#include <particle_effect.h>
Collaboration diagram for hoa_video::ParticleEffect:

Public Member Functions | |
| float | GetAge () const |
| return the age of the system, i.e. how many seconds it has been since it was created | |
| int32 | GetNumParticles () const |
| return the number of active particles in this effect | |
| void | GetPosition (float &x, float &y) const |
| return the position of the effect into x and y | |
| bool | IsAlive () |
| returns true if the system is alive, i.e. the number of active particles is more than zero. This is used by the particle manager so it knows when to destroy an effect. | |
| void | Move (float x, float y) |
| moves the effect to the specified position on the screen, This can be used if you want to move a particle system around on some flight path, or if you want to attach the system to an object. (e.g. smoke to a jet) | |
| void | MoveRelative (float dx, float dy) |
| moves the effect dx and dy units relative to its current position | |
| ParticleEffect () | |
| Constructor. | |
| void | SetAttractorPoint (float x, float y) |
| set the position of an "attractor point". Any particle systems which use radial acceleration and have user-defined attractor points enabled will have particles move towards this point | |
| void | SetOrientation (float angle) |
| set the orientation of the effect (including all systems contained within the effect). This is essentially added to the emitter orientation for each system. For example, if you want to create a particle system for smoke coming out of a jet, set the emitter orientation to zero degrees (right) when you create the effect. Then, at runtime just call SetOrientation() every frame with the angle the jet is facing. | |
| void | Stop (bool kill_immediate=false) |
| stops this effect | |
Private Member Functions | |
| void | _Destroy () |
| destroys the effect. This is private so that only the ParticleManager class can destroy effects. | |
| bool | _Draw () |
| draws the effect. This is private so that only the ParticleManager class can draw effects. | |
| bool | _Update (float frame_time) |
| updates the effect. This is private so that only the ParticleManager class can update effects. | |
Private Attributes | |
| float | _age |
| age of the effect (seconds since it was created) | |
| bool | _alive |
| is the effect is alive or not | |
| float | _attractor_x |
| position of attractor point | |
| float | _attractor_y |
| const ParticleEffectDef * | _effect_def |
| pointer to the effect definition | |
| int32 | _num_particles |
| number of active particles (this is updated on each call to Update()) | |
| float | _orientation |
| orientation of the effect (angle in radians) | |
| std::list< ParticleSystem * > | _systems |
| float | _x |
| position of the effect | |
| float | _y |
Friends | |
| class | private_video::ParticleManager |
***************************************************************************
Definition at line 68 of file particle_effect.h.
| hoa_video::ParticleEffect::ParticleEffect | ( | ) |
Constructor.
Definition at line 27 of file particle_effect.cpp.
References _age, _alive, _attractor_x, _attractor_y, _effect_def, _orientation, _x, and _y.
| void hoa_video::ParticleEffect::_Destroy | ( | ) | [private] |
destroys the effect. This is private so that only the ParticleManager class can destroy effects.
Definition at line 132 of file particle_effect.cpp.
References _systems.
| bool hoa_video::ParticleEffect::_Draw | ( | ) | [private] |
draws the effect. This is private so that only the ParticleManager class can draw effects.
Definition at line 42 of file particle_effect.cpp.
References _systems, _x, _y, hoa_video::GameVideo::Move(), hoa_video::GameVideo::PopMatrix(), hoa_video::GameVideo::PushMatrix(), hoa_video::VIDEO_DEBUG, and hoa_video::VideoManager.
Here is the call graph for this function:

