Particle Universe  1.2
ParticleUniverse::ParticleObserver Class Referenceabstract

#include <ParticleUniverseObserver.h>

Inheritance diagram for ParticleUniverse::ParticleObserver:

Public Types

typedef vector< ParticleEventHandler * >::iterator ParticleEventHandlerIterator
 
typedef vector< ParticleEventHandler * >::const_iterator ParticleEventHandlerConstIterator
 
typedef vector< ParticleEventHandler * > ParticleEventHandlerList
 
- 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

 ParticleObserver (void)
 
virtual ~ParticleObserver (void)
 
const StringgetObserverType (void) const
 
void setObserverType (const String &observerType)
 
virtual bool isEnabled (void) const
 
bool _getOriginalEnabled (void) const
 
virtual void setEnabled (bool enabled)
 
void _resetEnabled (void)
 
ParticleTechniquegetParentTechnique (void) const
 
void setParentTechnique (ParticleTechnique *parentTechnique)
 
const StringgetName (void) const
 
void setName (const String &name)
 
const Particle::ParticleTypegetParticleTypeToObserve (void) const
 
void setParticleTypeToObserve (const Particle::ParticleType particleTypeToObserve)
 
virtual void _notifyStart (void)
 
virtual void _notifyStop (void)
 
virtual void _notifyRescaled (const Vector3 &scale)
 
virtual void _preProcessParticles (ParticleTechnique *technique, Real timeElapsed)
 
virtual void _processParticle (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed, bool firstParticle)
 
virtual void _firstParticle (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed)
 
virtual void _postProcessParticles (ParticleTechnique *technique, Real timeElapsed)
 
virtual bool _observe (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed)=0
 
ParticleEventHandlercreateEventHandler (const String &eventHandlerType)
 
void addEventHandler (ParticleEventHandler *eventHandler)
 
void removeEventHandler (ParticleEventHandler *eventHandler)
 
ParticleEventHandlergetEventHandler (size_t index) const
 
ParticleEventHandlergetEventHandler (const String &eventHandlerName) const
 
size_t getNumEventHandlers (void) const
 
void destroyEventHandler (ParticleEventHandler *eventHandler)
 
void destroyEventHandler (size_t index)
 
void destroyAllEventHandlers (void)
 
virtual void copyAttributesTo (ParticleObserver *observer)
 
virtual void copyParentAttributesTo (ParticleObserver *observer)
 
Real getObserverInterval (void) const
 
void setObserverInterval (Real observerInterval)
 
bool getObserveUntilEvent (void) const
 
void setObserveUntilEvent (bool observeUntilEvent)
 
bool isParticleTypeToObserveSet (void) const
 
- 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 Particle::ParticleType DEFAULT_PARTICLE_TYPE
 
static const Real DEFAULT_INTERVAL
 
static const bool DEFAULT_UNTIL_EVENT
 

Protected Member Functions

virtual void _handleObserve (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed)
 
virtual void _handleEvent (ParticleTechnique *particleTechnique, Particle *particle, Real timeElapsed)
 

Protected Attributes

ParticleTechniquemParentTechnique
 
String mObserverType
 
String mName
 
bool mEnabled
 
bool mOriginalEnabled
 
bool mOriginalEnabledSet
 
bool mObserve
 
bool mObserveUntilEvent
 
bool mEventHandlersExecuted
 
Vector3 _mObserverScale
 
Particle::ParticleType mParticleTypeToObserve
 
bool mParticleTypeToObserveSet
 
ParticleEventHandlerList mEventHandlers
 
Real mObserverInterval
 
Real mObserverIntervalRemainder
 
bool mObserverIntervalSet
 
- Protected Attributes inherited from ParticleUniverse::IAlias
String mAliasName
 
AliasType mAliasType
 

Detailed Description

ParticleObservers are used to observe whether a certain condition occurs. This condition is often related to the state of a Particle, but also certain situations regarding a ParticleTechnique, ParticleEmitter or even the ParticleSystem can be validated.

