]> git.localhorst.tv Git - blank.git/blobdiff - src/world/Entity.hpp
show camera position in debug overlay
[blank.git] / src / world / Entity.hpp
index 83c1f6fb0889b88697365e34a129b15aa7dc076f..05d795f38af6e67e0b0ac2b2633628efc58f2496 100644 (file)
@@ -3,15 +3,16 @@
 
 #include "Block.hpp"
 #include "Chunk.hpp"
-#include "../model/Model.hpp"
+#include "../model/geometry.hpp"
+#include "../model/EntityModel.hpp"
 
+#include <string>
 #include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 
 
 namespace blank {
 
-class Ray;
 class Shape;
 
 class Entity {
@@ -24,6 +25,15 @@ public:
        void SetShape(const Shape *, const glm::vec3 &color);
        void SetShapeless() noexcept;
 
+       const std::string &Name() const noexcept { return name; }
+       void Name(const std::string &n) { name = n; }
+
+       const AABB &Bounds() const noexcept { return bounds; }
+       void Bounds(const AABB &b) noexcept { bounds = b; }
+
+       bool WorldCollidable() const noexcept { return world_collision; }
+       void WorldCollidable(bool b) noexcept { world_collision = b; }
+
        const glm::vec3 &Velocity() const noexcept { return velocity; }
        void Velocity(const glm::vec3 &) noexcept;
 
@@ -33,6 +43,10 @@ public:
 
        const Chunk::Pos ChunkCoords() const noexcept { return chunk; }
 
+       glm::vec3 AbsolutePosition() const noexcept {
+               return glm::vec3(chunk * Chunk::Extent()) + position;
+       }
+
        const glm::quat &AngularVelocity() const noexcept { return angular_velocity; }
        void AngularVelocity(const glm::quat &) noexcept;
 
@@ -49,7 +63,11 @@ public:
 
 private:
        const Shape *shape;
-       Model model;
+       EntityModel model;
+
+       std::string name;
+
+       AABB bounds;
 
        glm::vec3 velocity;
        Block::Pos position;
@@ -58,6 +76,8 @@ private:
        glm::quat angular_velocity;
        glm::mat4 rotation;
 
+       bool world_collision;
+
 };
 
 }