| author | Radek Brich <radek.brich@devl.cz> | 
| Thu, 10 Apr 2008 23:20:36 +0200 | |
| branch | pyrit | 
| changeset 65 | 242839c6d27d | 
| parent 62 | 07c2f8084719 | 
| child 69 | 303583d2fb97 | 
| permissions | -rwxr-xr-x | 
| 18 | 1 | #!/usr/bin/python | 
| 2 | ||
| 3 | # this demo needs dragon 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: 
28diff
changeset | 7 | from plyreader import LoadStanfordPlyFile | 
| 18 | 8 | import Image | 
| 9 | ||
| 10 | rt = Raytracer() | |
| 11 | mat = Material(colour=(0.9, 0.9, 0.9)) | |
| 62 
07c2f8084719
more SConscript tweaking, make model preparation work again
 Radek Brich <radek.brich@devl.cz> parents: 
60diff
changeset | 12 | LoadStanfordPlyFile(rt, "../models/ply/dragon/dragon_vrip_res2.ply", | 
| 29 
574c34441a1c
new C++ demo: realtime_bunny
 Radek Brich <radek.brich@devl.cz> parents: 
28diff
changeset | 13 | mat, smooth=True, scale=(-29.0, 29.0, -29.0), trans=(0.0, -3.6, 0.0)) | 
| 18 | 14 | |
| 25 
b8232edee786
tuned ray-triangle intersection, now there are three algorithms to choose from:
 Radek Brich <radek.brich@devl.cz> parents: 
24diff
changeset | 15 | light1 = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.2)) | 
| 
b8232edee786
tuned ray-triangle intersection, now there are three algorithms to choose from:
 Radek Brich <radek.brich@devl.cz> parents: 
24diff
changeset | 16 | rt.addlight(light1) | 
| 
b8232edee786
tuned ray-triangle intersection, now there are three algorithms to choose from:
 Radek Brich <radek.brich@devl.cz> parents: 
24diff
changeset | 17 | |
| 
b8232edee786
tuned ray-triangle intersection, now there are three algorithms to choose from:
 Radek Brich <radek.brich@devl.cz> parents: 
24diff
changeset | 18 | light2 = Light(position=(3.0, 0.0, 9.0), colour=(0.0, 1.0, 0.2)) | 
| 
b8232edee786
tuned ray-triangle intersection, now there are three algorithms to choose from:
 Radek Brich <radek.brich@devl.cz> parents: 
24diff
changeset | 19 | rt.addlight(light2) | 
| 18 | 20 | |
| 21 | imagesize = (800, 600) | |
| 22 | data = rt.render(imagesize) | |
| 23 | img = Image.fromstring("RGB", imagesize, data)
 | |
| 24 | img.save('dragon.png')
 |