fix graphics

This commit is contained in:
nek0 2024-12-17 15:42:14 +01:00
parent 63c76389f0
commit 44c87fe766

View file

@ -101,10 +101,11 @@ castRay wizard (row, col) (x, y) (width, height) =
tMaxRow = min dMaxRow (recip 0) tMaxRow = min dMaxRow (recip 0)
tMin = max 0 $ max dMinCol dMinRow tMin = max 0 $ max dMinCol dMinRow
tMax = min (recip 0) $ min dMaxCol dMaxRow tMax = min (recip 0) $ min dMaxCol dMaxRow
vec = (tMin *) <$> direction
in in
if tMin < tMax if tMin < tMax
then 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 ("ray length: " <> show result) result
-- in trace ("vector: " <> show (sqrt $ quadrance $ (tMin *) <$> direction)) result -- in trace ("vector: " <> show (sqrt $ quadrance $ (tMin *) <$> direction)) result
-- in trace ("wStep: " <> show wStep) result -- in trace ("wStep: " <> show wStep) result