1 #ifndef BLANK_WORLD_ENTITY_HPP_
2 #define BLANK_WORLD_ENTITY_HPP_
6 #include "../model/geometry.hpp"
7 #include "../model/EntityModel.hpp"
10 #include <glm/glm.hpp>
11 #include <glm/gtc/quaternion.hpp>
23 bool HasShape() const noexcept { return shape; }
24 const Shape *GetShape() const noexcept { return shape; }
25 void SetShape(const Shape *, const glm::vec3 &color);
26 void SetShapeless() noexcept;
28 const std::string &Name() const noexcept { return name; }
29 void Name(const std::string &n) { name = n; }
31 const AABB &Bounds() const noexcept { return bounds; }
32 void Bounds(const AABB &b) noexcept { bounds = b; }
34 bool WorldCollidable() const noexcept { return world_collision; }
35 void WorldCollidable(bool b) noexcept { world_collision = b; }
37 const glm::vec3 &Velocity() const noexcept { return velocity; }
38 void Velocity(const glm::vec3 &) noexcept;
40 const Block::Pos &Position() const noexcept { return position; }
41 void Position(const Block::Pos &) noexcept;
42 void Move(const glm::vec3 &delta) noexcept;
44 const Chunk::Pos ChunkCoords() const noexcept { return chunk; }
46 glm::vec3 AbsolutePosition() const noexcept {
47 return glm::vec3(chunk * Chunk::Extent()) + position;
50 const glm::quat &AngularVelocity() const noexcept { return angular_velocity; }
51 void AngularVelocity(const glm::quat &) noexcept;
53 const glm::mat4 &Rotation() const noexcept { return rotation; }
54 void Rotation(const glm::mat4 &) noexcept;
55 void Rotate(const glm::quat &delta) noexcept;
57 glm::mat4 Transform(const Chunk::Pos &chunk_offset) const noexcept;
58 Ray Aim(const Chunk::Pos &chunk_offset) const noexcept;
60 void Remove() noexcept { remove = true; }
61 bool CanRemove() const noexcept { return remove; }
63 void Update(int dt) noexcept;
79 glm::quat angular_velocity;