CrystalSpace

Public API Reference

csParticleSystem Class Reference
[Common Plugin Classes]

This class represents a particle system. More...

#include <csplugincommon/particlesys/partgen.h>

Inherits scfImplementationExt2< csParticleSystem, csObjectModel, iMeshObject, iParticleState >.

Inherited by scfImplementationExt0< csNewtonianParticleSystem, csParticleSystem >, and scfImplementationExt0< csNewtonianParticleSystem, csParticleSystem >.

List of all members.

Public Member Functions

virtual void AddColor (const csColor &col)
 Add particle colors, convenience function.
void AppendParticle (iMeshObject *mesh, iParticle *part, iSprite2DState *spr2d)
 Add a new particle, increases num_particles. Do a DecRef yourself.
void AppendRectSprite (float width, float height, iMaterialWrapper *mat, bool lighted)
 Add an rectangle shaped sprite2d particle.
void AppendRegularSprite (int n, float radius, iMaterialWrapper *mat, bool lighted)
 Add a sprite2d n-gon with material, and given radius.
virtual void BuildDecal (const csVector3 *pos, float decalRadius, iDecalBuilder *decalBuilder)
 see imesh/object.h for specification.
 csParticleSystem (iObjectRegistry *object_reg, iMeshObjectFactory *factory)
 Make a new system.
float GetAlpha () const
 Get the probable alpha of the particles.
const csBox3GetBoundingBox () const
 Get the bounding box for this particle system.
bool GetChangeAlpha (float &factor) const
 see if change alpha is enabled, and get the value if so.
bool GetChangeColor (csColor &col) const
 see if change color is enabled, and get a copy if so.
bool GetChangeRotation (float &angle) const
 see if change rotation is enabled, and get the angle if so.
bool GetChangeSize (float &factor) const
 see if change size is enabled, and get the value if so.
size_t GetNumParticles () const
 How many particles the system currently has.
iParticleGetParticle (size_t idx) const
 Get a particle.
size_t GetParticleCount () const
 Get the number of particles.
bool GetSelfDestruct () const
 returns whether the system will self destruct
csTicks GetTimeToLive () const
 if the system will self destruct, returns the time to live in msec.
virtual void PositionChild (iMeshObject *, csTicks)
 see imesh/object.h for specification.
void RemoveParticles ()
 Remove all particles.
virtual void Rotate (float angle)
 Rotate all particles.
virtual void ScaleBy (float factor)
 Scale all particles.
void SetAlpha (float alpha)
 Set the alpha of particles.
void SetChangeAlpha (float factor)
 Change alpha of all particles, by factor per second.
void SetChangeColor (const csColor &col)
 Change color of all particles, by col per second.
void SetChangeRotation (float angle)
 Change rotation of all particles, by angle in radians per second.
void SetChangeSize (float factor)
 Change size of all particles, by factor per second.
virtual void SetParticleCount (size_t num)
 Set the number of particles to use.
void SetSelfDestruct (csTicks t)
 Set selfdestruct mode on, and msec to live.
virtual void SetupColor ()
 Set particle colors, convenience function.
virtual void SetupMixMode ()
 Set particle mixmodes, convenience function.
void UnsetChangeAlpha ()
 Stop change of alpha.
void UnsetChangeColor ()
 Stop change of color.
void UnsetChangeRotation ()
 Stop change of rotation.
void UnsetChangeSize ()
 Stop change of size.
void UnSetSelfDestruct ()
 system will no longer self destruct
virtual void Update (csTicks elapsed_time)
 Update the state of the particles as time has passed.
virtual ~csParticleSystem ()
 Destroy particle system, and all particles.

Protected Member Functions

csVector3 GetRandomDirection ()
 Return vector with -1..+1 members. Varying length.
csVector3 GetRandomDirection (csVector3 const &magnitude, csVector3 const &offset)
 Return vector with -1..+1 members. Varying length.
csVector3 GetRandomPosition (csBox3 const &box)
 Return vector with random position within box.
void SetupBuffers (size_t part_sides)
 Setup the buffers for the particles.
virtual void SetupObject ()
 Setup this object.

Protected Attributes

csBox3 bbox
 bounding box in 3d of all particles in this system.
bool change_alpha
 Alpha change.
bool change_color
 Color change.
