Game Development Reference
In-Depth Information
we work with the attributes; then when we are ready to render, we
copy the position and color over to the Particle structure.
The attributes of a particle are specific to the particular kind of par-
ticle system that we are modeling. However, we can generalize a bit
and come up with common attributes. The following example structure
contains some common particle attributes. Most systems won't need
all of these, and some systems may need additional attributes not
listed.
struct Attribute
{
D3DXVECTOR3 _position;
D3DXVECTOR3 _velocity;
D3DXVECTOR3 _acceleration;
float
_lifeTime;
float
_age;
D3DXCOLOR
_color;
D3DXCOLOR
_colorFade;
bool
_isAlive;
};
_position —The position of the particle in world space
_velocity —The velocity of the particle, which we usually mea-
sure in units per second
_acceleration —The acceleration of the particle, which we usu-
ally measure in units per second
_lifeTime —How long the particle can live before it dies. For
instance, we might kill a laser beam particle after a certain period
of time.
_age —The current age of the particle
_color —The color of the particle
_colorFade —How the color of the particle fades over time
_isAlive —True if the particle is alive, false if it has died
14.2 Particle System Components
A particle system is a collection of particles and is responsible for main-
taining and displaying these particles. The particle system keeps track
of global properties that affect all particles in the system, such as the
size of the particles, the location that the particles originate from, the
texture to apply to the particles, etc. Functionality-wise, the particle
system is responsible for updating, displaying, killing, and creating
particles.
Search WWH ::




Custom Search