Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DParticleEmitter Class Reference

The U4DParticleEmitter class contains all the methods required for the computation of the position, colors and behaviors of the particles. More...

Inherits U4DEngine::U4DParticleEmitterInterface.

Inherited by U4DEngine::U4DParticleEmitterLinear, U4DEngine::U4DParticleEmitterSphere, and U4DEngine::U4DParticleEmitterTorus.

Public Member Functions

 U4DParticleEmitter ()
 class constructor
 
 ~U4DParticleEmitter ()
 class destructor
 
void emitParticles ()
 emit particles More...
 
virtual void computeVelocity (U4DParticle *uParticle)
 Computes the velocity of the 3D particle. More...
 
virtual void computeRadialAcceleration (U4DParticle *uParticle)
 computes the radial acceleration of the 3D particle More...
 
virtual void computeTangentialAcceleration (U4DParticle *uParticle)
 computes the tangential acceleration of the 3D particle More...
 
float getRandomNumberBetween (float uMinValue, float uMaxValue)
 compute random number More...
 
void computeVariance (U4DVector3n &uVector, U4DVector3n &uVectorVariance)
 Computes the variance of vectors. More...
 
void computeVariance (U4DVector4n &uVector, U4DVector4n &uVectorVariance)
 Computes the variance of vectors. More...
 
void computeVariance (float &uValue, float &uValueVariance)
 Computes the variance of a particular value. More...
 
void computePosition (U4DParticle *uParticle)
 computes the position of the 3D particle More...
 
void computeColors (U4DParticle *uParticle)
 computes the color of the 3D particle More...
 
void computeScale (U4DParticle *uParticle)
 computes the scale of the 3D particle More...
 
void decreaseNumberOfEmittedParticles ()
 decreases the number of particles emitted More...
 
int getNumberOfEmittedParticles ()
 Gets the current number of emitted particles. More...
 
void setNumberOfParticlesPerEmission (int uNumberOfParticles)
 sets the number of particles to emit per emission More...
 
void setParticleEmissionRate (float uEmissionRate)
 sets the emission rate. More...
 
void setParticleSystem (U4DParticleSystem *uParticleSystem)
 sets the pointer to the Particle System More...
 
void setParticleData (U4DParticleData &uParticleData)
 sets the pointer to the Particle Data More...
 
void setEmitContinuously (bool uValue)
 sets if the particle should emit the particles continuously More...
 
float mix (float x, float y, float a)
 linearly interpolates between two values More...
 
void play ()
 Starts the emission of particles.
 
void stop ()
 stops the emission of particles
 
void negateEmitterDurationFlag ()
 negate the emitterDurationFlag
 
void setEmitterDurationRate (float uEmitterDurationRate)
 sets the emitter duration rate More...
 
void computeRotation (U4DParticle *uParticle)
 computes the rotation of the 3D particle More...
 
- Public Member Functions inherited from U4DEngine::U4DParticleEmitterInterface
virtual ~U4DParticleEmitterInterface ()
 interface destructor
 

Protected Attributes

int emittedNumberOfParticles
 number of particles to emit
 
int numberOfParticlesPerEmission
 numer of particles per emission
 
float emissionRate
 emission rate of particles
 
float emitterDurationRate
 duration of how long the emitter will emit
 
U4DCallback< U4DParticleEmitter > * emitterRateScheduler
 pointer to Callback to schedule the emission rate
 
U4DTimeremitterRateTimer
 pointer to a timer used in the callback
 
U4DCallback< U4DParticleEmitter > * emitterDurationScheduler
 pointer to Callback to schedule the emission duration
 
U4DTimeremitterDurationTimer
 pointer to a timer used in the callback
 
U4DParticleSystemparticleSystem
 pointer to the Particle System object
 
U4DParticleData particleData
 pointer to the Particle Data object
 
bool emitContinuously
 variable to set whether to emit particles continuously
 

Detailed Description

The U4DParticleEmitter class contains all the methods required for the computation of the position, colors and behaviors of the particles.

Member Function Documentation

◆ computeColors()

void U4DEngine::U4DParticleEmitter::computeColors ( U4DParticle uParticle)
virtual

computes the color of the 3D particle

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

◆ computePosition()

void U4DEngine::U4DParticleEmitter::computePosition ( U4DParticle uParticle)
virtual

computes the position of the 3D particle

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

◆ computeRadialAcceleration()

virtual void U4DEngine::U4DParticleEmitter::computeRadialAcceleration ( U4DParticle uParticle)
inlinevirtual

computes the radial acceleration of the 3D particle

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

Reimplemented in U4DEngine::U4DParticleEmitterLinear.

◆ computeRotation()

void U4DEngine::U4DParticleEmitter::computeRotation ( U4DParticle uParticle)
virtual

computes the rotation of the 3D particle

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

◆ computeScale()

void U4DEngine::U4DParticleEmitter::computeScale ( U4DParticle uParticle)
virtual

computes the scale of the 3D particle

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

◆ computeTangentialAcceleration()

