demos/buddha.py
branchpyrit
changeset 24 d0d76e8a5203
parent 19 4e0955fca797
child 28 ffe83ca074f3
equal deleted inserted replaced
23:7e258561a690 24:d0d76e8a5203
     2 
     2 
     3 # this demo needs buddha model from
     3 # this demo needs buddha 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):
    40 		rt.addshape(face)
    40 		rt.addshape(face)
    41 		face_num -= 1
    41 		face_num -= 1
    42 
    42 
    43 rt = Raytracer()
    43 rt = Raytracer()
    44 mat = Material(colour=(0.9, 0.9, 0.9))
    44 mat = Material(colour=(0.9, 0.9, 0.9))
    45 LoadStanfordPlyFile(rt, mat ,"happy_vrip_res2.ply", 20.0)
    45 LoadStanfordPlyFile(rt, mat ,"../models/happy/happy_vrip_res2.ply", 20.0)
    46 
    46 
    47 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
    47 light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
    48 rt.addlight(light)
    48 rt.addlight(light)
    49 
    49 
    50 imagesize = (800, 600)
    50 imagesize = (800, 600)