8 #ifndef Navigation_MultiDestinationPathFinderQuery_H
9 #define Navigation_MultiDestinationPathFinderQuery_H
18 #include "gwnavruntime/math/box2iiterator.h"
24 template<
class TraverseLogic>
25 class MultiDestinationPathFinderQuery :
public BaseMultiDestinationPathFinderQuery
31 MultiDestinationPathFinderQuery();
32 virtual ~MultiDestinationPathFinderQuery();
38 virtual void Advance(WorkingMemory* workingMemory);
40 virtual void ReleaseWorkingMemoryOnCancelDuringProcess(WorkingMemory* workingMemory =
KY_NULL);
43 bool HasNavDataChanged();
46 void SetFinish(WorkingMemory* workingMemory);
47 KyResult ComputeStartGraphEdgeOrGraphVertexOrTriangle(PathFinderQueryUtils& queryUtils);
48 KyResult ComputeStartTriangle(PathFinderQueryUtils& queryUtils);
49 KyResult ComputeDestTriangleIfNeeded(PathFinderQueryUtils& queryUtils);
50 KyResult InitializeContextAndStartNode(PathFinderQueryUtils& queryUtils);
52 KyResult InitDestinationNodeFromDestNavGraphEdge(PathFinderPoint& dest);
53 KyResult InitDestinationNodeFromDestNavGraphVertex(PathFinderPoint& dest);
54 KyResult InitDestinationNodeFromDestNavTriangle(PathFinderPoint& dest);
55 KyResult InitTraversalFromStartNode(PathFinderQueryUtils& queryUtils);
56 void InitPropagationBounds();
58 KyResult CheckNavDataChangeFromAstarContext(WorkingMemory* workingMemory);
59 KyResult CheckNavDataChange(WorkingMemory* workingMemory);
61 bool ShouldReturnAfterTryingCanGo(WorkingMemory* workingMemory);
63 bool HasExplorationReachedAllDestNodes();
64 bool HasExplorationReachedAtLeastADestNode();
66 void ComputeRawCosts();
68 PathEdgeType GetPathEdgeType(
const AStarNode& predecessorNode,
const AStarNode& node);
70 bool ProcessFirstDestination();
71 bool UpdateResultAndSelectFirstDestination();
72 bool ProcessNextDestination(WorkingMemory* workingMemory);
74 KyUInt32 CountAbstractGraphNodes(WorkingMemory* workingMemory, AStarNodeIndex destNodeIdx);
75 bool BuildAbstractPath(WorkingMemory* workingMemory);
78 class TraversalCustomizer
81 typedef TraverseLogic TLogic;
83 TraversalCustomizer();
85 bool CanTraverse(
const NavTriangleRawPtr& triangleRawPtr,
KyFloat32* costMultiplier);
86 bool CanTraverse(
const NavGraphEdgeRawPtr& edgeRawPtr,
KyFloat32* costMultiplier);
87 bool CanEnterNavTag(
const NavTag& exitNavTag,
const NavTag& enterNavTag,
const Vec3f& pos);
88 KyFloat32 GetHeuristicFromNodePosition(
const Vec3f& nodePosition);
90 void* GetTraverseLogicUserData()
const {
return m_traverseLogicUserData; }
91 bool ShouldVisitNode(AStarTraversalContext* aStarTraversalContext, AStarNodeIndex nodeIndex);
92 bool IsNodeOutsidePropagationBounds(AStarTraversalContext* aStarTraversalContext, AStarNodeIndex nodeIndex);
93 bool ShouldOpenHalfEdgeNode(
const NavHalfEdgeRawPtr& halfEdge, NavHalfEdgeRawPtr& pairHalfEdgeOfNewNode);
94 bool ShouldOpenGraphVertexNode(
const NavGraphVertexRawPtr& navGraphVertexRawPtr);
95 bool ShouldOpenAbstractGraphNode(
const AbstractGraphNodeRawPtr& abstractGraphNodeRawPtr);
96 bool ShouldOpenNavTriangleUnderAbstractGraphNode(
const AbstractGraphNodeRawPtr& abstractGraphNodeRawPtr);
97 Vec3f ComputeNodePositionOnHalfEdge(AStarTraversalContext* aStarTraversalContext,
const Vec3f& startPosOfEdge,
const Vec3f& endPosOfEdge, AStarNodeIndex predecessorNodeIndex);
98 KyResult OnNavTriangleExplored(AStarTraversalContext* aStarTraversalContext,
const NavTriangleRawPtr& navTriangleRawPtr, AStarNodeIndex currentNodeIndex);
99 KyResult OnNavGraphEdgeExplored(AStarTraversalContext* aStarTraversalContext,
const NavGraphEdgeRawPtr& navGraphEdgeRawPtr, AStarNodeIndex currentNodeIndex);
101 MultiDestinationPathFinderQuery<TraverseLogic>* m_query;
102 void* m_traverseLogicUserData;
105 AStarTraversal<TraversalCustomizer> m_traversal;
106 KyArray<MonodirectionalRayCanGoQuery<TraverseLogic> > m_rayCanGoQueries;
114 #endif //Navigation_MultiDestinationPathFinderQuery_H
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
#define KY_NULL
Null value.
Definition: types.h:247
Definition: gamekitcrowddispersion.h:20
PathEdgeType
Defines the different kind of PathEdge within a Path.
Definition: path.h:26
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43