![]() |
The LARC Game Engine
A Simple Game Engine from the Laboratory for Recreational Computing
|
A particle. More...
#include <Particle.h>
Public Member Functions | |
LParticle (const LParticleDesc< VECTOR, SPRITEDESC > &, float) | |
Constructor. More... | |
void | move (float) |
Move and rotate. More... | |
void | rescale (float) |
Rescale. More... | |
void | fade (float) |
Fade. More... | |
void | translate (const VECTOR &) |
Translate. More... | |
Public Attributes | |
float | m_fBirthTime = 0.0f |
Time of creation. | |
![]() | |
VECTOR | m_vVel = VECTOR::Zero |
Velocity. | |
VECTOR | m_vAccel = VECTOR::Zero |
Acceleration. | |
float | m_fFriction = 0.0f |
Coefficient of friction. | |
float | m_fRSpeed = 0.0f |
Rotational speed. | |
float | m_fLifeSpan = FLT_MAX |
Time it will live for. | |
float | m_fMaxScale = 1.0f |
Maximum scale. | |
float | m_fScaleInFrac = 0.0f |
Fraction of life growing in. | |
float | m_fScaleOutFrac = 0.0f |
Fraction of life shrinking out. | |
float | m_fFadeInFrac = 0.0f |
Fraction of life fading in. | |
float | m_fFadeOutFrac = 0.0f |
Fraction of life fading out. | |
A particle is a sprite that exists for a brief time. It can grow in and shrink out, and also fade in and fade out using an alpha channel. It's templated so we can define a 2D and a 3D version with a minimum of fuss.
VECTOR | A vector class. |
SPRITEDESC | A sprite descriptor class. |
LParticle< T0 >::LParticle | ( | const LParticleDesc< VECTOR, SPRITEDESC > & | d, |
float | t | ||
) |
Create a particle given a particle descriptor and a creation time.
VECTOR | A vector class. |
SPRITEDESC | A sprite descriptor class. |
d | Particle descriptor. |
t | Birth time. |
Make the particle's alpha channel fade in or fade out over time.
VECTOR | A vector class. |
SPRITEDESC | A sprite descriptor class. |
f | Fraction of lifespan lived, from 0.0f to 1.0f inclusive. |
Translate, apply acceleration, apply friction, and rotate.
VECTOR | A vector class. |
SPRITEDESC | A sprite descriptor class. |
t | Time step. |
Rescale the particle. It grows to m_fMaxScale for the first m_fScaleInFrac fraction of its life, and shrink to zero for the last m_fScaleOutFrac of its life.
VECTOR | A vector class. |
SPRITEDESC | A sprite descriptor class. |
f | Fraction of lifespan lived, from 0.0f to 1.0f inclusive. |