Refactor, try to limit dependencies
This commit is contained in:
+16
-16
@@ -1,28 +1,28 @@
|
||||
module Dodge.CullBox
|
||||
( updateBounds
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Base.Window
|
||||
import Geometry
|
||||
import Dodge.Update.Camera
|
||||
module Dodge.CullBox (
|
||||
updateBounds,
|
||||
) where
|
||||
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Update.Camera
|
||||
import Geometry
|
||||
|
||||
findBoundDists :: Configuration -> World -> (Float,Float,Float,Float)
|
||||
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 (_cWorld w)) w
|
||||
| debugOn Bound_box_screen cfig = (hh, - hh, hw, - hw)
|
||||
| otherwise = fromMaybe (0, 0, 0, 0) $ farWallDistDirection (_cameraCenter (_cWorld w)) w
|
||||
where
|
||||
hw = halfWidth cfig
|
||||
hh = halfHeight cfig
|
||||
|
||||
updateBounds :: Universe -> Universe
|
||||
updateBounds uv = uv
|
||||
& uvWorld . cWorld . boundDist .~ bdists
|
||||
& uvWorld . cWorld . boundBox .~ map ( (+.+ _cameraCenter (_cWorld w)) . rotateV (_cameraRot (_cWorld w)) ) (rectNSWE n s w' e)
|
||||
updateBounds uv =
|
||||
uv
|
||||
& uvWorld . cWorld . boundDist .~ bdists
|
||||
& uvWorld . cWorld . boundBox .~ map ((+.+ _cameraCenter (_cWorld w)) . rotateV (_cameraRot (_cWorld w))) (rectNSWE n s w' e)
|
||||
where
|
||||
w = _uvWorld uv
|
||||
cfig = _uvConfig uv
|
||||
bdists@(n,s,e,w') = findBoundDists cfig w
|
||||
bdists@(n, s, e, w') = findBoundDists cfig w
|
||||
|
||||
Reference in New Issue
Block a user