Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

XFuParticleSystem Class Reference

Particle system class. More...

#include <XFuParticleSystem.h>

Collaboration diagram for XFuParticleSystem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 XFuParticleSystem ()
 Constructor.

virtual ~XFuParticleSystem ()
 Destructor.

void restart ()
 Restarts the particle system.

void tick (XFcFixed aTime)
 Called to update the particle system.

void tickOnce (XFcFixed aTimeSlice)
 Used internally.

void render (XFcGL *mGL)
 Renders the particle system using 3D sprites.

void setMaxVisible (INT32 value)
 Sets maximum number of visible particles.

void save (const CHAR *aFname)
 Saves particle system to disk.

void load (const CHAR *aFname)
 Loads particle system from disk.

void loadTextures (const CHAR *aFilenamePrefix=NULL)
 Loads textures.

void newParticle (struct Particle &aParticle)
 Creates a new particle.

void PSSeed (INT32 aValue)
 Seeds the noise function.

INT32 PSRand ()
 Noise function.


Static Public Member Functions

INT32 PSRandInPlace (INT32 aSeed)
 Seeds the noise function and returns the next value.


Public Attributes

UINT32 mFlags
 Flags (see XFUPARTICLESYSTEM_FLAGBITS enum).

XFcFixed mLaunchVelocity [3]
 Launch velocity.

XFuNoiseController mLaunchVelocityVar [3]
 Noise controllers for launch velocity.

XFcFixed mDamping [3]
 Damping (emulates friction).

XFcFixed mWeight [3]
 Weight (or gravity, wind, whatever).

XFuNoiseController mNoise [3]
 Noise contollers for weight.

XFcFixed mLaunchRate
 Launch rate (particles per second).

INT32 mMaxAge
 Maximum age (in msec).

XFuNoiseController mAgeVariation
 Maximum age noise controller.

INT32 mMaxTotal
 Maximum number of particles for all time.

INT32 mMaxVisible
 Maximum number of particles visible at any time. DO NOT CHANGE DIRECTLY.

XFcFixed mSizeScale
 All sizes are scaled by this value.

XFcFixed mViewScale
 Scaling value for the rendering billboards.

XFcFixed mTimeScale
 Time is scaled by this value (for 'bullet-time'ish things) - unfinished.

XFcFixed mDesiredFPS
 Maximum iterations per second.

INT32 mAlphaMode
 Alpha mode (none, alpha, add, mul, invmul).

XFcFixed mAlphaStart
 Alpha value at the beginning of the lifespan.

XFcFixed mAlphaEnd
 Alpha value at the end of the lifespan.

XFuNoiseController mAlphaVariation
 Noise controller for alpha.

XFcFixed mParticleSizeStart
 Particle size at the beginning of the lifespan.

XFcFixed mParticleSizeEnd
 Particle size at the end of the lifespan.

XFuNoiseController mParticleSizeVariation
 Noise controller for particle size.

XFcFixed mRotation
 Base z-rotation.

XFuNoiseController mRotationVariation
 Noise controller for rotation.

XFuNoiseController mRotationNoise
 Noise controller for original z-position.

XFuNoiseController mFrameVariation
 Noise controller for particle animation frames.

XFcFixed mEmitterSize [3]
 Emitter size (0 for point).

XFcFixed mAABB [3]
 Maximum limits from the center of the particle system (0 for infinite).

INT32 mPreTick
 How many frames to pre-tick the particle system on restart.

CHAR ** mTexture
 File names for animation frames.

XFuParticleSystem::ParticlemParticle
 Array of particles.

INT32 mActive
 Number of currently active particles.

INT32 mFrames
 Number of frames of animation for this system.

XFcGLTexture ** mFrame
 Particle animation frames.

XFcFixed mStartTick
 Start tick.

XFcFixed mLastTick
 Last tick the particle system was updated.

XFcFixed mCurrentTick
 Current tick .

INT32 mPeakActive
 Peak active particles.

INT32 mEmitted
 Number of particles emitted so far.

XFcFixed mEmitQueue
 Number of particles in queue to be emitted.

INT32 mRandSeed1
 First seed for rol'n'xor noise function.

INT32 mRandSeed2
 Second seed for rol'n'xor noise function.


Detailed Description

Particle system class.

This particle system class runs and renders particle systems made with the 'thingamajig' particle system editor.

Definition at line 60 of file XFuParticleSystem.h.


Constructor & Destructor Documentation

XFuParticleSystem::XFuParticleSystem  
 

Constructor.

Definition at line 66 of file XFuParticleSystem.cpp.

References mCurrentTick, mFrame, mFrames, mParticle, mTexture, mViewScale, and PSSeed().

