Currently, there is one ParticleRenderer class, which both holds the data of all particles to be rendered and renders them.
This is a little inflexible. It means that all particles have to follow the same behaviours (one shader for all particles). It also means that if you want to create a particle, it has to be done during the draw phase (the only time that game entities have access to the ParticleRenderer).
Instead, ParticleRenderer should only contain code for rendering particles, and handling particle maintenance, etc. should be done by a ParticleEmitter. The ParticleEmitter stores all the data for it's particles, and is passed to the ParticleRenderer during the draw phase for rendering.
ParticleEmitter should be fairly customizable:
Length (how long to emit particles for with one activation)
Shader
Colours
Particle lifetime
Whether or not to destroy itself when no particles remain
Currently, there is one
ParticleRenderer
class, which both holds the data of all particles to be rendered and renders them.This is a little inflexible. It means that all particles have to follow the same behaviours (one shader for all particles). It also means that if you want to create a particle, it has to be done during the draw phase (the only time that game entities have access to the
ParticleRenderer
).Instead,
ParticleRenderer
should only contain code for rendering particles, and handling particle maintenance, etc. should be done by aParticleEmitter
. TheParticleEmitter
stores all the data for it's particles, and is passed to theParticleRenderer
during the draw phase for rendering.ParticleEmitter
should be fairly customizable: