Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
Particle Class Reference

#include <ParticleSys.h>

Inherits MemoryPoolObject, and ParticleInfo.

Public Member Functions

 Particle (ParticleSystem *system, const ParticleInfo *data)
 
Bool update (void)
 update this particle's behavior - return false if dead
 
void doWindMotion (void)
 do wind motion (if present) from particle system
 
void applyForce (const Coord3D *force)
 add the given acceleration
 
const Coord3DgetPosition (void)
 
Real getSize (void)
 
Real getAngle (void)
 
Real getAlpha (void)
 
const RGBColorgetColor (void)
 
void setColor (RGBColor *color)
 
Bool isInvisible (void)
 return true if this particle is invisible
 
Bool isCulled (void)
 return true if the particle falls off the edge of the screen
 
void setIsCulled (Bool enable)
 set particle to not visible because it's outside view frustum
 
void controlParticleSystem (ParticleSystem *sys)
 
void detachControlledParticleSystem (void)
 
ParticlePriorityType getPriority (void)
 
UnsignedInt getPersonality (void)
 
void setPersonality (UnsignedInt p)
 
- Public Member Functions inherited from MemoryPoolObject
void deleteInstance ()
 
- Public Member Functions inherited from ParticleInfo
 ParticleInfo (void)
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Public Attributes

Particlem_systemNext
 
Particlem_systemPrev
 
Particlem_overallNext
 
Particlem_overallPrev
 
Bool m_inSystemList
 
Bool m_inOverallList
 
union { 
 
   ParticleSystem *   m_systemUnderControl 
 the particle system attached to this particle (not the system that created us) More...
 
   ParticleSystemID   m_systemUnderControlID 
 id of system attached to this particle (not the system that created us); More...
 
};  
 
- Public Attributes inherited from ParticleInfo
Coord3D m_vel
 initial velocity
 
Coord3D m_pos
 initial position
 
Coord3D m_emitterPos
 position of the emitter
 
Real m_velDamping
 velocity damping coefficient
 
Real m_angleZ
 initial angle around Z axis
 
Real m_angularRateZ
 initial angle around Z axis
 
Real m_angularDamping
 angular velocity damping coefficient
 
UnsignedInt m_lifetime
 lifetime of this particle
 
Real m_size
 size of the particle
 
Real m_sizeRate
 rate of change of size
 
Real m_sizeRateDamping
 damping of size change rate
 
Keyframe m_alphaKey [MAX_KEYFRAMES]
 
RGBColorKeyframe m_colorKey [MAX_KEYFRAMES]
 
Real m_colorScale
 color "scaling" coefficient
 
Real m_windRandomness
 multiplier for wind randomness per particle
 
Bool m_particleUpTowardsEmitter
 correspond to the direction of the emitter.
 

Protected Member Functions

virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess (void)
 
void computeAlphaRate (void)
 compute alpha rate to get to next key
 
void computeColorRate (void)
 compute color change to get to next key
 
- Protected Member Functions inherited from MemoryPoolObject
virtual ~MemoryPoolObject ()
 
void * operator new (size_t s)
 
void operator delete (void *p)
 
virtual MemoryPoolgetObjectMemoryPool ()=0
 

Protected Attributes

ParticleSystemm_system
 the particle system this particle belongs to
 
UnsignedInt m_personality
 each new particle assigned a number one higher than the previous
 
Coord3D m_accel
 current acceleration
 
Coord3D m_lastPos
 previous position
 
UnsignedInt m_lifetimeLeft
 lifetime remaining, if zero -> destroy
 
UnsignedInt m_createTimestamp
 frame this particle was created
 
Real m_alpha
 current alpha of this particle
 
Real m_alphaRate
 current rate of alpha change
 
Int m_alphaTargetKey
 next index into key array
 
RGBColor m_color
 current color of this particle
 
RGBColor m_colorRate
 current rate of color change
 
Int m_colorTargetKey
 next index into key array
 
Bool m_isCulled
 status of particle relative to screen bounds
 

Detailed Description

An individual particle created by a ParticleSystem. NOTE: Particles cannot exist without a parent particle system.

Definition at line 163 of file ParticleSys.h.

Constructor & Destructor Documentation

◆ Particle()

Particle::Particle ( ParticleSystem * system,
const ParticleInfo * info )

Construct a particle from a particle template

Definition at line 256 of file ParticleSys.cpp.

Member Function Documentation

◆ applyForce()

void Particle::applyForce ( const Coord3D * force)

add the given acceleration

Add the given acceleration

Definition at line 348 of file ParticleSys.cpp.

◆ computeAlphaRate()

void Particle::computeAlphaRate ( void )
protected

compute alpha rate to get to next key

Compute alpha rate to get to next key on given frame

Definition at line 215 of file ParticleSys.cpp.

◆ computeColorRate()

void Particle::computeColorRate ( void )
protected

compute color change to get to next key

Compute color rate to get to next key on given frame

Definition at line 232 of file ParticleSys.cpp.

◆ controlParticleSystem()

void Particle::controlParticleSystem ( ParticleSystem * sys)
inline

Definition at line 189 of file ParticleSys.h.

◆ crc()

void Particle::crc ( Xfer * xfer)
protectedvirtual

CRC

Reimplemented from ParticleInfo.

Definition at line 625 of file ParticleSys.cpp.

◆ detachControlledParticleSystem()

void Particle::detachControlledParticleSystem ( void )
inline

Definition at line 190 of file ParticleSys.h.

◆ doWindMotion()

void Particle::doWindMotion ( void )

do wind motion (if present) from particle system

