return float max for no hit
This commit is contained in:
parent
7ae4f18814
commit
a367a780ba
1 changed files with 3 additions and 4 deletions
|
|
@ -31,13 +31,12 @@ namespace Crafter {
|
|||
Vector<T, 3, 0> h = Vector<T, 3, 0>::Cross(rayDir, edge2);
|
||||
float determinant = Vector<T, 3, 0>::Dot(edge1, h);
|
||||
|
||||
|
||||
if(determinant < 0) {
|
||||
return -1;
|
||||
return std::numeric_limits<float>::max();
|
||||
}
|
||||
|
||||
if (determinant > -EPSILON && determinant < EPSILON) {
|
||||
return -1;
|
||||
return std::numeric_limits<float>::max();
|
||||
}
|
||||
|
||||
float inverse_determinant = 1.0 / determinant;
|
||||
|
|
@ -54,7 +53,7 @@ namespace Crafter {
|
|||
float v = inverse_determinant * Vector<T, 3, 0>::Dot(rayDir, q);
|
||||
|
||||
if (v < 0.0 || u + v > 1.0) {
|
||||
return -1;
|
||||
return std::numeric_limits<float>::max();
|
||||
}
|
||||
|
||||
return inverse_determinant * Vector<T, 3, 0>::Dot(edge2, q);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue