- Timestamp:
- 04/24/06 08:36:26 (7 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgprecipitation/osgprecipitation.cpp
r5102 r5103 16 16 #include <osgProducer/Viewer> 17 17 18 #include <osg/MatrixTransform> 19 #include <osgUtil/TransformCallback> 18 20 #include <osgParticle/PrecipitationEffect> 21 22 class MyGustCallback : public osg::NodeCallback 23 { 24 25 public: 26 27 MyGustCallback() {} 28 29 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) 30 { 31 osgParticle::PrecipitationEffect* pe = dynamic_cast<osgParticle::PrecipitationEffect*>(node); 32 33 float value = sin(nv->getFrameStamp()->getReferenceTime()); 34 if (value<-0.5) pe->getParameters()->wind.set(5.0,0.0,0.0); 35 else pe->getParameters()->wind.set(1.0,0.0,0.0); 36 37 traverse(node, nv); 38 } 39 }; 19 40 20 41 #if 0 … … 120 141 while (arguments.read("--particleColour", parameters.particleColour.r(), parameters.particleColour.g(), parameters.particleColour.b(), parameters.particleColour.a())) {} 121 142 122 osg::Vec3 particleVelocity; 123 while (arguments.read("--particleVelocity", particleVelocity.x(), particleVelocity.y(), particleVelocity.z() )) parameters.particleVelocity = particleVelocity; 143 osg::Vec3 wind; 144 while (arguments.read("--wind", wind.x(), wind.y(), wind.z())) parameters.wind = wind; 145 146 while (arguments.read("--particleVelocity", parameters.particleVelocity)) {} 124 147 125 148 while (arguments.read("--nearTransition", parameters.nearTransition )) {} … … 181 204 } 182 205 183 #if 1 184 206 // precipitationEffect->setUpdateCallback(new MyGustCallback); 207 185 208 osg::ref_ptr<osg::Group> group = new osg::Group; 186 209 group->addChild(precipitationEffect.get()); … … 189 212 // set the scene to render 190 213 viewer.setSceneData(group.get()); 191 192 #else193 194 loadedModel = createModel(loadedModel.get(), parameters);195 196 // set the scene to render197 viewer.setSceneData(loadedModel.get());198 #endif199 214 200 215 // create the windows and run the threads.
