27 lines
713 B
Haskell
27 lines
713 B
Haskell
module Dodge.CullBox
|
|
( updateBounds
|
|
)
|
|
where
|
|
import Dodge.Data
|
|
import Dodge.Base.Window
|
|
import Geometry
|
|
import Dodge.Update.Camera
|
|
|
|
import Data.Maybe
|
|
import Control.Lens
|
|
|
|
findBoundDists :: Configuration -> World -> (Float,Float,Float,Float)
|
|
findBoundDists cfig w
|
|
| debugOn Bound_box_screen cfig = (hh,-hh,hw,-hw)
|
|
| otherwise = fromMaybe (0,0,0,0) $ farWallDistDirection (_cameraCenter w) w
|
|
where
|
|
hw = halfWidth cfig
|
|
hh = halfHeight cfig
|
|
|
|
updateBounds :: Configuration -> World -> World
|
|
updateBounds cfig w = w
|
|
& boundDist .~ bdists
|
|
& boundBox .~ map ( (+.+ _cameraCenter w) . rotateV (_cameraRot w) ) (rectNSWE n s w' e)
|
|
where
|
|
bdists@(n,s,e,w') = findBoundDists cfig w
|