X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry.hpp;h=df75f22bf66720d31c6b4d4e0c08b83cb7fb312d;hb=83ed3de28841d1eecfca39ff540e804cf6809b32;hp=d74e08e6b6fc8c29a5bc104ce381d6f0632e6289;hpb=753be639d7d04f9f7415db9fc2721485c531f0a1;p=blank.git diff --git a/src/geometry.hpp b/src/geometry.hpp index d74e08e..df75f22 100644 --- a/src/geometry.hpp +++ b/src/geometry.hpp @@ -8,12 +8,16 @@ namespace blank { constexpr float PI = 3.141592653589793238462643383279502884; +constexpr float PI_0p25 = PI * 0.25f; +constexpr float PI_0p5 = PI * 0.5f; +constexpr float PI_1p5 = PI * 1.5f; +constexpr float PI_2p0 = PI * 2.0f; struct AABB { glm::vec3 min; glm::vec3 max; - void Adjust() { + void Adjust() noexcept { if (max.x < min.x) std::swap(max.x, min.x); if (max.y < min.y) std::swap(max.y, min.y); if (max.z < min.z) std::swap(max.z, min.z); @@ -30,7 +34,9 @@ bool Intersection( const AABB &, const glm::mat4 &M, float *dist = nullptr, - glm::vec3 *normal = nullptr); + glm::vec3 *normal = nullptr) noexcept; + +bool CullTest(const AABB &box, const glm::mat4 &MVP) noexcept; }