I was a little to hasty with this clean up
I actually need this check to get the closest shape for intersection.
This commit is contained in:
parent
4cbe9df324
commit
556e13ae74
1 changed files with 4 additions and 2 deletions
|
@ -228,8 +228,10 @@ Scene::trace_ray(const Ray &ray,
|
|||
for (Object::Ptr s : shapes) {
|
||||
ts.clear();
|
||||
if (s->DoesIntersect(ray, ts, mStats)) {
|
||||
intersected_shape = s;
|
||||
nearest_t = ts[0];
|
||||
if (ts[0] < nearest_t) {
|
||||
intersected_shape = s;
|
||||
nearest_t = ts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue