pub struct Projection3d { /* private fields */ }Expand description
Perspective or orthographic camera projection with a finite depth range.
Implementations§
Source§impl Projection3d
impl Projection3d
Sourcepub fn perspective(
vertical_fov_radians: f32,
aspect_ratio: f32,
near: WorldLength,
far: WorldLength,
) -> Result<Self, Pseudo3dError>
pub fn perspective( vertical_fov_radians: f32, aspect_ratio: f32, near: WorldLength, far: WorldLength, ) -> Result<Self, Pseudo3dError>
Builds a perspective projection.
The vertical field of view is in radians and must be in 0..PI.
Aspect ratio and near distance must be positive; far must exceed near.
Sourcepub fn orthographic(
vertical_span: WorldLength,
aspect_ratio: f32,
near: WorldLength,
far: WorldLength,
) -> Result<Self, Pseudo3dError>
pub fn orthographic( vertical_span: WorldLength, aspect_ratio: f32, near: WorldLength, far: WorldLength, ) -> Result<Self, Pseudo3dError>
Builds an orthographic projection from its vertical world-space span.
Sourcepub const fn aspect_ratio(self) -> f32
pub const fn aspect_ratio(self) -> f32
Returns the viewport width-to-height ratio.
Sourcepub const fn near(self) -> WorldLength
pub const fn near(self) -> WorldLength
Returns the nearest visible positive view-space depth.
Sourcepub const fn far(self) -> WorldLength
pub const fn far(self) -> WorldLength
Returns the farthest visible positive view-space depth.
Sourcepub const fn is_perspective(self) -> bool
pub const fn is_perspective(self) -> bool
Returns true for perspective and false for orthographic projection.
Trait Implementations§
Source§impl Clone for Projection3d
impl Clone for Projection3d
Source§fn clone(&self) -> Projection3d
fn clone(&self) -> Projection3d
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 moreimpl Copy for Projection3d
Source§impl Debug for Projection3d
impl Debug for Projection3d
Source§impl PartialEq for Projection3d
impl PartialEq for Projection3d
impl StructuralPartialEq for Projection3d
Auto Trait Implementations§
impl Freeze for Projection3d
impl RefUnwindSafe for Projection3d
impl Send for Projection3d
impl Sync for Projection3d
impl Unpin for Projection3d
impl UnsafeUnpin for Projection3d
impl UnwindSafe for Projection3d
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