Refactor wall zoning, remove streaming
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
module Dodge.Render.ShapePicture
|
||||
( worldSPic
|
||||
) where
|
||||
import Dodge.Zoning.Wall
|
||||
import Dodge.Button.Draw
|
||||
import Dodge.LightSource.Draw
|
||||
import Dodge.Targeting.Draw
|
||||
@@ -246,7 +247,7 @@ drawFarWallDetect w = setLayer DebugLayer
|
||||
. color yellow
|
||||
. foldMap (\q -> line
|
||||
[ p
|
||||
, fst $ collidePoint p q $ S.filter wlIsOpaque $ wlsNearSeg p q w
|
||||
, fst $ collidePoint p q $ filter wlIsOpaque $ wlsNearSeg p q w
|
||||
] )
|
||||
$ runIdentity $ S.toList_ $ streamViewpoints p w
|
||||
where
|
||||
@@ -282,7 +283,7 @@ innerSquare :: [Point2]
|
||||
innerSquare = [V2 1 1, V2 (-1) 1, V2 (-1) (-1), V2 1 (-1)]
|
||||
|
||||
drawWallSearchRays :: World -> Picture
|
||||
drawWallSearchRays w = runIdentity $ S.foldMap_ f $ S.map fst $ allVisibleWalls w
|
||||
drawWallSearchRays w = foldMap f $ map fst $ allVisibleWalls w
|
||||
where
|
||||
f p = setLayer DebugLayer $ color yellow $ uncurryV translate p (circle 5)
|
||||
<> line [_cameraViewFrom w, p]
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
module Dodge.Render.Walls
|
||||
( wallsToDraw
|
||||
) where
|
||||
import Dodge.Zoning.World
|
||||
import Dodge.Zoning.Base
|
||||
import Dodge.Zoning.Wall
|
||||
import Dodge.Data
|
||||
import Dodge.Wall.Draw
|
||||
import Dodge.Zone
|
||||
@@ -21,13 +24,26 @@ wallsToDraw w
|
||||
= ( wls, wins,spic)
|
||||
where
|
||||
f wl = (_wlLine wl, _wlColor wl)
|
||||
(wls, wins, spic) = runIdentity $ L.purely S.fold_
|
||||
(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
|
||||
) (S.concat $ S.mapMaybe g $ zoneOfSight wlZoneSize w)
|
||||
g (V2 i j) = w ^? wlZoning . znObjects . ix i . ix j
|
||||
) (wlsFromIXs w $ zonesExtract (w ^. wlZoning) $ zoneOfSight' wlZoneSize w)
|
||||
--wallsToDraw
|
||||
-- :: World
|
||||
-- -> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)], SPic )
|
||||
--wallsToDraw w
|
||||
-- = ( wls, wins,spic)
|
||||
-- where
|
||||
-- f wl = (_wlLine wl, _wlColor wl)
|
||||
-- (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
|
||||
|
||||
Reference in New Issue
Block a user