Added support for animation path manipulator to osgViewer path
This commit is contained in:
parent
509ac7fb1a
commit
c2416e48c1
@ -138,7 +138,7 @@ int main_osgProducer(osg::ArgumentParser& arguments)
|
|||||||
#include <osgGA/DriveManipulator>
|
#include <osgGA/DriveManipulator>
|
||||||
#include <osgGA/KeySwitchMatrixManipulator>
|
#include <osgGA/KeySwitchMatrixManipulator>
|
||||||
#include <osgGA/StateSetManipulator>
|
#include <osgGA/StateSetManipulator>
|
||||||
|
#include <osgGA/AnimationPathManipulator>
|
||||||
|
|
||||||
int main_osgViewer(osg::ArgumentParser& arguments)
|
int main_osgViewer(osg::ArgumentParser& arguments)
|
||||||
{
|
{
|
||||||
@ -152,6 +152,19 @@ int main_osgViewer(osg::ArgumentParser& arguments)
|
|||||||
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() );
|
||||||
|
|
||||||
|
std::string pathfile;
|
||||||
|
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = 0;
|
||||||
|
while (arguments.read("-p",pathfile))
|
||||||
|
{
|
||||||
|
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
|
if (apm || !apm->valid())
|
||||||
|
{
|
||||||
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
|
keyswitchManipulator->addMatrixManipulator( '4', "Path", apm );
|
||||||
|
keyswitchManipulator->selectMatrixManipulator(num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user