| bool hoa_video::ParticleEffect::_Update | ( | float | frame_time | ) | [private] |
updates the effect. This is private so that only the ParticleManager class can update effects.
| the | new frame time |
Definition at line 79 of file particle_effect.cpp.
References _age, _alive, _attractor_x, _attractor_y, _num_particles, _orientation, _systems, _x, _y, hoa_video::private_video::EffectParameters::attractor_x, hoa_video::private_video::EffectParameters::attractor_y, hoa_video::private_video::EffectParameters::orientation, and hoa_video::VIDEO_DEBUG.
| float hoa_video::ParticleEffect::GetAge | ( | ) | const |
return the age of the system, i.e. how many seconds it has been since it was created
Definition at line 258 of file particle_effect.cpp.
References _age.
| int32 hoa_video::ParticleEffect::GetNumParticles | ( | ) | const |
return the number of active particles in this effect
Definition at line 236 of file particle_effect.cpp.
References _num_particles.
| void hoa_video::ParticleEffect::GetPosition | ( | float & | x, | |
| float & | y | |||
| ) | const |
return the position of the effect into x and y
| x | parameter to store x value of system in | |
| y | parameter to store y value of system in |
Definition at line 246 of file particle_effect.cpp.
| bool hoa_video::ParticleEffect::IsAlive | ( | ) |
returns true if the system is alive, i.e. the number of active particles is more than zero. This is used by the particle manager so it knows when to destroy an effect.
Definition at line 197 of file particle_effect.cpp.
References _alive.
| void hoa_video::ParticleEffect::Move | ( | float | x, | |
| float | y | |||
| ) |
moves the effect to the specified position on the screen, This can be used if you want to move a particle system around on some flight path, or if you want to attach the system to an object. (e.g. smoke to a jet)
| x | movement of system in x direction | |
| y | movement of system in y direction |
Definition at line 149 of file particle_effect.cpp.
Referenced by hoa_video::private_video::ParticleManager::AddEffect().
| void hoa_video::ParticleEffect::MoveRelative | ( | float | dx, | |
| float | dy | |||
| ) |
moves the effect dx and dy units relative to its current position
| dx | x offset to move to from current x position | |
| dy | y offset to move to from current y position |
Definition at line 161 of file particle_effect.cpp.
| void hoa_video::ParticleEffect::SetAttractorPoint | ( | float | x, | |
| float | y | |||
| ) |
set the position of an "attractor point". Any particle systems which use radial acceleration and have user-defined attractor points enabled will have particles move towards this point
| x | x coordiante of gravitation point | |
| y | y coordiante of gravitation point |
Definition at line 185 of file particle_effect.cpp.
References _attractor_x, and _attractor_y.
| void hoa_video::ParticleEffect::SetOrientation | ( | float | angle | ) |
set the orientation of the effect (including all systems contained within the effect). This is essentially added to the emitter orientation for each system. For example, if you want to create a particle system for smoke coming out of a jet, set the emitter orientation to zero degrees (right) when you create the effect. Then, at runtime just call SetOrientation() every frame with the angle the jet is facing.
| angle | rotation of particle system |
Definition at line 173 of file particle_effect.cpp.
References _orientation.
| void hoa_video::ParticleEffect::Stop | ( | bool | kill_immediate = false |
) |
stops this effect
| kill_immediate | If this is true, the effect is immediately killed. If it isn't true, then we stop the effect from emitting new particles, and allow it to live until all the active particles fizzle out. |
Definition at line 209 of file particle_effect.cpp.
friend class private_video::ParticleManager [friend] |
Definition at line 215 of file particle_effect.h.
float hoa_video::ParticleEffect::_age [private] |
age of the effect (seconds since it was created)
Definition at line 210 of file particle_effect.h.
Referenced by hoa_video::private_video::ParticleManager::_CreateEffect(), _Update(), GetAge(), and ParticleEffect().
bool hoa_video::ParticleEffect::_alive [private] |
is the effect is alive or not
Definition at line 207 of file particle_effect.h.
Referenced by hoa_video::private_video::ParticleManager::_CreateEffect(), _Update(), IsAlive(), ParticleEffect(), and Stop().
float hoa_video::ParticleEffect::_attractor_x [private] |
position of attractor point
Definition at line 201 of file particle_effect.h.
Referenced by _Update(), ParticleEffect(), and SetAttractorPoint().
float hoa_video::ParticleEffect::_attractor_y [private] |
Definition at line 201 of file particle_effect.h.
Referenced by _Update(), ParticleEffect(), and SetAttractorPoint().
const ParticleEffectDef* hoa_video::ParticleEffect::_effect_def [private] |
pointer to the effect definition
Definition at line 191 of file particle_effect.h.
Referenced by hoa_video::private_video::ParticleManager::_CreateEffect(), and ParticleEffect().
number of active particles (this is updated on each call to Update())
Definition at line 213 of file particle_effect.h.
Referenced by _Update(), and GetNumParticles().
float hoa_video::ParticleEffect::_orientation [private] |
orientation of the effect (angle in radians)
Definition at line 204 of file particle_effect.h.
Referenced by _Update(), ParticleEffect(), and SetOrientation().
std::list<ParticleSystem *> hoa_video::ParticleEffect::_systems [private] |
list of subsystems that make up the effect. (for example, a fire effect might consist of a flame + smoke + embers)
Definition at line 195 of file particle_effect.h.
Referenced by hoa_video::private_video::ParticleManager::_CreateEffect(), _Destroy(), _Draw(), _Update(), and Stop().
float hoa_video::ParticleEffect::_x [private] |
position of the effect
Definition at line 198 of file particle_effect.h.
Referenced by _Draw(), _Update(), GetPosition(), Move(), MoveRelative(), and ParticleEffect().
float hoa_video::ParticleEffect::_y [private] |
Definition at line 198 of file particle_effect.h.
Referenced by _Draw(), _Update(), GetPosition(), Move(), MoveRelative(), and ParticleEffect().
1.5.1