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