]> git.localhorst.tv Git - blobs.git/blob - src/graphics/PlanetSurface.hpp
8e98875851d70c0d859b0386aaae604396bab070
[blobs.git] / src / graphics / PlanetSurface.hpp
1 #ifndef BLOBS_GRAPHICS_PLANETSURFACE_HPP_
2 #define BLOBS_GRAPHICS_PLANETSURFACE_HPP_
3
4 #include "Program.hpp"
5
6 #include "glm.hpp"
7
8
9 namespace blobs {
10 namespace graphics {
11
12 class ArrayTexture;
13
14 class PlanetSurface {
15
16 public:
17         static constexpr int MAX_LIGHTS = 8;
18
19 public:
20         PlanetSurface();
21         ~PlanetSurface();
22
23         PlanetSurface(const PlanetSurface &) = delete;
24         PlanetSurface &operator =(const PlanetSurface &) = delete;
25
26         PlanetSurface(PlanetSurface &&) = delete;
27         PlanetSurface &operator =(PlanetSurface &&) = 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 SetNormal(const glm::vec3 &) noexcept;
34         void SetTexture(ArrayTexture &) noexcept;
35         void SetLight(int n, const glm::vec3 &pos, const glm::vec3 &color, float strength) noexcept;
36         void SetNumLights(int n) noexcept;
37
38         const glm::mat4 &M() const noexcept { return m; }
39         const glm::mat4 &V() const noexcept { return v; }
40         const glm::mat4 &P() const noexcept { return p; }
41         const glm::mat4 &MV() const noexcept { return mv; }
42         const glm::mat4 &MVP() const noexcept { return mvp; }
43
44 private:
45         Program prog;
46
47         int num_lights;
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         GLuint sampler_handle;
59         GLuint normal_handle;
60
61         GLuint num_lights_handle;
62         GLuint light_handle[MAX_LIGHTS * 3];
63
64 };
65
66 }
67 }
68
69 #endif