]> git.localhorst.tv Git - blank.git/blob - src/model/OutlineModel.hpp
more packet introspection from payload
[blank.git] / src / model / OutlineModel.hpp
1 #ifndef BLANK_MODEL_OUTLINEMODEL_HPP_
2 #define BLANK_MODEL_OUTLINEMODEL_HPP_
3
4 #include "../graphics/VertexArray.hpp"
5
6 #include <vector>
7 #include <GL/glew.h>
8 #include <glm/glm.hpp>
9
10
11 namespace blank {
12
13 class OutlineModel {
14
15 public:
16         using Position = glm::vec3;
17         using Color = glm::vec3;
18         using Index = unsigned short;
19
20         using Positions = std::vector<Position>;
21         using Colors = std::vector<Color>;
22         using Indices = std::vector<Index>;
23
24         enum Attribute {
25                 ATTRIB_VERTEX,
26                 ATTRIB_COLOR,
27                 ATTRIB_INDEX,
28                 ATTRIB_COUNT,
29         };
30
31         struct Buffer {
32
33                 Positions vertices;
34                 Colors colors;
35                 Indices indices;
36
37                 void Clear() noexcept {
38                         vertices.clear();
39                         colors.clear();
40                         indices.clear();
41                 }
42
43                 void Reserve(size_t p, size_t i) {
44                         vertices.reserve(p);
45                         colors.reserve(p);
46                         indices.reserve(i);
47                 }
48
49         };
50
51         using VAO = VertexArray<ATTRIB_COUNT>;
52
53 public:
54         void Update(const Buffer &) noexcept;
55
56         void Draw() noexcept;
57
58 private:
59         VAO vao;
60
61 };
62
63 }
64
65 #endif