XFuParticleSystem::~XFuParticleSystem   [virtual]
 

Destructor.

Definition at line 104 of file XFuParticleSystem.cpp.

References mFrame, mFrames, mParticle, and mTexture.


Member Function Documentation

void XFuParticleSystem::load const CHAR *    aFname
 

Loads particle system from disk.

void XFuParticleSystem::loadTextures const CHAR *    aFilenamePrefix = NULL
 

Loads textures.

Parameters:
aFilenamePrefix filename prefix to use for each texture filename.

Definition at line 639 of file XFuParticleSystem.cpp.

References mFrame, and mFrames.

void XFuParticleSystem::newParticle struct Particle   aParticle
 

Creates a new particle.

Definition at line 270 of file XFuParticleSystem.cpp.

References XFuParticleSystem::Particle::mAge, mAgeVariation, XFuParticleSystem::Particle::mAngle, XFuParticleSystem::Particle::mBaseRotation, mEmitterSize, mLaunchVelocity, mLaunchVelocityVar, mMaxAge, XFuParticleSystem::Particle::mMaxAge, mRotation, mRotationNoise, XFuParticleSystem::Particle::mUniqueSeed, XFuNoiseController::mValue, XFuParticleSystem::Particle::mX, XFuParticleSystem::Particle::mXi, XFuParticleSystem::Particle::mY, XFuParticleSystem::Particle::mYi, XFuParticleSystem::Particle::mZ, XFuParticleSystem::Particle::mZi, XFuNoiseController::noise(), PI, and PSRand().

Referenced by tickOnce().

INT32 XFuParticleSystem::PSRand  
 

Noise function.

Definition at line 38 of file XFuParticleSystem.cpp.

References mRandSeed1, and mRandSeed2.

Referenced by newParticle(), and XFuNoiseController::noise().

INT32 XFuParticleSystem::PSRandInPlace INT32    aSeed [static]
 

Seeds the noise function and returns the next value.

Definition at line 49 of file XFuParticleSystem.cpp.

Referenced by XFuNoiseController::noise().

void XFuParticleSystem::PSSeed INT32    aValue
 

Seeds the noise function.

Definition at line 26 of file XFuParticleSystem.cpp.

References mRandSeed1, and mRandSeed2.

Referenced by XFuParticleSystem().

void XFuParticleSystem::render XFcGL *    mGL
 

Renders the particle system using 3D sprites.

Definition at line 176 of file XFuParticleSystem.cpp.

References XFuParticleSystem::Particle::mAge, mAlphaEnd, mAlphaStart, mAlphaVariation, mFrames, mFrameVariation, mMaxVisible, mParticle, mParticleSizeEnd, mParticleSizeStart, mParticleSizeVariation, mSizeScale, mViewScale, and XFuNoiseController::noise().

void XFuParticleSystem::restart  
 

Restarts the particle system.

Definition at line 78 of file XFuParticleSystem.cpp.

References mActive, XFuParticleSystem::Particle::mAge, mEmitQueue, mEmitted, mLastTick, mMaxVisible, mParticle, mPeakActive, mPreTick, mStartTick, and tickOnce().

Referenced by setMaxVisible().

void XFuParticleSystem::save const CHAR *    aFname
 

Saves particle system to disk.

Definition at line 456 of file XFuParticleSystem.cpp.

References mAgeVariation, mAlphaVariation, mFrames, mFrameVariation, mLaunchVelocityVar, mNoise, mParticleSizeVariation, mRotationNoise, mRotationVariation, mTexture, PS_VERSIONTAG, and XFuNoiseController::write().

void XFuParticleSystem::setMaxVisible INT32    value
 

Sets maximum number of visible particles.

Definition at line 94 of file XFuParticleSystem.cpp.

References mMaxVisible, mParticle, and restart().

void XFuParticleSystem::tick XFcFixed    aTime
 

Called to update the particle system.

Definition at line 398 of file XFuParticleSystem.cpp.

References mDesiredFPS, mFlags, mLastTick, mTimeScale, tickOnce(), and XFUPSF_FORCEITERATIONS.

void XFuParticleSystem::tickOnce XFcFixed    aTimeSlice
 

Used internally.

Definition at line 298 of file XFuParticleSystem.cpp.

