ParticleEmitter Class Reference

#include <particleEmitter.h>

Inheritance diagram for ParticleEmitter:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ParticleEmitter ()
 ~ParticleEmitter ()
ColorF getCollectiveColor ()
void setSizes (F32 *sizeList)
 Sets sizes of particles based on sizelist provided.
void setColors (ColorF *colorList)
 Sets colors for particles based on color list provided.
ParticleEmitterDatagetDataBlock ()
 Returns the datablock for this object.
bool onNewDataBlock (GameBaseData *dptr)
 Called when a new datablock is set.
void deleteWhenEmpty ()
 By default, a particle renderer will wait for it's owner to delete it.
Particle Emission
Main interface for creating particles. The emitter does _not_ track changes in axis or velocity over the course of a single update, so this should be called at a fairly fine grain. The emitter will potentially track the last particle to be created into the next call to this function in order to create a uniformly random time distribution of the particles. If the object to which the emitter is attached is in motion, it should try to ensure that for call (n+1) to this function, start is equal to the end from call (n). This will ensure a uniform spatial distribution.

void emitParticles (const Point3F &start, const Point3F &end, const Point3F &axis, const Point3F &velocity, const U32 numMilliseconds)
void emitParticles (const Point3F &point, const bool useLastPosition, const Point3F &axis, const Point3F &velocity, const U32 numMilliseconds)
void emitParticles (const Point3F &rCenter, const Point3F &rNormal, const F32 radius, const Point3F &velocity, S32 count)

Static Public Member Functions

static void setWindVelocity (const Point3F &vel)

Public Attributes

bool mDead

Static Public Attributes

static Point3F mWindVelocity

Protected Member Functions

bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
void processTick (const Move *move)
 Processes a move event and updates object state once every 32 milliseconds.
void advanceTime (F32 dt)
 Advances simulation time for animations.
bool prepRenderImage (SceneState *state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState)
 Called when the SceneGraph is ready for the registration of RenderImages.
void prepBatchRender (const Point3F &camPos)
void copyToVB (const Point3F &camPos)
Internal interface
void addParticle (const Point3F &pos, const Point3F &axis, const Point3F &vel, const Point3F &axisx)
 Adds a particle.
void setupBillboard (Particle *part, Point3F *basePts, const MatrixF &camView, GFXVertexPCT *lVerts)
void setupOriented (Particle *part, const Point3F &camPos, GFXVertexPCT *lVerts)
void updateBBox ()
 Updates the bounding box for the particle system.

Private Types

typedef GameBase Parent

Private Member Functions

void update (U32 ms)
void updateKeyData (Particle *part)

Private Attributes

ParticleEmitterDatamDataBlock
U32 mInternalClock
U32 mNextParticleTime
Point3F mLastPosition
bool mHasLastPosition
bool mDeleteWhenEmpty
bool mDeleteOnTick
S32 mLifetimeMS
S32 mElapsedTimeMS
F32 sizes [ParticleData::PDC_NUM_KEYS]
ColorF colors [ParticleData::PDC_NUM_KEYS]
GFXVertexBufferHandle< GFXVertexPCT > mVertBuff
Vector< Particle * > part_store
Particlepart_freelist
Particle part_list_head
S32 n_part_capacity
S32 n_parts
S32 mCurBuffSize

Member Typedef Documentation

typedef GameBase ParticleEmitter::Parent [private]

Reimplemented from GameBase.


Constructor & Destructor Documentation

ParticleEmitter::ParticleEmitter (  ) 

ParticleEmitter::~ParticleEmitter (  ) 


Member Function Documentation

static void ParticleEmitter::setWindVelocity ( const Point3F vel  )  [inline, static]

ColorF ParticleEmitter::getCollectiveColor (  ) 

void ParticleEmitter::setSizes ( F32 sizeList  ) 

Sets sizes of particles based on sizelist provided.

Parameters:
sizeList List of sizes

void ParticleEmitter::setColors ( ColorF colorList  ) 

Sets colors for particles based on color list provided.

Parameters:
colorList List of colors

ParticleEmitterData* ParticleEmitter::getDataBlock (  )  [inline]

Returns the datablock for this object.

Reimplemented from GameBase.

bool ParticleEmitter::onNewDataBlock ( GameBaseData dptr  )  [virtual]

Called when a new datablock is set.

This allows subclasses to appropriately handle new datablocks.

See also:
setDataBlock()
Parameters:
dptr New datablock

Reimplemented from GameBase.

void ParticleEmitter::deleteWhenEmpty (  ) 

By default, a particle renderer will wait for it's owner to delete it.

When this is turned on, it will delete itself as soon as it's particle count drops to zero.

void ParticleEmitter::emitParticles ( const Point3F start,
const Point3F end,
const Point3F axis,
const Point3F velocity,
const U32  numMilliseconds 
)

void ParticleEmitter::emitParticles ( const Point3F point,
const bool  useLastPosition,
const Point3F axis,
const Point3F velocity,
const U32  numMilliseconds 
)

void ParticleEmitter::emitParticles ( const Point3F rCenter,
const Point3F rNormal,
const F32  radius,
const Point3F velocity,
S32  count 
)

void ParticleEmitter::addParticle ( const Point3F pos,
const Point3F axis,
const Point3F vel,
const Point3F axisx 
) [protected]

Adds a particle.

Parameters:
pos Initial position of particle
axis 
vel Initial velocity
axisx 

void ParticleEmitter::setupBillboard ( Particle part,
Point3F basePts,
const MatrixF camView,
GFXVertexPCT *  lVerts 
) [inline, protected]

void ParticleEmitter::setupOriented ( Particle part,
const Point3F camPos,
GFXVertexPCT *  lVerts 
) [inline, protected]

void ParticleEmitter::updateBBox (  )  [protected]

Updates the bounding box for the particle system.

bool ParticleEmitter::onAdd (  )  [protected, virtual]

Called when the object is added to the sim.

Reimplemented from GameBase.

void ParticleEmitter::onRemove (  )  [protected, virtual]

Called when the object is removed from the sim.

Reimplemented from GameBase.

void ParticleEmitter::processTick ( const Move move  )  [protected, virtual]

Processes a move event and updates object state once every 32 milliseconds.

This takes place both on the client and server, every 32 milliseconds (1 tick).

See also:
ProcessList
Parameters:
move Move event corresponding to this tick, or NULL.

Reimplemented from GameBase.

void ParticleEmitter::advanceTime ( F32  dt  )  [protected, virtual]

Advances simulation time for animations.

This is called every frame.

Parameters:
dt Time since last advance call

Reimplemented from GameBase.

bool ParticleEmitter::prepRenderImage ( SceneState state,
const U32  stateKey,
const U32  startZone,
const bool  modifyBaseZoneState 
) [protected, virtual]

Called when the SceneGraph is ready for the registration of RenderImages.

See also:
SceneState
Parameters:
state SceneState
stateKey State key of the current SceneState
startZone Base zone index
modifyBaseZoneState If true, the object needs to modify the zone state.

Reimplemented from SceneObject.

void ParticleEmitter::prepBatchRender ( const Point3F camPos  )  [protected]

void ParticleEmitter::copyToVB ( const Point3F camPos  )  [protected]

void ParticleEmitter::update ( U32  ms  )  [private]

void ParticleEmitter::updateKeyData ( Particle part  )  [inline, private]


Member Data Documentation

F32 ParticleEmitter::sizes[ParticleData::PDC_NUM_KEYS] [private]

ColorF ParticleEmitter::colors[ParticleData::PDC_NUM_KEYS] [private]