CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csNewParticleSystem Class Reference
[Common Plugin Classes]

This is an abstract implementation of a particle system mesh object. More...

#include <csplugincommon/particlesys/particle.h>

Inheritance diagram for csNewParticleSystem:

csMeshObject iMeshObject iBase List of all members.

Public Member Functions

 csNewParticleSystem (iEngine *, iMeshObjectFactory *, int ParticleFlags)
 constructor
virtual ~csNewParticleSystem ()
 destructor
void SetCount (int num)
 grow or shrink the storage area to the specified amount of particles
void Compact ()
 free as much storage area as possible
void UpdateBounds ()
 update the bounding box based on particle positions
virtual void Update (csTicks passedTime)
 update the system.
virtual iMeshObjectFactoryGetFactory () const
 Returns 0 since there is no factory for a particle system.
virtual csRenderMesh ** GetRenderMeshes (int &n, iRenderView *rview, iMovable *movable, uint32 frustum_mask)
 See imesh/object.h for specification.
void UpdateLighting (const csArray< iLight * > &, iMovable *)
 update lighting info
virtual void NextFrame (csTicks current_time, const csVector3 &pos)
 calls Update() with the amount of time passed since the previous call
virtual bool SetColor (const csColor &color)
 Set the base color.
virtual void AddColor (const csColor &color)
 Add to the current color.
virtual const csColorGetColor () const
 Return the base color.
virtual bool SetMaterialWrapper (iMaterialWrapper *material)
 Set the material to use.
virtual iMaterialWrapperGetMaterialWrapper () const
 Return the current material.
virtual bool GetLighting () const
 Return whether this particle system applies lighting.
virtual void SetLighting (bool enable)
 Set whether this particle system applies lighting.
virtual void GetObjectBoundingBox (csBox3 &bbox)
 See igeom/objmodel.h for specification.
virtual void SetObjectBoundingBox (const csBox3 &bbox)
 See igeom/objmodel.h for specification.
void SetSelfDestruct (csTicks t)
 Set selfdestruct mode on, and msec to live.
void UnSetSelfDestruct ()
 system will no longer self destruct
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.
void SetChangeColor (const csColor &col)
 Change color of all particles, by col per second.
void UnsetChangeColor ()
 Stop change of color.
bool GetChangeColor (csColor &col) const
 see if change color is enabled, and get a copy if so.
void SetChangeSize (float factor)
 Change size of all particles, by factor per second.
void UnsetChangeSize ()
 Stop change of size.
bool GetChangeSize (float &factor) const
 see if change size is enabled, and get the value if so.
void SetAlpha (float alpha)
 Set the alpha of particles.
float GetAlpha () const
 Get the probable alpha of the particles.
void SetChangeAlpha (float factor)
 Change alpha of all particles, by factor per second.
void UnsetChangeAlpha ()
 Stop change of alpha.
bool GetChangeAlpha (float &factor) const
 see if change alpha is enabled, and get the value if so.
void SetChangeRotation (float angle)
 Change rotation of all particles, by angle in radians per second.
void UnsetChangeRotation ()
 Stop change of rotation.
bool GetChangeRotation (float &angle) const
 see if change rotation is enabled, and get the angle if so.

Protected Member Functions

virtual void Allocate (int newsize, int copysize)
 This function re-allocates the data arrays to 'newsize' and copies 'copysize' items from the old arrays.
void SetupParticles (const csReversibleTransform &, csVector3 *vertices)
 Setup particles in the given tables right before they are drawn.

Protected Attributes

iMeshObjectFactoryFactory
 the mesh factory (should be an empty frame)
int StorageCount
 currently allocated amount of storage for particles
int ParticleFlags
 flags
int ParticleCount
 number of particles in the system
csVector3PositionArray
 position values
csVector2 Scale
 uniform scaling
float Angle
 uniform rotation
csColor Color
 uniform base color
uint MixMode
 mixing mode
csRef< iMaterialWrapperMaterial
 uniform material
csVector3 Axis
 uniform axis alignment
csTicks PrevTime
 previous time in the NextFrame() method
bool self_destruct
 Self destruct and when.
bool change_color
 Color change.
bool change_size
 Size change.
bool change_alpha
 Alpha change.
bool change_rotation
 Rotate particles, angle in radians.

Detailed Description

This is an abstract implementation of a particle system mesh object.

It stores particle information (like position, rotation, scale, etc.) and knows how to draw the particles. It is abstract because it does not know how the particles move. This is done in the Update() method which must be implemented by subclasses. All features like scale and rotation can be disabled, enabled with global values and enabled with per-particle values.

Definition at line 65 of file particle.h.


Constructor & Destructor Documentation

csNewParticleSystem::csNewParticleSystem iEngine ,
iMeshObjectFactory ,
int  ParticleFlags
 

constructor

virtual csNewParticleSystem::~csNewParticleSystem  )  [virtual]
 

destructor


Member Function Documentation

virtual void csNewParticleSystem::AddColor const csColor color  )  [virtual]
 

Add to the current color.

virtual void csNewParticleSystem::Allocate int  newsize,
int  copysize
[protected, virtual]
 

This function re-allocates the data arrays to 'newsize' and copies 'copysize' items from the old arrays.

Subclasses can override this method to get notified (when they use their own arrays).

void csNewParticleSystem::Compact  ) 
 

free as much storage area as possible

float csNewParticleSystem::GetAlpha  )  const [inline]
 

Get the probable alpha of the particles.

Definition at line 261 of file particle.h.

bool csNewParticleSystem::GetChangeAlpha float &  factor  )  const [inline]
 

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

Definition at line 268 of file particle.h.

bool csNewParticleSystem::GetChangeColor csColor col  )  const [inline]
 

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

Definition at line 245 of file particle.h.

bool csNewParticleSystem::GetChangeRotation float &  angle  )  const [inline]
 

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

Definition at line 282 of file particle.h.

bool csNewParticleSystem::GetChangeSize float &  factor  )  const [inline]
 

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

Definition at line 254 of file particle.h.

virtual const csColor& csNewParticleSystem::GetColor  )  const [virtual]
 

Return the base color.

virtual iMeshObjectFactory* csNewParticleSystem::GetFactory  )  const [virtual]
 

Returns 0 since there is no factory for a particle system.

Implements csMeshObject.

virtual bool csNewParticleSystem::GetLighting  )  const [virtual]
 

Return whether this particle system applies lighting.

virtual iMaterialWrapper* csNewParticleSystem::GetMaterialWrapper  )  const [virtual]
 

Return the current material.

Reimplemented from csMeshObject.

virtual void csNewParticleSystem::GetObjectBoundingBox csBox3 bbox  )  [inline, virtual]
 

See igeom/objmodel.h for specification.

The default implementation returns an infinite bounding box.

Reimplemented from csMeshObject.

Definition at line 218 of file particle.h.

virtual csRenderMesh** csNewParticleSystem::GetRenderMeshes int &  n,
iRenderView rview,
iMovable movable,
uint32  frustum_mask
[virtual]
 

See imesh/object.h for specification.

The default implementation does nothing and always returns 0. @@ Note: in future it would be better that the default implementation does nothing as this function has to be implemented by mesh objects.

Reimplemented from csMeshObject.

bool csNewParticleSystem::GetSelfDestruct  )  const [inline]
 

returns whether the system will self destruct

Definition at line 235 of file particle.h.

csTicks csNewParticleSystem::GetTimeToLive  )  const [inline]
 

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

Definition at line 237 of file particle.h.

References csTicks.

virtual void csNewParticleSystem::NextFrame csTicks  current_time,
const csVector3 pos
[virtual]
 

calls Update() with the amount of time passed since the previous call

Reimplemented from csMeshObject.

void csNewParticleSystem::SetAlpha float  alpha  )  [inline]
 

Set the alpha of particles.

Definition at line 258 of file particle.h.

References CS_FX_SETALPHA.

void csNewParticleSystem::SetChangeAlpha float  factor  )  [inline]
 

Change alpha of all particles, by factor per second.

Definition at line 263 of file particle.h.

void csNewParticleSystem::SetChangeColor const csColor col  )  [inline]
 

Change color of all particles, by col per second.

Definition at line 240 of file particle.h.

void csNewParticleSystem::SetChangeRotation float  angle  )  [inline]
 

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

Definition at line 272 of file particle.h.

void csNewParticleSystem::SetChangeSize float  factor  )  [inline]
 

Change size of all particles, by factor per second.

Definition at line 249 of file particle.h.

