From 44c87fe76630c979ad1c900b65821c28abafbcdc Mon Sep 17 00:00:00 2001 From: nek0 Date: Tue, 17 Dec 2024 15:42:14 +0100 Subject: [PATCH] fix graphics --- src-client/Client/Graphics.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src-client/Client/Graphics.hs b/src-client/Client/Graphics.hs index 69904f9..1ea21c2 100644 --- a/src-client/Client/Graphics.hs +++ b/src-client/Client/Graphics.hs @@ -101,10 +101,11 @@ castRay wizard (row, col) (x, y) (width, height) = tMaxRow = min dMaxRow (recip 0) tMin = max 0 $ max dMinCol dMinRow tMax = min (recip 0) $ min dMaxCol dMaxRow + vec = (tMin *) <$> direction in if tMin < tMax then - let result = sqrt (quadrance ((tMin *) <$> direction)) * abs ((- vFOV) / 2 + y * vFOV / height) + let result = sqrt (vec `dot` vec) / cos ((- vFOV) / 2 + y * vFOV / height) -- in trace ("ray length: " <> show result) result -- in trace ("vector: " <> show (sqrt $ quadrance $ (tMin *) <$> direction)) result -- in trace ("wStep: " <> show wStep) result