Refactor, try to limit dependencies
This commit is contained in:
+26
-23
@@ -1,29 +1,32 @@
|
||||
module Dodge.Render.Walls
|
||||
( wallsToDraw
|
||||
) where
|
||||
import Dodge.Zoning.World
|
||||
module Dodge.Render.Walls (
|
||||
wallsToDraw,
|
||||
) where
|
||||
|
||||
import qualified Control.Foldl as L
|
||||
import Control.Lens
|
||||
import Dodge.Base.Wall
|
||||
import Dodge.Data.World
|
||||
import Dodge.Wall.Draw
|
||||
import Dodge.Zoning.Base
|
||||
import Dodge.Zoning.Wall
|
||||
import Dodge.Data
|
||||
import Dodge.Wall.Draw
|
||||
import Dodge.Base.Wall
|
||||
import Dodge.Zoning.World
|
||||
import Geometry
|
||||
import ShapePicture
|
||||
|
||||
import Control.Lens
|
||||
--import Data.Maybe
|
||||
import qualified Control.Foldl as L
|
||||
wallsToDraw :: World -> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)], SPic )
|
||||
wallsToDraw w
|
||||
= ( wls, wins,spic)
|
||||
wallsToDraw :: World -> ([((Point2, Point2), Point4)], [((Point2, Point2), Point4)], SPic)
|
||||
wallsToDraw w =
|
||||
(wls, wins, spic)
|
||||
where
|
||||
f wl = (_wlLine wl, _wlColor wl)
|
||||
(wls, wins, spic) = L.fold
|
||||
((,,)
|
||||
<$> L.prefilter wlOpaqueDraw (L.premap f L.list)
|
||||
<*> L.prefilter wlSeeThroughDraw (L.premap f L.list)
|
||||
<*> L.premap getWallSPic L.mconcat
|
||||
) (wlsFromIXs w $ zonesExtract (w ^. cWorld . wlZoning) $ zoneOfSight' wlZoneSize w)
|
||||
(wls, wins, spic) =
|
||||
L.fold
|
||||
( (,,)
|
||||
<$> L.prefilter wlOpaqueDraw (L.premap f L.list)
|
||||
<*> L.prefilter wlSeeThroughDraw (L.premap f L.list)
|
||||
<*> L.premap getWallSPic L.mconcat
|
||||
)
|
||||
(wlsFromIXs w $ zonesExtract (w ^. cWorld . wlZoning) $ zoneOfSight' wlZoneSize w)
|
||||
|
||||
--wallsToDraw
|
||||
-- :: World
|
||||
-- -> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)], SPic )
|
||||
@@ -31,26 +34,26 @@ wallsToDraw w
|
||||
-- = ( wls, wins,spic)
|
||||
-- where
|
||||
-- f wl = (_wlLine wl, _wlColor wl)
|
||||
-- (wls, wins, spic) = runIdentity $ L.purely S.fold_
|
||||
-- (wls, wins, spic) = runIdentity $ L.purely S.fold_
|
||||
-- ((,,)
|
||||
-- <$> L.prefilter wlOpaqueDraw (L.premap f L.list)
|
||||
-- <*> L.prefilter wlSeeThroughDraw (L.premap f L.list)
|
||||
-- <*> L.premap getWallSPic L.mconcat
|
||||
-- ) (S.concat $ S.mapMaybe g $ zoneOfSight wlZoneSize w)
|
||||
-- g (V2 i j) = w ^? wlZoning . znObjects . ix i . ix j
|
||||
|
||||
|
||||
wlOpaqueDraw :: Wall -> Bool
|
||||
wlOpaqueDraw wl = wlIsOpaque wl && _wlHeight wl == 100
|
||||
|
||||
wlSeeThroughDraw :: Wall -> Bool
|
||||
wlSeeThroughDraw wl = wlIsSeeThrough wl && _wlHeight wl == 100
|
||||
|
||||
getWallSPic :: Wall -> SPic
|
||||
getWallSPic wl = case wl ^? wlOpacity . opDraw of
|
||||
Nothing -> mempty
|
||||
Just f -> drawWall f wl
|
||||
Just f -> drawWall f wl
|
||||
|
||||
-- (wins,wls) = partition theTest . IM.elems . IM.filter _wlUnshadowed $ wallsDoubleScreen cfig w
|
||||
-- theTest wl = case _wlOpacity wl of
|
||||
-- Opaque -> False
|
||||
-- _ -> True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user