mln_engine/render/update_parameters.rs
1use std::sync::Arc;
2
3use mln_style::Style;
4use mln_style::subdivision_granularity::SubdivisionGranularitySetting;
5use mln_style::time::Instant;
6
7use crate::camera::{Elevation, View};
8use crate::map::{MapMode, TerrainOptions};
9use crate::text::glyph::FontFaces;
10use crate::tile_store::TileLodMode;
11
12#[derive(Clone)]
13pub struct UpdateParameters {
14 pub style_loaded: bool,
15 pub mode: MapMode,
16 pub pixel_ratio: f32,
17 /// The frame's time; `None` in still modes, which have no clock and show
18 /// every transition and fade as ended.
19 pub time_point: Option<Instant>,
20 /// The view the frame shows.
21 pub view: View,
22 /// The map's zoom range, which the sources load tiles within.
23 pub min_zoom: f64,
24 pub max_zoom: f64,
25 /// Whether a gesture or an animation moves the camera, which the frame
26 /// draws for speed rather than crispness.
27 pub camera_moving: bool,
28
29 /// The version of the style to draw. A renderer compares it with the
30 /// version it drew last ([`mln_style::diff::StyleDiff`]).
31 pub style: Arc<Style>,
32 /// The faces that the style's text draws with: the style's own
33 /// `font-faces`, then the app's fallback faces
34 /// ([`style_font_faces`](crate::text::glyph::style_font_faces)).
35 pub font_faces: Option<Arc<FontFaces>>,
36 pub sprite_loaded: bool,
37 /// The map's feature state. Each render source takes its own, in place
38 /// of what it held.
39 pub feature_states: Arc<crate::source::source_state::FeatureStatesBySource>,
40
41 pub file_source: Option<Arc<dyn crate::storage::FileSource>>,
42 pub prefetch_zoom_delta: u8,
43
44 /// For still image requests, render requested.
45 pub still_image_request: bool,
46 /// Identifies the still image request: each new one retries the
47 /// resources that failed to load.
48 pub still_image_request_id: u64,
49 /// Identifies the update among its map's, which number them from 1 in
50 /// the order they're made. A frame's report names the update it drew
51 /// ([`RendererEvent::RenderFrameFinished`]).
52 ///
53 /// [`RendererEvent::RenderFrameFinished`]: crate::RendererEvent::RenderFrameFinished
54 pub update_id: u64,
55 pub cross_source_collisions: bool,
56 pub fast_pfor_enabled: bool,
57 /// How the map draws its terrain.
58 pub terrain: TerrainOptions,
59 /// The terrain's ground that `view` stands on: the snapshot of it that
60 /// the renderer last reported ([`RendererEvent::TerrainElevation`]) and
61 /// the map applied, or `None`. A frame is complete only when this is the
62 /// renderer's current snapshot, the same `Arc`, or both are `None`. A
63 /// still image draws no other.
64 ///
65 /// [`RendererEvent::TerrainElevation`]: crate::RendererEvent::TerrainElevation
66 pub elevation: Option<Arc<dyn Elevation>>,
67
68 pub tile_lod_min_radius: f64,
69 pub tile_lod_scale: f64,
70 pub tile_lod_pitch_threshold: f64,
71 pub tile_lod_zoom_shift: f64,
72 pub tile_lod_mode: TileLodMode,
73
74 pub subdivision_granularity: SubdivisionGranularitySetting,
75}
76
77// The map and a renderer on another thread share an update.
78const _: () = {
79 const fn assert_send_sync<T: Send + Sync>() {}
80 assert_send_sync::<UpdateParameters>();
81};