/** See Ogre::ParticleAffector. */ void _affectParticles(Ogre::ParticleSystem *psys, Ogre::Real timeElapsed) { Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle *p = pi.getNext(); const Ogre::Real life_time = p->totalTimeToLive; Ogre::Real particle_time = p->timeToLive; Ogre::Real width = mParent->getDefaultWidth(); Ogre::Real height = mParent->getDefaultHeight(); if(life_time-particle_time < mGrowTime) { Ogre::Real scale = (life_time-particle_time) / mGrowTime; width *= scale; height *= scale; } if(particle_time < mFadeTime) { Ogre::Real scale = particle_time / mFadeTime; width *= scale; height *= scale; } p->setDimensions(width, height); } }
/** See Ogre::ParticleAffector. */ void _affectParticles(Ogre::ParticleSystem *psys, Ogre::Real timeElapsed) { Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle *p = pi.getNext(); #if OGRE_VERSION >= (1 << 16 | 10 << 8 | 0) const Ogre::Real life_time = p->mTotalTimeToLive; Ogre::Real particle_time = p->mTimeToLive; #else const Ogre::Real life_time = p->totalTimeToLive; Ogre::Real particle_time = p->timeToLive; #endif Ogre::Real width = mParent->getDefaultWidth(); Ogre::Real height = mParent->getDefaultHeight(); if(life_time-particle_time < mGrowTime) { Ogre::Real scale = (life_time-particle_time) / mGrowTime; assert (scale >= 0); // HACK: don't allow zero-sized particles which can rarely cause an AABB assertion in Ogre to fail scale = std::max(scale, 0.00001f); width *= scale; height *= scale; } if(particle_time < mFadeTime) { Ogre::Real scale = particle_time / mFadeTime; assert (scale >= 0); // HACK: don't allow zero-sized particles which can rarely cause an AABB assertion in Ogre to fail scale = std::max(scale, 0.00001f); width *= scale; height *= scale; } p->setDimensions(width, height); } }