--- a/demos/dragon.py Tue Apr 29 13:56:29 2008 +0200
+++ b/demos/dragon.py Tue Apr 29 23:31:08 2008 +0200
@@ -3,11 +3,14 @@
# this demo needs dragon model from
# http://graphics.stanford.edu/data/3Dscanrep/
-from raytracer import Raytracer, Light, Sphere, Triangle, Material
+from pyrit import *
from plyreader import LoadStanfordPlyFile
-import Image
rt = Raytracer()
+top = KdTree()
+rt.setTop(top)
+rt.setCamera(Camera())
+
mat = Material(colour=(0.9, 0.9, 0.9))
mat.setSmooth(True)
LoadStanfordPlyFile(rt, "../models/ply/dragon/dragon_vrip_res2.ply",
@@ -19,7 +22,9 @@
light2 = Light(position=(3.0, 0.0, 9.0), colour=(0.0, 1.0, 0.2))
rt.addLight(light2)
-imagesize = (800, 600)
-data = rt.render(imagesize)
-img = Image.fromstring("RGB", imagesize, data)
-img.save('dragon.png')
+top.optimize()
+
+sampler = DefaultSampler(800, 600)
+rt.setSampler(sampler)
+rt.render()
+sampler.getPixmap().writePNG('dragon.png')