X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel.hpp;h=4fd4515563022215e0ca8e2f847813b4610b501f;hb=2d8c7c015478a4528c0909f11d43998b1393948d;hp=c0bda4112fe052231340dbcd3a30ce7857e4c3df;hpb=d18be10ef3f0a7b61c6f5c4c4096ca2b776c75b3;p=blank.git diff --git a/src/model.hpp b/src/model.hpp index c0bda41..4fd4515 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,25 +10,74 @@ 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; + + 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π) - void Pitch(float p) { pitch = p; } - void RotatePitch(float delta) { pitch += delta; } - 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_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 Clear(); + void Reserve(int); + + void Draw(); + +private: + void Update(); + +private: + enum Attribute { + ATTRIB_VERTEX, + ATTRIB_COLOR, + ATTRIB_COUNT, + }; + + GLuint handle[ATTRIB_COUNT]; + bool dirty; };