diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 07:00:08 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 07:00:08 +0300 |
| commit | dcba82d1cdf4a70ab879d8af0a623a10deecb544 (patch) | |
| tree | 990640d51dc917b59baf0c02a7d7bdba12557cef /adapters/fparkan-render-vulkan/src/ffi/smoke.rs | |
| parent | 5be1b800d028ba30c5e2a4ff84983c700b4e9175 (diff) | |
| download | fparkan-dcba82d1cdf4a70ab879d8af0a623a10deecb544.tar.xz fparkan-dcba82d1cdf4a70ab879d8af0a623a10deecb544.zip | |
feat(factory): build newly loaded projects without restarting the mission
Transfer a saved design from the original designer panel, prepare it with the regular AniMesh scene builder, and queue the selected factory order. Appended world batches keep existing draw handles and gain the normal cockpit, walking animation, weapon and shield bindings.
The Field Camp window witness adds a one-gun Unit DAT after mission start, uses the normal transfer and order controls, supplies the factory with a scripted test fixture, and captures the released unit with Vulkan validation clean. The two licensed factory tests also verify the assembled component records and weapon control.
Diffstat (limited to 'adapters/fparkan-render-vulkan/src/ffi/smoke.rs')
| -rw-r--r-- | adapters/fparkan-render-vulkan/src/ffi/smoke.rs | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs index 2111e6ff..97deb2f1 100644 --- a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs +++ b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs @@ -25,6 +25,8 @@ use crate::shader::validate_triangle_shaders; #[path = "preview_mesh.rs"] mod preview_mesh; +#[path = "scene_append.rs"] +mod scene_append; use preview_mesh::preview_rect; #[cfg(test)] @@ -417,6 +419,7 @@ impl VulkanSmokeRenderer { draw_order: (0..create_info.mesh.draw_ranges.len()).collect(), draw_range_sort_keys: vec![None; create_info.mesh.draw_ranges.len()], draw_order_dirty: false, + scene_append_order: None, draw_range_world_queue: vec![None; create_info.mesh.draw_ranges.len()], draw_range_diffuse_alpha_overrides: vec![None; create_info.mesh.draw_ranges.len()], world_transparent_background_ranges: Vec::new(), @@ -1850,27 +1853,6 @@ impl VulkanSmokeRenderer { Ok(()) } - /// Recomputes the stable command-recording order. Without explicit - /// backgrounds, opaque world ranges followed by the sorted transparent - /// world ranges replace the existing world slots. With explicit - /// backgrounds, opaque ranges compact into the world slots and sorted - /// transparent ranges are inserted after the last background; unrelated - /// fixed ranges keep relative order but may shift slots. The transparent - /// queue matches the native descending key comparator. - fn rebuild_draw_order(&mut self) { - let range_count = self.draw_ranges.len(); - if self.draw_order.len() != range_count { - self.draw_order = (0..range_count).collect(); - } - self.draw_order = sorted_world_draw_order( - range_count, - &self.draw_ranges, - &self.draw_range_world_queue, - &self.draw_range_sort_keys, - &self.world_transparent_background_ranges, - ); - } - fn record_command_buffer( &mut self, image_index: usize, @@ -2833,16 +2815,15 @@ fn world_material_pipeline_states( /// after the last active background; fixed passes keep their relative order but /// can shift slots. Zero-index-count ranges are inactive and are omitted. fn sorted_world_draw_order( - range_count: usize, + mut next: Vec<usize>, ranges: &[super::VulkanStaticDrawRange], world_queue: &[Option<bool>], keys: &[Option<f32>], transparent_background_ranges: &[usize], ) -> Vec<usize> { - let mut next = (0..range_count).collect::<Vec<_>>(); let mut world_opaque = Vec::new(); let mut world_transparent = Vec::new(); - for range_index in 0..range_count { + for &range_index in &next { if ranges .get(range_index) .is_none_or(|range| range.index_count == 0) @@ -2919,8 +2900,8 @@ fn sorted_world_draw_order( // transparent slots, compact opaque ranges into the world slots, then // insert the sorted transparent queue after the explicit background group. let mut opaque_cursor = 0usize; - let mut next_without_transparency = Vec::with_capacity(range_count); - for slot in 0..range_count { + let mut next_without_transparency = Vec::with_capacity(next.len()); + for slot in next { let active_world = ranges.get(slot).is_some_and(|range| range.index_count != 0); match world_queue.get(slot).copied().flatten() { Some(true) if active_world => {} @@ -3460,7 +3441,7 @@ mod tests { }) .collect::<Vec<_>>(); let order = sorted_world_draw_order( - 5, + (0..5).collect(), &ranges, &[None, Some(true), None, Some(true), Some(false)], &[None, Some(2.0), None, Some(9.0), Some(-3.0)], @@ -3469,7 +3450,7 @@ mod tests { assert_eq!(order, vec![0, 4, 2, 3, 1]); let order = sorted_world_draw_order( - 5, + (0..5).collect(), &ranges, &[Some(true), Some(false), None, None, None], &[Some(2.0), None, None, None, None], @@ -3523,7 +3504,7 @@ mod tests { }, ]; let order = sorted_world_draw_order( - 3, + (0..3).collect(), &ranges, &[None, Some(true), Some(true)], &[None, Some(100.0), Some(1.0)], @@ -3549,7 +3530,13 @@ mod tests { alpha_test_reference: 0, }) .collect::<Vec<_>>(); - let order = sorted_world_draw_order(4, &ranges, &[Some(true); 4], &[Some(1.0); 4], &[]); + let order = sorted_world_draw_order( + (0..4).collect(), + &ranges, + &[Some(true); 4], + &[Some(1.0); 4], + &[], + ); assert_eq!(order, vec![2, 3, 1, 0]); } @@ -3654,7 +3641,7 @@ mod tests { sort_keys[CANOPY_NEAR] = Some(2.0); sort_keys[CANOPY_FAR] = Some(9.0); let order = sorted_world_draw_order( - ranges.len(), + (0..ranges.len()).collect(), &ranges, &world_queue, &sort_keys, @@ -3717,7 +3704,7 @@ mod tests { sort_keys[EMPTY_CONTROL_FX] = Some(30.0); let order = sorted_world_draw_order( - ranges.len(), + (0..ranges.len()).collect(), &ranges, &world_queue, &sort_keys, |
