demos/car.py
author Radek Brich <radek.brich@devl.cz>
Fri, 04 Apr 2008 01:55:25 +0200
branchpyrit
changeset 58 cfe98f5c0ae9
child 59 64e456ab823d
permissions -rwxr-xr-x
new python demo: car.py new model format reader: LightWave lwo

#!/usr/bin/python

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

from raytracer import Raytracer, Light, Sphere, Triangle, Material
from lworeader import LoadLightwaveLwoFile
import Image

rt = Raytracer()
mat = Material(colour=(0.9, 0.9, 0.9))
LoadLightwaveLwoFile(rt, "../models/car/Nissan300ZX.lwo",	mat, smooth=True, scale=0.4) #, , trans=(0,-3,0))

light = Light(position=(-5.0, 2.0, 8.0), colour=(0.2, 0.4, 0.6))
rt.addlight(light)

imagesize = (800, 600)
data = rt.render(imagesize)
img = Image.fromstring("RGB", imagesize, data)
img.save('car.png')