Separate out concrete part of world
This commit is contained in:
@@ -15,10 +15,10 @@ screenPolygon :: Configuration -> World -> [Point2]
|
||||
screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
|
||||
-- [tr,tl,bl,br]
|
||||
where
|
||||
scRot = rotateV (_cameraRot w)
|
||||
scZoom p | _cameraZoom w /= 0 = (1/_cameraZoom w) *.* p
|
||||
scRot = rotateV (_cameraRot (_cWorld w))
|
||||
scZoom p | _cameraZoom (_cWorld w) /= 0 = (1/_cameraZoom (_cWorld w)) *.* p
|
||||
| otherwise = p
|
||||
scTran p = p +.+ _cameraCenter w
|
||||
scTran p = p +.+ _cameraCenter (_cWorld w)
|
||||
-- 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))
|
||||
@@ -35,9 +35,9 @@ screenPolygonBord xbord ybord cfig w = [tr,tl,bl,br]
|
||||
where
|
||||
hw = halfWidth cfig - xbord
|
||||
hh = halfHeight cfig - ybord
|
||||
scZoom p | _cameraZoom w /= 0 = (1/_cameraZoom w) *.* p
|
||||
scZoom p | _cameraZoom (_cWorld w) /= 0 = (1/_cameraZoom (_cWorld w)) *.* p
|
||||
| otherwise = p
|
||||
theTransform = (+.+ _cameraCenter w) . rotateV (_cameraRot w) . scZoom
|
||||
theTransform = (+.+ _cameraCenter (_cWorld w)) . rotateV (_cameraRot (_cWorld w)) . scZoom
|
||||
tr = theTransform (V2 hw hh )
|
||||
tl = theTransform (V2 (-hw) hh )
|
||||
br = theTransform (V2 hw (-hh))
|
||||
|
||||
Reference in New Issue
Block a user