virtual bool csNewParticleSystem::SetColor const csColor color  )  [virtual]
 

Set the base color.

Reimplemented from csMeshObject.

void csNewParticleSystem::SetCount int  num  ) 
 

grow or shrink the storage area to the specified amount of particles

virtual void csNewParticleSystem::SetLighting bool  enable  )  [virtual]
 

Set whether this particle system applies lighting.

virtual bool csNewParticleSystem::SetMaterialWrapper iMaterialWrapper material  )  [virtual]
 

Set the material to use.

Reimplemented from csMeshObject.

virtual void csNewParticleSystem::SetObjectBoundingBox const csBox3 bbox  )  [inline, virtual]
 

See igeom/objmodel.h for specification.

Overrides the default bounding box.

Reimplemented from csMeshObject.

Definition at line 223 of file particle.h.

void csNewParticleSystem::SetSelfDestruct csTicks  t  )  [inline]
 

Set selfdestruct mode on, and msec to live.

Definition at line 230 of file particle.h.

void csNewParticleSystem::SetupParticles const csReversibleTransform ,
csVector3 vertices
[protected]
 

Setup particles in the given tables right before they are drawn.

void csNewParticleSystem::UnsetChangeAlpha  )  [inline]
 

Stop change of alpha.

Definition at line 266 of file particle.h.

void csNewParticleSystem::UnsetChangeColor  )  [inline]
 

Stop change of color.

Definition at line 243 of file particle.h.

void csNewParticleSystem::UnsetChangeRotation  )  [inline]
 

Stop change of rotation.

Definition at line 280 of file particle.h.

void csNewParticleSystem::UnsetChangeSize  )  [inline]
 

Stop change of size.

Definition at line 252 of file particle.h.

void csNewParticleSystem::UnSetSelfDestruct  )  [inline]
 

system will no longer self destruct

Definition at line 233 of file particle.h.

virtual void csNewParticleSystem::Update csTicks  passedTime  )  [virtual]
 

update the system.

void csNewParticleSystem::UpdateBounds  ) 
 

update the bounding box based on particle positions

void csNewParticleSystem::UpdateLighting const csArray< iLight * > &  ,
iMovable
 

update lighting info


Member Data Documentation

float csNewParticleSystem::Angle [protected]
 

uniform rotation

Definition at line 108 of file particle.h.

csVector3 csNewParticleSystem::Axis [protected]
 

uniform axis alignment

Definition at line 120 of file particle.h.

bool csNewParticleSystem::change_alpha [protected]
 

Alpha change.

Definition at line 146 of file particle.h.

bool csNewParticleSystem::change_color [protected]
 

Color change.

Definition at line 142 of file particle.h.

bool csNewParticleSystem::change_rotation [protected]
 

Rotate particles, angle in radians.

Definition at line 148 of file particle.h.

bool csNewParticleSystem::change_size [protected]
 

Size change.

Definition at line 144 of file particle.h.

csColor csNewParticleSystem::Color [protected]
 

uniform base color

Definition at line 111 of file particle.h.

iMeshObjectFactory* csNewParticleSystem::Factory [protected]
 

the mesh factory (should be an empty frame)

Definition at line 69 of file particle.h.

csRef<iMaterialWrapper> csNewParticleSystem::Material [protected]
 

uniform material

Definition at line 117 of file particle.h.

uint csNewParticleSystem::MixMode [protected]
 

mixing mode

Definition at line 114 of file particle.h.

int csNewParticleSystem::ParticleCount [protected]
 

number of particles in the system

Definition at line 99 of file particle.h.

int csNewParticleSystem::ParticleFlags [protected]
 

flags

Definition at line 96 of file particle.h.

csVector3* csNewParticleSystem::PositionArray [protected]
 

position values

Definition at line 102 of file particle.h.

csTicks csNewParticleSystem::PrevTime [protected]
 

previous time in the NextFrame() method

Definition at line 123 of file particle.h.

csVector2 csNewParticleSystem::Scale [protected]
 

uniform scaling

Definition at line 105 of file particle.h.

bool csNewParticleSystem::self_destruct [protected]
 

Self destruct and when.

Definition at line 138 of file particle.h.

int csNewParticleSystem::StorageCount [protected]
 

currently allocated amount of storage for particles

Definition at line 93 of file particle.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1