pub struct Projection2d { /* private fields */ }Expand description
Lightweight pseudo-depth projection for 2D scenes.
This is not a mesh renderer or z-buffer. It offsets 2D points using a scalar depth value so host applications can create camera-like depth transitions without leaving the 2D rendering model.
Implementations§
Source§impl Projection2d
impl Projection2d
Sourcepub fn new(tilt: f32, depth_scale: f32) -> Result<Self, Projection2dError>
pub fn new(tilt: f32, depth_scale: f32) -> Result<Self, Projection2dError>
Builds a projection from tilt in radians and depth conversion scale.
depth_scale is measured in world units per caller-defined depth unit.
Both values must be finite.
Sourcepub fn depth_scale(self) -> f32
pub fn depth_scale(self) -> f32
Returns depth conversion in world units per caller-defined depth unit.
Sourcepub fn project_relative(
self,
point: Vec2,
depth: f32,
) -> Result<Vec2, Projection2dError>
pub fn project_relative( self, point: Vec2, depth: f32, ) -> Result<Vec2, Projection2dError>
Projects a camera-relative world-space point with caller-provided pseudo-depth.
This is the same relative-coordinate operation used by Camera2d.
It is not an absolute-world transform and must not be applied before
Camera2d::world_to_screen, which performs it itself.
Trait Implementations§
Source§impl Clone for Projection2d
impl Clone for Projection2d
Source§fn clone(&self) -> Projection2d
fn clone(&self) -> Projection2d
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 Projection2d
Source§impl Debug for Projection2d
impl Debug for Projection2d
Source§impl Interpolate for Projection2d
impl Interpolate for Projection2d
Source§fn interpolate(self, end: Self, amount: f32) -> Self
fn interpolate(self, end: Self, amount: f32) -> Self
Interpolates between
self and end.Source§impl PartialEq for Projection2d
impl PartialEq for Projection2d
impl StructuralPartialEq for Projection2d
Auto Trait Implementations§
impl Freeze for Projection2d
impl RefUnwindSafe for Projection2d
impl Send for Projection2d
impl Sync for Projection2d
impl Unpin for Projection2d
impl UnsafeUnpin for Projection2d
impl UnwindSafe for Projection2d
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