Particle Universe  1.2
ParticleUniverse::ParticleAffector Class Referenceabstract

#include <ParticleUniverseAffector.h>

Inheritance diagram for ParticleUniverse::ParticleAffector:

Public Types

enum  AffectSpecialisation { AFSP_DEFAULT, AFSP_TTL_INCREASE, AFSP_TTL_DECREASE }
 
- Public Types inherited from ParticleUniverse::Particle
enum  ParticleType {
  PT_VISUAL, PT_TECHNIQUE, PT_EMITTER, PT_AFFECTOR,
  PT_SYSTEM
}
 
enum  ReservedParticleEventFlags { PEF_EXPIRED = 1<<0, PEF_EMITTED = 1<<1, PEF_COLLIDED = 1<<2 }
 
typedef vector< ParticleBehaviour * > ParticleBehaviourList
 
typedef ParticleBehaviourList::const_iterator ParticleBehaviourIterator
 
- Public Types inherited from ParticleUniverse::IAlias
enum  AliasType {
  AT_UNDEFINED, AT_TECHNIQUE, AT_RENDERER, AT_EMITTER,
  AT_AFFECTOR, AT_OBSERVER, AT_EXTERN, AT_HANDLER,
  AT_BEHAVIOUR
}
 

Public Member Functions

 ParticleAffector (void)
 
virtual ~ParticleAffector (void)
 
const AffectSpecialisationgetAffectSpecialisation (void) const
 
void setAffectSpecialisation (const AffectSpecialisation &affectSpecialisation)
 
const StringgetAffectorType (void) const
 
void setAffectorType (const String &affectorType)
 
const StringgetName (void) const
 
void setName (const String &name)
 
ParticleTechniquegetParentTechnique (void) const
 
void setParentTechnique (ParticleTechnique *parentTechnique)
 
virtual void _prepare (ParticleTechnique *particleTechnique)
 
virtual void _unprepare (ParticleTechnique *particleTechnique)
 
virtual void _notifyStart (void)
 
virtual void _notifyStop (void)
 
virtual void _notifyPause (void)
 
virtual void _notifyResume (void)
 
virtual void _notifyRescaled (const Vector3 &scale)
 
virtual void _preProcessParticles (ParticleTechnique *particleTechnique, Real timeElapsed)
 
virtual void _firstParticle (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed)
 
virtual void _initForEmission (void)
 
virtual void _initForExpiration (ParticleTechnique *technique, Real timeElapsed)
 
virtual void _initParticleForEmission (Particle *particle)
 
void _processParticle (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed, bool firstParticle)
 
virtual void _postProcessParticles (ParticleTechnique *technique, Real timeElapsed)
 
virtual void _affect (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed)=0
 
void addEmitterToExclude (const String &emitterName)
 
void removeEmitterToExclude (const String &emitterName)
 
void removeAllEmittersToExclude (void)
 
const list< String > & getEmittersToExclude (void) const
 
bool hasEmitterToExclude (const String &emitterName)
 
virtual void copyAttributesTo (ParticleAffector *affector)
 
virtual void copyParentAttributesTo (ParticleAffector *affector)
 
const Vector3getDerivedPosition (void)
 
Real _calculateAffectSpecialisationFactor (const Particle *particle)
 
- Public Member Functions inherited from ParticleUniverse::Particle
 Particle (void)
 
virtual ~Particle (void)
 
bool _isMarkedForEmission (void) const
 
void _setMarkedForEmission (bool markedForEmission)
 
virtual bool isEnabled (void) const
 
virtual void setEnabled (bool enabled)
 
void _setOriginalEnabled (bool originalEnabled)
 
bool _getOriginalEnabled (void) const
 
bool isFreezed (void) const
 
void setFreezed (bool freezed)
 
void setEventFlags (uint32 flags)
 
void addEventFlags (uint32 flags)
 
void removeEventFlags (uint32 flags)
 
uint32 getEventFlags (void) const
 
bool hasEventFlags (uint32 flags) const
 
void copyBehaviours (ParticleBehaviourList &behaviours)
 
virtual void _process (ParticleTechnique *technique, Real timeElapsed)
 
ParticleBehaviourgetBehaviour (const String &behaviourType)
 
Real calculateVelocity (void) const
 
virtual void copyAttributesTo (Particle *particle)
 
- Public Member Functions inherited from ParticleUniverse::IAlias
 IAlias (void)
 
virtual ~IAlias (void)
 
const StringgetAliasName (void) const
 
void setAliasName (String aliasName)
 
const AliasType getAliasType (void) const
 
void setAliasType (AliasType aliasType)
 
- Public Member Functions inherited from ParticleUniverse::IElement
 IElement (void)
 
virtual ~IElement (void)
 

Static Public Attributes

static const bool DEFAULT_ENABLED
 
static const Vector3 DEFAULT_POSITION
 
static const AffectSpecialisation DEFAULT_SPECIALISATION
 
