demos/bunny.py
branchpyrit
changeset 31 b4e09433934a
parent 29 574c34441a1c
child 34 28f6e8b9d5d1
--- a/demos/bunny.py	Sat Dec 08 16:02:37 2007 +0100
+++ b/demos/bunny.py	Sun Dec 09 10:45:26 2007 +0100
@@ -6,19 +6,31 @@
 import sys
 sys.path.append(open('ModulePath').read().strip())
 
-from raytracer import Raytracer, Light, Sphere, Triangle, NormalVertex, Material
+from raytracer import Raytracer, Light, Box, Triangle, NormalVertex, Material
 from plyreader import LoadStanfordPlyFile
 import Image
 
 rt = Raytracer()
+#rt.ambientocclusion(samples=100, distance=16.0, angle=0.5)
+
 mat = Material(colour=(0.9, 0.9, 0.9))
+mat.setTransmissivity(0.8)
 LoadStanfordPlyFile(rt, "../models/bunny/bun_zipper.ply",
-	mat, smooth=True, scale=(-29.0, 29.0, 29.0), trans=(-1,-3,-3))
+	mat, smooth=True, scale=(-29.0, 29.0, 29.0), trans=(-1,-2.5,-3))
+
+mat0 = Material(colour=(0.1, 0.2, 0.9))
+box1 = Box(L=(-20.0, -1.7, -20.0), H=(20.0, -1.5, 20.0), material=mat0)
+rt.addshape(box1)
 
-light = Light(position=(-5.0, 2.0, 10.0), colour=(0.9, 0.3, 0.6))
+mat1 = Material(colour=(0.2, 0.8, 0.4))
+mat1.setReflectivity(0.0)
+box2 = Box(L=(-20.0, -20.0, -10.0), H=(20.0, 20.0, -12.0), material=mat1)
+rt.addshape(box2)
+
+light = Light(position=(-5.0, 3.0, 10.0), colour=(0.9, 0.3, 0.6))
 rt.addlight(light)
 
-light2 = Light(position=(4.0, -3.0, 10.0), colour=(0.2, 0.9, 0.5))
+light2 = Light(position=(4.0, 1.0, 10.0), colour=(0.2, 0.9, 0.5))
 rt.addlight(light2)
 
 imagesize = (800, 600)