View Source Exray.Core.Screenspace (Exray v0.6.0)

Transform 3D positions in the world to screenspace and vice versa

Summary

Functions

Get camera transform matrix (view matrix)

Get camera 2d transform matrix

Get a ray trace from mouse position

Get the world space position for a 2d camera screen space position

Get the screen space position for a 3d world space position

Get the screen space position for a 2d camera world space position

Get size position for a 3d world space position

Functions

Link to this function

get_camera_matrix(camera)

View Source
@spec get_camera_matrix(camera :: Exray.Structs.Camera3D.t()) ::
  camera_matrix :: Exray.Structs.Matrix.t()

Get camera transform matrix (view matrix)

Link to this function

get_camera_matrix_2d(camera)

View Source
@spec get_camera_matrix_2d(camera :: Exray.Structs.Camera2D.t()) ::
  camera_matrix :: Exray.Structs.Matrix.t()

Get camera 2d transform matrix

Link to this function

get_mouse_ray(mouse_position, camera)

View Source
@spec get_mouse_ray(
  mouse_position :: Exray.Structs.Vector2.t(),
  camera :: Exray.Structs.Camera3D.t()
) ::
  mouse_ray :: Exray.Structs.Ray.t()

Get a ray trace from mouse position

Link to this function

get_screen_to_world_2d(position, camera)

View Source
@spec get_screen_to_world_2d(
  position :: Exray.Structs.Vector2.t(),
  camera :: Exray.Structs.Camera2D.t()
) :: screen_to_world :: Exray.Structs.Vector2.t()

Get the world space position for a 2d camera screen space position

Link to this function

get_world_to_screen(position, camera)

View Source
@spec get_world_to_screen(
  position :: Exray.Structs.Vector3.t(),
  camera :: Exray.Structs.Camera3D.t()
) ::
  world_to_screen :: Exray.Structs.Vector2.t()

Get the screen space position for a 3d world space position

Link to this function

get_world_to_screen_2d(position, camera)

View Source
@spec get_world_to_screen_2d(
  position :: Exray.Structs.Vector2.t(),
  camera :: Exray.Structs.Camera2D.t()
) :: world_to_screen_2d :: Exray.Structs.Vector2.t()

Get the screen space position for a 2d camera world space position

Link to this function

get_world_to_screen_ex(position, camera, width, height)

View Source
@spec get_world_to_screen_ex(
  position :: Exray.Structs.Vector3.t(),
  camera :: Exray.Structs.Camera3D.t(),
  width :: integer(),
  height :: integer()
) :: world_to_screen_ex :: Exray.Structs.Vector2.t()

Get size position for a 3d world space position