CrystalSpace

Public API Reference

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:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual void AddColor (const csColor &color)
 Add to the current color.
void Compact ()
 free as much storage area as possible
 csNewParticleSystem (iEngine *, iMeshObjectFactory *, int ParticleFlags)
 constructor
float GetAlpha () const
 Get the probable alpha of the particles.
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.
virtual const csColorGetColor () const
 Return the base color.
virtual iMeshObjectFactoryGetFactory () const
 Returns 0 since there is no factory for a particle system.
virtual bool GetLighting () const
 Return whether this particle system applies lighting.
virtual iMaterialWrapperGetMaterialWrapper () const
 Return the current material.
virtual uint GetMixMode () const
 Get mix mode.
virtual void GetObjectBoundingBox (csBox3 &bbox)
 See igeom/objmodel.h for specification.
virtual csRenderMesh ** GetRenderMeshes (int &n, iRenderView *rview, iMovable *movable, uint32 frustum_mask)
 See imesh/object.h for specification.
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 NextFrame (csTicks current_time, const csVector3 &pos)
 calls Update() with the amount of time passed since the previous call
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 bool SetColor (const csColor &color)
 Set the base color.
void SetCount (int num)
 grow or shrink the storage area to the specified amount of particles
virtual void SetLighting (bool enable)
 Set whether this particle system applies lighting.
virtual bool SetMaterialWrapper (iMaterialWrapper *material)
 Set the material to use.
virtual void SetMixMode (uint mode)
 Set mix mode. Default implementation doesn't do anything.
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 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 passedTime)
 update the system.
void UpdateBounds ()
 update the bounding box based on particle positions
void UpdateLighting (const csArray< iLightSectorInfluence * > &, iMovable *)
 update lighting info
virtual ~csNewParticleSystem ()
 destructor

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

float alpha_now
float alphapersecond
float Angle
 uniform rotation
float anglepersecond
csVector3 Axis
 uniform axis alignment
csBox3 Bounds
bool change_alpha
 Alpha change.
bool change_color
 Color change.
bool change_rotation
 Rotate particles, angle in radians.
bool change_size
 Size change.
int ClipPlane
int ClipPortal
int ClipZ
csColor Color
 uniform base color
csRef< iRenderBuffercolor_buffer
csColor colorpersecond
csColorcolors
iMeshObjectFactoryFactory
 the mesh factory (should be an empty frame)
csWeakRef< iGraphics3Dg3d
csRef< iRenderBufferindex_buffer
bool initialized
uint lastDataUpdateFrame
csRef< iLightManagerlight_mgr
bool Lighting
csColorLitColors
csRef< iMaterialWrapperMaterial
 uniform material
uint MixMode
 mixing mode
csRef< iRenderBuffernormal_buffer
int ParticleCount
 number of particles in the system
int ParticleFlags
 flags
csFrameDataHolder< PerFrameDataperFrameHolder
csVector3PositionArray
 position values
csTicks PrevTime
 previous time in the NextFrame() method
csRenderMeshHolder rmHolder
csVector2 Scale
 uniform scaling
float scalepersecond
bool self_destruct
 Self destruct and when.
int StorageCount
 currently allocated amount of storage for particles
csRef< iRenderBuffertexel_buffer
csVector2texels
csTicks time_to_live
int TriangleCount
csTriangletriangles
int VertexCount

Classes

struct  PerFrameData

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 70 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, virtual]
 

Get the probable alpha of the particles.

Implements iParticleState.

Definition at line 270 of file particle.h.

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

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

Implements iParticleState.

Definition at line 277 of file particle.h.

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

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

Implements iParticleState.

Definition at line 254 of file particle.h.

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

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

Implements iParticleState.

Definition at line 291 of file particle.h.

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

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

Implements iParticleState.

Definition at line 263 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 uint csNewParticleSystem::GetMixMode  )  const [inline, virtual]
 

Get mix mode.

Reimplemented from csMeshObject.

Definition at line 295 of file particle.h.

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

Reimplemented from csMeshObject.

bool csNewParticleSystem::GetSelfDestruct  )  const [inline]
 

returns whether the system will self destruct

Definition at line 244 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 246 of file particle.h.

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, virtual]
 

Set the alpha of particles.

