Advertisement
BanyRule

Untitled

Feb 2nd, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. vert, t, normals, f = load_obj('diablo3_pose.obj')
  2. for face in f:
  3. screen_coord = []
  4. world_coord = []
  5. for j in range(3):
  6. v = Vec3(vert[face[j][0]])
  7. screen_coord.append(Vec2((v.x+1.)*width/2., (v.y+1.)*height/2.))
  8. world_coord.append(v)
  9. for i in range(3):
  10. screen_coord[i] = Vec2(int(screen_coord[i].x), int(screen_coord[i].y))
  11.  
  12. n = (world_coord[2] - world_coord[0]) ^ (world_coord[1] - world_coord[0]).normalize()
  13. intensity = n.x*light_dir.x + n.y*light_dir.y + n.z*light_dir.z
  14. intensity *= 10
  15. print intensity
  16. if intensity > 0:
  17. triangle( screen_coord[0], screen_coord[1], screen_coord[2], (255*intensity,255,255))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement