Improve forcefield visuals
This commit is contained in:
@@ -1,20 +1,42 @@
|
||||
module Dodge.Render.Walls
|
||||
( wallsAndWindows
|
||||
( wallsToDrawStreams
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Zone
|
||||
import Dodge.Base.Collide
|
||||
import Geometry
|
||||
import ShapePicture
|
||||
|
||||
import Data.List
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
wallsAndWindows
|
||||
import Control.Lens
|
||||
--import Data.Maybe
|
||||
import qualified Control.Foldl as L
|
||||
--import Data.List
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
wallsToDrawStreams
|
||||
:: Configuration
|
||||
-> World
|
||||
-> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)] )
|
||||
wallsAndWindows cfig w
|
||||
= (map f wls, map f wins)
|
||||
-> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)], SPic )
|
||||
wallsToDrawStreams cfig w
|
||||
= ( wls, wins,spic)
|
||||
where
|
||||
f wl = (_wlLine wl, _wlColor wl)
|
||||
(wins,wls) = partition theTest . IM.elems . IM.filter _wlDraw $ wallsDoubleScreen cfig w
|
||||
theTest wl = _wlOpacity wl /= Opaque
|
||||
(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
|
||||
) (wallsDoubleScreen cfig w)
|
||||
wlOpaqueDraw :: Wall -> Bool
|
||||
wlOpaqueDraw wl = wlIsOpaque wl && _wlDraw wl
|
||||
wlSeeThroughDraw :: Wall -> Bool
|
||||
wlSeeThroughDraw wl = wlIsSeeThrough wl && _wlDraw wl
|
||||
|
||||
getWallSPic :: Wall -> SPic
|
||||
getWallSPic wl = case wl ^? wlOpacity . opDraw of
|
||||
Nothing -> mempty
|
||||
Just f -> f wl
|
||||
|
||||
-- (wins,wls) = partition theTest . IM.elems . IM.filter _wlDraw $ wallsDoubleScreen cfig w
|
||||
-- theTest wl = case _wlOpacity wl of
|
||||
-- Opaque -> False
|
||||
-- _ -> True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user