From 6fa7cdaf0a4fab44d51d348e00e1863c20c52412 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 29 Sep 2022 14:26:53 +0200 Subject: [PATCH] ads-game:: fixed the precision issues casuing weird display in dS --- rogueviz/ads/ds-game.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rogueviz/ads/ds-game.cpp b/rogueviz/ads/ds-game.cpp index 81783d09..f27c644c 100644 --- a/rogueviz/ads/ds-game.cpp +++ b/rogueviz/ads/ds-game.cpp @@ -209,7 +209,7 @@ struct rock_generator { rock_generator rockgen, rsrcgen; -auto future_shown = 2 * TAU; +auto future_shown = 5 * TAU; void init_ds_game() { @@ -462,12 +462,16 @@ void view_ds_game() { if(rock.at.shift < current.shift - future_shown) continue; if(rock.at.shift > current.shift + future_shown) continue; - + if(1) { dynamicval g(geometry, gSpace435); transmatrix at = current.T * lorentz(2, 3, rock.at.shift - current.shift) * rock.at.T; rock.pt_main = ds_cross0(at); + // sometimes the result may be incorrect due to numerical precision -- don't show that then in this case + ld val = sqhypot_d(3, rock.pt_main.h); + if(abs(val-1) > 1e-3 || isnan(val) || abs(rock.pt_main.h[3]) > 1e-3 || isnan(rock.pt_main.h[3])) continue; + if(rock.pt_main.shift < rock.life_start) continue; if(rock.pt_main.shift > rock.life_end) continue;