X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel.hpp;h=4423cd7115338f671847d2461def60ffd11454cd;hb=cb959294a8271969ddfe411471d7f04e82c4788a;hp=938fd4453d6f700d51391509ab07a97b305a1676;hpb=ea1ce7b0fb7709ae56977480821ac96a231a0686;p=blank.git diff --git a/src/model.hpp b/src/model.hpp index 938fd44..4423cd7 100644 --- a/src/model.hpp +++ b/src/model.hpp @@ -1,6 +1,8 @@ #ifndef BLANK_MODEL_HPP_ #define BLANK_MODEL_HPP_ +#include +#include #include @@ -8,27 +10,77 @@ namespace blank { class Model { +public: + std::vector vertices; + std::vector colors; + std::vector normals; + public: Model(); ~Model(); - glm::mat4 Transform() const; + Model(const Model &) = delete; + Model &operator =(const Model &) = delete; + + Model(Model &&); + Model &operator =(Model &&); + + void Invalidate() { dirty = true; } + + void Clear(); + void Reserve(int); + + void Draw(); + +private: + void Update(); + +private: + enum Attribute { + ATTRIB_VERTEX, + ATTRIB_COLOR, + ATTRIB_NORMAL, + ATTRIB_COUNT, + }; + + GLuint handle[ATTRIB_COUNT]; + bool dirty; + +}; + + +class OutlineModel { + +public: + std::vector vertices; + std::vector colors; + +public: + OutlineModel(); + ~OutlineModel(); + + OutlineModel(const OutlineModel &) = delete; + OutlineModel &operator =(const OutlineModel &) = delete; + + void Invalidate() { dirty = true; } - void Position(glm::vec3 pos) { position = pos; } - void Move(glm::vec3 delta) { position += delta; } + void Clear(); + void Reserve(int); - // all angles in radians (full circle = 2π) - float Pitch() const { return pitch; } - void Pitch(float p) { pitch = p; } - void RotatePitch(float delta) { pitch += delta; } - float Yaw() const { return yaw; } - void Yaw(float y) { yaw = y; } - void RotateYaw(float delta) { yaw += delta; } + void Draw(); private: - glm::vec3 position; - float pitch; - float yaw; + void Update(); + +private: + enum Attribute { + ATTRIB_VERTEX, + ATTRIB_COLOR, + ATTRIB_COUNT, + }; + + GLuint handle[ATTRIB_COUNT]; + bool dirty; };