Move towards serializing saves/loads faster
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Dodge.Debug.Picture where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Wall
|
||||
import Dodge.Base.Window
|
||||
@@ -19,11 +20,11 @@ printRotPoint r p =
|
||||
outsideScreenPolygon :: Configuration -> World -> [Point2]
|
||||
outsideScreenPolygon cfig w = [tr, tl, bl, br]
|
||||
where
|
||||
scRot = rotateV (_cameraRot (_cWorld w))
|
||||
scRot = rotateV (w ^. cWorld . cwCam . cwcRot)
|
||||
scZoom p
|
||||
| _cameraZoom (_cWorld w) /= 0 = (1 / _cameraZoom (_cWorld w)) *.* p
|
||||
| (w ^. cWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . cwCam . cwcZoom)) *.* p
|
||||
| otherwise = error "Trying to set screen zoom to zero"
|
||||
scTran p = p +.+ _cameraCenter (_cWorld w)
|
||||
scTran p = p +.+ (w ^. cWorld . cwCam . cwcCenter)
|
||||
tr = f 3 3
|
||||
tl = f (-3) 3
|
||||
br = f 3 (-3)
|
||||
@@ -39,10 +40,10 @@ lineOnScreenCone cfig w p1 p2 =
|
||||
|| any (isJust . uncurry (intersectSegSeg p1 p2)) sps
|
||||
where
|
||||
sp' = screenPolygon cfig w
|
||||
vp = _cameraViewFrom (_cWorld w)
|
||||
vp = w ^. cWorld . cwCam . cwcViewFrom
|
||||
sp
|
||||
| pointInPolygon vp sp' = sp'
|
||||
| otherwise = orderPolygon (_cameraViewFrom (_cWorld w) : sp')
|
||||
| otherwise = orderPolygon ((w ^. cWorld . cwCam . cwcViewFrom) : sp')
|
||||
sps = zip sp (tail sp ++ [head sp])
|
||||
|
||||
pointOnScreen :: Configuration -> World -> Point2 -> Bool
|
||||
@@ -55,7 +56,7 @@ drawWallFace cfig w wall
|
||||
where
|
||||
(x, y) = _wlLine wall
|
||||
points = extendConeToScreenEdge cfig w sightFrom (x, y)
|
||||
sightFrom = _cameraViewFrom (_cWorld w)
|
||||
sightFrom = w ^. cWorld . cwCam . cwcViewFrom
|
||||
|
||||
extendConeToScreenEdge :: Configuration -> World -> Point2 -> (Point2, Point2) -> [Point2]
|
||||
extendConeToScreenEdge cfig w c (x, y) = orderPolygon $ wallScreenIntersect ++ [x, y] ++ borderPs ++ cornerPs
|
||||
|
||||
Reference in New Issue
Block a user