From 7e3f42eeda586194c4d0f84d87e0e4e6ffcce7a5 Mon Sep 17 00:00:00 2001 From: Groove Date: Sat, 21 Jul 2018 18:07:24 +0200 Subject: [PATCH] Fixed initialisation --- glm/gtx/intersect.inl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl index d10d65b2..0ddb8ccf 100644 --- a/glm/gtx/intersect.inl +++ b/glm/gtx/intersect.inl @@ -41,20 +41,20 @@ namespace glm // if determinant is near zero, ray lies in plane of triangle T const det = glm::dot(edge1, p); - vec<3, T, Q> qvec; + vec<3, T, Q> qvec(0); if(det > std::numeric_limits::epsilon()) { // calculate distance from vert0 to ray origin - vec<3, T, Q> const tvec = orig - vert0; + vec<3, T, Q> const dist = orig - vert0; // calculate U parameter and test bounds - baryPosition.x = glm::dot(tvec, p); + baryPosition.x = glm::dot(dist, p); if(baryPosition.x < static_cast(0) || baryPosition.x > det) return false; // prepare to test V parameter - qvec = glm::cross(tvec, edge1); + qvec = glm::cross(dist, edge1); // calculate V parameter and test bounds baryPosition.y = glm::dot(dir, qvec); @@ -64,15 +64,15 @@ namespace glm else if(det < -std::numeric_limits::epsilon()) { // calculate distance from vert0 to ray origin - vec<3, T, Q> const tvec = orig - vert0; + vec<3, T, Q> const dist = orig - vert0; // calculate U parameter and test bounds - baryPosition.x = glm::dot(tvec, p); + baryPosition.x = glm::dot(dist, p); if((baryPosition.x > static_cast(0)) || (baryPosition.x < det)) return false; // prepare to test V parameter - qvec = glm::cross(tvec, edge1); + qvec = glm::cross(dist, edge1); // calculate V parameter and test bounds baryPosition.y = glm::dot(dir, qvec);