From d9c820ea27ed23a9587453f1410735764e673035 Mon Sep 17 00:00:00 2001 From: chairmanpow Date: Sat, 3 Oct 2026 17:41:40 +0100 Subject: [PATCH] anim lod: a far on-screen rig parks, so a city crowd costs no per-bone work `animLodDistance` (0..=300 yd, default 60, `0` off) adds a distance leg to the animation-LOD gate: a rig past it parks its pose evaluation even when it is in frame and in a PVS-visible room, joining the frustum and room legs. The gate reads the world camera's `GlobalTransform` for the position. `0` restores the shipped frustum-and-room-only behaviour. --- crates/benilla-app/src/creature_anim/lod.rs | 73 +++++++++++++++++---- crates/benilla-app/src/cvars.rs | 5 ++ crates/benilla-app/src/video.rs | 19 ++++++ 3 files changed, 83 insertions(+), 14 deletions(-) diff --git a/crates/benilla-app/src/creature_anim/lod.rs b/crates/benilla-app/src/creature_anim/lod.rs index c374c9d1..6e595f60 100644 --- a/crates/benilla-app/src/creature_anim/lod.rs +++ b/crates/benilla-app/src/creature_anim/lod.rs @@ -1,6 +1,6 @@ -//! The animation-LOD gate: a rig off the frustum, or in a room the portal PVS does not reach, -//! parks its pose evaluation ([`AnimParked`]) while its clocks run on; every [`RigPose`] is -//! covered, GameObject rigs included. The reference elects every scene object each frame +//! The animation-LOD gate: a rig off the frustum, past `animLodDistance` yards, or in a room the +//! portal PVS does not reach, parks its pose evaluation ([`AnimParked`]) while its clocks run on; +//! every [`RigPose`] is covered, GameObject rigs included. The reference elects every scene object each frame //! (`0x683dd0`): a pass-2 unit is neither drawn, animated nor event-ticked, except a //! `MORE_AUDIBLE` creature, re-linked for the tick (`0x607da0`). So a parked rig fires no event //! keys unless flagged, and wakes to the pose its absolute clock dictates (`0x714260` samples the @@ -38,14 +38,16 @@ const RADIUS_SCALE: f32 = 2.0; const RADIUS_PAD: f32 = 4.0; const FALLBACK_RADIUS: f32 = 6.0; -/// Park or wake each rig by its padded frustum sphere and its room, before [`AnimationSystems`] so -/// a wake samples the same frame. The body we drive and its mount never park: the camera rides its -/// attachment 17 and it animates faded out in first person. `WOW_NO_ANIM_LOD=1` never parks and -/// `WOW_NO_ROOM_LOD=1` drops the room leg. +/// Park or wake each rig by its padded frustum sphere, its distance from the camera and its room, +/// before [`AnimationSystems`] so a wake samples the same frame. The body we drive and its mount +/// never park: the camera rides its attachment 17 and it animates faded out in first person. +/// `WOW_NO_ANIM_LOD=1` never parks, `WOW_NO_ROOM_LOD=1` drops the room leg and `animLodDistance 0` +/// drops the distance leg. #[allow(clippy::type_complexity)] // one Bevy system's full input set pub(super) fn gate_rig_animation( time: Res