]> git.localhorst.tv Git - blank.git/blobdiff - src/model/geometry.hpp
implemented font redering
[blank.git] / src / model / geometry.hpp
index d6e3d2847782e2b1d882e49d7e5cf3fa7e77386a..df45fff2f2a2797d789b06b9bd2ad71feb3c6464 100644 (file)
@@ -22,6 +22,10 @@ struct AABB {
                if (max.y < min.y) std::swap(max.y, min.y);
                if (max.z < min.z) std::swap(max.z, min.z);
        }
+
+       glm::vec3 Center() const noexcept {
+               return min + (max - min) * 0.5f;
+       }
 };
 
 struct Ray {
@@ -36,6 +40,14 @@ bool Intersection(
        float *dist = nullptr,
        glm::vec3 *normal = nullptr) noexcept;
 
+bool Intersection(
+       const AABB &a_box,
+       const glm::mat4 &a_m,
+       const AABB &b_box,
+       const glm::mat4 &b_m,
+       float &depth,
+       glm::vec3 &normal) noexcept;
+
 bool CullTest(const AABB &box, const glm::mat4 &MVP) noexcept;
 
 }