Particles
// High performance GPU particle renderer that can be used to build many types of particle systems.
// No prebuilt particle system is provided by the engine.
class RVAPI Particles : public Geometry
{
public:
// Begin particle add. All particles must be re-added each OnAnimate(). Call SetPColor(), SetPMat()
// and SetPPos() for each particle. SetPPos() must be called last for each particle. Call ndAdd()
// after all particles are added.
void BeginAdd();
// Set particle color.
void SetPColor(const Color &color);
// Set particle material.
void SetPMat(wcstr matName);
// Set particle position. Call this last on each particle.
void SetPPos(const M4f &pos);
// End particle add.
void EndAdd();
// Animate particles with the BeginAdd() / EndAdd() set of functions. Call this function in
// OnPass1() callback and pair with Wait() in OnPass2() callback.
void Animate();
// Wait for particle rendering.
void Wait();
// Internal.
void *operator () () const { return (void *)wobj; }
// Construct particles. [host] is the entity hosting this particles object. [capacity] is the
// maximum number of particles that can be added. [pos] is particles position. [fps] is the
// number of particle updates per second.
Particles(EntKey host, uint capacity, const M4f &pos, float fps = 30);
// Destructor.
virtual ~Particles();
protected:
virtual void OnAnimate() {};
private:
byte wobj[1280];
friend ParticlesBridge;
};