//-----------------------------------------------------------------------
	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 VortexAffector::_preProcessParticles(ParticleTechnique* particleTechnique, Real timeElapsed)
	{
		ParticleSystem* sys = mParentTechnique->getParentSystem();
		if (sys)
		{
			mRotation.FromAngleAxis(Radian(_calculateRotationSpeed() * timeElapsed), sys->getDerivedOrientation() * mRotationVector);
		}
		else
		{
			mRotation.FromAngleAxis(Radian(_calculateRotationSpeed() * timeElapsed), mRotationVector);
		}
		getDerivedPosition();
	}
	//-----------------------------------------------------------------------
	void TextureRotator::_affect(ParticleTechnique* particleTechnique, Particle* particle, Ogre::Real timeElapsed)
	{
		// Only continue if the particle is a visual particle
		if (particle->particleType != Particle::PT_VISUAL)
			return;

		VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
		if (mUseOwnRotationSpeed)
		{
			// Use scaled rotationspeed and adjust the speed according to the velocity
			mScaledRotationSpeed = visualParticle->zRotationSpeed * timeElapsed;
		}
		else
		{
			// Scale speed
			mScaledRotationSpeed = _calculateRotationSpeed(particle) * timeElapsed;
		}

		visualParticle->zRotation += mScaledRotationSpeed;
		visualParticle->zRotation = visualParticle->zRotation > twoPiRad ? visualParticle->zRotation - twoPiRad : visualParticle->zRotation;
		if (particleTechnique->getRenderer())
		{
			particleTechnique->getRenderer()->_notifyParticleZRotated();
		}
	}
	//-----------------------------------------------------------------------
	void TextureRotator::_initParticleForEmission(Particle* particle)
	{
		// Only continue if the particle is a visual particle
		if (particle->particleType != Particle::PT_VISUAL)
			return;

		// Set initial random zRotation
		VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
		visualParticle->zRotation = _calculateRotation();
		if (particle->parentEmitter->getParentTechnique()->getRenderer())
		{
			// Assume that all parents exist. That must be the case otherwise particles are not emitted.
			particle->parentEmitter->getParentTechnique()->getRenderer()->_notifyParticleZRotated();
		}

		// Set the zRotationSpeed
		visualParticle->zRotationSpeed = _calculateRotationSpeed(particle);
	}