virtual void U4DEngine::U4DParticleEmitter::computeTangentialAcceleration ( U4DParticle uParticle)
inlinevirtual

computes the tangential acceleration of the 3D particle

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

Reimplemented in U4DEngine::U4DParticleEmitterLinear.

◆ computeVariance() [1/3]

void U4DEngine::U4DParticleEmitter::computeVariance ( float &  uValue,
float &  uValueVariance 
)

Computes the variance of a particular value.

Parameters
uVectorvector representing main value
uVectorVariancedesired value variance range

◆ computeVariance() [2/3]

void U4DEngine::U4DParticleEmitter::computeVariance ( U4DVector3n uVector,
U4DVector3n uVectorVariance 
)

Computes the variance of vectors.

Parameters
uVectorvector representing main vector
uVectorVariancedesired vector variance range

◆ computeVariance() [3/3]

void U4DEngine::U4DParticleEmitter::computeVariance ( U4DVector4n uVector,
U4DVector4n uVectorVariance 
)

Computes the variance of vectors.

Parameters
uVectorvector representing main vector
uVectorVariancedesired vector variance range

◆ computeVelocity()

virtual void U4DEngine::U4DParticleEmitter::computeVelocity ( U4DParticle uParticle)
inlinevirtual

Computes the velocity of the 3D particle.

Parameters
uParticlepointer to the 3D particle

Implements U4DEngine::U4DParticleEmitterInterface.

Reimplemented in U4DEngine::U4DParticleEmitterLinear, U4DEngine::U4DParticleEmitterSphere, and U4DEngine::U4DParticleEmitterTorus.

◆ decreaseNumberOfEmittedParticles()

void U4DEngine::U4DParticleEmitter::decreaseNumberOfEmittedParticles ( )
virtual

decreases the number of particles emitted

If a particle's life is up, this method is called to update the current count of alive particles and the dead particle is removed from the scenegraph

Implements U4DEngine::U4DParticleEmitterInterface.

◆ emitParticles()

void U4DEngine::U4DParticleEmitter::emitParticles ( )
virtual

emit particles

once the position, color and velocity of the particle has been computed, the particle is loaded into the particle's system scenegraph

Implements U4DEngine::U4DParticleEmitterInterface.

◆ getNumberOfEmittedParticles()

int U4DEngine::U4DParticleEmitter::getNumberOfEmittedParticles ( )
virtual

Gets the current number of emitted particles.

Returns
number of alive particles

Implements U4DEngine::U4DParticleEmitterInterface.

◆ getRandomNumberBetween()

float U4DEngine::U4DParticleEmitter::getRandomNumberBetween ( float  uMinValue,
float  uMaxValue 
)

compute random number

used to give randomness to the computation of colors and position variance

Parameters
uMinValuemin value
uMaxValuemax value
Returns
random number

◆ mix()

float U4DEngine::U4DParticleEmitter::mix ( float  x,
float  y,
float  a 
)

linearly interpolates between two values

Parameters
xSpecify the start of range in which to interpolate
ySpecify the end of range in which to interpolate
aSpecify the value to use to interpolate between x and y
Returns
interpolation between two values

◆ setEmitContinuously()

void U4DEngine::U4DParticleEmitter::setEmitContinuously ( bool  uValue)
virtual

sets if the particle should emit the particles continuously

Parameters
uValuetrue for continuous emission, false for only one emission

Implements U4DEngine::U4DParticleEmitterInterface.

◆ setEmitterDurationRate()

void U4DEngine::U4DParticleEmitter::setEmitterDurationRate ( float  uEmitterDurationRate)
virtual

sets the emitter duration rate

Parameters
uEmitterDurationRateemitter duration rate

Implements U4DEngine::U4DParticleEmitterInterface.

◆ setNumberOfParticlesPerEmission()

void U4DEngine::U4DParticleEmitter::setNumberOfParticlesPerEmission ( int  uNumberOfParticles)
virtual

sets the number of particles to emit per emission

Parameters
uNumberOfParticlesnumber of particles

Implements U4DEngine::U4DParticleEmitterInterface.

◆ setParticleData()

void U4DEngine::U4DParticleEmitter::setParticleData ( U4DParticleData uParticleData)
virtual

sets the pointer to the Particle Data

Parameters
uParticleDatapointer to the Particle Data

Implements U4DEngine::U4DParticleEmitterInterface.

◆ setParticleEmissionRate()

void U4DEngine::U4DParticleEmitter::setParticleEmissionRate ( float  uEmissionRate)
virtual

sets the emission rate.

This rate sets how often to emit particles. The lower the value, the more frequent the emision

Parameters
uEmissionRateemission rate

Implements U4DEngine::U4DParticleEmitterInterface.

◆ setParticleSystem()

void U4DEngine::U4DParticleEmitter::setParticleSystem ( U4DParticleSystem uParticleSystem)
virtual

sets the pointer to the Particle System

Parameters
uParticleSystempointer to particle system

Implements U4DEngine::U4DParticleEmitterInterface.