kd-tree traversal - avoid dynamic memory allocation
use minimum storage size for KdNode (8B on 32bit cpu)
vector.h - add division operator, fix semicolons
#!/usr/bin/python
# this demo needs bunny model from
# http://graphics.stanford.edu/data/3Dscanrep/
from raytracer import Raytracer, Light, Box, Triangle, 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)
mat.setSmooth(True)
LoadStanfordPlyFile(rt, "../models/ply/bunny/bun_zipper.ply",
mat, scale=(-29.0, 29.0, 29.0), trans=(-1,-2.5,-3))
mat0 = Material(colour=(0.1, 0.2, 0.6))
box1 = Box(L=(-20.0, -1.7, -20.0), H=(20.0, -1.5, 20.0), material=mat0)
rt.addshape(box1)
mat1 = Material(colour=(0.5, 0.5, 0.2))
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.8, 0.5, 0.6))
#light.castshadows(0)
rt.addlight(light)
light2 = Light(position=(4.0, 1.0, 10.0), colour=(0.5, 0.55, 0.7))
#light2.castshadows(0)
rt.addlight(light2)
imagesize = (800, 600)
data = rt.render(imagesize)
img = Image.fromstring("RGB", imagesize, data)
img.save('bunny.png')