Skip to main content

mln_engine/camera/
frame_projection.rs

1//! Where a frame drew the map, for a host that draws into the frame
2//! depth-tested against it. The renderer computes it
3//! (`crate::render::frame_projection`); it lives here so that the style's
4//! custom layers, which get it with each frame, can name it.
5
6use glam::DMat4;
7pub use mln_gfx::gpu::ClipDepthRange;
8
9/// Where a frame drew the map, and the depth its 3D layers wrote there.
10#[derive(Clone, Copy, Debug, PartialEq)]
11pub struct FrameProjection {
12    /// Takes Web Mercator points, x and y from 0 to 1 and z in meters, to
13    /// clip coordinates in `clip_depth_range`'s convention, whose depth
14    /// under the API's default depth range is the depth that the frame's 3D
15    /// layers wrote at the point.
16    pub matrix: DMat4,
17    pub clip_depth_range: ClipDepthRange,
18    /// The distance from the camera to the plane where that depth is 0, in
19    /// pixels at the camera's zoom.
20    pub near_distance: f64,
21    /// The distance to the plane where the depth is `far_depth`.
22    pub far_distance: f64,
23    /// The depth at `far_distance`, below the 2D layers' depths.
24    pub far_depth: f64,
25    /// Whether the frame drew a globe, which `matrix` doesn't describe.
26    pub globe: bool,
27}