Changeset 4631 for OpenSceneGraph/trunk/examples/osgcamera/osgcamera.cpp
- Timestamp:
- 10/28/05 15:11:56 (8 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgcamera/osgcamera.cpp
r4494 r4631 59 59 struct CullOperation : public osg::GraphicsThread::Operation 60 60 { 61 CullOperation(osg ::CameraNode* camera, osgUtil::SceneView* sceneView):61 CullOperation(osgUtil::SceneView* sceneView): 62 62 osg::GraphicsThread::Operation("Cull",true), 63 _camera(camera),64 63 _sceneView(sceneView) 65 64 { … … 69 68 { 70 69 _sceneView->setState(context->getState()); 71 _sceneView->setProjectionMatrix(_camera->getProjectionMatrix());72 _sceneView->setViewMatrix(_camera->getViewMatrix());73 _sceneView->setViewport(_camera->getViewport());74 75 70 _sceneView->cull(); 76 71 } 77 72 78 osg::CameraNode* _camera;79 73 osg::ref_ptr<osgUtil::SceneView> _sceneView; 80 74 }; … … 274 268 { 275 269 osg::CameraNode* camera = citr->get(); 270 osg::GraphicsThread* graphicsThread = camera->getGraphicsContext()->getGraphicsThread(); 276 271 277 272 // create a scene view to do the cull and draw … … 279 274 sceneView->setDefaults(); 280 275 sceneView->setFrameStamp(frameStamp.get()); 281 282 if (camera->getNumChildren()>=1) 283 { 284 sceneView->setSceneData(camera->getChild(0)); 285 } 276 sceneView->setCamera(camera); 286 277 287 278 // cull traversal operation 288 camera->getGraphicsContext()->getGraphicsThread()->add( new CullOperation(camera,sceneView), false);279 graphicsThread->add( new CullOperation(sceneView), false); 289 280 290 281 // optionally add glFinish barrier to ensure that all OpenGL commands are completed before we start dispatching a new frame 291 if (doFinishBeforeNewDraw) camera->getGraphicsContext()->getGraphicsThread()->add( glFinishBarrierOp.get(), false);282 if (doFinishBeforeNewDraw) graphicsThread->add( glFinishBarrierOp.get(), false); 292 283 293 284 // draw traversal operation. 294 camera->getGraphicsContext()->getGraphicsThread()->add( new DrawOperation(sceneView), false);285 graphicsThread->add( new DrawOperation(sceneView), false); 295 286 } 296 287
