pub struct CameraFrame {
pub pos: DVec3,
pub up: DVec3,
pub facing: DVec3,
pub scale: f64,
pub fovy: f64,
pub near: f64,
pub far: f64,
pub perspective_blend: f64,
}Expand description
The data of a camera
The CameraFrame has a CameraFrame::perspective_blend property (default is 0.0),
which is used to blend between orthographic and perspective projection.
Fields§
§pos: DVec3The position
up: DVec3The up unit vec
facing: DVec3The facing unit vec
scale: f64The scaling factor, used in orthographic projection
fovy: f64The field of view angle, used in perspective projection
near: f64The near pane
far: f64The far pane
perspective_blend: f64The perspective blend value in [0.0, 1.0]
Implementations§
Source§impl CameraFrame
impl CameraFrame
Source§impl CameraFrame
impl CameraFrame
Sourcepub fn view_matrix(&self) -> DMat4
pub fn view_matrix(&self) -> DMat4
The view matrix of the camera
Sourcepub fn orthographic_mat(&self, frame_height: f64, aspect_ratio: f64) -> DMat4
pub fn orthographic_mat(&self, frame_height: f64, aspect_ratio: f64) -> DMat4
Use the given frame size as left, right, bottom, top to construct an orthographic matrix
Sourcepub fn perspective_mat(&self, aspect_ratio: f64) -> DMat4
pub fn perspective_mat(&self, aspect_ratio: f64) -> DMat4
Use the given frame aspect ratio to construct a perspective matrix
Sourcepub fn projection_matrix(&self, frame_height: f64, aspect_ratio: f64) -> DMat4
pub fn projection_matrix(&self, frame_height: f64, aspect_ratio: f64) -> DMat4
Use the given frame size to construct projection matrix
Sourcepub fn view_projection_matrix(
&self,
frame_height: f64,
aspect_ratio: f64,
) -> DMat4
pub fn view_projection_matrix( &self, frame_height: f64, aspect_ratio: f64, ) -> DMat4
Use the given frame size to construct view projection matrix
Source§impl CameraFrame
impl CameraFrame
Sourcepub fn center_canvas_in_frame(
&mut self,
center: DVec3,
width: f64,
height: f64,
up: DVec3,
normal: DVec3,
aspect_ratio: f64,
) -> &mut Self
pub fn center_canvas_in_frame( &mut self, center: DVec3, width: f64, height: f64, up: DVec3, normal: DVec3, aspect_ratio: f64, ) -> &mut Self
Center the canvas in the frame when CameraFrame::perspective_blend is 1.0
Trait Implementations§
Source§impl Alignable for CameraFrame
impl Alignable for CameraFrame
Source§fn is_aligned(&self, _other: &Self) -> bool
fn is_aligned(&self, _other: &Self) -> bool
Source§fn align_with(&mut self, _other: &mut Self)
fn align_with(&mut self, _other: &mut Self)
Source§impl Clone for CameraFrame
impl Clone for CameraFrame
Source§fn clone(&self) -> CameraFrame
fn clone(&self) -> CameraFrame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CameraFrame
impl Debug for CameraFrame
Source§impl Default for CameraFrame
impl Default for CameraFrame
Source§impl Interpolatable for CameraFrame
impl Interpolatable for CameraFrame
Source§impl PartialEq for CameraFrame
impl PartialEq for CameraFrame
Source§impl Primitive for CameraFrame
impl Primitive for CameraFrame
Source§fn build_primitives<T: IntoIterator<Item = Self>>(iter: T) -> Primitives
fn build_primitives<T: IntoIterator<Item = Self>>(iter: T) -> Primitives
impl StructuralPartialEq for CameraFrame
Auto Trait Implementations§
impl Freeze for CameraFrame
impl RefUnwindSafe for CameraFrame
impl Send for CameraFrame
impl Sync for CameraFrame
impl Unpin for CameraFrame
impl UnwindSafe for CameraFrame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Extract for T
impl<T> Extract for T
Source§fn extract_to_primitives(&self) -> Primitives
fn extract_to_primitives(&self) -> Primitives
Primitive from reference.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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