]> git.localhorst.tv Git - blank.git/blob - src/model/OutlineModel.hpp
some code reorganization
[blank.git] / src / model / OutlineModel.hpp
1 #ifndef BLANK_MODEL_OUTLINEMODEL_HPP_
2 #define BLANK_MODEL_OUTLINEMODEL_HPP_
3
4 #include <vector>
5 #include <GL/glew.h>
6 #include <glm/glm.hpp>
7
8
9 namespace blank {
10
11 class OutlineModel {
12
13 public:
14         using Position = glm::vec3;
15         using Color = glm::vec3;
16         using Index = unsigned short;
17
18         using Positions = std::vector<Position>;
19         using Colors = std::vector<Color>;
20         using Indices = std::vector<Index>;
21
22 public:
23         Positions vertices;
24         Colors colors;
25         Indices indices;
26
27 public:
28         OutlineModel() noexcept;
29         ~OutlineModel() noexcept;
30
31         OutlineModel(const OutlineModel &) = delete;
32         OutlineModel &operator =(const OutlineModel &) = delete;
33
34         void Invalidate() noexcept { dirty = true; }
35
36         void Clear() noexcept;
37         void Reserve(int vtx_count, int idx_count);
38
39         void Draw() noexcept;
40
41 private:
42         void Update() noexcept;
43
44 private:
45         enum Attribute {
46                 ATTRIB_VERTEX,
47                 ATTRIB_COLOR,
48                 ATTRIB_INDEX,
49                 ATTRIB_COUNT,
50         };
51
52         GLuint va;
53         GLuint handle[ATTRIB_COUNT];
54         bool dirty;
55
56 };
57
58 }
59
60 #endif