OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
Abstract class defining the interface to be implemented by particle emitters. More...
#include <OgreParticleEmitter.h>
Public Member Functions | |
ParticleEmitter (ParticleSystem *psys) | |
virtual | ~ParticleEmitter () |
Virtual destructor essential. | |
virtual unsigned short | _getEmissionCount (Real timeElapsed) |
Gets the number of particles which this emitter would like to emit based on the time elapsed. | |
virtual void | _initParticle (Particle *pParticle) |
Initialises a particle based on the emitter's approach and parameters. | |
virtual const Radian & | getAngle (void) const |
Returns the maximum angle which the initial particle direction can deviate from the emitters base direction. | |
virtual const ColourValue & | getColour (void) const |
Gets the colour of particles to be emitted. | |
virtual const ColourValue & | getColourRangeEnd (void) const |
Gets the maximum colour of particles to be emitted. | |
virtual const ColourValue & | getColourRangeStart (void) const |
Gets the minimum colour of particles to be emitted. | |
virtual const Vector3 & | getDirection (void) const |
Returns the base direction of the emitter. | |
virtual const Vector3 & | getDirPositionReference () const |
Returns the position reference to generate direction of emitted particles. | |
virtual bool | getDirPositionReferenceEnabled () const |
Returns whether direction or position reference is used. | |
virtual Real | getDuration (void) const |
Gets the duration of the emitter from when it is created or re-enabled. | |
virtual Real | getEmissionRate (void) const |
Returns the emission rate set for this emitter. | |
const String & | getEmittedEmitter (void) const |
Returns the name of the emitter to be emitted. | |
virtual bool | getEnabled (void) const |
Gets the flag indicating if this emitter is enabled or not. | |
virtual Real | getMaxDuration (void) const |
Gets the maximum duration of this emitter in seconds (see setDuration for more details) | |
virtual Real | getMaxParticleVelocity (void) const |
Returns the maximum particle velocity. | |
virtual Real | getMaxRepeatDelay (void) const |
Gets the maximum duration of this emitter in seconds (see setRepeatDelay for more details) | |
virtual Real | getMaxTimeToLive (void) const |
Gets the maximum time each particle will live for. | |
virtual Real | getMinDuration (void) const |
Gets the minimum duration of this emitter in seconds (see setDuration for more details) | |
virtual Real | getMinParticleVelocity (void) const |
Returns the minimum particle velocity. | |
virtual Real | getMinRepeatDelay (void) const |
Gets the minimum duration of this emitter in seconds (see setRepeatDelay for more details) | |
virtual Real | getMinTimeToLive (void) const |
Gets the minimum time each particle will live for. | |
const String & | getName (void) const |
Returns the name of the emitter. | |
virtual Real | getParticleVelocity (void) const |
Returns the initial velocity of particles emitted. | |
virtual const Vector3 & | getPosition (void) const |
Returns the position of this emitter relative to the center of the particle system. | |
virtual Real | getRepeatDelay (void) const |
Gets the duration of the emitter from when it is created or re-enabled. | |
virtual Real | getStartTime (void) const |
Gets the start time of the emitter. | |
virtual Real | getTimeToLive (void) const |
Gets the time each particle will live for. | |
const String & | getType (void) const |
Returns the name of the type of emitter. | |
virtual const Vector3 & | getUp (void) const |
Returns the up vector of the emitter. | |
virtual bool | isEmitted (void) const |
Return true if the emitter is emitted by another emitter. | |
virtual void | setAngle (const Radian &angle) |
Sets the maximum angle away from the emitter direction which particle will be emitted. | |
virtual void | setColour (const ColourValue &colour) |
Sets the initial colour of particles emitted. | |
virtual void | setColour (const ColourValue &colourStart, const ColourValue &colourEnd) |
Sets the range of colours for emitted particles. | |
virtual void | setColourRangeEnd (const ColourValue &colour) |
Sets the maximum colour of particles to be emitted. | |
virtual void | setColourRangeStart (const ColourValue &colour) |
Sets the minimum colour of particles to be emitted. | |
virtual void | setDirection (const Vector3 &direction) |
Sets the direction of the emitter. | |
virtual void | setDirPositionReference (const Vector3 &position, bool enable) |
Sets the direction of the emitter. | |
virtual void | setDuration (Real duration) |
Sets the duration of the emitter. | |
virtual void | setDuration (Real min, Real max) |
Sets the range of random duration for this emitter. | |
virtual void | setEmissionRate (Real particlesPerSecond) |
Sets the emission rate for this emitter. | |
virtual void | setEmitted (bool emitted) |
Set the indication (true/false) to indicate that the emitter is emitted by another emitter. | |
virtual void | setEmittedEmitter (const String &emittedEmitter) |
Sets the name of the emitter to be emitted. | |
virtual void | setEnabled (bool enabled) |
Sets whether or not the emitter is enabled. | |
virtual void | setMaxDuration (Real max) |
Sets the maximum duration of this emitter in seconds (see setDuration for more details) | |
virtual void | setMaxParticleVelocity (Real max) |
Returns the maximum particle velocity. | |
virtual void | setMaxRepeatDelay (Real max) |
Sets the maximum duration of this emitter in seconds (see setRepeatDelay for more details) | |
virtual void | setMaxTimeToLive (Real max) |
Sets the maximum time each particle will live for. | |
virtual void | setMinDuration (Real min) |
Sets the minimum duration of this emitter in seconds (see setDuration for more details) | |
virtual void | setMinParticleVelocity (Real min) |
Returns the minimum particle velocity. | |
virtual void | setMinRepeatDelay (Real min) |
Sets the minimum duration of this emitter in seconds (see setRepeatDelay for more details) | |
virtual void | setMinTimeToLive (Real min) |
Sets the minimum time each particle will live for. | |
virtual void | setName (const String &newName) |
Sets the name of the emitter. | |
virtual void | setParticleVelocity (Real min, Real max) |
Sets the initial velocity range of particles emitted. | |
virtual void | setParticleVelocity (Real speed) |
Sets the initial velocity of particles emitted. | |
virtual void | setPosition (const Vector3 &pos) |
Sets the position of this emitter relative to the particle system center. | |
virtual void | setRepeatDelay (Real duration) |
Sets the time between repeats of the emitter. | |
virtual void | setRepeatDelay (Real min, Real max) |
Sets the range of random duration for this emitter. | |
virtual void | setStartTime (Real startTime) |
Sets the 'start time' of this emitter. | |
virtual void | setTimeToLive (Real minTtl, Real maxTtl) |
Sets the range of lifetime for particles emitted. | |
virtual void | setTimeToLive (Real ttl) |
Sets the lifetime of all particles emitted. | |
virtual void | setUp (const Vector3 &up) |
Sets the notional up vector of the emitter. | |
Public Member Functions inherited from Ogre::StringInterface | |
StringInterface () | |
virtual | ~StringInterface () |
Virtual destructor, see Effective C++. | |
void | copyParametersTo (StringInterface *dest) const |
Method for copying this object's parameters to another object. | |
ParamDictionary * | getParamDictionary (void) |
Retrieves the parameter dictionary for this class. | |
const ParamDictionary * | getParamDictionary (void) const |
String | getParameter (const String &name) const |
Generic parameter retrieval method. | |
const ParameterList & | getParameters (void) const |
Retrieves a list of parameters valid for this object. | |
bool | setParameter (const String &name, const String &value) |
Generic parameter setting method. | |
void | setParameterList (const NameValuePairList ¶mList) |
Generic multiple parameter setting method. | |
Public Member Functions inherited from Ogre::Particle | |
Particle () | |
float | getOwnHeight (void) const |
Retrieves the particle's personal width, if hasOwnDimensions is true. | |
float | getOwnWidth (void) const |
Retrieves the particle's personal width, if hasOwnDimensions is true. | |
const Radian & | getRotation (void) const |
bool | hasOwnDimensions (void) const |
void | setDimensions (float width, float height) |
Sets the width and height for this particle. | |
void | setRotation (const Radian &rad) |
Sets the current rotation. | |
Additional Inherited Members | |
Public Types inherited from Ogre::Particle | |
enum | ParticleType : uint8 { Visual , Emitter } |
Type of particle. More... | |
Static Public Member Functions inherited from Ogre::StringInterface | |
static void | cleanupDictionary () |
Cleans up the static 'msDictionary' required to reset Ogre, otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the ResourceManager implementers (e.g. | |
Public Attributes inherited from Ogre::Particle | |
RGBA | mColour |
Current colour. | |
Vector3 | mDirection |
Direction (and speed) | |
float | mHeight |
Particle height. | |
ParticleType | mParticleType |
Determines the type of particle. | |
Vector3 | mPosition |
World position. | |
uint8 | mRandomTexcoordOffset |
Radian | mRotation |
Current rotation value. | |
Radian | mRotationSpeed |
Speed of rotation in radians/sec. | |
uint8 | mTexcoordIndex |
Index into the array of texture coordinates. | |
float | mTimeToLive |
Time to live, number of seconds left of particles natural life. | |
float | mTotalTimeToLive |
Total Time to live, number of seconds of particles natural life. | |
float | mWidth |
Particle width. | |
Abstract class defining the interface to be implemented by particle emitters.
Particle emitters are the sources of particles in a particle system. This class defines the ParticleEmitter interface, and provides a basic implementation for tasks which most emitters will do (these are of course overridable). Particle emitters can be grouped into types, e.g. 'point' emitters, 'box' emitters etc; each type will create particles with a different starting point, direction and velocity (although within the types you can configure the ranges of these parameters).
Ogre::ParticleEmitter::ParticleEmitter | ( | ParticleSystem * | psys | ) |
|
virtual |
Virtual destructor essential.
Sets the position of this emitter relative to the particle system center.
Returns the position of this emitter relative to the center of the particle system.
Sets the direction of the emitter.
Most emitters will have a base direction in which they emit particles (those which emit in all directions will ignore this parameter). They may not emit exactly along this vector for every particle, many will introduce a random scatter around this vector using the angle property.
direction | The base direction for particles emitted. |
Reimplemented in Ogre::AreaEmitter.
Returns the base direction of the emitter.
Sets the notional up vector of the emitter.
Many emitters emit particles from within a region, and for some that region is not circularly symmetric about the emitter direction. The up vector allows such emitters to be orientated about the direction vector.
up | The base direction for particles emitted. It must be perpendicular to the direction vector. |
Returns the up vector of the emitter.
|
virtual |
Sets the direction of the emitter.
Some particle effects need to emit particles in many random directions, but still following some rules; like not having them collide against each other. Very useful for explosions and implosions (when velocity is negative)
position | The reference position in which the direction of the particles will be calculated from, also taking into account the particle's position at the time of emission. |
enable | True to use mDirPositionRef, false to use the default behaviour with mDirection |
Returns the position reference to generate direction of emitted particles.
Returns whether direction or position reference is used.
Sets the maximum angle away from the emitter direction which particle will be emitted.
Whilst the direction property defines the general direction of emission for particles, this property defines how far the emission angle can deviate away from this base direction. This allows you to create a scatter effect - if set to 0, all particles will be emitted exactly along the emitters direction vector, whereas if you set it to 180 degrees or more, particles will be emitted in a sphere, i.e. in all directions.
angle | Maximum angle which initial particle direction can deviate from the emitter base direction vector. |
Returns the maximum angle which the initial particle direction can deviate from the emitters base direction.
Sets the initial velocity of particles emitted.
This method sets a constant speed for emitted particles. See the alternate version of this method which takes 2 parameters if you want a variable speed.
speed | The initial speed in world units per second which every particle emitted starts with. |
Sets the initial velocity range of particles emitted.
This method sets the range of starting speeds for emitted particles. See the alternate version of this method which takes 1 parameter if you want a constant speed. This emitter will randomly choose a speed between the minimum and maximum for each particle.
max | The maximum speed in world units per second for the initial particle speed on emission. |
min | The minimum speed in world units per second for the initial particle speed on emission. |
Returns the minimum particle velocity.
Returns the maximum particle velocity.
Returns the initial velocity of particles emitted.
Returns the minimum particle velocity.
Returns the maximum particle velocity.
Sets the emission rate for this emitter.
This method tells the emitter how many particles per second should be emitted. The emitter subclass does not have to emit these in a continuous burst - this is a relative parameter and the emitter may choose to emit all of the second's worth of particles every half-second for example. This is controlled by the emitter's getEmissionCount method.
particlesPerSecond | The number of particles to be emitted every second. |
Returns the emission rate set for this emitter.
Sets the lifetime of all particles emitted.
The emitter initialises particles with a time-to-live (TTL), the number of seconds a particle will exist before being destroyed. This method sets a constant TTL for all particles emitted. Note that affectors are able to modify the TTL of particles later.
ttl | The number of seconds each particle will live for. |
Sets the range of lifetime for particles emitted.
The emitter initialises particles with a time-to-live (TTL), the number of seconds a particle will exist before being destroyed. This method sets a range for the TTL for all particles emitted; the ttl may be randomised between these 2 extremes or will vary some other way depending on the emitter. Note that affectors are able to modify the TTL of particles later.
minTtl | The minimum number of seconds each particle will live for. Must be non-negative! |
maxTtl | The maximum number of seconds each particle will live for. Must be non-negative! |
Sets the minimum time each particle will live for.
Must be non-negative!
Sets the maximum time each particle will live for.
Must be non-negative!
Gets the time each particle will live for.
Gets the minimum time each particle will live for.
Gets the maximum time each particle will live for.
|
virtual |
Sets the initial colour of particles emitted.
Particles have an initial colour on emission which the emitter sets. This method sets this colour. See the alternate version of this method which takes 2 colours in order to establish a range of colours to be assigned to particles.
colour | The colour which all particles will be given on emission. |
|
virtual |
Sets the range of colours for emitted particles.
Particles have an initial colour on emission which the emitter sets. This method sets the range of this colour. See the alternate version of this method which takes a single colour in order to set a constant colour for all particles. Emitters may choose to randomly assign a colour in this range, or may use some other method to vary the colour.
colourStart | The start of the colour range |
colourEnd | The end of the colour range |
|
virtual |
Sets the minimum colour of particles to be emitted.
|
virtual |
Sets the maximum colour of particles to be emitted.
|
virtual |
Gets the colour of particles to be emitted.
|
virtual |
Gets the minimum colour of particles to be emitted.
|
virtual |
Gets the maximum colour of particles to be emitted.
Gets the number of particles which this emitter would like to emit based on the time elapsed.
For efficiency the emitter does not actually create new Particle instances (these are reused by the ParticleSystem as existing particles 'die'). The implementation for this method must return the number of particles the emitter would like to emit given the number of seconds which have elapsed (passed in as a parameter).
Initialises a particle based on the emitter's approach and parameters.
See the _getEmissionCount method for details of why there is a separation between 'requested' emissions and actual initialised particles.
pParticle | Pointer to a particle which must be initialised based on how this emitter starts particles. This is passed as a pointer rather than being created by the emitter so the ParticleSystem can reuse Particle instances, and can also set defaults itself. |
Reimplemented in Ogre::BoxEmitter, Ogre::CylinderEmitter, Ogre::EllipsoidEmitter, Ogre::HollowEllipsoidEmitter, Ogre::PointEmitter, and Ogre::RingEmitter.
References Ogre::ParticleSystem::getDefaultHeight(), and Ogre::ParticleSystem::getDefaultWidth().
Returns the name of the type of emitter.
This property is useful for determining the type of emitter procedurally so another can be created.
Sets whether or not the emitter is enabled.
You can turn an emitter off completely by setting this parameter to false.
Gets the flag indicating if this emitter is enabled or not.
Sets the 'start time' of this emitter.
By default an emitter starts straight away as soon as a ParticleSystem is first created, or also just after it is re-enabled. This parameter allows you to set a time delay so that the emitter does not 'kick in' until later.
startTime | The time in seconds from the creation or enabling of the emitter. |
Gets the start time of the emitter.
Sets the duration of the emitter.
By default emitters run indefinitely (unless you manually disable them). By setting this parameter, you can make an emitter turn off on it's own after a set number of seconds. It will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter has been set it will also repeat after a number of seconds.
duration | The duration in seconds. |
Gets the duration of the emitter from when it is created or re-enabled.
Sets the range of random duration for this emitter.
By default emitters run indefinitely (unless you manually disable them). By setting this parameter, you can make an emitter turn off on it's own after a random number of seconds. It will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter has been set it will also repeat after a number of seconds.
min | The minimum duration in seconds. |
max | The minimum duration in seconds. |
Sets the minimum duration of this emitter in seconds (see setDuration for more details)
Sets the maximum duration of this emitter in seconds (see setDuration for more details)
Gets the minimum duration of this emitter in seconds (see setDuration for more details)
Gets the maximum duration of this emitter in seconds (see setDuration for more details)
Sets the time between repeats of the emitter.
By default emitters run indefinitely (unless you manually disable them). However, if you manually disable the emitter (by calling setEnabled(false), or it's duration runs out, it will cease to emit
duration | The duration in seconds. |
Gets the duration of the emitter from when it is created or re-enabled.
Sets the range of random duration for this emitter.
By default emitters run indefinitely (unless you manually disable them). By setting this parameter, you can make an emitter turn off on it's own after a random number of seconds. It will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter has been set it will also repeat after a number of seconds.
min | The minimum duration in seconds. |
max | The minimum duration in seconds. |
Sets the minimum duration of this emitter in seconds (see setRepeatDelay for more details)
Sets the maximum duration of this emitter in seconds (see setRepeatDelay for more details)
Gets the minimum duration of this emitter in seconds (see setRepeatDelay for more details)
Gets the maximum duration of this emitter in seconds (see setRepeatDelay for more details)
Sets the name of the emitter.
Returns the name of the emitter to be emitted.
Sets the name of the emitter to be emitted.
Return true if the emitter is emitted by another emitter.
Set the indication (true/false) to indicate that the emitter is emitted by another emitter.