From 3efc5ba5d3389da168b00f8fe47d3478821e5d7f Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 01:14:54 +0400 Subject: feat(ui): restore the original cockpit radar dial Use the mirrored source atlas halves and show the installed sensor range with the original font. The stock Fireline cockpit reads 300 and the Two Fortresses cockpit reads 400. The range query agrees with the original libraries for both inactive and missing devices. --- apps/fparkan-game/src/altimeter_hud.rs | 40 ++---- apps/fparkan-game/src/cockpit_dial.rs | 201 +++++++++++++++++++++++++++++ apps/fparkan-game/src/cockpit_radar_hud.rs | 91 ++++++++++++- apps/fparkan-game/src/course_hud.rs | 117 ----------------- apps/fparkan-game/src/main.rs | 2 +- apps/fparkan-game/src/mission_overlay.rs | 62 ++++----- 6 files changed, 321 insertions(+), 192 deletions(-) create mode 100644 apps/fparkan-game/src/cockpit_dial.rs delete mode 100644 apps/fparkan-game/src/course_hud.rs (limited to 'apps/fparkan-game') diff --git a/apps/fparkan-game/src/altimeter_hud.rs b/apps/fparkan-game/src/altimeter_hud.rs index 48114bf1..9a7b4865 100644 --- a/apps/fparkan-game/src/altimeter_hud.rs +++ b/apps/fparkan-game/src/altimeter_hud.rs @@ -1,16 +1,11 @@ use super::{ append_environment_gradient_material, append_environment_range, environment_vertex, mission_overlay::source_over, quad_indices, screen_tl_quad_vertices_pixels, - world_pipeline_state, DirectoryVfs, EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, + world_pipeline_state, EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, StaticPreviewScene, VulkanSmokeRenderer, VulkanStaticMesh, VulkanStaticTexture, }; -use fparkan_assets::{ - game_font::{load_layout_font, BitmapFont}, - ui_sprite::load_ui_page, - RgbaImage, -}; +use fparkan_assets::{game_font::BitmapFont, RgbaImage}; use fparkan_runtime::cockpit_altimeter::Altimeter; -use std::path::Path; const LEFT: u32 = 221; const TOP: u32 = 347; @@ -28,37 +23,18 @@ pub(super) struct AltimeterHud { } impl AltimeterHud { - pub(super) fn load(root: &Path, preview: &mut StaticPreviewScene) -> Result { - let vfs = DirectoryVfs::new(root); - let page = load_ui_page(&vfs, "page6")?; - let icons = load_ui_page(&vfs, "ui_menu3")?; - if [page.width, page.height, icons.width, icons.height] != [256; 4] { - return Err("unexpected native altimeter atlas dimensions".into()); - } - let font = load_layout_font(&vfs)?; + pub(super) fn load( + page: RgbaImage, + icons: RgbaImage, + font: BitmapFont, + preview: &mut StaticPreviewScene, + ) -> Result { let mut backing = VulkanStaticTexture { width: WIDTH, height: HEIGHT, rgba8: vec![0; (WIDTH * HEIGHT * 4) as usize], mip_levels: Vec::new(), }; - // The gauge bracket and number well are part of the mirrored radar frame. - blit( - &mut backing, - &page, - [228, 52, 21, 63], - [227, 379], - true, - WHITE, - ); - blit( - &mut backing, - &page, - [219, 115, 36, 14], - [221, 442], - true, - WHITE, - ); // iron3d+0x3f6a0 and +0x3ff00 select and position the altitude icon. blit( &mut backing, diff --git a/apps/fparkan-game/src/cockpit_dial.rs b/apps/fparkan-game/src/cockpit_dial.rs new file mode 100644 index 00000000..3bbb0131 --- /dev/null +++ b/apps/fparkan-game/src/cockpit_dial.rs @@ -0,0 +1,201 @@ +use super::{ + altimeter_hud::AltimeterHud, append_environment_gradient_material, append_environment_range, + environment_vertex, quad_indices, screen_tl_quad_vertices_pixels, world_pipeline_state, + DirectoryVfs, EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, StaticPreviewScene, + VulkanSmokeRenderer, VulkanStaticMesh, VulkanStaticTexture, VulkanStaticVertex, +}; +use fparkan_assets::{game_font::load_layout_font, ui_sprite::load_ui_page, RgbaImage}; +use fparkan_render::cockpit_course::{bearing_markers, view_sector}; +use fparkan_runtime::cockpit_altimeter::Altimeter; +use std::path::Path; + +const MARKER_UVS: [[f32; 2]; 4] = [ + [192.5 / 256.0, 154.5 / 256.0], + [192.5 / 256.0, 165.0 / 256.0], + [201.0 / 256.0, 154.5 / 256.0], + [201.0 / 256.0, 165.0 / 256.0], +]; +const FRONT: [f32; 3] = [10.0 / 255.0, 10.0 / 255.0, 225.0 / 255.0]; +const REAR: [f32; 3] = [225.0 / 255.0, 10.0 / 255.0, 10.0 / 255.0]; + +pub(super) struct CockpitDial { + bezel: EnvironmentGpuRange, + altimeter: AltimeterHud, + sector: EnvironmentGpuRange, + markers: EnvironmentGpuRange, +} + +impl CockpitDial { + pub(super) fn load(root: &Path, preview: &mut StaticPreviewScene) -> Result { + let vfs = DirectoryVfs::new(root); + let sector_page = load_ui_page(&vfs, "page7")?; + let marker_page = load_ui_page(&vfs, "page6")?; + let icons = load_ui_page(&vfs, "ui_menu3")?; + let font = load_layout_font(&vfs)?; + if [ + sector_page.width, + sector_page.height, + marker_page.width, + marker_page.height, + icons.width, + icons.height, + ] != [256; 6] + { + return Err("unexpected native cockpit dial atlas dimensions".into()); + } + let bezels_and_markers = atlas_material(preview, marker_page.clone())?; + let bezel = append_environment_range( + &mut preview.mesh, + bezels_and_markers, + bezel_vertices(), + quad_indices(2)?, + world_pipeline_state(LegacyBlendMode::SourceAlpha, LegacyDepthMode::Disabled), + )?; + let altimeter = AltimeterHud::load(marker_page, icons, font, preview)?; + let sector_material = atlas_material(preview, sector_page)?; + let sector = append_range(preview, sector_material, 3, vec![0, 1, 2])?; + let markers = append_range( + preview, + bezels_and_markers, + 8, + vec![0, 1, 2, 2, 1, 3, 4, 5, 6, 6, 5, 7], + )?; + Ok(Self { + bezel, + altimeter, + sector, + markers, + }) + } + + pub(super) fn ranges(&self) -> [usize; 4] { + [ + self.bezel.range_index, + self.altimeter.range_index(), + self.sector.range_index, + self.markers.range_index, + ] + } + + pub(super) fn draw( + &mut self, + renderer: &mut VulkanSmokeRenderer, + mesh: &mut VulkanStaticMesh, + viewport: [f32; 2], + view: Option<([f32; 2], f32)>, + altitude: Option, + ) -> Result<(), String> { + self.altimeter.draw(renderer, mesh, viewport, altitude)?; + for (range, count) in [(self.bezel, 12), (self.sector, 3), (self.markers, 12)] { + renderer + .set_draw_range_index_count( + range.range_index, + if view.is_some() { count } else { 0 }, + ) + .map_err(|error| error.to_string())?; + } + let Some((forward, fov)) = view else { + return Ok(()); + }; + + let start = self.sector.vertex_start; + mesh.vertices[start..start + 3] + .copy_from_slice(&view_sector(fov).map(|(point, uv)| vertex(point, uv, [1.0; 3]))); + let start = self.markers.vertex_start; + for ((corners, color), vertices) in bearing_markers(forward) + .into_iter() + .zip([FRONT, REAR]) + .zip(mesh.vertices[start..start + 8].chunks_exact_mut(4)) + { + for ((point, uv), output) in corners.into_iter().zip(MARKER_UVS).zip(vertices) { + *output = vertex(point, uv, color); + } + } + Ok(()) + } +} + +fn bezel_vertices() -> Vec { + // iron3d+0x3ffde and +0x40008 meet at X=320. The left interval is mirrored. + [(221.0, 320.0, 255.0, 156.5), (320.0, 421.0, 155.5, 255.0)] + .into_iter() + .flat_map(|(left, right, u_left, u_right)| { + let [u_left, u_right] = [u_left / 256.0, u_right / 256.0]; + let [v_top, v_bottom] = [0.5 / 256.0, 153.0 / 256.0]; + screen_tl_quad_vertices_pixels( + [(left + right) * 0.5, (327.0 + 480.0) * 0.5], + (right - left) * 0.5, + (480.0 - 327.0) * 0.5, + [640.0, 480.0], + [1.0; 3], + 1.0, + [ + [u_left, v_top], + [u_left, v_bottom], + [u_right, v_bottom], + [u_right, v_top], + ], + ) + }) + .collect() +} + +fn vertex([x, y]: [f32; 2], uv: [f32; 2], color: [f32; 3]) -> VulkanStaticVertex { + // Scaling the design coordinates and the viewport by the same factors + // cancels out when converting the original TL positions to NDC. + environment_vertex( + [x * (2.0 / 640.0) - 1.0, y * (2.0 / 480.0) - 1.0, 0.999], + color, + uv, + ) +} + +fn atlas_material(preview: &mut StaticPreviewScene, page: RgbaImage) -> Result { + let material = append_environment_gradient_material(&mut preview.materials)?; + preview.materials[material].screen_tl = true; + preview.materials[material].sky_far_depth = false; + preview.materials[material].texture = VulkanStaticTexture { + width: page.width, + height: page.height, + rgba8: page.rgba8, + mip_levels: Vec::new(), + }; + Ok(material) +} + +fn append_range( + preview: &mut StaticPreviewScene, + material: usize, + vertex_count: usize, + indices: Vec, +) -> Result { + append_environment_range( + &mut preview.mesh, + material, + vec![environment_vertex([0.0; 3], [1.0; 3], [0.0; 2]); vertex_count], + indices, + world_pipeline_state(LegacyBlendMode::SourceAlpha, LegacyDepthMode::Disabled), + ) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn bezel_halves_meet_at_the_native_atlas_seam() { + let vertices = bezel_vertices(); + // Top corners in the 800×600 TL quads of the running original. + for (index, x, texel_x) in [ + (2, 276.25, 255.0), + (3, 400.0, 156.5), + (6, 400.0, 155.5), + (7, 526.25, 255.0), + ] { + let vertex = vertices[index]; + assert!(((vertex.position[0] + 1.0) * 400.0 - x).abs() < 0.001); + assert!(((vertex.position[1] + 1.0) * 300.0 - 408.75).abs() < 0.001); + assert_eq!(vertex.uv, [texel_x / 256.0, 0.5 / 256.0]); + } + } +} diff --git a/apps/fparkan-game/src/cockpit_radar_hud.rs b/apps/fparkan-game/src/cockpit_radar_hud.rs index 178715ed..53161ec2 100644 --- a/apps/fparkan-game/src/cockpit_radar_hud.rs +++ b/apps/fparkan-game/src/cockpit_radar_hud.rs @@ -1,18 +1,27 @@ use super::{ append_environment_gradient_material, append_environment_range, environment_vertex, - quad_indices, screen_tl_quad_vertices_pixels, world_pipeline_state, LegacyBlendMode, - LegacyDepthMode, StaticPreviewScene, VulkanDynamicDrawRange, VulkanStaticMesh, + quad_indices, screen_tl_quad_vertices_pixels, world_pipeline_state, DirectoryVfs, + EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, StaticPreviewScene, + VulkanDynamicDrawRange, VulkanSmokeRenderer, VulkanStaticMesh, VulkanStaticTexture, }; +use fparkan_assets::game_font::{load_layout_font, BitmapFont}; use fparkan_render::cockpit_radar::{contact_pixel, mark_rectangles}; use fparkan_runtime::{radar::cockpit_contacts, Engine, StartingCockpit}; use fparkan_world::ObjectHandle; +use std::path::Path; + +const LABEL_SIZE: [u32; 2] = [37, 11]; pub(super) struct CockpitRadarHud { - pub(super) range_index: usize, + contacts: usize, + label: EnvironmentGpuRange, + font: BitmapFont, + previous_reading: Option, } impl CockpitRadarHud { - pub(super) fn load(preview: &mut StaticPreviewScene) -> Result { + pub(super) fn load(root: &Path, preview: &mut StaticPreviewScene) -> Result { + let font = load_layout_font(&DirectoryVfs::new(root))?; let material = append_environment_gradient_material(&mut preview.materials)?; preview.materials[material].screen_tl = true; preview.materials[material].sky_far_depth = false; @@ -23,11 +32,79 @@ impl CockpitRadarHud { vec![0, 1, 2], world_pipeline_state(LegacyBlendMode::SourceAlpha, LegacyDepthMode::Disabled), )?; + let label_material = append_environment_gradient_material(&mut preview.materials)?; + let label = &mut preview.materials[label_material]; + label.screen_tl = true; + label.sky_far_depth = false; + let [width, height] = LABEL_SIZE; + label.texture = VulkanStaticTexture { + width, + height, + rgba8: vec![0; (width * height * 4) as usize], + mip_levels: Vec::new(), + }; + // iron3d+0x40a24 centers the range in [303, 340), starting at y=467. + let vertices = screen_tl_quad_vertices_pixels( + [303.0 + width as f32 / 2.0, 467.0 + height as f32 / 2.0], + width as f32 / 2.0, + height as f32 / 2.0, + [640.0, 480.0], + [0.0, 1.0, 0.0], + 1.0, + [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0]], + ); + let label = append_environment_range( + &mut preview.mesh, + label_material, + vertices.to_vec(), + quad_indices(1)?, + world_pipeline_state(LegacyBlendMode::SourceAlpha, LegacyDepthMode::Disabled), + )?; Ok(Self { - range_index: range.range_index, + contacts: range.range_index, + label, + font, + previous_reading: None, }) } + pub(super) fn ranges(&self) -> [usize; 2] { + [self.contacts, self.label.range_index] + } + + pub(super) fn draw_readout( + &mut self, + renderer: &mut VulkanSmokeRenderer, + reading: Option, + ) -> Result<(), String> { + renderer + .set_draw_range_index_count( + self.label.range_index, + if reading.is_some() { 6 } else { 0 }, + ) + .map_err(|error| error.to_string())?; + if let Some(reading) = reading.filter(|&value| self.previous_reading != Some(value)) { + let [width, height] = LABEL_SIZE.map(|dimension| dimension as u16); + let image = self + .font + .centered_line(&reading.to_string(), width, height)?; + renderer + .update_material_texture( + self.label.material_index, + 0, + &VulkanStaticTexture { + width: image.width, + height: image.height, + rgba8: image.rgba8, + mip_levels: Vec::new(), + }, + ) + .map_err(|error| error.to_string())?; + self.previous_reading = Some(reading); + } + Ok(()) + } + pub(super) fn append_frame( &self, mesh: &mut VulkanStaticMesh, @@ -72,11 +149,11 @@ impl CockpitRadarHud { } let index_count = u32::try_from(mesh.indices.len() - first_index as usize) .map_err(|_| "radar index count exceeds u32")?; - let range = &mut mesh.draw_ranges[self.range_index]; + let range = &mut mesh.draw_ranges[self.contacts]; range.first_index = first_index; range.index_count = index_count; Ok(VulkanDynamicDrawRange { - range_index: self.range_index, + range_index: self.contacts, first_index, index_count, }) diff --git a/apps/fparkan-game/src/course_hud.rs b/apps/fparkan-game/src/course_hud.rs deleted file mode 100644 index 7e436271..00000000 --- a/apps/fparkan-game/src/course_hud.rs +++ /dev/null @@ -1,117 +0,0 @@ -use super::{ - append_environment_gradient_material, append_environment_range, environment_vertex, - world_pipeline_state, DirectoryVfs, EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, - StaticPreviewScene, VulkanSmokeRenderer, VulkanStaticMesh, VulkanStaticTexture, - VulkanStaticVertex, -}; -use fparkan_assets::{ui_sprite::load_ui_page, RgbaImage}; -use fparkan_render::cockpit_course::{bearing_markers, view_sector}; -use std::path::Path; - -const MARKER_UVS: [[f32; 2]; 4] = [ - [192.5 / 256.0, 154.5 / 256.0], - [192.5 / 256.0, 165.0 / 256.0], - [201.0 / 256.0, 154.5 / 256.0], - [201.0 / 256.0, 165.0 / 256.0], -]; -const FRONT: [f32; 3] = [10.0 / 255.0, 10.0 / 255.0, 225.0 / 255.0]; -const REAR: [f32; 3] = [225.0 / 255.0, 10.0 / 255.0, 10.0 / 255.0]; - -pub(super) struct CourseHud { - sector: EnvironmentGpuRange, - markers: EnvironmentGpuRange, -} - -impl CourseHud { - pub(super) fn load(root: &Path, preview: &mut StaticPreviewScene) -> Result { - let vfs = DirectoryVfs::new(root); - let sector_page = load_ui_page(&vfs, "page7")?; - let marker_page = load_ui_page(&vfs, "page6")?; - if [ - sector_page.width, - sector_page.height, - marker_page.width, - marker_page.height, - ] != [256; 4] - { - return Err("unexpected native course atlas dimensions".into()); - } - let sector = append_range(preview, sector_page, 3, vec![0, 1, 2])?; - let markers = append_range( - preview, - marker_page, - 8, - vec![0, 1, 2, 2, 1, 3, 4, 5, 6, 6, 5, 7], - )?; - Ok(Self { sector, markers }) - } - - pub(super) fn ranges(&self) -> [usize; 2] { - [self.sector.range_index, self.markers.range_index] - } - - pub(super) fn draw( - &self, - renderer: &mut VulkanSmokeRenderer, - mesh: &mut VulkanStaticMesh, - view: Option<([f32; 2], f32)>, - ) -> Result<(), String> { - for (range, count) in self.ranges().into_iter().zip([3, 12]) { - renderer - .set_draw_range_index_count(range, if view.is_some() { count } else { 0 }) - .map_err(|error| error.to_string())?; - } - let Some((forward, fov)) = view else { - return Ok(()); - }; - - let start = self.sector.vertex_start; - mesh.vertices[start..start + 3] - .copy_from_slice(&view_sector(fov).map(|(point, uv)| vertex(point, uv, [1.0; 3]))); - let start = self.markers.vertex_start; - for ((corners, color), vertices) in bearing_markers(forward) - .into_iter() - .zip([FRONT, REAR]) - .zip(mesh.vertices[start..start + 8].chunks_exact_mut(4)) - { - for ((point, uv), output) in corners.into_iter().zip(MARKER_UVS).zip(vertices) { - *output = vertex(point, uv, color); - } - } - Ok(()) - } -} - -fn vertex([x, y]: [f32; 2], uv: [f32; 2], color: [f32; 3]) -> VulkanStaticVertex { - // Scaling the design coordinates and the viewport by the same factors - // cancels out when converting the original TL positions to NDC. - environment_vertex( - [x * (2.0 / 640.0) - 1.0, y * (2.0 / 480.0) - 1.0, 0.999], - color, - uv, - ) -} - -fn append_range( - preview: &mut StaticPreviewScene, - page: RgbaImage, - vertex_count: usize, - indices: Vec, -) -> Result { - let material = append_environment_gradient_material(&mut preview.materials)?; - preview.materials[material].screen_tl = true; - preview.materials[material].sky_far_depth = false; - preview.materials[material].texture = VulkanStaticTexture { - width: page.width, - height: page.height, - rgba8: page.rgba8, - mip_levels: Vec::new(), - }; - append_environment_range( - &mut preview.mesh, - material, - vec![environment_vertex([0.0; 3], [1.0; 3], [0.0; 2]); vertex_count], - indices, - world_pipeline_state(LegacyBlendMode::SourceAlpha, LegacyDepthMode::Disabled), - ) -} diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 06be344c..bafc6051 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -7,11 +7,11 @@ use fparkan_runtime::initial_component_node_times as static_preview_node_times; mod altimeter_hud; mod camera_capture; mod chassis_animation; +mod cockpit_dial; mod cockpit_geometry; mod cockpit_radar_hud; #[cfg(windows)] mod control_effects; -mod course_hud; #[cfg(test)] use control_effects::advance_control_effect_instances; mod damage_visibility; diff --git a/apps/fparkan-game/src/mission_overlay.rs b/apps/fparkan-game/src/mission_overlay.rs index 66c0f837..7eec86b2 100644 --- a/apps/fparkan-game/src/mission_overlay.rs +++ b/apps/fparkan-game/src/mission_overlay.rs @@ -1,10 +1,12 @@ use super::{ - altimeter_hud::AltimeterHud, cockpit_radar_hud::CockpitRadarHud, course_hud::CourseHud, - horizontal_fov, satellite_map::SatelliteMap, StaticPreviewScene, StaticVulkanApp, + cockpit_dial::CockpitDial, cockpit_radar_hud::CockpitRadarHud, horizontal_fov, + satellite_map::SatelliteMap, StaticPreviewScene, StaticVulkanApp, }; #[cfg(windows)] use super::{mission_hints::MissionHints, weapon_hud::WeaponHud}; -use fparkan_runtime::{cockpit_altimeter::cockpit_altimeter, Engine, StartingCockpit}; +use fparkan_runtime::{ + cockpit_altimeter::cockpit_altimeter, radar::cockpit_range_readout, Engine, StartingCockpit, +}; use std::path::Path; /// Source-over composition for original sprite texels and their alpha masks. @@ -26,8 +28,7 @@ pub(super) fn source_over(pixel: &mut [u8], source: &[u8]) { #[derive(Default)] pub(super) struct MissionOverlay { pub(super) satellite_map: Option, - course: Option, - altimeter: Option, + dial: Option, pub(super) radar: Option, #[cfg(windows)] pub(super) hints: Option, @@ -47,24 +48,16 @@ impl MissionOverlay { return Self::default(); }; // The original draws the cockpit instruments before the satellite map. - let course = cockpit.and_then(|_| { - CourseHud::load(root, preview) - .map(Some) - .unwrap_or_else(|error| { - eprintln!("course_hud_unavailable reason={error}"); - None - }) - }); - let altimeter = cockpit.and_then(|_| { - AltimeterHud::load(root, preview) + let dial = cockpit.and_then(|_| { + CockpitDial::load(root, preview) .map(Some) .unwrap_or_else(|error| { - eprintln!("altimeter_unavailable reason={error}"); + eprintln!("cockpit_dial_unavailable reason={error}"); None }) }); let radar = cockpit.and_then(|_| { - CockpitRadarHud::load(preview) + CockpitRadarHud::load(root, preview) .map(Some) .unwrap_or_else(|error| { eprintln!("cockpit_radar_unavailable reason={error}"); @@ -94,8 +87,7 @@ impl MissionOverlay { }); Self { satellite_map, - course, - altimeter, + dial, radar, #[cfg(windows)] hints, @@ -120,14 +112,13 @@ impl MissionOverlay { remove(range, ranges, counts); } } - if let Some(altimeter) = &self.altimeter { - remove(altimeter.range_index(), ranges, counts); - } if let Some(radar) = &self.radar { - remove(radar.range_index, ranges, counts); + for range in radar.ranges() { + remove(range, ranges, counts); + } } - if let Some(course) = &self.course { - for range in course.ranges() { + if let Some(dial) = &self.dial { + for range in dial.ranges() { remove(range, ranges, counts); } } @@ -155,20 +146,21 @@ impl StaticVulkanApp { .map(|(engine, cockpit)| (engine, cockpit, self.boarding_target)); map.draw(renderer, &mut self.mesh, frame.viewport, player)?; } - if let Some(altimeter) = &mut self.overlay.altimeter { - let state = self - .mission_engine - .as_ref() - .zip(self.cockpit) - .and_then(|(engine, cockpit)| cockpit_altimeter(engine, cockpit)); - altimeter.draw(renderer, &mut self.mesh, frame.viewport, state)?; - } - if let Some(course) = &self.overlay.course { + let occupant = self.mission_engine.as_ref().zip(self.cockpit); + if let Some(dial) = &mut self.overlay.dial { let view = self.cockpit.map(|_| { let [x, y, _] = frame.camera.forward(); ([x, y], horizontal_fov(&frame.camera, frame.aspect)) }); - course.draw(renderer, &mut self.mesh, view)?; + let altitude = + occupant.and_then(|(engine, cockpit)| cockpit_altimeter(engine, cockpit)); + dial.draw(renderer, &mut self.mesh, frame.viewport, view, altitude)?; + } + if let Some(radar) = &mut self.overlay.radar { + radar.draw_readout( + renderer, + occupant.map(|(engine, cockpit)| cockpit_range_readout(engine, cockpit)), + )?; } #[cfg(windows)] if let Some(hints) = &mut self.overlay.hints { -- cgit v1.2.3