mirror of
https://github.com/g-truc/glm.git
synced 2024-11-23 01:14:34 +00:00
Fixed initialisation
This commit is contained in:
parent
848800b5c4
commit
7e3f42eeda
@ -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<T>::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<T>(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<T>::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<T>(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);
|
||||
|
Loading…
Reference in New Issue
Block a user