diff --git a/src/bbox.rs b/src/bbox.rs index 9bd8613..0a18ac6 100644 --- a/src/bbox.rs +++ b/src/bbox.rs @@ -47,13 +47,13 @@ impl BBox { // Find the far and near intersection let mut near_t = t1.v_min(t2); let mut far_t = t1.v_max(t2); - near_t.set_3(std::f32::NEG_INFINITY); + near_t.set_3(0.0); far_t.set_3(std::f32::INFINITY); let hitt0 = near_t.h_max(); let hitt1 = far_t.h_min() * BBOX_MAXT_ADJUST; // Did we hit? - return fast_maxf32(hitt0, 0.0) <= fast_minf32(hitt1, ray.max_t); + return hitt0 <= fast_minf32(hitt1, ray.max_t); } // Creates a new BBox transformed into a different space. diff --git a/src/bbox4.rs b/src/bbox4.rs index b5cacf8..15fa59d 100644 --- a/src/bbox4.rs +++ b/src/bbox4.rs @@ -75,7 +75,8 @@ impl BBox4 { // Get the minimum and maximum hits let mins = v_max(v_max(xlos, ylos), v_max(zlos, Float4::splat(0.0))); let maxs = v_max(v_min(v_min(xhis, yhis), zhis), - Float4::splat(std::f32::NEG_INFINITY) * Float4::splat(BBOX_MAXT_ADJUST)); + Float4::splat(std::f32::NEG_INFINITY)) * + Float4::splat(BBOX_MAXT_ADJUST); // Check for hits let hits = mins.lt(Float4::splat(ray.max_t)) & mins.lte(maxs);