
The emitter holds a pool of MAX_P particles of type PartT. A varying number of these are considered active, the rest is considered dead and will not be processed until the active count is increased.
This template accepts a number of policies that control particle and emitter behavior and allow easy creation of a wide range of different particle systems with little or no overhead. These policies enrich the interface, i.e. they may be used to add functions to the emitter class that may be called from the outside.
Many of the policies will make assumptions about the used particle type. See those policies' documentation for details. If the intended particle class does not meet the requirements it must either be extended in an appropriate way or a custom policy must be created.
| Heir | the inheriting class | |
| MAX_P | the maximum number of particles this emitter can handle at the same time. Note that this many particles are always pooled, regardless of the number of active particles. | |
| PartT | the handled particle type. This may be any appropriate type including ParticleEmitter s. The particle class must at least provide a getTTL function that returns the time to the particle's death. This should usually be the remaining life time in seconds, however, this class only assumes that particles with a TTL less or equal to zero are dead. | |
| EmissionPolicy | controls the number of particles emitted each time process is called. The policy must provide a getEmissionCount function that accepts the time since the last frame (aka deltaT) and returns the number of particles to be emitted during that time. | |
| InitPolicy | handles particle initialization. This policy must provide a void init function that accepts a pointer to this emitter and a reference to the particle that will be initialized. | |
| ActionPolicy | controls the particle's behavior. The action policy must provide a void process function that accepts a pointer to this emitter, a reference to the particle being processed and the time step. That function is called for each particle every time ParticleEmitter::process is called. | |
| RenderPolicy | handles the particle rendering. It must have the following functions:
| |
| Base | this emitter's base class. This argument may be used to adapt the emitter to different rendering and scene graph infrastructures. The default is SimpleBase. |
Public Types | |
| typedef ActionPolicy< PartT, Heir > | ActionP |
| typedef EmissionPolicy | EmissionP |
| typedef Heir | Heir |
| typedef InitPolicy< PartT, Heir > | InitP |
| typedef PartT | Particle |
| typedef util::SmartPointer< util::Iterator< PartT >, util::DestructiveCopy > | ParticleIt |
| typedef RenderP::Renderer | Renderer |
| typedef RenderPolicy< PartT, Heir > | RenderP |
Public Member Functions | |
| void | clear () |
sets the number of active particles to 0 | |
| void | emit (unsigned int cnt) |
| emits the given number of particles | |
| unsigned int | getMaxParticles () const |
| unsigned int | getParticleCount () const |
| ParticleIt | getParticles () |
| accesses the active particles | |
| bool | isParticleSortingEnabled () const |
| ParticleEmitter () | |
| void | process (const float &deltaT) |
| processes all particles | |
| void | render (Renderer &, bool standAlone=true) |
| renders this emitter's active particles | |
| void | setParticleSortingEnabled (bool) |
| enables or disables particle sorting | |
Classes | |
| struct | Comparator |
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||||||
|
|
|
|||||||||
|
sets the number of active particles to The particles are not destroyed and remain pooled. |
|
||||||||||
|
emits the given number of particles
The particles are initialized using the initialization policy.
|
|
|||||||||
|
|
|
|||||||||
|
|
|
|||||||||
|
accesses the active particles Dead particles will not be traversed by the iterator.
|
|
|||||||||
|
|
|
||||||||||
|
processes all particles This function emits particles according to the emission policy and then processes each one via the action policy.
Reimplemented in ONE::fx::TexturedEmitter< Heir, MAX_P, P, E, I, A, B >, ONE::fx::TexturedEmitter< DustEmitter, MAX_P, DustParticle< DustEmitter >, Emission, Init, Action, Base >, and ONE::fx::TexturedEmitter< SparkEmitter, MAX_P, SparkParticle< SparkEmitter >, Emission, Init, Action, Base >. |
|
||||||||||||||||
|
renders this emitter's active particles
|
|
||||||||||
|
enables or disables particle sorting If sorting is enabled, particles are sorted before rendering. This can be quite costly but is necessary for certain drawing techniques. |
1.4.3