Recast Navigation
Navigation-mesh Toolset for Games
DetourLocalBoundary.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 DETOURLOCALBOUNDARY_H
20 #define DETOURLOCALBOUNDARY_H
21 
22 #include "DetourNavMeshQuery.h"
23 
24 
26 {
27  static const int MAX_LOCAL_SEGS = 8;
28  static const int MAX_LOCAL_POLYS = 16;
29 
30  struct Segment
31  {
32  float s[6];
33  float d;
34  };
35 
36  float m_center[3];
37  Segment m_segs[MAX_LOCAL_SEGS];
38  int m_nsegs;
39 
40  dtPolyRef m_polys[MAX_LOCAL_POLYS];
41  int m_npolys;
42 
43  void addSegment(const float dist, const float* s);
44 
45 public:
48 
49  void reset();
50 
51  void update(dtPolyRef ref, const float* pos, const float collisionQueryRange,
52  dtNavMeshQuery* navquery, const dtQueryFilter* filter);
53 
54  bool isValid(dtNavMeshQuery* navquery, const dtQueryFilter* filter);
55 
56  inline const float* getCenter() const { return m_center; }
57  inline int getSegmentCount() const { return m_nsegs; }
58  inline const float* getSegment(int i) const { return m_segs[i].s; }
59 
60 private:
61  // Explicitly disabled copy constructor and copy assignment operator.
63  dtLocalBoundary& operator=(const dtLocalBoundary&);
64 };
65 
66 #endif // DETOURLOCALBOUNDARY_H
Definition: DetourLocalBoundary.h:26
int getSegmentCount() const
Definition: DetourLocalBoundary.h:57
const float * getSegment(int i) const
Definition: DetourLocalBoundary.h:58
void update(dtPolyRef ref, const float *pos, const float collisionQueryRange, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition: DetourLocalBoundary.cpp:84
void reset()
Definition: DetourLocalBoundary.cpp:38
~dtLocalBoundary()
Definition: DetourLocalBoundary.cpp:34
const float * getCenter() const
Definition: DetourLocalBoundary.h:56
dtLocalBoundary()
Definition: DetourLocalBoundary.cpp:27
bool isValid(dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition: DetourLocalBoundary.cpp:123
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition: DetourNavMeshQuery.h:166
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