39DustPool::DustPool(Ogre::SceneManager* sm,
const char* dname,
int dsize,
const std::string& custom_name ):
41 size(std::min(dsize, static_cast<int>(MAX_DUSTS))),
44 std::string poolname = fmt::format(
"DustPools/{}", custom_name.empty() ? dname : custom_name);
45 parent_snode = sm->getRootSceneNode()->createChildSceneNode(poolname);
47 for (
int i = 0; i <
size; i++)
50 pss[i] = sm->createParticleSystem(fmt::format(
"{}_{}", poolname, i), 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)
197 for (
int i = 0; i <
size; i++)
207 ParticleEmitter* emit =
pss[i]->getEmitter(0);
209 Real vel = ndir.length();
216 emit->setEnabled(
true);
220 emit->setDirection(ndir);
221 emit->setParticleVelocity(vel);
231 emit->setTimeToLive(vel * 0.05 / 0.1);
246 col.a = sqrt(vel) * 0.1;
251 emit->setTimeToLive(vel * 0.025 / 0.1);
259 emit->setParticleVelocity(vel / 2.0);
261 col.a =
rates[i] * 0.03;
266 emit->setTimeToLive(
rates[i] * 0.03 / 0.1);
270 emit->setEmissionRate(
rates[i]);
275 ndir.y = -ndir.y / 2.0;
277 emit->setDirection(ndir);
279 col.a = sqrt(vel) * 0.04;
284 emit->setTimeToLive(vel * 0.025 / 0.1);
296 emit->setTimeToLive(vel * 0.04 / 0.1);
299 emit->setColour(col);
303 pss[i]->getEmitter(0)->setEnabled(
false);
Central state/object manager and communications hub.
#define ROR_ASSERT(_EXPR)
Game state manager and message-queue provider.
Ogre::SceneNode * sns[MAX_DUSTS]
void Discard(Ogre::SceneManager *sm)
void allocRipple(Ogre::Vector3 pos, Ogre::Vector3 vel)
Ogre::Vector3 positions[MAX_DUSTS]
Ogre::Vector3 velocities[MAX_DUSTS]
Velocity in wall time, ignoring the time scale.
void allocVapour(Ogre::Vector3 pos, Ogre::Vector3 vel, float time)
Ogre::ParticleSystem * pss[MAX_DUSTS]
Ogre::SceneNode * parent_snode
Ogre::ColourValue colours[MAX_DUSTS]
DustPool(Ogre::SceneManager *sm, const char *dname, int dsize, const std::string &custom_name="")
void AdjustDustPoolSpeedFactor(GfxActor *gfx_actor=nullptr)
void allocSmoke(Ogre::Vector3 pos, Ogre::Vector3 vel)
void allocSparks(Ogre::Vector3 pos, Ogre::Vector3 vel)
void allocClump(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col=Ogre::ColourValue(0.83, 0.71, 0.64, 1.0))
void allocSplash(Ogre::Vector3 pos, Ogre::Vector3 vel)
static const int MAX_DUSTS
void malloc(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col=Ogre::ColourValue(0.83, 0.71, 0.64, 1.0))
void allocDrip(Ogre::Vector3 pos, Ogre::Vector3 vel, float time)
const TerrainPtr & GetTerrain()
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys, GfxActor *gfx_actor=nullptr)
float GetStaticWaterHeight()
Returns static water level configured in 'terrn2'.
GameContext * GetGameContext()