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.