proland::ParticleLayer Class Reference
[particles]

An abstract layer for a ParticleProducer. More...

#include <ParticleLayer.h>

Inheritance diagram for proland::ParticleLayer:
proland::LifeCycleParticleLayer proland::RandomParticleLayer proland::ScreenParticleLayer proland::TerrainParticleLayer proland::WorldParticleLayer

List of all members.

Public Member Functions

 ParticleLayer (const char *type, int particleSize)
 Creates a new ParticleLayer.
virtual ~ParticleLayer ()
 Deletes this ParticleLayer.
ParticleProducergetOwner ()
 Returns the ParticleProducer to which this ParticleLayer belongs.
bool isEnabled ()
 Returns true if this layer is enabled.
void setIsEnabled (bool enable)
 Enables or disables this ParticleLayer.
virtual int getParticleSize ()
 Returns the size in bytes of the layer specific data that must be stored for each particle.
void * getParticleData (ParticleStorage::Particle *p)
 Returns a pointer to the layer specific data of the given particle.
ParticleStorage::ParticlegetParticle (void *p)
 Returns a pointer to the Particle corresponding to the given layer specific data.
virtual void getReferencedProducers (vector< ptr< TileProducer > > &producers) const
 Returns the tile producers used by this ParticleLayer.
virtual void moveParticles (double dt)
 Moves the existing particles.
virtual void removeOldParticles ()
 Removes old particles.
virtual void addNewParticles ()
 Adds new particles.

Protected Member Functions

void init (int particleSize)
 Initializes this ParticleLayer.
virtual void initialize ()
 Initializes this ParticleLayer.
virtual void initParticle (ParticleStorage::Particle *p)
 Initializes the data that is specific to this layer in the given particle.

Private Attributes

ParticleProducerowner
 The ParticleProducer to which this ParticleLayer belongs.
int size
 The size in bytes of the layer specific data that must be stored for each particle.
int offset
 The offset of the data that is specific to this layer in the global particle data.
bool enabled
 True if this layer is enabled.

Detailed Description

An abstract layer for a ParticleProducer.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::ParticleLayer::ParticleLayer ( const char *  type,
int  particleSize 
)

Creates a new ParticleLayer.

Parameters:
type the layer's type.
particleSize the size in bytes of the layer specific data that must be stored for each particle.
virtual proland::ParticleLayer::~ParticleLayer (  )  [virtual]

Deletes this ParticleLayer.


Member Function Documentation

virtual void proland::ParticleLayer::addNewParticles (  )  [virtual]

Adds new particles.

The default implementation of this method does nothing.

Reimplemented in proland::RandomParticleLayer, and proland::ScreenParticleLayer.

ParticleProducer* proland::ParticleLayer::getOwner (  ) 

Returns the ParticleProducer to which this ParticleLayer belongs.

ParticleStorage::Particle* proland::ParticleLayer::getParticle ( void *  p  )  [inline]

Returns a pointer to the Particle corresponding to the given layer specific data.

Parameters:
p a pointer to the data that is specific to this layer for a given particle.
Returns:
the corresponding Particle.
void* proland::ParticleLayer::getParticleData ( ParticleStorage::Particle p  )  [inline]

Returns a pointer to the layer specific data of the given particle.

Parameters:
p a particle.
Returns:
a pointer to the data that is specific to this layer for the given particle.
virtual int proland::ParticleLayer::getParticleSize (  )  [virtual]

Returns the size in bytes of the layer specific data that must be stored for each particle.

virtual void proland::ParticleLayer::getReferencedProducers ( vector< ptr< TileProducer > > &  producers  )  const [inline, virtual]

Returns the tile producers used by this ParticleLayer.

Parameters:
[out] producers the tile producers used by this ParticleLayer.

Reimplemented in proland::TerrainParticleLayer.

void proland::ParticleLayer::init ( int  particleSize  )  [protected]

Initializes this ParticleLayer.

virtual void proland::ParticleLayer::initialize (  )  [protected, virtual]

Initializes this ParticleLayer.

If this layer needs reference to other layers it can initialize them in this method (using the template method ParticleProducer::getLayer()). The default implementation of this method does nothing.

Reimplemented in proland::ScreenParticleLayer, and proland::TerrainParticleLayer.

virtual void proland::ParticleLayer::initParticle ( ParticleStorage::Particle p  )  [protected, virtual]

Initializes the data that is specific to this layer in the given particle.

The default implementation of this method does nothing.

Reimplemented in proland::LifeCycleParticleLayer, proland::RandomParticleLayer, proland::ScreenParticleLayer, proland::TerrainParticleLayer, and proland::WorldParticleLayer.

bool proland::ParticleLayer::isEnabled (  ) 

Returns true if this layer is enabled.

If it is not the case, its moveParticles, removeOldParticles and addNewParticles will not be called by the ParticleProducer.

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

Moves the existing particles.

The default implementation of this method does nothing.

Parameters:
dt the elapsed time since the last call to this method, in microseconds.

Reimplemented in proland::LifeCycleParticleLayer, proland::ScreenParticleLayer, proland::TerrainParticleLayer, and proland::WorldParticleLayer.

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

Removes old particles.

The default implementation of this method does nothing.

Reimplemented in proland::LifeCycleParticleLayer, and proland::ScreenParticleLayer.

void proland::ParticleLayer::setIsEnabled ( bool  enable  ) 

Enables or disables this ParticleLayer.

The moveParticles, removeOldParticles and addNewParticles methods are called only on enabled layers.

Parameters:
enable true to enable this layer, false otherwise.

Member Data Documentation

True if this layer is enabled.

The offset of the data that is specific to this layer in the global particle data.

The ParticleProducer to which this ParticleLayer belongs.

The size in bytes of the layer specific data that must be stored for each particle.


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