Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vert, t, normals, f = load_obj('diablo3_pose.obj')
- for face in f:
- screen_coord = []
- world_coord = []
- for j in range(3):
- v = Vec3(vert[face[j][0]])
- screen_coord.append(Vec2((v.x+1.)*width/2., (v.y+1.)*height/2.))
- world_coord.append(v)
- for i in range(3):
- screen_coord[i] = Vec2(int(screen_coord[i].x), int(screen_coord[i].y))
- n = (world_coord[2] - world_coord[0]) ^ (world_coord[1] - world_coord[0]).normalize()
- intensity = n.x*light_dir.x + n.y*light_dir.y + n.z*light_dir.z
- intensity *= 10
- print intensity
- if intensity > 0:
- triangle( screen_coord[0], screen_coord[1], screen_coord[2], (255*intensity,255,255))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement