C# Class Axiom.ParticleSystems.ParticleEmitter

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).

Because there are so many types of emitters you could use, the engine chooses not to dictate the available types. It comes with some in-built, but allows plugins or games to extend the emitter types available. This is done by subclassing ParticleEmitter to have the appropriate emission behavior you want, and also creating a subclass of ParticleEmitterFactory which is responsible for creating instances of your new emitter type. You register this factory with the ParticleSystemManager using AddEmitterFactory, and from then on emitters of this type can be created either from code or through XML particle scripts by naming the type.

This same approach is used for ParticleAffectors (which modify existing particles per frame). This means that the engine is particularly flexible when it comes to creating particle system effects, with literally infinite combinations of emitter and affector types, and parameters within those types.

Inheritance: IConfigurable
Afficher le fichier Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Свойство Type Description
angle float
colorFixed ColorEx
colorRangeEnd ColorEx
colorRangeStart ColorEx
commandTable AxiomCollection
direction Vector3
durationFixed float
durationMax float
durationMin float
durationRemain float
emissionRate float
emitted bool
emittedEmitter string
fixedSpeed float
fixedTTL float
isEnabled bool
maxSpeed float
maxTTL float
minSpeed float
minTTL float
position Vector3
remainder float
repeatDelayFixed float
repeatDelayMax float
repeatDelayMin float
repeatDelayRemain float
startTime float
type string
up Vector3

Méthodes publiques

Méthode Description
CopyTo ( ParticleEmitter emitter ) : void

GenerateConstantEmissionCount ( float timeElapsed ) : ushort

Utility method for generating an emission count based on a constant emission rate.

GetEmissionCount ( float timeElapsed ) : ushort

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).

Based on the return value from this method, the ParticleSystem class will call InitParticle once for each particle it chooses to allow to be emitted by this emitter. The emitter should not track these InitParticle calls, it should assume all emissions requested were made (even if they could not be because of particle quotas).

InitParticle ( Particle particle ) : void

Initializes 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 initialized particles.

Move ( float x, float y, float z ) : void
MoveTo ( float x, float y, float z ) : void
ParticleEmitter ( ParticleSystem ps ) : System

Default constructor.

ScaleVelocity ( float velocityMultiplier ) : void

Scales the velocity of the emitters by the float argument

SetDuration ( float min, float max ) : void

Sets the min/max duration range for this emitter.

SetParam ( string name, string val ) : bool

Méthodes protégées

Méthode Description
GenerateEmissionColor ( ColorEx &color ) : void

Internal method for generating a color for a particle.

GenerateEmissionDirection ( Vector3 &dest ) : void

Utility method for generating particle exit direction

GenerateEmissionTTL ( ) : float

Utility method for generating a time-to-live for a particle.

GenerateEmissionVelocity ( Vector3 &dest ) : void

Utility method to apply velocity to a particle direction.

InitDurationRepeat ( ) : void

RegisterCommands ( ) : void

Registers all attribute names with their respective parser.

Methods meant to serve as attribute parsers should use a method attribute to

Method Details

CopyTo() public méthode

public CopyTo ( ParticleEmitter emitter ) : void
emitter ParticleEmitter
Résultat void

GenerateConstantEmissionCount() public méthode

Utility method for generating an emission count based on a constant emission rate.
public GenerateConstantEmissionCount ( float timeElapsed ) : ushort
timeElapsed float
Résultat ushort

GenerateEmissionColor() protected méthode

Internal method for generating a color for a particle.
protected GenerateEmissionColor ( ColorEx &color ) : void
color ColorEx /// The color object that will be altered depending on the method of generating the particle color. ///
Résultat void

GenerateEmissionDirection() protected méthode

Utility method for generating particle exit direction
protected GenerateEmissionDirection ( Vector3 &dest ) : void
dest Vector3 Normalized vector dictating new direction.
Résultat void

GenerateEmissionTTL() protected méthode

Utility method for generating a time-to-live for a particle.
protected GenerateEmissionTTL ( ) : float
Résultat float

GenerateEmissionVelocity() protected méthode

Utility method to apply velocity to a particle direction.
protected GenerateEmissionVelocity ( Vector3 &dest ) : void
dest Vector3 The normalized vector to scale by a randomly generated scale between min and max speed.
Résultat void

GetEmissionCount() public abstract méthode

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).

Based on the return value from this method, the ParticleSystem class will call InitParticle once for each particle it chooses to allow to be emitted by this emitter. The emitter should not track these InitParticle calls, it should assume all emissions requested were made (even if they could not be because of particle quotas).

public abstract GetEmissionCount ( float timeElapsed ) : ushort
timeElapsed float
Résultat ushort

