csParticleSystem Class Reference
[Common Plugin Classes]
This class represents a particle system.
More...
#include <csplugincommon/particlesys/partgen.h>
Inheritance diagram for csParticleSystem:

Public Member Functions | |
csParticleSystem (iObjectRegistry *object_reg, iMeshObjectFactory *factory) | |
Make a new system. | |
virtual | ~csParticleSystem () |
Destroy particle system, and all particles. | |
virtual void | SetParticleCount (size_t num) |
Set the number of particles to use. | |
size_t | GetParticleCount () const |
Get the number of particles. | |
size_t | GetNumParticles () const |
How many particles the system currently has. | |
iParticle * | GetParticle (size_t idx) const |
Get a particle. | |
void | RemoveParticles () |
Remove all particles. | |
void | AppendParticle (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. | |
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. | |
const csBox3 & | GetBoundingBox () const |
Get the bounding box for this particle system. | |
virtual void | SetupColor () |
Set particle colors, convenience function. | |
virtual void | AddColor (const csColor &col) |
Add particle colors, convenience function. | |
virtual void | ScaleBy (float factor) |
Scale all particles. | |
virtual void | SetupMixMode () |
Set particle mixmodes, convenience function. | |
virtual void | Rotate (float angle) |
Rotate all particles. | |
virtual void | Update (csTicks elapsed_time) |
Update the state of the particles as time has passed. | |
virtual iMeshObjectFactory * | GetFactory () const |
Get the reference to the factory that created this mesh object. | |
virtual csFlags & | GetFlags () |
Get flags for this object. | |
virtual csPtr< iMeshObject > | Clone () |
Creates a copy of this object and returns the clone. | |
virtual csRenderMesh ** | GetRenderMeshes (int &n, iRenderView *rview, iMovable *movable, uint32 frustum_mask) |
Returns the set of render meshes. | |
virtual void | SetVisibleCallback (iMeshObjectDrawCallback *cb) |
Register a callback to the mesh object which will be called from within Draw() if the mesh object thinks that the object is really visible. | |
virtual iMeshObjectDrawCallback * | GetVisibleCallback () const |
Get the current visible callback. | |
virtual void | NextFrame (csTicks current_time, const csVector3 &) |
Control animation of this object. | |
virtual bool | HitBeamOutline (const csVector3 &, const csVector3 &, csVector3 &, float *) |
Check if this mesh is hit by this object space vector. | |
virtual bool | HitBeamObject (const csVector3 &, const csVector3 &, csVector3 &, float *, int *=0) |
Check if this mesh is hit by this object space vector. | |
virtual void | SetLogicalParent (iBase *lp) |
Set a reference to some logical parent in the context that holds the mesh objects. | |
virtual iBase * | GetLogicalParent () const |
Get the logical parent for this mesh object. | |
virtual iObjectModel * | GetObjectModel () |
Get the generic interface describing the geometry of this mesh. | |
virtual bool | SetColor (const csColor &col) |
Set the base color of the mesh. | |
virtual bool | GetColor (csColor &col) const |
Get the base color of the mesh. | |
virtual bool | SetMaterialWrapper (iMaterialWrapper *mat) |
Set the material of the mesh. | |
virtual iMaterialWrapper * | GetMaterialWrapper () const |
Get the material of the mesh. | |
virtual void | InvalidateMaterialHandles () |
Material changed. | |
virtual void | PositionChild (iMeshObject *child, csTicks current_time) |
see imesh/object.h for specification. | |
Protected Member Functions | |
void | SetupBuffers (size_t part_sides) |
Setup the buffers for the particles. | |
virtual void | SetupObject () |
Setup this object. | |
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. | |
Protected Attributes | |
csVector3 | radius |
Object space radius. | |
csRefArray< iSprite2DState > | sprite2ds |
iParticle ptrs to the particles. | |
bool | self_destruct |
Self destruct and when. | |
csColor | color |
Color of all particles. | |
csRef< iMaterialWrapper > | mat |
Material for all particles. | |
uint | MixMode |
MixMode for all particles. | |
bool | change_color |
Color change. | |
bool | change_size |
Size change. | |
bool | change_alpha |
Alpha change. | |
bool | change_rotation |
Rotate particles, angle in radians. | |
csBox3 | bbox |
bounding box in 3d of all particles in this system. | |
csRef< iMeshObjectFactory > | spr_factory |
Pointer to a mesh object factory for 2D sprites. | |
csTicks | prev_time |
Previous time. | |
csVector3 * | part_pos |
particle position |
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 59 of file partgen.h.
Constructor & Destructor Documentation
|
Make a new system. Also adds the particle system to the list of the current engine. |
|
Destroy particle system, and all particles.
|
Member Function Documentation
|
Add particle colors, convenience function.
|
|
Add a new particle, increases num_particles. Do a DecRef yourself.
|
|
Add an rectangle shaped sprite2d particle. Pass along half w and h. adds sprite to engine list. |
|
Add a sprite2d n-gon with material, and given radius. adds sprite to engine list. |
|
Creates a copy of this object and returns the clone.
Implements iMeshObject. |
|
Get the probable alpha of the particles.
|
|
Get the bounding box for this particle system.
|
|
see if change alpha is enabled, and get the value if so.
|
|
see if change color is enabled, and get a copy if so.
|
|
see if change rotation is enabled, and get the angle if so.
|
|
see if change size is enabled, and get the value if so.
|
|
Get the base color of the mesh. Will return false if not supported. Implements iMeshObject. |
|
Get the reference to the factory that created this mesh object.
Implements iMeshObject. |
|
Get flags for this object. The following flags are at least supported:
Implements iMeshObject. |
|
Get the logical parent for this mesh object. See SetLogicalParent() for more information. Implements iMeshObject. |
|
Get the material of the mesh. If not supported this will return 0. Implements iMeshObject. |
|
How many particles the system currently has.
|
|
Get the generic interface describing the geometry of this mesh. If the factory supports this you should preferably use the object model from the factory instead. Implements iMeshObject. |
|
Get a particle.
|
|
Get the number of particles.
|
|
Return vector with -1..+1 members. Varying length.
|
|
Return vector with -1..+1 members. Varying length.
|
|
Return vector with random position within box.
|
|
Returns the set of render meshes. The frustum_mask is given by the culler and contains a mask with all relevant planes for the given object. These planes correspond with the clip planes kept by iRenderView. Implements iMeshObject. |
|
returns whether the system will self destruct
|
|
if the system will self destruct, returns the time to live in msec.
Definition at line 214 of file partgen.h. References csTicks. |
|
Get the current visible callback.
Implements iMeshObject. |
|
Check if this mesh is hit by this object space vector. Return the collision point in object space coordinates. This is the most detailed version (and also the slowest). The returned hit will be guaranteed to be the point closest to the 'start' of the beam. If the object supports this then an index of the hit polygon will be returned (or -1 if not supported or no hit). Implements iMeshObject. |
|
Check if this mesh is hit by this object space vector. This will do a test based on the outline of the object. This means that it is more accurate than HitBeamBBox(). Note that this routine will typically be faster than HitBeamObject(). The hit may be on the front or the back of the object, but will indicate that it iterrupts the beam. Implements iMeshObject. |
|
Material changed. This is an 'event' that the engine (or another party managing materials) will send out as soon as the material handles are changed in some way which requires the mesh object to fetch it again (i.e. to call materialwrapper->GetMaterialHandle()) again. Implements iMeshObject. |
|
Control animation of this object.
Implements iMeshObject. Definition at line 316 of file partgen.h. References csTicks. |
|
see imesh/object.h for specification. The default implementation does nothing. Implements iMeshObject. |
|
Remove all particles.
|
|
Rotate all particles.
|
|
Scale all particles.
|
|
Set the alpha of particles.
Definition at line 235 of file partgen.h. References CS_FX_SETALPHA. |
|
Change alpha of all particles, by factor per second.
|
|
Change color of all particles, by col per second.
|
|
Change rotation of all particles, by angle in radians per second.
|
|
Change size of all particles, by factor per second.
|
|
Set the base color of the mesh. This color will be added to whatever color is set for lighting. Not all meshes need to support this. This function will return true if it worked. Implements iMeshObject. |
|
Set a reference to some logical parent in the context that holds the mesh objects. When a mesh object is used in the context of the 3D engine then this will be an iMeshWrapper. In case it is used in the context of the isometric engine this will be an iIsoMeshSprite. Note that this function should NOT increase the ref-count of the given logical parent because this would cause a circular reference (since the logical parent already holds a reference to this mesh object). Implements iMeshObject. |
|
Set the material of the mesh. This only works for single-material meshes. If not supported this function will return false. Implements iMeshObject. Definition at line 365 of file partgen.h. References mat. |
|
Set the number of particles to use.
|
|
Set selfdestruct mode on, and msec to live.
|
|
Setup the buffers for the particles.
|
|
Set particle colors, convenience function.
|
|
Set particle mixmodes, convenience function.
|
|
Setup this object.
|
|
Register a callback to the mesh object which will be called from within Draw() if the mesh object thinks that the object is really visible. Depending on the type of mesh object this can be very accurate or not accurate at all. But in all cases it will certainly be called if the object is visible. Implements iMeshObject. Definition at line 306 of file partgen.h. References iBase::DecRef(), and iBase::IncRef(). |
|
Stop change of alpha.
|
|
Stop change of color.
|
|
Stop change of rotation.
|
|
Stop change of size.
|
|
system will no longer self destruct
|
|
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. Reimplemented in csNewtonianParticleSystem. |
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. |
|
Alpha change.
|
|
Color change.
|
|
Rotate particles, angle in radians.
|
|
Size change.
|
|
Color of all particles.
|
|
Material for all particles.
Definition at line 78 of file partgen.h. Referenced by SetMaterialWrapper(). |
|
MixMode for all particles.
|
|
particle position
|
|
Previous time.
|
|
Object space radius.
|
|
Self destruct and when.
|
|
Pointer to a mesh object factory for 2D sprites.
|
|
iParticle ptrs to the particles.
|
The documentation for this class was generated from the following file:
- csplugincommon/particlesys/partgen.h
Generated for Crystal Space by doxygen 1.3.9.1