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