]> git.localhorst.tv Git - blobs.git/blob - src/graphics/SunSurface.hpp
more orbits and stuff
[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 SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p) noexcept;
33         void SetLight(const glm::vec3 &color, float strength) 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 Draw() const noexcept;
42
43 private:
44         struct Attributes {
45                 glm::vec3 position;
46         };
47         SimpleVAO<Attributes, std::uint8_t> vao;
48         Program prog;
49
50         glm::mat4 m;
51         glm::mat4 v;
52         glm::mat4 p;
53         glm::mat4 mv;
54         glm::mat4 mvp;
55
56         GLuint m_handle;
57         GLuint mv_handle;
58         GLuint mvp_handle;
59
60         GLuint light_color_handle;
61         GLuint light_strength_handle;
62
63 };
64
65 }
66 }
67
68 #endif