demos/bunny.py
branchpyrit
changeset 75 20dee9819b17
parent 69 303583d2fb97
child 90 f6a72eb99631
equal deleted inserted replaced
74:09aedbf5f95f 75:20dee9819b17
    16 LoadStanfordPlyFile(rt, "../models/ply/bunny/bun_zipper.ply",
    16 LoadStanfordPlyFile(rt, "../models/ply/bunny/bun_zipper.ply",
    17 	mat, scale=(-29.0, 29.0, 29.0), trans=(-1,-2.5,-3))
    17 	mat, scale=(-29.0, 29.0, 29.0), trans=(-1,-2.5,-3))
    18 
    18 
    19 mat0 = Material(colour=(0.1, 0.2, 0.6))
    19 mat0 = Material(colour=(0.1, 0.2, 0.6))
    20 box1 = Box(L=(-20.0, -1.7, -20.0), H=(20.0, -1.5, 20.0), material=mat0)
    20 box1 = Box(L=(-20.0, -1.7, -20.0), H=(20.0, -1.5, 20.0), material=mat0)
    21 rt.addshape(box1)
    21 rt.addShape(box1)
    22 
    22 
    23 mat1 = Material(colour=(0.5, 0.5, 0.2))
    23 mat1 = Material(colour=(0.5, 0.5, 0.2))
    24 mat1.setReflectivity(0.0)
    24 mat1.setReflectivity(0.0)
    25 box2 = Box(L=(-20.0, -20.0, -10.0), H=(20.0, 20.0, -12.0), material=mat1)
    25 box2 = Box(L=(-20.0, -20.0, -10.0), H=(20.0, 20.0, -12.0), material=mat1)
    26 rt.addshape(box2)
    26 rt.addShape(box2)
    27 
    27 
    28 light = Light(position=(-5.0, 3.0, 10.0), colour=(0.8, 0.5, 0.6))
    28 light = Light(position=(-5.0, 3.0, 10.0), colour=(0.8, 0.5, 0.6))
    29 #light.castshadows(0)
    29 #light.castshadows(0)
    30 rt.addlight(light)
    30 rt.addLight(light)
    31 
    31 
    32 light2 = Light(position=(4.0, 1.0, 10.0), colour=(0.5, 0.55, 0.7))
    32 light2 = Light(position=(4.0, 1.0, 10.0), colour=(0.5, 0.55, 0.7))
    33 #light2.castshadows(0)
    33 #light2.castshadows(0)
    34 rt.addlight(light2)
    34 rt.addLight(light2)
    35 
    35 
    36 imagesize = (800, 600)
    36 imagesize = (800, 600)
    37 data = rt.render(imagesize)
    37 data = rt.render(imagesize)
    38 img = Image.fromstring("RGB", imagesize, data)
    38 img = Image.fromstring("RGB", imagesize, data)
    39 img.save('bunny.png')
    39 img.save('bunny.png')