pub struct Image { /* private fields */ }Implementations§
Source§impl Image
impl Image
Sourcepub fn new(frame: Frame, scope: Scope, max: Vec2) -> Self
pub fn new(frame: Frame, scope: Scope, max: Vec2) -> Self
Computes initial transformations from frame, scope, and screen’s width and height.
Sourcepub fn compute(&mut self, frame: Frame, scope: Scope) -> Option<bool>
pub fn compute(&mut self, frame: Frame, scope: Scope) -> Option<bool>
Recomputes only cached matrices whose parameters have changed, see Self::set_compute().
Returns Some(true) on success, Some(false) on failure, and None with no changes.
Sourcepub const fn set_compute(&mut self, compute_mat: bool, compute_inv: bool)
pub const fn set_compute(&mut self, compute_mat: bool, compute_inv: bool)
Sets whether to compute transformation and inverse transformation with Self::compute().
Default is (true, true). Takes effect with next Self::compute().
Sourcepub const fn set_passive(&mut self, use_passive: bool)
pub const fn set_passive(&mut self, use_passive: bool)
Sets whether to use passive transformations.
Default is false. Takes effect with next Self::compute().
Sourcepub const fn pos(&self) -> Vec2
pub const fn pos(&self) -> Vec2
Current position in screen space of hovering input or pointing device.
Sourcepub const fn set_pos(&mut self, pos: Vec2)
pub const fn set_pos(&mut self, pos: Vec2)
Sets current position in screen space of hovering input or pointing device.
Sourcepub fn set_max(&mut self, max: Vec2)
pub fn set_max(&mut self, max: Vec2)
Sets maximum position in screen space as screen’s width and height.
Takes effect with next Self::compute().
Sourcepub const fn upp(&self) -> f32
pub const fn upp(&self) -> f32
Cached unit per pixel on focus plane to scale/project positions/vectors onto focus plane.
Sourcepub const fn view_rigid(&self) -> Rigid
pub const fn view_rigid(&self) -> Rigid
Cached view transformation from camera to world space or inversely if passive.
See Self::set_passive().
Sourcepub const fn projection(&self) -> Mat4
pub const fn projection(&self) -> Mat4
Cached projection matrix.
Sourcepub const fn transformation(&self) -> Mat4
pub const fn transformation(&self) -> Mat4
Cached projection view matrix.
Sourcepub const fn inverse_transformation(&self) -> Mat4
pub const fn inverse_transformation(&self) -> Mat4
Cached inverse projection view matrix.
Sourcepub const fn clamp_pos_wrt_max(pos: Vec2, max: Vec2) -> Vec2
pub const fn clamp_pos_wrt_max(pos: Vec2, max: Vec2) -> Vec2
Clamps position in screen space wrt its maximum in screen space.
Sourcepub fn transform_pos_and_max_wrt_max(pos: Vec2, max: Vec2) -> (Vec2, Vec2)
pub fn transform_pos_and_max_wrt_max(pos: Vec2, max: Vec2) -> (Vec2, Vec2)
Transforms position and its maximum from screen to camera space wrt its maximum.
Sourcepub fn transform_pos(&self, pos: Vec2) -> Vec2
pub fn transform_pos(&self, pos: Vec2) -> Vec2
Transforms position from screen to camera space.
Sourcepub const fn transform_vec(vec: Vec2) -> Vec2
pub const fn transform_vec(vec: Vec2) -> Vec2
Transforms vector from screen to camera space.
Sourcepub fn project_pos(&self, pos: Vec2) -> Vec3
pub fn project_pos(&self, pos: Vec2) -> Vec3
Transforms position from screen to camera space and projects it onto focus plane.
Sourcepub fn project_vec(&self, vec: Vec2) -> Vec3
pub fn project_vec(&self, vec: Vec2) -> Vec3
Transforms vector from screen to camera space and projects it onto focus plane.