Particle Universe  1.2
ParticleUniverse::Particle Class Reference

#include <ParticleUniverseParticle.h>

Inheritance diagram for ParticleUniverse::Particle:

Public Types

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 Member Functions

 Particle (void)
 
virtual ~Particle (void)
 
bool _isMarkedForEmission (void) const
 
void _setMarkedForEmission (bool markedForEmission)
 
virtual void _initForEmission (void)
 
virtual void _initForExpiration (ParticleTechnique *technique, Real timeElapsed)
 
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 Attributes

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
 

Static Public Attributes

static Real DEFAULT_TTL
 
static Real DEFAULT_MASS
 

Protected Attributes

uint32 mEventFlags
 
bool mMarkedForEmission
 
bool mEnabled
 
bool mFreezed
 
bool mOriginalEnabled
 
bool mOriginalEnabledSet
 
Vector3 mDerivedPosition
 
ParticleBehaviourList mBehaviours
 

Detailed Description

Particle is the abstract/virtual class that represents the object to be emitted.

Remarks
Several types of particles are distinguished, where the visual particle is the most obvious one. Other types of particles are also possible. ParticleAffectors, ParticleEmitters, ParticleTechniques and even ParticleSystems can act as a particle.

Member Typedef Documentation

typedef ParticleBehaviourList::const_iterator ParticleUniverse::Particle::ParticleBehaviourIterator

Member Enumeration Documentation

Enumerator
PT_VISUAL 
PT_TECHNIQUE 
PT_EMITTER 
PT_AFFECTOR 
PT_SYSTEM 

Enumeration which lists a number of reserved event flags. Although custom flags can be used to indicate that a certain condition occurs, the first number of flags may not be used as custom flags.

Enumerator
PEF_EXPIRED 
PEF_EMITTED 
PEF_COLLIDED 

Constructor & Destructor Documentation

ParticleUniverse::Particle::Particle ( void  )
inline
virtual ParticleUniverse::Particle::~Particle ( void  )
virtual

Member Function Documentation

bool ParticleUniverse::Particle::_getOriginalEnabled ( void  ) const

Returns the original 'enabled' value of the particle

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

Perform some action if the particle expires.

Remarks
Note, that this function applies to all particle types (including Particle Techniques, Emitters and Affectors).

Reimplemented in ParticleUniverse::ParticleTechnique, ParticleUniverse::ParticleSystem, ParticleUniverse::ParticleEmitter, ParticleUniverse::ParticleAffector, and ParticleUniverse::VisualParticle.

bool ParticleUniverse::Particle::_isMarkedForEmission ( void  ) const
inline

Todo

virtual void ParticleUniverse::Particle::_process ( ParticleTechnique technique,
Real  timeElapsed 
)
virtual

Perform actions on the particle itself during the update loop of a ParticleTechnique.

Remarks
Active particles may want to do some processing themselves each time the ParticleTechnique is updated. One example is to perform actions by means of the registered ParticleBehaviour objects. ParticleBehaviour objects apply internal behaviour of each particle individually. They add both data and behaviour to a particle, which means that each particle can be extended with functionality.

Reimplemented in ParticleUniverse::ParticleSystem.

void ParticleUniverse::Particle::_setMarkedForEmission ( bool  markedForEmission)
inline
void ParticleUniverse::Particle::_setOriginalEnabled ( bool  originalEnabled)

This function sets the original 'enabled' value of the particle.

Remarks
Only use this function if you really know what you're doing. Otherwise it shouldn't be used for regular usage.
void ParticleUniverse::Particle::addEventFlags ( uint32  flags)
inline

As setEventFlags, except the flags passed as parameters are appended to the existing flags on this object.

Real ParticleUniverse::Particle::calculateVelocity ( void  ) const

Calculates the velocity, based on the direction vector.

virtual void ParticleUniverse::Particle::copyAttributesTo ( Particle particle)
virtual

Copy the data of this particle to another particle.

void ParticleUniverse::Particle::copyBehaviours ( ParticleBehaviourList behaviours)

Copy a vector of ParticleBehaviour objects to this particle.

ParticleBehaviour* ParticleUniverse::Particle::getBehaviour ( const String behaviourType)

