demos/demo.py
branchpyrit
changeset 19 4e0955fca797
parent 14 fc18ac4833f2
child 24 d0d76e8a5203
equal deleted inserted replaced
18:25b7c445cf61 19:4e0955fca797
     7 #, SphericalLight
     7 #, SphericalLight
     8 import Image
     8 import Image
     9 
     9 
    10 rt = Raytracer()
    10 rt = Raytracer()
    11 
    11 
    12 light1 = Light(position=(0.0, 5.0, 3.0), colour=(0.9, 0.3, 0.6))
    12 light1 = Light(position=(0.0, 5.0, -3.0), colour=(0.9, 0.3, 0.6))
    13 rt.addlight(light1)
    13 rt.addlight(light1)
    14 
    14 
    15 #light2 = SphericalLight(position=(-2.0, 5.0, 1.0), radius=3.0, colour=(0.7, 1.0, 0.3))
    15 #light2 = SphericalLight(position=(-2.0, 5.0, 1.0), radius=3.0, colour=(0.7, 1.0, 0.3))
    16 light2 = Light(position=(-2.0, -5.0, 1.0), colour=(0.7, 1.0, 0.3))
    16 light2 = Light(position=(-2.0, -5.0, -1.0), colour=(0.7, 1.0, 0.3))
    17 rt.addlight(light2)
    17 rt.addlight(light2)
    18 
    18 
    19 mat0 = Material(colour=(0.1, 0.2, 0.9))
    19 mat0 = Material(colour=(0.1, 0.2, 0.9))
    20 box = Box(L=(-20.0, -1.2, -20.0), H=(20.0, -1.0, 20.0), material=mat0)
    20 box = Box(L=(-20.0, -1.2, -20.0), H=(20.0, -1.0, 20.0), material=mat0)
    21 rt.addshape(box)
    21 rt.addshape(box)
    22 
    22 
    23 mat1 = Material(colour=(1.0, 0.2, 0.1))
    23 mat1 = Material(colour=(1.0, 0.2, 0.1))
    24 bigsphere = Sphere(centre=(2.0, 2.0, 5.0), radius=2.5, material=mat1)
    24 bigsphere = Sphere(centre=(2.0, 2.0, -5.0), radius=2.5, material=mat1)
    25 #      reflection=0.6)
    25 #      reflection=0.6)
    26 rt.addshape(bigsphere)
    26 rt.addshape(bigsphere)
    27 
    27 
    28 mat2 = Material(colour=(0.1, 0.7, 1.0))
    28 mat2 = Material(colour=(0.1, 0.7, 1.0))
    29 smallsphere = Sphere(centre=(-5.5, 1.5, 8.0), radius=2.0, material=mat2)
    29 smallsphere = Sphere(centre=(-5.5, 1.5, -8.0), radius=2.0, material=mat2)
    30 #      reflection=1.0, diffuse=0.1)
    30 #      reflection=1.0, diffuse=0.1)
    31 rt.addshape(smallsphere)
    31 rt.addshape(smallsphere)
    32 
    32 
    33 mat3 = Material(colour=(0.9, 0.9, 0.1))
    33 mat3 = Material(colour=(0.9, 0.9, 0.1))
    34 tinysphere = Sphere(centre=(-0.5, 0.0, 2.0), radius=0.5, material=mat3)
    34 tinysphere = Sphere(centre=(-0.5, 0.0, -2.0), radius=0.5, material=mat3)
    35 #      reflection=1.0, diffuse=0.1)
    35 #      reflection=1.0, diffuse=0.1)
    36 rt.addshape(tinysphere)
    36 rt.addshape(tinysphere)
    37 
    37 
    38 #for i in range(100):
    38 #for i in range(100):
    39 #      sph=Sphere((-5.5+i/10.0, -0.5, 7.0), 2.0)
    39 #      sph=Sphere((-5.5+i/10.0, -0.5, 7.0), 2.0)