From b345a6ee046fa6d1978db537cb5e7b969bd69558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20Pinto?= Date: Sun, 26 May 2024 23:13:48 +0100 Subject: [PATCH] stuff --- engine/include/frustsum.hpp | 3 +-- engine/src/frustsum.cpp | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) 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); }