Guest User

Untitled

a guest
Mar 15th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. fn PixelPos inputPoint3D =
  2. (
  3. local screen_width, screen_height
  4. screen_width=RenderWidth as float
  5. screen_height=RenderHeight as float
  6.  
  7. thePos = inputPoint3D * viewport.getTM()
  8. screen_origin = mapScreenToView [0,0] (thePos.z) [screen_width,screen_height]
  9. end_screen = mapScreenToView [screen_width,screen_height] (thePos.z) [screen_width,screen_height]
  10. world_size = screen_origin-end_screen
  11. x_aspect = screen_width/(abs world_size.x)
  12. y_aspect = screen_height/(abs world_size.y)
  13. screen_coords = point2 (x_aspect*(thePos.x-screen_origin.x)) (-(y_aspect*(thePos.y-screen_origin.y)))
  14.  
  15. return screen_coords   
  16. )
Add Comment
Please, Sign In to add comment