X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmodel%2Fgeometry.hpp;fp=src%2Fmodel%2Fgeometry.hpp;h=df45fff2f2a2797d789b06b9bd2ad71feb3c6464;hb=419e33e565bffbaf0416ed4a5f80e9c81f62a479;hp=f4498f5fa743ec734edc84aa90a87eb1d55757ab;hpb=c04ea5a6f67d446ea29aa2e88dc4c666956d7732;p=blank.git diff --git a/src/model/geometry.hpp b/src/model/geometry.hpp index f4498f5..df45fff 100644 --- a/src/model/geometry.hpp +++ b/src/model/geometry.hpp @@ -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 { @@ -40,7 +44,9 @@ bool Intersection( const AABB &a_box, const glm::mat4 &a_m, const AABB &b_box, - const glm::mat4 &b_m) noexcept; + const glm::mat4 &b_m, + float &depth, + glm::vec3 &normal) noexcept; bool CullTest(const AABB &box, const glm::mat4 &MVP) noexcept;