Use streaming to improve speed of generating cullbox

This commit is contained in:
2022-06-24 11:35:35 +01:00
parent ffdf7e4164
commit 78f211a129
3 changed files with 33 additions and 18 deletions
+5 -2
View File
@@ -15,8 +15,11 @@ cullBox :: Configuration -> World -> [Point2]
--cullBox cfig w = farWallPoints cp w
cullBox cfig w'
| debugOn Bound_box_screen cfig = screenPolygon cfig w'
| otherwise = let (n,s,e,w) = farWallDistDirection (_cameraCenter w') w'
in map ((+.+ _cameraCenter w') . rotateV (_cameraRot w') ) $ rectNSWE n (negate s) (negate w) e
| otherwise = let (n,s,e,w) = f $ farWallDistDirection (_cameraCenter w') w'
in map ((+.+ _cameraCenter w') . rotateV (_cameraRot w') ) $ rectNSWE n ( s) ( w) e
where
f (Just a,Just b,Just c,Just d) = (max 0 a,min 0 b,max 0 c,min 0 d)
f _ = (0,0,0,0)
-- --mapMaybe (fmap (fst . _wlLine . snd) . f) $ screenPolygon cfig w
-- where
-- grs = filter (pointInOrOnPolygon cp . _grBound) (_gameRooms w)