pub struct Camera<T = f32> {
pub position: Vector3<T>,
pub up: Vector3<T>,
pub right: Vector3<T>,
pub forward: Vector3<T>,
}Expand description
Models a camera with position and directions.
Fields§
§position: Vector3<T>The camera position.
up: Vector3<T>The up direction.
right: Vector3<T>The right direction.
forward: Vector3<T>The forward direction.
Implementations§
Source§impl<T: Float + Copy> Camera<T>
impl<T: Float + Copy> Camera<T>
Sourcepub fn new(position: Vector3<T>) -> Camera<T>
pub fn new(position: Vector3<T>) -> Camera<T>
Constructs a new camera.
Places the camera at [x, y, z], looking towards pozitive z.
Sourcepub fn orthogonal(&self) -> Matrix4<T>
pub fn orthogonal(&self) -> Matrix4<T>
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: Quaternion<T>)
pub fn set_rotation(&mut self, rotation: Quaternion<T>)
Sets forward, up, and right vectors from a Quaternion rotation relative to the positive z-axis
Trait Implementations§
Source§impl<T: PartialOrd> PartialOrd for Camera<T>
impl<T: PartialOrd> PartialOrd for Camera<T>
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