diff -r 3239f749e394 -r f9fad94cd0cc src/raytracer.cc --- a/src/raytracer.cc Thu Nov 22 21:46:09 2007 +0100 +++ b/src/raytracer.cc Fri Nov 23 01:24:33 2007 +0100 @@ -57,7 +57,7 @@ { Shape *nearest_shape = NULL; ShapeList::iterator shape; - for (shape = shapes.begin(); shape != shapes.end(); shape++) + for (shape = top->shapes.begin(); shape != top->shapes.end(); shape++) if (*shape != origin_shape && (*shape)->intersect(ray, nearest_distance)) nearest_shape = *shape; return nearest_shape; @@ -221,6 +221,12 @@ float vy; RenderrowData *d; + printf("* building kd-tree\n"); + //cout << endl; + static_cast(top)->optimize(); + //static_cast(top)->save(cout); + //cout << endl; + //srand(time(NULL)); // eye - viewing point @@ -283,11 +289,6 @@ return data; } -void Raytracer::addshape(Shape *shape) -{ - shapes.push_back(shape); -} - void Raytracer::addlight(Light *light) { lights.push_back(light);