+ bool hit = false;
+ float t = std::numeric_limits<float>::max();
+ for (std::vector<Primitive*>::iterator i = m_primitives.begin();
+ i != m_primitives.end(); i++) {
+ // store closest object hit
+ if (hit |= (*i)->Intersect(ray)) {
+ if (ray.t() < t) {
+ ray.setHit(*i);
+ t = ray.t();
+ }
+ }
+ }
+ return hit;