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`).
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 /// The map's [`fade_duration`](crate::map::MapOptions::fade_duration).
57 pub fade_duration: Option<std::time::Duration>,
58 /// Whether symbols and patterns fade: once the map went idle, so what
59 /// it shows first doesn't fade in.
60 pub fades: bool,
61 /// How the map draws its terrain.
62 pub terrain: TerrainOptions,
63 /// The terrain's ground that `view` stands on: the snapshot of it that
64 /// the renderer last reported ([`RendererEvent::TerrainElevation`]) and
65 /// the map applied, or `None`. A frame is complete only when this is the
66 /// renderer's current snapshot, the same `Arc`, or both are `None`. A
67 /// still image draws no other.
68 ///
69 /// [`RendererEvent::TerrainElevation`]: crate::RendererEvent::TerrainElevation
70 pub elevation: Option<Arc<dyn Elevation>>,
71
72 pub tile_lod_min_radius: f64,
73 pub tile_lod_scale: f64,
74 pub tile_lod_pitch_threshold: f64,
75 pub tile_lod_zoom_shift: f64,
76 pub tile_lod_mode: TileLodMode,
77
78 pub subdivision_granularity: SubdivisionGranularitySetting,
79}
80
81// The map and a renderer on another thread share an update.
82const _: () = {
83 const fn assert_send_sync<T: Send + Sync>() {}
84 assert_send_sync::<UpdateParameters>();
85};