]> git.localhorst.tv Git - blobs.git/blob - src/world/Creature.hpp
170d52b0e036452e0b78120c3ab7a856a3bab336
[blobs.git] / src / world / Creature.hpp
1 #ifndef BLOBS_WORLD_CREATURE_HPP_
2 #define BLOBS_WORLD_CREATURE_HPP_
3
4 #include "../graphics/glm.hpp"
5 #include "../graphics/SimpleVAO.hpp"
6
7
8 namespace blobs {
9 namespace app {
10         struct Assets;
11 }
12 namespace graphics {
13         class Viewport;
14 }
15 namespace world {
16
17 class Body;
18
19 class Creature {
20
21 public:
22         Creature();
23         ~Creature();
24
25         Creature(const Creature &) = delete;
26         Creature &operator =(const Creature &) = delete;
27
28         Creature(Creature &&) = delete;
29         Creature &operator =(Creature &&) = delete;
30
31 public:
32         void SetBody(Body &b) noexcept { body = &b; }
33         Body &GetBody() noexcept { return *body; }
34         const Body &GetBody() const noexcept { return *body; }
35
36         void Surface(int s) noexcept { surface = s; }
37         void Position(const glm::dvec3 &p) noexcept { position = p; }
38
39         glm::dmat4 LocalTransform() noexcept;
40
41         void BuildVAO();
42         void Draw(app::Assets &, graphics::Viewport &);
43
44 private:
45         Body *body;
46         int surface;
47         glm::dvec3 position;
48
49         struct Attributes {
50                 glm::vec3 position;
51                 glm::vec3 normal;
52                 glm::vec3 texture;
53         };
54         graphics::SimpleVAO<Attributes, unsigned short> vao;
55
56 };
57
58 }
59 }
60
61 #endif