diff --git a/cimery/crates/viewer/src/bridge_scene.rs b/cimery/crates/viewer/src/bridge_scene.rs index d58d2d7..ba0c8c5 100644 --- a/cimery/crates/viewer/src/bridge_scene.rs +++ b/cimery/crates/viewer/src/bridge_scene.rs @@ -71,22 +71,22 @@ fn merge(meshes: Vec) -> Mesh { /// Build a complete bridge scene mesh using the provided kernel and parameters. pub fn build_bridge_scene(kernel: &K, p: &SceneParams) -> Result { - let SPAN_M = p.span_m; - let SPAN_MM = (p.span_m * 1_000.0) as f32; - let N_GIRDERS = p.girder_count.max(1).min(10); - let SPACING = p.girder_spacing; - let GIRDER_H = p.girder_height; + let span_m = p.span_m; + let span_mm = (p.span_m * 1_000.0) as f32; + let n_girders = p.girder_count.max(1).min(10); + let spacing = p.girder_spacing; + let girder_h = p.girder_height; const BEARING_H: f32 = 60.0; // mm let mut parts: Vec = Vec::new(); // ── Girders ──────────────────────────────────────────────────────────────── - for i in 0..N_GIRDERS { - let x = (i as f32 - (N_GIRDERS as f32 - 1.0) * 0.5) * SPACING; + for i in 0..n_girders { + let x = (i as f32 - (n_girders as f32 - 1.0) * 0.5) * spacing; let ir = GirderIR { id: FeatureId::new(), station_start: 0.0, - station_end: SPAN_M, + station_end: span_m, offset_from_alignment: x as f64, section_type: SectionType::PscI, section: SectionParams::PscI(PscISectionParams::kds_standard()), @@ -101,11 +101,11 @@ pub fn build_bridge_scene(kernel: &K, p: &SceneParams) -> Result< // ── Deck Slab ────────────────────────────────────────────────────────────── // KDS: min 220 mm, width = (N-1)*spacing + 2 × cantilever - let half_width = ((N_GIRDERS as f32 - 1.0) * SPACING) * 0.5 + 1_000.0; // 1 m cantilever + let half_width = ((n_girders as f32 - 1.0) * spacing) * 0.5 + 1_000.0; // 1 m cantilever let deck_ir = DeckSlabIR { id: FeatureId::new(), station_start: 0.0, - station_end: SPAN_M, + station_end: span_m, width_left: half_width as f64, width_right: half_width as f64, thickness: p.slab_thickness as f64, @@ -115,16 +115,16 @@ pub fn build_bridge_scene(kernel: &K, p: &SceneParams) -> Result< }; let mut deck_mesh = kernel.deck_slab_mesh(&deck_ir)?; deck_mesh.recolor(COL_DECK); - parts.push(translate(deck_mesh, 0.0, GIRDER_H + p.slab_thickness, 0.0)); + parts.push(translate(deck_mesh, 0.0, girder_h + p.slab_thickness, 0.0)); // ── Bearings ─────────────────────────────────────────────────────────────── // 5 per abutment, one under each girder - for &z in &[0.0_f32, SPAN_MM] { - for i in 0..N_GIRDERS { - let x = (i as f32 - (N_GIRDERS as f32 - 1.0) * 0.5) * SPACING; + for &z in &[0.0_f32, span_mm] { + for i in 0..n_girders { + let x = (i as f32 - (n_girders as f32 - 1.0) * 0.5) * spacing; let bearing_ir = BearingIR { id: FeatureId::new(), - station: if z < 1.0 { 0.0 } else { SPAN_M }, + station: if z < 1.0 { 0.0 } else { span_m }, bearing_type: BearingType::Elastomeric, plan_length: 350.0, plan_width: 450.0, @@ -139,10 +139,10 @@ pub fn build_bridge_scene(kernel: &K, p: &SceneParams) -> Result< // ── Abutments ────────────────────────────────────────────────────────────── let wing = WingWallIR { length: 5_000.0, height: 2_500.0, thickness: 500.0 }; - let total_w = (N_GIRDERS as f64 - 1.0) * SPACING as f64 + 3_000.0; - let breast_wall_h = (GIRDER_H + BEARING_H) as f64; + let total_w = (n_girders as f64 - 1.0) * spacing as f64 + 3_000.0; + let breast_wall_h = (girder_h + BEARING_H) as f64; - for &(station, z) in &[(0.0f64, -800.0_f32), (SPAN_M, SPAN_MM)] { + for &(station, z) in &[(0.0f64, -800.0_f32), (span_m, span_mm)] { let abut_ir = AbutmentIR { id: FeatureId::new(), station, diff --git a/cimery/crates/viewer/src/lib.rs b/cimery/crates/viewer/src/lib.rs index 378fadb..117229a 100644 --- a/cimery/crates/viewer/src/lib.rs +++ b/cimery/crates/viewer/src/lib.rs @@ -284,8 +284,9 @@ impl RenderState { &*window, None, None, None, ); + // egui renders 2D UI overlay — no depth buffer let egui_renderer = egui_wgpu::Renderer::new( - &device, format, Some(DEPTH_FORMAT), 1, false, + &device, format, None, 1, false, ); RenderState {