--- a/demos/triangles_monkey.py Tue Apr 29 13:56:29 2008 +0200
+++ b/demos/triangles_monkey.py Tue Apr 29 23:31:08 2008 +0200
@@ -1,17 +1,21 @@
#!/usr/bin/python
-from raytracer import Raytracer, Light, Sphere, Triangle, NormalVertex, Material
+from pyrit import *
from objreader import LoadWavefrontObjFile
-import Image
rt = Raytracer()
-mat = Material(colour=(0.9, 0.9, 0.9))
-LoadWavefrontObjFile(rt, "../models/obj/monkey.obj", mat, 1.5)
+top = KdTree()
+rt.setTop(top)
+rt.setCamera(Camera())
light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
rt.addLight(light)
-imagesize = (800, 600)
-data = rt.render(imagesize)
-img = Image.fromstring("RGB", imagesize, data)
-img.save('triangles_monkey.png')
+mat = Material(colour=(0.9, 0.9, 0.9))
+LoadWavefrontObjFile(rt, "../models/obj/monkey.obj", mat, 1.5)
+top.optimize()
+
+sampler = DefaultSampler(800, 600)
+rt.setSampler(sampler)
+rt.render()
+sampler.getPixmap().writePNG('triangles_monkey.png')