Work on distortion shader
This commit is contained in:
+17
-15
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user