[][src]Struct duku::Camera

pub struct Camera {
    pub position: Vec3,
    pub scale: Vec3,
    pub rotation: Quat,
    pub fov: u32,
    pub width: Option<f32>,
    pub height: Option<f32>,
    pub depth: f32,
    pub projection: Projection,
}

The view into a scene.

Examples

let camera = Camera::perspective(90);

duku.draw(Some(&camera), |t| {
    // draw commands
});

Fields

position: Vec3

the position of the camera

scale: Vec3

the scale of the camera

rotation: Quat

the rotation of the camera

fov: u32

field of view for perspective cameras

width: Option<f32>

the width of the camera, if width is None the camera will be automatically sized based on the render texture or window

height: Option<f32>

the height of the camera, if height is None the camera will be automatically sized based on the render texture or window

depth: f32

the depth of the camera

projection: Projection

the projection type of the camera

Implementations

impl Camera[src]

pub fn perspective(fov: u32) -> Self[src]

Create a perspective camera that is autosized

pub fn orthographic() -> Self[src]

Create a orthographic camera that is autosized

pub fn perspective_sized(width: f32, height: f32, fov: u32) -> Self[src]

Create a perspective camera

pub fn orthographic_sized(width: f32, height: f32) -> Self[src]

Create a orthographic camera

pub fn new(
    projection: Projection,
    width: f32,
    height: f32,
    depth: f32,
    fov: u32
) -> Self
[src]

Create a new camera

pub fn fake_orthographic(&mut self, enable: bool)[src]

Convert perspective camera to a zoomed-in orthographic one

Camera has to have a set height

pub fn move_by(&mut self, amount: impl Into<Vec3>)[src]

Move camera by specified amount

This moves using global directions

pub fn move_up(&mut self, amount: f32)[src]

Move camera up by specified amount

This moves using local directions

pub fn move_down(&mut self, amount: f32)[src]

Move camera down by specified amount

This moves using local directions

pub fn move_right(&mut self, amount: f32)[src]

Move camera right by specified amount

This moves using local directions

pub fn move_left(&mut self, amount: f32)[src]

Move camera left by specified amount

This moves using local directions

pub fn move_forward(&mut self, amount: f32)[src]

Move camera forward by specified amount

This moves using local directions

pub fn move_back(&mut self, amount: f32)[src]

Move camera back by specified amount

This moves using local directions

pub fn move_around_point(
    &mut self,
    point: impl Into<Vec3>,
    angle: f32,
    axis: impl Into<Vec3>
)
[src]

Move camera rotating it around some point around an axis

pub fn look_dir(&mut self, dir: impl Into<Vec3>)[src]

Rotate the camera to look in specific direction

pub fn look_at(&mut self, pos: impl Into<Vec3>)[src]

Rotate the camera to look at specific position

Trait Implementations

impl Clone for Camera[src]

impl Debug for Camera[src]

Auto Trait Implementations

impl RefUnwindSafe for Camera

impl Send for Camera

impl Sync for Camera

impl Unpin for Camera

impl UnwindSafe for Camera

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.