aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/main.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 05:17:14 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 05:17:14 +0300
commitfbaf44e97a413e1705b1dfb011849e19d4b21fa5 (patch)
treea40d7f32a72ceae2a09080df01b99dfa6e6326c1 /apps/fparkan-game/src/main.rs
parent81eb7cd67af54780756a98475145a864b72cbee0 (diff)
downloadfparkan-fbaf44e97a413e1705b1dfb011849e19d4b21fa5.tar.xz
fparkan-fbaf44e97a413e1705b1dfb011849e19d4b21fa5.zip
fix(movement): drive tread material cycles from chassis travel
Bind animated tread batches to their individual hull displacements. Preserve the authored phase sequence and derive nominal cycle length from the Control speed, scale and MAT0 duration. Checked stock tracked models in the normal AutoDemo window with Vulkan validation clean. Signed travel, stop and respawn are covered by a unit test. Per-track turning and physical cycle length are approximate.
Diffstat (limited to 'apps/fparkan-game/src/main.rs')
-rw-r--r--apps/fparkan-game/src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs
index d0d6d2b8..ac63ed41 100644
--- a/apps/fparkan-game/src/main.rs
+++ b/apps/fparkan-game/src/main.rs
@@ -295,6 +295,7 @@ fn run(args: &[String]) -> Result<String, String> {
)?;
if !args.viewer {
chassis_animation::connect_walkers(&engine, &mut preview);
+ chassis_animation::connect_treads(&engine, &mut preview);
}
let terrain_materials_duration = terrain_materials_duration_started.elapsed();
// Atmosphere files are mission-local assets. Resolving them from the
@@ -4736,6 +4737,7 @@ struct StaticPreviewScene {
type16_present_ranges: HashSet<usize>,
materials: Vec<VulkanStaticMaterial>,
material_animations: Vec<MaterialAnimationBinding>,
+ tread_animations: Vec<chassis_animation::TreadMaterials>,
ambient_effect_slots: Vec<AmbientEffectGpuSlot>,
control_point_light_slots: Vec<ControlEffectSlot>,
control_sound_slots: Vec<ControlSoundSlot>,
@@ -8829,6 +8831,7 @@ fn static_preview_mesh_and_materials(
type16_present_ranges,
materials,
material_animations,
+ tread_animations: Vec::new(),
ambient_effect_slots,
control_point_light_slots,
control_sound_slots,
@@ -9963,6 +9966,7 @@ struct StaticVulkanApp {
type16_present_ranges: HashSet<usize>,
materials: Vec<VulkanStaticMaterial>,
material_animations: Vec<MaterialAnimationBinding>,
+ tread_animations: Vec<chassis_animation::TreadMaterials>,
ambient_effect_slots: Vec<AmbientEffectGpuSlot>,
control_point_light_slots: Vec<ControlEffectSlot>,
control_sound_slots: Vec<ControlSoundSlot>,
@@ -10104,6 +10108,7 @@ impl StaticVulkanApp {
type16_present_ranges: preview.type16_present_ranges,
materials: preview.materials,
material_animations: preview.material_animations,
+ tread_animations: preview.tread_animations,
ambient_effect_slots: preview.ambient_effect_slots,
control_point_light_slots: preview.control_point_light_slots,
control_sound_slots: preview.control_sound_slots,
@@ -11552,6 +11557,14 @@ impl StaticVulkanApp {
&self.ambient_effect_slots,
self.view_camera.position,
)?;
+ if let Some(frame) = &self.mission_frame {
+ chassis_animation::update_treads(
+ &mut self.tread_animations,
+ &mut self.material_animations,
+ &self.mission_render_roots,
+ &frame.snapshot,
+ );
+ }
let material_update = sample_material_animations(
&mut self.material_animations,
&self.materials,
@@ -16198,6 +16211,7 @@ mod tests {
type16_present_ranges: HashSet::new(),
materials,
material_animations: vec![material_animation],
+ tread_animations: Vec::new(),
ambient_effect_slots: Vec::new(),
control_point_light_slots: vec![control_slot],
control_sound_slots: Vec::new(),