More streaming refactoring

This commit is contained in:
2022-06-24 23:37:01 +01:00
parent 0270d423fd
commit 3c2df2542a
10 changed files with 96 additions and 198 deletions
+15 -4
View File
@@ -22,11 +22,13 @@ import Shape
import Picture
import Sound.Data
import Geometry.ConvexPoly
--import Dodge.Base.Collide
import qualified Data.IntMap.Strict as IM -- Lazy?
import qualified Data.Map.Strict as M
import Control.Lens
import Data.Maybe
import qualified Streaming.Prelude as S
-- TODO only filter out shapes outside the range of the furthest shown light source
worldSPic :: Configuration -> World -> SPic
@@ -76,15 +78,24 @@ extraPics cfig w = pictures (_decorations w)
<> drawWallIDs cfig w
<> drawPathing cfig w
<> drawCrInfo cfig w
<> drawBoundingBox cfig w
<> cfigdraw Show_bound_box drawBoundingBox
<> cfigdraw Show_wall_search_rays (const drawWallSearchRays)
where
cfigdraw boption draw
| debugOn boption cfig = draw cfig w
| otherwise = mempty
drawWallSearchRays :: World -> Picture
drawWallSearchRays w = runIdentity $ S.foldMap_ f $ S.map fst $ allVisibleWalls w
where
f p = setLayer DebugLayer $ color yellow $ uncurryV translate p (circle 5)
<> line [_cameraViewFrom w, p]
testPic :: Configuration -> World -> Picture
testPic _ _ = mempty
drawBoundingBox :: Configuration -> World -> Picture
drawBoundingBox cfig w
| debugOn Show_bound_box cfig = setLayer DebugLayer $ color green $ line $ (x:xs) ++ [x]
| otherwise = mempty
drawBoundingBox cfig w = setLayer DebugLayer $ color green $ line $ (x:xs) ++ [x]
where
(x:xs) = cullBox cfig w