Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn PixelPos inputPoint3D =
- (
- local screen_width, screen_height
- screen_width=RenderWidth as float
- screen_height=RenderHeight as float
- thePos = inputPoint3D * viewport.getTM()
- screen_origin = mapScreenToView [0,0] (thePos.z) [screen_width,screen_height]
- end_screen = mapScreenToView [screen_width,screen_height] (thePos.z) [screen_width,screen_height]
- world_size = screen_origin-end_screen
- x_aspect = screen_width/(abs world_size.x)
- y_aspect = screen_height/(abs world_size.y)
- screen_coords = point2 (x_aspect*(thePos.x-screen_origin.x)) (-(y_aspect*(thePos.y-screen_origin.y)))
- return screen_coords
- )
Add Comment
Please, Sign In to add comment