- Scalar t = (cml::dot(ray.point, normal) + d) / denominator;
- if (t > SCALAR(0.0))
- {
- ray.solve(intersection.point, t);
- intersection.normal = normal;
- }
+ Scalar numer = cml::dot(ray.point, normal) + d;
+ hit.distance = -numer / denom;
+ if (hit.distance < SCALAR(0.0)) return false;