[][src]Struct camera_ss::Camera

pub struct Camera { /* fields omitted */ }

The camera struct maintains all the state of the camera. In order to maintain correct the correct aspect ratio and timing for orbital mechanics, it needs to be updated every frame.

Methods

impl Camera[src]

pub fn distance(&self) -> &f32[src]

How far the camera is from the target in world coordinates

pub fn near(&self) -> &f32[src]

The distance from the camera to the near plane of the viewing frustrum

pub fn far(&self) -> &f32[src]

The distance from the camera to the far plane of the viewing frustrum

pub fn field_of_view(&self) -> &f32[src]

The field of view to use when making the perspective transform

pub fn rotation(&self) -> &Quaternion<f32>[src]

How the camera is oriented relative to the target in world coordinates

pub fn scroll_modifier(&self) -> &f32[src]

The factor applied to the number of pixels from each scroll event, I have default set of (1 / 200)

pub fn target(&self) -> &Vector3<f32>[src]

The target is where the camera points in world coordinates

impl Camera[src]

pub fn set_distance(&mut self, val: f32) -> &mut Self[src]

How far the camera is from the target in world coordinates

pub fn set_near(&mut self, val: f32) -> &mut Self[src]

The distance from the camera to the near plane of the viewing frustrum

pub fn set_far(&mut self, val: f32) -> &mut Self[src]

The distance from the camera to the far plane of the viewing frustrum

pub fn set_field_of_view(&mut self, val: f32) -> &mut Self[src]

The field of view to use when making the perspective transform

pub fn set_rotation(&mut self, val: Quaternion<f32>) -> &mut Self[src]

How the camera is oriented relative to the target in world coordinates

pub fn set_scroll_modifier(&mut self, val: f32) -> &mut Self[src]

The factor applied to the number of pixels from each scroll event, I have default set of (1 / 200)

pub fn set_target(&mut self, val: Vector3<f32>) -> &mut Self[src]

The target is where the camera points in world coordinates

impl Camera[src]

pub fn new() -> Camera[src]

pub fn update(
    &mut self,
    elapsed_millis: f32,
    window_width: f32,
    window_height: f32
)
[src]

The update function should be called once per frame in order to maintain the aspect ratio and the timing for orbital mechanics. Ideally it should be called at the begining of your "simulation loop", right after you have calculated your frame time. TODO: Duration should be a f32 millis too

pub fn start_transition(
    &mut self,
    end_target: Vector3<f32>,
    end_rotation: Quaternion<f32>,
    end_distance: f32,
    transition_duration: f32
)
[src]

Use this to setup a camera transition

pub fn transition_to_default(&mut self)[src]

pub fn set_current_as_default(&mut self)[src]

pub fn get_position(&self) -> Vector3<f32>[src]

Get the position of the camera in world coordinates

pub fn get_rotation(&self) -> Basis3<f32>[src]

Get the rotation of the camera

pub fn get_up(&self) -> Vector3<f32>[src]

pub fn get_right(&self) -> Vector3<f32>[src]

pub fn get_rotation_transform(&self) -> Matrix4<f32>[src]

The Rotation applied to world coordinates as part of the view matrix

pub fn get_world_to_camera_transform(&self) -> Matrix4<f32>[src]

world to camera transform, also known as ViewMatrix

pub fn get_world_to_clipspace_transform(&self) -> Matrix4<f32>[src]

Get the world coordinates to clipspace coordinates transform If you are unsure, this is probably the transform you want from the camera.

pub fn handle_mouse_move(&mut self, mouse_x: f32, mouse_y: f32)[src]

Handle mouse movement as pixel coordinates

pub fn toggle_orbit(&mut self)[src]

pub fn handle_mouse_input(&mut self, button: MouseButton, state: ButtonState)[src]

Handle mouse clicks,

pub fn handle_scroll(&mut self, pixel_delta: f32)[src]

pub fn translate(&mut self, delta: Vector3<f32>)[src]

Move the camera's target

Auto Trait Implementations

impl Sync for Camera

impl Send for Camera

impl Unpin for Camera

impl RefUnwindSafe for Camera

impl UnwindSafe for Camera

Blanket Implementations

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

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

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.

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

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

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