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
+17 -15
View File
@@ -39,27 +39,29 @@ updateFloatingCamera cfig w =
& updateBounds cfig
& wCam %~ setViewDistance cfig
& wCam %~ translateFloatingCamera theinput
& rotateCamera cfig
& wCam %~ translateFloatingCameraKeys theinput
& wCam %~ zoomFloatingCamera theinput
where
theinput = w ^. input
translateFloatingCamera :: Input -> Camera -> Camera
translateFloatingCamera theinput cam = fromMaybe cam $ do
lpresstime <- theinput ^. mouseButtons . at ButtonLeft
rpresstime <- theinput ^. mouseButtons . at ButtonRight
if lpresstime > rpresstime
then do
hpos <- theinput ^? heldPos . ix ButtonLeft
let thetran =
screenToWorldPos cam hpos
-.- screenToWorldPos cam (theinput ^. mousePos)
return $
cam & camCenter +~ thetran
& camViewFrom +~ thetran
else do
a <- theinput ^. heldPos . at SDL.ButtonRight
return $ cam & camRot -~ angleBetween (theinput ^. mousePos) a
translateFloatingCamera _ cam = cam -- fromMaybe cam $ do
---- lpresstime <- theinput ^. mouseButtons . at ButtonLeft
-- _ <- theinput ^. mouseButtons . at ButtonRight
---- guard (theinput ^. mouseButtons . at ButtonRight == Nothing)
---- if lpresstime > rpresstime
---- then do
-- hpos <- theinput ^? heldPos . ix ButtonRight
-- let thetran =
-- screenToWorldPos cam hpos
-- -.- screenToWorldPos cam (theinput ^. mousePos)
-- return $
-- cam & camCenter +~ thetran
-- & camViewFrom +~ thetran
---- else do
---- a <- theinput ^. heldPos . at SDL.ButtonRight
---- return $ cam & camRot -~ angleBetween (theinput ^. mousePos) a
translateFloatingCameraKeys :: Input -> Camera -> Camera
translateFloatingCameraKeys theinput cam =