]> git.localhorst.tv Git - blank.git/blobdiff - src/model/shape.cpp
figure out depth and normal in box/box test
[blank.git] / src / model / shape.cpp
index 1c831498e6e36a16cd6d1710c806405f7ca6c076..8aa1c257e0d8f65eb69b54d588b4e763e30296bf 100644 (file)
@@ -80,6 +80,14 @@ bool NullShape::Intersects(
        return false;
 }
 
+bool NullShape::Intersects(
+       const glm::mat4 &,
+       const AABB &,
+       const glm::mat4 &
+) const noexcept {
+       return false;
+}
+
 
 CuboidShape::CuboidShape(const AABB &b)
 : Shape()
@@ -167,6 +175,16 @@ bool CuboidShape::Intersects(
        return Intersection(ray, bb, M, &dist, &normal);
 }
 
+bool CuboidShape::Intersects(
+       const glm::mat4 &M,
+       const AABB &box,
+       const glm::mat4 &box_M
+) const noexcept {
+       float depth;
+       glm::vec3 normal;
+       return Intersection(bb, M, box, box_M, depth, normal);
+}
+
 
 StairShape::StairShape(const AABB &bb, const glm::vec2 &clip)
 : Shape()
@@ -326,4 +344,14 @@ bool StairShape::Intersects(
        }
 }
 
+bool StairShape::Intersects(
+       const glm::mat4 &M,
+       const AABB &box,
+       const glm::mat4 &box_M
+) const noexcept {
+       float depth;
+       glm::vec3 normal;
+       return Intersection(bot, M, box, box_M, depth, normal) || Intersection(top, M, box, box_M, depth, normal);
+}
+
 }