| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef DETOURLOCALBOUNDARY_H |
| 20 |
#define DETOURLOCALBOUNDARY_H |
| 21 |
|
| 22 |
#include "DetourNavMeshQuery.h" |
| 23 |
|
| 24 |
|
| 25 |
class dtLocalBoundary |
| 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: |
| 46 |
dtLocalBoundary(); |
| 47 |
~dtLocalBoundary(); |
| 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 |
|
| 62 |
dtLocalBoundary(const dtLocalBoundary&); |
| 63 |
dtLocalBoundary& operator=(const dtLocalBoundary&); |
| 64 |
}; |
| 65 |
|
| 66 |
#endif |