mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 21:12:03 +00:00
perf(hud): stop flight instruments redrawing when values have settled
hud_gauge, hud_attitude_indicator, and hud_heading_tape now skip queue_redraw() when the newly-lerped value hasn't moved past a small epsilon, instead of redrawing every frame forever. Angle-wrapping values (heading, attitude roll) use a new shared angle_delta_deg helper on HudInstrument so the wrap boundary doesn't read as a false jump. HUD.tscn's Instruments node now sets process_mode = 1 (PAUSABLE), overriding the inherited ALWAYS mode from the HUD root so instruments stop processing during the post-match pause freeze, while sibling ResultOverlay keeps running its win-screen tween.
This commit is contained in:
@@ -13,5 +13,13 @@ static func lerp_angle_deg(from: float, to: float, weight: float) -> float:
|
||||
return rad_to_deg(lerp_angle(deg_to_rad(from), deg_to_rad(to), weight))
|
||||
|
||||
|
||||
# Shortest signed distance from `from` to `to` in degrees, wrapped to
|
||||
# [-180, 180]. Use this (never a plain subtraction) to decide whether an
|
||||
# angle that wraps around (heading, roll) has moved enough to redraw —
|
||||
# a naive delta gives a false-large jump at the 0/360 boundary.
|
||||
static func angle_delta_deg(from: float, to: float) -> float:
|
||||
return wrapf(to - from, -180.0, 180.0)
|
||||
|
||||
|
||||
func _smoothing_weight(delta: float) -> float:
|
||||
return 1.0 - exp(-SMOOTHING * delta) # frame-rate independent
|
||||
|
||||
Reference in New Issue
Block a user