Remove parallelization of pokeTopPrism

This commit is contained in:
2022-06-26 14:26:39 +01:00
parent d386b0ea89
commit c3f9dad233
8 changed files with 30 additions and 61 deletions
+4 -30
View File
@@ -284,20 +284,12 @@ updateMIM f up = f %~ IM.mapMaybe (dbArg up)
ppEvents :: World -> World
ppEvents w = IM.foldl' (flip $ \pp -> _ppEvent pp pp) w $ _pressPlates w
-- this is not working correctly, maybe a problem with wallsAlongLine
--updateSeenWalls :: World -> World
--updateSeenWalls w = foldl' markWallSeen w wallsToUpdate
-- where
-- vPos = _cameraViewFrom w
-- wallsToUpdate = concatMap (\p -> visibleWalls vPos (vPos +.+p) $ wallsAlongLine vPos (vPos +.+ p) w)
-- $ nRays 20
updateSeenWalls :: World -> World
updateSeenWalls w = runIdentity $ S.fold_ f w id (S.map (_wlID . snd) $ allVisibleWalls w)
where
f w' i = w' & walls . ix i . wlSeen .~ True
-- wallsToUpdate = concatMap (\p -> visibleWalls vPos (vPos +.+p) $ wallsAlongLine vPos (vPos +.+ p) w)
-- $ nRays 20
f w' i -- = w' & walls . ix i . wlSeen .~ True -- this is much simpler, but leaks
= w' { _walls = IM.adjust mw i $ _walls w' }
mw wl = wl {_wlSeen = True}
--markWallSeen :: World -> Wall -> World
--markWallSeen w wl = w { _walls = IM.adjust mw (_wlID wl) $ _walls w }
@@ -339,34 +331,16 @@ updateCloud w c
newVel@(V3 _ _ nvz) = (0.95 *.*.* springVels) +.+.+ V3 0 0 (0.001 * vertVel)
newVel2 = stripZ newVel
vertVel = _clAlt c - opz
springVels = foldl' (clClSpringVel c) (_clVel c) (cloudsNearPoint oldPos2 w)
springVels = runIdentity $ S.fold_ (clClSpringVel c) (_clVel c) id (cloudsNearPoint oldPos2 w)
oldPos@(V3 _ _ opz) = _clPos c
oldPos2 = stripZ oldPos
newPos@(V3 _ _ npz) = oldPos +.+.+ newVel
newPos2 = stripZ newPos
-- the following only tests for the first collision with a wall
--hitWl = collidePointAnyWallsReflect oldPos2 newPos2 $ wallsNearPoint newPos2 w
hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w
finalPos = addZ (min 74 npz) $ maybe newPos2 fst hitWl
-- allowing clouds at/above height 75 causes graphical glitches 22.05.23
finalVel = addZ nvz $ maybe newVel2 snd hitWl
--updateCloud :: World -> Cloud -> Maybe Cloud
--updateCloud w c
-- | _clTimer c < 1 = Nothing
-- | otherwise = Just $ c
-- & clPos .~ finalPos
-- & clVel .~ finalVel
-- & clTimer -~ 1
-- where
-- newVel = 0.95 *.* springVels
-- springVels = foldl' (clClSpringVel c) (_clVel c) (cloudsNearPoint oldPos w)
-- oldPos = _clPos c
-- newPos = oldPos +.+ newVel
-- hitWl = collideCircWalls' oldPos newPos 5 $ wallsNearPoint newPos w
-- finalPos = maybe newPos fst hitWl
-- finalVel = maybe newVel snd hitWl
clClSpringVel :: Cloud -> Point3 -> Cloud -> Point3
clClSpringVel a v b
| dist3 pa pb < radDist = v +.+.+ 0.1 *.*.* normalizeV3 (pa -.-.- pb)