savoiardi/camera
Perspective and orthographic cameras.
Savoiardi exposes typed camera variants together with safe downcasts and common projection and lens controls.
Types
An orthographic camera.
pub type Orthographic
A perspective camera.
pub type Perspective
Values
pub fn from_orthographic(camera: Orthographic) -> Camera
Widens an orthographic camera into the shared camera type.
pub fn from_perspective(camera: Perspective) -> Camera
Widens a perspective camera into the shared camera type.
pub fn is_orthographic_camera(object: object.Object3D) -> Bool
Returns whether an object is an orthographic camera.
pub fn is_perspective_camera(object: object.Object3D) -> Bool
Returns whether an object is a perspective camera.
pub fn orthographic(
left left: Float,
right right: Float,
top top: Float,
bottom bottom: Float,
near near: Float,
far far: Float,
) -> Orthographic
Creates an orthographic camera.
pub fn orthographic_bottom(camera: Orthographic) -> Float
Reads the bottom bound of an orthographic camera.
pub fn orthographic_from_object3d(
object: object.Object3D,
) -> Result(Orthographic, Nil)
Safely downcasts an object to an orthographic camera.
pub fn orthographic_left(camera: Orthographic) -> Float
Reads the left bound of an orthographic camera.
pub fn orthographic_right(camera: Orthographic) -> Float
Reads the right bound of an orthographic camera.
pub fn orthographic_top(camera: Orthographic) -> Float
Reads the top bound of an orthographic camera.
pub fn perspective(
fov fov: Float,
aspect aspect: Float,
near near: Float,
far far: Float,
) -> Perspective
Creates a perspective camera.
pub fn perspective_aspect(camera: Perspective) -> Float
Reads the aspect ratio of a perspective camera.
pub fn perspective_effective_fov(camera: Perspective) -> Float
Reads the effective field of view of a perspective camera.
pub fn perspective_film_height(camera: Perspective) -> Float
Reads the film height of a perspective camera.
pub fn perspective_film_width(camera: Perspective) -> Float
Reads the film width of a perspective camera.
pub fn perspective_focal_length(camera: Perspective) -> Float
Reads the focal length of a perspective camera.
pub fn perspective_fov(camera: Perspective) -> Float
Reads the field of view of a perspective camera.
pub fn perspective_from_object3d(
object: object.Object3D,
) -> Result(Perspective, Nil)
Safely downcasts an object to a perspective camera.
pub fn set_orthographic_bottom(
camera: Orthographic,
bottom: Float,
) -> Orthographic
Sets the bottom bound of an orthographic camera.
pub fn set_orthographic_left(
camera: Orthographic,
left: Float,
) -> Orthographic
Sets the left bound of an orthographic camera.
pub fn set_orthographic_right(
camera: Orthographic,
right: Float,
) -> Orthographic
Sets the right bound of an orthographic camera.
pub fn set_orthographic_top(
camera: Orthographic,
top: Float,
) -> Orthographic
Sets the top bound of an orthographic camera.
pub fn set_perspective_aspect(
camera: Perspective,
aspect: Float,
) -> Perspective
Sets the aspect ratio of a perspective camera.
pub fn set_perspective_film_gauge(
camera: Perspective,
film_gauge: Float,
) -> Perspective
Sets the film gauge of a perspective camera.
pub fn set_perspective_film_offset(
camera: Perspective,
film_offset: Float,
) -> Perspective
Sets the film offset of a perspective camera.
pub fn set_perspective_focal_length(
camera: Perspective,
focal_length: Float,
) -> Perspective
Sets the focal length of a perspective camera.
pub fn set_perspective_fov(
camera: Perspective,
fov: Float,
) -> Perspective
Sets the field of view of a perspective camera.
pub fn set_view_offset(
camera: Camera,
full_width full_width: Int,
full_height full_height: Int,
x x: Int,
y y: Int,
width width: Int,
height height: Int,
) -> Camera
Sets a view offset for tiled or multi-window rendering.
pub fn update_orthographic(
camera: Orthographic,
left left: Float,
right right: Float,
top top: Float,
bottom bottom: Float,
near near: Float,
far far: Float,
) -> Orthographic
Updates the core projection values of an orthographic camera.
pub fn update_perspective(
camera: Perspective,
fov fov: Float,
aspect aspect: Float,
near near: Float,
far far: Float,
) -> Perspective
Updates the core projection values of a perspective camera.