InitDurationRepeat() protected méthode

protected InitDurationRepeat ( ) : void
Résultat void

InitParticle() public méthode

Initializes 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 initialized particles.
public InitParticle ( Particle particle ) : void
particle Particle Reference to a particle which must be initialized based on how this emitter starts particles
Résultat void

Move() public méthode

public Move ( float x, float y, float z ) : void
x float
y float
z float
Résultat void

MoveTo() public méthode

public MoveTo ( float x, float y, float z ) : void
x float
y float
z float
Résultat void

ParticleEmitter() public méthode

Default constructor.
public ParticleEmitter ( ParticleSystem ps ) : System
ps ParticleSystem
Résultat System

RegisterCommands() protected méthode

Registers all attribute names with their respective parser.
Methods meant to serve as attribute parsers should use a method attribute to
protected RegisterCommands ( ) : void
Résultat void

ScaleVelocity() public méthode

Scales the velocity of the emitters by the float argument
public ScaleVelocity ( float velocityMultiplier ) : void
velocityMultiplier float
Résultat void

SetDuration() public méthode

Sets the min/max duration range for this emitter.
public SetDuration ( float min, float max ) : void
min float
max float
Résultat void

SetParam() public méthode

public SetParam ( string name, string val ) : bool
name string
val string
Résultat bool

Property Details

angle protected_oe property

Angle around direction which particles may be emitted, internally radians but degrees for interface.
protected float angle
Résultat float

colorFixed protected_oe property

Initial color of particles (fixed).
protected ColorEx colorFixed
Résultat ColorEx

colorRangeEnd protected_oe property

Initial color of particles (range end).
protected ColorEx colorRangeEnd
Résultat ColorEx

colorRangeStart protected_oe property

Initial color of particles (range start).
protected ColorEx colorRangeStart
Résultat ColorEx

commandTable protected_oe property

protected AxiomCollection commandTable
Résultat AxiomCollection

direction protected_oe property

Base direction of the emitter, may not be used by some emitters.
protected Vector3 direction
Résultat Vector3

durationFixed protected_oe property

Length of time emitter will run for (0 = forever).
protected float durationFixed
Résultat float

durationMax protected_oe property

Maximum length of time the emitter will run for (0 = forever).
protected float durationMax
Résultat float

durationMin protected_oe property

Minimum length of time emitter will run for (0 = forever).
protected float durationMin
Résultat float

durationRemain protected_oe property

Current duration remainder.
protected float durationRemain
Résultat float

emissionRate protected_oe property

Rate in particles per second at which this emitter wishes to emit particles.
protected float emissionRate
Résultat float

emitted protected_oe property

If 'true', this emitter is emitted by another emitter. NB. That doesn´t imply that the emitter itself emits other emitters (that could or could not be the case)
protected bool emitted
Résultat bool

emittedEmitter protected_oe property

The name of the emitter to be emitted (optional)
protected string emittedEmitter
Résultat string

fixedSpeed protected_oe property

Fixed speed of particles.
protected float fixedSpeed
Résultat float

fixedTTL protected_oe property

Initial time-to-live of particles (fixed).
protected float fixedTTL
Résultat float

isEnabled protected_oe property

Whether this emitter is currently enabled (defaults to true).
protected bool isEnabled
Résultat bool

maxSpeed protected_oe property

Max speed of particles.
protected float maxSpeed
Résultat float

maxTTL protected_oe property

Initial time-to-live of particles (max).
protected float maxTTL
Résultat float

minSpeed protected_oe property

Min speed of particles.
protected float minSpeed
Résultat float

minTTL protected_oe property

Initial time-to-live of particles (min).
protected float minTTL
Résultat float

position protected_oe property

Position relative to the center of the ParticleSystem.
protected Vector3 position
Résultat Vector3

remainder protected_oe property

protected float remainder
Résultat float

repeatDelayFixed protected_oe property

Fixed time between each repeat.
protected float repeatDelayFixed
Résultat float

repeatDelayMax protected_oe property

Maximum time between each repeat.
protected float repeatDelayMax
Résultat float

repeatDelayMin protected_oe property

Minimum time between each repeat.
protected float repeatDelayMin
Résultat float

repeatDelayRemain protected_oe property

Repeat delay left.
protected float repeatDelayRemain
Résultat float

startTime protected_oe property

Start time (in seconds from start of first call to ParticleSystem to update).
protected float startTime
Résultat float

type protected_oe property

Name of the type of emitter, MUST be initialized by subclasses.
protected string type
Résultat string

up protected_oe property

Notional up vector, just used to speed up generation of variant directions.
protected Vector3 up
Résultat Vector3