Work on distortion shader

This commit is contained in:
2025-11-15 23:17:44 +00:00
parent d436b853eb
commit 1205823ddb
12 changed files with 108 additions and 119 deletions
+11 -10
View File
@@ -43,13 +43,14 @@ blinkActionMousePos cr w =
pushIntoMaybe (x,my) = (x,) <$> my
blinkDistortions :: Point2 -> Point2 -> World -> World
blinkDistortions sp ep = cWorld . lWorld . distortions .++~ distortionBulge
where
distR = 120
distortionBulge =
[ RadialDistortion ep (ep +.+ V2 distR 0) (ep +.+ V2 0 distR) 0.1
, RadialDistortion sp (sp +.+ V2 distR 0) (sp +.+ V2 0 distR) 1.9
]
blinkDistortions _ _ = id
--blinkDistortions sp ep = cWorld . lWorld . distortions .++~ distortionBulge
-- where
-- distR = 120
-- distortionBulge =
-- [ RadialDistortion ep (ep +.+ V2 distR 0) (ep +.+ V2 0 distR) 0.1
-- , RadialDistortion sp (sp +.+ V2 distR 0) (sp +.+ V2 0 distR) 1.9
-- ]
{- | Teleport a creature to the mouse position.
Can go through walls, if ending up in wall does big damage.
@@ -87,12 +88,12 @@ blinkActionFail :: Creature -> World -> World
blinkActionFail cr w =
w
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
& cWorld . lWorld . distortions .:~ distortionBulge
-- & cWorld . lWorld . distortions .:~ distortionBulge
& cWorld . lWorld . creatures . ix cid . crPos . _xy .~ p3
& inverseShockwaveAt (cpos `v2z` 20) 40 2 2
where
distR = 120
distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
-- distR = 120
-- distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
cid = _crID cr
p1 = w ^. cWorld . lWorld . lAimPos
cpos = cr ^. crPos . _xy