diff -r 79b516a3803d -r 76b7bd51d64a ccdemos/spheres_shadow.cc --- a/ccdemos/spheres_shadow.cc Fri Nov 30 00:44:51 2007 +0100 +++ b/ccdemos/spheres_shadow.cc Mon Dec 03 01:49:23 2007 +0100 @@ -4,7 +4,10 @@ int main() { Raytracer rt; - rt.setThreads(1); + rt.setThreads(2); + + KdTree top; + rt.setTop(&top); Light light1(Vector3(0.0, 5.0, -5.0), Colour(0.7, 0.3, 0.6)); rt.addlight(&light1); @@ -29,19 +32,21 @@ Sphere tinysphere(Vector3(-1.2, 0.0, -2.0), 0.5, &mat3); rt.addshape(&tinysphere); + top.optimize(); + Camera cam; cam.setEye(Vector3(0,0,15)); rt.setCamera(&cam); int w = 800; int h = 600; - float *fdata = (float *) malloc(w*h*3*sizeof(float)); + Float *fdata = (Float *) malloc(w*h*3*sizeof(Float)); rt.render(w, h, fdata); struct image *img; new_image(&img, w, h, 3); - float *fd = fdata; + Float *fd = fdata; for (char *cd = img->data; cd != img->data + w*h*3; cd++, fd++) { if (*fd > 1.0) *cd = 255;