![]() |
SAGE
A Simple Academic Game Engine
|
An abstract particle engine. More...
#include <SageParticleEngine.h>


Public Member Functions | |
| CParticleEngine () | |
| Constructor. | |
| virtual | ~CParticleEngine () |
| Destructor. | |
| void | Create (const PD &d) |
| Create particle. | |
| void | Step () |
| Animation step. | |
| void | Clear (float=0.1f) |
| Fade out all particles. | |
| void | Clear (UINT) |
| Clear out a particular kind of particle. | |
| void | Translate (const VEC &) |
| Translate all particles. | |
| void | TranslateTo (const VEC &) |
| Translate all particles to a point. | |
| void | SetOrigin (const VEC &) |
| Set origin. | |
Protected Member Functions | |
| void | Move () |
| Move all particles. | |
| const float | GetLifeFraction (const P *) const |
| Get life fraction. | |
| void | Cull () |
| Cull old dead particles. | |
| void | Rescale () |
| Compute new particle scales. | |
| void | Fade () |
| Compute new particle alpha channel. | |
Protected Attributes | |
| std::list< P * > | m_stdList |
| Particle list. | |
| VEC | m_vOrigin |
| Origin in world space. | |
Additional Inherited Members | |
Static Protected Attributes inherited from Sage::CComponent | |
| static std::unique_ptr< CTimer > | m_pTimer = std::make_unique<CTimer>() |
| Pointer to a timer. | |
| static std::unique_ptr< CRandom > | m_pRandom = std::make_unique<CRandom>() |
| Pointer to a PRNG. | |
| static std::unique_ptr< CSound > | m_pSound = std::make_unique<CSound>() |
| Pointer to sound manager. | |
| static std::unique_ptr< CKeyboard > | m_pKeyboard |
| Pointer to a keyboard handler. | |
| static std::unique_ptr< CMouse > | m_pMouse = std::make_unique<CMouse>() |
| Pointer to a mouse handler. | |
| static std::unique_ptr< CController > | m_pController |
| Pointer to a controller. | |
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.
| P | Partice class. |
| P | Particle descriptor. |
| VEC | Vector. |
| CParticleEngine::CParticleEngine | ( | ) |
Constructor.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
|
virtual |
Destructor. Delete all of the particles in the particle list.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| void CParticleEngine::Clear | ( | float | t = 0.1f | ) |
Pre-emptively trigger a fade out of all particles.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| t | Time over which to fade out. |
| void CParticleEngine::Clear | ( | UINT | n | ) |
Pre-emptively trigger scale out of all particles of a given type.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| n | Sprite type of particle to be cleared. |
| void CParticleEngine::Create | ( | const PD & | d | ) |
Create a particle given its particle descriptor.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| d | Particle descriptor. |
|
protected |
Remove from the particle list and delete those particles that have reached or exceeded their lifespan.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
|
protected |
Fade out all particles in the particle list according to how much of their lifespans they have lived up to this point.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
|
protected |
Get the remaining fraction of a particle's lifespan.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| p | Pointer to a particle. |

|
protected |
Move all particles in the particle list.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
|
protected |
Rescale all of the particles in the particle list according to how much of their lifespans they have lived up to this point.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| void CParticleEngine::SetOrigin | ( | const VEC & | v | ) |
Set origin in world space.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| v | New origin. |
| void CParticleEngine::Step | ( | ) |
Move all particles, cull any that have exceeded their lifespan, and recompute the scale and transparency of the ones remaining.
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| void CParticleEngine::Translate | ( | const VEC & | delta | ) |
Translate all particles simultaneously by the same amount.
| delta | Translation amount. |
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |
| void CParticleEngine::TranslateTo | ( | const VEC & | v | ) |
Translate all particles simultaneously to the same point.
| v | Destination. |
| P | Particle type, 2D or 3D. |
| PD | Particle descriptor type, 2D or 3D. |
| VEC | Vector type, 2D or 3D. |