X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2FOutlineModel.hpp;h=ba85fc8e57243b9418765c9fd0125f2a2a93f7f5;hb=7bb75960dbf9bfdee9ac865384aca81791b3da5c;hp=308ab5195c68a07a638d9caaeec0dd2b0a735f73;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/model/OutlineModel.hpp b/src/model/OutlineModel.hpp index 308ab51..ba85fc8 100644 --- a/src/model/OutlineModel.hpp +++ b/src/model/OutlineModel.hpp @@ -1,6 +1,8 @@ #ifndef BLANK_MODEL_OUTLINEMODEL_HPP_ #define BLANK_MODEL_OUTLINEMODEL_HPP_ +#include "../graphics/VertexArray.hpp" + #include #include #include @@ -19,39 +21,42 @@ public: using Colors = std::vector; using Indices = std::vector; -public: - Positions vertices; - Colors colors; - Indices indices; + enum Attribute { + ATTRIB_VERTEX, + ATTRIB_COLOR, + ATTRIB_INDEX, + ATTRIB_COUNT, + }; -public: - OutlineModel() noexcept; - ~OutlineModel() noexcept; + struct Buffer { - OutlineModel(const OutlineModel &) = delete; - OutlineModel &operator =(const OutlineModel &) = delete; + Positions vertices; + Colors colors; + Indices indices; - void Invalidate() noexcept { dirty = true; } + void Clear() noexcept { + vertices.clear(); + colors.clear(); + indices.clear(); + } - void Clear() noexcept; - void Reserve(int vtx_count, int idx_count); + void Reserve(size_t p, size_t i) { + vertices.reserve(p); + colors.reserve(p); + indices.reserve(i); + } - void Draw() noexcept; + }; -private: - void Update() noexcept; + using VAO = VertexArray; -private: - enum Attribute { - ATTRIB_VERTEX, - ATTRIB_COLOR, - ATTRIB_INDEX, - ATTRIB_COUNT, - }; +public: + void Update(const Buffer &) noexcept; - GLuint va; - GLuint handle[ATTRIB_COUNT]; - bool dirty; + void Draw() noexcept; + +private: + VAO vao; };