| | 97 | // set up the camera manipulators. |
| | 98 | { |
| | 99 | osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; |
| | 100 | |
| | 101 | keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); |
| | 102 | keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); |
| | 103 | keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); |
| | 104 | keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); |
| | 105 | |
| | 106 | std::string pathfile; |
| | 107 | char keyForAnimationPath = '5'; |
| | 108 | while (arguments.read("-p",pathfile)) |
| | 109 | { |
| | 110 | osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); |
| | 111 | if (apm || !apm->valid()) |
| | 112 | { |
| | 113 | unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); |
| | 114 | keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm ); |
| | 115 | keyswitchManipulator->selectMatrixManipulator(num); |
| | 116 | ++keyForAnimationPath; |
| | 117 | } |
| | 118 | } |
| | 119 | |
| | 120 | viewer.setCameraManipulator( keyswitchManipulator.get() ); |
| | 121 | } |
| | 122 | |
| 149 | | group->addChild(precipitationEffect.get()); |
| 150 | | |
| | 188 | |
| | 189 | if (clipDistance!=0.0) |
| | 190 | { |
| | 191 | osg::ref_ptr<osg::ClipNode> clipNode = new osg::ClipNode; |
| | 192 | clipNode->addClipPlane( new osg::ClipPlane( 0 ) ); |
| | 193 | clipNode->getClipPlane(0)->setClipPlane( 0.0, 0.0, -1.0, -clipDistance ); |
| | 194 | clipNode->setReferenceFrame(osg::ClipNode::ABSOLUTE_RF); |
| | 195 | clipNode->addChild(precipitationEffect.get()); |
| | 196 | |
| | 197 | group->addChild(clipNode.get()); |
| | 198 | } |
| | 199 | else |
| | 200 | { |
| | 201 | group->addChild(precipitationEffect.get()); |
| | 202 | } |
| | 203 | |