- Static Public Attributes inherited from ParticleUniverse::Particle
static Real DEFAULT_TTL
 
static Real DEFAULT_MASS
 

Protected Attributes

ParticleTechniquemParentTechnique
 
String mAffectorType
 
String mName
 
AffectSpecialisation mAffectSpecialisation
 
list< StringmExcludedEmitters
 
Vector3 _mAffectorScale
 
- Protected Attributes inherited from ParticleUniverse::Particle
uint32 mEventFlags
 
bool mMarkedForEmission
 
bool mEnabled
 
bool mFreezed
 
bool mOriginalEnabled
 
bool mOriginalEnabledSet
 
Vector3 mDerivedPosition
 
ParticleBehaviourList mBehaviours
 
- Protected Attributes inherited from ParticleUniverse::IAlias
String mAliasName
 
AliasType mAliasType
 

Additional Inherited Members

- Public Attributes inherited from ParticleUniverse::Particle
ParticleEmitterparentEmitter
 
Vector3 position
 
Vector3 direction
 
Real mass
 
Real timeToLive
 
Real totalTimeToLive
 
Real timeFraction
 
ParticleType particleType
 
Any mUserDefinedObject
 
PhysicsActorphysicsActor
 
IVisualDatavisualData
 
Vector3 originalPosition
 
Vector3 originalDirection
 
Real originalVelocity
 
Real originalDirectionLength
 
Real originalScaledDirectionLength
 
Vector3 latestPosition
 

Detailed Description

Abstract class defining the interface to be implemented by particle affectors.

Remarks
Particle affectors modify particles in a particle system over their lifetime. This class defines the interface, and provides a few implementations of some basic functions.

Member Enumeration Documentation

The AffectSpecialisation enumeration is used to specialise the affector even more. This enumeration isn't used by all affectors; in some cases it isn't even applicable.

Enumerator
AFSP_DEFAULT 
AFSP_TTL_INCREASE 
AFSP_TTL_DECREASE 

Constructor & Destructor Documentation

ParticleUniverse::ParticleAffector::ParticleAffector ( void  )
virtual ParticleUniverse::ParticleAffector::~ParticleAffector ( void  )
inlinevirtual

Member Function Documentation

Real ParticleUniverse::ParticleAffector::_calculateAffectSpecialisationFactor ( const Particle particle)

If the mAffectSpecialisation is used to specialise the affector, a factor can be calculated and used in a child class. This factor depends on the value of mAffectSpecialisation.

Remarks
This helper method assumes that the particle pointer is valid.
virtual void ParticleUniverse::ParticleAffector::_firstParticle ( ParticleTechnique particleTechnique,
Particle particle,
Real  timeElapsed 
)
inlinevirtual

Perform precalculations if the first Particle in the update-loop is processed.

Reimplemented in ParticleUniverse::LineAffector, ParticleUniverse::AlignAffector, and ParticleUniverse::ParticleFollower.

virtual void ParticleUniverse::ParticleAffector::_initForEmission ( void  )
virtual

Initialise the ParticleAffector before it is emitted itself.

Reimplemented from ParticleUniverse::Particle.

virtual void ParticleUniverse::ParticleAffector::_initForExpiration ( ParticleTechnique technique,
Real  timeElapsed 
)
virtual

Initialise the ParticleAffector before it is expired itself.

Reimplemented from ParticleUniverse::Particle.

virtual void ParticleUniverse::ParticleAffector::_initParticleForEmission ( Particle particle)
inlinevirtual

Initialise a newly emitted particle.

Parameters
particlePointer to a Particle to initialise.

Reimplemented in ParticleUniverse::TextureAnimator, ParticleUniverse::GeometryRotator, and ParticleUniverse::TextureRotator.

virtual void ParticleUniverse::ParticleAffector::_notifyPause ( void  )
inlinevirtual

Perform activities when a ParticleAffector is paused.

virtual void ParticleUniverse::ParticleAffector::_notifyRescaled ( const Vector3 scale)
virtual

Notify that the Affector is rescaled.

Reimplemented in ParticleUniverse::LineAffector, and ParticleUniverse::PlaneCollider.

virtual void ParticleUniverse::ParticleAffector::_notifyResume ( void  )
inlinevirtual

Perform activities when a ParticleAffector is resumed.

virtual void ParticleUniverse::ParticleAffector::_notifyStart ( void  )
virtual

Perform activities when a ParticleAffector is started.

Reimplemented in ParticleUniverse::ForceFieldAffector.

virtual void ParticleUniverse::ParticleAffector::_notifyStop ( void  )
inlinevirtual

Perform activities when a ParticleAffector is stopped.

virtual void ParticleUniverse::ParticleAffector::_postProcessParticles ( ParticleTechnique technique,
Real  timeElapsed 
)
inlinevirtual

Perform activities after the individual particles are processed.

Remarks
This function is called after the ParticleTechnique update-loop where all particles are traversed.

Reimplemented in ParticleUniverse::LineAffector, and ParticleUniverse::Randomiser.