bool change_rotation
 Rotate particles, angle in radians.
bool change_size
 Size change.
csColor color
 Color of all particles.
csRef< iMaterialWrappermat
 Material for all particles.
uint MixMode
 MixMode for all particles.
csVector3part_pos
 particle position
csRefArray< iMeshObjectpartmeshes
 iParticle ptrs to the particles.
csTicks prev_time
 Previous time.
float radius
 Object space radius.
bool self_destruct
 Self destruct and when.
csRef< iMeshObjectFactoryspr_factory
 Pointer to a mesh object factory for 2D sprites.

Detailed Description

This class represents a particle system.

It is a set of iParticles. Subclasses of this class may be of more interest to users. More specialised particle systems can be found below.

Definition at line 63 of file partgen.h.


Constructor & Destructor Documentation

csParticleSystem::csParticleSystem ( iObjectRegistry object_reg,
iMeshObjectFactory factory 
)

Make a new system.

Also adds the particle system to the list of the current engine.

virtual csParticleSystem::~csParticleSystem (  )  [virtual]

Destroy particle system, and all particles.


Member Function Documentation

virtual void csParticleSystem::AddColor ( const csColor col  )  [virtual]

Add particle colors, convenience function.

void csParticleSystem::AppendParticle ( iMeshObject mesh,
iParticle part,
iSprite2DState spr2d 
) [inline]

Add a new particle, increases num_particles. Do a DecRef yourself.

Definition at line 193 of file partgen.h.

void csParticleSystem::AppendRectSprite ( float  width,
float  height,
iMaterialWrapper mat,
bool  lighted 
)

Add an rectangle shaped sprite2d particle.

Pass along half w and h. adds sprite to engine list.

void csParticleSystem::AppendRegularSprite ( int  n,
float  radius,
iMaterialWrapper mat,
bool  lighted 
)

Add a sprite2d n-gon with material, and given radius.

adds sprite to engine list.

virtual void csParticleSystem::BuildDecal ( const csVector3 pos,
float  decalRadius,
iDecalBuilder decalBuilder 
) [inline, virtual]

see imesh/object.h for specification.

The default implementation does nothing.

Definition at line 387 of file partgen.h.

float csParticleSystem::GetAlpha (  )  const [inline]

Get the probable alpha of the particles.

Definition at line 247 of file partgen.h.

const csBox3& csParticleSystem::GetBoundingBox (  )  const [inline]

Get the bounding box for this particle system.

Definition at line 267 of file partgen.h.

bool csParticleSystem::GetChangeAlpha ( float &  factor  )  const [inline]

see if change alpha is enabled, and get the value if so.

Definition at line 254 of file partgen.h.

bool csParticleSystem::GetChangeColor ( csColor col  )  const [inline]

see if change color is enabled, and get a copy if so.

Definition at line 231 of file partgen.h.

bool csParticleSystem::GetChangeRotation ( float &  angle  )  const [inline]

see if change rotation is enabled, and get the angle if so.

Definition at line 263 of file partgen.h.

bool csParticleSystem::GetChangeSize ( float &  factor  )  const [inline]

see if change size is enabled, and get the value if so.

Definition at line 240 of file partgen.h.

size_t csParticleSystem::GetNumParticles (  )  const [inline]

How many particles the system currently has.

Definition at line 185 of file partgen.h.

iParticle* csParticleSystem::GetParticle ( size_t  idx  )  const [inline]

Get a particle.

Definition at line 187 of file partgen.h.

size_t csParticleSystem::GetParticleCount (  )  const [inline]

Get the number of particles.

Definition at line 179 of file partgen.h.

csVector3 csParticleSystem::GetRandomDirection (  )  [protected]

Return vector with -1..+1 members. Varying length.

csVector3 csParticleSystem::GetRandomDirection ( csVector3 const &  magnitude,
csVector3 const &  offset 
) [protected]

Return vector with -1..+1 members. Varying length.

csVector3 csParticleSystem::GetRandomPosition ( csBox3 const &  box  )  [protected]

Return vector with random position within box.

bool csParticleSystem::GetSelfDestruct (  )  const [inline]

returns whether the system will self destruct

Definition at line 221 of file partgen.h.

csTicks csParticleSystem::GetTimeToLive (  )  const [inline]

