X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel.hpp;h=ea9bf119e80e6061084117edb0e1c11549a8b1a0;hb=e5b1f5ef948724145ec2ed5777f4da1d6d862afd;hp=4fd4515563022215e0ca8e2f847813b4610b501f;hpb=2d8c7c015478a4528c0909f11d43998b1393948d;p=blank.git diff --git a/src/model.hpp b/src/model.hpp index 4fd4515..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,11 @@ private: ATTRIB_VERTEX, ATTRIB_COLOR, ATTRIB_NORMAL, + ATTRIB_INDEX, ATTRIB_COUNT, }; + GLuint va; GLuint handle[ATTRIB_COUNT]; bool dirty; @@ -48,9 +58,13 @@ private: class OutlineModel { +public: + using Index = unsigned short; + public: std::vector vertices; std::vector colors; + std::vector indices; public: OutlineModel(); @@ -62,7 +76,7 @@ public: void Invalidate() { dirty = true; } void Clear(); - void Reserve(int); + void Reserve(int vtx_count, int idx_count); void Draw(); @@ -73,9 +87,11 @@ private: enum Attribute { ATTRIB_VERTEX, ATTRIB_COLOR, + ATTRIB_INDEX, ATTRIB_COUNT, }; + GLuint va; GLuint handle[ATTRIB_COUNT]; bool dirty;