| | 29 | #include <osgGA/TerrainManipulator> |
|---|
| | 30 | #include <osgGA/StateSetManipulator> |
|---|
| | 31 | #include <osgGA/AnimationPathManipulator> |
|---|
| | 32 | #include <osgGA/TrackballManipulator> |
|---|
| | 33 | #include <osgGA/FlightManipulator> |
|---|
| | 34 | #include <osgGA/DriveManipulator> |
|---|
| | 35 | #include <osgGA/KeySwitchMatrixManipulator> |
|---|
| | 36 | #include <osgGA/StateSetManipulator> |
|---|
| | 37 | #include <osgGA/AnimationPathManipulator> |
|---|
| | 38 | #include <osgGA/TerrainManipulator> |
|---|
| | 39 | |
|---|
| | 281 | |
|---|
| | 282 | // add all the camera manipulators |
|---|
| | 283 | { |
|---|
| | 284 | osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; |
|---|
| | 285 | |
|---|
| | 286 | keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); |
|---|
| | 287 | keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); |
|---|
| | 288 | keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); |
|---|
| | 289 | |
|---|
| | 290 | unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); |
|---|
| | 291 | keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); |
|---|
| | 292 | |
|---|
| | 293 | std::string pathfile; |
|---|
| | 294 | char keyForAnimationPath = '5'; |
|---|
| | 295 | while (arguments.read("-p",pathfile)) |
|---|
| | 296 | { |
|---|
| | 297 | osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); |
|---|
| | 298 | if (apm || !apm->valid()) |
|---|
| | 299 | { |
|---|
| | 300 | num = keyswitchManipulator->getNumMatrixManipulators(); |
|---|
| | 301 | keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm ); |
|---|
| | 302 | ++keyForAnimationPath; |
|---|
| | 303 | } |
|---|
| | 304 | } |
|---|
| | 305 | |
|---|
| | 306 | keyswitchManipulator->selectMatrixManipulator(num); |
|---|
| | 307 | |
|---|
| | 308 | viewer.setCameraManipulator( keyswitchManipulator.get() ); |
|---|
| | 309 | } |
|---|
| | 310 | |
|---|