Merge with upstream
commit
f824e5861d
|
@ -10,5 +10,5 @@ Exec=mtsgui %U
|
|||
TryExec=mtsgui
|
||||
Terminal=false
|
||||
StartupNotify=true
|
||||
MimeType=application/xml
|
||||
MimeType=application/xml;image/x-exr;image/x-hdr;
|
||||
Icon=mitsuba48.png
|
||||
|
|
|
@ -289,19 +289,17 @@ template <typename T> struct TAABB {
|
|||
Float t1 = (minVal - origin) * ray.dRcp[i];
|
||||
Float t2 = (maxVal - origin) * ray.dRcp[i];
|
||||
|
||||
if (t1 > t2) {
|
||||
Float tmp = t1;
|
||||
t1 = t2;
|
||||
t2 = tmp;
|
||||
}
|
||||
if (t1 > t2)
|
||||
std::swap(t1, t2);
|
||||
|
||||
nearT = std::max(nearT, t1);
|
||||
farT = std::min(farT, t2);
|
||||
nearT = std::max(t1, nearT);
|
||||
farT = std::min(t2, farT);
|
||||
|
||||
if (nearT > farT)
|
||||
if (!(nearT <= farT))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
if (!m_sceneBSphere.rayIntersect(ray, nearT, farT))
|
||||
return Spectrum(0.0f);
|
||||
|
||||
if (nearT >= 0 || farT <= 0)
|
||||
if (!(nearT < 0 && farT > 0))
|
||||
return Spectrum(0.0f);
|
||||
|
||||
dRec.p = ray(farT);
|
||||
|
|
|
@ -114,6 +114,12 @@ bool ShapeKDTree::rayIntersect(const Ray &ray, Intersection &its) const {
|
|||
its.t = std::numeric_limits<Float>::infinity();
|
||||
Float mint, maxt;
|
||||
|
||||
#if defined(MTS_FP_DEBUG_STRICT)
|
||||
Assert(
|
||||
std::isfinite(ray.o.x) && std::isfinite(ray.o.y) && std::isfinite(ray.o.z) &&
|
||||
std::isfinite(ray.d.x) && std::isfinite(ray.d.y) && std::isfinite(ray.d.z));
|
||||
#endif
|
||||
|
||||
++raysTraced;
|
||||
if (m_aabb.rayIntersect(ray, mint, maxt)) {
|
||||
/* Use an adaptive ray epsilon */
|
||||
|
|
|
@ -145,11 +145,12 @@ public:
|
|||
if (!solveQuadratic(A, B, C, nearT, farT))
|
||||
return false;
|
||||
|
||||
if (nearT > maxt || farT < mint)
|
||||
if (!(nearT <= maxt && farT >= mint)) /* NaN-aware conditionals */
|
||||
return false;
|
||||
|
||||
const Float zPosNear = ray.o.z + ray.d.z * nearT;
|
||||
const Float zPosFar = ray.o.z + ray.d.z * farT;
|
||||
|
||||
if (zPosNear >= 0 && zPosNear <= m_length && nearT >= mint) {
|
||||
t = nearT;
|
||||
} else if (zPosFar >= 0 && zPosFar <= m_length) {
|
||||
|
|
|
@ -136,7 +136,7 @@ public:
|
|||
m_worldToObject.transformAffine(_ray, ray);
|
||||
Float hit = -ray.o.z / ray.d.z;
|
||||
|
||||
if (hit < mint || hit > maxt)
|
||||
if (!(hit >= mint && hit <= maxt))
|
||||
return false;
|
||||
|
||||
Point local = ray(hit);
|
||||
|
|
|
@ -504,7 +504,7 @@ public:
|
|||
if (!solveQuadraticDouble(A, B, C, nearT, farT))
|
||||
return false;
|
||||
|
||||
if (nearT > maxt || farT < mint)
|
||||
if (!(nearT <= maxt && farT >= mint)) /* NaN-aware conditionals */
|
||||
return false;
|
||||
|
||||
/* Next check the intersection points against the miter planes */
|
||||
|
@ -523,7 +523,7 @@ public:
|
|||
p = Point(rayO + rayD * nearT);
|
||||
t = (Float) nearT;
|
||||
} else if (dot(pointFar - v1, n1) >= 0 &&
|
||||
dot(pointFar - v2, n2) <= 0) {
|
||||
dot(pointFar - v2, n2) <= 0) {
|
||||
if (farT > maxt)
|
||||
return false;
|
||||
p = Point(rayO + rayD * nearT);
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
m_worldToObject.transformAffine(_ray, ray);
|
||||
Float hit = -ray.o.z / ray.d.z;
|
||||
|
||||
if (hit < mint || hit > maxt)
|
||||
if (!(hit >= mint && hit <= maxt))
|
||||
return false;
|
||||
|
||||
Point local = ray(hit);
|
||||
|
|
|
@ -172,8 +172,9 @@ public:
|
|||
if (!solveQuadraticDouble(A, B, C, nearT, farT))
|
||||
return false;
|
||||
|
||||
if (nearT > maxt || farT < mint)
|
||||
if (!(nearT <= maxt && farT >= mint)) /* NaN-aware conditionals */
|
||||
return false;
|
||||
|
||||
if (nearT < mint) {
|
||||
if (farT > maxt)
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue