Add in "linear" lWorld to separate time reversable worlds

This commit is contained in:
2022-10-28 12:24:51 +01:00
parent 5f6bd43599
commit 7e790b7153
130 changed files with 827 additions and 980 deletions
+5 -10
View File
@@ -15,16 +15,11 @@ import Control.Lens
screenPolygon :: Configuration -> World -> [Point2]
screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
where
scRot = rotateV (w ^. cWorld . cwCam . cwcRot)
scRot = rotateV (w ^. cWorld . lWorld . cwCam . cwcRot)
scZoom p
| (w ^. cWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . cwCam . cwcZoom)) *.* p
| (w ^. cWorld . lWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . lWorld . cwCam . cwcZoom)) *.* p
| otherwise = p
scTran p = p +.+ (w ^. cWorld . cwCam . cwcCenter)
-- tr = scTran $ scRot $ scZoom (V2 ( halfWidth w) ( halfHeight w))
-- tl = scTran $ scRot $ scZoom (V2 (-halfWidth w) ( halfHeight w))
-- br = scTran $ scRot $ scZoom (V2 ( halfWidth w) (-halfHeight w))
-- bl = scTran $ scRot $ scZoom (V2 (-halfWidth w) (-halfHeight w))
scTran p = p +.+ (w ^. cWorld . lWorld . cwCam . cwcCenter)
-- | A box covering the screen in world coordinates, with a x and y border
screenPolygonBord ::
@@ -40,9 +35,9 @@ screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
hw = halfWidth cfig - xbord
hh = halfHeight cfig - ybord
scZoom p
| (w ^. cWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . cwCam . cwcZoom)) *.* p
| (w ^. cWorld . lWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . lWorld . cwCam . cwcZoom)) *.* p
| otherwise = p
theTransform = (+.+ (w ^. cWorld . cwCam . cwcCenter)) . rotateV (w ^. cWorld . cwCam . cwcRot) . scZoom
theTransform = (+.+ (w ^. cWorld . lWorld . cwCam . cwcCenter)) . rotateV (w ^. cWorld . lWorld . cwCam . cwcRot) . scZoom
tr = theTransform (V2 hw hh)
tl = theTransform (V2 (- hw) hh)
br = theTransform (V2 hw (- hh))