Hello,
I'm using Explosion- and SmokeEffect classes in my game. I just
want single shot explosions and smokes so i don't use any emitters
(or should i)?
Creating new effect instances is slow, so i'd like to create a
pool of effects on startup and use them:
for(unsigned int i=0;i<100;i++) {
ref_ptr<ExplosionEffect> ee = new ExplosionEffect(false);
freeEffects.push_back(ee);
}
The API docs are quite sparse so this is how i create the
effects. This is how i do it, is it correct?
ref_ptr<ExplosionEffect> ee = newExplosion();
ee->setDefaults();
ee->setPosition(e->pos);
ee->setScale(e->size);
ee->setIntensity(e->size*5);
ee->setParticleDuration(0.1);
ee->setEmitterDuration(0.01);
ee->setTextureFileName("textures/explosion.png");
explGroup->addChild(ee.get());
ee->buildEffect();
This works for first explosions, but when i try to
re-use the effects they do not appear any more.
What would be the correct method of doing this?
Btw i just released a new version of my game for
Linux and Windows platforms. Feel free to try it if you
want. It doesn't use effect pooling yet so explosions cause
a huge FPS hit.
<http://openbirds.sourceforge.net/>
--
-- Ville Ranki oh3gbq
[EMAIL PROTECTED] 040-757 2533
http://www.iki.fi/~cos/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/