X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry.hpp;h=78fe5f5a2ce538deb943eee6c160f9369eb26c9f;hb=4ef32c5a4a5bdb6da8383f66d8265715eb2ed4f9;hp=e8ead98de83bc75b1b32481cca16673371c966b3;hpb=4d0ef1687987a0801469c7262f81efd36636605a;p=blank.git diff --git a/src/geometry.hpp b/src/geometry.hpp index e8ead98..78fe5f5 100644 --- a/src/geometry.hpp +++ b/src/geometry.hpp @@ -7,6 +7,12 @@ 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; @@ -23,7 +29,14 @@ struct Ray { glm::vec3 dir; }; -bool Intersection(const Ray &, const AABB &, const glm::mat4 &M, float *dist = nullptr); +bool Intersection( + const Ray &, + const AABB &, + const glm::mat4 &M, + float *dist = nullptr, + glm::vec3 *normal = nullptr); + +bool CullTest(const AABB &box, const glm::mat4 &MVP); }