]> git.localhorst.tv Git - blank.git/blobdiff - src/world/Chunk.hpp
fix entity/world collision
[blank.git] / src / world / Chunk.hpp
index 6e87a0907d15059cea8b15e5255022b333b4c12b..4938c1b1a7a92f3f34c861e30287ca23491c6686 100644 (file)
@@ -14,6 +14,7 @@
 namespace blank {
 
 class BlockType;
+class Entity;
 class WorldCollision;
 
 /// cube of size 16 (256 tiles, 4096 blocks)
@@ -30,6 +31,8 @@ public:
        static constexpr int size = side * side * side;
 
        static AABB Bounds() noexcept { return AABB{ { 0.0f, 0.0f, 0.0f }, ExactLocation::FExtent() }; }
+       static glm::vec3 Center() noexcept { return glm::vec3(8.0f); }
+       static float Radius() noexcept { return 27.71281292110203669632f; /* 16 * √3 */ }
 
        static constexpr bool InBounds(const ExactLocation::Fine &pos) noexcept {
                return
@@ -144,6 +147,12 @@ public:
                const glm::mat4 &Mchunk,
                std::vector<WorldCollision> &) noexcept;
 
+       bool Intersection(
+               const Entity &entity,
+               const glm::mat4 &Mentity,
+               const glm::mat4 &Mchunk,
+               std::vector<WorldCollision> &) noexcept;
+
        void Position(const ExactLocation::Coarse &pos) noexcept { position = pos; }
        const ExactLocation::Coarse &Position() const noexcept { return position; }
        glm::mat4 Transform(const ExactLocation::Coarse &offset) const noexcept {