demos/car.py
branchpyrit
changeset 60 a23b5089b9c3
parent 59 64e456ab823d
child 62 07c2f8084719
equal deleted inserted replaced
59:64e456ab823d 60:a23b5089b9c3
     1 #!/usr/bin/python
     1 #!/usr/bin/python
     2 
       
     3 import sys
       
     4 sys.path.append(open('ModulePath').read().strip())
       
     5 
     2 
     6 from raytracer import Raytracer, Light, Sphere, Triangle, Material, Camera
     3 from raytracer import Raytracer, Light, Sphere, Triangle, Material, Camera
     7 from lworeader import LoadLightwaveLwoFile
     4 from lworeader import LoadLightwaveLwoFile
     8 import Image
     5 import Image
     9 from math import *
     6 from math import *
    16 rt.setcamera(cam)
    13 rt.setcamera(cam)
    17 
    14 
    18 mat = Material(colour=(0.9, 0.9, 0.9))
    15 mat = Material(colour=(0.9, 0.9, 0.9))
    19 LoadLightwaveLwoFile(rt, "../models/car/Nissan300ZX.lwo", mat, smooth=False, scale=0.4)
    16 LoadLightwaveLwoFile(rt, "../models/car/Nissan300ZX.lwo", mat, smooth=False, scale=0.4)
    20 
    17 
    21 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.7, 0.7, 0.7))
    18 light = Light(position=(-5.0, 10.0, 8.0), colour=(0.9, 0.9, 0.9))
    22 rt.addlight(light)
    19 rt.addlight(light)
    23 
    20 
    24 imagesize = (800, 600)
    21 imagesize = (800, 600)
    25 data = rt.render(imagesize)
    22 data = rt.render(imagesize)
    26 img = Image.fromstring("RGB", imagesize, data)
    23 img = Image.fromstring("RGB", imagesize, data)