Go to the documentation of this file.
28 #ifndef __ParticleSystem_H__
29 #define __ParticleSystem_H__
396 bool debugRenderables =
false);
478 { msDefaultNonvisibleTimeout = timeout; }
String doGet(const void *target) const
void doSet(void *target, const String &val)
uint32 getTypeFlags(void) const
Override to return specific type flag.
Sort by direction functor.
vector< ParticleEmitter * >::type ParticleEmitterList
void initialiseEmittedEmitters(void)
Create a pool of emitted emitters and assign them to the free emitter list.
bool mNonvisibleTimeoutSet
Update timeout when nonvisible set? Otherwise track default.
size_t mEmittedEmitterPoolSize
The number of emitted emitters in the pool.
Real mDefaultHeight
Default height of each particle.
String doGet(const void *target) const
void configureRenderer(void)
Internal method to configure the renderer.
Real mTimeSinceLastVisible
Amount of time non-visible so far.
bool mSorted
Particles sorted according to camera?
String doGet(const void *target) const
bool getSortingEnabled(void) const
Gets whether particles are sorted relative to the camera.
static CmdEmittedEmitterQuota msEmittedEmitterQuotaCmd
SortByDirectionFunctor(const Vector3 &dir)
unsigned long mLastVisibleFrame
Last frame in which known to be visible.
Real mDefaultWidth
Default width of each particle.
virtual Real getBoundingRadius(void) const
Overridden from MovableObject.
A viewpoint from which the scene will be rendered.
static CmdHeight msHeightCmd
bool getKeepParticlesInLocalSpace(void) const
Gets whether particles (and any affector effects) remain relative to the node the particle system is ...
void _executeTriggerEmitters(ParticleEmitter *emitter, unsigned requested, Real timeElapsed)
Helper function that actually performs the emission of particles.
Particle * createParticle(void)
Manually add a particle to the system.
static CmdWidth msWidthCmd
Command object for renderer (see ParamCommand).
void doSet(void *target, const String &val)
Real mSpeedFactor
Speed factor.
Command object for local space (see ParamCommand).
SortByDistanceFunctor(const Vector3 &pos)
virtual void _notifyParticleRotated(void)
Internal callback used by Particles to notify their parent that they have been rotated.
FreeEmittedEmitterList * findFreeEmittedEmitter(const String &name)
Find the list with free emitted emitters.
void increaseEmittedEmitterPool(size_t size)
Resize the internal pool of emitted emitters.
Abstract class defining the interface required to be implemented by classes which provide rendering c...
void setSpeedFactor(Real speedFactor)
Sets a 'speed factor' on this particle system, which means it scales the elapsed real time which has ...
static CmdNonvisibleTimeout msNonvisibleTimeoutCmd
virtual bool getCullIndividually(void) const
Returns whether or not particles in this are tested individually for culling.
static void setDefaultNonVisibleUpdateTimeout(Real timeout)
Set the default nonvisible timeout for all ParticleSystem instances.
ParticleAffector * addAffector(const String &affectorType)
Adds an affector to this particle system.
virtual ~ParticleSystem()
ParticleSystem & operator=(const ParticleSystem &rhs)
Assignment operator for copying.
virtual const String & getResourceGroupName(void) const
Return the resource group to be used to load dependent resources.
static CmdCull msCullCmd
Command objects.
Abstract class defining a movable object in a scene.
String doGet(const void *target) const
void _triggerEmitters(Real timeElapsed)
Spawn new particles based on free quota and emitter requirements.
unsigned short getNumEmitters(void) const
Returns the number of emitters for this particle system.
virtual void setDefaultHeight(Real height)
See setDefaultDimensions - this sets 1 component individually.
void _update(Real timeElapsed)
Updates the particles in the system based on time elapsed.
const String & getRendererName(void) const
Gets the name of the ParticleRenderer to be used to render this particle system.
static Real getDefaultIterationInterval(void)
Get the default iteration interval for all ParticleSystem instances.
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
void setKeepParticlesInLocalSpace(bool keepLocal)
Sets whether particles (and any affector effects) remain relative to the node the particle system is ...
AxisAlignedBox mWorldAABB
World AABB, only used to compare world-space positions to calc bounds.
static CmdQuota msQuotaCmd
String doGet(const void *target) const
list< ParticleEmitter * >::type FreeEmittedEmitterList
FreeEmittedEmitterMap mFreeEmittedEmitters
Free emitted emitter list.
Convenience class to make it easy to step through all particles in a ParticleSystem.
void removeAffector(unsigned short index)
Removes an affector from the system.
virtual Real getDefaultWidth(void) const
See setDefaultDimensions - this gets 1 component individually.
unsigned short getNumAffectors(void) const
Returns the number of affectors for this particle system.
FreeParticleList mFreeParticles
Free particle queue.
void setIterationInterval(Real iterationInterval)
Sets a 'iteration interval' on this particle system.
size_t getParticleQuota(void) const
Returns the maximum number of particles this system is allowed to have active at once.
Abstract class which is command object which gets/sets parameters.
vector< ParticleAffector * >::type ParticleAffectorList
void setBounds(const AxisAlignedBox &aabb)
Set the (initial) bounds of the particle system manually.
void setEmittedEmitterQuota(size_t quota)
Sets the maximum number of emitted emitters this system is allowed to have active at once.
Command object for material (see ParamCommand).
void setRenderer(const String &typeName)
Sets the ParticleRenderer to be used to render this particle system.
void addActiveEmittedEmittersToFreeList(void)
Moves all emitted emitters from the active list to the free list.
void increasePool(size_t size)
Resize the internal pool of particles.
void doSet(void *target, const String &val)
ParticleSystemRenderer * mRenderer
The renderer used to render this particle system.
String doGet(const void *target) const
String doGet(const void *target) const
Particle * createEmitterParticle(const String &emitterName)
Manually add an emitter particle to the system.
ParticleIterator _getIterator(void)
Returns an iterator for stepping through all particles in this system.
Command object for cull_each (see ParamCommand).
String mMaterialName
Name of the material to use.
Command object for emittedEmitterQuota (see ParamCommand).
map< String, FreeEmittedEmitterList >::type FreeEmittedEmitterMap
void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority)
Sets the render queue group and group priority this entity will be rendered through.
list< Particle * >::type FreeParticleList
void initialiseEmittedEmitterPool(void)
Determine which emitters in the Particle Systems main emitter become a template for creating an pool ...
static Real getDefaultNonVisibleUpdateTimeout(void)
Get the default nonvisible timeout for all ParticleSystem instances.
bool mIsEmitting
Used to control if the particle system should emit particles or not.
bool mEmittedEmitterPoolInitialised
Indication whether the emitted emitter pool (= pool with particle emitters that are emitted) is initi...
ParticleEmitter * getEmitter(unsigned short index) const
Retrieves an emitter by it's index (zero-based).
Real getNonVisibleUpdateTimeout(void) const
Gets when the particle system should stop updating after it hasn't been visible for a while.
ActiveEmittedEmitterList mActiveEmittedEmitters
Active emitted emitter list.
size_t getEmittedEmitterQuota(void) const
Returns the maximum number of emitted emitters this system is allowed to have active at once.
EmittedEmitterPool mEmittedEmitterPool
Pool of emitted emitters for use and reuse in the active emitted emitter list.
static CmdSorted msSortedCmd
float operator()(Particle *p) const
virtual const AxisAlignedBox & getBoundingBox(void) const
Overridden from MovableObject.
void fastForward(Real time, Real interval=0.1)
Fast-forwards this system by the required number of seconds.
virtual void _updateRenderQueue(RenderQueue *queue)
Overridden from MovableObject.
void _applyMotion(Real timeElapsed)
Updates existing particle based on their momentum.
String doGet(const void *target) const
Vector3 sortDir
Direction to sort in.
void createVisualParticles(size_t poolstart, size_t poolend)
Internal method for creating ParticleVisualData instances for the pool.
void setSortingEnabled(bool enabled)
Set whether or not particles are sorted according to the camera.
virtual const String & getMaterialName(void) const
Sets the name of the material to be used for this billboard set.
Real getIterationInterval(void) const
Gets a 'iteration interval' on this particle system.
static Real msDefaultIterationInterval
Default iteration interval.
static CmdIterationInterval msIterationIntervalCmd
void _notifyReorganiseEmittedEmitterData(void)
This function clears all data structures that are used in combination with emitted emitters and sets ...
list< ParticleEmitter * >::type ActiveEmittedEmitterList
A 3D box aligned with the x/y/z axes.
Command object for particle_width (see ParamCommand).
static Real msDefaultNonvisibleTimeout
Default nonvisible update timeout.
void clear()
Empties this set of all particles.
Real mNonvisibleTimeout
Update timeout when nonvisible (0 for no timeout)
virtual Real getDefaultHeight(void) const
See setDefaultDimensions - this gets 1 component individually.
virtual void setMaterialName(const String &name, const String &groupName=ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME)
Sets the name of the material to be used for this billboard set.
void setParticleQuota(size_t quota)
Sets the maximum number of particles this system is allowed to have active at once.
list< Particle * >::type ActiveParticleList
Class representing a single particle instance.
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject ...
ParticleAffector * getAffector(unsigned short index) const
Retrieves an affector by it's index (zero-based).
void removeAllEmittedEmitters(void)
Removes all emitted emitters from this system.
Abstract class defining the interface to be implemented by particle emitters.
Class defining the common interface which classes can use to present a reflection-style,...
virtual void _notifyCurrentCamera(Camera *cam)
Overridden from MovableObject.
static void setDefaultIterationInterval(Real iterationInterval)
Set the default iteration interval for all ParticleSystem instances.
void doSet(void *target, const String &val)
void removeEmitter(unsigned short index)
Removes an emitter from the system.
Command object for quota (see ParamCommand).
String mRendererType
The name of the type of renderer used to render this system.
void setNonVisibleUpdateTimeout(Real timeout)
Sets when the particle system should stop updating after it hasn't been visible for a while.
void _notifyAttached(Node *parent, bool isTagPoint=false)
Overridden from MovableObject.
ParticlePool mParticlePool
Pool of particle instances for use and reuse in the active particle list.
bool mCullIndividual
Do we cull each particle individually?
ParticleSystemRenderer * getRenderer(void) const
Gets the ParticleRenderer to be used to render this particle system.
void removeFromActiveEmittedEmitters(ParticleEmitter *emitter)
Removes an emitter from the active emitted emitter list.
ParticleAffectorList mAffectors
List of particle affectors, ie modifiers of particles.
Sort by distance functor.
void doSet(void *target, const String &val)
ParticleEmitter * addEmitter(const String &emitterType)
Adds an emitter to this particle system.
void initParameters(void)
Internal method for initialising string interface.
Real mIterationInterval
Iteration interval.
bool mIsRendererConfigured
Have we set the material etc on the renderer?
void doSet(void *target, const String &val)
void _sortParticles(Camera *cam)
Sort the particles in the system.
void doSet(void *target, const String &val)
float operator()(Particle *p) const
Visitor object that can be used to iterate over a collection of Renderable instances abstractly.
String mOrigin
Optional origin of this particle system (eg script name)
bool mLocalSpace
Particles in local space?
bool mIterationIntervalSet
Iteration interval set? Otherwise track default.
Class for performing a radix sort (fast comparison-less sort based on byte value) on various standard...
virtual void setDefaultWidth(Real width)
See setDefaultDimensions - this sets 1 component individually.
void doSet(void *target, const String &val)
virtual void setDefaultDimensions(Real width, Real height)
Sets the default dimensions of the particles in this set.
const String & getMovableType(void) const
Overridden from MovableObject.
String doGet(const void *target) const
void removeAllAffectors(void)
Removes all the affectors from this system.
const String & getOrigin(void) const
Get the origin of this particle system, e.g.
Command object for particle_height (see ParamCommand).
Class defining particle system based special effects.
size_t getNumParticles(void) const
Gets the number of individual particles in the system right now.
Command object for nonvisible timeout (see ParamCommand).
void setEmitting(bool v)
This is used to turn on or off particle emission for this system.
String mResourceGroupName
Name of the resource group to use to load materials.
float Real
Software floating point type.
void _expire(Real timeElapsed)
Internal method used to expire dead particles.
void _notifyOrigin(const String &origin)
Notify this particle system of it's origin.
virtual void _notifyParticleResized(void)
Internal callback used by Particles to notify their parent that they have been resized.
void doSet(void *target, const String &val)
Command object for sorting (see ParamCommand).
Command object for iteration interval(see ParamCommand).
MaterialPtr mMaterial
Pointer to the material to use.
Particle * getParticle(size_t index)
Retrieve a particle from the system for manual tweaking.
static CmdRenderer msRendererCmd
void removeAllEmitters(void)
Removes all the emitters from this system.
static RadixSort< ActiveParticleList, Particle *, float > mRadixSorter
static CmdLocalSpace msLocalSpaceCmd
ParticleSystem()
Default constructor required for STL creation in manager.
Real getSpeedFactor(void) const
Gets the 'speed factor' on this particle system.
Class representing a general-purpose node an articulated scene graph.
Controller< Real > * mTimeController
Controller for time update.
Abstract class defining the interface to be implemented by particle affectors.
void setBoundsAutoUpdated(bool autoUpdate, Real stopIn=0.0f)
Sets whether the bounds will be automatically updated for the life of the particle system.
ActiveParticleList mActiveParticles
Active particle list.
void doSet(void *target, const String &val)
String doGet(const void *target) const
ParticleEmitterList mEmitters
List of particle emitters, ie sources of particles.
map< String, EmittedEmitterList >::type EmittedEmitterPool
void setRenderQueueGroup(uint8 queueID)
Sets the render queue group this entity will be rendered through.
void doSet(void *target, const String &val)
Standard 3-dimensional vector.
vector< ParticleEmitter * >::type EmittedEmitterList
ParticleSystem(const String &name, const String &resourceGroupName)
Creates a particle system with no emitters or affectors.
String doGet(const void *target) const
Class to manage the scene object rendering queue.
void _updateBounds(void)
Internal method for updating the bounds of the particle system.
void destroyVisualParticles(size_t poolstart, size_t poolend)
Internal method for destroying ParticleVisualData instances for the pool.
static CmdMaterial msMaterialCmd
Vector3 sortPos
Position to sort in.
void addFreeEmittedEmitters(void)
Add emitters from the pool to the free emitted emitter queue.
void _triggerAffectors(Real timeElapsed)
Applies the effects of affectors.
bool getEmitting() const
Returns true if the particle system emitting flag is turned on.
virtual void setCullIndividually(bool cullIndividual)
Sets whether culling tests particles in this individually as well as in a group.
vector< Particle * >::type ParticlePool
size_t mPoolSize
The number of particles in the pool.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.