Recast Navigation
Navigation-mesh Toolset for Games
DetourPathQueue.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 // Permission is granted to anyone to use this software for any purpose,
8 // including commercial applications, and to alter it and redistribute it
9 // freely, subject to the following restrictions:
10 // 1. The origin of this software must not be misrepresented; you must not
11 // claim that you wrote the original software. If you use this software
12 // in a product, an acknowledgment in the product documentation would be
13 // appreciated but is not required.
14 // 2. Altered source versions must be plainly marked as such, and must not be
15 // misrepresented as being the original software.
16 // 3. This notice may not be removed or altered from any source distribution.
17 //
18 
19 #ifndef DETOURPATHQUEUE_H
20 #define DETOURPATHQUEUE_H
21 
22 #include "DetourNavMesh.h"
23 #include "DetourNavMeshQuery.h"
24 
25 static const unsigned int DT_PATHQ_INVALID = 0;
26 
27 typedef unsigned int dtPathQueueRef;
28 
30 {
31  struct PathQuery
32  {
33  dtPathQueueRef ref;
35  float startPos[3], endPos[3];
36  dtPolyRef startRef, endRef;
38  dtPolyRef* path;
39  int npath;
41  dtStatus status;
42  int keepAlive;
43  const dtQueryFilter* filter;
44  };
45 
46  static const int MAX_QUEUE = 8;
47  PathQuery m_queue[MAX_QUEUE];
48  dtPathQueueRef m_nextHandle;
49  int m_maxPathSize;
50  int m_queueHead;
51  dtNavMeshQuery* m_navquery;
52 
53  void purge();
54 
55 public:
56  dtPathQueue();
57  ~dtPathQueue();
58 
59  bool init(const int maxPathSize, const int maxSearchNodeCount, dtNavMesh* nav);
60 
61  void update(const int maxIters);
62 
63  dtPathQueueRef request(dtPolyRef startRef, dtPolyRef endRef,
64  const float* startPos, const float* endPos,
65  const dtQueryFilter* filter);
66 
68 
69  dtStatus getPathResult(dtPathQueueRef ref, dtPolyRef* path, int* pathSize, const int maxPath);
70 
71  inline const dtNavMeshQuery* getNavQuery() const { return m_navquery; }
72 
73 private:
74  // Explicitly disabled copy constructor and copy assignment operator.
75  dtPathQueue(const dtPathQueue&);
76  dtPathQueue& operator=(const dtPathQueue&);
77 };
78 
79 #endif // DETOURPATHQUEUE_H
static const unsigned int DT_PATHQ_INVALID
Definition: DetourPathQueue.h:25
unsigned int dtPathQueueRef
Definition: DetourPathQueue.h:27
unsigned int dtStatus
Definition: DetourStatus.h:22
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition: DetourNavMeshQuery.h:166
A navigation mesh based on tiles of convex polygons.
Definition: DetourNavMesh.h:339
Definition: DetourPathQueue.h:30
dtStatus getRequestStatus(dtPathQueueRef ref) const
Definition: DetourPathQueue.cpp:171
~dtPathQueue()
Definition: DetourPathQueue.cpp:37
dtPathQueue()
Definition: DetourPathQueue.cpp:27
dtStatus getPathResult(dtPathQueueRef ref, dtPolyRef *path, int *pathSize, const int maxPath)
Definition: DetourPathQueue.cpp:181
void update(const int maxIters)
Definition: DetourPathQueue.cpp:77
dtPathQueueRef request(dtPolyRef startRef, dtPolyRef endRef, const float *startPos, const float *endPos, const dtQueryFilter *filter)
Definition: DetourPathQueue.cpp:135
const dtNavMeshQuery * getNavQuery() const
Definition: DetourPathQueue.h:71
bool init(const int maxPathSize, const int maxSearchNodeCount, dtNavMesh *nav)
Definition: DetourPathQueue.cpp:53
Defines polygon filtering and traversal costs for navigation mesh query operations.
Definition: DetourNavMeshQuery.h:36
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition: DetourNavMesh.h:48