demos/car.py
branchpyrit
changeset 58 cfe98f5c0ae9
child 59 64e456ab823d
equal deleted inserted replaced
57:1e92c21b9a61 58:cfe98f5c0ae9
       
     1 #!/usr/bin/python
       
     2 
       
     3 import sys
       
     4 sys.path.append(open('ModulePath').read().strip())
       
     5 
       
     6 from raytracer import Raytracer, Light, Sphere, Triangle, Material
       
     7 from lworeader import LoadLightwaveLwoFile
       
     8 import Image
       
     9 
       
    10 rt = Raytracer()
       
    11 mat = Material(colour=(0.9, 0.9, 0.9))
       
    12 LoadLightwaveLwoFile(rt, "../models/car/Nissan300ZX.lwo",	mat, smooth=True, scale=0.4) #, , trans=(0,-3,0))
       
    13 
       
    14 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.2, 0.4, 0.6))
       
    15 rt.addlight(light)
       
    16 
       
    17 imagesize = (800, 600)
       
    18 data = rt.render(imagesize)
       
    19 img = Image.fromstring("RGB", imagesize, data)
       
    20 img.save('car.png')