demos/dragon.py
branchpyrit
changeset 24 d0d76e8a5203
parent 19 4e0955fca797
child 25 b8232edee786
equal deleted inserted replaced
23:7e258561a690 24:d0d76e8a5203
     2 
     2 
     3 # this demo needs dragon model from
     3 # this demo needs dragon model from
     4 # http://graphics.stanford.edu/data/3Dscanrep/
     4 # http://graphics.stanford.edu/data/3Dscanrep/
     5 
     5 
     6 import sys
     6 import sys
     7 sys.path.append("..")
     7 sys.path.append(open('ModulePath').read().strip())
     8 
     8 
     9 from raytracer import Raytracer, Light, Sphere, Triangle, Material
     9 from raytracer import Raytracer, Light, Sphere, Triangle, Material
    10 import Image
    10 import Image
    11 
    11 
    12 def LoadStanfordPlyFile(rt, mat, filename, scale):
    12 def LoadStanfordPlyFile(rt, mat, filename, scale):
    42 		rt.addshape(face)
    42 		rt.addshape(face)
    43 		face_num -= 1
    43 		face_num -= 1
    44 
    44 
    45 rt = Raytracer()
    45 rt = Raytracer()
    46 mat = Material(colour=(0.9, 0.9, 0.9))
    46 mat = Material(colour=(0.9, 0.9, 0.9))
    47 LoadStanfordPlyFile(rt, mat, "dragon_vrip.ply", 29.0)
    47 LoadStanfordPlyFile(rt, mat, "../models/dragon/dragon_vrip_res4.ply", 29.0)
    48 
    48 
    49 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
    49 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
    50 rt.addlight(light)
    50 rt.addlight(light)
    51 
    51 
    52 imagesize = (800, 600)
    52 imagesize = (800, 600)