pub struct CamTransform {
pub pos: Vector3<f32>,
pub rot: Vector3<f32>,
pub fov: f32,
pub clip: ClipDist,
pub size: Size2D,
pub proj: CamProj,
pub view_matrix: Matrix4<f32>,
pub ortho_scale: f32,
pub front: Vector3<f32>,
pub persp_matrix: Matrix4<f32>,
pub ortho_matrix: Matrix4<f32>,
}Expand description
Camera transform state with pre-computed view and projection matrices.
Holds position, Euler rotation, FOV, clip distances, viewport size, and
projection type. Call calc_matrices to
recompute the view, perspective, and orthographic matrices after mutating
any field.
Fields§
§pos: Vector3<f32>§rot: Vector3<f32>§fov: f32§clip: ClipDist§size: Size2D§proj: CamProj§view_matrix: Matrix4<f32>§ortho_scale: f32§front: Vector3<f32>§persp_matrix: Matrix4<f32>§ortho_matrix: Matrix4<f32>Implementations§
Source§impl CamTransform
impl CamTransform
Sourcepub fn calc_matrices(&mut self)
pub fn calc_matrices(&mut self)
Recalculates view, perspective, and orthographic matrices.
Also updates the front direction vector used for fly-through movement.
Sourcepub fn view_matrix(&self) -> Matrix4<f32>
pub fn view_matrix(&self) -> Matrix4<f32>
Returns the view matrix (world-to-camera).
Sourcepub fn proj_matrix(&self) -> Matrix4<f32>
pub fn proj_matrix(&self) -> Matrix4<f32>
Returns the active projection matrix based on proj.
Trait Implementations§
Source§impl Clone for CamTransform
impl Clone for CamTransform
Source§fn clone(&self) -> CamTransform
fn clone(&self) -> CamTransform
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CamTransform
impl RefUnwindSafe for CamTransform
impl Send for CamTransform
impl Sync for CamTransform
impl Unpin for CamTransform
impl UnsafeUnpin for CamTransform
impl UnwindSafe for CamTransform
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more