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 frame. 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();

    // 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.
    Particles(EntKey host, uint capacity, const M4f &pos);

    // Destructor.
    ~Particles();

private:
    byte wobj[1216];
};