demos/bunny.py
branchpyrit
changeset 90 f6a72eb99631
parent 75 20dee9819b17
child 95 ca7d4c665531
--- a/demos/bunny.py	Tue Apr 29 13:56:29 2008 +0200
+++ b/demos/bunny.py	Tue Apr 29 23:31:08 2008 +0200
@@ -3,11 +3,14 @@
 # this demo needs bunny model from
 # http://graphics.stanford.edu/data/3Dscanrep/
 
-from raytracer import Raytracer, Light, Box, Triangle, Material
+from pyrit import *
 from plyreader import LoadStanfordPlyFile
-import Image
 
 rt = Raytracer()
+top = KdTree()
+rt.setTop(top)
+rt.setCamera(Camera())
+
 #rt.ambientocclusion(samples=100, distance=16.0, angle=0.5)
 
 mat = Material(colour=(0.9, 0.9, 0.9))
@@ -33,7 +36,9 @@
 #light2.castshadows(0)
 rt.addLight(light2)
 
-imagesize = (800, 600)
-data = rt.render(imagesize)
-img = Image.fromstring("RGB", imagesize, data)
-img.save('bunny.png')
+top.optimize()
+
+sampler = DefaultSampler(800, 600)
+rt.setSampler(sampler)
+rt.render()
+sampler.getPixmap().writePNG('bunny.png')