diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:55:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 15:55:37 -0400 |
commit | 90aadf3844386824140a20d7fbb847bc16009a94 (patch) | |
tree | 6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /src/renderer/mesh.h | |
parent | bc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff) | |
parent | 86f0106d0523825549f1e74b835688c78a10cf6c (diff) | |
download | therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.gz therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.bz2 therapy-90aadf3844386824140a20d7fbb847bc16009a94.zip |
Merge pull request #7 from hatkirby/es-rewrite
The ECS rewrite exceeds the original branch in functionality, so it is time to merge it in.
Diffstat (limited to 'src/renderer/mesh.h')
-rw-r--r-- | src/renderer/mesh.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/renderer/mesh.h b/src/renderer/mesh.h new file mode 100644 index 0000000..06bf65d --- /dev/null +++ b/src/renderer/mesh.h | |||
@@ -0,0 +1,62 @@ | |||
1 | #ifndef MESH_H_76B72E12 | ||
2 | #define MESH_H_76B72E12 | ||
3 | |||
4 | #include <string> | ||
5 | #include "gl.h" | ||
6 | #include "wrappers.h" | ||
7 | |||
8 | class Mesh { | ||
9 | public: | ||
10 | |||
11 | Mesh(std::string filename); | ||
12 | |||
13 | Mesh(const Mesh& other) = delete; | ||
14 | Mesh& operator=(const Mesh& other) = delete; | ||
15 | |||
16 | inline GLuint getVertexBufferId() const | ||
17 | { | ||
18 | return vertexBuffer_.getId(); | ||
19 | } | ||
20 | |||
21 | inline GLuint getUvBufferId() const | ||
22 | { | ||
23 | return uvBuffer_.getId(); | ||
24 | } | ||
25 | |||
26 | inline GLuint getNormalBufferId() const | ||
27 | { | ||
28 | return normalBuffer_.getId(); | ||
29 | } | ||
30 | |||
31 | inline GLuint getIndexBufferId() const | ||
32 | { | ||
33 | return indexBuffer_.getId(); | ||
34 | } | ||
35 | |||
36 | inline size_t getIndexCount() const | ||
37 | { | ||
38 | return indexCount_; | ||
39 | } | ||
40 | |||
41 | private: | ||
42 | |||
43 | struct element { | ||
44 | size_t vertexId; | ||
45 | size_t uvId; | ||
46 | size_t normalId; | ||
47 | |||
48 | bool operator<(const element& other) const | ||
49 | { | ||
50 | return std::tie(vertexId, uvId, normalId) < | ||
51 | std::tie(other.vertexId, other.uvId, other.normalId); | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | GLBuffer vertexBuffer_; | ||
56 | GLBuffer uvBuffer_; | ||
57 | GLBuffer normalBuffer_; | ||
58 | GLBuffer indexBuffer_; | ||
59 | size_t indexCount_; | ||
60 | }; | ||
61 | |||
62 | #endif /* end of include guard: MESH_H_76B72E12 */ | ||