Particle Class Reference

A single particle (a point in space with a velocity and different parameters). More...

List of all members.

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.
Vector3Dposition ()
 Gets the position of the Particle.
Vector3Dvelocity ()
 Gets the velocity of the Particle.
Vector3DoldPosition ()
 Gets the old position of the Particle.
const Vector3Dposition () const
 Gets the position of the Particle.
const Vector3Dvelocity () const
 Gets the velocity of the Particle.
const Vector3DoldPosition () 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.
ModelgetModel () const
 Gets the Model of this Particle.
GroupgetGroup () 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.

Detailed Description

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.


Member Function Documentation

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).

Parameters:
type : the parameter to set
delta : the delta
Returns:
true if the parameter can be changed, false otherwise (if the parameter is not enabled)
Since:
1.02.00
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).

Parameters:
type : the parameter to set
delta : the delta
Returns:
true if the parameter can be changed, false otherwise (if the parameter is not mutable)
Since:
1.02.00
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.

Returns:
the age of the particle
Since:
1.03.00

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.

Returns:
the distance of this Particle from the camera
Since:
1.01.00

Definition at line 384 of file SPK_Particle.h.

Group * getGroup (  )  const

Gets the group of this Particle.

Returns:
A pointer on the Group of this Particle
Since:
1.02.00

Definition at line 329 of file SPK_Particle.h.

size_t getIndex (  )  const

Gets the index of this Particle in its Group.

Returns:
the index of thi Particle in its Group
Since:
1.03.00

Definition at line 334 of file SPK_Particle.h.

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.

Returns:
the amount of life left

Definition at line 374 of file SPK_Particle.h.

Model* getModel (  )  const

Gets the Model of this Particle.

Returns:
A pointer on the Model of this Particle
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.

Parameters:
type : the parameter to get the value
Returns:
the current value of the parameter
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.

Parameters:
type : the parameter to get the value
Returns:
the current value of the parameter
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.

Returns:
the square distance of this Particle from the camera
Since:
1.01.00

Definition at line 389 of file SPK_Particle.h.

void init (  ) 

Initializes the Particle.

When a Particle is initialized, all its parameters are reinitialized as well as its life.

bool isAlive (  )  const

Tells whether this Particle is alive or not.

A call to this method is equivalent to getLifeLeft > 0.0f

Returns:
true if this Particle is alive, false if it is dead
Since:
1.04.00

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

Returns:
true if this Particle was initialized at its latest update, false if not
Since:
1.03.00

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.

Since:
1.01.00

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()

Returns:
the old position of this Particle
Since:
1.02.00

Definition at line 369 of file SPK_Particle.h.

Vector3D & oldPosition (  ) 

Gets the old position of the Particle.

Returns:
the old position of this Particle
Since:
1.02.00

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()

Returns:
the position of this Particle
Since:
1.02.00

Definition at line 359 of file SPK_Particle.h.

Vector3D & position (  ) 

Gets the position of the Particle.

Returns:
the position of this Particle
Since:
1.02.00

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.

Parameters:
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.

Parameters:
type : the parameter to set
value : the value of the parameter
Returns:
true if the parameter can be set, false otherwise (if the parameter is not enabled)
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.

Parameters:
type : the parameter to set
value : the value of the parameter
Returns:
true if the parameter can be set, false otherwise (if the parameter is not mutable)
const Vector3D & velocity (  )  const

Gets the velocity of the Particle.

This is the constant version of velocity()

Returns:
the velocity of this Particle
Since:
1.02.00

Definition at line 364 of file SPK_Particle.h.

Vector3D & velocity (  ) 

Gets the velocity of the Particle.

Returns:
the velocity of this Particle
Since:
1.02.00

Definition at line 349 of file SPK_Particle.h.


Generated on Wed Apr 27 21:09:26 2011 for SPARK Particle Engine by  doxygen 1.6.1