demos/buddha.py
author Radek Brich <radek.brich@devl.cz>
Wed, 09 Apr 2008 17:55:29 +0200
branchpyrit
changeset 64 5785cca4cdb9
parent 62 07c2f8084719
child 69 303583d2fb97
permissions -rwxr-xr-x
add Help with list of targets to SConstruct

#!/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))
LoadStanfordPlyFile(rt, "../models/ply/happy/happy_vrip_res2.ply",
	mat, smooth=True, 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')