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