More cleverly set maximum view distance for rectangular window sizes

This commit is contained in:
2022-06-26 11:30:02 +01:00
parent 15b98e38ac
commit 6c571d1878
7 changed files with 27 additions and 28 deletions
+14 -8
View File
@@ -1,6 +1,8 @@
module Dodge.CullBox
(cullBox
) where
( cullBox
, findBoundDists
)
where
import Dodge.Data
--import Dodge.GameRoom
import Dodge.Base.Window
@@ -11,6 +13,16 @@ import Dodge.Update.Camera
--import Data.Maybe (mapMaybe)
findBoundDists :: Configuration -> World -> (Float,Float,Float,Float)
findBoundDists cfig w
| debugOn Bound_box_screen cfig = (hh,-hh,hw,-hw)
| otherwise = f $ farWallDistDirection (_cameraCenter w) w
where
f (Just a,Just b,Just c,Just d) = (max 0 a,min 0 b,max 0 c,min 0 d)
f _ = (0,0,0,0)
hw = halfWidth cfig
hh = halfHeight cfig
cullBox :: Configuration -> World -> [Point2]
--cullBox cfig w = farWallPoints cp w
cullBox cfig w'
@@ -20,9 +32,3 @@ cullBox cfig w'
where
f (Just a,Just b,Just c,Just d) = (max 0 a,min 0 b,max 0 c,min 0 d)
f _ = (0,0,0,0)
-- --mapMaybe (fmap (fst . _wlLine . snd) . f) $ screenPolygon cfig w
-- where
-- grs = filter (pointInOrOnPolygon cp . _grBound) (_gameRooms w)
-- cp = _cameraCenter w
-- f p = collidePointWallsWall cp p $ wallsAlongLine cp p w
--