1 #ifndef BLANK_MODEL_GEOMETRY_H_
2 #define BLANK_MODEL_GEOMETRY_H_
10 constexpr float PI = 3.141592653589793238462643383279502884;
11 constexpr float PI_0p25 = PI * 0.25f;
12 constexpr float PI_0p5 = PI * 0.5f;
13 constexpr float PI_1p5 = PI * 1.5f;
14 constexpr float PI_2p0 = PI * 2.0f;
16 constexpr float DEG_RAD_FACTOR = PI / 180.0f;
17 constexpr float RAD_DEG_FACTOR = 180.0f / PI;
19 constexpr float deg2rad(float d) {
20 return d * DEG_RAD_FACTOR;
23 constexpr float rad2deg(float r) {
24 return r * RAD_DEG_FACTOR;
32 void Adjust() noexcept {
33 if (max.x < min.x) std::swap(max.x, min.x);
34 if (max.y < min.y) std::swap(max.y, min.y);
35 if (max.z < min.z) std::swap(max.z, min.z);
38 glm::vec3 Center() const noexcept {
39 return min + (max - min) * 0.5f;
52 float *dist = nullptr,
53 glm::vec3 *normal = nullptr) noexcept;
61 glm::vec3 &normal) noexcept;
63 bool CullTest(const AABB &box, const glm::mat4 &MVP) noexcept;