X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel.hpp;h=4fd4515563022215e0ca8e2f847813b4610b501f;hb=2d8c7c015478a4528c0909f11d43998b1393948d;hp=b2a6e21a64a424fbd02639ef78004ddd369b9f3b;hpb=49c81f76b80e0de99ca57db49510eb5e3385e1d1;p=blank.git diff --git a/src/model.hpp b/src/model.hpp index b2a6e21..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,31 +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 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 { - void Velocity(glm::vec3 vel) { velocity = vel; } - void Position(glm::vec3 pos) { position = pos; } - void Move(glm::vec3 delta) { position += delta; } +public: + std::vector vertices; + std::vector colors; + +public: + OutlineModel(); + ~OutlineModel(); - // 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; } + OutlineModel(const OutlineModel &) = delete; + OutlineModel &operator =(const OutlineModel &) = delete; - void Update(int dt); + void Invalidate() { dirty = true; } + + void Clear(); + void Reserve(int); + + void Draw(); private: - glm::vec3 velocity; - glm::vec3 position; - float pitch; - float yaw; + void Update(); + +private: + enum Attribute { + ATTRIB_VERTEX, + ATTRIB_COLOR, + ATTRIB_COUNT, + }; + + GLuint handle[ATTRIB_COUNT]; + bool dirty; };