Show
Ignore:
Timestamp:
10/28/05 15:11:56 (8 years ago)
Author:
robert
Message:

Moved SceneView? across to use an osg::CameraNode? to store the projection and view matrices,
the viewport, the clear colour and the subgraph needing rendered. This is done
transparently so all existing functionality will behave as before. What it does
add is the ability to set a SceneView? directly by a single osg::CameraNode? when required.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgcamera/osgcamera.cpp

    r4494 r4631  
    5959struct CullOperation : public osg::GraphicsThread::Operation 
    6060{ 
    61     CullOperation(osg::CameraNode* camera, osgUtil::SceneView* sceneView): 
     61    CullOperation(osgUtil::SceneView* sceneView): 
    6262        osg::GraphicsThread::Operation("Cull",true), 
    63         _camera(camera), 
    6463        _sceneView(sceneView) 
    6564    { 
     
    6968    { 
    7069        _sceneView->setState(context->getState()); 
    71         _sceneView->setProjectionMatrix(_camera->getProjectionMatrix()); 
    72         _sceneView->setViewMatrix(_camera->getViewMatrix()); 
    73         _sceneView->setViewport(_camera->getViewport()); 
    74          
    7570        _sceneView->cull(); 
    7671    } 
    7772     
    78     osg::CameraNode*                 _camera; 
    7973    osg::ref_ptr<osgUtil::SceneView> _sceneView; 
    8074}; 
     
    274268    { 
    275269        osg::CameraNode* camera = citr->get(); 
     270        osg::GraphicsThread* graphicsThread = camera->getGraphicsContext()->getGraphicsThread(); 
    276271         
    277272        // create a scene view to do the cull and draw 
     
    279274        sceneView->setDefaults(); 
    280275        sceneView->setFrameStamp(frameStamp.get()); 
    281              
    282         if (camera->getNumChildren()>=1) 
    283         { 
    284             sceneView->setSceneData(camera->getChild(0)); 
    285         } 
     276        sceneView->setCamera(camera);     
    286277 
    287278        // cull traversal operation 
    288         camera->getGraphicsContext()->getGraphicsThread()->add( new CullOperation(camera, sceneView), false);  
     279        graphicsThread->add( new CullOperation(sceneView), false);  
    289280 
    290281        // 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);  
    292283 
    293284        // draw traversal operation. 
    294         camera->getGraphicsContext()->getGraphicsThread()->add( new DrawOperation(sceneView), false);  
     285        graphicsThread->add( new DrawOperation(sceneView), false);  
    295286    } 
    296287