Initial replacement of FGL with incidence representation, use A*
This commit is contained in:
@@ -404,8 +404,8 @@ drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls
|
||||
p = worldPosToScreen (w ^. wCam) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
||||
|
||||
|
||||
drawPathing :: Config -> World -> Picture
|
||||
drawPathing cfig w =
|
||||
drawPathing' :: Config -> World -> Picture
|
||||
drawPathing' cfig w =
|
||||
setLayer DebugLayer $
|
||||
foldMap (edgeToPic (screenPolygon cfig (w ^. wCam)) . (^?! _3)) (FGL.labEdges gr)
|
||||
<> foldMap dispInc (graphToIncidence gr)
|
||||
@@ -413,6 +413,15 @@ drawPathing cfig w =
|
||||
dispInc (p, n) = setDepth 2 . uncurryV translate p . scale 0.1 0.1 $ text $ show n
|
||||
gr = w ^. cWorld . pathGraph
|
||||
|
||||
drawPathing :: Config -> World -> Picture
|
||||
drawPathing cfig w =
|
||||
setLayer DebugLayer $ ifoldMap f $ w ^. cWorld . incGraph
|
||||
where
|
||||
inodes = w ^. cWorld . incNode
|
||||
f i = foldMap (g i)
|
||||
g i (j,se) = edgeToPic (screenPolygon cfig (w ^.wCam))
|
||||
(PathEdge (inodes ^?! ix i) (inodes ^?! ix j) 0 (se ^. seObstacles))
|
||||
|
||||
edgeToPic :: [Point2] -> PathEdge -> Picture
|
||||
edgeToPic poly pe
|
||||
| not (pointInPoly sp poly) && not (pointInPoly ep poly) = mempty
|
||||
|
||||
Reference in New Issue
Block a user