Remarks
ParticleEventHandlers can be added to a ParticleObserve to handle the condition that is registered by the ParticleObserver. This mechanism provides a extendable framework for determination of events and processing these events.
ParticleObservers are defined on the same level as a ParticleEmitter and not as part of a ParticleEmitter. This is because the ParticleObserver observes ALL particles in the ParticleTechniques´ Particle pool.
A ParticleObserver can contain one or more ParticleEventHandlers.

Member Typedef Documentation

Constructor & Destructor Documentation

ParticleUniverse::ParticleObserver::ParticleObserver ( void  )
virtual ParticleUniverse::ParticleObserver::~ParticleObserver ( void  )
virtual

Member Function Documentation

virtual void ParticleUniverse::ParticleObserver::_firstParticle ( ParticleTechnique particleTechnique,
Particle particle,
Real  timeElapsed 
)
inlinevirtual

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

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

Returns the 'enabled' value that was set in setEnabled() and not altered during execution.

virtual void ParticleUniverse::ParticleObserver::_handleEvent ( ParticleTechnique particleTechnique,
Particle particle,
Real  timeElapsed 
)
protectedvirtual

Handle the event.

Remarks
This function iterates over all at the observer registered handlers and executes them.
virtual void ParticleUniverse::ParticleObserver::_handleObserve ( ParticleTechnique particleTechnique,
Particle particle,
Real  timeElapsed 
)
protectedvirtual

Handle the observer implementation.

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

Notify that the Particle System is rescaled.

virtual void ParticleUniverse::ParticleObserver::_notifyStart ( void  )
virtual

Perform activities when a ParticleTechnique is started.

Reimplemented in ParticleUniverse::OnCountObserver, and ParticleUniverse::OnClearObserver.

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

Perform activities when a ParticleTechnique is stopped.

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

Perform activities after the individual particles are processed.

Reimplemented in ParticleUniverse::OnClearObserver, and ParticleUniverse::OnQuotaObserver.

virtual void ParticleUniverse::ParticleObserver::_preProcessParticles ( ParticleTechnique technique,
Real  timeElapsed 
)
virtual

Perform activities before the individual particles are processed.

Reimplemented in ParticleUniverse::OnTimeObserver, and ParticleUniverse::OnRandomObserver.

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

Executes the ParticleObserver.

Remarks
This function calls the _observe() function to determine whether the event must be handled or not.

Reimplemented in ParticleUniverse::OnClearObserver, and ParticleUniverse::OnRandomObserver.

void ParticleUniverse::ParticleObserver::_resetEnabled ( void  )

Reset internal values for 'enabled'. This means that both the mEnabled and mOriginalEnabled can be set again using setEnabled.

Remarks
Using _resetEnabled() makes it possible to use setEnabled() without the restriction of having a fixed mOriginalEnabled value.
void ParticleUniverse::ParticleObserver::addEventHandler ( ParticleEventHandler eventHandler)

Todo

virtual void ParticleUniverse::ParticleObserver::copyAttributesTo ( ParticleObserver observer)
virtual
virtual void ParticleUniverse::ParticleObserver::copyParentAttributesTo ( ParticleObserver observer)
virtual

Copy parent attributes to another observer.

ParticleEventHandler* ParticleUniverse::ParticleObserver::createEventHandler ( const String eventHandlerType)

Todo

void ParticleUniverse::ParticleObserver::destroyAllEventHandlers ( void  )

Todo

void ParticleUniverse::ParticleObserver::destroyEventHandler ( ParticleEventHandler eventHandler)

Todo

void ParticleUniverse::ParticleObserver::destroyEventHandler ( size_t  index)

Todo

ParticleEventHandler* ParticleUniverse::ParticleObserver::getEventHandler ( size_t  index) const

Todo

ParticleEventHandler* ParticleUniverse::ParticleObserver::getEventHandler ( const String eventHandlerName) const

Todo

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

Todo

size_t ParticleUniverse::ParticleObserver::getNumEventHandlers ( void  ) const

Todo

