X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel.hpp;h=ea9bf119e80e6061084117edb0e1c11549a8b1a0;hb=f01ebd81ff047eb3209e25e183564f72f587915f;hp=1e9dab9d1cde0132c30c1cdad9d656c3e5a47a7a;hpb=482114e156e91729f2529ea6bb1fe98dacdee97f;p=blank.git diff --git a/src/model.hpp b/src/model.hpp index 1e9dab9..ea9bf11 100644 --- a/src/model.hpp +++ b/src/model.hpp @@ -10,10 +10,14 @@ namespace blank { class Model { +public: + using Index = unsigned int; + public: std::vector vertices; std::vector colors; std::vector normals; + std::vector indices; public: Model(); @@ -22,11 +26,15 @@ public: Model(const Model &) = delete; Model &operator =(const Model &) = delete; + Model(Model &&); + Model &operator =(Model &&); + void Invalidate() { dirty = true; } void Clear(); - void Reserve(int); + void Reserve(int vtx_count, int idx_count); + void CheckUpdate(); void Draw(); private: @@ -37,9 +45,53 @@ private: ATTRIB_VERTEX, ATTRIB_COLOR, ATTRIB_NORMAL, + ATTRIB_INDEX, + ATTRIB_COUNT, + }; + + GLuint va; + GLuint handle[ATTRIB_COUNT]; + bool dirty; + +}; + + +class OutlineModel { + +public: + using Index = unsigned short; + +public: + std::vector vertices; + std::vector colors; + std::vector indices; + +public: + OutlineModel(); + ~OutlineModel(); + + OutlineModel(const OutlineModel &) = delete; + OutlineModel &operator =(const OutlineModel &) = delete; + + void Invalidate() { dirty = true; } + + void Clear(); + void Reserve(int vtx_count, int idx_count); + + void Draw(); + +private: + void Update(); + +private: + enum Attribute { + ATTRIB_VERTEX, + ATTRIB_COLOR, + ATTRIB_INDEX, ATTRIB_COUNT, }; + GLuint va; GLuint handle[ATTRIB_COUNT]; bool dirty;