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