Animated Mesh


// GPU Animated mesh.
class RVAPI AnimMesh : public Geometry
{
public:
    // Get frame count.
    uint GetFrameCount() const;

    // Check if animation is done.
    bool operator ! () const;

    // Start asynchronous animation.
    uint Animate();

    // Wait for animation.
    void Wait();

    // Begin asynchronous animation. Adjust by +/- [delay] seconds.
    void Start(float delay = 0);

    // End asynchronous animation.
    void Stop();

    // Pass2 animation.
    void Pass2();

    // Clear animation.
    void Clear();

    // Set animation to [name] using [mode] behavior, possibly in [reverse].
    void SetAnim(wcstr name, AnimInt::Mode mode = AnimInt::Mode::CLAMP, bool reverse = false);

    // Internal.
    void *operator () () const { return (void *)wobj; }

    // Construct animated mesh with [host] entity, animation [name] and mesh position [pos].
    AnimMesh(EntKey host, wcstr animName, const M4f &pos = M4fIdent());

    // Destructor.
    ~AnimMesh() override;

private:
    byte wobj[1664];
};