Rebel Fork Framework
Particle systems

The ParticleEmitter class derives from BillboardSet to implement a particle system that updates automatically.

The parameters of the particle system are stored in a ParticleEffect resource class, which uses XML format. Call SetEffect() to assign the effect resource to the emitter. Most of the parameters can take either a single value, or minimum and maximum values to allow for random variation. See below for all supported parameters:

<particleemitter>
<material name="MaterialName" />
<updateinvisible enable="true|false" />
<relative enable="true|false" />
<scaled enable="true|false" />
<sorted enable="true|false" />
<fixedscreensize enable="true|false" />
<emittertype value="sphere|box" />
<emittersize value="x y z" />
<emitterradius value="x" />
<direction min="x1 y1 z1" max="x2 y2 z2" />
<constantforce value="x y z" />
<dampingforce value="x" />
<activetime value="t" />
<inactivetime value="t" />
<interval min="t1" max="t2" />
<emissionrate min="t1" max="t2" />
<particlesize min="x1 y1" max="x2 y2" />
<timetolive min="t1" max="t2" />
<velocity min="x1" max="x2" />
<rotation min="x1" max="x2" />
<rotationspeed min="x1" max="x2" />
<sizedelta add="x" mul="y" />
<color value="r g b a" />
<colorfade color="r g b a" time="t" />
<texanim uv="u1 v1 u2 v2" time="t" />
</particleemitter>

Notes:

  • Zero active or inactive time period means infinite.
  • Interval is the reciprocal of emission rate. Either can be used to define the rate at which new particles are emitted.
  • Instead of defining a single color element, several colorfade elements can be defined in time order to describe how the particles change color over time.
  • Use several texanim elements to define a texture animation for the particles.