From fd2ffeb310a19bbad67dc688eb87f23f3fb64182 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 27 Nov 2006 14:52:07 +0000 Subject: [PATCH] Renamed osg::CameraNode to osg::Camera, cleaned up osg::View. Added beginnings of new osgViewer::Scene,View,Viewer,CompositeViewer and GraphicsWindowProxy files. --- VisualStudio/highlight70.reg | 2 +- VisualStudio/highlight71.reg | 2 +- VisualStudio/highlight80.reg | 2 +- VisualStudio/osg/osg.dsp | 4 +- VisualStudio/osgPlugins/ive/ive.dsp | 4 +- VisualStudio/osgPlugins/osg/dot_osg.dsp | 2 +- VisualStudio/osgViewer/osgViewer.dsp | 36 ++ VisualStudio/osgWrappers/osg/wrapper_osg.dsp | 2 +- .../osgViewer/wrapper_osgViewer.dsp | 18 +- .../OpenSceneGraph.xcodeproj/project.pbxproj | 40 +- .../OSG Application/osgApp_Prefix.pch | 2 +- examples/osgcamera/osgcamera.cpp | 6 +- .../osgdepthpartition/DepthPartitionNode.cpp | 32 +- .../osgdepthpartition/DepthPartitionNode.h | 22 +- .../osgdepthpartition/DistanceAccumulator.cpp | 2 +- examples/osgdepthshadow/osgdepthshadow.cpp | 34 +- examples/osgdistortion/osgdistortion.cpp | 16 +- examples/osghud/osghud.cpp | 14 +- .../osgmultiplecameras/osgmultiplecameras.cpp | 8 +- examples/osgpick/osgpick.cpp | 6 +- examples/osgprerender/osgprerender.cpp | 26 +- .../osgprerendercubemap.cpp | 42 +- .../osgshadowtexture/CreateShadowedScene.cpp | 36 +- examples/osgtext/osgtext.cpp | 4 +- include/osg/Camera | 404 ++++++++++++++++++ include/osg/CameraNode | 385 +---------------- include/osg/FrameBufferObject | 4 +- include/osg/NodeVisitor | 6 +- include/osg/Transform | 8 +- include/osg/View | 139 ++---- include/osgShadow/ParallelSplitShadowMap | 2 +- include/osgShadow/ShadowMap | 2 +- include/osgShadow/ShadowTechnique | 2 +- include/osgShadow/ShadowTexture | 2 +- include/osgShadow/ShadowVolume | 2 +- include/osgShadow/ShadowedScene | 2 +- include/osgSim/ImpostorSprite | 10 +- include/osgSim/OverlayNode | 8 +- include/osgUtil/CullVisitor | 4 +- include/osgUtil/IntersectVisitor | 2 +- include/osgUtil/IntersectionVisitor | 2 +- include/osgUtil/RenderStage | 14 +- include/osgUtil/SceneView | 10 +- include/osgViewer/CompositeViewer | 68 +++ include/osgViewer/GraphicsWindowProxy | 88 ++++ include/osgViewer/Scene | 87 ++++ include/osgViewer/SimpleViewer | 4 +- include/osgViewer/View | 58 +++ include/osgViewer/Viewer | 61 +++ src/osg/AnimationPath.cpp | 4 +- src/osg/{CameraNode.cpp => Camera.cpp} | 62 +-- src/osg/FrameBufferObject.cpp | 6 +- src/osg/GNUmakefile | 2 +- src/osg/Node.cpp | 2 +- src/osg/NodeTrackerCallback.cpp | 4 +- src/osg/Transform.cpp | 30 +- src/osg/View.cpp | 190 ++------ .../Inventor/ConvertFromInventor.cpp | 4 +- src/osgPlugins/dae/daeWSceneObjects.cpp | 2 +- src/osgPlugins/dae/daeWriter.h | 4 +- .../ive/{CameraNode.cpp => Camera.cpp} | 28 +- src/osgPlugins/ive/DataInputStream.cpp | 8 +- src/osgPlugins/ive/DataOutputStream.cpp | 6 +- src/osgPlugins/ive/GNUmakefile | 2 +- src/osgPlugins/ive/ReadWrite.h | 2 +- .../osg/{CameraNode.cpp => Camera.cpp} | 199 ++++----- src/osgPlugins/osg/GNUmakefile | 2 +- src/osgProducer/OsgCameraGroup.cpp | 22 +- src/osgProducer/Viewer.cpp | 5 +- src/osgSim/Impostor.cpp | 12 +- src/osgSim/OverlayNode.cpp | 10 +- src/osgText/FadeText.cpp | 4 +- src/osgUtil/CullVisitor.cpp | 12 +- src/osgUtil/IntersectVisitor.cpp | 8 +- src/osgUtil/IntersectionVisitor.cpp | 10 +- src/osgUtil/RenderStage.cpp | 80 ++-- src/osgUtil/SceneView.cpp | 4 +- src/osgViewer/CompositeViewer.cpp | 24 ++ src/osgViewer/GNUmakefile | 2 + src/osgViewer/Scene.cpp | 122 ++++++ src/osgViewer/SimpleViewer.cpp | 4 +- src/osgViewer/View.cpp | 24 ++ src/osgViewer/Viewer.cpp | 24 ++ .../osg/{CameraNode.cpp => Camera.cpp} | 116 ++--- src/osgWrappers/osg/FrameBufferObject.cpp | 6 +- src/osgWrappers/osg/GNUmakefile | 2 +- src/osgWrappers/osg/Matrixd.cpp | 12 +- src/osgWrappers/osg/Matrixf.cpp | 12 +- src/osgWrappers/osg/NodeTrackerCallback.cpp | 2 +- src/osgWrappers/osg/NodeVisitor.cpp | 11 +- src/osgWrappers/osg/Plane.cpp | 4 + src/osgWrappers/osg/View.cpp | 192 ++------- src/osgWrappers/osgGA/GUIEventHandler.cpp | 10 - src/osgWrappers/osgProducer/GNUmakefile | 2 +- .../osgShadow/OccluderGeometry.cpp | 108 ++++- src/osgWrappers/osgSim/ImpostorSprite.cpp | 20 +- src/osgWrappers/osgSim/OverlayNode.cpp | 14 +- src/osgWrappers/osgUtil/CullVisitor.cpp | 6 +- src/osgWrappers/osgUtil/IntersectVisitor.cpp | 6 +- .../osgUtil/IntersectionVisitor.cpp | 6 +- src/osgWrappers/osgUtil/Optimizer.cpp | 4 + src/osgWrappers/osgUtil/RenderStage.cpp | 33 +- src/osgWrappers/osgUtil/SceneView.cpp | 20 +- src/osgWrappers/osgViewer/CompositeViewer.cpp | 88 ++++ src/osgWrappers/osgViewer/GNUmakefile | 6 +- .../osgViewer/GraphicsWindowProxy.cpp | 86 ++++ src/osgWrappers/osgViewer/Scene.cpp | 111 +++++ src/osgWrappers/osgViewer/SimpleViewer.cpp | 38 +- src/osgWrappers/osgViewer/View.cpp | 84 ++++ src/osgWrappers/osgViewer/Viewer.cpp | 64 +++ 110 files changed, 2257 insertions(+), 1466 deletions(-) create mode 100644 include/osg/Camera create mode 100644 include/osgViewer/CompositeViewer create mode 100644 include/osgViewer/GraphicsWindowProxy create mode 100644 include/osgViewer/Scene create mode 100644 include/osgViewer/View create mode 100644 include/osgViewer/Viewer rename src/osg/{CameraNode.cpp => Camera.cpp} (74%) rename src/osgPlugins/ive/{CameraNode.cpp => Camera.cpp} (86%) rename src/osgPlugins/osg/{CameraNode.cpp => Camera.cpp} (56%) create mode 100644 src/osgViewer/CompositeViewer.cpp create mode 100644 src/osgViewer/Scene.cpp create mode 100644 src/osgViewer/View.cpp create mode 100644 src/osgViewer/Viewer.cpp rename src/osgWrappers/osg/{CameraNode.cpp => Camera.cpp} (84%) create mode 100644 src/osgWrappers/osgViewer/CompositeViewer.cpp create mode 100644 src/osgWrappers/osgViewer/GraphicsWindowProxy.cpp create mode 100644 src/osgWrappers/osgViewer/Scene.cpp create mode 100644 src/osgWrappers/osgViewer/View.cpp create mode 100644 src/osgWrappers/osgViewer/Viewer.cpp diff --git a/VisualStudio/highlight70.reg b/VisualStudio/highlight70.reg index 78c4ad6ea..f6e427eb3 100644 --- a/VisualStudio/highlight70.reg +++ b/VisualStudio/highlight70.reg @@ -24,7 +24,7 @@ Windows Registry Editor Version 5.00 "buffered_value"="" "BufferObject"="" "BumpMapping"="" -"CameraNode"="" +"Camera"="" "CameraView"="" "Cartoon"="" "CenteredPlacer"="" diff --git a/VisualStudio/highlight71.reg b/VisualStudio/highlight71.reg index b44968948..de23560bf 100644 --- a/VisualStudio/highlight71.reg +++ b/VisualStudio/highlight71.reg @@ -24,7 +24,7 @@ Windows Registry Editor Version 5.00 "buffered_value"="" "BufferObject"="" "BumpMapping"="" -"CameraNode"="" +"Camera"="" "CameraView"="" "Cartoon"="" "CenteredPlacer"="" diff --git a/VisualStudio/highlight80.reg b/VisualStudio/highlight80.reg index 84afc3aa9..39e5b4fff 100644 --- a/VisualStudio/highlight80.reg +++ b/VisualStudio/highlight80.reg @@ -24,7 +24,7 @@ Windows Registry Editor Version 5.00 "buffered_value"="" "BufferObject"="" "BumpMapping"="" -"CameraNode"="" +"Camera"="" "CameraView"="" "Cartoon"="" "CenteredPlacer"="" diff --git a/VisualStudio/osg/osg.dsp b/VisualStudio/osg/osg.dsp index 409ced31a..cd47158f9 100755 --- a/VisualStudio/osg/osg.dsp +++ b/VisualStudio/osg/osg.dsp @@ -208,7 +208,7 @@ SOURCE=..\..\src\osg\BufferObject.cpp # End Source File # Begin Source File -SOURCE=..\..\src\osg\CameraNode.cpp +SOURCE=..\..\src\osg\Camera.cpp # End Source File # Begin Source File @@ -676,7 +676,7 @@ SOURCE=..\..\include\osg\BufferObject # End Source File # Begin Source File -SOURCE=..\..\include\osg\CameraNode +SOURCE=..\..\include\osg\Camera # End Source File # Begin Source File diff --git a/VisualStudio/osgPlugins/ive/ive.dsp b/VisualStudio/osgPlugins/ive/ive.dsp index 143a7f5a0..f67ef5cb7 100755 --- a/VisualStudio/osgPlugins/ive/ive.dsp +++ b/VisualStudio/osgPlugins/ive/ive.dsp @@ -193,7 +193,7 @@ SOURCE=..\..\..\src\osgPlugins\ive\BlinkSequence.cpp # End Source File # Begin Source File -SOURCE=..\..\..\src\osgPlugins\ive\CameraNode.cpp +SOURCE=..\..\..\src\osgPlugins\ive\Camera.cpp # End Source File # Begin Source File @@ -553,7 +553,7 @@ SOURCE=..\..\..\src\osgPlugins\ive\BlinkSequence.h # End Source File # Begin Source File -SOURCE=..\..\..\src\osgPlugins\ive\CameraNode.h +SOURCE=..\..\..\src\osgPlugins\ive\Camera.h # End Source File # Begin Source File diff --git a/VisualStudio/osgPlugins/osg/dot_osg.dsp b/VisualStudio/osgPlugins/osg/dot_osg.dsp index 0920c3176..ffc53aede 100755 --- a/VisualStudio/osgPlugins/osg/dot_osg.dsp +++ b/VisualStudio/osgPlugins/osg/dot_osg.dsp @@ -177,7 +177,7 @@ SOURCE=..\..\..\src\osgPlugins\osg\BlendFunc.cpp # End Source File # Begin Source File -SOURCE=..\..\..\src\osgPlugins\osg\CameraNode.cpp +SOURCE=..\..\..\src\osgPlugins\osg\Camera.cpp # End Source File # Begin Source File diff --git a/VisualStudio/osgViewer/osgViewer.dsp b/VisualStudio/osgViewer/osgViewer.dsp index 2624b5e39..431e2ef65 100644 --- a/VisualStudio/osgViewer/osgViewer.dsp +++ b/VisualStudio/osgViewer/osgViewer.dsp @@ -155,6 +155,22 @@ LIB32=link.exe -lib # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File +SOURCE=..\..\src\osgViewer\View.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\osgViewer\Viewer.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\osgViewer\CompositeViewer.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\osgViewer\Scene.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\osgViewer\SimpleViewer.cpp # End Source File # Begin Source File @@ -175,6 +191,26 @@ SOURCE=..\..\Include\osgViewer\GraphicsWindow # End Source File # Begin Source File +SOURCE=..\..\Include\osgViewer\GraphicsWindowProxy +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgViewer\Scene +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgViewer\View +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgViewer\Viewer +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgViewer\CompositeViewer +# End Source File +# Begin Source File + SOURCE=..\..\Include\osgViewer\SimpleViewer # End Source File # Begin Source File diff --git a/VisualStudio/osgWrappers/osg/wrapper_osg.dsp b/VisualStudio/osgWrappers/osg/wrapper_osg.dsp index df946b9f6..38f7541e6 100644 --- a/VisualStudio/osgWrappers/osg/wrapper_osg.dsp +++ b/VisualStudio/osgWrappers/osg/wrapper_osg.dsp @@ -148,7 +148,7 @@ SOURCE=..\..\..\src\osgWrappers\osg\BufferObject.cpp # End Source File # Begin Source File -SOURCE=..\..\..\src\osgWrappers\osg\CameraNode.cpp +SOURCE=..\..\..\src\osgWrappers\osg\Camera.cpp # End Source File # Begin Source File diff --git a/VisualStudio/osgWrappers/osgViewer/wrapper_osgViewer.dsp b/VisualStudio/osgWrappers/osgViewer/wrapper_osgViewer.dsp index 6fbd8e853..fe55b6590 100644 --- a/VisualStudio/osgWrappers/osgViewer/wrapper_osgViewer.dsp +++ b/VisualStudio/osgWrappers/osgViewer/wrapper_osgViewer.dsp @@ -96,17 +96,33 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\..\..\src\osgWrappers\osgViewer\Export.cpp +SOURCE=..\..\..\src\osgWrappers\osgViewer\CompositeViewer.cpp # End Source File # Begin Source File SOURCE=..\..\..\src\osgWrappers\osgViewer\GraphicsWindow.cpp # End Source File +# Begin Source File +SOURCE=..\..\..\src\osgWrappers\osgViewer\GraphicsWindowProxy.cpp +# End Source File + +# Begin Source File +SOURCE=..\..\..\src\osgWrappers\osgViewer\Scene.cpp +# End Source File + # Begin Source File SOURCE=..\..\..\src\osgWrappers\osgViewer\SimpleViewer.cpp # End Source File +# Begin Source File +SOURCE=..\..\..\src\osgWrappers\osgViewer\View.cpp +# End Source File + +# Begin Source File +SOURCE=..\..\..\src\osgWrappers\osgViewer\Viewer.cpp +# End Source File + # End Group # Begin Group "Header Files" diff --git a/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj b/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj index d98156aa1..94c5535c8 100644 --- a/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj +++ b/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj @@ -1509,10 +1509,10 @@ 006CE73809218D9400985402 /* Viewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE73209218D9300985402 /* Viewport.cpp */; }; 006CE73909218D9400985402 /* Viewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 006CE73309218D9300985402 /* Viewport.h */; }; 006CE73B09218DEE00985402 /* Scissor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE73A09218DEE00985402 /* Scissor.cpp */; }; - 006CE73E09218E2400985402 /* CameraNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE73C09218E2300985402 /* CameraNode.cpp */; }; + 006CE73E09218E2400985402 /* Camera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE73C09218E2300985402 /* Camera.cpp */; }; 006CE73F09218E2400985402 /* CameraView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE73D09218E2400985402 /* CameraView.cpp */; }; - 006CE74409218E6900985402 /* CameraNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE74009218E6800985402 /* CameraNode.cpp */; }; - 006CE74509218E6900985402 /* CameraNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 006CE74109218E6800985402 /* CameraNode.h */; }; + 006CE74409218E6900985402 /* Camera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE74009218E6800985402 /* Camera.cpp */; }; + 006CE74509218E6900985402 /* Camera.h in Headers */ = {isa = PBXBuildFile; fileRef = 006CE74109218E6800985402 /* Camera.h */; }; 006CE74609218E6900985402 /* CameraView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 006CE74209218E6800985402 /* CameraView.cpp */; }; 006CE74709218E6900985402 /* CameraView.h in Headers */ = {isa = PBXBuildFile; fileRef = 006CE74309218E6900985402 /* CameraView.h */; }; 006CE7FF092195B500985402 /* OverlayNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C5FA0919637300B255F2 /* OverlayNode.cpp */; }; @@ -1707,7 +1707,7 @@ 0096C51309195DBF00B255F2 /* StateGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C51109195DBE00B255F2 /* StateGraph.cpp */; }; 0096C51409195E3E00B255F2 /* PositionalStateContainer in Headers */ = {isa = PBXBuildFile; fileRef = 0096C50C09195D8B00B255F2 /* PositionalStateContainer */; settings = {ATTRIBUTES = (Public, ); }; }; 0096C51509195E3E00B255F2 /* StateGraph in Headers */ = {isa = PBXBuildFile; fileRef = 0096C50D09195D8B00B255F2 /* StateGraph */; settings = {ATTRIBUTES = (Public, ); }; }; - 0096C54309195F3E00B255F2 /* CameraNode in Headers */ = {isa = PBXBuildFile; fileRef = 0096C51909195F1000B255F2 /* CameraNode */; settings = {ATTRIBUTES = (Public, ); }; }; + 0096C54309195F3E00B255F2 /* Camera in Headers */ = {isa = PBXBuildFile; fileRef = 0096C51909195F1000B255F2 /* Camera */; settings = {ATTRIBUTES = (Public, ); }; }; 0096C54409195F3E00B255F2 /* CameraView in Headers */ = {isa = PBXBuildFile; fileRef = 0096C51A09195F1000B255F2 /* CameraView */; settings = {ATTRIBUTES = (Public, ); }; }; 0096C54509195F3E00B255F2 /* FrameBufferObject in Headers */ = {isa = PBXBuildFile; fileRef = 0096C51B09195F1000B255F2 /* FrameBufferObject */; settings = {ATTRIBUTES = (Public, ); }; }; 0096C54609195F3E00B255F2 /* GraphicsContext in Headers */ = {isa = PBXBuildFile; fileRef = 0096C51C09195F1000B255F2 /* GraphicsContext */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -1721,7 +1721,7 @@ 0096C54E09195F3E00B255F2 /* Vec4b in Headers */ = {isa = PBXBuildFile; fileRef = 0096C52409195F1200B255F2 /* Vec4b */; settings = {ATTRIBUTES = (Public, ); }; }; 0096C54F09195F3E00B255F2 /* Vec4s in Headers */ = {isa = PBXBuildFile; fileRef = 0096C52509195F1300B255F2 /* Vec4s */; settings = {ATTRIBUTES = (Public, ); }; }; 0096C55009195F3E00B255F2 /* Vec4ub in Headers */ = {isa = PBXBuildFile; fileRef = 0096C52609195F1300B255F2 /* Vec4ub */; settings = {ATTRIBUTES = (Public, ); }; }; - 0096C55A09195FE500B255F2 /* CameraNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C55309195FE300B255F2 /* CameraNode.cpp */; }; + 0096C55A09195FE500B255F2 /* Camera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C55309195FE300B255F2 /* Camera.cpp */; }; 0096C55B09195FE500B255F2 /* CameraView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C55409195FE300B255F2 /* CameraView.cpp */; }; 0096C55C09195FE500B255F2 /* FrameBufferObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C55509195FE400B255F2 /* FrameBufferObject.cpp */; }; 0096C55D09195FE500B255F2 /* GraphicsContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0096C55609195FE400B255F2 /* GraphicsContext.cpp */; }; @@ -5521,10 +5521,10 @@ 006CE73209218D9300985402 /* Viewport.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = Viewport.cpp; sourceTree = ""; }; 006CE73309218D9300985402 /* Viewport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Viewport.h; sourceTree = ""; }; 006CE73A09218DEE00985402 /* Scissor.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = Scissor.cpp; sourceTree = ""; }; - 006CE73C09218E2300985402 /* CameraNode.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = CameraNode.cpp; sourceTree = ""; }; + 006CE73C09218E2300985402 /* Camera.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = Camera.cpp; sourceTree = ""; }; 006CE73D09218E2400985402 /* CameraView.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = CameraView.cpp; sourceTree = ""; }; - 006CE74009218E6800985402 /* CameraNode.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = CameraNode.cpp; sourceTree = ""; }; - 006CE74109218E6800985402 /* CameraNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CameraNode.h; sourceTree = ""; }; + 006CE74009218E6800985402 /* Camera.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = Camera.cpp; sourceTree = ""; }; + 006CE74109218E6800985402 /* Camera.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Camera.h; sourceTree = ""; }; 006CE74209218E6800985402 /* CameraView.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; path = CameraView.cpp; sourceTree = ""; }; 006CE74309218E6900985402 /* CameraView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CameraView.h; sourceTree = ""; }; 006CE90B0921A83D00985402 /* osgcamera.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = osgcamera.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -5651,7 +5651,7 @@ 0096C50D09195D8B00B255F2 /* StateGraph */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = StateGraph; path = ../../include/osgUtil/StateGraph; sourceTree = SOURCE_ROOT; }; 0096C51009195DBE00B255F2 /* PositionalStateContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PositionalStateContainer.cpp; path = ../../src/osgUtil/PositionalStateContainer.cpp; sourceTree = SOURCE_ROOT; }; 0096C51109195DBE00B255F2 /* StateGraph.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = StateGraph.cpp; path = ../../src/osgUtil/StateGraph.cpp; sourceTree = SOURCE_ROOT; }; - 0096C51909195F1000B255F2 /* CameraNode */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CameraNode; sourceTree = ""; }; + 0096C51909195F1000B255F2 /* Camera */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Camera; sourceTree = ""; }; 0096C51A09195F1000B255F2 /* CameraView */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CameraView; sourceTree = ""; }; 0096C51B09195F1000B255F2 /* FrameBufferObject */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = FrameBufferObject; sourceTree = ""; }; 0096C51C09195F1000B255F2 /* GraphicsContext */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = GraphicsContext; sourceTree = ""; }; @@ -5665,7 +5665,7 @@ 0096C52409195F1200B255F2 /* Vec4b */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Vec4b; sourceTree = ""; }; 0096C52509195F1300B255F2 /* Vec4s */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Vec4s; sourceTree = ""; }; 0096C52609195F1300B255F2 /* Vec4ub */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Vec4ub; sourceTree = ""; }; - 0096C55309195FE300B255F2 /* CameraNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CameraNode.cpp; sourceTree = ""; }; + 0096C55309195FE300B255F2 /* Camera.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Camera.cpp; sourceTree = ""; }; 0096C55409195FE300B255F2 /* CameraView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CameraView.cpp; sourceTree = ""; }; 0096C55509195FE400B255F2 /* FrameBufferObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FrameBufferObject.cpp; sourceTree = ""; }; 0096C55609195FE400B255F2 /* GraphicsContext.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext.cpp; sourceTree = ""; }; @@ -8780,7 +8780,7 @@ 001D02A3065AACB6003310BF /* AnimationPath.cpp */, 001D02A4065AACB6003310BF /* Billboard.cpp */, 001D02A5065AACB6003310BF /* BlendFunc.cpp */, - 006CE73C09218E2300985402 /* CameraNode.cpp */, + 006CE73C09218E2300985402 /* Camera.cpp */, 006CE73D09218E2400985402 /* CameraView.cpp */, 001D02A6065AACB6003310BF /* ClearNode.cpp */, 0079500C09D36132003FC8A1 /* ClusterCullingCallback.cpp */, @@ -8989,8 +8989,8 @@ 0079500309D360F6003FC8A1 /* Depth.h */, 0079500409D360F7003FC8A1 /* TextureRectangle.cpp */, 0079500509D360F7003FC8A1 /* TextureRectangle.h */, - 006CE74009218E6800985402 /* CameraNode.cpp */, - 006CE74109218E6800985402 /* CameraNode.h */, + 006CE74009218E6800985402 /* Camera.cpp */, + 006CE74109218E6800985402 /* Camera.h */, 006CE74209218E6800985402 /* CameraView.cpp */, 006CE74309218E6900985402 /* CameraView.h */, 006CE72E09218D9200985402 /* PolygonMode.cpp */, @@ -10833,7 +10833,7 @@ BE117FC105D63B8900EB53E5 /* BoundingBox.cpp */, BE117FC205D63B8900EB53E5 /* BoundingSphere.cpp */, 009D9F99081D7216001FA987 /* BufferObject.cpp */, - 0096C55309195FE300B255F2 /* CameraNode.cpp */, + 0096C55309195FE300B255F2 /* Camera.cpp */, 0096C55409195FE300B255F2 /* CameraView.cpp */, 004E4CF00A51F17800EC8521 /* ClampColor.cpp */, BE117FC305D63B8900EB53E5 /* ClearNode.cpp */, @@ -10979,7 +10979,7 @@ BE1181F905D63C0900EB53E5 /* BoundsChecking */, BE1181FA05D63C0900EB53E5 /* buffered_value */, 009D9F89081D717F001FA987 /* BufferObject */, - 0096C51909195F1000B255F2 /* CameraNode */, + 0096C51909195F1000B255F2 /* Camera */, 0096C51A09195F1000B255F2 /* CameraView */, 004E4CD70A51F12700EC8521 /* ClampColor */, BE1181FB05D63C0900EB53E5 /* ClearNode */, @@ -11818,7 +11818,7 @@ 006CE73509218D9400985402 /* PolygonMode.h in Headers */, 006CE73709218D9400985402 /* Scissor.h in Headers */, 006CE73909218D9400985402 /* Viewport.h in Headers */, - 006CE74509218E6900985402 /* CameraNode.h in Headers */, + 006CE74509218E6900985402 /* Camera.h in Headers */, 006CE74709218E6900985402 /* CameraView.h in Headers */, 0079500709D360F7003FC8A1 /* AutoTransform.h in Headers */, 0079500909D360F7003FC8A1 /* Depth.h in Headers */, @@ -12679,7 +12679,7 @@ BE11842C05D70D1800EB53E5 /* BoundsChecking in Headers */, BE11842D05D70D1800EB53E5 /* buffered_value in Headers */, 009D9FB3081D7392001FA987 /* BufferObject in Headers */, - 0096C54309195F3E00B255F2 /* CameraNode in Headers */, + 0096C54309195F3E00B255F2 /* Camera in Headers */, 0096C54409195F3E00B255F2 /* CameraView in Headers */, 004E4CD80A51F12800EC8521 /* ClampColor in Headers */, BE11842E05D70D1800EB53E5 /* ClearNode in Headers */, @@ -17264,7 +17264,7 @@ 00A14B36084D61B2000150AD /* Uniform.cpp in Sources */, 00A14B37084D61B2000150AD /* Viewport.cpp in Sources */, 006CE73B09218DEE00985402 /* Scissor.cpp in Sources */, - 006CE73E09218E2400985402 /* CameraNode.cpp in Sources */, + 006CE73E09218E2400985402 /* Camera.cpp in Sources */, 006CE73F09218E2400985402 /* CameraView.cpp in Sources */, 0079500D09D36132003FC8A1 /* ClusterCullingCallback.cpp in Sources */, ); @@ -17453,7 +17453,7 @@ 006CE73409218D9400985402 /* PolygonMode.cpp in Sources */, 006CE73609218D9400985402 /* Scissor.cpp in Sources */, 006CE73809218D9400985402 /* Viewport.cpp in Sources */, - 006CE74409218E6900985402 /* CameraNode.cpp in Sources */, + 006CE74409218E6900985402 /* Camera.cpp in Sources */, 006CE74609218E6900985402 /* CameraView.cpp in Sources */, 0079500609D360F7003FC8A1 /* AutoTransform.cpp in Sources */, 0079500809D360F7003FC8A1 /* Depth.cpp in Sources */, @@ -18425,7 +18425,7 @@ 009D9FA5081D7218001FA987 /* Shader.cpp in Sources */, 009D9FA6081D7218001FA987 /* StateAttribute.cpp in Sources */, 009D9FA7081D7218001FA987 /* Uniform.cpp in Sources */, - 0096C55A09195FE500B255F2 /* CameraNode.cpp in Sources */, + 0096C55A09195FE500B255F2 /* Camera.cpp in Sources */, 0096C55B09195FE500B255F2 /* CameraView.cpp in Sources */, 0096C55C09195FE500B255F2 /* FrameBufferObject.cpp in Sources */, 0096C55D09195FE500B255F2 /* GraphicsContext.cpp in Sources */, diff --git a/Xcode/XcodeTemplates/OSG Application/osgApp_Prefix.pch b/Xcode/XcodeTemplates/OSG Application/osgApp_Prefix.pch index 66d91f159..9ddd21313 100644 --- a/Xcode/XcodeTemplates/OSG Application/osgApp_Prefix.pch +++ b/Xcode/XcodeTemplates/OSG Application/osgApp_Prefix.pch @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/osgcamera/osgcamera.cpp b/examples/osgcamera/osgcamera.cpp index 2d5988324..15bbfdf83 100644 --- a/examples/osgcamera/osgcamera.cpp +++ b/examples/osgcamera/osgcamera.cpp @@ -181,7 +181,7 @@ int main( int argc, char **argv ) osgUtil::UpdateVisitor updateVisitor; updateVisitor.setFrameStamp(frameStamp.get()); - typedef std::list< osg::ref_ptr > CameraList; + typedef std::list< osg::ref_ptr > CameraList; typedef std::set< osg::GraphicsContext* > GraphicsContextSet; CameraList cameraList; @@ -192,7 +192,7 @@ int main( int argc, char **argv ) osg::GraphicsContext* previousContext = 0; for(unsigned int i=0; i< numberCameras; ++i) { - osg::ref_ptr camera = new osg::CameraNode; + osg::ref_ptr camera = new osg::Camera; camera->addChild(loadedModel.get()); osg::ref_ptr traits = new osg::GraphicsContext::Traits; @@ -284,7 +284,7 @@ int main( int argc, char **argv ) citr != cameraList.end(); ++citr) { - osg::CameraNode* camera = citr->get(); + osg::Camera* camera = citr->get(); osg::GraphicsThread* graphicsThread = camera->getGraphicsContext()->getGraphicsThread(); // create a scene view to do the cull and draw diff --git a/examples/osgdepthpartition/DepthPartitionNode.cpp b/examples/osgdepthpartition/DepthPartitionNode.cpp index 7ee730a0b..559ce09cd 100644 --- a/examples/osgdepthpartition/DepthPartitionNode.cpp +++ b/examples/osgdepthpartition/DepthPartitionNode.cpp @@ -28,7 +28,7 @@ void CURRENT_CLASS::init() _active = true; _numCameras = 0; setCullingActive(false); - _renderOrder = osg::CameraNode::POST_RENDER; + _renderOrder = osg::Camera::POST_RENDER; _clearColorBuffer = true; } @@ -42,7 +42,7 @@ void CURRENT_CLASS::setClearColorBuffer(bool clear) { _clearColorBuffer = clear; - // Update the render order for the first CameraNode if it exists + // Update the render order for the first Camera if it exists if(!_cameraList.empty()) { if(clear) @@ -52,11 +52,11 @@ void CURRENT_CLASS::setClearColorBuffer(bool clear) } } -void CURRENT_CLASS::setRenderOrder(osg::CameraNode::RenderOrder order) +void CURRENT_CLASS::setRenderOrder(osg::Camera::RenderOrder order) { _renderOrder = order; - // Update the render order for existing CameraNodes + // Update the render order for existing Cameras unsigned int numCameras = _cameraList.size(); for(unsigned int i = 0; i < numCameras; i++) { @@ -104,18 +104,18 @@ void CURRENT_CLASS::traverse(osg::NodeVisitor &nv) _children[i]->accept(*(_distAccumulator.get())); } - // Step 2: Compute the near and far distances for every CameraNode that + // Step 2: Compute the near and far distances for every Camera that // should be used to render the scene. _distAccumulator->computeCameraPairs(); - // Step 3: Create the CameraNodes, and add them as children. + // Step 3: Create the Cameras, and add them as children. DistanceAccumulator::PairList& camPairs = _distAccumulator->getCameraPairs(); _numCameras = camPairs.size(); // Get the number of cameras - // Create the CameraNodes, and add them as children. + // Create the Cameras, and add them as children. if(_numCameras > 0) { - osg::CameraNode *currCam; + osg::Camera *currCam; DistanceAccumulator::DistancePair currPair; for(i = 0; i < _numCameras; i++) @@ -147,7 +147,7 @@ bool CURRENT_CLASS::insertChild(unsigned int index, osg::Node *child) { if(!Group::insertChild(index, child)) return false; // Insert child - // Insert child into each CameraNode + // Insert child into each Camera unsigned int totalCameras = _cameraList.size(); for(unsigned int i = 0; i < totalCameras; i++) { @@ -161,7 +161,7 @@ bool CURRENT_CLASS::removeChildren(unsigned int pos, unsigned int numRemove) { if(!Group::removeChildren(pos, numRemove)) return false; // Remove child - // Remove child from each CameraNode + // Remove child from each Camera unsigned int totalCameras = _cameraList.size(); for(unsigned int i = 0; i < totalCameras; i++) { @@ -174,7 +174,7 @@ bool CURRENT_CLASS::setChild(unsigned int i, osg::Node *node) { if(!Group::setChild(i, node)) return false; // Set child - // Set child for each CameraNode + // Set child for each Camera unsigned int totalCameras = _cameraList.size(); for(unsigned int j = 0; j < totalCameras; j++) { @@ -183,16 +183,16 @@ bool CURRENT_CLASS::setChild(unsigned int i, osg::Node *node) return true; } -osg::CameraNode* CURRENT_CLASS::createOrReuseCamera(const osg::Matrix& proj, +osg::Camera* CURRENT_CLASS::createOrReuseCamera(const osg::Matrix& proj, double znear, double zfar, const unsigned int &camNum) { if(_cameraList.size() <= camNum) _cameraList.resize(camNum+1); - osg::CameraNode *camera = _cameraList[camNum].get(); + osg::Camera *camera = _cameraList[camNum].get(); - if(!camera) // Create a new CameraNode + if(!camera) // Create a new Camera { - camera = new osg::CameraNode; + camera = new osg::Camera; camera->setCullingActive(false); camera->setRenderOrder(_renderOrder); camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); @@ -206,7 +206,7 @@ osg::CameraNode* CURRENT_CLASS::createOrReuseCamera(const osg::Matrix& proj, else camera->setClearMask(GL_DEPTH_BUFFER_BIT); - // Add our children to the new CameraNode's children + // Add our children to the new Camera's children unsigned int numChildren = _children.size(); for(unsigned int i = 0; i < numChildren; i++) { diff --git a/examples/osgdepthpartition/DepthPartitionNode.h b/examples/osgdepthpartition/DepthPartitionNode.h index 2e7f84ac3..180629fbd 100644 --- a/examples/osgdepthpartition/DepthPartitionNode.h +++ b/examples/osgdepthpartition/DepthPartitionNode.h @@ -2,7 +2,7 @@ #define _OF_DEPTHPARTITIONNODE_ #include "DistanceAccumulator.h" -#include +#include #define CURRENT_CLASS DepthPartitionNode /********************************************************** @@ -28,13 +28,13 @@ class CURRENT_CLASS : public osg::Group inline bool getActive() const { return _active; } /** Specify whether the color buffer should be cleared before the first - CameraNode draws it's scene. */ + Camera draws it's scene. */ void setClearColorBuffer(bool clear); inline bool getClearColorBuffer() const { return _clearColorBuffer; } - /** Specify the render order for each CameraNode */ - void setRenderOrder(osg::CameraNode::RenderOrder order); - inline osg::CameraNode::RenderOrder getRenderOrder() const + /** Specify the render order for each Camera */ + void setRenderOrder(osg::Camera::RenderOrder order); + inline osg::Camera::RenderOrder getRenderOrder() const { return _renderOrder; } /** Set/get the maximum depth that the scene will be traversed to. @@ -48,7 +48,7 @@ class CURRENT_CLASS : public osg::Group /** Override update and cull traversals */ virtual void traverse(osg::NodeVisitor &nv); - /** Catch child management functions so the CameraNodes can be informed + /** Catch child management functions so the Cameras can be informed of added or removed children. */ virtual bool addChild(osg::Node *child); virtual bool insertChild(unsigned int index, osg::Node *child); @@ -56,14 +56,14 @@ class CURRENT_CLASS : public osg::Group virtual bool setChild(unsigned int i, osg::Node *node); protected: - typedef std::vector< osg::ref_ptr > CameraList; + typedef std::vector< osg::ref_ptr > CameraList; ~CURRENT_CLASS(); void init(); - // Creates a new CameraNode object with default settings - osg::CameraNode* createOrReuseCamera(const osg::Matrix& proj, + // Creates a new Camera object with default settings + osg::Camera* createOrReuseCamera(const osg::Matrix& proj, double znear, double zfar, const unsigned int &camNum); @@ -72,13 +72,13 @@ class CURRENT_CLASS : public osg::Group // The NodeVisitor that computes cameras for the scene osg::ref_ptr _distAccumulator; - osg::CameraNode::RenderOrder _renderOrder; + osg::Camera::RenderOrder _renderOrder; bool _clearColorBuffer; // Cameras that should be used to draw the scene. These cameras // will be reused on every frame in order to save time and memory. CameraList _cameraList; - unsigned int _numCameras; // Number of CameraNodes actually being used + unsigned int _numCameras; // Number of Cameras actually being used }; #undef CURRENT_CLASS diff --git a/examples/osgdepthpartition/DistanceAccumulator.cpp b/examples/osgdepthpartition/DistanceAccumulator.cpp index e1c1e7f73..fdfb87925 100644 --- a/examples/osgdepthpartition/DistanceAccumulator.cpp +++ b/examples/osgdepthpartition/DistanceAccumulator.cpp @@ -73,7 +73,7 @@ void CURRENT_CLASS::pushDistancePair(double zNear, double zFar) } /** Return true if the node should be traversed, and false if the bounding sphere - of the node is small enough to be rendered by one CameraNode. If the latter + of the node is small enough to be rendered by one Camera. If the latter is true, then store the node's near & far plane distances. */ bool CURRENT_CLASS::shouldContinueTraversal(osg::Node &node) { diff --git a/examples/osgdepthshadow/osgdepthshadow.cpp b/examples/osgdepthshadow/osgdepthshadow.cpp index d5a6d1a14..56b41a86f 100644 --- a/examples/osgdepthshadow/osgdepthshadow.cpp +++ b/examples/osgdepthshadow/osgdepthshadow.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -193,9 +193,9 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback { public: - UpdateCameraAndTexGenCallback(osg::MatrixTransform* light_transform, osg::CameraNode* cameraNode, osg::TexGenNode* texgenNode): + UpdateCameraAndTexGenCallback(osg::MatrixTransform* light_transform, osg::Camera* Camera, osg::TexGenNode* texgenNode): _light_transform(light_transform), - _cameraNode(cameraNode), + _Camera(Camera), _texgenNode(texgenNode) { } @@ -207,14 +207,14 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback // now compute the camera's view and projection matrix to point at the shadower (the camera's children) osg::BoundingSphere bs; - for(unsigned int i=0; i<_cameraNode->getNumChildren(); ++i) + for(unsigned int i=0; i<_Camera->getNumChildren(); ++i) { - bs.expandBy(_cameraNode->getChild(i)->getBound()); + bs.expandBy(_Camera->getChild(i)->getBound()); } if (!bs.valid()) { - osg::notify(osg::WARN) << "bb invalid"<<_cameraNode.get()<setReferenceFrame(osg::CameraNode::ABSOLUTE_RF); - _cameraNode->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar); - _cameraNode->setViewMatrixAsLookAt(position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f)); + _Camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); + _Camera->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar); + _Camera->setViewMatrixAsLookAt(position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f)); // compute the matrix which takes a vertex from local coords into tex coords // will use this later to specify osg::TexGen.. - osg::Matrix MVPT = _cameraNode->getViewMatrix() * - _cameraNode->getProjectionMatrix() * + osg::Matrix MVPT = _Camera->getViewMatrix() * + _Camera->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5f,0.5f,0.5f); @@ -255,7 +255,7 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback virtual ~UpdateCameraAndTexGenCallback() {} osg::ref_ptr _light_transform; - osg::ref_ptr _cameraNode; + osg::ref_ptr _Camera; osg::ref_ptr _texgenNode; }; @@ -307,11 +307,11 @@ osg::Group* createShadowedScene(osg::Node* shadowed,osg::MatrixTransform* light_ { // create the camera - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; camera->setClearMask(GL_DEPTH_BUFFER_BIT); camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); - camera->setComputeNearFarMode(osg::CameraNode::DO_NOT_COMPUTE_NEAR_FAR); + camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); // set viewport camera->setViewport(0,0,tex_width,tex_height); @@ -337,13 +337,13 @@ osg::Group* createShadowedScene(osg::Node* shadowed,osg::MatrixTransform* light_ // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + camera->setRenderOrder(osg::Camera::PRE_RENDER); // tell the camera to use OpenGL frame buffer object where supported. - camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT); + camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::DEPTH_BUFFER, texture); + camera->attach(osg::Camera::DEPTH_BUFFER, texture); // add subgraph to render camera->addChild(shadowed); diff --git a/examples/osgdistortion/osgdistortion.cpp b/examples/osgdistortion/osgdistortion.cpp index 0c446cc7f..0e0c1822f 100644 --- a/examples/osgdistortion/osgdistortion.cpp +++ b/examples/osgdistortion/osgdistortion.cpp @@ -39,7 +39,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC // set up the render to texture camera. { - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; // set clear the color and depth buffer camera->setClearColor(clearColour); @@ -54,13 +54,13 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC camera->setViewport(0,0,tex_width,tex_height); // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + camera->setRenderOrder(osg::Camera::PRE_RENDER); // tell the camera to use OpenGL frame buffer object where supported. - camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT); + camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::COLOR_BUFFER, texture); + camera->attach(osg::Camera::COLOR_BUFFER, texture); // add subgraph to render camera->addChild(subgraph); @@ -145,7 +145,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC geode->addDrawable(polyGeom); // set up the camera to render the textured quad - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; // just inherit the main cameras view camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); @@ -153,13 +153,13 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC camera->setProjectionMatrixAsOrtho2D(0,1280,0,1024); // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::NESTED_RENDER); + camera->setRenderOrder(osg::Camera::NESTED_RENDER); // tell the camera to use OpenGL frame buffer object where supported. - camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT); + camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::COLOR_BUFFER, texture); + camera->attach(osg::Camera::COLOR_BUFFER, texture); // add subgraph to render camera->addChild(geode); diff --git a/examples/osghud/osghud.cpp b/examples/osghud/osghud.cpp index 73ec4f9c3..bb74383c9 100644 --- a/examples/osghud/osghud.cpp +++ b/examples/osghud/osghud.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include @@ -69,7 +69,7 @@ osg::Node* createHUD() text->setFont(timesFont); text->setPosition(position); - text->setText("Then place an osg::CameraNode above the subgraph\n" + text->setText("Then place an osg::Camera above the subgraph\n" "to create an orthographic projection.\n"); position += delta; @@ -81,7 +81,7 @@ osg::Node* createHUD() text->setFont(timesFont); text->setPosition(position); - text->setText("Set the CameraNode's ReferenceFrame to ABSOLUTE_RF to ensure\n" + text->setText("Set the Camera's ReferenceFrame to ABSOLUTE_RF to ensure\n" "it remains independent from any external model view matrices."); position += delta; @@ -93,7 +93,7 @@ osg::Node* createHUD() text->setFont(timesFont); text->setPosition(position); - text->setText("And set the CameraNode's clear mask to just clear the depth buffer."); + text->setText("And set the Camera's clear mask to just clear the depth buffer."); position += delta; } @@ -104,7 +104,7 @@ osg::Node* createHUD() text->setFont(timesFont); text->setPosition(position); - text->setText("And finally set the CameraNode's RenderOrder to POST_RENDER\n" + text->setText("And finally set the Camera's RenderOrder to POST_RENDER\n" "to make sure its drawn last."); position += delta; @@ -148,7 +148,7 @@ osg::Node* createHUD() geode->addDrawable(geom); } - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; // set the projection matrix camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); @@ -161,7 +161,7 @@ osg::Node* createHUD() camera->setClearMask(GL_DEPTH_BUFFER_BIT); // draw subgraph after main camera view. - camera->setRenderOrder(osg::CameraNode::POST_RENDER); + camera->setRenderOrder(osg::Camera::POST_RENDER); camera->addChild(geode); diff --git a/examples/osgmultiplecameras/osgmultiplecameras.cpp b/examples/osgmultiplecameras/osgmultiplecameras.cpp index 75a4ba45a..663ff034c 100644 --- a/examples/osgmultiplecameras/osgmultiplecameras.cpp +++ b/examples/osgmultiplecameras/osgmultiplecameras.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -30,7 +30,7 @@ osg::Node* createRearView(osg::Node* subgraph, const osg::Vec4& clearColour) { - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; // set the viewport camera->setViewport(10,10,400,200); @@ -38,7 +38,7 @@ osg::Node* createRearView(osg::Node* subgraph, const osg::Vec4& clearColour) // set the view matrix camera->setCullingActive(false); camera->setReferenceFrame(osg::Transform::RELATIVE_RF); - camera->setTransformOrder(osg::CameraNode::POST_MULTIPLY); + camera->setTransformOrder(osg::Camera::POST_MULTIPLY); camera->setProjectionMatrix(osg::Matrixd::scale(-1.0f,1.0f,1.0f)); camera->setViewMatrix(osg::Matrixd::rotate(osg::inDegrees(180.0f),0.0f,1.0f,0.0f)); @@ -48,7 +48,7 @@ osg::Node* createRearView(osg::Node* subgraph, const osg::Vec4& clearColour) camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // draw subgraph after main camera view. - camera->setRenderOrder(osg::CameraNode::POST_RENDER); + camera->setRenderOrder(osg::Camera::POST_RENDER); // add the subgraph to draw. camera->addChild(subgraph); diff --git a/examples/osgpick/osgpick.cpp b/examples/osgpick/osgpick.cpp index 7b099251e..7f5b93133 100644 --- a/examples/osgpick/osgpick.cpp +++ b/examples/osgpick/osgpick.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -116,11 +116,11 @@ osg::Node* createHUD(osgText::Text* updateText) // eg to be used as a menuing/help system! // Can pick texts too! - osg::CameraNode* hudCamera = new osg::CameraNode; + osg::Camera* hudCamera = new osg::Camera; hudCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera->setProjectionMatrixAsOrtho2D(0,1280,0,1024); hudCamera->setViewMatrix(osg::Matrix::identity()); - hudCamera->setRenderOrder(osg::CameraNode::POST_RENDER); + hudCamera->setRenderOrder(osg::Camera::POST_RENDER); hudCamera->setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont("fonts/times.ttf"); diff --git a/examples/osgprerender/osgprerender.cpp b/examples/osgprerender/osgprerender.cpp index f3ab1a48b..4abe596fa 100644 --- a/examples/osgprerender/osgprerender.cpp +++ b/examples/osgprerender/osgprerender.cpp @@ -107,14 +107,14 @@ class MyGeometryCallback : }; -struct MyCameraPostDrawCallback : public osg::CameraNode::DrawCallback +struct MyCameraPostDrawCallback : public osg::Camera::DrawCallback { MyCameraPostDrawCallback(osg::Image* image): _image(image) { } - virtual void operator () (const osg::CameraNode& /*camera*/) const + virtual void operator () (const osg::Camera& /*camera*/) const { if (_image && _image->getPixelFormat()==GL_RGBA && _image->getDataType()==GL_UNSIGNED_BYTE) { @@ -177,7 +177,7 @@ struct MyCameraPostDrawCallback : public osg::CameraNode::DrawCallback }; -osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsigned tex_height, osg::CameraNode::RenderTargetImplementation renderImplementation, bool useImage, bool useTextureRectangle, bool useHDR) +osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsigned tex_height, osg::Camera::RenderTargetImplementation renderImplementation, bool useImage, bool useTextureRectangle, bool useHDR) { if (!subgraph) return 0; @@ -288,7 +288,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsi // then create the camera node to do the render to texture { - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; // set up the background color and clear mask. camera->setClearColor(osg::Vec4(0.1f,0.1f,0.3f,1.0f)); @@ -321,7 +321,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsi camera->setViewport(0,0,tex_width,tex_height); // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + camera->setRenderOrder(osg::Camera::PRE_RENDER); // tell the camera to use OpenGL frame buffer object where supported. camera->setRenderTargetImplementation(renderImplementation); @@ -334,7 +334,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsi image->allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_FLOAT); // attach the image so its copied on each frame. - camera->attach(osg::CameraNode::COLOR_BUFFER, image); + camera->attach(osg::Camera::COLOR_BUFFER, image); camera->setPostDrawCallback(new MyCameraPostDrawCallback(image)); @@ -351,7 +351,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsi else { // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::COLOR_BUFFER, texture); + camera->attach(osg::Camera::COLOR_BUFFER, texture); } @@ -404,13 +404,13 @@ int main( int argc, char **argv ) while (arguments.read("--width", tex_width)) {} while (arguments.read("--height", tex_height)) {} - osg::CameraNode::RenderTargetImplementation renderImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; + osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; - while (arguments.read("--fbo")) { renderImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; } - while (arguments.read("--pbuffer")) { renderImplementation = osg::CameraNode::PIXEL_BUFFER; } - while (arguments.read("--pbuffer-rtt")) { renderImplementation = osg::CameraNode::PIXEL_BUFFER_RTT; } - while (arguments.read("--fb")) { renderImplementation = osg::CameraNode::FRAME_BUFFER; } - while (arguments.read("--window")) { renderImplementation = osg::CameraNode::SEPERATE_WINDOW; } + while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; } + while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; } + while (arguments.read("--pbuffer-rtt")) { renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; } + while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; } + while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; } bool useImage = false; while (arguments.read("--image")) { useImage = true; } diff --git a/examples/osgprerendercubemap/osgprerendercubemap.cpp b/examples/osgprerendercubemap/osgprerendercubemap.cpp index da1c869b2..4819e7f77 100644 --- a/examples/osgprerendercubemap/osgprerendercubemap.cpp +++ b/examples/osgprerendercubemap/osgprerendercubemap.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include using namespace osg; @@ -111,11 +111,11 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback { public: - typedef std::vector< osg::ref_ptr > CameraList; + typedef std::vector< osg::ref_ptr > CameraList; - UpdateCameraAndTexGenCallback(osg::NodePath& reflectorNodePath, CameraList& cameraNodes): + UpdateCameraAndTexGenCallback(osg::NodePath& reflectorNodePath, CameraList& Cameras): _reflectorNodePath(reflectorNodePath), - _cameraNodes(cameraNodes) + _Cameras(Cameras) { } @@ -141,7 +141,7 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback }; for(unsigned int i=0; - i<6 && i<_cameraNodes.size(); + i<6 && i<_Cameras.size(); ++i) { osg::Matrix localOffset; @@ -149,9 +149,9 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback osg::Matrix viewMatrix = worldToLocal*localOffset; - _cameraNodes[i]->setReferenceFrame(osg::CameraNode::ABSOLUTE_RF); - _cameraNodes[i]->setProjectionMatrixAsFrustum(-1.0,1.0,-1.0,1.0,1.0,10000.0); - _cameraNodes[i]->setViewMatrix(viewMatrix); + _Cameras[i]->setReferenceFrame(osg::Camera::ABSOLUTE_RF); + _Cameras[i]->setProjectionMatrixAsFrustum(-1.0,1.0,-1.0,1.0,1.0,10000.0); + _Cameras[i]->setViewMatrix(viewMatrix); } } @@ -160,7 +160,7 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback virtual ~UpdateCameraAndTexGenCallback() {} osg::NodePath _reflectorNodePath; - CameraList _cameraNodes; + CameraList _Cameras; }; class TexMatCullCallback : public osg::NodeCallback @@ -191,7 +191,7 @@ class TexMatCullCallback : public osg::NodeCallback }; -osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath reflectorNodePath, unsigned int unit, const osg::Vec4& clearColor, unsigned tex_width, unsigned tex_height, osg::CameraNode::RenderTargetImplementation renderImplementation) +osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath reflectorNodePath, unsigned int unit, const osg::Vec4& clearColor, unsigned tex_width, unsigned tex_height, osg::Camera::RenderTargetImplementation renderImplementation) { osg::Group* group = new osg::Group; @@ -207,11 +207,11 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl texture->setFilter(osg::TextureCubeMap::MAG_FILTER,osg::TextureCubeMap::LINEAR); // set up the render to texture cameras. - UpdateCameraAndTexGenCallback::CameraList cameraNodes; + UpdateCameraAndTexGenCallback::CameraList Cameras; for(unsigned int i=0; i<6; ++i) { // create the camera - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera->setClearColor(clearColor); @@ -220,20 +220,20 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl camera->setViewport(0,0,tex_width,tex_height); // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + camera->setRenderOrder(osg::Camera::PRE_RENDER); // tell the camera to use OpenGL frame buffer object where supported. camera->setRenderTargetImplementation(renderImplementation); // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::COLOR_BUFFER, texture, 0, i); + camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, i); // add subgraph to render camera->addChild(reflectedSubgraph); group->addChild(camera); - cameraNodes.push_back(camera); + Cameras.push_back(camera); } // create the texgen node to project the tex coords onto the subgraph @@ -264,7 +264,7 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl group->addChild(reflectedSubgraph); // set an update callback to keep moving the camera and tex gen in the right direction. - group->setUpdateCallback(new UpdateCameraAndTexGenCallback(reflectorNodePath, cameraNodes)); + group->setUpdateCallback(new UpdateCameraAndTexGenCallback(reflectorNodePath, Cameras)); return group; } @@ -307,12 +307,12 @@ int main(int argc, char** argv) while (arguments.read("--width", tex_width)) {} while (arguments.read("--height", tex_height)) {} - osg::CameraNode::RenderTargetImplementation renderImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; + osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; - while (arguments.read("--fbo")) { renderImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; } - while (arguments.read("--pbuffer")) { renderImplementation = osg::CameraNode::PIXEL_BUFFER; } - while (arguments.read("--fb")) { renderImplementation = osg::CameraNode::FRAME_BUFFER; } - while (arguments.read("--window")) { renderImplementation = osg::CameraNode::SEPERATE_WINDOW; } + while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; } + while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; } + while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; } + while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; } // any option left unread are converted into errors to write out later. diff --git a/examples/osgshadowtexture/CreateShadowedScene.cpp b/examples/osgshadowtexture/CreateShadowedScene.cpp index 0da32a972..9fca651a3 100644 --- a/examples/osgshadowtexture/CreateShadowedScene.cpp +++ b/examples/osgshadowtexture/CreateShadowedScene.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -17,9 +17,9 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback { public: - UpdateCameraAndTexGenCallback(const osg::Vec3& position, osg::CameraNode* cameraNode, osg::TexGenNode* texgenNode): + UpdateCameraAndTexGenCallback(const osg::Vec3& position, osg::Camera* Camera, osg::TexGenNode* texgenNode): _position(position), - _cameraNode(cameraNode), + _Camera(Camera), _texgenNode(texgenNode) { } @@ -31,14 +31,14 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback // now compute the camera's view and projection matrix to point at the shadower (the camera's children) osg::BoundingSphere bs; - for(unsigned int i=0; i<_cameraNode->getNumChildren(); ++i) + for(unsigned int i=0; i<_Camera->getNumChildren(); ++i) { - bs.expandBy(_cameraNode->getChild(i)->getBound()); + bs.expandBy(_Camera->getChild(i)->getBound()); } if (!bs.valid()) { - osg::notify(osg::WARN) << "bb invalid"<<_cameraNode.get()<setReferenceFrame(osg::CameraNode::ABSOLUTE_RF); - _cameraNode->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar); - _cameraNode->setViewMatrixAsLookAt(_position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f)); + _Camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); + _Camera->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar); + _Camera->setViewMatrixAsLookAt(_position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f)); // compute the matrix which takes a vertex from local coords into tex coords // will use this later to specify osg::TexGen.. - osg::Matrix MVPT = _cameraNode->getViewMatrix() * - _cameraNode->getProjectionMatrix() * + osg::Matrix MVPT = _Camera->getViewMatrix() * + _Camera->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5f,0.5f,0.5f); @@ -73,7 +73,7 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback virtual ~UpdateCameraAndTexGenCallback() {} osg::Vec3 _position; - osg::ref_ptr _cameraNode; + osg::ref_ptr _Camera; osg::ref_ptr _texgenNode; }; @@ -120,7 +120,7 @@ osg::Group* createShadowedScene(osg::Node* shadower,osg::Node* shadowed,const os { // create the camera - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); @@ -128,13 +128,13 @@ osg::Group* createShadowedScene(osg::Node* shadower,osg::Node* shadowed,const os camera->setViewport(0,0,tex_width,tex_height); // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + camera->setRenderOrder(osg::Camera::PRE_RENDER); // tell the camera to use OpenGL frame buffer object where supported. - camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT); + camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::COLOR_BUFFER, texture); + camera->attach(osg::Camera::COLOR_BUFFER, texture); // add subgraph to render camera->addChild(shadower); @@ -179,7 +179,7 @@ osg::Group* createShadowedScene(osg::Node* shadower,osg::Node* shadowed,const os geom->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); geode->addDrawable(geom); - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; // set the projection matrix camera->setProjectionMatrix(osg::Matrix::ortho2D(0,100,0,100)); @@ -194,7 +194,7 @@ osg::Group* createShadowedScene(osg::Node* shadower,osg::Node* shadowed,const os camera->setClearMask(GL_DEPTH_BUFFER_BIT); // draw subgraph after main camera view. - camera->setRenderOrder(osg::CameraNode::POST_RENDER); + camera->setRenderOrder(osg::Camera::POST_RENDER); camera->addChild(geode); diff --git a/examples/osgtext/osgtext.cpp b/examples/osgtext/osgtext.cpp index d5b644d65..c191e74a9 100644 --- a/examples/osgtext/osgtext.cpp +++ b/examples/osgtext/osgtext.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -540,7 +540,7 @@ int main( int argc, char **argv ) { // create the hud. - osg::CameraNode* camera = new osg::CameraNode; + osg::Camera* camera = new osg::Camera; camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera->setProjectionMatrixAsOrtho2D(0,1280,0,1024); camera->setViewMatrix(osg::Matrix::identity()); diff --git a/include/osg/Camera b/include/osg/Camera new file mode 100644 index 000000000..4c171604d --- /dev/null +++ b/include/osg/Camera @@ -0,0 +1,404 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSG_CAMERA +#define OSG_CAMERA 1 + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace osg { + +// forward declare View to allow Camera to point back to the View that its within +class View; + +/** Camera - is a subclass of Transform which represents encapsulates the settings of a Camera. +*/ +class OSG_EXPORT Camera : public Transform, public CullSettings +{ + public : + + + Camera(); + + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ + Camera(const Camera&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); + + META_Node(osg, Camera); + + /** Set the View that this Camera is part of. */ + void setView(View* view) { _view = view; } + + /** Get the View that this Camera is part of. */ + View* getView() { return _view; } + + /** Get the const View that this Camera is part of. */ + const View* getView() const { return _view; } + + + /** Sets the clear color. */ + inline void setClearColor(const Vec4& color) { _clearColor = color; } + + /** Returns the clear color. */ + inline const Vec4& getClearColor() const { return _clearColor; } + + /** Set the clear mask used in glClear(..). + * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */ + inline void setClearMask(GLbitfield mask) { _clearMask = mask; } + + /** Get the clear mask.*/ + inline GLbitfield getClearMask() const { return _clearMask; } + + + /** Set the color mask of the camera to use specified osg::ColorMask. */ + void setColorMask(osg::ColorMask* colorMask); + + /** Set the color mask of the camera to specified values. */ + void setColorMask(bool red, bool green, bool blue, bool alpha); + + /** Get the const ColorMask. */ + const ColorMask* getColorMask() const { return _colorMask.get(); } + + /** Get the ColorMask. */ + ColorMask* getColorMask() { return _colorMask.get(); } + + + + + /** Set the viewport of the camera to use specified osg::Viewport. */ + void setViewport(osg::Viewport* viewport); + + /** Set the viewport of the camera to specified dimensions. */ + void setViewport(int x,int y,int width,int height); + + /** Get the const viewport. */ + const Viewport* getViewport() const { return _viewport.get(); } + + /** Get the viewport. */ + Viewport* getViewport() { return _viewport.get(); } + + + enum TransformOrder + { + PRE_MULTIPLY, + POST_MULTIPLY + }; + + /** Set the transformation order for world-to-local and local-to-world transformation.*/ + void setTransformOrder(TransformOrder order) { _transformOrder = order; } + + /** Get the transformation order.*/ + TransformOrder getTransformOrder() const { return _transformOrder; } + + + /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ + inline void setProjectionMatrix(const osg::Matrixf& matrix) { _projectionMatrix.set(matrix); } + + /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ + inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); } + + /** Set to an orthographic projection. See OpenGL glOrtho for documentation further details.*/ + void setProjectionMatrixAsOrtho(double left, double right, + double bottom, double top, + double zNear, double zFar); + + /** Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.*/ + void setProjectionMatrixAsOrtho2D(double left, double right, + double bottom, double top); + + /** Set to a perspective projection. See OpenGL glFrustum documentation for further details.*/ + void setProjectionMatrixAsFrustum(double left, double right, + double bottom, double top, + double zNear, double zFar); + + /** Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details. + * Aspect ratio is defined as width/height.*/ + void setProjectionMatrixAsPerspective(double fovy,double aspectRatio, + double zNear, double zFar); + + /** Get the projection matrix.*/ + osg::Matrixd& getProjectionMatrix() { return _projectionMatrix; } + + /** Get the const projection matrix.*/ + const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; } + + /** Get the othographic settings of the orthographic projection matrix. + * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ + bool getProjectionMatrixAsOrtho(double& left, double& right, + double& bottom, double& top, + double& zNear, double& zFar); + + /** Get the frustum setting of a perspective projection matrix. + * Returns false if matrix is not a perspective matrix, where parameter values are undefined.*/ + bool getProjectionMatrixAsFrustum(double& left, double& right, + double& bottom, double& top, + double& zNear, double& zFar); + + /** Get the frustum setting of a symmetric perspective projection matrix. + * Returns false if matrix is not a perspective matrix, where parameter values are undefined. + * Note, if matrix is not a symmetric perspective matrix then the shear will be lost. + * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. + * In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/ + bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, + double& zNear, double& zFar); + + + + /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ + inline void setViewMatrix(const osg::Matrixf& matrix) { _viewMatrix.set(matrix); dirtyBound();} + + /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ + inline void setViewMatrix(const osg::Matrixd& matrix) { _viewMatrix.set(matrix); dirtyBound();} + + /** Set to the position and orientation of view matrix, using the same convention as gluLookAt. */ + void setViewMatrixAsLookAt(const osg::Vec3& eye,const osg::Vec3& center,const osg::Vec3& up); + + /** Get the view matrix. */ + osg::Matrixd& getViewMatrix() { return _viewMatrix; } + + /** Get the const view matrix. */ + const osg::Matrixd& getViewMatrix() const { return _viewMatrix; } + + /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ + void getViewMatrixAsLookAt(osg::Vec3& eye,osg::Vec3& center,osg::Vec3& up,float lookDistance=1.0f); + + /** Get the inverse view matrix.*/ + Matrixd getInverseViewMatrix() const; + + + enum RenderOrder + { + PRE_RENDER, + NESTED_RENDER, + POST_RENDER + }; + + /** Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within. + * For rendering to a texture, one typically uses PRE_RENDER. + * For Head Up Displays, one would typically use POST_RENDER.*/ + void setRenderOrder(RenderOrder order, int orderNum = 0) { _renderOrder = order; _renderOrderNum = orderNum; } + + /** Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.*/ + RenderOrder getRenderOrder() const { return _renderOrder; } + + /** Get the rendering order number of this camera relative to any sibling cameras in this subgraph.*/ + int getRenderOrderNum() const { return _renderOrderNum; } + + /** Return true if this Camera is set up as a render to texture camera, i.e. it has textures assigned to it.*/ + bool isRenderToTextureCamera() const; + + enum RenderTargetImplementation + { + FRAME_BUFFER_OBJECT, + PIXEL_BUFFER_RTT, + PIXEL_BUFFER, + FRAME_BUFFER, + SEPERATE_WINDOW + }; + + /** Set the render target.*/ + void setRenderTargetImplementation(RenderTargetImplementation impl); + + /** Set the render target and fall-back that's used if the former isn't available.*/ + void setRenderTargetImplementation(RenderTargetImplementation impl, RenderTargetImplementation fallback); + + /** Get the render target.*/ + RenderTargetImplementation getRenderTargetImplementation() const { return _renderTargetImplementation; } + + /** Get the render target fallback.*/ + RenderTargetImplementation getRenderTargetFallback() const { return _renderTargetFallback; } + + + /** Set the draw buffer used at the start of each frame draw. + * Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/ + void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; } + + /** Get the draw buffer used at the start of each frame draw. */ + GLenum getDrawBuffer() const { return _drawBuffer; } + + /** Set the read buffer for any required copy operations to use. + * Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/ + void setReadBuffer(GLenum buffer) { _readBuffer = buffer; } + + /** Get the read buffer for any required copy operations to use. */ + GLenum getReadBuffer() const { return _readBuffer; } + + enum BufferComponent + { + DEPTH_BUFFER, + STENCIL_BUFFER, + COLOR_BUFFER, + COLOR_BUFFER0 = COLOR_BUFFER, + COLOR_BUFFER1 = COLOR_BUFFER+1, + COLOR_BUFFER2 = COLOR_BUFFER+2, + COLOR_BUFFER3 = COLOR_BUFFER+3, + COLOR_BUFFER4 = COLOR_BUFFER+4, + COLOR_BUFFER5 = COLOR_BUFFER+5, + COLOR_BUFFER6 = COLOR_BUFFER+6, + COLOR_BUFFER7 = COLOR_BUFFER+7 + }; + + void attach(BufferComponent buffer, GLenum internalFormat); + + void attach(BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face=0, bool mipMapGeneration=false); + + void attach(BufferComponent buffer, osg::Image* image); + + void detach(BufferComponent buffer); + + struct Attachment + { + Attachment(): + _internalFormat(GL_NONE), + _level(0), + _face(0), + _mipMapGeneration(false) {} + + int width() const + { + if (_texture.valid()) return _texture->getTextureWidth(); + if (_image.valid()) return _image->s(); + return 0; + }; + + int height() const + { + if (_texture.valid()) return _texture->getTextureHeight(); + if (_image.valid()) return _image->t(); + return 0; + }; + + int depth() const + { + if (_texture.valid()) return _texture->getTextureDepth(); + if (_image.valid()) return _image->r(); + return 0; + }; + + GLenum _internalFormat; + ref_ptr _image; + ref_ptr _texture; + unsigned int _level; + unsigned int _face; + bool _mipMapGeneration; + }; + + typedef std::map< BufferComponent, Attachment> BufferAttachmentMap; + + /** Get the BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.*/ + BufferAttachmentMap& getBufferAttachmentMap() { return _bufferAttachmentMap; } + + /** Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.*/ + const BufferAttachmentMap& getBufferAttachmentMap() const { return _bufferAttachmentMap; } + + + /** Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera.*/ + void setGraphicsContext(GraphicsContext* context) { _graphicsContext = context; } + + /** Get the GraphicsContext.*/ + GraphicsContext* getGraphicsContext() { return _graphicsContext.get(); } + + /** Get the const GraphicsContext.*/ + const GraphicsContext* getGraphicsContext() const { return _graphicsContext.get(); } + + + /** Set the Rendering object that is used to implement rendering of the subgraph.*/ + void setRenderingCache(unsigned int contextID, osg::Object* rc) { _renderingCache[contextID] = rc; } + + /** Get the Rendering object that is used to implement rendering of the subgraph.*/ + osg::Object* getRenderingCache(unsigned int contextID) { return _renderingCache[contextID].get(); } + + /** Get the const Rendering object that is used to implement rendering of the subgraph.*/ + const osg::Object* getRenderingCache(unsigned int contextID) const { return _renderingCache[contextID].get(); } + + + /** Draw callback for custom operations.*/ + struct DrawCallback : virtual public Object + { + DrawCallback() {} + + DrawCallback(const DrawCallback&,const CopyOp&) {} + + META_Object(osg,DrawCallback) + + virtual void operator () (const osg::Camera& /*camera*/) const {} + }; + + /** Set the post draw callback for custom operations to do done after the drawing of the camera's subgraph has been completed.*/ + void setPostDrawCallback(DrawCallback* cb) { _postDrawCallback = cb; } + + /** Get the post draw callback.*/ + DrawCallback* getPostDrawCallback() { return _postDrawCallback.get(); } + + /** Get the const post draw callback.*/ + const DrawCallback* getPostDrawCallback() const { return _postDrawCallback.get(); } + + OpenThreads::Mutex* getDataChangeMutex() const { return &_dataChangeMutex; } + + /** If State is non-zero, this function releases any associated OpenGL objects for + * the specified graphics context. Otherwise, releases OpenGL objexts + * for all graphics contexts. */ + virtual void releaseGLObjects(osg::State* = 0) const; + + public: + + /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ + virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const; + + /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ + virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const; + + protected : + + virtual ~Camera(); + + mutable OpenThreads::Mutex _dataChangeMutex; + + + View* _view; + + Vec4 _clearColor; + GLbitfield _clearMask; + ref_ptr _colorMask; + ref_ptr _viewport; + + TransformOrder _transformOrder; + Matrixd _projectionMatrix; + Matrixd _viewMatrix; + + RenderOrder _renderOrder; + int _renderOrderNum; + + GLenum _drawBuffer; + GLenum _readBuffer; + + RenderTargetImplementation _renderTargetImplementation; + RenderTargetImplementation _renderTargetFallback; + BufferAttachmentMap _bufferAttachmentMap; + + ref_ptr _graphicsContext; + buffered_object< ref_ptr > _renderingCache; + + ref_ptr _postDrawCallback; +}; + +} + +#endif diff --git a/include/osg/CameraNode b/include/osg/CameraNode index 74d539807..676b84b80 100644 --- a/include/osg/CameraNode +++ b/include/osg/CameraNode @@ -14,390 +14,13 @@ #ifndef OSG_CAMERANODE #define OSG_CAMERANODE 1 -#include -#include -#include -#include -#include -#include -#include - -#include +#include namespace osg { -// forward declare View to allow CameraNode to point back to the View that its within -class View; - -/** CameraNode - is a subclass of Transform which represents encapsulates the settings of a Camera. -*/ -class OSG_EXPORT CameraNode : public Transform, public CullSettings -{ - public : - - - CameraNode(); - - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - CameraNode(const CameraNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); - - META_Node(osg, CameraNode); - - /** Set the View that this Camera is part of. */ - void setView(View* view) { _view = view; } - - /** Get the View that this Camera is part of. */ - View* getView() { return _view; } - - /** Get the const View that this Camera is part of. */ - const View* getView() const { return _view; } - - - /** Sets the clear color. */ - inline void setClearColor(const Vec4& color) { _clearColor = color; } - - /** Returns the clear color. */ - inline const Vec4& getClearColor() const { return _clearColor; } - - /** Set the clear mask used in glClear(..). - * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */ - inline void setClearMask(GLbitfield mask) { _clearMask = mask; } - - /** Get the clear mask.*/ - inline GLbitfield getClearMask() const { return _clearMask; } - - - /** Set the color mask of the camera to use specified osg::ColorMask. */ - void setColorMask(osg::ColorMask* colorMask); - - /** Set the color mask of the camera to specified values. */ - void setColorMask(bool red, bool green, bool blue, bool alpha); - - /** Get the const ColorMask. */ - const ColorMask* getColorMask() const { return _colorMask.get(); } - - /** Get the ColorMask. */ - ColorMask* getColorMask() { return _colorMask.get(); } - - - - - /** Set the viewport of the camera to use specified osg::Viewport. */ - void setViewport(osg::Viewport* viewport); - - /** Set the viewport of the camera to specified dimensions. */ - void setViewport(int x,int y,int width,int height); - - /** Get the const viewport. */ - const Viewport* getViewport() const { return _viewport.get(); } - - /** Get the viewport. */ - Viewport* getViewport() { return _viewport.get(); } - - - enum TransformOrder - { - PRE_MULTIPLY, - POST_MULTIPLY - }; - - /** Set the transformation order for world-to-local and local-to-world transformation.*/ - void setTransformOrder(TransformOrder order) { _transformOrder = order; } - - /** Get the transformation order.*/ - TransformOrder getTransformOrder() const { return _transformOrder; } - - - /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ - inline void setProjectionMatrix(const osg::Matrixf& matrix) { _projectionMatrix.set(matrix); } - - /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ - inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); } - - /** Set to an orthographic projection. See OpenGL glOrtho for documentation further details.*/ - void setProjectionMatrixAsOrtho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.*/ - void setProjectionMatrixAsOrtho2D(double left, double right, - double bottom, double top); - - /** Set to a perspective projection. See OpenGL glFrustum documentation for further details.*/ - void setProjectionMatrixAsFrustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details. - * Aspect ratio is defined as width/height.*/ - void setProjectionMatrixAsPerspective(double fovy,double aspectRatio, - double zNear, double zFar); - - /** Get the projection matrix.*/ - osg::Matrixd& getProjectionMatrix() { return _projectionMatrix; } - - /** Get the const projection matrix.*/ - const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; } - - /** Get the othographic settings of the orthographic projection matrix. - * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ - bool getProjectionMatrixAsOrtho(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar); - - /** Get the frustum setting of a perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined.*/ - bool getProjectionMatrixAsFrustum(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar); - - /** Get the frustum setting of a symmetric perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined. - * Note, if matrix is not a symmetric perspective matrix then the shear will be lost. - * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. - * In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/ - bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, - double& zNear, double& zFar); - - - - /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ - inline void setViewMatrix(const osg::Matrixf& matrix) { _viewMatrix.set(matrix); dirtyBound();} - - /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ - inline void setViewMatrix(const osg::Matrixd& matrix) { _viewMatrix.set(matrix); dirtyBound();} - - /** Set to the position and orientation of view matrix, using the same convention as gluLookAt. */ - void setViewMatrixAsLookAt(const osg::Vec3& eye,const osg::Vec3& center,const osg::Vec3& up); - - /** Get the view matrix. */ - osg::Matrixd& getViewMatrix() { return _viewMatrix; } - - /** Get the const view matrix. */ - const osg::Matrixd& getViewMatrix() const { return _viewMatrix; } - - /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ - void getViewMatrixAsLookAt(osg::Vec3& eye,osg::Vec3& center,osg::Vec3& up,float lookDistance=1.0f); - - /** Get the inverse view matrix.*/ - Matrixd getInverseViewMatrix() const; - - - enum RenderOrder - { - PRE_RENDER, - NESTED_RENDER, - POST_RENDER - }; - - /** Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within. - * For rendering to a texture, one typically uses PRE_RENDER. - * For Head Up Displays, one would typically use POST_RENDER.*/ - void setRenderOrder(RenderOrder order, int orderNum = 0) { _renderOrder = order; _renderOrderNum = orderNum; } - - /** Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.*/ - RenderOrder getRenderOrder() const { return _renderOrder; } - - /** Get the rendering order number of this camera relative to any sibling cameras in this subgraph.*/ - int getRenderOrderNum() const { return _renderOrderNum; } - - /** Return true if this Camera is set up as a render to texture camera, i.e. it has textures assigned to it.*/ - bool isRenderToTextureCamera() const; - - enum RenderTargetImplementation - { - FRAME_BUFFER_OBJECT, - PIXEL_BUFFER_RTT, - PIXEL_BUFFER, - FRAME_BUFFER, - SEPERATE_WINDOW - }; - - /** Set the render target.*/ - void setRenderTargetImplementation(RenderTargetImplementation impl); - - /** Set the render target and fall-back that's used if the former isn't available.*/ - void setRenderTargetImplementation(RenderTargetImplementation impl, RenderTargetImplementation fallback); - - /** Get the render target.*/ - RenderTargetImplementation getRenderTargetImplementation() const { return _renderTargetImplementation; } - - /** Get the render target fallback.*/ - RenderTargetImplementation getRenderTargetFallback() const { return _renderTargetFallback; } - - - /** Set the draw buffer used at the start of each frame draw. - * Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/ - void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; } - - /** Get the draw buffer used at the start of each frame draw. */ - GLenum getDrawBuffer() const { return _drawBuffer; } - - /** Set the read buffer for any required copy operations to use. - * Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/ - void setReadBuffer(GLenum buffer) { _readBuffer = buffer; } - - /** Get the read buffer for any required copy operations to use. */ - GLenum getReadBuffer() const { return _readBuffer; } - - enum BufferComponent - { - DEPTH_BUFFER, - STENCIL_BUFFER, - COLOR_BUFFER, - COLOR_BUFFER0 = COLOR_BUFFER, - COLOR_BUFFER1 = COLOR_BUFFER+1, - COLOR_BUFFER2 = COLOR_BUFFER+2, - COLOR_BUFFER3 = COLOR_BUFFER+3, - COLOR_BUFFER4 = COLOR_BUFFER+4, - COLOR_BUFFER5 = COLOR_BUFFER+5, - COLOR_BUFFER6 = COLOR_BUFFER+6, - COLOR_BUFFER7 = COLOR_BUFFER+7 - }; - - void attach(BufferComponent buffer, GLenum internalFormat); - - void attach(BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face=0, bool mipMapGeneration=false); - - void attach(BufferComponent buffer, osg::Image* image); - - void detach(BufferComponent buffer); - - struct Attachment - { - Attachment(): - _internalFormat(GL_NONE), - _level(0), - _face(0), - _mipMapGeneration(false) {} - - int width() const - { - if (_texture.valid()) return _texture->getTextureWidth(); - if (_image.valid()) return _image->s(); - return 0; - }; - - int height() const - { - if (_texture.valid()) return _texture->getTextureHeight(); - if (_image.valid()) return _image->t(); - return 0; - }; - - int depth() const - { - if (_texture.valid()) return _texture->getTextureDepth(); - if (_image.valid()) return _image->r(); - return 0; - }; - - GLenum _internalFormat; - ref_ptr _image; - ref_ptr _texture; - unsigned int _level; - unsigned int _face; - bool _mipMapGeneration; - }; - - typedef std::map< BufferComponent, Attachment> BufferAttachmentMap; - - /** Get the BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.*/ - BufferAttachmentMap& getBufferAttachmentMap() { return _bufferAttachmentMap; } - - /** Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads.*/ - const BufferAttachmentMap& getBufferAttachmentMap() const { return _bufferAttachmentMap; } - - - /** Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera.*/ - void setGraphicsContext(GraphicsContext* context) { _graphicsContext = context; } - - /** Get the GraphicsContext.*/ - GraphicsContext* getGraphicsContext() { return _graphicsContext.get(); } - - /** Get the const GraphicsContext.*/ - const GraphicsContext* getGraphicsContext() const { return _graphicsContext.get(); } - - - /** Set the Rendering object that is used to implement rendering of the subgraph.*/ - void setRenderingCache(unsigned int contextID, osg::Object* rc) { _renderingCache[contextID] = rc; } - - /** Get the Rendering object that is used to implement rendering of the subgraph.*/ - osg::Object* getRenderingCache(unsigned int contextID) { return _renderingCache[contextID].get(); } - - /** Get the const Rendering object that is used to implement rendering of the subgraph.*/ - const osg::Object* getRenderingCache(unsigned int contextID) const { return _renderingCache[contextID].get(); } - - - /** Draw callback for custom operations.*/ - struct DrawCallback : virtual public Object - { - DrawCallback() {} - - DrawCallback(const DrawCallback&,const CopyOp&) {} - - META_Object(osg,DrawCallback) - - virtual void operator () (const osg::CameraNode& /*camera*/) const {} - }; - - /** Set the post draw callback for custom operations to do done after the drawing of the camera's subgraph has been completed.*/ - void setPostDrawCallback(DrawCallback* cb) { _postDrawCallback = cb; } - - /** Get the post draw callback.*/ - DrawCallback* getPostDrawCallback() { return _postDrawCallback.get(); } - - /** Get the const post draw callback.*/ - const DrawCallback* getPostDrawCallback() const { return _postDrawCallback.get(); } - - OpenThreads::Mutex* getDataChangeMutex() const { return &_dataChangeMutex; } - - /** If State is non-zero, this function releases any associated OpenGL objects for - * the specified graphics context. Otherwise, releases OpenGL objexts - * for all graphics contexts. */ - virtual void releaseGLObjects(osg::State* = 0) const; - - public: - - /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const; - - /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const; - - protected : - - virtual ~CameraNode(); - - mutable OpenThreads::Mutex _dataChangeMutex; - - - View* _view; - - Vec4 _clearColor; - GLbitfield _clearMask; - ref_ptr _colorMask; - ref_ptr _viewport; - - TransformOrder _transformOrder; - Matrixd _projectionMatrix; - Matrixd _viewMatrix; - - RenderOrder _renderOrder; - int _renderOrderNum; - - GLenum _drawBuffer; - GLenum _readBuffer; - - RenderTargetImplementation _renderTargetImplementation; - RenderTargetImplementation _renderTargetFallback; - BufferAttachmentMap _bufferAttachmentMap; - - ref_ptr _graphicsContext; - buffered_object< ref_ptr > _renderingCache; - - ref_ptr _postDrawCallback; -}; +#ifdef USE_DEPRECATED_API + typedef osg::Camera CameraNode; +#endif } diff --git a/include/osg/FrameBufferObject b/include/osg/FrameBufferObject index d57c55c9f..54f98a010 100644 --- a/include/osg/FrameBufferObject +++ b/include/osg/FrameBufferObject @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifndef GL_EXT_framebuffer_object #define GL_EXT_framebuffer_object 1 @@ -261,7 +261,7 @@ namespace osg explicit FrameBufferAttachment(Texture3D* target, int zoffset, int level = 0); explicit FrameBufferAttachment(TextureCubeMap* target, int face, int level = 0); explicit FrameBufferAttachment(TextureRectangle* target); - explicit FrameBufferAttachment(CameraNode::Attachment& attachment); + explicit FrameBufferAttachment(Camera::Attachment& attachment); ~FrameBufferAttachment(); diff --git a/include/osg/NodeVisitor b/include/osg/NodeVisitor index 7af517e72..94d613b6d 100644 --- a/include/osg/NodeVisitor +++ b/include/osg/NodeVisitor @@ -38,9 +38,8 @@ class Sequence; class Switch; class TexGenNode; class Transform; -class CameraNode; +class Camera; class CameraView; -class View; /** Visitor for type safe operations on osg::Nodes. Based on GOF's Visitor pattern. The NodeVisitor @@ -236,8 +235,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced virtual void apply(LightSource& node) { apply((Group&)node); } virtual void apply(Transform& node) { apply((Group&)node); } - virtual void apply(View& node) { apply((Transform&)node); } - virtual void apply(CameraNode& node) { apply((Transform&)node); } + virtual void apply(Camera& node) { apply((Transform&)node); } virtual void apply(CameraView& node) { apply((Transform&)node); } virtual void apply(MatrixTransform& node) { apply((Transform&)node); } virtual void apply(PositionAttitudeTransform& node) { apply((Transform&)node); } diff --git a/include/osg/Transform b/include/osg/Transform index 45438633f..c88dc0f8c 100644 --- a/include/osg/Transform +++ b/include/osg/Transform @@ -28,24 +28,24 @@ namespace osg { /** Compute the matrix which transforms objects in local coords to world coords, * by accumulating the Transform local to world matrices along the specified node path. */ -extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath, bool ignoreCameraNodes = true); +extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath, bool ignoreCameras = true); /** Compute the matrix which transforms objects in world coords to local coords, * by accumulating the Transform world to local matrices along the specified node path. */ -extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath, bool ignoreCameraNodes = true); +extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath, bool ignoreCameras = true); /** Compute the matrix which transforms objects in local coords to eye coords, * by accumulating the Transform local to world matrices along the specified node path * and multipling by the supplied initial camera modelview. */ -extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameraNodes = true); +extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true); /** Compute the matrix which transforms objects in eye coords to local coords, * by accumulating the Transform world to local matrices along the specified node path * and multipling by the inverse of the supplied initialial camera modelview. */ -extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameraNodes = true); +extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true); /** A Transform is a group node for which all children are transformed by diff --git a/include/osg/View b/include/osg/View index c56b2bf88..7136c65f8 100644 --- a/include/osg/View +++ b/include/osg/View @@ -14,112 +14,43 @@ #ifndef OSG_VIEW #define OSG_VIEW 1 -#include +#include #include namespace osg { -/** View - is a subclass of Transform which encompasses all the cameras that combine to make up a single view of the scene. +/** View - maintains a master camera view and a list of slave cameras that are relative to this master camera. + * Note, if no slave cameras are attached to the view then the master camera does both the control and implementation of the rendering of the scene, + * but if slave cameras are present then the master controls the view onto the scene, while the slaves implement the rendering of the scene. */ -class OSG_EXPORT View : public osg::Transform, public CullSettings +class OSG_EXPORT View : public osg::Referenced { public : View(); - /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ - View(const View&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); + /** Set the master camera of the view. */ + void setCamera(osg::Camera* camera) { _camera = camera; } - META_Node(osg, View); + /** Get the master camera of the view. */ + osg::Camera* getCamera() { return _camera.get(); } + /** Get the const master camera of the view. */ + const osg::Camera* getCamera() const { return _camera.get(); } - /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ - inline void setProjectionMatrix(const osg::Matrixf& matrix) { _projectionMatrix.set(matrix); updateCameras(); } - - /** Set the projection matrix. Can be thought of as setting the lens of a camera. */ - inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); updateCameras(); } - - /** Set to an orthographic projection. See OpenGL glOrtho for documentation further details.*/ - void setProjectionMatrixAsOrtho(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.*/ - void setProjectionMatrixAsOrtho2D(double left, double right, - double bottom, double top); - - /** Set to a perspective projection. See OpenGL glFrustum documentation for further details.*/ - void setProjectionMatrixAsFrustum(double left, double right, - double bottom, double top, - double zNear, double zFar); - - /** Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details. - * Aspect ratio is defined as width/height.*/ - void setProjectionMatrixAsPerspective(double fovy,double aspectRatio, - double zNear, double zFar); - - /** Get the projection matrix.*/ - osg::Matrixd& getProjectionMatrix() { return _projectionMatrix; } - - /** Get the const projection matrix.*/ - const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; } - - /** Get the othographic settings of the orthographic projection matrix. - * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ - bool getProjectionMatrixAsOrtho(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar); - - /** Get the frustum setting of a perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined.*/ - bool getProjectionMatrixAsFrustum(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar); - - /** Get the frustum setting of a symmetric perspective projection matrix. - * Returns false if matrix is not a perspective matrix, where parameter values are undefined. - * Note, if matrix is not a symmetric perspective matrix then the shear will be lost. - * Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. - * In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/ - bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, - double& zNear, double& zFar); - - - - /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ - inline void setViewMatrix(const osg::Matrixf& matrix) { _viewMatrix.set(matrix); dirtyBound(); updateCameras(); } - - /** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */ - inline void setViewMatrix(const osg::Matrixd& matrix) { _viewMatrix.set(matrix); dirtyBound(); updateCameras(); } - - /** Set to the position and orientation of view matrix, using the same convention as gluLookAt. */ - void setViewMatrixAsLookAt(const osg::Vec3& eye,const osg::Vec3& center,const osg::Vec3& up); - - /** Get the view matrix. */ - osg::Matrixd& getViewMatrix() { return _viewMatrix; } - - /** Get the const view matrix. */ - const osg::Matrixd& getViewMatrix() const { return _viewMatrix; } - - /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ - void getViewMatrixAsLookAt(osg::Vec3& eye,osg::Vec3& center,osg::Vec3& up,float lookDistance=1.0f); - - /** Get the inverse view matrix.*/ - Matrixd getInverseViewMatrix() const; - - - struct CameraData + /** Slave allows one to up a camera that follows the master with a local offset to the project and view matrices.*/ + struct Slave { - CameraData() {} - CameraData(osg::CameraNode* camera, const osg::Matrixd& projectionOffset, const osg::Matrixd& viewOffset): + Slave() {} + Slave(osg::Camera* camera, const osg::Matrixd& projectionOffset, const osg::Matrixd& viewOffset): _camera(camera), _projectionOffset(projectionOffset), _viewOffset(viewOffset) {} - CameraData(const CameraData& rhs) : + Slave(const Slave& rhs) : _camera(rhs._camera), _projectionOffset(rhs._projectionOffset), _viewOffset(rhs._viewOffset) {} - CameraData& operator = (const CameraData& rhs) + Slave& operator = (const Slave& rhs) { _camera = rhs._camera; _projectionOffset = rhs._projectionOffset; @@ -127,46 +58,32 @@ class OSG_EXPORT View : public osg::Transform, public CullSettings return *this; } - osg::ref_ptr _camera; + osg::ref_ptr _camera; osg::Matrixd _projectionOffset; osg::Matrixd _viewOffset; }; - bool addCamera(osg::CameraNode* camera) { return addCamera(camera, osg::Matrix::identity(), osg::Matrix::identity()); } + bool addSlave(osg::Camera* camera) { return addSlave(camera, osg::Matrix::identity(), osg::Matrix::identity()); } - bool addCamera(osg::CameraNode* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffse); + bool addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffse); - bool removeCamera(unsigned int pos); + bool removeSlave(unsigned int pos); - unsigned int getNumCameras() const { return _cameras.size(); } - - CameraNode* getCamera(unsigned int pos) { return _cameras[pos]._camera.get(); } - const CameraNode* getCamera(unsigned int pos) const { return _cameras[pos]._camera.get(); } - - CameraData& getCameraData(unsigned int pos) { return _cameras[pos]; } - const CameraData& getCameraData(unsigned int pos) const { return _cameras[pos]; } - - - public: - - /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ - virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const; - - /** Transform method that must be defined to provide generic interface for scene graph traversals.*/ - virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const; + unsigned int getNumSlaves() const { return _slaves.size(); } + Slave& getSlave(unsigned int pos) { return _slaves[pos]; } + const Slave& getSlave(unsigned int pos) const { return _slaves[pos]; } protected : virtual ~View(); - void updateCameras(); + void updateSlaves(); - Matrixd _projectionMatrix; - Matrixd _viewMatrix; + osg::ref_ptr _camera; - typedef std::vector CameraList; - CameraList _cameras; + typedef std::vector Slaves; + Slaves _slaves; }; } diff --git a/include/osgShadow/ParallelSplitShadowMap b/include/osgShadow/ParallelSplitShadowMap index 36446c8b6..d20abf79a 100644 --- a/include/osgShadow/ParallelSplitShadowMap +++ b/include/osgShadow/ParallelSplitShadowMap @@ -14,7 +14,7 @@ #ifndef OSGSHADOW_PARALLELSPLITSHADOWMAP #define OSGSHADOW_PARALLELSPLITSHADOWMAP 1 -#include +#include #include diff --git a/include/osgShadow/ShadowMap b/include/osgShadow/ShadowMap index 75cc32323..e76da5e41 100644 --- a/include/osgShadow/ShadowMap +++ b/include/osgShadow/ShadowMap @@ -14,7 +14,7 @@ #ifndef OSGSHADOW_SHADOWEDTEXTURE #define OSGSHADOW_SHADOWEDTEXTURE 1 -#include +#include #include diff --git a/include/osgShadow/ShadowTechnique b/include/osgShadow/ShadowTechnique index 3302d2fc4..01ebf7ed4 100644 --- a/include/osgShadow/ShadowTechnique +++ b/include/osgShadow/ShadowTechnique @@ -15,7 +15,7 @@ #define OSGSHADOW_SHADOWEDTECHNIQUE 1 #include -#include +#include #include #include diff --git a/include/osgShadow/ShadowTexture b/include/osgShadow/ShadowTexture index a79cf3194..a6bdec253 100644 --- a/include/osgShadow/ShadowTexture +++ b/include/osgShadow/ShadowTexture @@ -14,7 +14,7 @@ #ifndef OSGSHADOW_SHADOWEDTEXTURE #define OSGSHADOW_SHADOWEDTEXTURE 1 -#include +#include #include diff --git a/include/osgShadow/ShadowVolume b/include/osgShadow/ShadowVolume index ad926ea9b..b4ef900bd 100644 --- a/include/osgShadow/ShadowVolume +++ b/include/osgShadow/ShadowVolume @@ -14,7 +14,7 @@ #ifndef OSGSHADOW_SHADOWVOLUME #define OSGSHADOW_SHADOWVOLUME 1 -#include +#include #include diff --git a/include/osgShadow/ShadowedScene b/include/osgShadow/ShadowedScene index 956093889..29f5ad226 100644 --- a/include/osgShadow/ShadowedScene +++ b/include/osgShadow/ShadowedScene @@ -15,7 +15,7 @@ #define OSGSHADOW_SHADOWEDSCENE 1 #include -#include +#include #include #include diff --git a/include/osgSim/ImpostorSprite b/include/osgSim/ImpostorSprite index e44675a54..885596d04 100644 --- a/include/osgSim/ImpostorSprite +++ b/include/osgSim/ImpostorSprite @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include @@ -152,13 +152,13 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable virtual osg::BoundingBox computeBound() const; /** Set the camera node to use for pre rendering the impostor sprite's texture.*/ - void setCameraNode(osg::CameraNode* camera) { _camera = camera; } + void setCamera(osg::Camera* camera) { _camera = camera; } /** Get the camera node to use for pre rendering the impostor sprite's texture.*/ - osg::CameraNode* getCameraNode() { return _camera.get(); } + osg::Camera* getCamera() { return _camera.get(); } /** Get the const camera node to use for pre rendering the impostor sprite's texture.*/ - const osg::CameraNode* getCameraNode() const { return _camera.get(); } + const osg::Camera* getCamera() const { return _camera.get(); } protected: @@ -172,7 +172,7 @@ class OSGSIM_EXPORT ImpostorSprite : public osg::Drawable friend class osgSim::ImpostorSpriteManager; // camera node for doing the pre rendering. - osg::ref_ptr _camera; + osg::ref_ptr _camera; // support for a double linked list managed by the // ImposotorSpriteManager. diff --git a/include/osgSim/OverlayNode b/include/osgSim/OverlayNode index 80b66c9e2..ad10f9684 100644 --- a/include/osgSim/OverlayNode +++ b/include/osgSim/OverlayNode @@ -15,7 +15,7 @@ #define OSGSIM_OVERLAYNODE 1 #include -#include +#include #include #include @@ -82,10 +82,10 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group /** Get the camera used to implement the render to texture of the overlay subgraph.*/ - osg::CameraNode* getCamera() { return _camera.get(); } + osg::Camera* getCamera() { return _camera.get(); } /** Get the const camera used to implement the render to texture of the overlay subgraph.*/ - const osg::CameraNode* getCamera() const { return _camera.get(); } + const osg::Camera* getCamera() const { return _camera.get(); } protected : @@ -99,7 +99,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group mutable TextureObjectValidList _textureObjectValidList; - osg::ref_ptr _camera; + osg::ref_ptr _camera; // overlay subgraph is render to a texture osg::ref_ptr _overlaySubgraph; diff --git a/include/osgUtil/CullVisitor b/include/osgUtil/CullVisitor index 7bc1fc3e2..d09cdf561 100644 --- a/include/osgUtil/CullVisitor +++ b/include/osgUtil/CullVisitor @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -76,7 +76,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac virtual void apply(osg::Switch& node); virtual void apply(osg::LOD& node); virtual void apply(osg::ClearNode& node); - virtual void apply(osg::CameraNode& node); + virtual void apply(osg::Camera& node); virtual void apply(osg::OccluderNode& node); void setClearNode(const osg::ClearNode* earthSky) { _clearNode = earthSky; } diff --git a/include/osgUtil/IntersectVisitor b/include/osgUtil/IntersectVisitor index 2f820eb7d..1311f80e6 100644 --- a/include/osgUtil/IntersectVisitor +++ b/include/osgUtil/IntersectVisitor @@ -213,7 +213,7 @@ class OSGUTIL_EXPORT PickVisitor : public osgUtil::IntersectVisitor void apply(osg::Projection& projection); - void apply(osg::CameraNode& camera); + void apply(osg::Camera& camera); protected: diff --git a/include/osgUtil/IntersectionVisitor b/include/osgUtil/IntersectionVisitor index 02bfa6373..5f879fb1a 100644 --- a/include/osgUtil/IntersectionVisitor +++ b/include/osgUtil/IntersectionVisitor @@ -323,7 +323,7 @@ class OSGUTIL_EXPORT IntersectionVisitor : public osg::NodeVisitor virtual void apply(osg::PagedLOD& lod); virtual void apply(osg::Transform& transform); virtual void apply(osg::Projection& projection); - virtual void apply(osg::CameraNode& camera); + virtual void apply(osg::Camera& camera); protected: diff --git a/include/osgUtil/RenderStage b/include/osgUtil/RenderStage index 0501bd5d1..4fa797236 100644 --- a/include/osgUtil/RenderStage +++ b/include/osgUtil/RenderStage @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -119,9 +119,9 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin /** Get the clear color.*/ int getClearStencil() const { return _clearStencil; } - void setCameraNode(osg::CameraNode* camera) { if (_camera!=camera) { _camera = camera; _cameraRequiresSetUp = true; } } - osg::CameraNode* getCameraNode() { return _camera; } - const osg::CameraNode* getCameraNode() const { return _camera; } + void setCamera(osg::Camera* camera) { if (_camera!=camera) { _camera = camera; _cameraRequiresSetUp = true; } } + osg::Camera* getCamera() { return _camera; } + const osg::Camera* getCamera() const { return _camera; } void setCameraRequiresSetUp(bool flag) { _cameraRequiresSetUp = flag; } bool getCameraRequiresSetUp() const { return _cameraRequiresSetUp; } @@ -210,7 +210,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin GLenum _imageReadPixelDataType; }; - void attach(osg::CameraNode::BufferComponent buffer, osg::Image* image); + void attach(osg::Camera::BufferComponent buffer, osg::Image* image); protected: @@ -236,7 +236,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin int _clearStencil; bool _cameraRequiresSetUp; - osg::CameraNode* _camera; + osg::Camera* _camera; osg::ref_ptr _texture; unsigned int _level; @@ -246,7 +246,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin GLenum _imageReadPixelFormat; GLenum _imageReadPixelDataType; - std::map< osg::CameraNode::BufferComponent, Attachment> _bufferAttachmentMap; + std::map< osg::Camera::BufferComponent, Attachment> _bufferAttachmentMap; osg::ref_ptr _fbo; osg::ref_ptr _graphicsContext; diff --git a/include/osgUtil/SceneView b/include/osgUtil/SceneView index ddd8ce305..f99e5347f 100644 --- a/include/osgUtil/SceneView +++ b/include/osgUtil/SceneView @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include @@ -56,13 +56,13 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting void setDefaults(unsigned int options = STANDARD_SETTINGS); /** Set the camera used to represent the camera view of this SceneView.*/ - void setCamera(osg::CameraNode* camera); + void setCamera(osg::Camera* camera); /** Get the camera used to represent the camera view of this SceneView.*/ - osg::CameraNode* getCamera() { return _camera.get(); } + osg::Camera* getCamera() { return _camera.get(); } /** Get the const camera used to represent the camera view of this SceneView.*/ - const osg::CameraNode* getCamera() const { return _camera.get(); } + const osg::Camera* getCamera() const { return _camera.get(); } /** Set the data to view. The data will typically be * an osg::Scene but can be any osg::Node type. @@ -500,7 +500,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting osg::ref_ptr _frameStamp; - osg::ref_ptr _camera; + osg::ref_ptr _camera; osg::ref_ptr _globalStateSet; osg::ref_ptr _light; diff --git a/include/osgViewer/CompositeViewer b/include/osgViewer/CompositeViewer new file mode 100644 index 000000000..44d2373d8 --- /dev/null +++ b/include/osgViewer/CompositeViewer @@ -0,0 +1,68 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSGVIEWER_CompositeViewer +#define OSGVIEWER_CompositeViewer 1 + +#include +#include + +namespace osgViewer { + +// WARNING ** Under development do not use, yet :-) + +/** CompsiteViewer holds a or more views to a one more scenes.*/ +class OSGVIEWER_EXPORT CompositeViewer : public osg::Referenced +{ + public: + + CompositeViewer(); + virtual ~CompositeViewer(); + + void addView(osgViewer* view); + osgViewer* getView(unsigned i) { return _views[i].get(); } + const osgViewer* getView(unsigned i) const { return _views[i].get(); } + void getNumViews() const { return _views.size(); } + + /** Render a complete new frame. + * Calls frameAdvance(), frameEventTraversal(), frameUpateTraversal(), frameCullTraversal() and frameDrawTraversal(). + * Note, no internal makeCurrent() is issued before, or swap buffers called after frame(), these operations are the responsibility of the calling code.*/ + virtual void frame(); + + virtual void frameAdvance(); + virtual void frameEventTraversal(); + virtual void frameUpdateTraversal(); + virtual void frameCullTraversal(); + virtual void frameDrawTraversal(); + + /** Release all OpenGL objects associated with this viewer's scenegraph. Note, does not deleted the actual OpenGL objects, it just releases them to the pending GL object delete lists which will need flushing once a valid graphics context is obtained.*/ + virtual void releaseAllGLObjects(); + + /** Clean up all OpenGL objects associated with this viewer's scenegraph. Note, must only be called from the graphics context associated with this viewer.*/ + virtual void cleanup(); + + public: + + void init(); + + protected: + + typedef std::vector< osg::ref_ptr > Views; + Views _views; + +}; + + +} + +#endif diff --git a/include/osgViewer/GraphicsWindowProxy b/include/osgViewer/GraphicsWindowProxy new file mode 100644 index 000000000..b8594be5d --- /dev/null +++ b/include/osgViewer/GraphicsWindowProxy @@ -0,0 +1,88 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSGVIEWER_GRAPHICWINDOW +#define OSGVIEWER_GRAPHICWINDOW 1 + +#include +#include + +#include + +#include + +namespace osgViewer { + +/** GraphicsWindowProxy acts as an adpater GraphicsWindow which allows the implementation of the GraphicsWindow to be decoupled */ +class OSGVIEWER_EXPORT GraphicsWindowProxy : public osgViewer::GraphicsWindow +{ + public: + + GraphicsWindowProxy(); + + void setGraphicsWindowImplentation(osgViewer::GraphicsWindow* gw) { _gw = gw; } + + osgViewer::GraphicsWindow* getGraphicsWindowImplentation() { return _gw.get(); } + + const osgViewer::GraphicsWindow* getGraphicsWindowImplentation() const { return _gw.get(); } + + /** Realise the GraphicsContext implementation, + * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ + virtual bool realizeImplementation() { if (_gw.valid()) return _gw->realizeImplementation(); else osg::notify(osg::NOTICE)<<"GraphicsWindow::realizeImplementation() not implemented."<isRealizedImplementation(); else osg::notify(osg::NOTICE)<<"GraphicsWindow::isRealizedImplementation() not implemented."<closeImplementation(); else osg::notify(osg::NOTICE)<<"GraphicsWindow::closeImplementation() not implemented."<makeCurrentImplementation(); else osg::notify(osg::NOTICE)<<"GraphicsWindow::makeCurrentImplementation() not implemented."<makeContextCurrentImplementation(readContext); else osg::notify(osg::NOTICE)<<"GraphicsWindow::makeContextCurrentImplementation(..) not implemented."<bindPBufferToTextureImplementation(buffer) else osg::notify(osg::NOTICE)<<"GraphicsWindow::void bindPBufferToTextureImplementation(..) not implemented."<swapBuffersImplementation() else osg::notify(osg::NOTICE)<<"GraphicsWindow:: swapBuffersImplementation() not implemented."<requestRedraw(); } + + // Override from GUIActionAdapter + virtual void requestContinuousUpdate(bool needed=true) { if (_gw.valid()) _gw->tequestContinuousUpdate(needed); } + + // Override from GUIActionAdapter + virtual void requestWarpPointer(float x,float y) { if (_gw.valid()) _gw->requestWarpPointer(x,y); } + + + protected: + + osg::ref_ptr _gw; + +}; + + +} + +#endif diff --git a/include/osgViewer/Scene b/include/osgViewer/Scene new file mode 100644 index 000000000..c2ddae250 --- /dev/null +++ b/include/osgViewer/Scene @@ -0,0 +1,87 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSGVIEWER_SCENE +#define OSGVIEWER_SCENE 1 + +#include +#include +#include +#include + +#include + +#include + +namespace osgViewer{ + +// WARNING ** Under development do not use, yet :-) + +/** Scene holds the highe level reference to a single scene graph.*/ +class OSGVIEWER_EXPORT Scene : public virtual osg::Referenced +{ + public: + + Scene(); + virtual ~Scene(); + + void setSceneData(osg::Node* node); + osg::Node* getSceneData(); + const osg::Node* getSceneData() const; + + + void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; } + osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); } + const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); } + + typedef std::list< osg::ref_ptr > EventHandlers; + + void addEventHandler(osgGA::GUIEventHandler* eventHandler); + EventHandlers& getEventHandlers() { return _eventHandlers; } + const EventHandlers& getEventHandlers() const { return _eventHandlers; } + + void setDatabasePager(osgDB::DatabasePager* dp); + osgDB::DatabasePager* getDatabasePager() { return _databasePager.get(); } + const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); } + + virtual void frameAdvance(); + virtual void frameEventTraversal(); + virtual void frameUpdateTraversal(); + + public: + + void init(); + + protected: + + bool _firstFrame; + osg::Timer_t _startTick; + osg::ref_ptr _frameStamp; + + osg::ref_ptr _sceneData; + + osg::ref_ptr _updateVisitor; + + osg::ref_ptr _eventQueue; + osg::ref_ptr _eventVisitor; + + osg::ref_ptr _databasePager; + + EventHandlers _eventHandlers; + +}; + + +} + +#endif diff --git a/include/osgViewer/SimpleViewer b/include/osgViewer/SimpleViewer index 46f7b8cab..ba3b5796a 100644 --- a/include/osgViewer/SimpleViewer +++ b/include/osgViewer/SimpleViewer @@ -42,8 +42,8 @@ class OSGVIEWER_EXPORT SimpleViewer : public virtual osgViewer::GraphicsWindow const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); } - osg::CameraNode* getCamera(); - const osg::CameraNode* getCamera() const; + osg::Camera* getCamera(); + const osg::Camera* getCamera() const; void setCameraManipulator(osgGA::MatrixManipulator* manipulator); osgGA::MatrixManipulator* getCameraManipulator() { return _cameraManipulator.get(); } diff --git a/include/osgViewer/View b/include/osgViewer/View new file mode 100644 index 000000000..3eff188b1 --- /dev/null +++ b/include/osgViewer/View @@ -0,0 +1,58 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSGVIEWER_VIEW +#define OSGVIEWER_VIEW 1 + +#include +#include +#include + +/** View holds a single view on a scene, this view may be composed of one or more slave cameras.*/ +class OSGVIEWER_EXPORT View : public virtual osg::View, public osgViewer::Scene +{ + public: + + View(); + virtual ~View(); + + void setSceneData(osg::Node* node); + osg::Node* getSceneData(); + const osg::Node* getSceneData() const; + + void setCameraManipulator(osgGA::MatrixManipulator* manipulator); + osgGA::MatrixManipulator* getCameraManipulator() { return _cameraManipulator.get(); } + const osgGA::MatrixManipulator* getCameraManipulator() const { return _cameraManipulator.get(); } + + typedef std::list< osg::ref_ptr > EventHandlers; + + void addEventHandler(osgGA::GUIEventHandler* eventHandler); + EventHandlers& getEventHandlers() { return _eventHandlers; } + const EventHandlers& getEventHandlers() const { return _eventHandlers; } + + public: + + void init(); + + protected: + + + osg::ref_ptr _scene; + + osg::ref_ptr _sceneView; + osg::ref_ptr _cameraManipulator; + EventHandlers _eventHandlers; + +}; + +#endif diff --git a/include/osgViewer/Viewer b/include/osgViewer/Viewer new file mode 100644 index 000000000..4889a680f --- /dev/null +++ b/include/osgViewer/Viewer @@ -0,0 +1,61 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSGVIEWER_Viewer +#define OSGVIEWER_Viewer 1 + +#include +#include + +namespace osgViewer{ + +// WARNING ** Under development do not use, yet :-) + +/** Viewer holds a single view on to a single scene..*/ +class OSGVIEWER_EXPORT Viewer : public osgViewer::View +{ + public: + + Viewer(); + virtual ~Viewer(); + + /** Render a complete new frame. + * Calls frameAdvance(), frameEventTraversal(), frameUpateTraversal(), frameCullTraversal() and frameDrawTraversal(). + * Note, no internal makeCurrent() is issued before, or swap buffers called after frame(), these operations are the responsibility of the calling code.*/ + virtual void frame(); + + virtual void frameAdvance(); + virtual void frameEventTraversal(); + virtual void frameUpdateTraversal(); + virtual void frameCullTraversal(); + virtual void frameDrawTraversal(); + + /** Release all OpenGL objects associated with this viewer's scenegraph. Note, does not deleted the actual OpenGL objects, it just releases them to the pending GL object delete lists which will need flushing once a valid graphics context is obtained.*/ + virtual void releaseAllGLObjects(); + + /** Clean up all OpenGL objects associated with this viewer's scenegraph. Note, must only be called from the graphics context associated with this viewer.*/ + virtual void cleanup(); + + public: + + void init(); + + protected: + + +}; + + +} + +#endif diff --git a/src/osg/AnimationPath.cpp b/src/osg/AnimationPath.cpp index 7f9cec3b9..ef7ea37a0 100644 --- a/src/osg/AnimationPath.cpp +++ b/src/osg/AnimationPath.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -156,7 +156,7 @@ class AnimationPathCallbackVisitor : public NodeVisitor _pivotPoint(pivotPoint), _useInverseMatrix(useInverseMatrix) {} - virtual void apply(CameraNode& camera) + virtual void apply(Camera& camera) { Matrix matrix; if (_useInverseMatrix) diff --git a/src/osg/CameraNode.cpp b/src/osg/Camera.cpp similarity index 74% rename from src/osg/CameraNode.cpp rename to src/osg/Camera.cpp index c30dd3266..898aad7a3 100644 --- a/src/osg/CameraNode.cpp +++ b/src/osg/Camera.cpp @@ -10,12 +10,12 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ -#include +#include #include using namespace osg; -CameraNode::CameraNode(): +Camera::Camera(): _view(0), _clearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)), _clearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT), @@ -30,7 +30,7 @@ CameraNode::CameraNode(): setStateSet(new StateSet); } -CameraNode::CameraNode(const CameraNode& camera,const CopyOp& copyop): +Camera::Camera(const Camera& camera,const CopyOp& copyop): Transform(camera,copyop), CullSettings(camera), _view(camera._view), @@ -53,23 +53,23 @@ CameraNode::CameraNode(const CameraNode& camera,const CopyOp& copyop): } -CameraNode::~CameraNode() +Camera::~Camera() { } -bool CameraNode::isRenderToTextureCamera() const +bool Camera::isRenderToTextureCamera() const { return (!_bufferAttachmentMap.empty()); } -void CameraNode::setRenderTargetImplementation(RenderTargetImplementation impl) +void Camera::setRenderTargetImplementation(RenderTargetImplementation impl) { _renderTargetImplementation = impl; if (implsetMask(red,green,blue,alpha); } -void CameraNode::setViewport(osg::Viewport* viewport) +void Camera::setViewport(osg::Viewport* viewport) { if (_viewport == viewport) return; @@ -125,19 +125,19 @@ void CameraNode::setViewport(osg::Viewport* viewport) } } -void CameraNode::setViewport(int x,int y,int width,int height) +void Camera::setViewport(int x,int y,int width,int height) { if (!_viewport) setViewport(new osg::Viewport); if (_viewport.valid()) _viewport->setViewport(x,y,width,height); } -Matrixd CameraNode::getInverseViewMatrix() const +Matrixd Camera::getInverseViewMatrix() const { Matrixd inverse; inverse.invert(_viewMatrix); return inverse; } -void CameraNode::setProjectionMatrixAsOrtho(double left, double right, +void Camera::setProjectionMatrixAsOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { @@ -146,14 +146,14 @@ void CameraNode::setProjectionMatrixAsOrtho(double left, double right, zNear, zFar)); } -void CameraNode::setProjectionMatrixAsOrtho2D(double left, double right, +void Camera::setProjectionMatrixAsOrtho2D(double left, double right, double bottom, double top) { setProjectionMatrix(osg::Matrixd::ortho2D(left, right, bottom, top)); } -void CameraNode::setProjectionMatrixAsFrustum(double left, double right, +void Camera::setProjectionMatrixAsFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { @@ -162,14 +162,14 @@ void CameraNode::setProjectionMatrixAsFrustum(double left, double right, zNear, zFar)); } -void CameraNode::setProjectionMatrixAsPerspective(double fovy,double aspectRatio, +void Camera::setProjectionMatrixAsPerspective(double fovy,double aspectRatio, double zNear, double zFar) { setProjectionMatrix(osg::Matrixd::perspective(fovy,aspectRatio, zNear, zFar)); } -bool CameraNode::getProjectionMatrixAsOrtho(double& left, double& right, +bool Camera::getProjectionMatrixAsOrtho(double& left, double& right, double& bottom, double& top, double& zNear, double& zFar) { @@ -178,7 +178,7 @@ bool CameraNode::getProjectionMatrixAsOrtho(double& left, double& right, zNear, zFar); } -bool CameraNode::getProjectionMatrixAsFrustum(double& left, double& right, +bool Camera::getProjectionMatrixAsFrustum(double& left, double& right, double& bottom, double& top, double& zNear, double& zFar) { @@ -187,29 +187,29 @@ bool CameraNode::getProjectionMatrixAsFrustum(double& left, double& right, zNear, zFar); } -bool CameraNode::getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, +bool Camera::getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, double& zNear, double& zFar) { return _projectionMatrix.getPerspective(fovy, aspectRatio, zNear, zFar); } -void CameraNode::setViewMatrixAsLookAt(const Vec3& eye,const Vec3& center,const Vec3& up) +void Camera::setViewMatrixAsLookAt(const Vec3& eye,const Vec3& center,const Vec3& up) { setViewMatrix(osg::Matrixd::lookAt(eye,center,up)); } -void CameraNode::getViewMatrixAsLookAt(Vec3& eye,Vec3& center,Vec3& up,float lookDistance) +void Camera::getViewMatrixAsLookAt(Vec3& eye,Vec3& center,Vec3& up,float lookDistance) { _viewMatrix.getLookAt(eye,center,up,lookDistance); } -void CameraNode::attach(BufferComponent buffer, GLenum internalFormat) +void Camera::attach(BufferComponent buffer, GLenum internalFormat) { _bufferAttachmentMap[buffer]._internalFormat = internalFormat; } -void CameraNode::attach(BufferComponent buffer, osg::Texture* texture, unsigned int level, unsigned int face, bool mipMapGeneration) +void Camera::attach(BufferComponent buffer, osg::Texture* texture, unsigned int level, unsigned int face, bool mipMapGeneration) { _bufferAttachmentMap[buffer]._texture = texture; _bufferAttachmentMap[buffer]._level = level; @@ -217,26 +217,26 @@ void CameraNode::attach(BufferComponent buffer, osg::Texture* texture, unsigned _bufferAttachmentMap[buffer]._mipMapGeneration = mipMapGeneration; } -void CameraNode::attach(BufferComponent buffer, osg::Image* image) +void Camera::attach(BufferComponent buffer, osg::Image* image) { _bufferAttachmentMap[buffer]._image = image; } -void CameraNode::detach(BufferComponent buffer) +void Camera::detach(BufferComponent buffer) { _bufferAttachmentMap.erase(buffer); } -void CameraNode::releaseGLObjects(osg::State* state) const +void Camera::releaseGLObjects(osg::State* state) const { - if (state) const_cast(this)->_renderingCache[state->getContextID()] = 0; - else const_cast(this)->_renderingCache.setAllElementsTo(0); + if (state) const_cast(this)->_renderingCache[state->getContextID()] = 0; + else const_cast(this)->_renderingCache.setAllElementsTo(0); Transform::releaseGLObjects(state); } -bool CameraNode::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const +bool Camera::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { if (_referenceFrame==RELATIVE_RF) { @@ -256,7 +256,7 @@ bool CameraNode::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const return true; } -bool CameraNode::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const +bool Camera::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const { const Matrixd& inverse = getInverseViewMatrix(); diff --git a/src/osg/FrameBufferObject.cpp b/src/osg/FrameBufferObject.cpp index f52295251..984408e5e 100644 --- a/src/osg/FrameBufferObject.cpp +++ b/src/osg/FrameBufferObject.cpp @@ -282,7 +282,7 @@ FrameBufferAttachment::FrameBufferAttachment(TextureRectangle* target) _ximpl->textureTarget = target; } -FrameBufferAttachment::FrameBufferAttachment(CameraNode::Attachment& attachment) +FrameBufferAttachment::FrameBufferAttachment(Camera::Attachment& attachment) { osg::Texture* texture = attachment._texture.get(); @@ -344,12 +344,12 @@ FrameBufferAttachment::FrameBufferAttachment(CameraNode::Attachment& attachment) } else { - osg::notify(osg::WARN)<<"Error: FrameBufferAttachment::FrameBufferAttachment(CameraNode::Attachment&) passed an empty osg::Image, image must be allocated first."< #include #include -#include +#include #include diff --git a/src/osg/NodeTrackerCallback.cpp b/src/osg/NodeTrackerCallback.cpp index 8fc2b2bbe..7eb29647d 100644 --- a/src/osg/NodeTrackerCallback.cpp +++ b/src/osg/NodeTrackerCallback.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include using namespace osg; @@ -28,7 +28,7 @@ class ApplyMatrixVisitor : public NodeVisitor ApplyMatrixVisitor(const osg::Matrix& matrix): _matrix(matrix) {} - virtual void apply(CameraNode& camera) + virtual void apply(Camera& camera) { camera.setViewMatrix(_matrix); } diff --git a/src/osg/Transform.cpp b/src/osg/Transform.cpp index 80071f64b..5b44e3b73 100644 --- a/src/osg/Transform.cpp +++ b/src/osg/Transform.cpp @@ -11,7 +11,7 @@ * OpenSceneGraph Public License for more details. */ #include -#include +#include #include @@ -30,13 +30,13 @@ class TransformVisitor : public NodeVisitor CoordMode _coordMode; Matrix& _matrix; - bool _ignoreCameraNodes; + bool _ignoreCameras; - TransformVisitor(Matrix& matrix,CoordMode coordMode, bool ignoreCameraNodes): + TransformVisitor(Matrix& matrix,CoordMode coordMode, bool ignoreCameras): NodeVisitor(), _coordMode(coordMode), _matrix(matrix), - _ignoreCameraNodes(ignoreCameraNodes) + _ignoreCameras(ignoreCameras) {} virtual void apply(Transform& transform) @@ -56,9 +56,9 @@ class TransformVisitor : public NodeVisitor if (nodePath.empty()) return; unsigned int i = 0; - if (_ignoreCameraNodes) + if (_ignoreCameras) { - // we need to found out the last absolute CameraNode in NodePath and + // we need to found out the last absolute Camera in NodePath and // set the i index to after it so the final accumulation set ignores it. i = nodePath.size(); NodePath::const_reverse_iterator ritr; @@ -66,7 +66,7 @@ class TransformVisitor : public NodeVisitor ritr != nodePath.rend(); ++ritr, --i) { - const osg::CameraNode* camera = dynamic_cast(*ritr); + const osg::Camera* camera = dynamic_cast(*ritr); if (camera && (camera->getReferenceFrame()==osg::Transform::ABSOLUTE_RF || camera->getParents().empty())) { @@ -86,35 +86,35 @@ class TransformVisitor : public NodeVisitor }; -Matrix osg::computeLocalToWorld(const NodePath& nodePath, bool ignoreCameraNodes) +Matrix osg::computeLocalToWorld(const NodePath& nodePath, bool ignoreCameras) { Matrix matrix; - TransformVisitor tv(matrix,TransformVisitor::LOCAL_TO_WORLD,ignoreCameraNodes); + TransformVisitor tv(matrix,TransformVisitor::LOCAL_TO_WORLD,ignoreCameras); tv.accumulate(nodePath); return matrix; } -Matrix osg::computeWorldToLocal(const NodePath& nodePath, bool ignoreCameraNodes) +Matrix osg::computeWorldToLocal(const NodePath& nodePath, bool ignoreCameras) { osg::Matrix matrix; - TransformVisitor tv(matrix,TransformVisitor::WORLD_TO_LOCAL,ignoreCameraNodes); + TransformVisitor tv(matrix,TransformVisitor::WORLD_TO_LOCAL,ignoreCameras); tv.accumulate(nodePath); return matrix; } -Matrix osg::computeLocalToEye(const Matrix& modelview,const NodePath& nodePath, bool ignoreCameraNodes) +Matrix osg::computeLocalToEye(const Matrix& modelview,const NodePath& nodePath, bool ignoreCameras) { Matrix matrix(modelview); - TransformVisitor tv(matrix,TransformVisitor::LOCAL_TO_WORLD,ignoreCameraNodes); + TransformVisitor tv(matrix,TransformVisitor::LOCAL_TO_WORLD,ignoreCameras); tv.accumulate(nodePath); return matrix; } -Matrix osg::computeEyeToLocal(const Matrix& modelview,const NodePath& nodePath, bool ignoreCameraNodes) +Matrix osg::computeEyeToLocal(const Matrix& modelview,const NodePath& nodePath, bool ignoreCameras) { Matrix matrix; matrix.invert(modelview); - TransformVisitor tv(matrix,TransformVisitor::WORLD_TO_LOCAL,ignoreCameraNodes); + TransformVisitor tv(matrix,TransformVisitor::WORLD_TO_LOCAL,ignoreCameras); tv.accumulate(nodePath); return matrix; } diff --git a/src/osg/View.cpp b/src/osg/View.cpp index f25944645..7c753e4be 100644 --- a/src/osg/View.cpp +++ b/src/osg/View.cpp @@ -6,7 +6,7 @@ * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRA;NTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ @@ -15,203 +15,69 @@ using namespace osg; -// use this cull callback to allow the camera to traverse the View's children without -// actuall having them assigned as children to the camea itself. This make the camera a -// decorator without ever directly being assigned to it. -class ViewCameraTraverseNodeCallback : public osg::NodeCallback -{ -public: - - ViewCameraTraverseNodeCallback(osg::View* view):_view(view) {} - - virtual void operator()(osg::Node*, osg::NodeVisitor* nv) - { - _view->Group::traverse(*nv); - } - - osg::View* _view; -}; - - View::View() { - setReferenceFrame(osg::Transform::ABSOLUTE_RF); } -/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ -View::View(const View& view,const CopyOp& copyop): - Transform(view,copyop), - CullSettings(view), - _projectionMatrix(view._projectionMatrix), - _viewMatrix(view._viewMatrix) -{ - // need to clone the cameras. - for(unsigned int i=0; i(cd._camera->clone(copyop)), cd._projectionOffset, cd._viewOffset); - } -} - - View::~View() { // detatch the cameras from this View to prevent dangling pointers - for(CameraList::iterator itr = _cameras.begin(); - itr != _cameras.end(); + for(Slaves::iterator itr = _slaves.begin(); + itr != _slaves.end(); ++itr) { - CameraData& cd = *itr; + Slave& cd = *itr; cd._camera->setView(0); cd._camera->setCullCallback(0); } } -Matrixd View::getInverseViewMatrix() const +void View::updateSlaves() { - Matrixd inverse; - inverse.invert(_viewMatrix); - return inverse; -} - -void View::setProjectionMatrixAsOrtho(double left, double right, - double bottom, double top, - double zNear, double zFar) -{ - setProjectionMatrix(osg::Matrixd::ortho(left, right, - bottom, top, - zNear, zFar)); -} - -void View::setProjectionMatrixAsOrtho2D(double left, double right, - double bottom, double top) -{ - setProjectionMatrix(osg::Matrixd::ortho2D(left, right, - bottom, top)); -} - -void View::setProjectionMatrixAsFrustum(double left, double right, - double bottom, double top, - double zNear, double zFar) -{ - setProjectionMatrix(osg::Matrixd::frustum(left, right, - bottom, top, - zNear, zFar)); -} - -void View::setProjectionMatrixAsPerspective(double fovy,double aspectRatio, - double zNear, double zFar) -{ - setProjectionMatrix(osg::Matrixd::perspective(fovy,aspectRatio, - zNear, zFar)); -} - -bool View::getProjectionMatrixAsOrtho(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) -{ - return _projectionMatrix.getOrtho(left, right, - bottom, top, - zNear, zFar); -} - -bool View::getProjectionMatrixAsFrustum(double& left, double& right, - double& bottom, double& top, - double& zNear, double& zFar) -{ - return _projectionMatrix.getFrustum(left, right, - bottom, top, - zNear, zFar); -} - -bool View::getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, - double& zNear, double& zFar) -{ - return _projectionMatrix.getPerspective(fovy, aspectRatio, zNear, zFar); -} - -void View::setViewMatrixAsLookAt(const Vec3& eye,const Vec3& center,const Vec3& up) -{ - setViewMatrix(osg::Matrixd::lookAt(eye,center,up)); -} - -void View::getViewMatrixAsLookAt(Vec3& eye,Vec3& center,Vec3& up,float lookDistance) -{ - _viewMatrix.getLookAt(eye,center,up,lookDistance); -} - - -bool View::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const -{ - if (_referenceFrame==RELATIVE_RF) - { - matrix.preMult(_viewMatrix); - } - else // absolute - { - matrix = _viewMatrix; - } - return true; -} - -bool View::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const -{ - const Matrixd& inverse = getInverseViewMatrix(); - - if (_referenceFrame==RELATIVE_RF) - { - // note doing inverse so pre becomes post. - matrix.postMult(inverse); - } - else // absolute - { - matrix = inverse; - } - return true; -} - -void View::updateCameras() -{ - for(CameraList::iterator itr = _cameras.begin(); - itr != _cameras.end(); + if (!_camera) return; + + for(Slaves::iterator itr = _slaves.begin(); + itr != _slaves.end(); ++itr) { - CameraData& cd = *itr; - cd._camera->setProjectionMatrix(cd._projectionOffset * _projectionMatrix); - cd._camera->setViewMatrix(cd._viewOffset * _viewMatrix); - cd._camera->inheritCullSettings(*this); + Slave& cd = *itr; + cd._camera->setProjectionMatrix(cd._projectionOffset * _camera->getProjectionMatrix()); + cd._camera->setViewMatrix(cd._viewOffset * _camera->getViewMatrix()); + cd._camera->inheritCullSettings(*_camera); } } -bool View::addCamera(osg::CameraNode* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffset) +bool View::addSlave(osg::Camera* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffset) { if (!camera) return false; - ViewCameraTraverseNodeCallback* cb = new ViewCameraTraverseNodeCallback(this); - camera->setCullCallback(cb); camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); - camera->setProjectionMatrix(projectionOffset * _projectionMatrix); - camera->setViewMatrix(viewOffset * _viewMatrix); - camera->inheritCullSettings(*this); - - _cameras.push_back(CameraData(camera, projectionOffset, viewOffset)); + + if (_camera.valid()) + { + camera->setProjectionMatrix(projectionOffset * _camera->getProjectionMatrix()); + camera->setViewMatrix(viewOffset * _camera->getViewMatrix()); + camera->inheritCullSettings(*_camera); + } + + _slaves.push_back(Slave(camera, projectionOffset, viewOffset)); // osg::notify(osg::NOTICE)<<"Added camera"<= _cameras.size()) return false; + if (pos >= _slaves.size()) return false; - _cameras[pos]._camera->setView(0); - _cameras[pos]._camera->setCullCallback(0); + _slaves[pos]._camera->setView(0); + _slaves[pos]._camera->setCullCallback(0); - _cameras.erase(_cameras.begin()+pos); + _slaves.erase(_slaves.begin()+pos); osg::notify(osg::NOTICE)<<"Removed camera"<getTextureMatrix().getValue()); // Transform texture coordinates if texture matrix is not an identity mat - osg::Matrix identityMat; - identityMat.makeIdentity(); osg::Vec2Array* texCoords = new osg::Vec2Array(thisPtr->textureCoords.size()); - if (textureMat == identityMat) + if (textureMat.isIdentity()) { // Set the texture coordinates for (unsigned int i = 0; i < thisPtr->textureCoords.size(); i++) diff --git a/src/osgPlugins/dae/daeWSceneObjects.cpp b/src/osgPlugins/dae/daeWSceneObjects.cpp index 3a7289e0c..e5d02dbcd 100644 --- a/src/osgPlugins/dae/daeWSceneObjects.cpp +++ b/src/osgPlugins/dae/daeWSceneObjects.cpp @@ -148,7 +148,7 @@ void daeWriter::apply( osg::LightSource &node ) } //CAMERA -void daeWriter::apply( osg::CameraNode &node ) +void daeWriter::apply( osg::Camera &node ) { #ifdef _DEBUG debugPrint( node ); diff --git a/src/osgPlugins/dae/daeWriter.h b/src/osgPlugins/dae/daeWriter.h index 360ce3a72..2da88a844 100644 --- a/src/osgPlugins/dae/daeWriter.h +++ b/src/osgPlugins/dae/daeWriter.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -88,7 +88,7 @@ public: virtual void apply( osg::Geode &node ); virtual void apply( osg::Group &node ); virtual void apply( osg::LightSource &node ); - virtual void apply( osg::CameraNode &node ); + virtual void apply( osg::Camera &node ); virtual void apply( osg::MatrixTransform &node ); virtual void apply( osg::PositionAttitudeTransform &node ); virtual void apply( osg::Switch &node ); diff --git a/src/osgPlugins/ive/CameraNode.cpp b/src/osgPlugins/ive/Camera.cpp similarity index 86% rename from src/osgPlugins/ive/CameraNode.cpp rename to src/osgPlugins/ive/Camera.cpp index fb6ba7f18..4ab6030c7 100644 --- a/src/osgPlugins/ive/CameraNode.cpp +++ b/src/osgPlugins/ive/Camera.cpp @@ -1,8 +1,8 @@ /********************************************************************** * - * FILE: CameraNode.cpp + * FILE: Camera.cpp * - * DESCRIPTION: Read/Write osg::CameraNode in binary format to disk. + * DESCRIPTION: Read/Write osg::Camera in binary format to disk. * * CREATED BY: Auto generated by iveGenerated * and later modified by Rune Schmidt Jensen. @@ -13,15 +13,15 @@ **********************************************************************/ #include "Exception.h" -#include "CameraNode.h" +#include "Camera.h" #include "Transform.h" #include "Image.h" using namespace ive; -void CameraNode::write(DataOutputStream* out){ - // Write CameraNode's identification. - out->writeInt(IVECAMERANODE); +void Camera::write(DataOutputStream* out){ + // Write Camera's identification. + out->writeInt(IVECAMERA); // If the osg class is inherited by any other class we should also write this to file. osg::Transform* transform = dynamic_cast(this); @@ -29,7 +29,7 @@ void CameraNode::write(DataOutputStream* out){ ((ive::Transform*)(transform))->write(out); } else - throw Exception("CameraNode::write(): Could not cast this osg::CameraNode to an osg::Group."); + throw Exception("Camera::write(): Could not cast this osg::Camera to an osg::Group."); out->writeVec4(getClearColor()); @@ -49,7 +49,7 @@ void CameraNode::write(DataOutputStream* out){ out->writeInt(getTransformOrder()); - // Write CameraNode's properties. + // Write Camera's properties. out->writeMatrixd(getProjectionMatrix()); out->writeMatrixd(getViewMatrix()); @@ -88,13 +88,13 @@ void CameraNode::write(DataOutputStream* out){ } -void CameraNode::read(DataInputStream* in) +void Camera::read(DataInputStream* in) { - // Read CameraNode's identification. + // Read Camera's identification. int id = in->peekInt(); - if(id == IVECAMERANODE) + if(id == IVECAMERA) { - // Code to read CameraNode's properties. + // Code to read Camera's properties. id = in->readInt(); // If the osg class is inherited by any other class we should also read this from file. osg::Transform* transform = dynamic_cast(this); @@ -103,7 +103,7 @@ void CameraNode::read(DataInputStream* in) ((ive::Transform*)(transform))->read(in); } else - throw Exception("CameraNode::read(): Could not cast this osg::CameraNode to an osg::Group."); + throw Exception("Camera::read(): Could not cast this osg::Camera to an osg::Group."); setClearColor(in->readVec4()); setClearMask(in->readUInt()); @@ -166,6 +166,6 @@ void CameraNode::read(DataInputStream* in) } } else{ - throw Exception("CameraNode::read(): Expected CameraNode identification"); + throw Exception("Camera::read(): Expected Camera identification"); } } diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index 6ba229fd8..833a507bd 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -50,7 +50,7 @@ #include "Group.h" #include "MatrixTransform.h" -#include "CameraNode.h" +#include "Camera.h" #include "CameraView.h" #include "Geode.h" #include "LightSource.h" @@ -1207,9 +1207,9 @@ osg::Node* DataInputStream::readNode() node = new osg::MatrixTransform(); ((ive::MatrixTransform*)(node))->read(this); } - else if(nodeTypeID== IVECAMERANODE){ - node = new osg::CameraNode(); - ((ive::CameraNode*)(node))->read(this); + else if(nodeTypeID== IVECAMERA){ + node = new osg::Camera(); + ((ive::Camera*)(node))->read(this); } else if(nodeTypeID== IVECAMERAVIEW){ node = new osg::CameraView(); diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index ed8776802..2d66bbb9e 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -53,7 +53,7 @@ #include "Group.h" #include "MatrixTransform.h" -#include "CameraNode.h" +#include "Camera.h" #include "CameraView.h" #include "Geode.h" #include "LightSource.h" @@ -927,8 +927,8 @@ void DataOutputStream::writeNode(const osg::Node* node) if(dynamic_cast(node)){ ((ive::MatrixTransform*)(node))->write(this); } - else if(dynamic_cast(node)){ - ((ive::CameraNode*)(node))->write(this); + else if(dynamic_cast(node)){ + ((ive::Camera*)(node))->write(this); } else if(dynamic_cast(node)){ ((ive::CameraView*)(node))->write(this); diff --git a/src/osgPlugins/ive/GNUmakefile b/src/osgPlugins/ive/GNUmakefile index cc82b6978..9f6338092 100644 --- a/src/osgPlugins/ive/GNUmakefile +++ b/src/osgPlugins/ive/GNUmakefile @@ -14,7 +14,7 @@ CXXFILES =\ ClipNode.cpp\ ClipPlane.cpp\ ClusterCullingCallback.cpp\ - CameraNode.cpp\ + Camera.cpp\ CameraView.cpp\ ConeSector.cpp\ ConvexPlanarOccluder.cpp\ diff --git a/src/osgPlugins/ive/ReadWrite.h b/src/osgPlugins/ive/ReadWrite.h index c96ff3928..9a7e14386 100644 --- a/src/osgPlugins/ive/ReadWrite.h +++ b/src/osgPlugins/ive/ReadWrite.h @@ -34,7 +34,7 @@ namespace ive { #define IVETEXGENNODE 0x00000025 #define IVECLIPNODE 0x00000026 #define IVEPROXYNODE 0x00000027 -#define IVECAMERANODE 0x00000028 +#define IVECAMERA 0x00000028 #define IVECAMERAVIEW 0x00000029 #define IVEAUTOTRANSFORM 0x00000030 diff --git a/src/osgPlugins/osg/CameraNode.cpp b/src/osgPlugins/osg/Camera.cpp similarity index 56% rename from src/osgPlugins/osg/CameraNode.cpp rename to src/osgPlugins/osg/Camera.cpp index b0dcc7eb6..d39bff0b5 100644 --- a/src/osgPlugins/osg/CameraNode.cpp +++ b/src/osgPlugins/osg/Camera.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -12,29 +12,40 @@ using namespace osg; using namespace osgDB; // forward declare functions to use later. -bool CameraNode_readLocalData(Object& obj, Input& fr); -bool CameraNode_writeLocalData(const Object& obj, Output& fw); +bool Camera_readLocalData(Object& obj, Input& fr); +bool Camera_writeLocalData(const Object& obj, Output& fw); -bool CameraNode_matchBufferComponentStr(const char* str,CameraNode::BufferComponent& buffer); -const char* CameraNode_getBufferComponentStr(CameraNode::BufferComponent buffer); +bool Camera_matchBufferComponentStr(const char* str,Camera::BufferComponent& buffer); +const char* Camera_getBufferComponentStr(Camera::BufferComponent buffer); +// register the read and write functions with the osgDB::Registry. +RegisterDotOsgWrapperProxy g_CameraProxy +( + new osg::Camera, + "Camera", + "Object Node Transform Camera Group", + &Camera_readLocalData, + &Camera_writeLocalData, + DotOsgWrapper::READ_AND_WRITE +); + // register the read and write functions with the osgDB::Registry. RegisterDotOsgWrapperProxy g_CameraNodeProxy ( - new osg::CameraNode, + new osg::Camera, "CameraNode", "Object Node Transform CameraNode Group", - &CameraNode_readLocalData, - &CameraNode_writeLocalData, + &Camera_readLocalData, + &Camera_writeLocalData, DotOsgWrapper::READ_AND_WRITE ); -bool CameraNode_readLocalData(Object& obj, Input& fr) +bool Camera_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; - CameraNode& camera = static_cast(obj); + Camera& camera = static_cast(obj); if (fr.matchSequence("clearColor %f %f %f %f")) { @@ -71,11 +82,11 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("transformOrder %w")) { - if (fr[1].matchWord("PRE_MULTIPLY")) camera.setTransformOrder(osg::CameraNode::PRE_MULTIPLY); - else if (fr[1].matchWord("POST_MULTIPLY")) camera.setTransformOrder(osg::CameraNode::POST_MULTIPLY); + if (fr[1].matchWord("PRE_MULTIPLY")) camera.setTransformOrder(osg::Camera::PRE_MULTIPLY); + else if (fr[1].matchWord("POST_MULTIPLY")) camera.setTransformOrder(osg::Camera::POST_MULTIPLY); // the following are for backwards compatibility. - else if (fr[1].matchWord("PRE_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::PRE_MULTIPLY); - else if (fr[1].matchWord("POST_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::POST_MULTIPLY); + else if (fr[1].matchWord("PRE_MULTIPLE")) camera.setTransformOrder(osg::Camera::PRE_MULTIPLY); + else if (fr[1].matchWord("POST_MULTIPLE")) camera.setTransformOrder(osg::Camera::POST_MULTIPLY); fr += 2; iteratorAdvanced = true; @@ -96,9 +107,9 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("renderOrder %w")) { - if (fr[1].matchWord("PRE_RENDER")) camera.setRenderOrder(osg::CameraNode::PRE_RENDER); - else if (fr[1].matchWord("NESTED_RENDER")) camera.setRenderOrder(osg::CameraNode::NESTED_RENDER); - else if (fr[1].matchWord("POST_RENDER")) camera.setRenderOrder(osg::CameraNode::POST_RENDER); + if (fr[1].matchWord("PRE_RENDER")) camera.setRenderOrder(osg::Camera::PRE_RENDER); + else if (fr[1].matchWord("NESTED_RENDER")) camera.setRenderOrder(osg::Camera::NESTED_RENDER); + else if (fr[1].matchWord("POST_RENDER")) camera.setRenderOrder(osg::Camera::POST_RENDER); fr += 2; iteratorAdvanced = true; @@ -106,13 +117,13 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("renderTargetImplementation %w")) { - osg::CameraNode::RenderTargetImplementation implementation = osg::CameraNode::FRAME_BUFFER; + osg::Camera::RenderTargetImplementation implementation = osg::Camera::FRAME_BUFFER; - if (fr[1].matchWord("FRAME_BUFFER_OBJECT")) implementation = osg::CameraNode::FRAME_BUFFER_OBJECT; - else if (fr[1].matchWord("PIXEL_BUFFER_RTT")) implementation = osg::CameraNode::PIXEL_BUFFER_RTT; - else if (fr[1].matchWord("PIXEL_BUFFER")) implementation = osg::CameraNode::PIXEL_BUFFER; - else if (fr[1].matchWord("FRAME_BUFFER")) implementation = osg::CameraNode::FRAME_BUFFER; - else if (fr[1].matchWord("SEPERATE_WINDOW")) implementation = osg::CameraNode::SEPERATE_WINDOW; + if (fr[1].matchWord("FRAME_BUFFER_OBJECT")) implementation = osg::Camera::FRAME_BUFFER_OBJECT; + else if (fr[1].matchWord("PIXEL_BUFFER_RTT")) implementation = osg::Camera::PIXEL_BUFFER_RTT; + else if (fr[1].matchWord("PIXEL_BUFFER")) implementation = osg::Camera::PIXEL_BUFFER; + else if (fr[1].matchWord("FRAME_BUFFER")) implementation = osg::Camera::FRAME_BUFFER; + else if (fr[1].matchWord("SEPERATE_WINDOW")) implementation = osg::Camera::SEPERATE_WINDOW; camera.setRenderTargetImplementation(implementation); @@ -122,13 +133,13 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("renderTargetImplementation %w")) { - osg::CameraNode::RenderTargetImplementation fallback = camera.getRenderTargetFallback(); + osg::Camera::RenderTargetImplementation fallback = camera.getRenderTargetFallback(); - if (fr[1].matchWord("FRAME_BUFFER_OBJECT")) fallback = osg::CameraNode::FRAME_BUFFER_OBJECT; - else if (fr[1].matchWord("PIXEL_BUFFER_RTT")) fallback = osg::CameraNode::PIXEL_BUFFER_RTT; - else if (fr[1].matchWord("PIXEL_BUFFER")) fallback = osg::CameraNode::PIXEL_BUFFER; - else if (fr[1].matchWord("FRAME_BUFFER")) fallback = osg::CameraNode::FRAME_BUFFER; - else if (fr[1].matchWord("SEPERATE_WINDOW")) fallback = osg::CameraNode::SEPERATE_WINDOW; + if (fr[1].matchWord("FRAME_BUFFER_OBJECT")) fallback = osg::Camera::FRAME_BUFFER_OBJECT; + else if (fr[1].matchWord("PIXEL_BUFFER_RTT")) fallback = osg::Camera::PIXEL_BUFFER_RTT; + else if (fr[1].matchWord("PIXEL_BUFFER")) fallback = osg::Camera::PIXEL_BUFFER; + else if (fr[1].matchWord("FRAME_BUFFER")) fallback = osg::Camera::FRAME_BUFFER; + else if (fr[1].matchWord("SEPERATE_WINDOW")) fallback = osg::Camera::SEPERATE_WINDOW; camera.setRenderTargetImplementation(camera.getRenderTargetImplementation(), fallback); @@ -141,12 +152,12 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) { int entry = fr[1].getNoNestedBrackets(); - CameraNode::BufferComponent buffer; - CameraNode_matchBufferComponentStr(fr[1].getStr(),buffer); + Camera::BufferComponent buffer; + Camera_matchBufferComponentStr(fr[1].getStr(),buffer); fr += 3; - CameraNode::Attachment& attachment = camera.getBufferAttachmentMap()[buffer]; + Camera::Attachment& attachment = camera.getBufferAttachmentMap()[buffer]; // read attachment data. while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) @@ -218,9 +229,9 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) } -bool CameraNode_writeLocalData(const Object& obj, Output& fw) +bool Camera_writeLocalData(const Object& obj, Output& fw) { - const CameraNode& camera = static_cast(obj); + const Camera& camera = static_cast(obj); fw.indent()<<"clearColor "<second; - fw.indent()<<"bufferComponent "<first)<<" {"<second; + fw.indent()<<"bufferComponent "<first)<<" {"<", "ON | OFF - Where supported, switch on or off the processor affinity." ); @@ -554,8 +553,8 @@ bool OsgCameraGroup::realize() sv->setDefaults(_realizeSceneViewOptions); // note, should really compute the projection and view offsets... - // but not critical as Producer controls the CameraNode matrices via SceneView. - _view->addCamera(sv->getCamera()); + // but not critical as Producer controls the osg::Camera matrices via SceneView. + _view->addSlave(sv->getCamera()); sv->setView(_view.get()); if (_renderSurfaceStateMap.count(rs)==0) @@ -693,7 +692,7 @@ bool OsgCameraGroup::realize() // disable multi-threading of cameras. if (_threadModel == Producer::CameraGroup::ThreadPerCamera) { - std::set renderSurfaceSet; + std::set renderSurfaceSet; for( unsigned int i = 0; i < _cfg->getNumberOfCameras(); i++ ) { Producer::Camera *cam = _cfg->getCamera(i); @@ -707,7 +706,7 @@ bool OsgCameraGroup::realize() osg::notify(osg::INFO)<<" threading problems when camera's share a RenderSurface."<1 && RenderSurface::allGLContextsAreShared()) + else if (renderSurfaceSet.size()>1 && Producer::RenderSurface::allGLContextsAreShared()) { // we have multiple RenderSurface, but with share contexts, which is dangerous for multi-threaded usage, // so need to disable multi-threading to prevent problems. @@ -811,16 +810,21 @@ void OsgCameraGroup::frame() double left, right, bottom, top, nearClip, farClip; getLensParams(left, right, bottom, top, nearClip, farClip); - if (getLensProjectionType()==Camera::Lens::Perspective) + if (!_view->getCamera()) { - _view->setProjectionMatrixAsFrustum(left, right, bottom, top, nearClip, farClip); + _view->setCamera(new osg::Camera); + } + + if (getLensProjectionType()==Producer::Camera::Lens::Perspective) + { + _view->getCamera()->setProjectionMatrixAsFrustum(left, right, bottom, top, nearClip, farClip); } else { - _view->setProjectionMatrixAsOrtho(left, right, bottom, top, nearClip, farClip); + _view->getCamera()->setProjectionMatrixAsOrtho(left, right, bottom, top, nearClip, farClip); } - _view->setViewMatrix(getViewMatrix()); + _view->getCamera()->setViewMatrix(getViewMatrix()); } // the settings in sync. diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 9d4c5a9bb..f6d8d092b 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -21,10 +21,7 @@ #include -using namespace Producer; using namespace osgProducer; -using namespace osg; - #ifdef __APPLE__ #define SINGLE_THREAD_KEYBOARDMOUSE @@ -60,7 +57,7 @@ public: traverse(node); } - NodePath _pathToCoordinateSystemNode; + osg::NodePath _pathToCoordinateSystemNode; }; diff --git a/src/osgSim/Impostor.cpp b/src/osgSim/Impostor.cpp index 2fc2de0e6..c3849a63e 100644 --- a/src/osgSim/Impostor.cpp +++ b/src/osgSim/Impostor.cpp @@ -387,11 +387,11 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) Vec3 center_world = bs.center()*matrix; - osg::CameraNode* camera = impostorSprite->getCameraNode(); + osg::Camera* camera = impostorSprite->getCamera(); if (!camera) { - camera = new osg::CameraNode; - impostorSprite->setCameraNode(camera); + camera = new osg::Camera; + impostorSprite->setCamera(camera); } camera->setCullCallback(new ImpostorTraverseNodeCallback(this)); @@ -456,13 +456,13 @@ ImpostorSprite* Impostor::createImpostorSprite(osgUtil::CullVisitor* cv) camera->setViewport(0,0,new_s,new_t); // tell the camera to use OpenGL frame buffer object where supported. - camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT, osg::CameraNode::FRAME_BUFFER); + camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT, osg::Camera::FRAME_BUFFER); // set the camera to render before the main camera. - camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + camera->setRenderOrder(osg::Camera::PRE_RENDER); // attach the texture and use it as the color buffer. - camera->attach(osg::CameraNode::COLOR_BUFFER, texture); + camera->attach(osg::Camera::COLOR_BUFFER, texture); // do the cull traversal on the subgraph camera->accept(*cv); diff --git a/src/osgSim/OverlayNode.cpp b/src/osgSim/OverlayNode.cpp index 9d3338ade..50261d365 100644 --- a/src/osgSim/OverlayNode.cpp +++ b/src/osgSim/OverlayNode.cpp @@ -68,7 +68,7 @@ void OverlayNode::init() if (!_camera) { // create the camera - _camera = new osg::CameraNode; + _camera = new osg::Camera; _camera->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,0.0f)); @@ -76,13 +76,13 @@ void OverlayNode::init() _camera->setViewport(0,0,tex_width,tex_height); // set the camera to render before the main camera. - _camera->setRenderOrder(osg::CameraNode::PRE_RENDER); + _camera->setRenderOrder(osg::Camera::PRE_RENDER); // tell the camera to use OpenGL frame buffer object where supported. - _camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT); + _camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. - _camera->attach(osg::CameraNode::COLOR_BUFFER, _texture.get()); + _camera->attach(osg::Camera::COLOR_BUFFER, _texture.get()); } if (!_texgenNode) _texgenNode = new osg::TexGenNode; @@ -122,7 +122,7 @@ void OverlayNode::traverse(osg::NodeVisitor& nv) csn = dynamic_cast(*itr); } - _camera->setReferenceFrame(osg::CameraNode::ABSOLUTE_RF); + _camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); if (csn) { diff --git a/src/osgText/FadeText.cpp b/src/osgText/FadeText.cpp index f3a268dfa..4f6d66de1 100644 --- a/src/osgText/FadeText.cpp +++ b/src/osgText/FadeText.cpp @@ -401,11 +401,11 @@ void FadeText::drawImplementation(osg::RenderInfo& renderInfo) const osg::Matrix lmv = atc._matrix; lmv.postMult(state.getModelViewMatrix()); - if (renderInfo.getView()) + if (renderInfo.getView() && renderInfo.getView()->getCamera()) { // move from camera into the view space. lmv.postMult(state.getInitialInverseViewMatrix()); - lmv.postMult(renderInfo.getView()->getViewMatrix()); + lmv.postMult(renderInfo.getView()->getCamera()->getViewMatrix()); } FadeTextData ftd(const_cast(this)); diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 45520ea52..6c86464c2 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -1065,7 +1065,7 @@ void CullVisitor::apply(osg::ClearNode& node) } -void CullVisitor::apply(osg::CameraNode& camera) +void CullVisitor::apply(osg::Camera& camera) { // push the node's state. StateSet* node_state = camera.getStateSet(); @@ -1074,7 +1074,7 @@ void CullVisitor::apply(osg::CameraNode& camera) // Save current cull settings CullSettings saved_cull_settings(*this); - // activate all active cull settings from this CameraNode + // activate all active cull settings from this Camera inheritCullSettings(camera); RefMatrix& originalModelView = getModelViewMatrix(); @@ -1084,7 +1084,7 @@ void CullVisitor::apply(osg::CameraNode& camera) pushProjectionMatrix(createOrReuseMatrix(camera.getProjectionMatrix())); pushModelViewMatrix(createOrReuseMatrix(camera.getViewMatrix())); } - else if (camera.getTransformOrder()==osg::CameraNode::POST_MULTIPLY) + else if (camera.getTransformOrder()==osg::Camera::POST_MULTIPLY) { pushProjectionMatrix(createOrReuseMatrix(getProjectionMatrix()*camera.getProjectionMatrix())); pushModelViewMatrix(createOrReuseMatrix(getModelViewMatrix()*camera.getViewMatrix())); @@ -1096,7 +1096,7 @@ void CullVisitor::apply(osg::CameraNode& camera) } - if (camera.getRenderOrder()==osg::CameraNode::NESTED_RENDER) + if (camera.getRenderOrder()==osg::Camera::NESTED_RENDER) { handle_cull_callbacks_and_traverse(camera); } @@ -1117,7 +1117,7 @@ void CullVisitor::apply(osg::CameraNode& camera) OpenThreads::ScopedLock lock(*(camera.getDataChangeMutex())); rtts = new osgUtil::RenderStage; - rtts->setCameraNode(&camera); + rtts->setCamera(&camera); if (camera.getDrawBuffer() != GL_NONE) { @@ -1203,7 +1203,7 @@ void CullVisitor::apply(osg::CameraNode& camera) // dependancy list. switch(camera.getRenderOrder()) { - case osg::CameraNode::PRE_RENDER: + case osg::Camera::PRE_RENDER: getCurrentRenderBin()->getStage()->addPreRenderStage(rtts.get(),camera.getRenderOrderNum()); break; default: diff --git a/src/osgUtil/IntersectVisitor.cpp b/src/osgUtil/IntersectVisitor.cpp index 9eb841b6d..b2c014b24 100644 --- a/src/osgUtil/IntersectVisitor.cpp +++ b/src/osgUtil/IntersectVisitor.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -800,11 +800,11 @@ void PickVisitor::apply(osg::Projection& projection) _mx, _my ); } -void PickVisitor::apply(osg::CameraNode& camera) +void PickVisitor::apply(osg::Camera& camera) { if (!camera.isRenderToTextureCamera()) { - if (camera.getReferenceFrame()==osg::CameraNode::ABSOLUTE_RF) + if (camera.getReferenceFrame()==osg::Camera::ABSOLUTE_RF) { runNestedPickVisitor( camera, camera.getViewport() ? camera.getViewport() : _lastViewport.get(), @@ -812,7 +812,7 @@ void PickVisitor::apply(osg::CameraNode& camera) camera.getViewMatrix(), _mx, _my ); } - else if (camera.getTransformOrder()==osg::CameraNode::POST_MULTIPLY) + else if (camera.getTransformOrder()==osg::Camera::POST_MULTIPLY) { runNestedPickVisitor( camera, camera.getViewport() ? camera.getViewport() : _lastViewport.get(), diff --git a/src/osgUtil/IntersectionVisitor.cpp b/src/osgUtil/IntersectionVisitor.cpp index 2bbd77f2c..376ad6bf5 100644 --- a/src/osgUtil/IntersectionVisitor.cpp +++ b/src/osgUtil/IntersectionVisitor.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -915,14 +915,14 @@ void IntersectionVisitor::apply(osg::Projection& projection) } -void IntersectionVisitor::apply(osg::CameraNode& camera) +void IntersectionVisitor::apply(osg::Camera& camera) { - // osg::notify(osg::NOTICE)<<"apply(CameraNode&)"<getRenderTargetImplementation(); - osg::CameraNode::RenderTargetImplementation renderTargetFallback = _camera->getRenderTargetFallback(); + osg::Camera::RenderTargetImplementation renderTargetImplemntation = _camera->getRenderTargetImplementation(); + osg::Camera::RenderTargetImplementation renderTargetFallback = _camera->getRenderTargetFallback(); - osg::CameraNode::BufferAttachmentMap& bufferAttachements = _camera->getBufferAttachmentMap(); + osg::Camera::BufferAttachmentMap& bufferAttachements = _camera->getBufferAttachmentMap(); // compute the required dimensions int width = _viewport->x() + _viewport->width(); int height = _viewport->y() + _viewport->height(); int depth = 1; - osg::CameraNode::BufferAttachmentMap::iterator itr; + osg::Camera::BufferAttachmentMap::iterator itr; for(itr = bufferAttachements.begin(); itr != bufferAttachements.end(); ++itr) @@ -315,14 +315,14 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) } } - if (renderTargetImplemntation==osg::CameraNode::FRAME_BUFFER_OBJECT) + if (renderTargetImplemntation==osg::Camera::FRAME_BUFFER_OBJECT) { osg::FBOExtensions* fbo_ext = osg::FBOExtensions::instance(state.getContextID(),true); bool fbo_supported = fbo_ext && fbo_ext->isSupported(); if (fbo_supported && !_fbo) { - osg::notify(osg::INFO)<<"Setting up osg::CameraNode::FRAME_BUFFER_OBJECT"< lock(*(_camera->getDataChangeMutex())); @@ -331,23 +331,23 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) bool colorAttached = false; bool depthAttached = false; bool stencilAttached = false; - for(osg::CameraNode::BufferAttachmentMap::iterator itr = bufferAttachements.begin(); + for(osg::Camera::BufferAttachmentMap::iterator itr = bufferAttachements.begin(); itr != bufferAttachements.end(); ++itr) { - osg::CameraNode::BufferComponent buffer = itr->first; - osg::CameraNode::Attachment& attachment = itr->second; + osg::Camera::BufferComponent buffer = itr->first; + osg::Camera::Attachment& attachment = itr->second; switch(buffer) { - case(osg::CameraNode::DEPTH_BUFFER): + case(osg::Camera::DEPTH_BUFFER): { fbo->setAttachment(GL_DEPTH_ATTACHMENT_EXT, osg::FrameBufferAttachment(attachment)); depthAttached = true; break; } - case(osg::CameraNode::STENCIL_BUFFER): + case(osg::Camera::STENCIL_BUFFER): { fbo->setAttachment(GL_STENCIL_ATTACHMENT_EXT, osg::FrameBufferAttachment(attachment)); stencilAttached = true; @@ -355,7 +355,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) } default: { - fbo->setAttachment(GL_COLOR_ATTACHMENT0_EXT+(buffer-osg::CameraNode::COLOR_BUFFER0), osg::FrameBufferAttachment(attachment)); + fbo->setAttachment(GL_COLOR_ATTACHMENT0_EXT+(buffer-osg::Camera::COLOR_BUFFER0), osg::FrameBufferAttachment(attachment)); colorAttached = true; break; } @@ -409,26 +409,26 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) if (renderTargetImplemntation context = getGraphicsContext(); if (!context) @@ -442,9 +442,9 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) // osg::notify(osg::NOTICE)<<"traits = "<_width<<" "<_height<_pbuffer = (renderTargetImplemntation==osg::CameraNode::PIXEL_BUFFER || renderTargetImplemntation==osg::CameraNode::PIXEL_BUFFER_RTT); - traits->_windowDecoration = (renderTargetImplemntation==osg::CameraNode::SEPERATE_WINDOW); - traits->_doubleBuffer = (renderTargetImplemntation==osg::CameraNode::SEPERATE_WINDOW); + traits->_pbuffer = (renderTargetImplemntation==osg::Camera::PIXEL_BUFFER || renderTargetImplemntation==osg::Camera::PIXEL_BUFFER_RTT); + traits->_windowDecoration = (renderTargetImplemntation==osg::Camera::SEPERATE_WINDOW); + traits->_doubleBuffer = (renderTargetImplemntation==osg::Camera::SEPERATE_WINDOW); osg::Texture* pBufferTexture = 0; GLenum bufferFormat = GL_NONE; @@ -454,28 +454,28 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) bool colorAttached = false; bool depthAttached = false; bool stencilAttached = false; - for(osg::CameraNode::BufferAttachmentMap::iterator itr = bufferAttachements.begin(); + for(osg::Camera::BufferAttachmentMap::iterator itr = bufferAttachements.begin(); itr != bufferAttachements.end(); ++itr) { - osg::CameraNode::BufferComponent buffer = itr->first; - osg::CameraNode::Attachment& attachment = itr->second; + osg::Camera::BufferComponent buffer = itr->first; + osg::Camera::Attachment& attachment = itr->second; switch(buffer) { - case(osg::CameraNode::DEPTH_BUFFER): + case(osg::Camera::DEPTH_BUFFER): { traits->_depth = 24; depthAttached = true; break; } - case(osg::CameraNode::STENCIL_BUFFER): + case(osg::Camera::STENCIL_BUFFER): { traits->_stencil = 8; stencilAttached = true; break; } - case(osg::CameraNode::COLOR_BUFFER): + case(osg::Camera::COLOR_BUFFER): { if (attachment._internalFormat!=GL_NONE) { @@ -501,7 +501,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) level = attachment._level; face = attachment._face; - if (renderTargetImplemntation==osg::CameraNode::PIXEL_BUFFER_RTT) + if (renderTargetImplemntation==osg::Camera::PIXEL_BUFFER_RTT) { traits->_target = bufferFormat; traits->_level = level; @@ -512,7 +512,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) } default: { - if (renderTargetImplemntation==osg::CameraNode::SEPERATE_WINDOW) + if (renderTargetImplemntation==osg::Camera::SEPERATE_WINDOW) osg::notify(osg::NOTICE)<<"Warning: RenderStage::runCameraSetUp(State&) Window "; else osg::notify(osg::NOTICE)<<"Warning: RenderStage::runCameraSetUp(State&) Pbuffer "; @@ -570,7 +570,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) setDrawBuffer(GL_FRONT); setReadBuffer(GL_FRONT); - if (pBufferTexture && renderTargetImplemntation==osg::CameraNode::PIXEL_BUFFER_RTT) + if (pBufferTexture && renderTargetImplemntation==osg::Camera::PIXEL_BUFFER_RTT) { osg::notify(osg::INFO)<<"RenderStage::runCameraSetUp(State&) Assign graphis context to Texture"<setReadPBuffer(context.get()); @@ -585,17 +585,17 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) { osg::notify(osg::INFO)<<"Failed to aquire Graphics Context"<::const_iterator itr; + std::map< osg::Camera::BufferComponent, Attachment>::const_iterator itr; for(itr = _bufferAttachmentMap.begin(); itr != _bufferAttachmentMap.end(); ++itr){ if (itr->second._image.valid()) { @@ -771,8 +771,8 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b if (fbo_supported && _camera) { // now generate mipmaps if they are required. - const osg::CameraNode::BufferAttachmentMap& bufferAttachements = _camera->getBufferAttachmentMap(); - for(osg::CameraNode::BufferAttachmentMap::const_iterator itr = bufferAttachements.begin(); + const osg::Camera::BufferAttachmentMap& bufferAttachements = _camera->getBufferAttachmentMap(); + for(osg::Camera::BufferAttachmentMap::const_iterator itr = bufferAttachements.begin(); itr != bufferAttachements.end(); ++itr) { @@ -1014,7 +1014,7 @@ bool RenderStage::getStats(Statistics& stats) const return statsCollected; } -void RenderStage::attach(osg::CameraNode::BufferComponent buffer, osg::Image* image) +void RenderStage::attach(osg::Camera::BufferComponent buffer, osg::Image* image) { _bufferAttachmentMap[buffer]._image = image; } diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 6becf999c..874416d92 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -99,7 +99,7 @@ SceneView::SceneView(DisplaySettings* ds) _prioritizeTextures = false; - _camera = new CameraNode; + _camera = new Camera; _camera->setViewport(new Viewport); _camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f)); @@ -210,7 +210,7 @@ void SceneView::setDefaults(unsigned int options) _camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f)); } -void SceneView::setCamera(osg::CameraNode* camera) +void SceneView::setCamera(osg::Camera* camera) { if (camera) { diff --git a/src/osgViewer/CompositeViewer.cpp b/src/osgViewer/CompositeViewer.cpp new file mode 100644 index 000000000..4626fe5b6 --- /dev/null +++ b/src/osgViewer/CompositeViewer.cpp @@ -0,0 +1,24 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#include + +using namespace osgViewer; + +CompositeViewer::CompositeViewer(): +{ +} + +CompositeViewer::~CompositeViewer() +{ +} diff --git a/src/osgViewer/GNUmakefile b/src/osgViewer/GNUmakefile index b749bfcc8..81e2f3cbb 100644 --- a/src/osgViewer/GNUmakefile +++ b/src/osgViewer/GNUmakefile @@ -4,6 +4,8 @@ include $(TOPDIR)/Make/makedefs CXXFILES = \ SimpleViewer.cpp\ + Scene.cpp\ + View.cpp\ Version.cpp\ DEF += -DOSGVIEWER_LIBRARY diff --git a/src/osgViewer/Scene.cpp b/src/osgViewer/Scene.cpp new file mode 100644 index 000000000..e2bc5e81e --- /dev/null +++ b/src/osgViewer/Scene.cpp @@ -0,0 +1,122 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#include + +using namespace osgViewer; + +Scene::Scene(): + _firstFrame(true) +{ + _startTick = osg::Timer::instance()->tick(); + _frameStamp = new osg::FrameStamp; + _frameStamp->setFrameNumber(0); + _frameStamp->setReferenceTime(0); + + _updateVisitor = new osgUtil::UpdateVisitor; + + _eventQueue->setStartTick(_startTick); + + _eventVisitor = new osgGA::EventVisitor; + + setDatabasePager(new osgDB::DatabasePager); +} + +Scene::~Scene() +{ +} + +void Scene::setSceneData(osg::Node* node) +{ + _sceneData = node; + + if (_databasePager.valid()) + { + // register any PagedLOD that need to be tracked in the scene graph + _databasePager->registerPagedLODs(node); + } +} + +osg::Node* Scene::getSceneData() +{ + return _sceneData.get(); +} + +const osg::Node* Scene::getSceneData() const +{ + return _sceneData.get(); +} + +void Scene::setDatabasePager(osgDB::DatabasePager* dp) +{ + _databasePager = dp; +} + +void Scene::frameAdvance() +{ + osg::Timer_t currentTick = osg::Timer::instance()->tick(); + _frameStamp->setReferenceTime(osg::Timer::instance()->delta_s(_startTick,currentTick)); + _frameStamp->setFrameNumber(_frameStamp->getFrameNumber()+1); +} + +void Scene::frameEventTraversal() +{ + _eventQueue->frame( _frameStamp->getReferenceTime() ); + + osgGA::EventQueue::Events events; + _eventQueue->takeEvents(events); + + if (_eventVisitor.valid()) + { + _eventVisitor->setTraversalNumber(_frameStamp->getFrameNumber()); + } + + for(osgGA::EventQueue::Events::iterator itr = events.begin(); + itr != events.end(); + ++itr) + { + osgGA::GUIEventAdapter* event = itr->get(); + + bool handled = false; + + if (_eventVisitor.valid() && getSceneData()) + { + _eventVisitor->reset(); + _eventVisitor->addEvent( event ); + + getSceneData()->accept(*_eventVisitor); + + if (_eventVisitor->getEventHandled()) handled = true; + } + + for(EventHandlers::iterator hitr = _eventHandlers.begin(); + hitr != _eventHandlers.end() && !handled; + ++hitr) + { +// handled = (*hitr)->handle( *event, *this, 0, 0); + } + } +} + +void Scene::frameUpdateTraversal() +{ + if (_databasePager.valid()) + { + // tell the DatabasePager the frame number of that the scene graph is being actively used to render a frame + _databasePager->signalBeginFrame(_frameStamp.get()); + + // syncronize changes required by the DatabasePager thread to the scene graph + _databasePager->updateSceneGraph(_frameStamp->getReferenceTime()); + } +} + diff --git a/src/osgViewer/SimpleViewer.cpp b/src/osgViewer/SimpleViewer.cpp index 169737bcd..1449bd435 100644 --- a/src/osgViewer/SimpleViewer.cpp +++ b/src/osgViewer/SimpleViewer.cpp @@ -69,12 +69,12 @@ const osg::Node* SimpleViewer::getSceneData() const return _sceneView->getSceneData(); } -osg::CameraNode* SimpleViewer::getCamera() +osg::Camera* SimpleViewer::getCamera() { return _sceneView->getCamera(); } -const osg::CameraNode* SimpleViewer::getCamera() const +const osg::Camera* SimpleViewer::getCamera() const { return _sceneView->getCamera(); } diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp new file mode 100644 index 000000000..f30a4f376 --- /dev/null +++ b/src/osgViewer/View.cpp @@ -0,0 +1,24 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#include + +using namespace osgViewer; + +View::View() +{ +} + +View::~View() +{ +} diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp new file mode 100644 index 000000000..bd38139b8 --- /dev/null +++ b/src/osgViewer/Viewer.cpp @@ -0,0 +1,24 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#include + +using namespace osgViewer; + +Viewer::Viewer(): +{ +} + +Viewer::~Viewer() +{ +} diff --git a/src/osgWrappers/osg/CameraNode.cpp b/src/osgWrappers/osg/Camera.cpp similarity index 84% rename from src/osgWrappers/osg/CameraNode.cpp rename to src/osgWrappers/osg/Camera.cpp index da88ed8da..c790b7fc7 100644 --- a/src/osgWrappers/osg/CameraNode.cpp +++ b/src/osgWrappers/osg/Camera.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -35,49 +35,49 @@ #undef OUT #endif -TYPE_NAME_ALIAS(std::map< osg::CameraNode::BufferComponent COMMA osg::CameraNode::Attachment >, osg::CameraNode::BufferAttachmentMap); +TYPE_NAME_ALIAS(std::map< osg::Camera::BufferComponent COMMA osg::Camera::Attachment >, osg::Camera::BufferAttachmentMap); -BEGIN_ENUM_REFLECTOR(osg::CameraNode::TransformOrder) - I_EnumLabel(osg::CameraNode::PRE_MULTIPLY); - I_EnumLabel(osg::CameraNode::POST_MULTIPLY); +BEGIN_ENUM_REFLECTOR(osg::Camera::TransformOrder) + I_EnumLabel(osg::Camera::PRE_MULTIPLY); + I_EnumLabel(osg::Camera::POST_MULTIPLY); END_REFLECTOR -BEGIN_ENUM_REFLECTOR(osg::CameraNode::RenderOrder) - I_EnumLabel(osg::CameraNode::PRE_RENDER); - I_EnumLabel(osg::CameraNode::NESTED_RENDER); - I_EnumLabel(osg::CameraNode::POST_RENDER); +BEGIN_ENUM_REFLECTOR(osg::Camera::RenderOrder) + I_EnumLabel(osg::Camera::PRE_RENDER); + I_EnumLabel(osg::Camera::NESTED_RENDER); + I_EnumLabel(osg::Camera::POST_RENDER); END_REFLECTOR -BEGIN_ENUM_REFLECTOR(osg::CameraNode::RenderTargetImplementation) - I_EnumLabel(osg::CameraNode::FRAME_BUFFER_OBJECT); - I_EnumLabel(osg::CameraNode::PIXEL_BUFFER_RTT); - I_EnumLabel(osg::CameraNode::PIXEL_BUFFER); - I_EnumLabel(osg::CameraNode::FRAME_BUFFER); - I_EnumLabel(osg::CameraNode::SEPERATE_WINDOW); +BEGIN_ENUM_REFLECTOR(osg::Camera::RenderTargetImplementation) + I_EnumLabel(osg::Camera::FRAME_BUFFER_OBJECT); + I_EnumLabel(osg::Camera::PIXEL_BUFFER_RTT); + I_EnumLabel(osg::Camera::PIXEL_BUFFER); + I_EnumLabel(osg::Camera::FRAME_BUFFER); + I_EnumLabel(osg::Camera::SEPERATE_WINDOW); END_REFLECTOR -BEGIN_ENUM_REFLECTOR(osg::CameraNode::BufferComponent) - I_EnumLabel(osg::CameraNode::DEPTH_BUFFER); - I_EnumLabel(osg::CameraNode::STENCIL_BUFFER); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER0); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER1); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER2); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER3); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER4); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER5); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER6); - I_EnumLabel(osg::CameraNode::COLOR_BUFFER7); +BEGIN_ENUM_REFLECTOR(osg::Camera::BufferComponent) + I_EnumLabel(osg::Camera::DEPTH_BUFFER); + I_EnumLabel(osg::Camera::STENCIL_BUFFER); + I_EnumLabel(osg::Camera::COLOR_BUFFER); + I_EnumLabel(osg::Camera::COLOR_BUFFER0); + I_EnumLabel(osg::Camera::COLOR_BUFFER1); + I_EnumLabel(osg::Camera::COLOR_BUFFER2); + I_EnumLabel(osg::Camera::COLOR_BUFFER3); + I_EnumLabel(osg::Camera::COLOR_BUFFER4); + I_EnumLabel(osg::Camera::COLOR_BUFFER5); + I_EnumLabel(osg::Camera::COLOR_BUFFER6); + I_EnumLabel(osg::Camera::COLOR_BUFFER7); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osg::CameraNode) +BEGIN_OBJECT_REFLECTOR(osg::Camera) I_BaseType(osg::Transform); I_BaseType(osg::CullSettings); - I_Constructor0(____CameraNode, + I_Constructor0(____Camera, "", ""); - I_ConstructorWithDefaults2(IN, const osg::CameraNode &, x, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, - ____CameraNode__C5_CameraNode_R1__C5_CopyOp_R1, + I_ConstructorWithDefaults2(IN, const osg::Camera &, x, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, + ____Camera__C5_Camera_R1__C5_CopyOp_R1, "Copy constructor using CopyOp to manage deep vs shallow copy. ", ""); I_Method0(osg::Object *, cloneType, @@ -164,11 +164,11 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __Viewport_P1__getViewport, "Get the viewport. ", ""); - I_Method1(void, setTransformOrder, IN, osg::CameraNode::TransformOrder, order, + I_Method1(void, setTransformOrder, IN, osg::Camera::TransformOrder, order, __void__setTransformOrder__TransformOrder, "Set the transformation order for world-to-local and local-to-world transformation. ", ""); - I_Method0(osg::CameraNode::TransformOrder, getTransformOrder, + I_Method0(osg::Camera::TransformOrder, getTransformOrder, __TransformOrder__getTransformOrder, "Get the transformation order. ", ""); @@ -244,11 +244,11 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __Matrixd__getInverseViewMatrix, "Get the inverse view matrix. ", ""); - I_MethodWithDefaults2(void, setRenderOrder, IN, osg::CameraNode::RenderOrder, order, , IN, int, orderNum, 0, + I_MethodWithDefaults2(void, setRenderOrder, IN, osg::Camera::RenderOrder, order, , IN, int, orderNum, 0, __void__setRenderOrder__RenderOrder__int, "Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within. ", "For rendering to a texture, one typically uses PRE_RENDER. For Head Up Displays, one would typically use POST_RENDER. "); - I_Method0(osg::CameraNode::RenderOrder, getRenderOrder, + I_Method0(osg::Camera::RenderOrder, getRenderOrder, __RenderOrder__getRenderOrder, "Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within. ", ""); @@ -260,19 +260,19 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __bool__isRenderToTextureCamera, "Return true if this Camera is set up as a render to texture camera, i.e. ", "it has textures assigned to it. "); - I_Method1(void, setRenderTargetImplementation, IN, osg::CameraNode::RenderTargetImplementation, impl, + I_Method1(void, setRenderTargetImplementation, IN, osg::Camera::RenderTargetImplementation, impl, __void__setRenderTargetImplementation__RenderTargetImplementation, "Set the render target. ", ""); - I_Method2(void, setRenderTargetImplementation, IN, osg::CameraNode::RenderTargetImplementation, impl, IN, osg::CameraNode::RenderTargetImplementation, fallback, + I_Method2(void, setRenderTargetImplementation, IN, osg::Camera::RenderTargetImplementation, impl, IN, osg::Camera::RenderTargetImplementation, fallback, __void__setRenderTargetImplementation__RenderTargetImplementation__RenderTargetImplementation, "Set the render target and fall-back that's used if the former isn't available. ", ""); - I_Method0(osg::CameraNode::RenderTargetImplementation, getRenderTargetImplementation, + I_Method0(osg::Camera::RenderTargetImplementation, getRenderTargetImplementation, __RenderTargetImplementation__getRenderTargetImplementation, "Get the render target. ", ""); - I_Method0(osg::CameraNode::RenderTargetImplementation, getRenderTargetFallback, + I_Method0(osg::Camera::RenderTargetImplementation, getRenderTargetFallback, __RenderTargetImplementation__getRenderTargetFallback, "Get the render target fallback. ", ""); @@ -292,27 +292,27 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __GLenum__getReadBuffer, "Get the read buffer for any required copy operations to use. ", ""); - I_Method2(void, attach, IN, osg::CameraNode::BufferComponent, buffer, IN, GLenum, internalFormat, + I_Method2(void, attach, IN, osg::Camera::BufferComponent, buffer, IN, GLenum, internalFormat, __void__attach__BufferComponent__GLenum, "", ""); - I_MethodWithDefaults5(void, attach, IN, osg::CameraNode::BufferComponent, buffer, , IN, osg::Texture *, texture, , IN, unsigned int, level, 0, IN, unsigned int, face, 0, IN, bool, mipMapGeneration, false, + I_MethodWithDefaults5(void, attach, IN, osg::Camera::BufferComponent, buffer, , IN, osg::Texture *, texture, , IN, unsigned int, level, 0, IN, unsigned int, face, 0, IN, bool, mipMapGeneration, false, __void__attach__BufferComponent__osg_Texture_P1__unsigned_int__unsigned_int__bool, "", ""); - I_Method2(void, attach, IN, osg::CameraNode::BufferComponent, buffer, IN, osg::Image *, image, + I_Method2(void, attach, IN, osg::Camera::BufferComponent, buffer, IN, osg::Image *, image, __void__attach__BufferComponent__osg_Image_P1, "", ""); - I_Method1(void, detach, IN, osg::CameraNode::BufferComponent, buffer, + I_Method1(void, detach, IN, osg::Camera::BufferComponent, buffer, __void__detach__BufferComponent, "", ""); - I_Method0(osg::CameraNode::BufferAttachmentMap &, getBufferAttachmentMap, + I_Method0(osg::Camera::BufferAttachmentMap &, getBufferAttachmentMap, __BufferAttachmentMap_R1__getBufferAttachmentMap, "Get the BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads. ", ""); - I_Method0(const osg::CameraNode::BufferAttachmentMap &, getBufferAttachmentMap, + I_Method0(const osg::Camera::BufferAttachmentMap &, getBufferAttachmentMap, __C5_BufferAttachmentMap_R1__getBufferAttachmentMap, "Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads. ", ""); @@ -340,15 +340,15 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __C5_osg_Object_P1__getRenderingCache__unsigned_int, "Get the const Rendering object that is used to implement rendering of the subgraph. ", ""); - I_Method1(void, setPostDrawCallback, IN, osg::CameraNode::DrawCallback *, cb, + I_Method1(void, setPostDrawCallback, IN, osg::Camera::DrawCallback *, cb, __void__setPostDrawCallback__DrawCallback_P1, "Set the post draw callback for custom operations to do done after the drawing of the camera's subgraph has been completed. ", ""); - I_Method0(osg::CameraNode::DrawCallback *, getPostDrawCallback, + I_Method0(osg::Camera::DrawCallback *, getPostDrawCallback, __DrawCallback_P1__getPostDrawCallback, "Get the post draw callback. ", ""); - I_Method0(const osg::CameraNode::DrawCallback *, getPostDrawCallback, + I_Method0(const osg::Camera::DrawCallback *, getPostDrawCallback, __C5_DrawCallback_P1__getPostDrawCallback, "Get the const post draw callback. ", ""); @@ -368,7 +368,7 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __bool__computeWorldToLocalMatrix__Matrix_R1__NodeVisitor_P1, "Transform method that must be defined to provide generic interface for scene graph traversals. ", ""); - I_SimpleProperty(osg::CameraNode::BufferAttachmentMap &, BufferAttachmentMap, + I_SimpleProperty(osg::Camera::BufferAttachmentMap &, BufferAttachmentMap, __BufferAttachmentMap_R1__getBufferAttachmentMap, 0); I_SimpleProperty(const osg::Vec4 &, ClearColor, @@ -392,7 +392,7 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) I_SimpleProperty(osg::Matrixd, InverseViewMatrix, __Matrixd__getInverseViewMatrix, 0); - I_SimpleProperty(osg::CameraNode::DrawCallback *, PostDrawCallback, + I_SimpleProperty(osg::Camera::DrawCallback *, PostDrawCallback, __DrawCallback_P1__getPostDrawCallback, __void__setPostDrawCallback__DrawCallback_P1); I_SimpleProperty(const osg::Matrixd &, ProjectionMatrix, @@ -401,23 +401,23 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) I_SimpleProperty(GLenum, ReadBuffer, __GLenum__getReadBuffer, __void__setReadBuffer__GLenum); - I_SimpleProperty(osg::CameraNode::RenderOrder, RenderOrder, + I_SimpleProperty(osg::Camera::RenderOrder, RenderOrder, __RenderOrder__getRenderOrder, 0); I_SimpleProperty(int, RenderOrderNum, __int__getRenderOrderNum, 0); - I_SimpleProperty(osg::CameraNode::RenderTargetImplementation, RenderTargetFallback, + I_SimpleProperty(osg::Camera::RenderTargetImplementation, RenderTargetFallback, __RenderTargetImplementation__getRenderTargetFallback, 0); - I_SimpleProperty(osg::CameraNode::RenderTargetImplementation, RenderTargetImplementation, + I_SimpleProperty(osg::Camera::RenderTargetImplementation, RenderTargetImplementation, __RenderTargetImplementation__getRenderTargetImplementation, __void__setRenderTargetImplementation__RenderTargetImplementation); I_IndexedProperty(osg::Object *, RenderingCache, __osg_Object_P1__getRenderingCache__unsigned_int, __void__setRenderingCache__unsigned_int__osg_Object_P1, 0); - I_SimpleProperty(osg::CameraNode::TransformOrder, TransformOrder, + I_SimpleProperty(osg::Camera::TransformOrder, TransformOrder, __TransformOrder__getTransformOrder, __void__setTransformOrder__TransformOrder); I_SimpleProperty(osg::View *, View, @@ -431,7 +431,7 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode) __void__setViewport__osg_Viewport_P1); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osg::CameraNode::Attachment) +BEGIN_VALUE_REFLECTOR(osg::Camera::Attachment) I_Constructor0(____Attachment, "", ""); @@ -455,12 +455,12 @@ BEGIN_VALUE_REFLECTOR(osg::CameraNode::Attachment) I_PublicMemberProperty(bool, _mipMapGeneration); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osg::CameraNode::DrawCallback) +BEGIN_OBJECT_REFLECTOR(osg::Camera::DrawCallback) I_VirtualBaseType(osg::Object); I_Constructor0(____DrawCallback, "", ""); - I_Constructor2(IN, const osg::CameraNode::DrawCallback &, x, IN, const osg::CopyOp &, x, + I_Constructor2(IN, const osg::Camera::DrawCallback &, x, IN, const osg::CopyOp &, x, ____DrawCallback__C5_DrawCallback_R1__C5_CopyOp_R1, "", ""); @@ -486,5 +486,5 @@ BEGIN_OBJECT_REFLECTOR(osg::CameraNode::DrawCallback) "Must be defined by derived classes. "); END_REFLECTOR -STD_MAP_REFLECTOR(std::map< osg::CameraNode::BufferComponent COMMA osg::CameraNode::Attachment >); +STD_MAP_REFLECTOR(std::map< osg::Camera::BufferComponent COMMA osg::Camera::Attachment >); diff --git a/src/osgWrappers/osg/FrameBufferObject.cpp b/src/osgWrappers/osg/FrameBufferObject.cpp index 30c75c94f..cae97c3f0 100644 --- a/src/osgWrappers/osg/FrameBufferObject.cpp +++ b/src/osgWrappers/osg/FrameBufferObject.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -113,8 +113,8 @@ BEGIN_VALUE_REFLECTOR(osg::FrameBufferAttachment) ____FrameBufferAttachment__TextureRectangle_P1, "", ""); - I_Constructor1(IN, osg::CameraNode::Attachment &, attachment, - ____FrameBufferAttachment__CameraNode_Attachment_R1, + I_Constructor1(IN, osg::Camera::Attachment &, attachment, + ____FrameBufferAttachment__Camera_Attachment_R1, "", ""); I_Method2(void, createRequiredTexturesAndApplyGenerateMipMap, IN, osg::State &, state, IN, const osg::FBOExtensions *, ext, diff --git a/src/osgWrappers/osg/GNUmakefile b/src/osgWrappers/osg/GNUmakefile index b60b92f1e..85d0096b4 100644 --- a/src/osgWrappers/osg/GNUmakefile +++ b/src/osgWrappers/osg/GNUmakefile @@ -15,7 +15,7 @@ CXXFILES =\ BoundingBox.cpp\ BoundingSphere.cpp\ BufferObject.cpp\ - CameraNode.cpp\ + Camera.cpp\ CameraView.cpp\ ClampColor.cpp\ ClearNode.cpp\ diff --git a/src/osgWrappers/osg/Matrixd.cpp b/src/osgWrappers/osg/Matrixd.cpp index f9511326d..ec0919ec5 100644 --- a/src/osgWrappers/osg/Matrixd.cpp +++ b/src/osgWrappers/osg/Matrixd.cpp @@ -102,6 +102,10 @@ BEGIN_VALUE_REFLECTOR(osg::Matrixd) __void__makeIdentity, "", ""); + I_Method0(bool, isIdentity, + __bool__isIdentity, + "", + ""); I_Method1(void, makeScale, IN, const osg::Vec3f &, x, __void__makeScale__C5_Vec3f_R1, "", @@ -246,14 +250,6 @@ BEGIN_VALUE_REFLECTOR(osg::Matrixd) __Vec4d__postMult__C5_Vec4d_R1, "", ""); - I_Method1(void, set, IN, const osg::Quat &, q, - __void__set__C5_Quat_R1, - "", - ""); - I_Method1(void, get, IN, osg::Quat &, q, - __void__get__Quat_R1, - "", - ""); I_Method1(void, setRotate, IN, const osg::Quat &, q, __void__setRotate__C5_Quat_R1, "", diff --git a/src/osgWrappers/osg/Matrixf.cpp b/src/osgWrappers/osg/Matrixf.cpp index 986bee939..6ee4b91d2 100644 --- a/src/osgWrappers/osg/Matrixf.cpp +++ b/src/osgWrappers/osg/Matrixf.cpp @@ -98,6 +98,10 @@ BEGIN_VALUE_REFLECTOR(osg::Matrixf) __C5_value_type_P1__ptr, "", ""); + I_Method0(bool, isIdentity, + __bool__isIdentity, + "", + ""); I_Method0(void, makeIdentity, __void__makeIdentity, "", @@ -246,14 +250,6 @@ BEGIN_VALUE_REFLECTOR(osg::Matrixf) __Vec4d__postMult__C5_Vec4d_R1, "", ""); - I_Method1(void, set, IN, const osg::Quat &, q, - __void__set__C5_Quat_R1, - "", - ""); - I_Method1(void, get, IN, osg::Quat &, q, - __void__get__Quat_R1, - "", - ""); I_Method1(void, setRotate, IN, const osg::Quat &, q, __void__setRotate__C5_Quat_R1, "", diff --git a/src/osgWrappers/osg/NodeTrackerCallback.cpp b/src/osgWrappers/osg/NodeTrackerCallback.cpp index b586dbded..60a3e3035 100644 --- a/src/osgWrappers/osg/NodeTrackerCallback.cpp +++ b/src/osgWrappers/osg/NodeTrackerCallback.cpp @@ -82,7 +82,7 @@ BEGIN_OBJECT_REFLECTOR(osg::observer_ptr< osg::Node >) ____observer_ptr__C5_observer_ptr_R1, "", ""); - I_Method1(void, objectDeleted, IN, void *, ptr, + I_Method1(void, objectDeleted, IN, void *, x, __void__objectDeleted__void_P1, "", ""); diff --git a/src/osgWrappers/osg/NodeVisitor.cpp b/src/osgWrappers/osg/NodeVisitor.cpp index 60500327b..bbf6993e1 100644 --- a/src/osgWrappers/osg/NodeVisitor.cpp +++ b/src/osgWrappers/osg/NodeVisitor.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -35,7 +35,6 @@ #include #include #include -#include // Must undefine IN and OUT macros defined in Windows headers #ifdef IN @@ -221,12 +220,8 @@ BEGIN_OBJECT_REFLECTOR(osg::NodeVisitor) __void__apply__Transform_R1, "", ""); - I_Method1(void, apply, IN, osg::View &, node, - __void__apply__View_R1, - "", - ""); - I_Method1(void, apply, IN, osg::CameraNode &, node, - __void__apply__CameraNode_R1, + I_Method1(void, apply, IN, osg::Camera &, node, + __void__apply__Camera_R1, "", ""); I_Method1(void, apply, IN, osg::CameraView &, node, diff --git a/src/osgWrappers/osg/Plane.cpp b/src/osgWrappers/osg/Plane.cpp index 2348ae6ff..d542c8394 100644 --- a/src/osgWrappers/osg/Plane.cpp +++ b/src/osgWrappers/osg/Plane.cpp @@ -121,6 +121,10 @@ BEGIN_VALUE_REFLECTOR(osg::Plane) __float__distance__C5_osg_Vec3_R1, "calculate the distance between a point and the plane. ", ""); + I_Method1(float, dotProductNormal, IN, const osg::Vec3 &, v, + __float__dotProductNormal__C5_osg_Vec3_R1, + "calculate the dot product of the plane normal and a point. ", + ""); I_Method1(int, intersect, IN, const std::vector< osg::Vec3 > &, vertices, __int__intersect__C5_std_vectorT1_Vec3__R1, "intersection test between plane and vertex list return 1 if the bs is completely above plane, return 0 if the bs intersects the plane, return -1 if the bs is completely below the plane. ", diff --git a/src/osgWrappers/osg/View.cpp b/src/osgWrappers/osg/View.cpp index 513667870..44bf7dbb7 100644 --- a/src/osgWrappers/osg/View.cpp +++ b/src/osgWrappers/osg/View.cpp @@ -10,14 +10,9 @@ #include #include -#include -#include +#include #include #include -#include -#include -#include -#include #include // Must undefine IN and OUT macros defined in Windows headers @@ -29,182 +24,71 @@ #endif BEGIN_OBJECT_REFLECTOR(osg::View) - I_BaseType(osg::Transform); - I_BaseType(osg::CullSettings); + I_BaseType(osg::Referenced); I_Constructor0(____View, "", ""); - I_ConstructorWithDefaults2(IN, const osg::View &, x, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, - ____View__C5_View_R1__C5_CopyOp_R1, - "Copy constructor using CopyOp to manage deep vs shallow copy. ", - ""); - I_Method0(osg::Object *, cloneType, - __osg_Object_P1__cloneType, - "clone an object of the same type as the node. ", + I_Method1(void, setCamera, IN, osg::Camera *, camera, + __void__setCamera__osg_Camera_P1, + "Set the master camera of the view. ", ""); - I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop, - __osg_Object_P1__clone__C5_osg_CopyOp_R1, - "return a clone of a node, with Object* return type. ", + I_Method0(osg::Camera *, getCamera, + __osg_Camera_P1__getCamera, + "Get the master camera of the view. ", ""); - I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, - __bool__isSameKindAs__C5_osg_Object_P1, - "return true if this and obj are of the same kind of object. ", + I_Method0(const osg::Camera *, getCamera, + __C5_osg_Camera_P1__getCamera, + "Get the const master camera of the view. ", ""); - I_Method0(const char *, className, - __C5_char_P1__className, - "return the name of the node's class type. ", - ""); - I_Method0(const char *, libraryName, - __C5_char_P1__libraryName, - "return the name of the node's library. ", - ""); - I_Method1(void, accept, IN, osg::NodeVisitor &, nv, - __void__accept__osg_NodeVisitor_R1, - "Visitor Pattern : calls the apply method of a NodeVisitor with this node's type. ", - ""); - I_Method1(void, setProjectionMatrix, IN, const osg::Matrixf &, matrix, - __void__setProjectionMatrix__C5_osg_Matrixf_R1, - "Set the projection matrix. ", - "Can be thought of as setting the lens of a camera. "); - I_Method1(void, setProjectionMatrix, IN, const osg::Matrixd &, matrix, - __void__setProjectionMatrix__C5_osg_Matrixd_R1, - "Set the projection matrix. ", - "Can be thought of as setting the lens of a camera. "); - I_Method6(void, setProjectionMatrixAsOrtho, IN, double, left, IN, double, right, IN, double, bottom, IN, double, top, IN, double, zNear, IN, double, zFar, - __void__setProjectionMatrixAsOrtho__double__double__double__double__double__double, - "Set to an orthographic projection. ", - "See OpenGL glOrtho for documentation further details. "); - I_Method4(void, setProjectionMatrixAsOrtho2D, IN, double, left, IN, double, right, IN, double, bottom, IN, double, top, - __void__setProjectionMatrixAsOrtho2D__double__double__double__double, - "Set to a 2D orthographic projection. ", - "See OpenGL glOrtho2D documentation for further details. "); - I_Method6(void, setProjectionMatrixAsFrustum, IN, double, left, IN, double, right, IN, double, bottom, IN, double, top, IN, double, zNear, IN, double, zFar, - __void__setProjectionMatrixAsFrustum__double__double__double__double__double__double, - "Set to a perspective projection. ", - "See OpenGL glFrustum documentation for further details. "); - I_Method4(void, setProjectionMatrixAsPerspective, IN, double, fovy, IN, double, aspectRatio, IN, double, zNear, IN, double, zFar, - __void__setProjectionMatrixAsPerspective__double__double__double__double, - "Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details. ", - "Aspect ratio is defined as width/height. "); - I_Method0(osg::Matrixd &, getProjectionMatrix, - __osg_Matrixd_R1__getProjectionMatrix, - "Get the projection matrix. ", - ""); - I_Method0(const osg::Matrixd &, getProjectionMatrix, - __C5_osg_Matrixd_R1__getProjectionMatrix, - "Get the const projection matrix. ", - ""); - I_Method6(bool, getProjectionMatrixAsOrtho, IN, double &, left, IN, double &, right, IN, double &, bottom, IN, double &, top, IN, double &, zNear, IN, double &, zFar, - __bool__getProjectionMatrixAsOrtho__double_R1__double_R1__double_R1__double_R1__double_R1__double_R1, - "Get the othographic settings of the orthographic projection matrix. ", - "Returns false if matrix is not an orthographic matrix, where parameter values are undefined. "); - I_Method6(bool, getProjectionMatrixAsFrustum, IN, double &, left, IN, double &, right, IN, double &, bottom, IN, double &, top, IN, double &, zNear, IN, double &, zFar, - __bool__getProjectionMatrixAsFrustum__double_R1__double_R1__double_R1__double_R1__double_R1__double_R1, - "Get the frustum setting of a perspective projection matrix. ", - "Returns false if matrix is not a perspective matrix, where parameter values are undefined. "); - I_Method4(bool, getProjectionMatrixAsPerspective, IN, double &, fovy, IN, double &, aspectRatio, IN, double &, zNear, IN, double &, zFar, - __bool__getProjectionMatrixAsPerspective__double_R1__double_R1__double_R1__double_R1, - "Get the frustum setting of a symmetric perspective projection matrix. ", - "Returns false if matrix is not a perspective matrix, where parameter values are undefined. Note, if matrix is not a symmetric perspective matrix then the shear will be lost. Asymmetric matrices occur when stereo, power walls, caves and reality center display are used. In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead. "); - I_Method1(void, setViewMatrix, IN, const osg::Matrixf &, matrix, - __void__setViewMatrix__C5_osg_Matrixf_R1, - "Set the view matrix. ", - "Can be thought of as setting the position of the world relative to the camera in camera coordinates. "); - I_Method1(void, setViewMatrix, IN, const osg::Matrixd &, matrix, - __void__setViewMatrix__C5_osg_Matrixd_R1, - "Set the view matrix. ", - "Can be thought of as setting the position of the world relative to the camera in camera coordinates. "); - I_Method3(void, setViewMatrixAsLookAt, IN, const osg::Vec3 &, eye, IN, const osg::Vec3 &, center, IN, const osg::Vec3 &, up, - __void__setViewMatrixAsLookAt__C5_osg_Vec3_R1__C5_osg_Vec3_R1__C5_osg_Vec3_R1, - "Set to the position and orientation of view matrix, using the same convention as gluLookAt. ", - ""); - I_Method0(osg::Matrixd &, getViewMatrix, - __osg_Matrixd_R1__getViewMatrix, - "Get the view matrix. ", - ""); - I_Method0(const osg::Matrixd &, getViewMatrix, - __C5_osg_Matrixd_R1__getViewMatrix, - "Get the const view matrix. ", - ""); - I_MethodWithDefaults4(void, getViewMatrixAsLookAt, IN, osg::Vec3 &, eye, , IN, osg::Vec3 &, center, , IN, osg::Vec3 &, up, , IN, float, lookDistance, 1.0f, - __void__getViewMatrixAsLookAt__osg_Vec3_R1__osg_Vec3_R1__osg_Vec3_R1__float, - "Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. ", - ""); - I_Method0(osg::Matrixd, getInverseViewMatrix, - __Matrixd__getInverseViewMatrix, - "Get the inverse view matrix. ", - ""); - I_Method1(bool, addCamera, IN, osg::CameraNode *, camera, - __bool__addCamera__osg_CameraNode_P1, + I_Method1(bool, addSlave, IN, osg::Camera *, camera, + __bool__addSlave__osg_Camera_P1, "", ""); - I_Method3(bool, addCamera, IN, osg::CameraNode *, camera, IN, const osg::Matrix &, projectionOffset, IN, const osg::Matrix &, viewOffse, - __bool__addCamera__osg_CameraNode_P1__C5_osg_Matrix_R1__C5_osg_Matrix_R1, + I_Method3(bool, addSlave, IN, osg::Camera *, camera, IN, const osg::Matrix &, projectionOffset, IN, const osg::Matrix &, viewOffse, + __bool__addSlave__osg_Camera_P1__C5_osg_Matrix_R1__C5_osg_Matrix_R1, "", ""); - I_Method1(bool, removeCamera, IN, unsigned int, pos, - __bool__removeCamera__unsigned_int, + I_Method1(bool, removeSlave, IN, unsigned int, pos, + __bool__removeSlave__unsigned_int, "", ""); - I_Method0(unsigned int, getNumCameras, - __unsigned_int__getNumCameras, + I_Method0(unsigned int, getNumSlaves, + __unsigned_int__getNumSlaves, "", ""); - I_Method1(osg::CameraNode *, getCamera, IN, unsigned int, pos, - __CameraNode_P1__getCamera__unsigned_int, + I_Method1(osg::View::Slave &, getSlave, IN, unsigned int, pos, + __Slave_R1__getSlave__unsigned_int, "", ""); - I_Method1(const osg::CameraNode *, getCamera, IN, unsigned int, pos, - __C5_CameraNode_P1__getCamera__unsigned_int, + I_Method1(const osg::View::Slave &, getSlave, IN, unsigned int, pos, + __C5_Slave_R1__getSlave__unsigned_int, "", ""); - I_Method1(osg::View::CameraData &, getCameraData, IN, unsigned int, pos, - __CameraData_R1__getCameraData__unsigned_int, - "", - ""); - I_Method1(const osg::View::CameraData &, getCameraData, IN, unsigned int, pos, - __C5_CameraData_R1__getCameraData__unsigned_int, - "", - ""); - I_Method2(bool, computeLocalToWorldMatrix, IN, osg::Matrix &, matrix, IN, osg::NodeVisitor *, x, - __bool__computeLocalToWorldMatrix__Matrix_R1__NodeVisitor_P1, - "Transform method that must be defined to provide generic interface for scene graph traversals. ", - ""); - I_Method2(bool, computeWorldToLocalMatrix, IN, osg::Matrix &, matrix, IN, osg::NodeVisitor *, x, - __bool__computeWorldToLocalMatrix__Matrix_R1__NodeVisitor_P1, - "Transform method that must be defined to provide generic interface for scene graph traversals. ", - ""); - I_ArrayProperty(osg::CameraNode *, Camera, - __CameraNode_P1__getCamera__unsigned_int, + I_SimpleProperty(osg::Camera *, Camera, + __osg_Camera_P1__getCamera, + __void__setCamera__osg_Camera_P1); + I_ArrayProperty(osg::View::Slave &, Slave, + __Slave_R1__getSlave__unsigned_int, 0, - __unsigned_int__getNumCameras, - __bool__addCamera__osg_CameraNode_P1, + __unsigned_int__getNumSlaves, 0, - __bool__removeCamera__unsigned_int); - I_SimpleProperty(osg::Matrixd, InverseViewMatrix, - __Matrixd__getInverseViewMatrix, - 0); - I_SimpleProperty(const osg::Matrixd &, ProjectionMatrix, - __C5_osg_Matrixd_R1__getProjectionMatrix, - __void__setProjectionMatrix__C5_osg_Matrixd_R1); - I_SimpleProperty(const osg::Matrixd &, ViewMatrix, - __C5_osg_Matrixd_R1__getViewMatrix, - __void__setViewMatrix__C5_osg_Matrixd_R1); + 0, + __bool__removeSlave__unsigned_int); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osg::View::CameraData) - I_Constructor0(____CameraData, +BEGIN_VALUE_REFLECTOR(osg::View::Slave) + I_Constructor0(____Slave, "", ""); - I_Constructor3(IN, osg::CameraNode *, camera, IN, const osg::Matrixd &, projectionOffset, IN, const osg::Matrixd &, viewOffset, - ____CameraData__osg_CameraNode_P1__C5_osg_Matrixd_R1__C5_osg_Matrixd_R1, + I_Constructor3(IN, osg::Camera *, camera, IN, const osg::Matrixd &, projectionOffset, IN, const osg::Matrixd &, viewOffset, + ____Slave__osg_Camera_P1__C5_osg_Matrixd_R1__C5_osg_Matrixd_R1, "", ""); - I_Constructor1(IN, const osg::View::CameraData &, rhs, - ____CameraData__C5_CameraData_R1, + I_Constructor1(IN, const osg::View::Slave &, rhs, + ____Slave__C5_Slave_R1, "", ""); - I_PublicMemberProperty(osg::ref_ptr< osg::CameraNode >, _camera); + I_PublicMemberProperty(osg::ref_ptr< osg::Camera >, _camera); I_PublicMemberProperty(osg::Matrixd, _projectionOffset); I_PublicMemberProperty(osg::Matrixd, _viewOffset); END_REFLECTOR diff --git a/src/osgWrappers/osgGA/GUIEventHandler.cpp b/src/osgWrappers/osgGA/GUIEventHandler.cpp index 9066e02cd..b72e34b4f 100644 --- a/src/osgWrappers/osgGA/GUIEventHandler.cpp +++ b/src/osgWrappers/osgGA/GUIEventHandler.cpp @@ -76,13 +76,3 @@ BEGIN_OBJECT_REFLECTOR(osgGA::GUIEventHandler) ""); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osgGA::GUIEventHandlerVisitor) - I_Constructor0(____GUIEventHandlerVisitor, - "", - ""); - I_Method1(void, visit, IN, osgGA::GUIEventHandler &, x, - __void__visit__GUIEventHandler_R1, - "", - ""); -END_REFLECTOR - diff --git a/src/osgWrappers/osgProducer/GNUmakefile b/src/osgWrappers/osgProducer/GNUmakefile index d65cda736..9881eb18f 100644 --- a/src/osgWrappers/osgProducer/GNUmakefile +++ b/src/osgWrappers/osgProducer/GNUmakefile @@ -10,7 +10,7 @@ CXXFILES =\ Viewer.cpp\ ViewerEventHandler.cpp\ -LIBS += -losgProducer -losg -losgIntrospection -losgUtil -losgGA -losgDB -lProducer -losgGA -losgText $(GL_LIBS) $(OTHER_LIBS) +LIBS += -losgProducer -losg -losgIntrospection -losgUtil -losgDB -lProducer -losgGA -losgText $(GL_LIBS) $(OTHER_LIBS) OPTF = -O diff --git a/src/osgWrappers/osgShadow/OccluderGeometry.cpp b/src/osgWrappers/osgShadow/OccluderGeometry.cpp index a936c587d..cd96c4859 100644 --- a/src/osgWrappers/osgShadow/OccluderGeometry.cpp +++ b/src/osgWrappers/osgShadow/OccluderGeometry.cpp @@ -16,7 +16,9 @@ #include #include #include +#include #include +#include #include // Must undefine IN and OUT macros defined in Windows headers @@ -31,8 +33,6 @@ TYPE_NAME_ALIAS(std::vector< osg::Vec3 >, osgShadow::OccluderGeometry::Vec3List) TYPE_NAME_ALIAS(std::vector< GLuint >, osgShadow::OccluderGeometry::UIntList); -TYPE_NAME_ALIAS(std::vector< osgShadow::OccluderGeometry::Edge >, osgShadow::OccluderGeometry::EdgeList); - BEGIN_OBJECT_REFLECTOR(osgShadow::OccluderGeometry) I_BaseType(osg::Drawable); I_Constructor0(____OccluderGeometry, @@ -70,6 +70,22 @@ BEGIN_OBJECT_REFLECTOR(osgShadow::OccluderGeometry) __void__computeOccluderGeometry__osg_Drawable_P1__osg_Matrix_P1__float, "Compute an occluder geometry containing the geometry in specified drawable. ", ""); + I_Method2(void, comptueShadowVolumeGeometry, IN, const osg::Vec4 &, lightpos, IN, osgShadow::ShadowVolumeGeometry &, svg, + __void__comptueShadowVolumeGeometry__C5_osg_Vec4_R1__ShadowVolumeGeometry_R1, + "Compute ShadowVolumeGeometry. ", + ""); + I_Method1(void, setBoundingPolytope, IN, const osg::Polytope &, polytope, + __void__setBoundingPolytope__C5_osg_Polytope_R1, + "Set the bounding polytope of the OccluderGeometry. ", + ""); + I_Method0(osg::Polytope &, getBoundingPolytope, + __osg_Polytope_R1__getBoundingPolytope, + "Get the bounding polytope of the OccluderGeometry. ", + ""); + I_Method0(const osg::Polytope &, getBoundingPolytope, + __C5_osg_Polytope_R1__getBoundingPolytope, + "Get the const bounding polytope of the OccluderGeometry. ", + ""); I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo, __void__drawImplementation__osg_RenderInfo_R1, "Render the occluder geometry. ", @@ -78,23 +94,87 @@ BEGIN_OBJECT_REFLECTOR(osgShadow::OccluderGeometry) __osg_BoundingBox__computeBound, "Compute the bounding box around occluder geometry. ", ""); + I_MethodWithDefaults3(void, processGeometry, IN, osg::Drawable *, drawable, , IN, osg::Matrix *, matrix, 0, IN, float, sampleRatio, 1.0f, + __void__processGeometry__osg_Drawable_P1__osg_Matrix_P1__float, + "", + ""); + I_SimpleProperty(const osg::Polytope &, BoundingPolytope, + __C5_osg_Polytope_R1__getBoundingPolytope, + __void__setBoundingPolytope__C5_osg_Polytope_R1); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osgShadow::OccluderGeometry::Edge) - I_Constructor0(____Edge, +TYPE_NAME_ALIAS(std::vector< osg::Vec3 >, osgShadow::ShadowVolumeGeometry::Vec3List); + +TYPE_NAME_ALIAS(std::vector< GLuint >, osgShadow::ShadowVolumeGeometry::UIntList); + +BEGIN_OBJECT_REFLECTOR(osgShadow::ShadowVolumeGeometry) + I_BaseType(osg::Drawable); + I_Constructor0(____ShadowVolumeGeometry, "", ""); - I_Constructor4(IN, unsigned int, p1, IN, unsigned int, p2, IN, unsigned int, t1, IN, unsigned int, t2, - ____Edge__unsigned_int__unsigned_int__unsigned_int__unsigned_int, - "", - ""); - I_PublicMemberProperty(unsigned int, _p1); - I_PublicMemberProperty(unsigned int, _p2); - I_PublicMemberProperty(unsigned int, _t1); - I_PublicMemberProperty(unsigned int, _t2); + I_ConstructorWithDefaults2(IN, const osgShadow::ShadowVolumeGeometry &, oc, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, + ____ShadowVolumeGeometry__C5_ShadowVolumeGeometry_R1__C5_osg_CopyOp_R1, + "", + ""); + I_Method0(osg::Object *, cloneType, + __Object_P1__cloneType, + "Clone the type of an object, with Object* return type. ", + "Must be defined by derived classes. "); + I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop, + __Object_P1__clone__C5_osg_CopyOp_R1, + "Clone an object, with Object* return type. ", + "Must be defined by derived classes. "); + I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, + __bool__isSameKindAs__C5_osg_Object_P1, + "", + ""); + I_Method0(const char *, libraryName, + __C5_char_P1__libraryName, + "return the name of the object's library. ", + "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. "); + I_Method0(const char *, className, + __C5_char_P1__className, + "return the name of the object's class type. ", + "Must be defined by derived classes. "); + I_Method1(void, setVertices, IN, const osgShadow::ShadowVolumeGeometry::Vec3List &, vertices, + __void__setVertices__C5_Vec3List_R1, + "", + ""); + I_Method0(osgShadow::ShadowVolumeGeometry::Vec3List &, getVertices, + __Vec3List_R1__getVertices, + "", + ""); + I_Method0(const osgShadow::ShadowVolumeGeometry::Vec3List &, getVertices, + __C5_Vec3List_R1__getVertices, + "", + ""); + I_Method1(void, setNormals, IN, const osgShadow::ShadowVolumeGeometry::Vec3List &, normals, + __void__setNormals__C5_Vec3List_R1, + "", + ""); + I_Method0(osgShadow::ShadowVolumeGeometry::Vec3List &, getNormals, + __Vec3List_R1__getNormals, + "", + ""); + I_Method0(const osgShadow::ShadowVolumeGeometry::Vec3List &, getNormals, + __C5_Vec3List_R1__getNormals, + "", + ""); + I_Method1(void, drawImplementation, IN, osg::RenderInfo &, renderInfo, + __void__drawImplementation__osg_RenderInfo_R1, + "Render the occluder geometry. ", + ""); + I_Method0(osg::BoundingBox, computeBound, + __osg_BoundingBox__computeBound, + "Compute the bounding box around occluder geometry. ", + ""); + I_SimpleProperty(const osgShadow::ShadowVolumeGeometry::Vec3List &, Normals, + __C5_Vec3List_R1__getNormals, + __void__setNormals__C5_Vec3List_R1); + I_SimpleProperty(const osgShadow::ShadowVolumeGeometry::Vec3List &, Vertices, + __C5_Vec3List_R1__getVertices, + __void__setVertices__C5_Vec3List_R1); END_REFLECTOR STD_VECTOR_REFLECTOR(std::vector< GLuint >); -STD_VECTOR_REFLECTOR(std::vector< osgShadow::OccluderGeometry::Edge >); - diff --git a/src/osgWrappers/osgSim/ImpostorSprite.cpp b/src/osgWrappers/osgSim/ImpostorSprite.cpp index acf6dc08c..7a7cdfdcd 100644 --- a/src/osgWrappers/osgSim/ImpostorSprite.cpp +++ b/src/osgWrappers/osgSim/ImpostorSprite.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -166,21 +166,21 @@ BEGIN_OBJECT_REFLECTOR(osgSim::ImpostorSprite) __osg_BoundingBox__computeBound, "Compute the bounding box around Drawables's geometry. ", ""); - I_Method1(void, setCameraNode, IN, osg::CameraNode *, camera, - __void__setCameraNode__osg_CameraNode_P1, + I_Method1(void, setCamera, IN, osg::Camera *, camera, + __void__setCamera__osg_Camera_P1, "Set the camera node to use for pre rendering the impostor sprite's texture. ", ""); - I_Method0(osg::CameraNode *, getCameraNode, - __osg_CameraNode_P1__getCameraNode, + I_Method0(osg::Camera *, getCamera, + __osg_Camera_P1__getCamera, "Get the camera node to use for pre rendering the impostor sprite's texture. ", ""); - I_Method0(const osg::CameraNode *, getCameraNode, - __C5_osg_CameraNode_P1__getCameraNode, + I_Method0(const osg::Camera *, getCamera, + __C5_osg_Camera_P1__getCamera, "Get the const camera node to use for pre rendering the impostor sprite's texture. ", ""); - I_SimpleProperty(osg::CameraNode *, CameraNode, - __osg_CameraNode_P1__getCameraNode, - __void__setCameraNode__osg_CameraNode_P1); + I_SimpleProperty(osg::Camera *, Camera, + __osg_Camera_P1__getCamera, + __void__setCamera__osg_Camera_P1); I_SimpleProperty(osg::Vec3 *, ControlCoords, __osg_Vec3_P1__getControlCoords, 0); diff --git a/src/osgWrappers/osgSim/OverlayNode.cpp b/src/osgWrappers/osgSim/OverlayNode.cpp index 95bb008de..8394721f1 100644 --- a/src/osgWrappers/osgSim/OverlayNode.cpp +++ b/src/osgWrappers/osgSim/OverlayNode.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -119,16 +119,16 @@ BEGIN_OBJECT_REFLECTOR(osgSim::OverlayNode) __unsigned_int__getOverlayTextureSizeHint, "Get the texture size hint. ", ""); - I_Method0(osg::CameraNode *, getCamera, - __osg_CameraNode_P1__getCamera, + I_Method0(osg::Camera *, getCamera, + __osg_Camera_P1__getCamera, "Get the camera used to implement the render to texture of the overlay subgraph. ", ""); - I_Method0(const osg::CameraNode *, getCamera, - __C5_osg_CameraNode_P1__getCamera, + I_Method0(const osg::Camera *, getCamera, + __C5_osg_Camera_P1__getCamera, "Get the const camera used to implement the render to texture of the overlay subgraph. ", ""); - I_SimpleProperty(osg::CameraNode *, Camera, - __osg_CameraNode_P1__getCamera, + I_SimpleProperty(osg::Camera *, Camera, + __osg_Camera_P1__getCamera, 0); I_SimpleProperty(bool, ContinuousUpdate, __bool__getContinuousUpdate, diff --git a/src/osgWrappers/osgUtil/CullVisitor.cpp b/src/osgWrappers/osgUtil/CullVisitor.cpp index 0952ea1e7..1ca3782f3 100644 --- a/src/osgWrappers/osgUtil/CullVisitor.cpp +++ b/src/osgWrappers/osgUtil/CullVisitor.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include @@ -124,8 +124,8 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::CullVisitor) __void__apply__osg_ClearNode_R1, "", ""); - I_Method1(void, apply, IN, osg::CameraNode &, node, - __void__apply__osg_CameraNode_R1, + I_Method1(void, apply, IN, osg::Camera &, node, + __void__apply__osg_Camera_R1, "", ""); I_Method1(void, apply, IN, osg::OccluderNode &, node, diff --git a/src/osgWrappers/osgUtil/IntersectVisitor.cpp b/src/osgWrappers/osgUtil/IntersectVisitor.cpp index 8fffd3991..c0510d98f 100644 --- a/src/osgWrappers/osgUtil/IntersectVisitor.cpp +++ b/src/osgWrappers/osgUtil/IntersectVisitor.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -280,8 +280,8 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::PickVisitor) __void__apply__osg_Projection_R1, "", ""); - I_Method1(void, apply, IN, osg::CameraNode &, camera, - __void__apply__osg_CameraNode_R1, + I_Method1(void, apply, IN, osg::Camera &, camera, + __void__apply__osg_Camera_R1, "", ""); END_REFLECTOR diff --git a/src/osgWrappers/osgUtil/IntersectionVisitor.cpp b/src/osgWrappers/osgUtil/IntersectionVisitor.cpp index 58797ae53..4293e8f48 100644 --- a/src/osgWrappers/osgUtil/IntersectionVisitor.cpp +++ b/src/osgWrappers/osgUtil/IntersectionVisitor.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -152,8 +152,8 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::IntersectionVisitor) __void__apply__osg_Projection_R1, "", ""); - I_Method1(void, apply, IN, osg::CameraNode &, camera, - __void__apply__osg_CameraNode_R1, + I_Method1(void, apply, IN, osg::Camera &, camera, + __void__apply__osg_Camera_R1, "", ""); I_SimpleProperty(osgUtil::Intersector *, Intersector, diff --git a/src/osgWrappers/osgUtil/Optimizer.cpp b/src/osgWrappers/osgUtil/Optimizer.cpp index a6c18fc6f..bc63766b2 100644 --- a/src/osgWrappers/osgUtil/Optimizer.cpp +++ b/src/osgWrappers/osgUtil/Optimizer.cpp @@ -442,6 +442,10 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::Optimizer::RemoveRedundantNodesVisitor) __void__apply__osg_Transform_R1, "", ""); + I_Method1(bool, isOperationPermissible, IN, osg::Node &, node, + __bool__isOperationPermissible__osg_Node_R1, + "", + ""); I_Method0(void, removeRedundantNodes, __void__removeRedundantNodes, "", diff --git a/src/osgWrappers/osgUtil/RenderStage.cpp b/src/osgWrappers/osgUtil/RenderStage.cpp index 05a7cda25..ddf0da900 100644 --- a/src/osgWrappers/osgUtil/RenderStage.cpp +++ b/src/osgWrappers/osgUtil/RenderStage.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -150,16 +150,16 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::RenderStage) __int__getClearStencil, "Get the clear color. ", ""); - I_Method1(void, setCameraNode, IN, osg::CameraNode *, camera, - __void__setCameraNode__osg_CameraNode_P1, + I_Method1(void, setCamera, IN, osg::Camera *, camera, + __void__setCamera__osg_Camera_P1, "", ""); - I_Method0(osg::CameraNode *, getCameraNode, - __osg_CameraNode_P1__getCameraNode, + I_Method0(osg::Camera *, getCamera, + __osg_Camera_P1__getCamera, "", ""); - I_Method0(const osg::CameraNode *, getCameraNode, - __C5_osg_CameraNode_P1__getCameraNode, + I_Method0(const osg::Camera *, getCamera, + __C5_osg_Camera_P1__getCamera, "", ""); I_Method1(void, setCameraRequiresSetUp, IN, bool, flag, @@ -306,9 +306,13 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::RenderStage) __bool__getStats__Statistics_R1, "Extract stats for current draw list. ", ""); - I_SimpleProperty(osg::CameraNode *, CameraNode, - __osg_CameraNode_P1__getCameraNode, - __void__setCameraNode__osg_CameraNode_P1); + I_Method2(void, attach, IN, osg::Camera::BufferComponent, buffer, IN, osg::Image *, image, + __void__attach__osg_Camera_BufferComponent__osg_Image_P1, + "", + ""); + I_SimpleProperty(osg::Camera *, Camera, + __osg_Camera_P1__getCamera, + __void__setCamera__osg_Camera_P1); I_SimpleProperty(bool, CameraRequiresSetUp, __bool__getCameraRequiresSetUp, __void__setCameraRequiresSetUp__bool); @@ -368,3 +372,12 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::RenderStage) __void__setViewport__osg_Viewport_P1); END_REFLECTOR +BEGIN_VALUE_REFLECTOR(osgUtil::RenderStage::Attachment) + I_Constructor0(____Attachment, + "", + ""); + I_PublicMemberProperty(osg::ref_ptr< osg::Image >, _image); + I_PublicMemberProperty(GLenum, _imageReadPixelFormat); + I_PublicMemberProperty(GLenum, _imageReadPixelDataType); +END_REFLECTOR + diff --git a/src/osgWrappers/osgUtil/SceneView.cpp b/src/osgWrappers/osgUtil/SceneView.cpp index 02dc7e383..6e1081fc9 100644 --- a/src/osgWrappers/osgUtil/SceneView.cpp +++ b/src/osgWrappers/osgUtil/SceneView.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -76,16 +76,16 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::SceneView) __void__setDefaults__unsigned_int, "Set scene view to use default global state, light, camera and render visitor. ", ""); - I_Method1(void, setCamera, IN, osg::CameraNode *, camera, - __void__setCamera__osg_CameraNode_P1, + I_Method1(void, setCamera, IN, osg::Camera *, camera, + __void__setCamera__osg_Camera_P1, "Set the camera used to represent the camera view of this SceneView. ", ""); - I_Method0(osg::CameraNode *, getCamera, - __osg_CameraNode_P1__getCamera, + I_Method0(osg::Camera *, getCamera, + __osg_Camera_P1__getCamera, "Get the camera used to represent the camera view of this SceneView. ", ""); - I_Method0(const osg::CameraNode *, getCamera, - __C5_osg_CameraNode_P1__getCamera, + I_Method0(const osg::Camera *, getCamera, + __C5_osg_Camera_P1__getCamera, "Get the const camera used to represent the camera view of this SceneView. ", ""); I_Method1(void, setSceneData, IN, osg::Node *, node, @@ -583,9 +583,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::SceneView) I_SimpleProperty(int, ActiveUniforms, __int__getActiveUniforms, __void__setActiveUniforms__int); - I_SimpleProperty(osg::CameraNode *, Camera, - __osg_CameraNode_P1__getCamera, - __void__setCamera__osg_CameraNode_P1); + I_SimpleProperty(osg::Camera *, Camera, + __osg_Camera_P1__getCamera, + __void__setCamera__osg_Camera_P1); I_SimpleProperty(const osg::Vec4 &, ClearColor, __C5_osg_Vec4_R1__getClearColor, __void__setClearColor__C5_osg_Vec4_R1); diff --git a/src/osgWrappers/osgViewer/CompositeViewer.cpp b/src/osgWrappers/osgViewer/CompositeViewer.cpp new file mode 100644 index 000000000..45875a93c --- /dev/null +++ b/src/osgWrappers/osgViewer/CompositeViewer.cpp @@ -0,0 +1,88 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) + I_BaseType(osg::Referenced); + I_Constructor0(____CompositeViewer, + "", + ""); + I_Method1(void, addView, IN, osgViewer *, view, + __void__addView__osgViewer_P1, + "", + ""); + I_Method1(osgViewer *, getView, IN, unsigned, i, + __osgViewer_P1__getView__unsigned, + "", + ""); + I_Method1(const osgViewer *, getView, IN, unsigned, i, + __C5_osgViewer_P1__getView__unsigned, + "", + ""); + I_Method0(void, getNumViews, + __void__getNumViews, + "", + ""); + I_Method0(void, frame, + __void__frame, + "Render a complete new frame. ", + "Calls frameAdvance(), frameEventTraversal(), frameUpateTraversal(), frameCullTraversal() and frameDrawTraversal(). Note, no internal makeCurrent() is issued before, or swap buffers called after frame(), these operations are the responsibility of the calling code. "); + I_Method0(void, frameAdvance, + __void__frameAdvance, + "", + ""); + I_Method0(void, frameEventTraversal, + __void__frameEventTraversal, + "", + ""); + I_Method0(void, frameUpdateTraversal, + __void__frameUpdateTraversal, + "", + ""); + I_Method0(void, frameCullTraversal, + __void__frameCullTraversal, + "", + ""); + I_Method0(void, frameDrawTraversal, + __void__frameDrawTraversal, + "", + ""); + I_Method0(void, releaseAllGLObjects, + __void__releaseAllGLObjects, + "Release all OpenGL objects associated with this viewer's scenegraph. ", + "Note, does not deleted the actual OpenGL objects, it just releases them to the pending GL object delete lists which will need flushing once a valid graphics context is obtained. "); + I_Method0(void, cleanup, + __void__cleanup, + "Clean up all OpenGL objects associated with this viewer's scenegraph. ", + "Note, must only be called from the graphics context associated with this viewer. "); + I_Method0(void, init, + __void__init, + "", + ""); + I_ArrayProperty(osgViewer *, View, + __osgViewer_P1__getView__unsigned, + 0, + __void__getNumViews, + __void__addView__osgViewer_P1, + 0, + 0); +END_REFLECTOR + diff --git a/src/osgWrappers/osgViewer/GNUmakefile b/src/osgWrappers/osgViewer/GNUmakefile index abb49341b..8f059bf85 100644 --- a/src/osgWrappers/osgViewer/GNUmakefile +++ b/src/osgWrappers/osgViewer/GNUmakefile @@ -2,9 +2,13 @@ TOPDIR = ../../.. include $(TOPDIR)/Make/makedefs CXXFILES =\ - Export.cpp\ + CompositeViewer.cpp\ GraphicsWindow.cpp\ + GraphicsWindowProxy.cpp\ + Scene.cpp\ SimpleViewer.cpp\ + View.cpp\ + Viewer.cpp\ LIBS += -losgViewer -losg -losgIntrospection $(GL_LIBS) $(OTHER_LIBS) diff --git a/src/osgWrappers/osgViewer/GraphicsWindowProxy.cpp b/src/osgWrappers/osgViewer/GraphicsWindowProxy.cpp new file mode 100644 index 000000000..4886b3ac5 --- /dev/null +++ b/src/osgWrappers/osgViewer/GraphicsWindowProxy.cpp @@ -0,0 +1,86 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include +#include +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +BEGIN_OBJECT_REFLECTOR(osgViewer::GraphicsWindowProxy) + I_BaseType(osgViewer::GraphicsWindow); + I_Constructor0(____GraphicsWindowProxy, + "", + ""); + I_Method1(void, setGraphicsWindowImplentation, IN, osgViewer::GraphicsWindow *, gw, + __void__setGraphicsWindowImplentation__osgViewer_GraphicsWindow_P1, + "", + ""); + I_Method0(osgViewer::GraphicsWindow *, getGraphicsWindowImplentation, + __osgViewer_GraphicsWindow_P1__getGraphicsWindowImplentation, + "", + ""); + I_Method0(const osgViewer::GraphicsWindow *, getGraphicsWindowImplentation, + __C5_osgViewer_GraphicsWindow_P1__getGraphicsWindowImplentation, + "", + ""); + I_Method0(bool, realizeImplementation, + __bool__realizeImplementation, + "Realise the GraphicsContext implementation, Pure virtual - must be implemented by concrate implementations of GraphicsContext. ", + ""); + I_Method0(bool, isRealizedImplementation, + __bool__isRealizedImplementation, + "Return true if the graphics context has been realised, and is ready to use, implementation. ", + "Pure virtual - must be implemented by concrate implementations of GraphicsContext. "); + I_Method0(void, closeImplementation, + __void__closeImplementation, + "Close the graphics context implementation. ", + "Pure virtual - must be implemented by concrate implementations of GraphicsContext. "); + I_Method0(void, makeCurrentImplementation, + __void__makeCurrentImplementation, + "Make this graphics context current implementation. ", + "Pure virtual - must be implemented by concrate implementations of GraphicsContext. "); + I_Method1(void, makeContextCurrentImplementation, IN, osg::GraphicsContext *, readContext, + __void__makeContextCurrentImplementation__GraphicsContext_P1, + "Make this graphics context current with specified read context implementation. ", + "Pure virtual - must be implemented by concrate implementations of GraphicsContext. "); + I_Method1(void, bindPBufferToTextureImplementation, IN, GLenum, buffer, + __void__bindPBufferToTextureImplementation__GLenum, + "Pure virtual, Bind the graphics context to associated texture implementation. ", + "Pure virtual - must be implemented by concrate implementations of GraphicsContext. "); + I_Method0(void, swapBuffersImplementation, + __void__swapBuffersImplementation, + "Swap the front and back buffers implementation. ", + "Pure virtual - must be implemented by Concrate implementations of GraphicsContext. "); + I_Method0(void, requestRedraw, + __void__requestRedraw, + "requestRedraw() requests a single redraw. ", + ""); + I_MethodWithDefaults1(void, requestContinuousUpdate, IN, bool, needed, true, + __void__requestContinuousUpdate__bool, + "requestContinousUpdate(bool) is for en/disabling a throw or idle callback to be requested by a GUIEventHandler (typically a MatrixManipulator, though other GUIEventHandler's may also provide functionality). ", + "GUI toolkits can respond to this immediately by registering an idle/timed callback, or can delay setting the callback and update at their own leisure."); + I_Method2(void, requestWarpPointer, IN, float, x, IN, float, y, + __void__requestWarpPointer__float__float, + "requestWarpPointer(int,int) is requesting a repositioning of the mouse pointer to a specified x,y location on the window. ", + "This is used by some camera manipulators to initialise the mouse pointer when mouse position relative to a controls neutral mouse position is required, i.e when mimicking a aircrafts joystick."); + I_SimpleProperty(osgViewer::GraphicsWindow *, GraphicsWindowImplentation, + __osgViewer_GraphicsWindow_P1__getGraphicsWindowImplentation, + __void__setGraphicsWindowImplentation__osgViewer_GraphicsWindow_P1); +END_REFLECTOR + diff --git a/src/osgWrappers/osgViewer/Scene.cpp b/src/osgWrappers/osgViewer/Scene.cpp new file mode 100644 index 000000000..2d2b54c17 --- /dev/null +++ b/src/osgWrappers/osgViewer/Scene.cpp @@ -0,0 +1,111 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osgGA::GUIEventHandler > >, osgViewer::Scene::EventHandlers); + +BEGIN_OBJECT_REFLECTOR(osgViewer::Scene) + I_VirtualBaseType(osg::Referenced); + I_Constructor0(____Scene, + "", + ""); + I_Method1(void, setSceneData, IN, osg::Node *, node, + __void__setSceneData__osg_Node_P1, + "", + ""); + I_Method0(osg::Node *, getSceneData, + __osg_Node_P1__getSceneData, + "", + ""); + I_Method0(const osg::Node *, getSceneData, + __C5_osg_Node_P1__getSceneData, + "", + ""); + I_Method1(void, setEventQueue, IN, osgGA::EventQueue *, eventQueue, + __void__setEventQueue__osgGA_EventQueue_P1, + "", + ""); + I_Method0(osgGA::EventQueue *, getEventQueue, + __osgGA_EventQueue_P1__getEventQueue, + "", + ""); + I_Method0(const osgGA::EventQueue *, getEventQueue, + __C5_osgGA_EventQueue_P1__getEventQueue, + "", + ""); + I_Method1(void, addEventHandler, IN, osgGA::GUIEventHandler *, eventHandler, + __void__addEventHandler__osgGA_GUIEventHandler_P1, + "", + ""); + I_Method0(osgViewer::Scene::EventHandlers &, getEventHandlers, + __EventHandlers_R1__getEventHandlers, + "", + ""); + I_Method0(const osgViewer::Scene::EventHandlers &, getEventHandlers, + __C5_EventHandlers_R1__getEventHandlers, + "", + ""); + I_Method1(void, setDatabasePager, IN, osgDB::DatabasePager *, dp, + __void__setDatabasePager__osgDB_DatabasePager_P1, + "", + ""); + I_Method0(osgDB::DatabasePager *, getDatabasePager, + __osgDB_DatabasePager_P1__getDatabasePager, + "", + ""); + I_Method0(const osgDB::DatabasePager *, getDatabasePager, + __C5_osgDB_DatabasePager_P1__getDatabasePager, + "", + ""); + I_Method0(void, frameAdvance, + __void__frameAdvance, + "", + ""); + I_Method0(void, frameEventTraversal, + __void__frameEventTraversal, + "", + ""); + I_Method0(void, frameUpdateTraversal, + __void__frameUpdateTraversal, + "", + ""); + I_Method0(void, init, + __void__init, + "", + ""); + I_SimpleProperty(osgDB::DatabasePager *, DatabasePager, + __osgDB_DatabasePager_P1__getDatabasePager, + __void__setDatabasePager__osgDB_DatabasePager_P1); + I_SimpleProperty(osgViewer::Scene::EventHandlers &, EventHandlers, + __EventHandlers_R1__getEventHandlers, + 0); + I_SimpleProperty(osgGA::EventQueue *, EventQueue, + __osgGA_EventQueue_P1__getEventQueue, + __void__setEventQueue__osgGA_EventQueue_P1); + I_SimpleProperty(osg::Node *, SceneData, + __osg_Node_P1__getSceneData, + __void__setSceneData__osg_Node_P1); +END_REFLECTOR + diff --git a/src/osgWrappers/osgViewer/SimpleViewer.cpp b/src/osgWrappers/osgViewer/SimpleViewer.cpp index c96e29f56..b2fc34361 100644 --- a/src/osgWrappers/osgViewer/SimpleViewer.cpp +++ b/src/osgWrappers/osgViewer/SimpleViewer.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -45,12 +45,24 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::SimpleViewer) __C5_osg_Node_P1__getSceneData, "", ""); - I_Method0(osg::CameraNode *, getCamera, - __osg_CameraNode_P1__getCamera, + I_Method1(void, setDatabasePager, IN, osgDB::DatabasePager *, dp, + __void__setDatabasePager__osgDB_DatabasePager_P1, "", ""); - I_Method0(const osg::CameraNode *, getCamera, - __C5_osg_CameraNode_P1__getCamera, + I_Method0(osgDB::DatabasePager *, getDatabasePager, + __osgDB_DatabasePager_P1__getDatabasePager, + "", + ""); + I_Method0(const osgDB::DatabasePager *, getDatabasePager, + __C5_osgDB_DatabasePager_P1__getDatabasePager, + "", + ""); + I_Method0(osg::Camera *, getCamera, + __osg_Camera_P1__getCamera, + "", + ""); + I_Method0(const osg::Camera *, getCamera, + __C5_osg_Camera_P1__getCamera, "", ""); I_Method1(void, setCameraManipulator, IN, osgGA::MatrixManipulator *, manipulator, @@ -77,18 +89,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::SimpleViewer) __C5_EventHandlers_R1__getEventHandlers, "", ""); - I_Method1(void, setDatabasePager, IN, osgDB::DatabasePager *, dp, - __void__setDatabasePager__osgDB_DatabasePager_P1, - "", - ""); - I_Method0(osgDB::DatabasePager *, getDatabasePager, - __osgDB_DatabasePager_P1__getDatabasePager, - "", - ""); - I_Method0(const osgDB::DatabasePager *, getDatabasePager, - __C5_osgDB_DatabasePager_P1__getDatabasePager, - "", - ""); I_Method0(void, frame, __void__frame, "Render a complete new frame. ", @@ -133,8 +133,8 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::SimpleViewer) __void__init, "", ""); - I_SimpleProperty(osg::CameraNode *, Camera, - __osg_CameraNode_P1__getCamera, + I_SimpleProperty(osg::Camera *, Camera, + __osg_Camera_P1__getCamera, 0); I_SimpleProperty(osgGA::MatrixManipulator *, CameraManipulator, __osgGA_MatrixManipulator_P1__getCameraManipulator, diff --git a/src/osgWrappers/osgViewer/View.cpp b/src/osgWrappers/osgViewer/View.cpp new file mode 100644 index 000000000..37c67625e --- /dev/null +++ b/src/osgWrappers/osgViewer/View.cpp @@ -0,0 +1,84 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include +#include +#include +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osgGA::GUIEventHandler > >, View::EventHandlers); + +BEGIN_OBJECT_REFLECTOR(View) + I_VirtualBaseType(osg::View); + I_BaseType(osgViewer::Scene); + I_Constructor0(____View, + "", + ""); + I_Method1(void, setSceneData, IN, osg::Node *, node, + __void__setSceneData__osg_Node_P1, + "", + ""); + I_Method0(osg::Node *, getSceneData, + __osg_Node_P1__getSceneData, + "", + ""); + I_Method0(const osg::Node *, getSceneData, + __C5_osg_Node_P1__getSceneData, + "", + ""); + I_Method1(void, setCameraManipulator, IN, osgGA::MatrixManipulator *, manipulator, + __void__setCameraManipulator__osgGA_MatrixManipulator_P1, + "", + ""); + I_Method0(osgGA::MatrixManipulator *, getCameraManipulator, + __osgGA_MatrixManipulator_P1__getCameraManipulator, + "", + ""); + I_Method0(const osgGA::MatrixManipulator *, getCameraManipulator, + __C5_osgGA_MatrixManipulator_P1__getCameraManipulator, + "", + ""); + I_Method1(void, addEventHandler, IN, osgGA::GUIEventHandler *, eventHandler, + __void__addEventHandler__osgGA_GUIEventHandler_P1, + "", + ""); + I_Method0(View::EventHandlers &, getEventHandlers, + __EventHandlers_R1__getEventHandlers, + "", + ""); + I_Method0(const View::EventHandlers &, getEventHandlers, + __C5_EventHandlers_R1__getEventHandlers, + "", + ""); + I_Method0(void, init, + __void__init, + "", + ""); + I_SimpleProperty(osgGA::MatrixManipulator *, CameraManipulator, + __osgGA_MatrixManipulator_P1__getCameraManipulator, + __void__setCameraManipulator__osgGA_MatrixManipulator_P1); + I_SimpleProperty(View::EventHandlers &, EventHandlers, + __EventHandlers_R1__getEventHandlers, + 0); + I_SimpleProperty(osg::Node *, SceneData, + __osg_Node_P1__getSceneData, + __void__setSceneData__osg_Node_P1); +END_REFLECTOR + diff --git a/src/osgWrappers/osgViewer/Viewer.cpp b/src/osgWrappers/osgViewer/Viewer.cpp new file mode 100644 index 000000000..a1bc67903 --- /dev/null +++ b/src/osgWrappers/osgViewer/Viewer.cpp @@ -0,0 +1,64 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +BEGIN_VALUE_REFLECTOR(osgViewer::Viewer) + I_Constructor0(____Viewer, + "", + ""); + I_Method0(void, frame, + __void__frame, + "Render a complete new frame. ", + "Calls frameAdvance(), frameEventTraversal(), frameUpateTraversal(), frameCullTraversal() and frameDrawTraversal(). Note, no internal makeCurrent() is issued before, or swap buffers called after frame(), these operations are the responsibility of the calling code. "); + I_Method0(void, frameAdvance, + __void__frameAdvance, + "", + ""); + I_Method0(void, frameEventTraversal, + __void__frameEventTraversal, + "", + ""); + I_Method0(void, frameUpdateTraversal, + __void__frameUpdateTraversal, + "", + ""); + I_Method0(void, frameCullTraversal, + __void__frameCullTraversal, + "", + ""); + I_Method0(void, frameDrawTraversal, + __void__frameDrawTraversal, + "", + ""); + I_Method0(void, releaseAllGLObjects, + __void__releaseAllGLObjects, + "Release all OpenGL objects associated with this viewer's scenegraph. ", + "Note, does not deleted the actual OpenGL objects, it just releases them to the pending GL object delete lists which will need flushing once a valid graphics context is obtained. "); + I_Method0(void, cleanup, + __void__cleanup, + "Clean up all OpenGL objects associated with this viewer's scenegraph. ", + "Note, must only be called from the graphics context associated with this viewer. "); + I_Method0(void, init, + __void__init, + "", + ""); +END_REFLECTOR +