Fix bug when forming convex hull of game room bounds

This commit is contained in:
2021-09-30 23:46:59 +01:00
parent cb23960bd7
commit 1414d08d88
14 changed files with 51 additions and 16 deletions
+9
View File
@@ -4,6 +4,7 @@ Functions controlling the movement of the screen camera:
and the position that the character sees from: '_cameraViewFrom'. -}
module Dodge.Update.Camera
( updateCamera
, farWallPoints
)
where
import Dodge.Data
@@ -176,6 +177,14 @@ farWallDist p w = (winFac /) . min maxViewDistance $ ssfold (> maxViewDistance)
grs = filter (pointInOrOnPolygon p . _grBound) (_gameRooms w)
wos = wallsOnScreen w
farWallPoints :: Point2 -> World -> [Point2]
farWallPoints p w = concatMap _grViewpoints grs ++ linkvps
where
grs = filter (pointInOrOnPolygon p . _grBound) (_gameRooms w)
linkvps = map extend (concatMap _grViewpointsEx grs)
extend :: Point2 -> Point2
extend outp = p +.+ maxViewDistance *.* safeNormalizeV (outp -.- p)
--farWallDist :: Point2 -> World -> Float
--farWallDist p w = (winFac /) $ fromMaybe maxViewDistance
-- $ L.fold (L.premap (dist p) L.maximum) vdists