To make our game look shinier, we add yet another component to our rendering engine: a particle system. Particles move similarly to boids from the previous chapter, but vastly outnumber them and are not supposed to participate in complex interactions. Since individual particles are transparent, we need to take care of the rendering order and render particles after all solid objects within the frame have been rendered.
Each particle is treated as a point-like object when speaking of dynamics and rendered as a screen-aligned quadrilateral. A single particle does not exist forever and its initial lifetime FLifeTime
and current time-to-live FTTL
are stored. The sParticle
structure contains FPosition
, FVelocity
, and FAcceleration
fields describing its kinematic and dynamic properties. In addition to the physical properties, the FRGBA
field contains a color of the particle and the FSize
field describes its visual size. Let's put it this way:
struct sParticle { ...