Files
airdef/horizon-patches/0004-Mod-models-draw-far-models-as-scaled-impostors-past-.patch
T
2026-10-30 15:43:11 +03:00

49 lines
2.0 KiB
Diff

From 2b137dbbedd540daeebc7f5e387847aeb56a1355 Mon Sep 17 00:00:00 2001
From: chexit <chexit@duck.com>
Date: Wed, 28 Oct 2026 22:09:30 +0300
Subject: [PATCH 04/36] Mod models: draw far models as scaled impostors past
the far plane, cull at 4096
---
crates/horizon-client/src/game/mod_models.rs | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/crates/horizon-client/src/game/mod_models.rs b/crates/horizon-client/src/game/mod_models.rs
index be00ea4c7..6cd55afc6 100644
--- a/crates/horizon-client/src/game/mod_models.rs
+++ b/crates/horizon-client/src/game/mod_models.rs
@@ -120,14 +120,26 @@ impl Game<'_> {
return;
}
let t = alpha.clamp(0.0, 1.0);
+ // Missiles are seen from far off: past the far plane a model is drawn nearer and
+ // smaller, the same size on screen.
+ let depth_far = f64::from(horizon_client::camera::depth_far(
+ self.terrain_distance(),
+ self.settings.cloud_range,
+ ));
+ let reach = depth_far * 0.85;
for p in self.mods.models.poses.values() {
- let at = p.previous.lerp(p.position, t);
- // Far models are culled by distance; the view frustum does the rest.
- if at.distance_squared(camera) > 512.0 * 512.0 {
+ let mut at = p.previous.lerp(p.position, t);
+ let d = at.distance(camera);
+ if d > 4096.0 {
continue;
}
+ let mut shrink = 1.0f32;
+ if d > reach {
+ shrink = (reach / d) as f32;
+ at = camera + (at - camera) * (reach / d);
+ }
let rotation = p.old_rotation.slerp(p.rotation, t as f32);
- let scale = p.old_scale + (p.scale - p.old_scale) * t as f32;
+ let scale = (p.old_scale + (p.scale - p.old_scale) * t as f32) * shrink;
if scale <= 0.0 {
continue;
}
--
2.54.0 (Apple Git-157)