demos/triangles_monkey.py
author Radek Brich <radek.brich@devl.cz>
Sun, 27 Apr 2008 09:44:49 +0200
branchpyrit
changeset 84 6f7fe14782c2
parent 75 20dee9819b17
child 90 f6a72eb99631
permissions -rwxr-xr-x
prepare kd-tree traversal for packet tracing (4 rays at once) RayPacket and VectorPacket structures for packet tracing remove some redundant const's

#!/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, "../models/obj/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')