Separate out concrete part of world
This commit is contained in:
@@ -19,10 +19,10 @@ printRotPoint r p = color white
|
||||
outsideScreenPolygon :: Configuration -> World -> [Point2]
|
||||
outsideScreenPolygon cfig w = [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 = error "Trying to set screen zoom to zero"
|
||||
scTran p = p +.+ _cameraCenter w
|
||||
scTran p = p +.+ _cameraCenter (_cWorld w)
|
||||
tr = f 3 3
|
||||
tl = f (-3) 3
|
||||
br = f 3 (-3)
|
||||
@@ -37,9 +37,9 @@ lineOnScreenCone cfig w p1 p2 = pointInPolygon p1 sp
|
||||
|| any (isJust . uncurry (intersectSegSeg p1 p2)) sps
|
||||
where
|
||||
sp' = screenPolygon cfig w
|
||||
vp = _cameraViewFrom w
|
||||
vp = _cameraViewFrom (_cWorld w)
|
||||
sp | pointInPolygon vp sp' = sp'
|
||||
| otherwise = orderPolygon (_cameraViewFrom w : sp')
|
||||
| otherwise = orderPolygon (_cameraViewFrom (_cWorld w) : sp')
|
||||
sps = zip sp (tail sp ++ [head sp])
|
||||
|
||||
pointOnScreen :: Configuration -> World -> Point2 -> Bool
|
||||
@@ -52,7 +52,7 @@ drawWallFace cfig w wall
|
||||
where
|
||||
(x,y) = _wlLine wall
|
||||
points = extendConeToScreenEdge cfig w sightFrom (x,y)
|
||||
sightFrom = _cameraViewFrom w
|
||||
sightFrom = _cameraViewFrom (_cWorld w)
|
||||
|
||||
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