Added recording of camera paths
This commit is contained in:
parent
78c831f850
commit
e741afb5be
@ -195,6 +195,9 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// add the stats handler
|
// add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
|
// add the record camera path handler
|
||||||
|
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
|
||||||
|
|
||||||
// add the help handler
|
// add the help handler
|
||||||
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
|
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
|
||||||
@ -281,16 +284,6 @@ int main(int argc, char **argv)
|
|||||||
arguments.getApplicationUsage()->write(std::cout);
|
arguments.getApplicationUsage()->write(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
|
||||||
|
|
||||||
// report any errors if they have occured when parsing the program aguments.
|
|
||||||
if (arguments.errors())
|
|
||||||
{
|
|
||||||
arguments.writeErrorMessages(std::cout);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(arguments);
|
||||||
@ -385,15 +378,27 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
||||||
|
|
||||||
if (tm.valid()) keyswitchManipulator->addMatrixManipulator( '0', "Trackball", tm.get() );
|
if (tm.valid()) keyswitchManipulator->addMatrixManipulator( '0', "NodeTracker", tm.get() );
|
||||||
|
|
||||||
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||||
|
|
||||||
|
std::string pathfile;
|
||||||
|
while (arguments.read("-p",pathfile))
|
||||||
|
{
|
||||||
|
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
|
if (apm || !apm->valid())
|
||||||
|
{
|
||||||
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
|
keyswitchManipulator->addMatrixManipulator( '5', "Path", apm );
|
||||||
|
keyswitchManipulator->selectMatrixManipulator(num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
// viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user