pub struct Camera {
pub center: [f32; 2],
pub zoom: f32,
pub viewport: [f32; 2],
pub fade: f32,
pub target_center: [f32; 2],
pub target_zoom: f32,
pub gliding: bool,
}Fields§
§center: [f32; 2]§zoom: f32§viewport: [f32; 2]§fade: f32§target_center: [f32; 2]§target_zoom: f32§gliding: boolImplementations§
Source§impl Camera
impl Camera
pub fn new(width: f32, height: f32) -> Self
pub fn uniform(&self) -> CameraUniform
pub fn pan_pixels(&mut self, dx: f32, dy: f32)
pub fn zoom_by(&mut self, factor: f32)
Sourcepub fn fit_bounds(&mut self, min: [f32; 2], max: [f32; 2])
pub fn fit_bounds(&mut self, min: [f32; 2], max: [f32; 2])
Center and zoom so the world-space AABB [min, max] fits the viewport with margin.
Sourcepub fn snap_to(&mut self, center: [f32; 2], zoom: f32)
pub fn snap_to(&mut self, center: [f32; 2], zoom: f32)
Jump immediately to center/zoom (no glide); clears any glide.
Sourcepub fn tick(&mut self, dt_ms: f32, dur_ms: f32)
pub fn tick(&mut self, dt_ms: f32, dur_ms: f32)
Advance an in-flight glide by dt_ms, using dur_ms to set the pace.
Built-in smooth (exponential) ease — no graph-explorer-style dependency.
No-op when not gliding; snaps when dur_ms <= 0.
Sourcepub fn view_for_bounds(&self, min: [f32; 2], max: [f32; 2]) -> ([f32; 2], f32)
pub fn view_for_bounds(&self, min: [f32; 2], max: [f32; 2]) -> ([f32; 2], f32)
Compute the (center, zoom) that frames world-AABB [min,max] with margin.
Sourcepub fn glide_bounds(&mut self, min: [f32; 2], max: [f32; 2])
pub fn glide_bounds(&mut self, min: [f32; 2], max: [f32; 2])
Glide to frame world-AABB [min,max].
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnsafeUnpin for Camera
impl UnwindSafe for Camera
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
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