Changeset 353 for experimental/distortionNG/main.cpp
- Timestamp:
- Apr 21, 2012, 9:49:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/main.cpp
r352 r353 47 47 osg::Image* intMap = osgDB::readImageFile("intensitymap.png"); 48 48 if (!intMap) 49 { 50 osg::notify(osg::WARN) << "Couldn't find intensity map, quiting." << std::endl; 51 return -1; 52 } 49 osg::notify(osg::WARN) << "Couldn't find intensity map, skip intensityMap setup." << std::endl; 50 53 51 // Create DistortionSet 54 52 osg::ref_ptr<osgViewer::DistortionSet> _distortionSet = new osgViewer::DistortionSet(); … … 62 60 63 61 // set up the camera manipulators. 62 osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; 63 64 keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); 65 keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); 66 keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); 67 keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); 68 69 std::string pathfile; 70 char keyForAnimationPath = '5'; 71 while (arguments.read("-p",pathfile)) 64 72 { 65 osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; 66 67 keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); 68 keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); 69 keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); 70 keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); 71 72 std::string pathfile; 73 char keyForAnimationPath = '5'; 74 while (arguments.read("-p",pathfile)) 73 osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); 74 if (apm || !apm->valid()) 75 75 { 76 osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); 77 if (apm || !apm->valid()) 78 { 79 unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); 80 keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm ); 81 keyswitchManipulator->selectMatrixManipulator(num); 82 ++keyForAnimationPath; 83 } 76 unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); 77 keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm ); 78 keyswitchManipulator->selectMatrixManipulator(num); 79 ++keyForAnimationPath; 84 80 } 85 86 viewer.setCameraManipulator( keyswitchManipulator.get() );87 81 } 88 82 83 // Add keyswitch manipulator for multiple scene controls- 84 viewer.setCameraManipulator( keyswitchManipulator.get() ); 85 89 86 // Add the distortion manipulator 90 osgViewer::DistortionManipulator* distManip = new osgViewer::DistortionManipulator(); 91 distManip->setDistortionSet(_distortionSet); 92 viewer.addEventHandler(distManip); 87 viewer.addEventHandler(new osgViewer::DistortionManipulator(_distortionSet)); 93 88 94 89 // add the state manipulator
Note: See TracChangeset
for help on using the changeset viewer.