/** 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); } }
void applyWindForce(Ogre::ParticleSystem *psys, Ogre::Real timeElapsed) { const Ogre::Vector3 vec = mDirection * mForce * timeElapsed; Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle *p = pi.getNext(); p->direction += vec; } }
void applyPointForce(Ogre::ParticleSystem *psys, Ogre::Real timeElapsed) { const Ogre::Real force = mForce * timeElapsed; Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle *p = pi.getNext(); const Ogre::Vector3 vec = (p->position - mPosition).normalisedCopy() * force; p->direction += vec; } }
void applyWindForce(Ogre::ParticleSystem *psys, Ogre::Real timeElapsed) { const Ogre::Vector3 vec = mDirection * mForce * timeElapsed; Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle *p = pi.getNext(); #if OGRE_VERSION >= (1 << 16 | 10 << 8 | 0) p->mDirection += vec; #else p->direction += vec; #endif } }
void applyPointForce(Ogre::ParticleSystem *psys, Ogre::Real timeElapsed) { const Ogre::Real force = mForce * timeElapsed; Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle *p = pi.getNext(); #if OGRE_VERSION >= (1 << 16 | 10 << 8 | 0) Ogre::Vector3 position = p->mPosition; #else Ogre::Vector3 position = p->position; #endif Ogre::Vector3 vec = (mPosition - position).normalisedCopy() * force; #if OGRE_VERSION >= (1 << 16 | 10 << 8 | 0) p->mDirection += vec; #else p->direction += vec; #endif } }
void gkOgreParticleAffector::_affectParticles(Ogre::ParticleSystem* psys, Ogre::Real timeElapsed) { GK_ASSERT(m_creator); gkParticleSettingsProperties& props = m_creator->getParticleProperties(); if (props.m_gravity != 0) { Ogre::ParticleIterator pi = psys->_getIterator(); while (!pi.end()) { Ogre::Particle* p = pi.getNext(); //float size = Ogre::Math::RangeRandom(props.m_size - props.m_sizeRandom, props.m_size + props.m_sizeRandom); //p->setDimensions(size, size); gkParticleVisualData* data = static_cast<gkParticleVisualData*>(p->getVisualData()); if (data) { p->direction = data->m_initDir + props.m_gravity * (p->totalTimeToLive - p->timeToLive) * gkVector3(0,0,-9.8f); } } } }
/** 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); } }