Implements iParticleState.

Definition at line 267 of file particle.h.

References CS_FX_SETALPHA.

void csNewParticleSystem::SetChangeAlpha float  factor  )  [inline, virtual]
 

Change alpha of all particles, by factor per second.

Implements iParticleState.

Definition at line 272 of file particle.h.

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

Change color of all particles, by col per second.

Implements iParticleState.

Definition at line 249 of file particle.h.

void csNewParticleSystem::SetChangeRotation float  angle  )  [inline, virtual]
 

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

Implements iParticleState.

Definition at line 281 of file particle.h.

References CS_PARTICLE_ROTATE.

void csNewParticleSystem::SetChangeSize float  factor  )  [inline, virtual]
 

Change size of all particles, by factor per second.

Implements iParticleState.

Definition at line 258 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::SetMixMode uint  mode  )  [inline, virtual]
 

Set mix mode. Default implementation doesn't do anything.

Reimplemented from csMeshObject.

Definition at line 294 of file particle.h.

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 232 of file particle.h.

void csNewParticleSystem::SetSelfDestruct csTicks  t  )  [inline, virtual]
 

Set selfdestruct mode on, and msec to live.

Implements iParticleState.

Definition at line 239 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, virtual]
 

Stop change of alpha.

Implements iParticleState.

Definition at line 275 of file particle.h.

void csNewParticleSystem::UnsetChangeColor  )  [inline, virtual]
 

Stop change of color.

Implements iParticleState.

Definition at line 252 of file particle.h.

void csNewParticleSystem::UnsetChangeRotation  )  [inline, virtual]
 

Stop change of rotation.

Implements iParticleState.

Definition at line 289 of file particle.h.

void csNewParticleSystem::UnsetChangeSize  )  [inline, virtual]
 

Stop change of size.

Implements iParticleState.

Definition at line 261 of file particle.h.

void csNewParticleSystem::UnSetSelfDestruct  )  [inline, virtual]
 

system will no longer self destruct

Implements iParticleState.

Definition at line 242 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< iLightSectorInfluence * > &  ,
iMovable
 

update lighting info


Member Data Documentation

float csNewParticleSystem::Angle [protected]
 

uniform rotation

Definition at line 119 of file particle.h.

csVector3 csNewParticleSystem::Axis [protected]
 

uniform axis alignment

Definition at line 131 of file particle.h.

bool csNewParticleSystem::change_alpha [protected]
 

Alpha change.

Definition at line 157 of file particle.h.

bool csNewParticleSystem::change_color [protected]
 

Color change.

Definition at line 153 of file particle.h.

bool csNewParticleSystem::change_rotation [protected]
 

Rotate particles, angle in radians.

Definition at line 159 of file particle.h.

bool csNewParticleSystem::change_size [protected]
 

Size change.

Definition at line 155 of file particle.h.

csColor csNewParticleSystem::Color [protected]
 

uniform base color

Definition at line 122 of file particle.h.

iMeshObjectFactory* csNewParticleSystem::Factory [protected]
 

the mesh factory (should be an empty frame)

Definition at line 76 of file particle.h.

csRef<iMaterialWrapper> csNewParticleSystem::Material [protected]
 

uniform material

Definition at line 128 of file particle.h.

uint csNewParticleSystem::MixMode [protected]
 

mixing mode

Definition at line 125 of file particle.h.

int csNewParticleSystem::ParticleCount [protected]
 

number of particles in the system

Definition at line 110 of file particle.h.

int csNewParticleSystem::ParticleFlags [protected]
 

flags

Definition at line 107 of file particle.h.

csVector3* csNewParticleSystem::PositionArray [protected]
 

position values

Definition at line 113 of file particle.h.

csTicks csNewParticleSystem::PrevTime [protected]
 

previous time in the NextFrame() method

Definition at line 134 of file particle.h.

csVector2 csNewParticleSystem::Scale [protected]
 

uniform scaling

Definition at line 116 of file particle.h.

bool csNewParticleSystem::self_destruct [protected]
 

Self destruct and when.

Definition at line 149 of file particle.h.

int csNewParticleSystem::StorageCount [protected]
 

currently allocated amount of storage for particles

Definition at line 104 of file particle.h.


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