CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | 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

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 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 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< iLight * > &, 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

Friends

struct eiParticleState

Classes

struct  eiParticleState
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 69 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 269 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 276 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 253 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 290 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 262 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 226 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 243 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 245 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]
 

Set the alpha of particles.

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

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

Change color of all particles, by col per second.

Definition at line 248 of file particle.h.

void csNewParticleSystem::SetChangeRotation float  angle  )  [inline]
 

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

Definition at line 280 of file particle.h.

References CS_PARTICLE_ROTATE.

void csNewParticleSystem::SetChangeSize float  factor  )  [inline]
 

Change size of all particles, by factor per second.

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

void csNewParticleSystem::SetSelfDestruct csTicks  t  )  [inline]
 

Set selfdestruct mode on, and msec to live.

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

void csNewParticleSystem::UnsetChangeColor  )  [inline]
 

Stop change of color.

Definition at line 251 of file particle.h.

void csNewParticleSystem::UnsetChangeRotation  )  [inline]
 

Stop change of rotation.

Definition at line 288 of file particle.h.

void csNewParticleSystem::UnsetChangeSize  )  [inline]
 

Stop change of size.

Definition at line 260 of file particle.h.

void csNewParticleSystem::UnSetSelfDestruct  )  [inline]
 

system will no longer self destruct

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

csVector3 csNewParticleSystem::Axis [protected]
 

uniform axis alignment

Definition at line 128 of file particle.h.

bool csNewParticleSystem::change_alpha [protected]
 

Alpha change.

Definition at line 154 of file particle.h.

bool csNewParticleSystem::change_color [protected]
 

Color change.

Definition at line 150 of file particle.h.

bool csNewParticleSystem::change_rotation [protected]
 

Rotate particles, angle in radians.

Definition at line 156 of file particle.h.

bool csNewParticleSystem::change_size [protected]
 

Size change.

Definition at line 152 of file particle.h.

csColor csNewParticleSystem::Color [protected]
 

uniform base color

Definition at line 119 of file particle.h.

iMeshObjectFactory* csNewParticleSystem::Factory [protected]
 

the mesh factory (should be an empty frame)

Definition at line 73 of file particle.h.

csRef<iMaterialWrapper> csNewParticleSystem::Material [protected]
 

uniform material

Definition at line 125 of file particle.h.

uint csNewParticleSystem::MixMode [protected]
 

mixing mode

Definition at line 122 of file particle.h.

int csNewParticleSystem::ParticleCount [protected]
 

number of particles in the system

Definition at line 107 of file particle.h.

int csNewParticleSystem::ParticleFlags [protected]
 

flags

Definition at line 104 of file particle.h.

csVector3* csNewParticleSystem::PositionArray [protected]
 

position values

Definition at line 110 of file particle.h.

csTicks csNewParticleSystem::PrevTime [protected]
 

previous time in the NextFrame() method

Definition at line 131 of file particle.h.

csVector2 csNewParticleSystem::Scale [protected]
 

uniform scaling

Definition at line 113 of file particle.h.

bool csNewParticleSystem::self_destruct [protected]
 

Self destruct and when.

Definition at line 146 of file particle.h.

int csNewParticleSystem::StorageCount [protected]
 

currently allocated amount of storage for particles

Definition at line 101 of file particle.h.


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