A single particle (a point in space with a velocity and different parameters). More...
Public Member Functions | |
bool | setParamCurrentValue (ModelParam type, float value) |
Sets the current value for the given parameter. | |
bool | setParamFinalValue (ModelParam type, float value) |
Sets the final value for the given parameter. | |
bool | changeParamCurrentValue (ModelParam type, float delta) |
Changes the current value for the given parameter. | |
bool | changeParamFinalValue (ModelParam type, float delta) |
Changes the final value for the given parameter. | |
void | setLifeLeft (float life) |
Sets the life left of the Particle. | |
Vector3D & | position () |
Gets the position of the Particle. | |
Vector3D & | velocity () |
Gets the velocity of the Particle. | |
Vector3D & | oldPosition () |
Gets the old position of the Particle. | |
const Vector3D & | position () const |
Gets the position of the Particle. | |
const Vector3D & | velocity () const |
Gets the velocity of the Particle. | |
const Vector3D & | oldPosition () const |
Gets the old position of the Particle. | |
float | getParamCurrentValue (ModelParam type) const |
Gets the current value for the given parameter. | |
float | getParamFinalValue (ModelParam type) const |
Gets the final value for the given parameter. | |
Model * | getModel () const |
Gets the Model of this Particle. | |
Group * | getGroup () const |
Gets the group of this Particle. | |
size_t | getIndex () const |
Gets the index of this Particle in its Group. | |
float | getLifeLeft () const |
Gets the amount of life left of the Particle. | |
float | getAge () const |
Gets the age of the Particle. | |
float | getDistanceFromCamera () const |
Gets the distance of this Particle from the camera. | |
float | getSqrDistanceFromCamera () const |
Gets the square distance of this Particle from the camera. | |
bool | isNewBorn () const |
Tells whether this Particle was initialized at its latest update or not. | |
bool | isAlive () const |
Tells whether this Particle is alive or not. | |
void | init () |
Initializes the Particle. | |
void | kill () |
Kills this Particle. |
A single particle (a point in space with a velocity and different parameters).
A Particle is the primitive on which all the SPARK engine relies.
Particles are designed to be handled in large amounts (called Group). This is why the user cannot update or render directly a single Particle.
Note that the Particle class is only a class that presents an interface to the user (since 1.02.00), particles data are stored in the groups. This is why copying a Particle will not copy its data.
Definition at line 47 of file SPK_Particle.h.
bool changeParamCurrentValue | ( | ModelParam | type, | |
float | delta | |||
) |
Changes the current value for the given parameter.
The delta is added to the current value of the parameter.
For more information see setParamCurrentValue(ModelParam,float).
type | : the parameter to set | |
delta | : the delta |
bool changeParamFinalValue | ( | ModelParam | type, | |
float | delta | |||
) |
Changes the final value for the given parameter.
The delta is added to the final value of the parameter.
For more information see setParamFinalValue(ModelParam,float).
type | : the parameter to set | |
delta | : the delta |
float getAge | ( | ) | const |
Gets the age of the Particle.
The age of a Particle starts at zero when it is initialized and evolve at each update.
Note that even immortal particles gets older.
Definition at line 379 of file SPK_Particle.h.
float getDistanceFromCamera | ( | ) | const |
Gets the distance of this Particle from the camera.
Note that the correct distance is only returned if the Group of this Particles has its distance computation enabled.
Definition at line 384 of file SPK_Particle.h.
Group * getGroup | ( | ) | const |
size_t getIndex | ( | ) | const |
float getLifeLeft | ( | ) | const |
Gets the amount of life left of the Particle.
The life left of the Particle is the time left before the Particle dies.
Note that in case of immortal particles, this value does not evolve.
Definition at line 374 of file SPK_Particle.h.
Model* getModel | ( | ) | const |
float getParamCurrentValue | ( | ModelParam | type | ) | const |
Gets the current value for the given parameter.
Note that if the the parameter is not enabled in the Particle's Model, the default value for the parameter is returned.
type | : the parameter to get the value |
float getParamFinalValue | ( | ModelParam | type | ) | const |
Gets the final value for the given parameter.
Note that if the the parameter is not enabled in the Particle's Model, the default value for the parameter is returned.
If the parameter is enabled but not mutable, the current value is returned.
type | : the parameter to get the value |
float getSqrDistanceFromCamera | ( | ) | const |
Gets the square distance of this Particle from the camera.
Note that the correct distance is only returned if the Group of this Particles has its distance computation enabled.
This method is faster than getDistanceFromCamera() and should be used instead when possible.
Definition at line 389 of file SPK_Particle.h.
void init | ( | ) |
bool isAlive | ( | ) | const |
Tells whether this Particle is alive or not.
A call to this method is equivalent to getLifeLeft > 0.0f
Definition at line 399 of file SPK_Particle.h.
bool isNewBorn | ( | ) | const |
Tells whether this Particle was initialized at its latest update or not.
A call to this method is equivalent to getAge() == 0.0f
Definition at line 394 of file SPK_Particle.h.
void kill | ( | ) |
Kills this Particle.
This method is equivalent to a call to setLifeLeft(float) with life being 0.
Definition at line 404 of file SPK_Particle.h.
const Vector3D & oldPosition | ( | ) | const |
Gets the old position of the Particle.
This is the constant version of oldPosition()
Definition at line 369 of file SPK_Particle.h.
Vector3D & oldPosition | ( | ) |
Gets the old position of the Particle.
Definition at line 354 of file SPK_Particle.h.
const Vector3D & position | ( | ) | const |
Gets the position of the Particle.
This is the constant version of position()
Definition at line 359 of file SPK_Particle.h.
Vector3D & position | ( | ) |
Gets the position of the Particle.
Definition at line 344 of file SPK_Particle.h.
void setLifeLeft | ( | float | life | ) |
Sets the life left of the Particle.
When the Particle's life reaches 0, the Particle is inactivated.
life | : the amount of life left of the Particle |
Definition at line 339 of file SPK_Particle.h.
bool setParamCurrentValue | ( | ModelParam | type, | |
float | value | |||
) |
Sets the current value for the given parameter.
Note that the method will have no effect if the parameter is not enabled in the Particle's Model. In this case, the method returns false.
type | : the parameter to set | |
value | : the value of the parameter |
bool setParamFinalValue | ( | ModelParam | type, | |
float | value | |||
) |
Sets the final value for the given parameter.
The final value is the value the parameter will have at the end of the Particle's life.
Note that the method will have no effect if the parameter is not mutable in the Particle's Model. In this case, the method returns false and setParamCurrentValue(ModelParam,float) should be used.
type | : the parameter to set | |
value | : the value of the parameter |
const Vector3D & velocity | ( | ) | const |
Gets the velocity of the Particle.
This is the constant version of velocity()
Definition at line 364 of file SPK_Particle.h.
Vector3D & velocity | ( | ) |
Gets the velocity of the Particle.
Definition at line 349 of file SPK_Particle.h.