Real ParticleUniverse::ParticleObserver::getObserverInterval ( void  ) const

Return the interval value, which defines at what interval the observer is called.

const String& ParticleUniverse::ParticleObserver::getObserverType ( void  ) const
inline

Todo

bool ParticleUniverse::ParticleObserver::getObserveUntilEvent ( void  ) const

Return the value of mObserveUntilEvent.

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

Todo

const Particle::ParticleType& ParticleUniverse::ParticleObserver::getParticleTypeToObserve ( void  ) const
inline

Todo

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

Todo

bool ParticleUniverse::ParticleObserver::isParticleTypeToObserveSet ( void  ) const

Returns true if the particle type to observe specifically has been set.

void ParticleUniverse::ParticleObserver::removeEventHandler ( ParticleEventHandler eventHandler)

Todo

virtual void ParticleUniverse::ParticleObserver::setEnabled ( bool  enabled)
virtual

Todo

void ParticleUniverse::ParticleObserver::setName ( const String name)
inline
void ParticleUniverse::ParticleObserver::setObserverInterval ( Real  observerInterval)

Set the interval value, which defines at what interval the observer is called.

void ParticleUniverse::ParticleObserver::setObserverType ( const String observerType)
inline
void ParticleUniverse::ParticleObserver::setObserveUntilEvent ( bool  observeUntilEvent)

Sets the value of mObserveUntilEvent. This value determines whether observation must be continued after an event ocurred and the event handlers are called.

void ParticleUniverse::ParticleObserver::setParentTechnique ( ParticleTechnique parentTechnique)
inline
void ParticleUniverse::ParticleObserver::setParticleTypeToObserve ( const Particle::ParticleType  particleTypeToObserve)

Member Data Documentation

Vector3 ParticleUniverse::ParticleObserver::_mObserverScale
protected

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

const bool ParticleUniverse::ParticleObserver::DEFAULT_ENABLED
static
const Real ParticleUniverse::ParticleObserver::DEFAULT_INTERVAL
static
const Particle::ParticleType ParticleUniverse::ParticleObserver::DEFAULT_PARTICLE_TYPE
static
const bool ParticleUniverse::ParticleObserver::DEFAULT_UNTIL_EVENT
static
bool ParticleUniverse::ParticleObserver::mEnabled
protected

Determines whether an observer is activated.

ParticleEventHandlerList ParticleUniverse::ParticleObserver::mEventHandlers
protected
bool ParticleUniverse::ParticleObserver::mEventHandlersExecuted
protected

Flag that is set if the event handler(s) are called at least once.

String ParticleUniverse::ParticleObserver::mName
protected
bool ParticleUniverse::ParticleObserver::mObserve
protected

Determines whether the _observe() function must be executed.

Remarks
This is independent of mEnabled, which means that an observer can be enabled, but if mObserve has been set to false, it still doesn't observe. It is used to enable/disable execution of the _observe() function in combination with the update interval.
Real ParticleUniverse::ParticleObserver::mObserverInterval
protected

Values that determine that the observer is called after every interval.

Real ParticleUniverse::ParticleObserver::mObserverIntervalRemainder
protected
bool ParticleUniverse::ParticleObserver::mObserverIntervalSet
protected
String ParticleUniverse::ParticleObserver::mObserverType
protected
bool ParticleUniverse::ParticleObserver::mObserveUntilEvent
protected

Observes until an event takes place. If the event occurs, the event handlers are called and after that the observer doesn't observe anymore.

bool ParticleUniverse::ParticleObserver::mOriginalEnabled
protected
bool ParticleUniverse::ParticleObserver::mOriginalEnabledSet
protected
ParticleTechnique* ParticleUniverse::ParticleObserver::mParentTechnique
protected
Particle::ParticleType ParticleUniverse::ParticleObserver::mParticleTypeToObserve
protected
bool ParticleUniverse::ParticleObserver::mParticleTypeToObserveSet
protected

Determines whether mParticleTypeToObserve is set. If ´true´, only that particles of the specified type are observed. If ´false´ (= default), all particles are observed.


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