35 const int DustPool::MAX_DUSTS;
38 DustPool::DustPool(Ogre::SceneManager* sm,
const char* dname,
int dsize):
40 size(std::min(dsize, static_cast<int>(MAX_DUSTS))),
45 for (
int i = 0; i <
size; i++)
48 sprintf(dename,
"Dust %s %i", dname, i);
50 pss[i] = sm->createParticleSystem(dename, dname);
53 sns[i]->attachObject(
pss[i]);
54 pss[i]->setCastShadows(
false);
56 if (
pss[i]->getNumEmitters() > 0)
58 pss[i]->getEmitter(0)->setEnabled(
false);
71 for (
int i = 0; i <
size; i++)
73 sns[i]->removeAndDestroyAllChildren();
74 sm->destroySceneNode(
sns[i]);
79 sm->destroyParticleSystem(
pss[i]);
89 for (
int i = 0; i <
size; i++)
91 pss[i]->setVisible(s);
136 if (vel.length() < 0.1)
198 ParticleEmitter* emit =
pss[i]->getEmitter(0);
200 Real vel = ndir.length();
207 emit->setEnabled(
true);
211 emit->setDirection(ndir);
212 emit->setParticleVelocity(vel);
222 emit->setTimeToLive(vel * 0.05 / 0.1);
237 col.a = sqrt(vel) * 0.1;
242 emit->setTimeToLive(vel * 0.025 / 0.1);
250 emit->setParticleVelocity(vel / 2.0);
252 col.a =
rates[i] * 0.03;
257 emit->setTimeToLive(
rates[i] * 0.03 / 0.1);
261 emit->setEmissionRate(
rates[i]);
266 ndir.y = -ndir.y / 2.0;
268 emit->setDirection(ndir);
270 col.a = sqrt(vel) * 0.04;
275 emit->setTimeToLive(vel * 0.025 / 0.1);
287 emit->setTimeToLive(vel * 0.04 / 0.1);
290 emit->setColour(col);
294 pss[i]->getEmitter(0)->setEnabled(
false);