//-----------------------------------------------------------------------
	void VortexExtern::_interface(ParticleTechnique* technique, 
		Particle* particle, 
		Real timeElapsed)
	{
		// Setting the distance threshold is mandatory
		if (isAttached() && mDistanceThresholdSet)
		{
			Real distance = mDerivedPosition.distance(particle->position);
			if (distance > mDistanceThreshold)
			{
				return;
			}
			else
			{
				// Rotate position, direction and orientation (visible particle only) based on distance between particle
				// and VortexExtern
				Real scalar = 1 - (distance / mDistanceThreshold);
				if (mParentNode)
				{
					mRotation.FromAngleAxis((_calculateRotationSpeed() * timeElapsed * scalar), mParentNode->_getDerivedOrientation() * mRotationVector);
				}
				else
				{
					mRotation.FromAngleAxis((_calculateRotationSpeed() * timeElapsed * scalar), mRotationVector);
				}
				_affect(technique, particle, timeElapsed);
			}
		}
	}
//-----------------------------------------------------------------------
void SphereColliderExtern::_interface(ParticleTechnique* technique,
                                      Particle* particle,
                                      Real timeElapsed)
{
    if (isAttached())
    {
        if (mDistanceThresholdSet && mDerivedPosition.distance(particle->position) > mDistanceThreshold)
            return;

        // Use the derived SphereCollider functionality here
        _affect(technique, particle, timeElapsed);
    }
}
Пример #3
0
	//-----------------------------------------------------------------------
	void ParticleAffector::_processParticle(ParticleTechnique* particleTechnique, Particle* particle, Ogre::Real timeElapsed, bool firstParticle)
	{
		// Call the _firstParticle() function if the first particle in the update loop is encountered.
		if (firstParticle)
		{
			// Perform a precalculation at the first particle
			_firstParticle(particleTechnique, particle, timeElapsed);
		}

		if (!mExcludedEmitters.empty() && particle->parentEmitter)
		{
			// Return if the emitter which emits this particle is part of the list
			Ogre::String emitterName = particle->parentEmitter->getName();
			Ogre::list<Ogre::String>::type::iterator it;
			it = std::find(mExcludedEmitters.begin(), mExcludedEmitters.end(), emitterName);
			if (it != mExcludedEmitters.end())
			{
				return;
			}
		}

		_affect(particleTechnique, particle, timeElapsed);
	}