pub struct Camera {
pub pan_x: f32,
pub pan_y: f32,
pub zoom: f32,
pub target: V3,
pub azimuth: f32,
pub elevation: f32,
pub distance: f32,
pub fov_y: f32,
pub feel: InputFeel,
}Expand description
The shared camera — the superset of the 2D pan/zoom and 3D orbit cameras.
In 2D mode (the graph board) a world point projects as
center + pan + p * zoom, exactly as facett-graphview::model::Camera.
In 3D mode (the orbit map) the eye sits on a sphere of distance around
target at (azimuth, elevation), and view_space / project_view /
view_proj reproduce facett-map3d::camera::OrbitCamera’s math (the
camera_seam test goldens this).
The skins keep their own concrete camera types this milestone; Camera is the
additive seam a future renderer drives both domains through.
Fields§
§pan_x: f32§pan_y: f32§zoom: f32§target: V3Point the camera orbits / looks at.
azimuth: f32Turntable yaw about +Y.
elevation: f32Polar lift; +PI/2 looks straight down, 0 is level.
distance: f32Eye-to-target distance (the dolly radius).
fov_y: f32Vertical field of view (radians).
feel: InputFeelPer-OS input feel (shared FEEL).
Implementations§
Source§impl Camera
impl Camera
Sourcepub const NEAR_PLANE: f32 = 0.02
pub const NEAR_PLANE: f32 = 0.02
The view-space near plane (camera-space depth, design units). Identical
to facett-map3d::camera::OrbitCamera::NEAR_PLANE — geometry with
cz <= NEAR_PLANE sits on or behind the eye and must be clipped before the
perspective divide.
Sourcepub fn project2d(&self, p: Pos) -> (f32, f32)
pub fn project2d(&self, p: Pos) -> (f32, f32)
Project a 2D world point to screen pixels (pan/zoom affine), the graph
board’s transform. p * zoom + pan — center is folded into pan by the
caller (matching graphview), so this is the raw affine.
Sourcepub fn far_plane(&self) -> f32
pub fn far_plane(&self) -> f32
The bounded far plane — mirrors OrbitCamera::far_plane (distance + 4).
Sourcepub fn basis(&self) -> (V3, V3, V3)
pub fn basis(&self) -> (V3, V3, V3)
Forward (eye → target), right, and up basis vectors of the view.
Sourcepub fn view_space(&self, p: V3) -> V3
pub fn view_space(&self, p: V3) -> V3
A world point transformed into view space (x=right, y=up, z=forward,
relative to the eye). The near-plane clip operates here, before projection.
Sourcepub fn project_view(&self, c: V3, center: (f32, f32), half_h: f32) -> Projected
pub fn project_view(&self, c: V3, center: (f32, f32), half_h: f32) -> Projected
Project an already-view-space point to screen pixels with perspective.
Trait Implementations§
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§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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