diff -r fcf1487b398b -r f6a72eb99631 demos/boxes.py --- a/demos/boxes.py Tue Apr 29 13:56:29 2008 +0200 +++ b/demos/boxes.py Tue Apr 29 23:31:08 2008 +0200 @@ -1,9 +1,11 @@ #!/usr/bin/python -from raytracer import Raytracer, Material, Box, Light -import Image +from pyrit import * rt = Raytracer() +top = Octree() +rt.setTop(top) +rt.setCamera(Camera()) light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.7, 0.3, 0.6)) rt.addLight(light1) @@ -19,7 +21,9 @@ box = Box(L=(-4.3+x, -4.6+y, -8.6+z), H=(-3.7+x, -4.0+y, -8.0+z), material=mat0) rt.addShape(box) -imagesize = (800, 600) -data = rt.render(imagesize) -img = Image.fromstring("RGB", imagesize, data) -img.save('boxes.png') +top.optimize() + +sampler = DefaultSampler(800, 600) +rt.setSampler(sampler) +rt.render() +sampler.getPixmap().writePNG('boxes.png')