author | Radek Brich <radek.brich@devl.cz> |
Sat, 10 May 2008 14:29:37 +0200 | |
branch | pyrit |
changeset 95 | ca7d4c665531 |
parent 90 | f6a72eb99631 |
permissions | -rwxr-xr-x |
57 | 1 |
#!/usr/bin/python |
2 |
||
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
3 |
from pyrit import * |
57 | 4 |
|
5 |
rt = Raytracer() |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
6 |
rt.setBgColour((1.0,1.0,1.0)) |
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
7 |
top = Octree() |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
8 |
rt.setTop(top) |
57 | 9 |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
10 |
light1 = Light(position=(0.0, 5.0, -5.0), colour=(0.1, 0.3, 0.6)) |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
11 |
light1.castShadows(False) |
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
12 |
rt.addLight(light1) |
57 | 13 |
|
14 |
light2 = Light(position=(-2.0, 10.0, -2.0), colour=(0.4, 0.6, 0.3)) |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
15 |
light2.castShadows(False) |
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
16 |
rt.addLight(light2) |
57 | 17 |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
18 |
mat = Material(colour=(0.7, 0.7, 0.7)) |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
19 |
mat.setReflectivity(0.3) |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
20 |
mat.setTransmissivity(0.5, 1.5) |
57 | 21 |
for x in range(8): |
22 |
for y in range(8): |
|
23 |
for z in range(8): |
|
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
24 |
box = Box(L=(-3.8+x, -3.8+y, -3.8+z), H=(-3.2+x, -3.2+y, -3.2+z), material=mat) |
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
25 |
rt.addShape(box) |
57 | 26 |
|
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
27 |
top.optimize() |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
28 |
|
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
29 |
sampler = DefaultSampler(800, 600) |
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
30 |
sampler.setOversample(1) |
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
31 |
rt.setSampler(sampler) |
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
32 |
|
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
33 |
rt.setCamera(Camera(eye=(-6,6,-10),lookat=(0,0,0))) |
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
34 |
rt.render() |
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
35 |
sampler.getPixmap().writePNG('boxes-1.png') |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
36 |
|
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
37 |
rt.setCamera(Camera(eye=(-4,3,-5),lookat=(0,0,0))) |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
38 |
rt.render() |
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
39 |
sampler.getPixmap().writePNG('boxes-2.png') |