Returns the first occurence of the ParticleBehaviour specified by its type.

uint32 ParticleUniverse::Particle::getEventFlags ( void  ) const
inline

Return the event flags.

bool ParticleUniverse::Particle::hasEventFlags ( uint32  flags) const
inline

Determines whether it has certain flags set.

virtual bool ParticleUniverse::Particle::isEnabled ( void  ) const
virtual

Todo

bool ParticleUniverse::Particle::isFreezed ( void  ) const

Returns true if the particle is freezed and doesn't move anymore.

Remarks
Although it is freezed, repositioning the particle is still possible.
void ParticleUniverse::Particle::removeEventFlags ( uint32  flags)
inline

The flags passed as parameters are removed from the existing flags.

virtual void ParticleUniverse::Particle::setEnabled ( bool  enabled)
virtual
void ParticleUniverse::Particle::setEventFlags ( uint32  flags)
inline

Sets the event flags.

void ParticleUniverse::Particle::setFreezed ( bool  freezed)

Freeze the particle, so it doesn't move anymore.

Member Data Documentation

Real ParticleUniverse::Particle::DEFAULT_MASS
static
Real ParticleUniverse::Particle::DEFAULT_TTL
static
Vector3 ParticleUniverse::Particle::direction
Vector3 ParticleUniverse::Particle::latestPosition
Real ParticleUniverse::Particle::mass
ParticleBehaviourList ParticleUniverse::Particle::mBehaviours
protected

List containing ParticleBehaviours.

Vector3 ParticleUniverse::Particle::mDerivedPosition
protected

Because the public attribute ´position´ is sometimes used for both localspace and worldspace position, the mDerivedPosition attribute is introduced.

bool ParticleUniverse::Particle::mEnabled
protected

Determines whether a particle is activated.

Remarks
This attribute is particularly used for child classes that must have a capability to be enabled or disabled (emitters, affectors, ...). There is no need for disabling a visual particle, because expiring a particle seems sufficient. The default value of this attribute is true.
uint32 ParticleUniverse::Particle::mEventFlags
protected
bool ParticleUniverse::Particle::mFreezed
protected

Determines whether a particle is 'freezed'. This means that the particle doesn´t move anymore.

bool ParticleUniverse::Particle::mMarkedForEmission
protected

Determines whether the particle is marked for emission.

Remarks
This means that the particle is emitted. This is obvious for visual particles, but a ParticleEmitter for instance is also a Particle; this means that is can be emitted also.
bool ParticleUniverse::Particle::mOriginalEnabled
protected

Original setting.

bool ParticleUniverse::Particle::mOriginalEnabledSet
protected

Original may be set only once.

Any ParticleUniverse::Particle::mUserDefinedObject

Keep the posibility to attach some custom data. This is additional to the Behaviour data. The advantage of a UserDefinedObject in favour of a ParticleBehaviour is, that no search is needed.

Remarks
The UserDefinedObject is not managed by the Particle itself, so assigned UserDefinedObjects must be deleted outside the Particle.
Vector3 ParticleUniverse::Particle::originalDirection
Real ParticleUniverse::Particle::originalDirectionLength
Vector3 ParticleUniverse::Particle::originalPosition
Real ParticleUniverse::Particle::originalScaledDirectionLength
Real ParticleUniverse::Particle::originalVelocity
ParticleEmitter* ParticleUniverse::Particle::parentEmitter
ParticleType ParticleUniverse::Particle::particleType
PhysicsActor* ParticleUniverse::Particle::physicsActor

If a physics engine is used, this attribute is set as soon as a particle is emitted.

Vector3 ParticleUniverse::Particle::position
Real ParticleUniverse::Particle::timeFraction
Real ParticleUniverse::Particle::timeToLive
Real ParticleUniverse::Particle::totalTimeToLive
IVisualData* ParticleUniverse::Particle::visualData

For some renderers it is needed to relate a particle to some visual data

Remarks
The visual data is set into the Particle instead of the VisualParticle, to enable other particle types do use visual data (if needed). The IVisualData is not managed by the Particle itself, so assigned IVisualData must be deleted outside the Particle.

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