virtual void ParticleUniverse::ParticleAffector::_prepare ( ParticleTechnique particleTechnique)
inlinevirtual

Perform initialisation actions.

Remarks
The _prepare() function is automatically called during initialisation (prepare) activities of a ParticleTechnique. A subclass could implement this function to perform initialisation actions.

Reimplemented in ParticleUniverse::InterParticleCollider, ParticleUniverse::ForceFieldAffector, ParticleUniverse::CollisionAvoidanceAffector, and ParticleUniverse::VelocityMatchingAffector.

virtual void ParticleUniverse::ParticleAffector::_preProcessParticles ( ParticleTechnique particleTechnique,
Real  timeElapsed 
)
inlinevirtual
void ParticleUniverse::ParticleAffector::_processParticle ( ParticleTechnique particleTechnique,
Particle particle,
Real  timeElapsed,
bool  firstParticle 
)

Entry point for affecting a Particle.

Remarks
Before the actual _affect() function is called, validations have to take place whether affecting the Particle is really needed. Particles which are emitted by a ParticleEmitter that has been excluded, will not be affected. This _affect() function is internally called.
Parameters
particlePointer to a ParticleTechnique to which the particle belongs.
particlePointer to a Particle.
timeElapsedThe number of seconds which have elapsed since the last call.
firstParticleDetermines whether the ParticleAffector encounters the first particle of all active particles.
virtual void ParticleUniverse::ParticleAffector::_unprepare ( ParticleTechnique particleTechnique)
inlinevirtual
void ParticleUniverse::ParticleAffector::addEmitterToExclude ( const String emitterName)

Add a ParticleEmitter name that excludes Particles emitted by this ParticleEmitter from being affected.

virtual void ParticleUniverse::ParticleAffector::copyParentAttributesTo ( ParticleAffector affector)
virtual

Copy parent attributes to another affector.

const String& ParticleUniverse::ParticleAffector::getAffectorType ( void  ) const
inline

Todo

const AffectSpecialisation& ParticleUniverse::ParticleAffector::getAffectSpecialisation ( void  ) const
inline

Todo

const Vector3& ParticleUniverse::ParticleAffector::getDerivedPosition ( void  )

Calculate the derived position of the affector.

Remarks
Note, that in script, the position is set as localspace, while if the affector is emitted, its position is automatically transformed. This function always returns the derived position.
const list<String>& ParticleUniverse::ParticleAffector::getEmittersToExclude ( void  ) const

Return the list with emitters to exclude.

const String& ParticleUniverse::ParticleAffector::getName ( void  ) const
inline

Todo

ParticleTechnique* ParticleUniverse::ParticleAffector::getParentTechnique ( void  ) const
inline

Todo

bool ParticleUniverse::ParticleAffector::hasEmitterToExclude ( const String emitterName)

Returns true if the list with excluded emitters contains a given name.

void ParticleUniverse::ParticleAffector::removeAllEmittersToExclude ( void  )

Remove all ParticleEmitter names that excludes Particles emitted by this ParticleEmitter.

void ParticleUniverse::ParticleAffector::removeEmitterToExclude ( const String emitterName)

Remove a ParticleEmitter name that excludes Particles emitted by this ParticleEmitter.

void ParticleUniverse::ParticleAffector::setAffectorType ( const String affectorType)
inline
void ParticleUniverse::ParticleAffector::setAffectSpecialisation ( const AffectSpecialisation affectSpecialisation)
inline
void ParticleUniverse::ParticleAffector::setName ( const String name)
inline
void ParticleUniverse::ParticleAffector::setParentTechnique ( ParticleTechnique parentTechnique)

Member Data Documentation

Vector3 ParticleUniverse::ParticleAffector::_mAffectorScale
protected

Although the scale is on a Particle System level, the affector can also be scaled.

const bool ParticleUniverse::ParticleAffector::DEFAULT_ENABLED
static
const Vector3 ParticleUniverse::ParticleAffector::DEFAULT_POSITION
static
const AffectSpecialisation ParticleUniverse::ParticleAffector::DEFAULT_SPECIALISATION
static
String ParticleUniverse::ParticleAffector::mAffectorType
protected
AffectSpecialisation ParticleUniverse::ParticleAffector::mAffectSpecialisation
protected

The mAffectSpecialisation is used to specialise the affector. This attribute is comparable with the mAutoDirection of the ParticleEmitter, it is an optional attribute and used in some of the Particle Affectors.

list<String> ParticleUniverse::ParticleAffector::mExcludedEmitters
protected

List of ParticleEmitter names that excludes particles emitted by ParticleEmitters with that name.

Remarks
Particles emitted by an ParticleEmitter with a name that is included in this list are not affected by this ParticleAffector.
String ParticleUniverse::ParticleAffector::mName
protected
ParticleTechnique* ParticleUniverse::ParticleAffector::mParentTechnique
protected

The documentation for this class was generated from the following file: