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