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 |
1
e74bf781067e
use python-config, strip python version from demos, change [PyRit] to [pyrit] -- should use unix name everywhere
Radek Brich <radek.brich@devl.cz>
parents:
0
diff
changeset
|
1 |
#!/usr/bin/python |
0
3547b885df7e
initial commit, raytracer source as written year ago and unchanged since 2007-03-25
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
|
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
3 |
from pyrit import * |
29
574c34441a1c
new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
28
diff
changeset
|
4 |
from objreader import LoadWavefrontObjFile |
0
3547b885df7e
initial commit, raytracer source as written year ago and unchanged since 2007-03-25
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
|
3547b885df7e
initial commit, raytracer source as written year ago and unchanged since 2007-03-25
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
6 |
rt = Raytracer() |
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
7 |
top = KdTree() |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
8 |
rt.setTop(top) |
95
ca7d4c665531
build script fixes, add ldflags build option
Radek Brich <radek.brich@devl.cz>
parents:
90
diff
changeset
|
9 |
rt.setCamera(Camera(eye=(0,0,6))) |
0
3547b885df7e
initial commit, raytracer source as written year ago and unchanged since 2007-03-25
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
|
19
4e0955fca797
added Camera, currently w/o Python binding
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
11 |
light1 = Light(position=(0.0, 2.0, 6.0), colour=(0.9, 0.3, 0.6)) |
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
12 |
light1.castShadows(False); |
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
13 |
rt.addLight(light1) |
0
3547b885df7e
initial commit, raytracer source as written year ago and unchanged since 2007-03-25
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
14 |
|
19
4e0955fca797
added Camera, currently w/o Python binding
Radek Brich <radek.brich@devl.cz>
parents:
6
diff
changeset
|
15 |
light2 = Light(position=(-2.0, -5.0, 7.0), colour=(0.7, 1.0, 0.3)) |
75
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
16 |
light2.castShadows(False); |
20dee9819b17
unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
17 |
rt.addLight(light2) |
0
3547b885df7e
initial commit, raytracer source as written year ago and unchanged since 2007-03-25
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
18 |
|
90
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
19 |
mat = Material(colour=(0.9, 0.9, 0.9)) |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
20 |
LoadWavefrontObjFile(rt, "../models/obj/sphere.obj", mat, 1.5) |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
21 |
top.optimize() |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
22 |
|
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
23 |
sampler = DefaultSampler(800, 600) |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
24 |
rt.setSampler(sampler) |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
25 |
rt.render() |
f6a72eb99631
rename Python module from 'raytracer' to 'pyrit'
Radek Brich <radek.brich@devl.cz>
parents:
75
diff
changeset
|
26 |
sampler.getPixmap().writePNG('triangles_sphere.png') |