demos/dragon.py
branchpyrit
changeset 28 ffe83ca074f3
parent 25 b8232edee786
child 29 574c34441a1c
equal deleted inserted replaced
27:e9bb83c2b8b9 28:ffe83ca074f3
    36 	while (face_num):
    36 	while (face_num):
    37 		tokens = fp.readline().split()
    37 		tokens = fp.readline().split()
    38 		if (tokens[0] != "3"):
    38 		if (tokens[0] != "3"):
    39 			print "ply warning: faces of %d vertices not supported" % tokens[0]
    39 			print "ply warning: faces of %d vertices not supported" % tokens[0]
    40 		f = [vertices[int(x)] for x in tokens[1:4]]
    40 		f = [vertices[int(x)] for x in tokens[1:4]]
    41 		face = Triangle(f[0], f[1], f[2], mat)
    41 		face = Triangle(NormalVertex(f[0]), NormalVertex(f[1]), NormalVertex(f[2]), mat)
    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, "../models/dragon/dragon_vrip_res4.ply", 29.0)
    47 LoadStanfordPlyFile(rt, mat, "../models/dragon/dragon_vrip_res2.ply", 29.0)
    48 
    48 
    49 light1 = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.2))
    49 light1 = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.2))
    50 rt.addlight(light1)
    50 rt.addlight(light1)
    51 
    51 
    52 light2 = Light(position=(3.0, 0.0, 9.0), colour=(0.0, 1.0, 0.2))
    52 light2 = Light(position=(3.0, 0.0, 9.0), colour=(0.0, 1.0, 0.2))