Planeshift
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* seg);
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 
61 #endif // DETOURLOCALBOUNDARY_H
int getSegmentCount() const
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition: DetourNavMesh.h:30
bool isValid(dtNavMeshQuery *navquery, const dtQueryFilter *filter)
const float * getCenter() const
const float * getSegment(int i) const
Defines polygon filtering and traversal costs for navigation mesh query operations.
Provides the ability to perform pathfinding related queries against a navigation mesh.
void update(dtPolyRef ref, const float *pos, const float collisionQueryRange, dtNavMeshQuery *navquery, const dtQueryFilter *filter)