proland::LifeCycleParticleLayer Class Reference
[particles]

A ParticleLayer to manage the lifecycle of particles. More...

#include <LifeCycleParticleLayer.h>

Inheritance diagram for proland::LifeCycleParticleLayer:
proland::ParticleLayer

List of all members.

Classes

struct  LifeCycleParticle
 Layer specific particle data for managing the lifecycle of particles. More...

Public Member Functions

 LifeCycleParticleLayer (float fadeInDelay, float activeDelay, float fadeOutDelay)
 Creates a new LifeCycleParticleLayer.
virtual ~LifeCycleParticleLayer ()
 Deletes this LifeCycleParticleLayer.
float getFadeInDelay () const
 Returns the fade in delay of particles, in microseconds.
void setFadeInDelay (float delay)
 Sets the fade in delay of particles, in microseconds.
float getActiveDelay () const
 Returns the active delay of particles, in microseconds.
void setActiveDelay (float delay)
 Sets the active delay of particles, in microseconds.
float getFadeOutDelay () const
 Returns the fade out delay of particles, in microseconds.
void setFadeOutDelay (float delay)
 Sets the fade out delay of particles, in microseconds.
LifeCycleParticlegetLifeCycle (ParticleStorage::Particle *p)
 Returns the lifecycle specific data of the given particle.
float getBirthDate (ParticleStorage::Particle *p)
 Returns the birth date of the given particle.
bool isFadingIn (ParticleStorage::Particle *p)
 Returns true if the given particle is fading in.
bool isActive (ParticleStorage::Particle *p)
 Returns true if the given particle is active.
bool isFadingOut (ParticleStorage::Particle *p)
 Returns true if the given particle is fading out.
void setFadingOut (ParticleStorage::Particle *p)
 Forces the given particle to start fading out.
void killParticle (ParticleStorage::Particle *p)
 Forces the given particle to be deleted immediatly.
float getIntensity (ParticleStorage::Particle *p)
 Returns an intensity for the given particle, based on its current state.
virtual void moveParticles (double dt)
 Updates the current time.
virtual void removeOldParticles ()
 Deletes the particles that have completely faded out.

Protected Member Functions

 LifeCycleParticleLayer ()
 Creates an uninitialized LifeCycleParticleLayer.
void init (float fadeInDelay, float activeDelay, float fadeOutDelay)
 Initializes this LifeCycleParticleLayer.
virtual void initParticle (ParticleStorage::Particle *p)
 Initializes the birth date of the given particle to time.

Private Attributes

float fadeInDelay
 The fade in delay of particles, in microseconds.
float activeDelay
 The active delay of particles, in microseconds.
float fadeOutDelay
 The fade out delay of particles, in microseconds.
float time
 The current time, in microseconds.

Detailed Description

A ParticleLayer to manage the lifecycle of particles.

This class manages a simple lifecycle where particles can be fading in, active, or fading out. The transitions between the three states are based on the particle's age, and on globally defined fading in, active, and fading out delays.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::LifeCycleParticleLayer::LifeCycleParticleLayer ( float  fadeInDelay,
float  activeDelay,
float  fadeOutDelay 
)

Creates a new LifeCycleParticleLayer.

Parameters:
fadeInDelay the fade in delay of particles, in microseconds. 0 means that particles are created directly in active state.
activeDelay the active delay of particles, in microseconds.
fadeOutDelay the fade out delay of particles, in microseconds. 0 means that particles are deleted when the become inactive.
virtual proland::LifeCycleParticleLayer::~LifeCycleParticleLayer (  )  [virtual]

Deletes this LifeCycleParticleLayer.

proland::LifeCycleParticleLayer::LifeCycleParticleLayer (  )  [protected]

Creates an uninitialized LifeCycleParticleLayer.


Member Function Documentation

float proland::LifeCycleParticleLayer::getActiveDelay (  )  const

Returns the active delay of particles, in microseconds.

float proland::LifeCycleParticleLayer::getBirthDate ( ParticleStorage::Particle p  )  [inline]

Returns the birth date of the given particle.

Parameters:
p a particle.
Returns:
the birth date of the given particle, in microseconds.
float proland::LifeCycleParticleLayer::getFadeInDelay (  )  const

Returns the fade in delay of particles, in microseconds.

0 means that particles are created directly in active state.

float proland::LifeCycleParticleLayer::getFadeOutDelay (  )  const

Returns the fade out delay of particles, in microseconds.

0 means that particles are deleted when they become inactive.

float proland::LifeCycleParticleLayer::getIntensity ( ParticleStorage::Particle p  ) 

Returns an intensity for the given particle, based on its current state.

This intensity varies between 0 to 1 during fade in, stays equal to 1 when the particle is active, and varies from 1 to 0 during fade out.

LifeCycleParticle* proland::LifeCycleParticleLayer::getLifeCycle ( ParticleStorage::Particle p  )  [inline]

Returns the lifecycle specific data of the given particle.

Parameters:
p a particle.
void proland::LifeCycleParticleLayer::init ( float  fadeInDelay,
float  activeDelay,
float  fadeOutDelay 
) [protected]
virtual void proland::LifeCycleParticleLayer::initParticle ( ParticleStorage::Particle p  )  [protected, virtual]

Initializes the birth date of the given particle to time.

Reimplemented from proland::ParticleLayer.

bool proland::LifeCycleParticleLayer::isActive ( ParticleStorage::Particle p  ) 

Returns true if the given particle is active.

bool proland::LifeCycleParticleLayer::isFadingIn ( ParticleStorage::Particle p  ) 

Returns true if the given particle is fading in.

bool proland::LifeCycleParticleLayer::isFadingOut ( ParticleStorage::Particle p  ) 

Returns true if the given particle is fading out.

void proland::LifeCycleParticleLayer::killParticle ( ParticleStorage::Particle p  ) 

Forces the given particle to be deleted immediatly.

virtual void proland::LifeCycleParticleLayer::moveParticles ( double  dt  )  [virtual]

Updates the current time.

We don't need to update the particles because we store their birth date instead of their age.

Reimplemented from proland::ParticleLayer.

virtual void proland::LifeCycleParticleLayer::removeOldParticles (  )  [virtual]

Deletes the particles that have completely faded out.

Reimplemented from proland::ParticleLayer.

void proland::LifeCycleParticleLayer::setActiveDelay ( float  delay  ) 

Sets the active delay of particles, in microseconds.

Parameters:
delay the new active delay.
void proland::LifeCycleParticleLayer::setFadeInDelay ( float  delay  ) 

Sets the fade in delay of particles, in microseconds.

0 means that particles are created directly in active state.

Parameters:
delay the new fade in delay.
void proland::LifeCycleParticleLayer::setFadeOutDelay ( float  delay  ) 

Sets the fade out delay of particles, in microseconds.

0 means that particles are deleted when they become inactive.

Parameters:
delay the new fade out delay.
void proland::LifeCycleParticleLayer::setFadingOut ( ParticleStorage::Particle p  ) 

Forces the given particle to start fading out.


Member Data Documentation

The active delay of particles, in microseconds.

The fade in delay of particles, in microseconds.

0 means that particles are created directly in active state.

The fade out delay of particles, in microseconds.

0 means that particles are deleted when the become inactive.

The current time, in microseconds.

This time is updated in moveParticles and used to set the birth date of particles in initParticle.


Generated on Sat May 12 09:41:37 2012 for proland by  doxygen 1.6.1