Changeset 12503
- Timestamp:
- 06/08/11 11:24:29 (2 years ago)
- Location:
- OpenSceneGraph/trunk/examples/osgdepthpartition
- Files:
-
- 4 removed
- 2 modified
-
CMakeLists.txt (modified) (1 diff)
-
DepthPartitionNode.cpp (deleted)
-
DepthPartitionNode.h (deleted)
-
DistanceAccumulator.cpp (deleted)
-
DistanceAccumulator.h (deleted)
-
osgdepthpartition.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgdepthpartition/CMakeLists.txt
r7025 r12503 1 #this file is automatically generated 1 SET(TARGET_SRC osgdepthpartition.cpp ) 2 2 3 4 SET(TARGET_SRC DepthPartitionNode.cpp DistanceAccumulator.cpp osgdepthpartition.cpp )5 SET(TARGET_H DepthPartitionNode.h DistanceAccumulator.h )6 3 #### end var setup ### 7 4 SETUP_EXAMPLE(osgdepthpartition) -
OpenSceneGraph/trunk/examples/osgdepthpartition/osgdepthpartition.cpp
r10021 r12503 25 25 26 26 #include <osgGA/TrackballManipulator> 27 #include <osgGA/StateSetManipulator> 27 28 28 29 #include <osgViewer/Viewer> 29 30 #include "DepthPartitionNode.h" 30 #include <osgViewer/ViewerEventHandlers> 31 31 32 32 const double r_earth = 6378.137; … … 133 133 osgViewer::Viewer viewer; 134 134 135 // add the state manipulator 136 viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) ); 137 138 // add stats 139 viewer.addEventHandler( new osgViewer::StatsHandler() ); 140 135 141 bool needToSetHomePosition = false; 136 142 … … 144 150 needToSetHomePosition = true; 145 151 } 146 147 // Create a DepthPartitionNode to manage partitioning of the scene148 osg::ref_ptr<DepthPartitionNode> dpn = new DepthPartitionNode;149 dpn->addChild(scene.get());150 dpn->setActive(true); // Control whether the node analyzes the scene151 152 152 // pass the loaded scene graph to the viewer. 153 viewer.setSceneData( dpn.get());153 viewer.setSceneData(scene.get()); 154 154 155 155 viewer.setCameraManipulator(new osgGA::TrackballManipulator); … … 157 157 if (needToSetHomePosition) 158 158 { 159 viewer.getCameraManipulator()->setHomePosition(osg::Vec3d(0.0,-5.0*r_earth,0.0),osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,0.0,1.0));159 viewer.getCameraManipulator()->setHomePosition(osg::Vec3d(0.0,-5.0*r_earth,0.0),osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,0.0,1.0)); 160 160 } 161 161 162 // depth partion node is only supports single window/single threaded at present. 163 viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); 162 double zNear=1.0, zMid=10.0, zFar=1000.0; 163 if (arguments.read("--depth-partition",zNear, zMid, zFar)) 164 { 165 // set up depth partitioning 166 osg::ref_ptr<osgViewer::DepthPartitionSettings> dps = new osgViewer::DepthPartitionSettings; 167 dps->_mode = osgViewer::DepthPartitionSettings::FIXED_RANGE; 168 dps->_zNear = zNear; 169 dps->_zMid = zMid; 170 dps->_zFar = zFar; 171 viewer.setUpDepthPartition(dps.get()); 172 } 173 else 174 { 175 // set up depth partitioning with default settings 176 viewer.setUpDepthPartition(); 177 } 178 164 179 165 180 return viewer.run();
