![]() |
The LARC Game Engine
A Simple Game Engine from the Laboratory for Recreational Computing
|
An abstract particle engine. More...
#include <ParticleEngine.h>
Public Member Functions | |
| LParticleEngine () | |
| Constructor. | |
| virtual | ~LParticleEngine () |
| Destructor. More... | |
| void | create (const PARTICLEDESC &d) |
| Create particle. More... | |
| void | step () |
| Animation step. More... | |
| void | clear (float=0.1f) |
| Fade out all particles. More... | |
| void | clear (UINT) |
| Clear out a particular kind of particle. More... | |
| void | translate (const VECTOR &) |
| Translate. More... | |
Protected Member Functions | |
| void | move () |
| Move all particles. More... | |
| float | GetLifeFraction (const PARTICLE *) |
| Get life fraction. More... | |
| void | cull () |
| Cull old dead particles. More... | |
| void | rescale () |
| Compute new particle scales. More... | |
| void | fade () |
| Compute new particle alpha channel. More... | |
Protected Attributes | |
| std::list< PARTICLE * > | m_stdList |
| Particle list. | |
Additional Inherited Members | |
Static Protected Attributes inherited from LComponent | |
| static LTimer * | m_pTimer = &cTimer |
| Pointer to a timer. More... | |
| static LRandom * | m_pRandom = &cRandom |
| Pointer to a PRNG. More... | |
| static LKeyboard * | m_pKeyboard = &cKeyboard |
| Pointer to a keyboard handler. More... | |
| static LXBoxController * | m_pController = &cController |
| Pointer to a XBox controller. More... | |
| static LSound * | m_pAudio = &cAudio |
| Pointer to an audio player. More... | |
A particle engine is responsible for managing a system of particles. Its step function must be called once per animation frame. Templates are used to make this class independent of operating system and renderer implementation.
| PARTICLE | Partice class. |
| PARTICLEDESC | Particle descriptor. |
| VECTOR | Vector. |
|
virtual |
Destructor. Deletes all of the particles in the particle list.
| void LParticleEngine< T0 >::clear | ( | float | t = 0.1f | ) |
Pre-emptively trigger a fade out of all particles.
| t | Time over which to fade out. |
| void LParticleEngine< T0 >::clear | ( | UINT | n | ) |
Pre-emptively trigger scale out of all particles of a given type.
| n | Sprite type of particle to be cleared. |
| void LParticleEngine< T0 >::create | ( | const PARTICLEDESC & | d | ) |
Create a particle given its particle descriptor.
| d | Particle descriptor. |
|
protected |
Remove from the particle list and delete those particles that have reached or exceeded their lifespan.
|
protected |
Fade out all particles in the particle list according to how much of their lifespans they have lived up to this point.
|
protected |
Get the remaining fraction of a particle's lifespan.
| p | Pointer to a particle. |
|
protected |
Move all particles in the particle list.
|
protected |
Rescale all of the particles in the particle list according to how much of their lifespans they have lived up to this point.
| void LParticleEngine< T0 >::step |
Move all particles, cull any that have exceeded their lifespan, and recompute the scale and transparency of the ones remaining.
| void LParticleEngine< T0 >::translate | ( | const VECTOR & | delta | ) |
Translate all particles simultaneously by the same amount.
| delta | Translation amount. |