Do wind motion as specified by the particle system template, if present

Definition at line 491 of file ParticleSys.cpp.

◆ getAlpha()

Real Particle::getAlpha ( void )
inline

Definition at line 181 of file ParticleSys.h.

◆ getAngle()

Real Particle::getAngle ( void )
inline

Definition at line 180 of file ParticleSys.h.

◆ getColor()

const RGBColor * Particle::getColor ( void )
inline

Definition at line 182 of file ParticleSys.h.

◆ getPersonality()

UnsignedInt Particle::getPersonality ( void )
inline

Definition at line 195 of file ParticleSys.h.

◆ getPosition()

const Coord3D * Particle::getPosition ( void )
inline

Definition at line 178 of file ParticleSys.h.

◆ getPriority()

ParticlePriorityType Particle::getPriority ( void )

Get priority of a particle ... which is the priority of it's attached system

Definition at line 573 of file ParticleSys.cpp.

◆ getSize()

Real Particle::getSize ( void )
inline

Definition at line 179 of file ParticleSys.h.

◆ isCulled()

Bool Particle::isCulled ( void )
inline

return true if the particle falls off the edge of the screen

Definition at line 186 of file ParticleSys.h.

◆ isInvisible()

Bool Particle::isInvisible ( void )
inline

return true if this particle is invisible

Return true if this particle is invisible

Definition at line 581 of file ParticleSys.cpp.

◆ loadPostProcess()

void Particle::loadPostProcess ( void )
protectedvirtual

Load post process

Reimplemented from ParticleInfo.

Definition at line 692 of file ParticleSys.cpp.

◆ setColor()

void Particle::setColor ( RGBColor * color)
inline

Definition at line 183 of file ParticleSys.h.

◆ setIsCulled()

void Particle::setIsCulled ( Bool enable)
inline

set particle to not visible because it's outside view frustum

Definition at line 187 of file ParticleSys.h.

◆ setPersonality()

void Particle::setPersonality ( UnsignedInt p)
inline

Definition at line 196 of file ParticleSys.h.

◆ update()

Bool Particle::update ( void )
inline

update this particle's behavior - return false if dead

Update the behavior of an individual particle

Todo
Rethink this - at least its name

Definition at line 358 of file ParticleSys.cpp.

◆ xfer()

void Particle::xfer ( Xfer * xfer)
protectedvirtual

Xfer method Version Info: 1: Initial version

Reimplemented from ParticleInfo.

Definition at line 635 of file ParticleSys.cpp.

Member Data Documentation

◆ [union]

union { ... } Particle

◆ m_accel

Coord3D Particle::m_accel
protected

current acceleration

Definition at line 220 of file ParticleSys.h.

◆ m_alpha

Real Particle::m_alpha
protected

current alpha of this particle

Definition at line 225 of file ParticleSys.h.

◆ m_alphaRate

Real Particle::m_alphaRate
protected

current rate of alpha change

Definition at line 226 of file ParticleSys.h.

◆ m_alphaTargetKey

Int Particle::m_alphaTargetKey
protected

next index into key array

Definition at line 227 of file ParticleSys.h.

◆ m_color

RGBColor Particle::m_color
protected

current color of this particle

Definition at line 229 of file ParticleSys.h.

◆ m_colorRate

RGBColor Particle::m_colorRate
protected

current rate of color change

Definition at line 230 of file ParticleSys.h.

◆ m_colorTargetKey

Int Particle::m_colorTargetKey
protected

next index into key array

Definition at line 231 of file ParticleSys.h.

◆ m_createTimestamp

UnsignedInt Particle::m_createTimestamp
protected

frame this particle was created

Definition at line 223 of file ParticleSys.h.

◆ m_inOverallList

Bool Particle::m_inOverallList

Definition at line 237 of file ParticleSys.h.

◆ m_inSystemList

Bool Particle::m_inSystemList

Definition at line 236 of file ParticleSys.h.

◆ m_isCulled

Bool Particle::m_isCulled
protected

status of particle relative to screen bounds

Definition at line 234 of file ParticleSys.h.

◆ m_lastPos

Coord3D Particle::m_lastPos
protected

previous position

Definition at line 221 of file ParticleSys.h.

◆ m_lifetimeLeft

UnsignedInt Particle::m_lifetimeLeft
protected

lifetime remaining, if zero -> destroy

Definition at line 222 of file ParticleSys.h.

◆ m_overallNext

Particle* Particle::m_overallNext

Definition at line 211 of file ParticleSys.h.

◆ m_overallPrev

Particle* Particle::m_overallPrev

Definition at line 212 of file ParticleSys.h.

◆ m_personality

UnsignedInt Particle::m_personality
protected

each new particle assigned a number one higher than the previous

Definition at line 216 of file ParticleSys.h.

◆ m_system

ParticleSystem* Particle::m_system
protected

the particle system this particle belongs to

Definition at line 215 of file ParticleSys.h.

◆ m_systemNext

Particle* Particle::m_systemNext

Definition at line 209 of file ParticleSys.h.

◆ m_systemPrev

Particle* Particle::m_systemPrev

Definition at line 210 of file ParticleSys.h.

◆ m_systemUnderControl

ParticleSystem* Particle::m_systemUnderControl

the particle system attached to this particle (not the system that created us)

Definition at line 241 of file ParticleSys.h.

◆ m_systemUnderControlID

ParticleSystemID Particle::m_systemUnderControlID

id of system attached to this particle (not the system that created us);

Definition at line 242 of file ParticleSys.h.


The documentation for this class was generated from the following files: