]> git.localhorst.tv Git - blobs.git/blob - src/graphics/SunSurface.hpp
f10e0e5db6a2da7933660dcca2956a45dd58453a
[blobs.git] / src / graphics / SunSurface.hpp
1 #ifndef BLOBS_GRAPHICS_SUNSURFACE_HPP_
2 #define BLOBS_GRAPHICS_SUNSURFACE_HPP_
3
4 #include "Program.hpp"
5 #include "SimpleVAO.hpp"
6
7 #include <cstdint>
8
9
10 namespace blobs {
11 namespace graphics {
12
13 class ArrayTexture;
14
15 class SunSurface {
16
17 public:
18         SunSurface();
19         ~SunSurface();
20
21         SunSurface(const SunSurface &) = delete;
22         SunSurface &operator =(const SunSurface &) = delete;
23
24         SunSurface(SunSurface &&) = delete;
25         SunSurface &operator =(SunSurface &&) = delete;
26
27 public:
28         void Activate() noexcept;
29
30         void SetM(const glm::mat4 &m) noexcept;
31         void SetV(const glm::mat4 &v) noexcept;
32         void SetVP(const glm::mat4 &v, const glm::mat4 &p) noexcept;
33         void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p) noexcept;
34         void SetLight(const glm::vec3 &color, float strength) noexcept;
35
36         const glm::mat4 &M() const noexcept { return m; }
37         const glm::mat4 &V() const noexcept { return v; }
38         const glm::mat4 &P() const noexcept { return p; }
39         const glm::mat4 &MV() const noexcept { return mv; }
40         const glm::mat4 &MVP() const noexcept { return mvp; }
41
42         void Draw() 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 light_color_handle;
62         GLuint light_strength_handle;
63
64 };
65
66 }
67 }
68
69 #endif