Skip to main content

Camera

Trait Camera 

Source
pub trait Camera:
    Send
    + Sync
    + Clone {
    // Required methods
    fn view(&self) -> Mat4;
    fn projection(&self) -> Mat4;
    fn eye(&mut self) -> &mut Vec3;
    fn target(&mut self) -> &mut Vec3;
    fn up(&mut self) -> &mut Vec3;

    // Provided method
    fn matrix(&self) -> Mat4 { ... }
}
Expand description

Abstraction of a camera

Required Methods§

Source

fn view(&self) -> Mat4

Create a view matrix for the camera

Source

fn projection(&self) -> Mat4

Create a projection matrix

Source

fn eye(&mut self) -> &mut Vec3

Poistion of the camera

Source

fn target(&mut self) -> &mut Vec3

Direction of the camera

Source

fn up(&mut self) -> &mut Vec3

Up vector

Provided Methods§

Source

fn matrix(&self) -> Mat4

Calculated and converted to WGPU matrix of the camera

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§