Class ParticleSys
See Also: Class GraphicsWindow, Marker Types, Class HitRegion.
class ParticleSys
Description:
This class describes a particle system. Methods are available to display, hit test, and compute the bounding box of the particle system. Other methods allocate and free the particles and allow custom particle drawing procedures to be used.
Data Members:
public:
Tab<Point3> points;
The location of each particle.
Tab<Point3> vels;
The velocity of each particle (optional).
Tab<TimeValue> ages;
The age of each particle (optional).
float size;
The world space radius of a particle.
Methods:
Prototype:
void Render(GraphicsWindow *gw, MarkerType type=POINT_MRKR);
Remarks:
Implemented by the System.
Draws the particle system into the GraphicsWindow.
Parameters:
GraphicsWindow *gw
The graphics window into which to particle system is to be drawn.
MarkerType type=POINT_MRKR
One of the following values:
See Marker Types.
Prototype:
BOOL HitTest(GraphicsWindow *gw, HitRegion *hr,
int abortOnHit=FALSE, MarkerType type=POINT_MRKR);
Remarks:
Implemented by the System.
This method hit tests the particle system and returns TRUE if the particle system was hit.
Parameters:
GraphicsWindow *gw
The graphics window to hit test in.
HitRegion *hr
Pointer to an instance of HitRegion describing the hit test region.
int abortOnHit=FALSE
If TRUE the hit testing should be aborted upon the first successful hit; otherwise hit testing should continue through all particles.
MarkerType type=POINT_MRKR
The type of particle marker being used. One of the following values:
See Marker Types.
Return Value:
TRUE if a particle is hit; otherwise FALSE.
Prototype:
Box3 BoundBox(Matrix3 *tm=NULL);
Remarks:
Implemented by the System.
Returns the 3D bounding box of the particles.
Parameters:
Matrix3 *tm=NULL
If not NULL, this is the optional space to compute the bounding box in.
Prototype:
void FreeAll();
Remarks:
Implemented by the System.
Sets all the counts to 0. This will be the points, and if used, the velocities and ages.
Prototype:
void SetCount(int c, DWORD flags);
Remarks:
Implemented by the System.
Sets the size of the particle system. This is to at least set the number of points in the particle system. The flags indicate if optional parameters velocities and ages should be allocated as well.
Parameters:
int c
The size for each allocated table.
DWORD flags
One or more of the following values:
PARTICLE_VELS - Velocities should be allocated.
PARTICLE_AGES - Particles ages should be allocated.
Prototype:
int Count();
Remarks:
Implemented by the System.
Returns the number of points in the particle system.
Prototype:
BOOL Alive(int i)
Remarks:
Implemented by the System.
Determines if particle i is alive (has not expired).
Parameters:
int i
The index of the particle to check.
Return Value:
TRUE if the 'i-th' particle is alive; otherwise FALSE.
Prototype:
void SetCustomDraw(CustomParticleDisplay *d);
Remarks:
Implemented by the System.
Establishes a custom draw callback object. This allows the particles to be displayed in any manner desired (not just using the standard point markers). See Class CustomParticleDisplay.
Parameters:
CustomParticleDisplay *d
The custom draw callback object.
Operators:
Prototype:
Point3& operator[](int i)
Remarks:
Implemented by the System.
Returns the 'i-th' point of the particle system.