diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-16 16:04:32 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-16 16:04:32 -0500 |
| commit | ed08b673c50b076042d8f0c49501372168142764 (patch) | |
| tree | 18ecda99942ef11ce4023c3ad4437976f96b75da /src/renderer/mesh.h | |
| parent | 224645d1071c14b4829dbb3ae35870868fcff85a (diff) | |
| download | therapy-ed08b673c50b076042d8f0c49501372168142764.tar.gz therapy-ed08b673c50b076042d8f0c49501372168142764.tar.bz2 therapy-ed08b673c50b076042d8f0c49501372168142764.zip | |
Refactored renderer
Renderer is basically now more C++'y, as it makes more use of classes (a lot of GL types have been wrapped), and the renderer itself is now a class. The monitor mesh is also now indexed. Tweaked the NTSC artifacting after inadvertently fixing a bug with the way the image was loaded.
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 */ | ||
