demos/triangles_monkey.py
author Radek Brich <radek.brich@devl.cz>
Sat, 29 Mar 2008 17:54:27 +0100
branchpyrit
changeset 56 d4481fc43952
parent 29 574c34441a1c
child 60 a23b5089b9c3
permissions -rwxr-xr-x
fix sphere transmissivity, rename demo.py to spheres_glass.py

#!/usr/bin/python

import sys
sys.path.append(open('ModulePath').read().strip())

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')