diff -r fcf1487b398b -r f6a72eb99631 demos/spheres_glass.py --- a/demos/spheres_glass.py Tue Apr 29 13:56:29 2008 +0200 +++ b/demos/spheres_glass.py Tue Apr 29 23:31:08 2008 +0200 @@ -1,10 +1,11 @@ #!/usr/bin/python -from raytracer import Raytracer, Material, Box, Sphere, Light -#, SphericalLight -import Image +from pyrit import * rt = Raytracer() +top = KdTree() +rt.setTop(top) +rt.setCamera(Camera()) light1 = Light(position=(0.0, 4.0, -3.0), colour=(0.9, 0.3, 0.6)) rt.addLight(light1) @@ -38,7 +39,9 @@ sph = Sphere(centre=(-5.0+i, -1.5, -4.0), radius=0.5, material=mat3) rt.addShape(sph) -rendersize = (800, 600) -data = rt.render(rendersize) -img = Image.fromstring("RGB", rendersize, data) -img.save('spheres_glass.png') +top.optimize() + +sampler = DefaultSampler(800, 600) +rt.setSampler(sampler) +rt.render() +sampler.getPixmap().writePNG('spheres_glass.png')