demos/dragon.py
branchpyrit
changeset 25 b8232edee786
parent 24 d0d76e8a5203
child 28 ffe83ca074f3
equal deleted inserted replaced
24:d0d76e8a5203 25:b8232edee786
    44 
    44 
    45 rt = Raytracer()
    45 rt = Raytracer()
    46 mat = Material(colour=(0.9, 0.9, 0.9))
    46 mat = Material(colour=(0.9, 0.9, 0.9))
    47 LoadStanfordPlyFile(rt, mat, "../models/dragon/dragon_vrip_res4.ply", 29.0)
    47 LoadStanfordPlyFile(rt, mat, "../models/dragon/dragon_vrip_res4.ply", 29.0)
    48 
    48 
    49 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
    49 light1 = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.2))
    50 rt.addlight(light)
    50 rt.addlight(light1)
       
    51 
       
    52 light2 = Light(position=(3.0, 0.0, 9.0), colour=(0.0, 1.0, 0.2))
       
    53 rt.addlight(light2)
    51 
    54 
    52 imagesize = (800, 600)
    55 imagesize = (800, 600)
    53 data = rt.render(imagesize)
    56 data = rt.render(imagesize)
    54 img = Image.fromstring("RGB", imagesize, data)
    57 img = Image.fromstring("RGB", imagesize, data)
    55 img.save('dragon.png')
    58 img.save('dragon.png')