aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/destruction_effects.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 08:42:38 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 08:42:38 +0300
commit2f75b9792c98c4d32b0349810080dd226357b505 (patch)
treea49b82684c095bf2b54523262cdf3edf4b3ce824 /apps/fparkan-game/src/destruction_effects.rs
parent5844c9b0f4216da47cf03894b34f9a150fd5b170 (diff)
downloadfparkan-2f75b9792c98c4d32b0349810080dd226357b505.tar.xz
fparkan-2f75b9792c98c4d32b0349810080dd226357b505.zip
feat(render): throw detached chassis nodes as fragments
Pass the depleted node to an authored Op10 with a built-in mesh request. Reuse its existing draw ranges for the flight and keep the hull alive. The fixed-camera fixture shows the heavy track section separate and rotate after impact.
Diffstat (limited to 'apps/fparkan-game/src/destruction_effects.rs')
-rw-r--r--apps/fparkan-game/src/destruction_effects.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/fparkan-game/src/destruction_effects.rs b/apps/fparkan-game/src/destruction_effects.rs
index 97f7436a..5f05e2f9 100644
--- a/apps/fparkan-game/src/destruction_effects.rs
+++ b/apps/fparkan-game/src/destruction_effects.rs
@@ -13,7 +13,9 @@ use fparkan_fx::{
FxCommand, FxOpcode,
};
use fparkan_render_vulkan::{VulkanPointLight, VulkanStaticMesh};
-use fparkan_runtime::{unit_destruction_effect_sources, Engine, UnitDestructionEffect};
+use fparkan_runtime::{
+ unit_destruction_effect_sources, DestroyedMesh, Engine, UnitDestructionEffect,
+};
use std::{
collections::{BTreeMap, HashMap, HashSet},
path::{Path, PathBuf},
@@ -44,7 +46,7 @@ mod tests {
let position = [23.0, 45.0, 10.0];
effects.start(
vec![UnitDestructionEffect {
- object_index: None,
+ mesh: None,
position,
archive: "system.rlb".into(),
name: "explode_rbr_b.exp".into(),
@@ -244,10 +246,10 @@ impl DestructionEffects {
events: Vec<UnitDestructionEffect>,
now: u32,
mut audio: Option<&mut GameAudio>,
- mut capture_fragments: impl FnMut(usize, [f32; 3]) -> Vec<MeshFragment>,
+ mut capture_fragments: impl FnMut(DestroyedMesh, [f32; 3]) -> Vec<MeshFragment>,
) {
for UnitDestructionEffect {
- object_index,
+ mesh,
position,
archive,
name,
@@ -291,9 +293,9 @@ impl DestructionEffects {
effect: Arc::clone(effect),
clock,
position,
- fragments: object_index
+ fragments: mesh
.filter(|_| effect.fragments)
- .map_or_else(Vec::new, |index| capture_fragments(index, position)),
+ .map_or_else(Vec::new, |geometry| capture_fragments(geometry, position)),
});
}
}