demos/spheres_ao.py
branchpyrit
changeset 95 ca7d4c665531
parent 90 f6a72eb99631
child 96 9eb71e76c7fd
equal deleted inserted replaced
94:4c8abb8977dc 95:ca7d4c665531
     3 from pyrit import *
     3 from pyrit import *
     4 
     4 
     5 rt = Raytracer()
     5 rt = Raytracer()
     6 top = KdTree()
     6 top = KdTree()
     7 rt.setTop(top)
     7 rt.setTop(top)
     8 rt.setCamera(Camera())
     8 rt.setCamera(Camera(eye=(0,1,6)))
     9 rt.ambientOcclusion(samples=100, distance=16.0, angle=0.5)
     9 rt.ambientOcclusion(samples=100, distance=16.0, angle=0.5)
    10 
    10 
    11 light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.7, 0.3, 0.6))
    11 light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.7, 0.3, 0.6))
    12 light1.castShadows(False)
    12 light1.castShadows(False)
    13 rt.addLight(light1)
    13 rt.addLight(light1)
    15 light2 = Light(position=(-2.0, 10.0, -2.0), colour=(0.4, 0.6, 0.3))
    15 light2 = Light(position=(-2.0, 10.0, -2.0), colour=(0.4, 0.6, 0.3))
    16 light2.castShadows(False)
    16 light2.castShadows(False)
    17 rt.addLight(light2)
    17 rt.addLight(light2)
    18 
    18 
    19 mat0 = Material(colour=(0.7, 0.7, 0.7))
    19 mat0 = Material(colour=(0.7, 0.7, 0.7))
    20 
       
    21 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)
    22 rt.addShape(box)
    21 rt.addShape(box)
    23 
    22 
    24 mat1 = Material(colour=(1.0, 0.0, 0.0))
    23 mat1 = Material(colour=(1.0, 0.0, 0.0))
    25 bigsphere = Sphere(centre=(3.0, 2.0, -7.0), radius=3.0, material=mat1)
    24 bigsphere = Sphere(centre=(3.0, 2.0, -7.0), radius=3.0, material=mat1)