if the system will self destruct, returns the time to live in msec.

Definition at line 223 of file partgen.h.

virtual void csParticleSystem::PositionChild ( iMeshObject ,
csTicks   
) [inline, virtual]

see imesh/object.h for specification.

The default implementation does nothing.

Definition at line 381 of file partgen.h.

void csParticleSystem::RemoveParticles (  ) 

Remove all particles.

virtual void csParticleSystem::Rotate ( float  angle  )  [virtual]

Rotate all particles.

virtual void csParticleSystem::ScaleBy ( float  factor  )  [virtual]

Scale all particles.

void csParticleSystem::SetAlpha ( float  alpha  )  [inline]

Set the alpha of particles.

Definition at line 244 of file partgen.h.

void csParticleSystem::SetChangeAlpha ( float  factor  )  [inline]

Change alpha of all particles, by factor per second.

Definition at line 249 of file partgen.h.

void csParticleSystem::SetChangeColor ( const csColor col  )  [inline]

Change color of all particles, by col per second.

Definition at line 226 of file partgen.h.

void csParticleSystem::SetChangeRotation ( float  angle  )  [inline]

Change rotation of all particles, by angle in radians per second.

Definition at line 258 of file partgen.h.

void csParticleSystem::SetChangeSize ( float  factor  )  [inline]

Change size of all particles, by factor per second.

Definition at line 235 of file partgen.h.

virtual void csParticleSystem::SetParticleCount ( size_t  num  )  [inline, virtual]

Set the number of particles to use.

Definition at line 173 of file partgen.h.

void csParticleSystem::SetSelfDestruct ( csTicks  t  )  [inline]

Set selfdestruct mode on, and msec to live.

Definition at line 216 of file partgen.h.

void csParticleSystem::SetupBuffers ( size_t  part_sides  )  [protected]

Setup the buffers for the particles.

virtual void csParticleSystem::SetupColor (  )  [virtual]

Set particle colors, convenience function.

virtual void csParticleSystem::SetupMixMode (  )  [virtual]

Set particle mixmodes, convenience function.

virtual void csParticleSystem::SetupObject (  )  [protected, virtual]

Setup this object.

void csParticleSystem::UnsetChangeAlpha (  )  [inline]

Stop change of alpha.

Definition at line 252 of file partgen.h.

void csParticleSystem::UnsetChangeColor (  )  [inline]

Stop change of color.

Definition at line 229 of file partgen.h.

void csParticleSystem::UnsetChangeRotation (  )  [inline]

Stop change of rotation.

Definition at line 261 of file partgen.h.

void csParticleSystem::UnsetChangeSize (  )  [inline]

Stop change of size.

Definition at line 238 of file partgen.h.

void csParticleSystem::UnSetSelfDestruct (  )  [inline]

system will no longer self destruct

Definition at line 219 of file partgen.h.

virtual void csParticleSystem::Update ( csTicks  elapsed_time  )  [virtual]

Update the state of the particles as time has passed.

i.e. move the particles, retexture, recolor ... this member function will set to_delete if self_destruct is enabled and time is up.


Member Data Documentation

bounding box in 3d of all particles in this system.

the particle system subclass has to give this a reasonable value. no particle may exceed the bbox.

Definition at line 101 of file partgen.h.

Alpha change.

Definition at line 93 of file partgen.h.

Color change.

Definition at line 89 of file partgen.h.

Rotate particles, angle in radians.

Definition at line 95 of file partgen.h.

Size change.

Definition at line 91 of file partgen.h.

Color of all particles.

Definition at line 83 of file partgen.h.

Material for all particles.

Definition at line 85 of file partgen.h.

MixMode for all particles.

Definition at line 87 of file partgen.h.

particle position

Definition at line 116 of file partgen.h.

iParticle ptrs to the particles.

Definition at line 76 of file partgen.h.

Previous time.

Definition at line 107 of file partgen.h.

float csParticleSystem::radius [protected]

Object space radius.

Definition at line 74 of file partgen.h.

Self destruct and when.

Definition at line 80 of file partgen.h.

Pointer to a mesh object factory for 2D sprites.

Definition at line 105 of file partgen.h.


The documentation for this class was generated from the following file:

Generated for Crystal Space 1.4.1 by doxygen 1.7.1