7 rt = Raytracer() |
7 rt = Raytracer() |
8 mat = Material(colour=(0.9, 0.9, 0.9)) |
8 mat = Material(colour=(0.9, 0.9, 0.9)) |
9 LoadWavefrontObjFile(rt, "../models/obj/sphere.obj", mat, 1.5) |
9 LoadWavefrontObjFile(rt, "../models/obj/sphere.obj", mat, 1.5) |
10 |
10 |
11 light1 = Light(position=(0.0, 2.0, 6.0), colour=(0.9, 0.3, 0.6)) |
11 light1 = Light(position=(0.0, 2.0, 6.0), colour=(0.9, 0.3, 0.6)) |
12 light1.castshadows(False); |
12 light1.castShadows(False); |
13 rt.addlight(light1) |
13 rt.addLight(light1) |
14 |
14 |
15 light2 = Light(position=(-2.0, -5.0, 7.0), colour=(0.7, 1.0, 0.3)) |
15 light2 = Light(position=(-2.0, -5.0, 7.0), colour=(0.7, 1.0, 0.3)) |
16 light2.castshadows(False); |
16 light2.castShadows(False); |
17 rt.addlight(light2) |
17 rt.addLight(light2) |
18 |
18 |
19 imagesize = (800, 600) |
19 imagesize = (800, 600) |
20 data = rt.render(imagesize) |
20 data = rt.render(imagesize) |
21 img = Image.fromstring("RGB", imagesize, data) |
21 img = Image.fromstring("RGB", imagesize, data) |
22 img.save('triangles_sphere.png') |
22 img.save('triangles_sphere.png') |