コード例 #1
0
ファイル: particles.cpp プロジェクト: Adrian-Revk/openmw
    /** 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);
        }
    }
コード例 #2
0
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);
			}
		}
	}
}
コード例 #3
0
ファイル: particles.cpp プロジェクト: AAlderman/openmw
    /** 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);
        }
    }