Originally, all the ParticleEmitter functionality was packed down into two classes: ParticleData and ParticleEmitters.
ParticleEmitters had the responsibility of:

  • calculating particles initial position
  • manage the particle memory pool
  • render the particles
  • simulate the particles
  • update the particles
  • and the list goes on and on..

Now I've split it up into more smaller classes:


It's pretty simple actually, you have the ParticleSystem class, which delegates the work into the other classes. Besides delegating the work out, it's also responsible for being the glue between the components of the ParticleSystem and the rest of the engine, so it handles all external requests (like emitParticles) and sends the appropriate commands to the components.

ParticleRenderers renders the particle, whatever this entails is up to the renderer. It could be Billboards, Pointlights or whatever. By changing how particles are rendered, you can easily accomplish stuff like glowing particles, ribbonParticles etc. Or even utilize other objects as if they were particles!

The ParticleEmitter changes the pattern which particles are emitted in. This is where you'll create your GraphEmitter, GroundEmitter, MaskEmitter or whatever you need.

Last but not least you have the IParticleBehaviours, which is small components you plug into the system to affect how particle behave. This way you can have attracted particles, sticky particles or particles that can collide with objects without having to touch any of the existing code!

Here is a short video of the ParticleSystem refactor in action:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License