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>
impl<T> Camera<T>
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> PartialOrd for Camera<T>where
T: PartialOrd,
impl<T> PartialOrd for Camera<T>where
T: PartialOrd,
impl<T> StructuralPartialEq for Camera<T>
Auto Trait Implementations§
impl<T> Freeze for Camera<T>where
T: Freeze,
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