]> git.localhorst.tv Git - blobs.git/blob - src/graphics/CreatureSkin.hpp
creature skin overhaul
[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
7 namespace blobs {
8 namespace graphics {
9
10 class ArrayTexture;
11
12 class CreatureSkin {
13
14 public:
15         static constexpr int MAX_LIGHTS = 8;
16
17 public:
18         CreatureSkin();
19         ~CreatureSkin();
20
21         CreatureSkin(const CreatureSkin &) = delete;
22         CreatureSkin &operator =(const CreatureSkin &) = delete;
23
24         CreatureSkin(CreatureSkin &&) = delete;
25         CreatureSkin &operator =(CreatureSkin &&) = delete;
26
27 public:
28         void Activate() noexcept;
29
30         void SetM(const glm::mat4 &m) noexcept;
31         void SetV(const glm::mat4 &v) noexcept;
32         void SetVP(const glm::mat4 &v, const glm::mat4 &p) noexcept;
33         void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p) noexcept;
34         void SetBaseColor(const glm::vec3 &) noexcept;
35         void SetHighlightColor(const glm::vec4 &) noexcept;
36         void SetTexture(ArrayTexture &) noexcept;
37         void SetLight(int n, const glm::vec3 &pos, const glm::vec3 &color, float strength) noexcept;
38         void SetNumLights(int n) noexcept;
39
40         const glm::mat4 &M() const noexcept { return m; }
41         const glm::mat4 &V() const noexcept { return v; }
42         const glm::mat4 &P() const noexcept { return p; }
43         const glm::mat4 &MV() const noexcept { return mv; }
44         const glm::mat4 &MVP() const noexcept { return mvp; }
45
46 private:
47         Program prog;
48
49         int num_lights;
50
51         glm::mat4 m;
52         glm::mat4 v;
53         glm::mat4 p;
54         glm::mat4 mv;
55         glm::mat4 mvp;
56
57         GLuint m_handle;
58         GLuint mv_handle;
59         GLuint mvp_handle;
60
61         GLuint base_color_handle;
62         GLuint highlight_color_handle;
63         GLuint sampler_handle;
64         GLuint num_lights_handle;
65         GLuint light_handle[MAX_LIGHTS * 3];
66
67 };
68
69 }
70 }
71
72 #endif