Struct camera_controllers::Camera
source · pub struct Camera<T = f32> {
pub position: [T; 3],
pub up: [T; 3],
pub right: [T; 3],
pub forward: [T; 3],
}
Expand description
Models a camera with position and directions.
Fields§
§position: [T; 3]
The camera position.
up: [T; 3]
The up direction.
right: [T; 3]
The right direction.
forward: [T; 3]
The forward direction.
Implementations§
source§impl<T> Camera<T>where
T: Float + Copy,
impl<T> Camera<T>where T: Float + Copy,
sourcepub fn new(position: [T; 3]) -> Camera<T>
pub fn new(position: [T; 3]) -> Camera<T>
Constructs a new camera.
Places the camera at [x, y, z], looking towards pozitive z.
sourcepub fn orthogonal(&self) -> [[T; 4]; 4]
pub fn orthogonal(&self) -> [[T; 4]; 4]
Computes an orthogonal matrix for the camera.
This matrix can be used to transform coordinates to the screen.
sourcepub fn set_yaw_pitch(&mut self, yaw: T, pitch: T)
pub fn set_yaw_pitch(&mut self, yaw: T, pitch: T)
Sets yaw and pitch angle of camera in radians.
sourcepub fn set_rotation(&mut self, rotation: (T, [T; 3]))
pub fn set_rotation(&mut self, rotation: (T, [T; 3]))
Sets forward, up, and right vectors from a Quaternion rotation relative to the positive z-axis
Trait Implementations§
source§impl<T> PartialEq<Camera<T>> for Camera<T>where
T: PartialEq<T>,
impl<T> PartialEq<Camera<T>> for Camera<T>where T: PartialEq<T>,
source§impl<T> PartialOrd<Camera<T>> for Camera<T>where
T: PartialOrd<T>,
impl<T> PartialOrd<Camera<T>> for Camera<T>where T: PartialOrd<T>,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T> StructuralPartialEq for Camera<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Camera<T>where T: RefUnwindSafe,
impl<T> Send for Camera<T>where T: Send,
impl<T> Sync for Camera<T>where T: Sync,
impl<T> Unpin for Camera<T>where T: Unpin,
impl<T> UnwindSafe for Camera<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more