9 #ifndef Navigation_BaseAStarQuery_H
10 #define Navigation_BaseAStarQuery_H
70 ASTAR_DO_NOT_TRY_RAYCANGO = 0,
71 ASTAR_DO_TRY_RAYCANGO = 1
75 class BaseAStarQuery :
public IPathFinderQuery
78 static QueryType GetStaticType() {
return TypeAStar; }
79 virtual QueryType GetType()
const {
return TypeAStar; }
80 virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
81 virtual void InitFromQueryBlob(World* world,
void* blob);
82 virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() {
return CreateStaticQueryBlobHandler(); }
83 static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
93 KyFloat32 GetFromOutsideNavMeshDistance()
const;
94 KyFloat32 GetToOutsideNavMeshDistance()
const;
95 KyFloat32 GetPropagationBoxExtent()
const;
96 const Vec3f& GetStartPos()
const;
97 const Vec3f& GetDestPos()
const;
98 const NavTrianglePtr& GetStartTrianglePtr()
const;
99 const NavGraphEdgePtr& GetStartNavGraphEdgePtr()
const;
100 const NavGraphVertexPtr& GetStartNavGraphVertexPtr()
const;
101 const NavTrianglePtr& GetDestTrianglePtr()
const;
102 const NavGraphEdgePtr& GetDestNavGraphEdgePtr()
const;
103 const NavGraphVertexPtr& GetDestNavGraphVertexPtr()
const;
106 const ChannelComputerConfig& GetChannelComputerConfig()
const;
107 Path* GetPath()
const;
108 KyUInt32 GetNumberOfProcessedNodePerFrame()
const;
109 Path* GetAbstractPath()
const;
112 const PositionSpatializationRange& GetPositionSpatializationRange()
const;
114 void ComputePathRefinerConfigInternals();
115 const PathRefinerConfig& GetPathRefinerConfig()
const;
119 void BindToDatabase(Database* database);
120 void Initialize(
const Vec3f& startPos,
const Vec3f& destPos);
122 void SetStartTrianglePtr(
const NavTrianglePtr& startTrianglePtr);
123 void SetStartNavGraphEdgePtr(
const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode);
124 void SetStartNavGraphVertexPtr(
const NavGraphVertexPtr& startNavGraphVertexPtr);
126 void SetDestTrianglePtr(
const NavTrianglePtr& destTrianglePtr);
127 void SetDestNavGraphEdgePtr(
const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode);
128 void SetDestNavGraphVertexPtr(
const NavGraphVertexPtr& startNavGraphVertexPtr);
132 void SetChannelComputerConfig(
const ChannelComputerConfig& channelComputerConfig);
133 void SetPropagationBoxExtent(
KyFloat32 propagationBoxExtent);
134 void SetPositionSpatializationRange(
const PositionSpatializationRange& positionSpatializationRange);
135 void SetFromOutsideNavMeshDistance(
KyFloat32 fromOutsideNavMeshDistance);
136 void SetToOutsideNavMeshDistance(
KyFloat32 toOutsideNavMeshDistance);
137 void SetNumberOfProcessedNodePerFrame(
KyUInt32 numberOfProcessedNodePerFrame);
139 void SetPathClamperFlagMask(PathClamperFlagMask pathClamperFlagMask);
143 virtual ~BaseAStarQuery() {}
146 void InitCellFilterFromAbstractGraph();
147 void ReplaceNodesOfShortestPathOnMiddleOfNavHalfEdge(WorkingMemory* workingMemory);
164 NavGraphEdgePtr m_destNavGraphEdgePtr;
179 PathRefinerConfig m_pathRefinerConfig;
180 PathClamperFlagMask m_pathClamperFlagMask;
183 Ptr<CellFilter> m_propagationCellFilter;
192 KY_INLINE
void BaseAStarQuery::SetTryCanGoMode(
AStarQueryTryCanGoMode tryCanGoMode) { m_tryCanGoMode = tryCanGoMode; }
194 KY_INLINE
void BaseAStarQuery::SetChannelComputerConfig(
const ChannelComputerConfig& config) {
m_channelComputerConfig = config; }
197 KY_INLINE
void BaseAStarQuery::SetStartTrianglePtr(
const NavTrianglePtr& startTrianglePtr)
200 KY_LOG_WARNING_IF(
m_startNavGraphEdgePtr.
IsValid(), (
"You are setting a start NavTrianglePtr whereas a start NavGraphEdgePtr was set too."));
206 KY_INLINE
void BaseAStarQuery::SetStartNavGraphEdgePtr(
const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode)
210 KY_LOG_WARNING_IF(
m_startTrianglePtr.
IsValid(), (
"You are setting a start NavGraphEdgePtr whereas a start NavTrianglePtr was set too."));
216 KY_INLINE
void BaseAStarQuery::SetStartNavGraphVertexPtr(
const NavGraphVertexPtr& startNavGraphVertexPtr)
219 KY_LOG_WARNING_IF(
m_startTrianglePtr.
IsValid(), (
"You are setting a start NavGraphVertexPtr whereas a start NavTrianglePtr was set too."));
220 KY_LOG_WARNING_IF(
m_startNavGraphEdgePtr.
IsValid(), (
"You are setting a start NavGraphVertexPtr whereas a start NavGraphEdgePtr was set too."));
225 KY_INLINE
void BaseAStarQuery::SetDestTrianglePtr(
const NavTrianglePtr& destTrianglePtr)
228 KY_LOG_WARNING_IF(m_destNavGraphEdgePtr.
IsValid(), (
"You are setting a dest NavTrianglePtr whereas a dest NavGraphEdgePtr was set too."));
229 KY_LOG_WARNING_IF(m_destNavGraphVertexPtr.
IsValid(), (
"You are setting a dest NavTrianglePtr whereas a dest NavGraphVertexPtr was set too."));
234 KY_INLINE
void BaseAStarQuery::SetDestNavGraphEdgePtr(
const NavGraphEdgePtr& destNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode)
236 m_destNavGraphEdgePtr = destNavGraphEdgePtr;
238 KY_LOG_WARNING_IF(
m_destTrianglePtr.
IsValid(), (
"You are setting a dest NavGraphEdgePtr whereas a dest NavTrianglePtr was set too."));
239 KY_LOG_WARNING_IF(m_destNavGraphVertexPtr.
IsValid(), (
"You are setting a dest NavGraphEdgePtr whereas a dest NavGraphVertexPtr was set too."));
244 KY_INLINE
void BaseAStarQuery::SetDestNavGraphVertexPtr(
const NavGraphVertexPtr& destNavGraphVertexPtr)
246 m_destNavGraphVertexPtr = destNavGraphVertexPtr;
247 KY_LOG_WARNING_IF(
m_destTrianglePtr.
IsValid(), (
"You are setting a dest NavGraphVertexPtr whereas a dest NavTrianglePtr was set too."));
248 KY_LOG_WARNING_IF(m_destNavGraphEdgePtr.
IsValid(), (
"You are setting a dest NavGraphVertexPtr whereas a dest NavGraphEdgePtr was set too."));
254 KY_INLINE
const Vec3f& BaseAStarQuery::GetDestPos()
const {
return m_destPos3f; }
255 KY_INLINE
const NavTrianglePtr& BaseAStarQuery::GetStartTrianglePtr()
const {
return m_startTrianglePtr; }
256 KY_INLINE
const NavGraphEdgePtr& BaseAStarQuery::GetStartNavGraphEdgePtr()
const {
return m_startNavGraphEdgePtr; }
257 KY_INLINE
const NavGraphVertexPtr& BaseAStarQuery::GetStartNavGraphVertexPtr()
const {
return m_startNavGraphVertexPtr; }
258 KY_INLINE
const NavTrianglePtr& BaseAStarQuery::GetDestTrianglePtr()
const {
return m_destTrianglePtr; }
259 KY_INLINE
const NavGraphEdgePtr& BaseAStarQuery::GetDestNavGraphEdgePtr()
const {
return m_destNavGraphEdgePtr; }
260 KY_INLINE
const NavGraphVertexPtr& BaseAStarQuery::GetDestNavGraphVertexPtr()
const {
return m_destNavGraphVertexPtr; }
261 KY_INLINE Path* BaseAStarQuery::GetPath()
const {
return m_path; }
262 KY_INLINE Path* BaseAStarQuery::GetAbstractPath()
const {
return m_abstractPath; }
265 KY_INLINE
const ChannelComputerConfig& BaseAStarQuery::GetChannelComputerConfig()
const {
return m_channelComputerConfig; }
269 KY_INLINE
KyFloat32 BaseAStarQuery::GetFromOutsideNavMeshDistance()
const {
return m_traversalParams.GetFromOutsideNavMeshDistance(); }
270 KY_INLINE
KyFloat32 BaseAStarQuery::GetToOutsideNavMeshDistance()
const {
return m_traversalParams.GetToOutsideNavMeshDistance(); }
271 KY_INLINE
KyUInt32 BaseAStarQuery::GetNumberOfProcessedNodePerFrame()
const {
return m_traversalParams.GetNumberOfProcessedNodePerFrame(); }
272 KY_INLINE
const Vec3f& BaseAStarQuery::GetStartPos()
const {
return IPathFinderQuery::GetStartPos(); }
274 KY_INLINE
void BaseAStarQuery::SetFromOutsideNavMeshDistance(
KyFloat32 fromOutsideNavMeshDistance)
276 m_traversalParams.SetFromOutsideNavMeshDistance(fromOutsideNavMeshDistance);
278 KY_INLINE
void BaseAStarQuery::SetToOutsideNavMeshDistance(
KyFloat32 toOutsideNavMeshDistance)
280 m_traversalParams.SetToOutsideNavMeshDistance(toOutsideNavMeshDistance);
282 KY_INLINE
void BaseAStarQuery::SetNumberOfProcessedNodePerFrame(
KyUInt32 numberOfProcessedNodePerFrame)
284 m_traversalParams.SetNumberOfProcessedNodePerFrame(numberOfProcessedNodePerFrame);
286 KY_INLINE
void BaseAStarQuery::SetPositionSpatializationRange(
const PositionSpatializationRange& positionSpatializationRange)
288 m_traversalParams.SetPositionSpatializationRange(positionSpatializationRange);
293 m_traversalParams.SetAbstractGraphTraversalMode(abstractGraphTraversalMode);
298 return m_traversalParams.GetAbstractGraphTraversalMode();
301 KY_INLINE
const PositionSpatializationRange& BaseAStarQuery::GetPositionSpatializationRange()
const {
return m_traversalParams.GetPositionSpatializationRange(); }
303 KY_INLINE
void BaseAStarQuery::ComputePathRefinerConfigInternals() { m_pathRefinerConfig.ComputeInternals();}
304 KY_INLINE
const PathRefinerConfig& BaseAStarQuery::GetPathRefinerConfig()
const {
return m_pathRefinerConfig;}
305 KY_INLINE
void BaseAStarQuery::SetPathClamperFlagMask(PathClamperFlagMask pathClamperFlagMask) { m_pathClamperFlagMask = pathClamperFlagMask; }
308 #endif //Navigation_BaseAstarQuery_H
ChannelComputerConfig m_channelComputerConfig
The parameter set specific to Channels computation.
Definition: ipathfinderquery.h:103
bool IsValid() const
Returns true if this object refers to a valid triangle: i.e. a triangle in a validNavFloor. see NavFloorPtr::IsValid().
Definition: navtriangleptr.h:132
NavTrianglePtr m_startTrianglePtr
The NavMesh triangle that corresponds to m_startPos3f.
Definition: baseastarquery.h:165
void Invalidate()
Invalidates this object.
Definition: navtriangleptr.h:134
Indicates that a path could not be found between the start and destination points.
Definition: baseastarquery.h:50
bool IsValid() const
Returns true if this object refers to a valid NavGraphVertex: i.e. a NavGraphVertex in a validNavGrap...
Definition: navgraphvertexptr.h:113
Vec3f m_destInsidePos3f
if m_destPos3f is slightly outside and we hook on the NavMesh, it is the computed inside pos...
Definition: baseastarquery.h:189
PathFinderQueryComputeChannelMode
This enum tells if the PathFinderQuery should compute Channels around path sections laying on the Nav...
Definition: ipathfinderquery.h:28
Vec3f m_startInsidePos3f
if m_startPos3f is slightly outside and we hook on the NavMesh, it is the computed inside pos...
Definition: baseastarquery.h:188
Unused. Kept here for backward compatibility.
Definition: baseastarquery.h:43
KyFloat32 m_propagationBoxExtent
the propagation is limited to a 2d oriented bounding box computed by inflating the segment going from...
Definition: baseastarquery.h:196
Indicates that a computation error caused the query to stop.
Definition: baseastarquery.h:55
Indicates that insufficient working memory caused the query to stop.
Definition: baseastarquery.h:52
void Invalidate()
Invalidates this object.
Definition: navgraphvertexptr.h:114
Indicates that a computation error caused the query to stop.
Definition: baseastarquery.h:53
Indicates that the refined path is being clamped to navMesh according to the altitude tolerance...
Definition: baseastarquery.h:41
Indicates that the NavTag at the starting point is forbidden.
Definition: baseastarquery.h:47
Indicates the query has not yet been launched.
Definition: baseastarquery.h:32
Indicates that the channel is initialized, the channel is being computed.
Definition: baseastarquery.h:44
void Invalidate()
Invalidates this object.
Definition: navgraphedgeptr.h:130
AStarQueryResult m_result
Updated during processing to indicate the result of the PathFinderQueryResult query.
Definition: baseastarquery.h:201
virtual void DisplayPropagationBounds(ScopedDisplayList &displayList) const
Fill the displayList with display info that may help to understand a PathFinderFailure (mainly propag...
Indicates that the NavTag at the destination point is forbidden.
Definition: baseastarquery.h:49
Indicates that the input channelComputerConfig is invalid.
Definition: baseastarquery.h:54
Ptr< Path > m_path
The Path found by the query.
Definition: ipathfinderquery.h:98
NavGraphEdgeDirection m_navGraphEdgePathfindMode
Whether we should pathfind on that edge both ways or not.
Definition: baseastarquery.h:181
Indicates that the refining process is being initialized.
Definition: baseastarquery.h:37
An internal class that stores parameters used to control the propagation of traversals through the Na...
Definition: traversalparams.h:23
PathFinderQueryComputeChannelMode m_computeChannelMode
The mode toggling Channels computation.
Definition: ipathfinderquery.h:102
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: baseastarquery.h:46
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
Vec3f m_destPos3f
The destination point for the path request.
Definition: baseastarquery.h:187
Indicates that the Astar traversal algorithm has been launched, but has not yet completed.
Definition: baseastarquery.h:34
Indicates the query has not yet been initialized.
Definition: baseastarquery.h:31
Indicates that the refiner is done, but the path has not yet been clamped to the navMesh.
Definition: baseastarquery.h:40
PathFinderAbstractGraphTraversalMode
Enumerates the possible way of dealing with AbstractGraphs.
Definition: pathfinderabstractgraphtraversalmode.h:16
Indicates that the computation has been canceled.
Definition: baseastarquery.h:56
AStarQueryTryCanGoMode
This enums tells if the AstarQuery should try to perform a RayCanGoQuery from start position to desti...
Definition: baseastarquery.h:70
Definition: gamekitcrowddispersion.h:20
virtual void GetPathFinderTextResult(String &) const
Fills the String with an explanation of the result. Use this to debug your pathfinder query...
Ptr< Path > m_abstractPath
The Abstract Path found by the query.
Definition: baseastarquery.h:199
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexptr.h:22
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
PathFinderResult
Enumerates the possible status of a IPathFinderQuery.
Definition: ipathfinderquery.h:43
Indicates that the cost from nodes that are on navMesh are beeing recomputed since they may have been...
Definition: baseastarquery.h:38
NavGraphEdgePtr m_startNavGraphEdgePtr
When this NavGraph edge is valid, that means that you want the path to start with that edge...
Definition: baseastarquery.h:177
Indicates that query starting location and ending location are equals. computing a Path would have le...
Definition: baseastarquery.h:58
NavGraphVertexPtr m_startNavGraphVertexPtr
When this NavGraph vertex is valid, that means that you want the path to start at that vertice...
Definition: baseastarquery.h:184
Indicates that the query has stopped and must be relaunched because of a change in the NavData...
Definition: baseastarquery.h:51
Indicates that the clamping algorithm has completed, but the path has not yet been built...
Definition: baseastarquery.h:42
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
Indicates that the Astar traversal algorithm traversed AbstractGraph, and the Abstract path is being ...
Definition: baseastarquery.h:36
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
bool IsValid() const
Returns true if this object refers to a valid NavGraphEdge: i.e. a NavGraphEdge in a valid NavGraph...
Definition: navgraphedgeptr.h:129
Indicates that the Astar traversal algorithm is finished, and that a path is found and is prepared to...
Definition: baseastarquery.h:35
Indicates that the query has not yet been launched.
Definition: iquery.h:347
virtual const Vec3f * GetDestination() const
This function is virtual because not all the PathFinders have a preset destination, it may return KY_NULL.
Definition: baseastarquery.h:280
Indicates that the destination point of the query is outside the NavMesh.
Definition: baseastarquery.h:48
Each instance of this class uniquely identifies a single and mono-directionnal NavGraphEdge in a NavG...
Definition: navgraphedgeptr.h:25
void Initialize()
Should be called by the derived class before trying to perform the query or to push it in a QueryQueu...
Definition: iquery.h:404
Indicates that a path has been found between the start and destination.
Definition: baseastarquery.h:59
Indicates that the path found is being refined.
Definition: baseastarquery.h:39
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
NavTrianglePtr m_destTrianglePtr
The NavMesh triangle that corresponds to m_destPos3f.
Definition: baseastarquery.h:173
AStarQueryResult
Enumerates the possible results of an AStarQuery.
Definition: baseastarquery.h:29