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