author | Radek Brich <radek.brich@devl.cz> |
Fri, 04 Apr 2008 01:55:25 +0200 | |
branch | pyrit |
changeset 58 | cfe98f5c0ae9 |
parent 38 | 5d043eeb09d9 |
child 60 | a23b5089b9c3 |
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 |
import sys |
|
24
d0d76e8a5203
new C++ demo: realtime_dragon.cc
Radek Brich <radek.brich@devl.cz>
parents:
19
diff
changeset
|
7 |
sys.path.append(open('ModulePath').read().strip()) |
13 | 8 |
|
9 |
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
|
10 |
from plyreader import LoadStanfordPlyFile |
13 | 11 |
import Image |
12 |
||
13 |
rt = Raytracer() |
|
14 |
mat = Material(colour=(0.9, 0.9, 0.9)) |
|
38
5d043eeb09d9
realtime_dragon demo: now fullsize model + octree
Radek Brich <radek.brich@devl.cz>
parents:
30
diff
changeset
|
15 |
LoadStanfordPlyFile(rt, "../models/happy/happy_vrip_res2.ply", |
30
33f95441790e
pyrit_verbosity: new variable for controlling amount of output, see common.h
Radek Brich <radek.brich@devl.cz>
parents:
29
diff
changeset
|
16 |
mat, smooth=True, scale=20.0, trans=(0,-3,0)) |
13 | 17 |
|
19
4e0955fca797
added Camera, currently w/o Python binding
Radek Brich <radek.brich@devl.cz>
parents:
13
diff
changeset
|
18 |
light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6)) |
13 | 19 |
rt.addlight(light) |
20 |
||
21 |
imagesize = (800, 600) |
|
22 |
data = rt.render(imagesize) |
|
23 |
img = Image.fromstring("RGB", imagesize, data) |
|
24 |
img.save('buddha.png') |