References mAABB, mActive, XFuParticleSystem::Particle::mAge, XFuParticleSystem::Particle::mAngle, XFuParticleSystem::Particle::mBaseRotation, mCurrentTick, mDamping, mEmitQueue, mEmitted, mFlags, XFuParticleSystem::Particle::mMaxAge, mMaxTotal, mMaxVisible, mNoise, mParticle, mPeakActive, mRotationVariation, mWeight, XFuParticleSystem::Particle::mX, XFuParticleSystem::Particle::mXi, XFuParticleSystem::Particle::mY, XFuParticleSystem::Particle::mYi, XFuParticleSystem::Particle::mZ, XFuParticleSystem::Particle::mZi, newParticle(), XFuNoiseController::noise(), XFUPSF_COLLIDER_XMAX, XFUPSF_COLLIDER_XMIN, XFUPSF_COLLIDER_YMAX, XFUPSF_COLLIDER_YMIN, XFUPSF_COLLIDER_ZMAX, and XFUPSF_COLLIDER_ZMIN.

Referenced by restart(), and tick().


Member Data Documentation

XFcFixed XFuParticleSystem::mAABB[3]
 

Maximum limits from the center of the particle system (0 for infinite).

Definition at line 129 of file XFuParticleSystem.h.

Referenced by tickOnce().

INT32 XFuParticleSystem::mActive
 

Number of currently active particles.

Definition at line 154 of file XFuParticleSystem.h.

Referenced by restart(), and tickOnce().

XFuNoiseController XFuParticleSystem::mAgeVariation
 

Maximum age noise controller.

Definition at line 84 of file XFuParticleSystem.h.

Referenced by newParticle(), and save().

XFcFixed XFuParticleSystem::mAlphaEnd
 

Alpha value at the end of the lifespan.

Definition at line 106 of file XFuParticleSystem.h.

Referenced by render().

INT32 XFuParticleSystem::mAlphaMode
 

Alpha mode (none, alpha, add, mul, invmul).

Definition at line 102 of file XFuParticleSystem.h.

XFcFixed XFuParticleSystem::mAlphaStart
 

Alpha value at the beginning of the lifespan.

Definition at line 104 of file XFuParticleSystem.h.

Referenced by render().

XFuNoiseController XFuParticleSystem::mAlphaVariation
 

Noise controller for alpha.

Definition at line 108 of file XFuParticleSystem.h.

Referenced by render(), and save().

XFcFixed XFuParticleSystem::mCurrentTick
 

Current tick .

Definition at line 159 of file XFuParticleSystem.h.

Referenced by tickOnce(), and XFuParticleSystem().

XFcFixed XFuParticleSystem::mDamping[3]
 

Damping (emulates friction).

Definition at line 72 of file XFuParticleSystem.h.

Referenced by tickOnce().

XFcFixed XFuParticleSystem::mDesiredFPS
 

Maximum iterations per second.

Definition at line 99 of file XFuParticleSystem.h.

Referenced by tick().

XFcFixed XFuParticleSystem::mEmitQueue
 

Number of particles in queue to be emitted.

Definition at line 162 of file XFuParticleSystem.h.

Referenced by restart(), and tickOnce().

INT32 XFuParticleSystem::mEmitted
 

Number of particles emitted so far.

Definition at line 161 of file XFuParticleSystem.h.

Referenced by restart(), and tickOnce().

XFcFixed XFuParticleSystem::mEmitterSize[3]
 

Emitter size (0 for point).

Definition at line 127 of file XFuParticleSystem.h.

Referenced by newParticle().

UINT32 XFuParticleSystem::mFlags
 

Flags (see XFUPARTICLESYSTEM_FLAGBITS enum).

Definition at line 64 of file XFuParticleSystem.h.

Referenced by tick(), and tickOnce().

XFcGLTexture** XFuParticleSystem::mFrame
 

Particle animation frames.

Definition at line 156 of file XFuParticleSystem.h.

Referenced by loadTextures(), XFuParticleSystem(), and ~XFuParticleSystem().

INT32 XFuParticleSystem::mFrames
 

Number of frames of animation for this system.

Definition at line 155 of file XFuParticleSystem.h.

Referenced by loadTextures(), render(), save(), XFuParticleSystem(), and ~XFuParticleSystem().

XFuNoiseController XFuParticleSystem::mFrameVariation
 

Noise controller for particle animation frames.

Definition at line 124 of file XFuParticleSystem.h.

Referenced by render(), and save().

XFcFixed XFuParticleSystem::mLastTick
 

Last tick the particle system was updated.

Definition at line 158 of file XFuParticleSystem.h.

Referenced by restart(), and tick().

XFcFixed XFuParticleSystem::mLaunchRate
 

Launch rate (particles per second).

Definition at line 80 of file XFuParticleSystem.h.

XFcFixed XFuParticleSystem::mLaunchVelocity[3]
 

Launch velocity.

Definition at line 67 of file XFuParticleSystem.h.

