]> git.localhorst.tv Git - blank.git/blobdiff - src/model.hpp
outline pointed-at block
[blank.git] / src / model.hpp
index 938fd4453d6f700d51391509ab07a97b305a1676..4fd4515563022215e0ca8e2f847813b4610b501f 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef BLANK_MODEL_HPP_
 #define BLANK_MODEL_HPP_
 
+#include <vector>
+#include <GL/glew.h>
 #include <glm/glm.hpp>
 
 
@@ -8,27 +10,74 @@ namespace blank {
 
 class Model {
 
+public:
+       std::vector<glm::vec3> vertices;
+       std::vector<glm::vec3> colors;
+       std::vector<glm::vec3> 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π)
-       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_NORMAL,
+               ATTRIB_COUNT,
+       };
+
+       GLuint handle[ATTRIB_COUNT];
+       bool dirty;
+
+};
+
+
+class OutlineModel {
+
+public:
+       std::vector<glm::vec3> vertices;
+       std::vector<glm::vec3> 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;
 
 };