torque Torque Game Engine Documentation
TGE Version 1.5.2

ParticleEmitter Class Reference

#include <particleEngine.h>

Inheritance diagram for ParticleEmitter:

Inheritance graph
[legend]

Public Member Functions

 ParticleEmitter ()
 ~ParticleEmitter ()
void setupParticleLighting (bool allowlighting)
void resetParticleLighting ()
void lightParticle (const Particle &part)
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.
virtual void setTransform (const MatrixF &mat)
 Sets the Object -> World transform.
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)

Data Fields

bool allowLighting
bool lastLightingValue
TextureHandle whiteTexture

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 renderObject (SceneState *state, SceneRenderImage *image)
 Called when the object is supposed to render itself.
Internal interface
void addParticle (const Point3F &pos, const Point3F &axis, const Point3F &vel, const Point3F &axisx)
 Adds a particle.
void renderBillboardParticle (const Particle &part, const Point3F *basePnts, const MatrixF &camView, const F32 spinFactor)
 Renders a particle facing the camera with a spin factor.
void renderOrientedParticle (const Particle &part, const Point3F &camPos)
 Renders a particle which will face the camera but spin itself to look like it is facing a particular velocity.
bool updateBBox (const Point3F &position)
 Updates the bounding box for the particle system.

Private Types

typedef GameBase Parent

Private Member Functions

void stealParticle (Particle *part)
 Removes the provided particle from the system and lets the caller of the function assume control of it.

Private Attributes

ParticleEmitterDatamDataBlock
bool mNeedTransformUpdate
 This is used so we only update our transform/bounding box on ticks, to minimize calls to setTransform.
ParticlemParticleListHead
U32 mInternalClock
U32 mNextParticleTime
Point3F mLastPosition
bool mHasLastPosition
bool mDeleteWhenEmpty
bool mDeleteOnTick
S32 mLifetimeMS
S32 mElapsedTimeMS
F32 sizes [ParticleEngine::PC_SIZE_KEYS]
ColorF colors [ParticleEngine::PC_COLOR_KEYS]

Friends

class PEngine

Member Typedef Documentation

typedef GameBase ParticleEmitter::Parent [private]

Reimplemented from GameBase.


Constructor & Destructor Documentation

ParticleEmitter::ParticleEmitter (  ) 

ParticleEmitter::~ParticleEmitter (  ) 


Member Function Documentation

void ParticleEmitter::setupParticleLighting ( bool  allowlighting  ) 

void ParticleEmitter::resetParticleLighting (  ) 

void ParticleEmitter::lightParticle ( const Particle part  ) 

ColorF ParticleEmitter::getCollectiveColor (  )  [inline]

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 
)

virtual void ParticleEmitter::setTransform ( const MatrixF mat  )  [virtual]

Sets the Object -> World transform.

Parameters:
mat New transform matrix

Reimplemented from SceneObject.

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::renderBillboardParticle ( const Particle part,
const Point3F basePnts,
const MatrixF camView,
const F32  spinFactor 
) [protected]

Renders a particle facing the camera with a spin factor.

Parameters:
part Particle
basePnts Base points for the quad the particle is rendered on
camView Camera view matrix
spinFactor 0.0-1.0 modifyer for

void ParticleEmitter::renderOrientedParticle ( const Particle part,
const Point3F camPos 
) [protected]

Renders a particle which will face the camera but spin itself to look like it is facing a particular velocity.

Parameters:
part Particle
camPos Camera position

bool ParticleEmitter::updateBBox ( const Point3F position  )  [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::renderObject ( SceneState state,
SceneRenderImage image 
) [protected, virtual]

Called when the object is supposed to render itself.

Parameters:
state Current rendering state.
See also:
SceneState
Parameters:
image Image associated with this object to render.
See also:
SceneRenderImage

Reimplemented from SceneObject.

void ParticleEmitter::stealParticle ( Particle part  )  [private]

Removes the provided particle from the system and lets the caller of the function assume control of it.

Parameters:
part Particle


Friends And Related Function Documentation

friend class PEngine [friend]


Field Documentation

This is used so we only update our transform/bounding box on ticks, to minimize calls to setTransform.

F32 ParticleEmitter::sizes[ParticleEngine::PC_SIZE_KEYS] [private]

ColorF ParticleEmitter::colors[ParticleEngine::PC_COLOR_KEYS] [private]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen