Hi,

I have problems with understanding the use of a NodeCallback.

Can anyone explain me what a Nodecallback is doing?

Another concrete question:
I have some code with a class that derives from osg::Nodecallback. This class 
implements operator():

Code:

class CameraUpdateCallback : public osg::NodeCallback {
private:
    osg::ref_ptr<osg::Camera>           mOtherCam;

    public:    
        CameraUpdateCallback(osg::Camera* otherCam) : mOtherCam(otherCam) {   }

    osg::ref_ptr<osg::Camera>           m_sourceCamera;
    void operator()(osg::Node* node, osg::NodeVisitor* nv) {
            osg::Camera* cam = static_cast<osg::Camera*>( node );
            
            cam->setViewMatrix(mOtherCam->getViewMatrix() );
            cam->setProjectionMatrix(mOtherCam->getProjectionMatrix() );
            
            traverse(node , nv);
     }      

...
camera->setUpdateCallback( new CameraUpdateCallback( currentView->getCamera() ) 
);



Does anyone understand this code? It adds a CameraUpdateCallback to the camera. 
When is this operator() called? Is this called only for the camera or for every 
node in the graph?

Thanks for any help!

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=41762#41762





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to