]> git.localhorst.tv Git - blobs.git/blob - src/graphics/SunSurface.hpp
randomize creature properties a bit
[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 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 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