Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/helpers/VertexPathfinder.h
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
class ICmpObstructionManager; | class ICmpObstructionManager; | ||||
class CSimContext; | class CSimContext; | ||||
class SceneCollector; | class SceneCollector; | ||||
class VertexPathfinder | class VertexPathfinder | ||||
{ | { | ||||
public: | public: | ||||
VertexPathfinder(const u16& mapSize, Grid<NavcellData>* const & terrainOnlyGrid) : m_MapSize(mapSize), m_TerrainOnlyGrid(terrainOnlyGrid), m_DebugOverlay(false) {}; | VertexPathfinder() : m_DebugOverlay(false) {}; | ||||
/** | /** | ||||
* Compute a precise path from the given point to the goal, and return the set of waypoints. | * Compute a precise path from the given point to the goal, and return the set of waypoints. | ||||
* The path is based on the full set of obstructions that pass the filter, such that | * The path is based on the full set of obstructions that pass the filter, such that | ||||
* a unit of clearance 'clearance' will be able to follow the path with no collisions. | * a unit of clearance 'clearance' will be able to follow the path with no collisions. | ||||
* The path is restricted to a box of radius 'range' from the starting point. | * The path is restricted to a box of radius 'range' from the starting point. | ||||
* Defined in CCmpPathfinder_Vertex.cpp | * Defined in CCmpPathfinder_Vertex.cpp | ||||
*/ | */ | ||||
WaypointPath ComputeShortPath(const ShortPathRequest& request, CmpPtr<ICmpObstructionManager> cmpObstructionManager) const; | WaypointPath ComputeShortPath(const u16 mapSize, Grid<NavcellData>* const& terrainOnlyGrid, const ShortPathRequest& request, CmpPtr<ICmpObstructionManager> cmpObstructionManager) const; | ||||
void SetDebugOverlay(bool enabled) { m_DebugOverlay = enabled; } | void SetDebugOverlay(bool enabled) { m_DebugOverlay = enabled; } | ||||
void RenderSubmit(SceneCollector& collector); | void RenderSubmit(SceneCollector& collector); | ||||
private: | private: | ||||
void DebugRenderGoal(const CSimContext& simContext, const PathGoal& goal) const; | void DebugRenderGoal(const CSimContext& simContext, const PathGoal& goal) const; | ||||
void DebugRenderGraph(const CSimContext& simContext, const std::vector<Vertex>& vertexes, const std::vector<Edge>& edges, const std::vector<Square>& edgeSquares) const; | void DebugRenderGraph(const CSimContext& simContext, const std::vector<Vertex>& vertexes, const std::vector<Edge>& edges, const std::vector<Square>& edgeSquares) const; | ||||
void DebugRenderEdges(const CSimContext& simContext, bool visible, CFixedVector2D curr, CFixedVector2D npos) const; | void DebugRenderEdges(const CSimContext& simContext, bool visible, CFixedVector2D curr, CFixedVector2D npos) const; | ||||
// References to the Pathfinder for convenience. | |||||
const u16& m_MapSize; | |||||
Grid<NavcellData>* const & m_TerrainOnlyGrid; | |||||
std::atomic<bool> m_DebugOverlay; | std::atomic<bool> m_DebugOverlay; | ||||
mutable std::vector<SOverlayLine> m_DebugOverlayShortPathLines; | mutable std::vector<SOverlayLine> m_DebugOverlayShortPathLines; | ||||
// These vectors are expensive to recreate on every call, so we cache them here. | // These vectors are expensive to recreate on every call, so we cache them here. | ||||
// They are made mutable to allow using them in the otherwise const ComputeShortPath. | // They are made mutable to allow using them in the otherwise const ComputeShortPath. | ||||
mutable std::vector<Edge> m_EdgesUnaligned; | mutable std::vector<Edge> m_EdgesUnaligned; | ||||
mutable std::vector<EdgeAA> m_EdgesLeft; | mutable std::vector<EdgeAA> m_EdgesLeft; | ||||
Show All 14 Lines |
Wildfire Games · Phabricator