Various performance improvements

This commit is contained in:
2021-09-23 15:27:37 +01:00
parent 7b6904b51f
commit 85edd98d62
17 changed files with 137 additions and 81 deletions
+6 -5
View File
@@ -32,7 +32,6 @@ worldPictures w = pictures
,concatMapPic (dbArg _ptDraw) $ _particles w
,testPic w
,concatMapPic (_spPicture . floorItemSPic) $ _floorItems w
,concatMapPic (crDraw w) $ _creatures w
,concatMapPic clDraw $ _clouds w
,concatMapPic ppDraw $ _pressPlates w
,concatMapPic btDraw $ _buttons w
@@ -149,8 +148,9 @@ wallShadowsToDraw w
-- cannot only test if walls are on screen, but also if they are on the cone
-- towards the center of sight
lineOnScreenCone :: World -> Point2 -> Point2 -> Bool
lineOnScreenCone w p1 p2 = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9 p2 sp
|| any (isJust . uncurry (intersectSegSeg p1 p2)) sps
lineOnScreenCone w p1 p2 = pointInPolygon p1 sp
|| pointInPolygon p2 sp
|| any (isJust . uncurry (intersectSegSeg p1 p2)) sps
where
sp' = screenPolygon w
vp = _cameraViewFrom w
@@ -160,8 +160,9 @@ lineOnScreenCone w p1 p2 = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9
lineOnScreen :: World -> Point2 -> Point2 -> Bool
lineOnScreen w p1 p2 = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9 p2 sp
|| any (isJust . uncurry (intersectSegSeg p1 p2)) sps
lineOnScreen w p1 p2 = pointInPolygon p1 sp
|| pointInPolygon p2 sp
|| any (isJust . uncurry (intersectSegSeg p1 p2)) sps
where
sp = screenPolygon w
sps = zip sp (tail sp ++ [head sp])