Show
Ignore:
Timestamp:
06/01/07 13:21:57 (8 years ago)
Author:
robert
Message:

Added recording of camera paths

Files:
1 modified

Legend:

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

    r6787 r6796  
    196196    // add the stats handler 
    197197    viewer.addEventHandler(new osgViewer::StatsHandler); 
     198         
     199    // add the record camera path  handler 
     200    viewer.addEventHandler(new osgViewer::RecordCameraPathHandler); 
    198201 
    199202    // add the help handler 
     
    280283    { 
    281284        arguments.getApplicationUsage()->write(std::cout); 
    282         return 1; 
    283     } 
    284  
    285     // any option left unread are converted into errors to write out later. 
    286     arguments.reportRemainingOptionsAsUnrecognized(); 
    287  
    288     // report any errors if they have occured when parsing the program aguments. 
    289     if (arguments.errors()) 
    290     { 
    291         arguments.writeErrorMessages(std::cout); 
    292285        return 1; 
    293286    } 
     
    386379        osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; 
    387380 
    388         if (tm.valid()) keyswitchManipulator->addMatrixManipulator( '0', "Trackball", tm.get() ); 
     381        if (tm.valid()) keyswitchManipulator->addMatrixManipulator( '0', "NodeTracker", tm.get() ); 
     382 
    389383        keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); 
    390384        keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); 
     
    392386        keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); 
    393387 
     388        std::string pathfile; 
     389        while (arguments.read("-p",pathfile)) 
     390        { 
     391            osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); 
     392            if (apm || !apm->valid())  
     393            { 
     394                unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); 
     395                keyswitchManipulator->addMatrixManipulator( '5', "Path", apm ); 
     396                keyswitchManipulator->selectMatrixManipulator(num); 
     397            } 
     398        } 
     399 
    394400        viewer.setCameraManipulator( keyswitchManipulator.get() ); 
    395401    } 
    396      
    397402 
    398403    // viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);