More cleverly set maximum view distance for rectangular window sizes
This commit is contained in:
+14
-8
@@ -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
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user