diff --git a/engine/include/frustsum.hpp b/engine/include/frustsum.hpp index 48575d9..37b4c13 100644 --- a/engine/include/frustsum.hpp +++ b/engine/include/frustsum.hpp @@ -12,7 +12,6 @@ struct Plane { glm::vec3 point = { 0.f, 0.f, 0.f }; glm::vec3 normal = { 0.f, 1.f, 0.f }; - glm::vec4 abcd = { 0.f, 0.f, 0.f, 0.f }; Plane() = default; Plane(const Plane& other) = default; @@ -20,7 +19,7 @@ struct Plane { // rethink distance to point float distanceToPoint(const glm::vec3& point) const { - return abcd.x * point.x + abcd.y * point.y + abcd.z * point.z + abcd.w; + return glm::dot(normal, point - this->point); } diff --git a/engine/src/frustsum.cpp b/engine/src/frustsum.cpp index 5093579..9b32bae 100644 --- a/engine/src/frustsum.cpp +++ b/engine/src/frustsum.cpp @@ -6,9 +6,6 @@ Plane::Plane(const glm::vec3& normal, glm::vec3 point) { this->normal = glm::normalize(normal); this->point = point; - float d = -normal.x * point.x - normal.y * point.y - normal.z * point.z; - - this->abcd = glm::vec4(this->normal, d); }