Show
Ignore:
Timestamp:
05/27/07 19:29:29 (8 years ago)
Author:
robert
Message:

Added camera event callback support into osgViewer

Files:
1 modified

Legend:

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

    r6422 r6767  
    120120}; 
    121121 
     122class CameraUpdateCallback : public osg::NodeCallback 
     123{ 
     124    virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) 
     125    {  
     126        std::cout<<"Camera update callback - pre traverse"<<node<<std::endl; 
     127        traverse(node,nv); 
     128        std::cout<<"Camera update callback - post traverse"<<node<<std::endl; 
     129    } 
     130}; 
     131 
     132class CameraEventCallback : public osg::NodeCallback 
     133{ 
     134    virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) 
     135    {  
     136        std::cout<<"Camera event callback - pre traverse"<<node<<std::endl; 
     137        traverse(node,nv); 
     138        std::cout<<"Camera event callback - post traverse"<<node<<std::endl; 
     139    } 
     140}; 
     141 
    122142int main( int argc, char **argv ) 
    123143{ 
     
    148168    rootnode->accept(icv); 
    149169 
     170    viewer.getCamera()->setUpdateCallback(new CameraUpdateCallback()); 
     171    viewer.getCamera()->setEventCallback(new CameraEventCallback()); 
     172 
    150173    // set the scene to render 
    151174    viewer.setSceneData(rootnode);