Implement multiple radial distortion rendering

This commit is contained in:
jgk
2021-07-10 14:04:01 +02:00
parent 1c519259a1
commit c63b293ea5
8 changed files with 75 additions and 22 deletions
+12
View File
@@ -53,6 +53,7 @@ update' w = case _menuLayers w of
w
(_ : _) -> w
[] -> checkEndGame
. updateRadialDistortions
. updateTriggers
. ppEvents
. updateCamera
@@ -89,6 +90,17 @@ updateCreatureGroups :: World -> World
updateCreatureGroups w = w & creatureGroups %~
IM.mapMaybe (\cgp -> _crGroupUpdate cgp w cgp)
updateRadialDistortions :: World -> World
updateRadialDistortions = radDistortion %~ mapMaybe decreaseBulge
decreaseBulge
:: (Point2,Point2,Point2,Float)
-> Maybe (Point2,Point2,Point2,Float)
decreaseBulge (a,b,c,v)
| v > 1 = Just (a,b,c,max 1 (v - 0.05) )
| v < 1 = Just (a,b,c,min 1 (v + 0.05) )
| otherwise = Nothing
updateTriggers :: World -> World
updateTriggers w
| ResetLevel 1 `S.member` _worldTriggers w = generateLevelFromRoomList levx $ initialWorld