fix graphics
This commit is contained in:
parent
63c76389f0
commit
44c87fe766
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue