00001
00002 #include "Node.h"
00003 #include "Primitive.h"
00004
00005
00014 bool Node::leafIntersect(Ray & ray, float min, float max) const
00015 {
00016
00017 Ray r = ray;
00018 bool found = false;
00019
00020
00021
00022 for (unsigned int i=0; i < mPrimitives.size(); i++)
00023 {
00024
00025 if (mPrimitives[i]->intersect(r))
00026 {
00027
00028
00029 if (min - EPSILON <= r.t() && r.t() <= max + EPSILON)
00030 {
00031
00032 ray = r;
00033 ray.setHit(mPrimitives[i], r.t());
00034
00035 max = r.t();
00036 found = true;
00037 }
00038 }
00039 }
00040
00041
00042 return found;
00043 }
00044
00045