author | Radek Brich <radek.brich@devl.cz> |
Wed, 23 Apr 2008 14:39:33 +0200 | |
branch | pyrit |
changeset 79 | 062b1c4143f7 |
parent 75 | 20dee9819b17 |
child 90 | f6a72eb99631 |
permissions | -rwxr-xr-x |
57 | 1 |
#!/usr/bin/python |
2 |
||
3 |
from raytracer import Raytracer, Material, Box, Light |
|
4 |
import Image |
|
5 |
||
6 |
rt = Raytracer() |
|
7 |
||
8 |
light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.7, 0.3, 0.6)) |
|
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
9 |
rt.addLight(light1) |
57 | 10 |
|
11 |
light2 = Light(position=(-2.0, 10.0, -2.0), colour=(0.4, 0.6, 0.3)) |
|
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
12 |
rt.addLight(light2) |
57 | 13 |
|
14 |
mat0 = Material(colour=(0.7, 0.7, 0.7)) |
|
15 |
mat0.setReflectivity(0.0) |
|
16 |
for x in range(8): |
|
17 |
for y in range(8): |
|
18 |
for z in range(8): |
|
19 |
box = Box(L=(-4.3+x, -4.6+y, -8.6+z), H=(-3.7+x, -4.0+y, -8.0+z), material=mat0) |
|
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
20 |
rt.addShape(box) |
57 | 21 |
|
22 |
imagesize = (800, 600) |
|
23 |
data = rt.render(imagesize) |
|
24 |
img = Image.fromstring("RGB", imagesize, data) |
|
25 |
img.save('boxes.png') |