author | Radek Brich <radek.brich@devl.cz> |
Wed, 23 Apr 2008 19:35:03 +0200 | |
branch | pyrit |
changeset 80 | 907929fa9b59 |
parent 75 | 20dee9819b17 |
child 90 | f6a72eb99631 |
permissions | -rwxr-xr-x |
13 | 1 |
#!/usr/bin/python |
2 |
||
3 |
# this demo needs buddha model from |
|
4 |
# http://graphics.stanford.edu/data/3Dscanrep/ |
|
5 |
||
6 |
from raytracer import Raytracer, Light, Sphere, Triangle, Material |
|
29
574c34441a1c
new C++ demo: realtime_bunny
Radek Brich <radek.brich@devl.cz>
parents:
28
diff
changeset
|
7 |
from plyreader import LoadStanfordPlyFile |
13 | 8 |
import Image |
9 |
||
10 |
rt = Raytracer() |
|
11 |
mat = Material(colour=(0.9, 0.9, 0.9)) |
|
69
303583d2fb97
move "smooth" attribute from Triangle to Material
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
12 |
mat.setSmooth(True) |
62
07c2f8084719
more SConscript tweaking, make model preparation work again
Radek Brich <radek.brich@devl.cz>
parents:
60
diff
changeset
|
13 |
LoadStanfordPlyFile(rt, "../models/ply/happy/happy_vrip_res2.ply", |
69
303583d2fb97
move "smooth" attribute from Triangle to Material
Radek Brich <radek.brich@devl.cz>
parents:
62
diff
changeset
|
14 |
mat, scale=20.0, trans=(0,-3,0)) |
13 | 15 |
|
19
4e0955fca797
added Camera, currently w/o Python binding
Radek Brich <radek.brich@devl.cz>
parents:
13
diff
changeset
|
16 |
light = Light(position=(-5.0, 2.0, 8.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:
69
diff
changeset
|
17 |
rt.addLight(light) |
13 | 18 |
|
19 |
imagesize = (800, 600) |
|
20 |
data = rt.render(imagesize) |
|
21 |
img = Image.fromstring("RGB", imagesize, data) |
|
22 |
img.save('buddha.png') |