demos/triangles_monkey.py
author Radek Brich <radek.brich@devl.cz>
Wed, 09 Apr 2008 00:29:11 +0200
branchpyrit
changeset 61 7006036eb0db
parent 60 a23b5089b9c3
child 62 07c2f8084719
permissions -rwxr-xr-x
minor SConscript tweaking

#!/usr/bin/python

from raytracer import Raytracer, Light, Sphere, Triangle, NormalVertex, Material
from objreader import LoadWavefrontObjFile
import Image

rt = Raytracer()
mat = Material(colour=(0.9, 0.9, 0.9))
LoadWavefrontObjFile(rt, "monkey.obj", mat, 1.5)

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