| | 386 | // function used in debugging |
| | 387 | void insertParticle(osg::Group* root, const osg::Vec3& center, float radius) |
| | 388 | { |
| | 389 | bool handleMovingModels = false; |
| | 390 | |
| | 391 | osg::Vec3 position = center + |
| | 392 | osg::Vec3( radius * (((float)rand() / (float)RAND_MAX)-0.5)*2.0, |
| | 393 | radius * (((float)rand() / (float)RAND_MAX)-0.5)*2.0, |
| | 394 | 0.0f); |
| | 395 | |
| | 396 | float scale = 10.0f * ((float)rand() / (float)RAND_MAX); |
| | 397 | float intensity = 1.0f; |
| | 398 | |
| | 399 | osgParticle::ExplosionEffect* explosion = new osgParticle::ExplosionEffect(position, scale, intensity); |
| | 400 | osgParticle::ExplosionDebrisEffect* explosionDebri = new osgParticle::ExplosionDebrisEffect(position, scale, intensity); |
| | 401 | osgParticle::FireEffect* fire = new osgParticle::FireEffect(position, scale, intensity); |
| | 402 | osgParticle::ParticleEffect* smoke = 0; |
| | 403 | if (handleMovingModels) |
| | 404 | smoke = new osgParticle::SmokeTrailEffect(position, scale, intensity); |
| | 405 | else |
| | 406 | smoke = new osgParticle::SmokeEffect(position, scale, intensity); |
| | 407 | |
| | 408 | explosion->setWind(wind); |
| | 409 | explosionDebri->setWind(wind); |
| | 410 | smoke->setWind(wind); |
| | 411 | fire->setWind(wind); |
| | 412 | |
| | 413 | osg::Group* effectsGroup = new osg::Group; |
| | 414 | effectsGroup->addChild(explosion); |
| | 415 | effectsGroup->addChild(explosionDebri); |
| | 416 | effectsGroup->addChild(smoke); |
| | 417 | effectsGroup->addChild(fire); |
| | 418 | |
| | 419 | root->addChild(effectsGroup); |
| | 420 | } |
| | 421 | |