Referenced by newParticle().

XFuNoiseController XFuParticleSystem::mLaunchVelocityVar[3]
 

Noise controllers for launch velocity.

Definition at line 69 of file XFuParticleSystem.h.

Referenced by newParticle(), and save().

INT32 XFuParticleSystem::mMaxAge
 

Maximum age (in msec).

Definition at line 82 of file XFuParticleSystem.h.

Referenced by newParticle().

INT32 XFuParticleSystem::mMaxTotal
 

Maximum number of particles for all time.

Definition at line 86 of file XFuParticleSystem.h.

Referenced by tickOnce().

INT32 XFuParticleSystem::mMaxVisible
 

Maximum number of particles visible at any time. DO NOT CHANGE DIRECTLY.

Definition at line 88 of file XFuParticleSystem.h.

Referenced by render(), restart(), setMaxVisible(), and tickOnce().

XFuNoiseController XFuParticleSystem::mNoise[3]
 

Noise contollers for weight.

Definition at line 77 of file XFuParticleSystem.h.

Referenced by save(), and tickOnce().

struct XFuParticleSystem::Particle * XFuParticleSystem::mParticle
 

Array of particles.

Referenced by render(), restart(), setMaxVisible(), tickOnce(), XFuParticleSystem(), and ~XFuParticleSystem().

XFcFixed XFuParticleSystem::mParticleSizeEnd
 

Particle size at the end of the lifespan.

Definition at line 113 of file XFuParticleSystem.h.

Referenced by render().

XFcFixed XFuParticleSystem::mParticleSizeStart
 

Particle size at the beginning of the lifespan.

Definition at line 111 of file XFuParticleSystem.h.

Referenced by render().

XFuNoiseController XFuParticleSystem::mParticleSizeVariation
 

Noise controller for particle size.

Definition at line 115 of file XFuParticleSystem.h.

Referenced by render(), and save().

INT32 XFuParticleSystem::mPeakActive
 

Peak active particles.

Definition at line 160 of file XFuParticleSystem.h.

Referenced by restart(), and tickOnce().

INT32 XFuParticleSystem::mPreTick
 

How many frames to pre-tick the particle system on restart.

Definition at line 132 of file XFuParticleSystem.h.

Referenced by restart().

INT32 XFuParticleSystem::mRandSeed1
 

First seed for rol'n'xor noise function.

Definition at line 164 of file XFuParticleSystem.h.

Referenced by PSRand(), and PSSeed().

INT32 XFuParticleSystem::mRandSeed2
 

Second seed for rol'n'xor noise function.

Definition at line 165 of file XFuParticleSystem.h.

Referenced by PSRand(), and PSSeed().

XFcFixed XFuParticleSystem::mRotation
 

Base z-rotation.

Definition at line 117 of file XFuParticleSystem.h.

Referenced by newParticle().

XFuNoiseController XFuParticleSystem::mRotationNoise
 

Noise controller for original z-position.

Definition at line 121 of file XFuParticleSystem.h.

Referenced by newParticle(), and save().

XFuNoiseController XFuParticleSystem::mRotationVariation
 

Noise controller for rotation.

Definition at line 119 of file XFuParticleSystem.h.

Referenced by save(), and tickOnce().

XFcFixed XFuParticleSystem::mSizeScale
 

All sizes are scaled by this value.

Definition at line 91 of file XFuParticleSystem.h.

Referenced by render().

XFcFixed XFuParticleSystem::mStartTick
 

Start tick.

Definition at line 157 of file XFuParticleSystem.h.

Referenced by restart().

CHAR** XFuParticleSystem::mTexture
 

File names for animation frames.

Definition at line 135 of file XFuParticleSystem.h.

Referenced by save(), XFuParticleSystem(), and ~XFuParticleSystem().

XFcFixed XFuParticleSystem::mTimeScale
 

Time is scaled by this value (for 'bullet-time'ish things) - unfinished.

Definition at line 97 of file XFuParticleSystem.h.

Referenced by tick().

XFcFixed XFuParticleSystem::mViewScale
 

Scaling value for the rendering billboards.

This is inverse of the camera scale in ViewMatrix.

Definition at line 95 of file XFuParticleSystem.h.

Referenced by render(), and XFuParticleSystem().

XFcFixed XFuParticleSystem::mWeight[3]
 

Weight (or gravity, wind, whatever).

Definition at line 75 of file XFuParticleSystem.h.

Referenced by tickOnce().


The documentation for this class was generated from the following files:
   
X-Forge Documentation
Confidential
Copyright © 2002-2003 Fathammer
   
Documentation generated
with doxygen
by Dimitri van Heesch