#ifndef _H_DRAWABLE_H #define _H_DRAWABLE_H #include #include #include #include using UniformValue = std::variant< int, bool, float, double, glm::mat4, glm::vec2 >; struct Uniform { std::string name; UniformValue value; }; class Drawable { public: virtual void draw() = 0; const unsigned getShaderID() const { return shaderID; } const std::vector& getUniforms() { return uniforms; } const std::vector& getOneShotUniforms() { return oneShotUniforms; } void clearOneShot() { oneShotUniforms.clear(); } void clearUniforms() { uniforms.clear(); } protected: unsigned shaderID; template void editUniform(const std::string& name, T value) { uniforms.emplace_back(Uniform {name, value}); } template void editUniformOnce(const std::string& name, T value) { oneShotUniforms.emplace_back(Uniform {name, value}); } private: std::vector uniforms; std::vector oneShotUniforms; }; #endif // _H_DRAWABLE_H