Start using streaming as the way to consume foldable objects

This commit is contained in:
2022-06-24 09:27:29 +01:00
parent 89dd8502ad
commit 86b1c2581b
6 changed files with 58 additions and 17 deletions
+5 -2
View File
@@ -27,7 +27,8 @@ import qualified Data.IntMap.Strict as IM
import qualified SDL
--import Data.Monoid
--import Data.Semigroup
--import qualified Control.Foldl as L
import qualified Control.Foldl as L
import qualified Streaming.Prelude as S
{- Update the screen camera rotation and position, including any in rold scope/remote camera modifiers;
update where your avatar's view is from. -}
updateCamera :: Configuration -> World -> World
@@ -213,7 +214,9 @@ farWallDistDirection p w = foldl' (flip (m . f)) (0,0,0,0) vps
where
--f q = g $ rotateV (negate $ _cameraRot w) $ collidePointWallsFilt' wlIsOpaque p q wos -.- p
f q = g $ rotateV (negate $ _cameraRot w)
$ collidePointWallsFilt' wlIsOpaque p q (wallsAlongLine p q w) -.- p
-- $ collidePointWallsFilt wlIsOpaque p q (wallsAlongLine p q w) -.- p
-- $ L.purely S.fold_ (collidePointWallsL p q) (wallsAlongLineStream p q w) -.- p
$ runIdentity (L.purely S.fold_ (collidePointWallsL p q) (wallsAlongLineStream p q w)) -.- p
g (V2 x y) = (y, negate y, x, negate x)
m (a,b,c,d) (x,y,z,w') = (max a x, max b y, max c z, max d w')
vps = concatMap _grViewpoints grs ++ extendedViewPoints p grs