]> git.localhorst.tv Git - blobs.git/blob - src/graphics/PlainColor.hpp
660ca9313e867292a7191ab76904a7bbb66b05c1
[blobs.git] / src / graphics / PlainColor.hpp
1 #ifndef BLOBS_GRAPHICS_PLAINCOLOR_HPP_
2 #define BLOBS_GRAPHICS_PLAINCOLOR_HPP_
3
4 #include "Program.hpp"
5 #include "SimpleVAO.hpp"
6
7 #include "glm.hpp"
8
9 #include <cstdint>
10
11
12 namespace blobs {
13 namespace graphics {
14
15 class PlainColor {
16
17 public:
18         PlainColor();
19         ~PlainColor();
20
21         PlainColor(const PlainColor &) = delete;
22         PlainColor &operator =(const PlainColor &) = delete;
23
24         PlainColor(PlainColor &&) = delete;
25         PlainColor &operator =(PlainColor &&) = delete;
26
27 public:
28         void Activate() noexcept;
29
30         void SetM(const glm::mat4 &m) noexcept;
31         void SetVP(const glm::mat4 &v, const glm::mat4 &p) noexcept;
32         void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p) noexcept;
33         void SetColor(const glm::vec3 &color) noexcept;
34
35         const glm::mat4 &M() const noexcept { return m; }
36         const glm::mat4 &V() const noexcept { return v; }
37         const glm::mat4 &P() const noexcept { return p; }
38         const glm::mat4 &MV() const noexcept { return mv; }
39         const glm::mat4 &MVP() const noexcept { return mvp; }
40
41         void DrawRect() const noexcept;
42         void OutlineRect() const noexcept;
43
44 private:
45         struct Attributes {
46                 glm::vec3 position;
47         };
48         SimpleVAO<Attributes, std::uint8_t> vao;
49         Program prog;
50
51         glm::mat4 m;
52         glm::mat4 v;
53         glm::mat4 p;
54         glm::mat4 mv;
55         glm::mat4 mvp;
56
57         GLuint m_handle;
58         GLuint mv_handle;
59         GLuint mvp_handle;
60
61         GLuint fg_color_handle;
62
63 };
64
65 }
66 }
67
68 #endif