demos/car.py
branchpyrit
changeset 75 20dee9819b17
parent 69 303583d2fb97
child 90 f6a72eb99631
equal deleted inserted replaced
74:09aedbf5f95f 75:20dee9819b17
     8 rt = Raytracer()
     8 rt = Raytracer()
     9 
     9 
    10 cam = Camera(eye=(0.,2.,8.))
    10 cam = Camera(eye=(0.,2.,8.))
    11 rotx=0.15
    11 rotx=0.15
    12 cam.rotate((cos(rotx),-sin(rotx),0.,0.))
    12 cam.rotate((cos(rotx),-sin(rotx),0.,0.))
    13 rt.setcamera(cam)
    13 rt.setCamera(cam)
    14 
    14 
    15 LoadLightwaveLwoFile(rt, "../models/lwo/Nissan300ZX.lwo", scale=0.4, trans=(-0.2,0,0.3))
    15 LoadLightwaveLwoFile(rt, "../models/lwo/Nissan300ZX.lwo", scale=0.4, trans=(-0.2,0,0.3))
    16 
    16 
    17 light1 = Light(position=(-5.0, 20.0, 8.0), colour=(0.9, 0.9, 0.9))
    17 light1 = Light(position=(-5.0, 20.0, 8.0), colour=(0.9, 0.9, 0.9))
    18 rt.addlight(light1)
    18 rt.addLight(light1)
    19 light2 = Light(position=(5.0, 10.0, 10.0), colour=(0.9, 0.7, 0.7))
    19 light2 = Light(position=(5.0, 10.0, 10.0), colour=(0.9, 0.7, 0.7))
    20 rt.addlight(light2)
    20 rt.addLight(light2)
    21 
    21 
    22 imagesize = (800, 600)
    22 imagesize = (800, 600)
    23 data = rt.render(imagesize)
    23 data = rt.render(imagesize)
    24 img = Image.fromstring("RGB", imagesize, data)
    24 img = Image.fromstring("RGB", imagesize, data)
    25 img.save('car.png')
    25 img.save('car.png')