demos/buddha.py
author Radek Brich <radek.brich@devl.cz>
Mon, 21 Apr 2008 19:35:27 +0200
branchpyrit
changeset 76 3b60fd0bea64
parent 75 20dee9819b17
child 90 f6a72eb99631
permissions -rwxr-xr-x
kd-tree: move recursive build subroutine from KdNode to KdTree

#!/usr/bin/python

# this demo needs buddha model from
# http://graphics.stanford.edu/data/3Dscanrep/

from raytracer import Raytracer, Light, Sphere, Triangle, Material
from plyreader import LoadStanfordPlyFile
import Image

rt = Raytracer()
mat = Material(colour=(0.9, 0.9, 0.9))
mat.setSmooth(True)
LoadStanfordPlyFile(rt, "../models/ply/happy/happy_vrip_res2.ply",
	mat, scale=20.0, trans=(0,-3,0))

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('buddha.png')