Changed dtNavmeshQuery.getPolyWallSegments() to require max number of segments to store.

This commit is contained in:
Mikko Mononen
2010-10-15 06:35:40 +00:00
parent ab9ada50c5
commit c9df5dc995
7 changed files with 177 additions and 656 deletions

View File

@@ -497,17 +497,20 @@ void PathCorridor::updateLocalNeighbourhood(const float collisionQueryRange, dtN
return;
dtVcopy(m_localCenter, m_pos);
// First query non-overlapping polygons.
static const int MAX_LOCALS = 32;
dtPolyRef locals[MAX_LOCALS];
const int nlocals = navquery->findLocalNeighbourhood(m_path[0], m_pos, collisionQueryRange,
filter, locals, 0, MAX_LOCALS);
// Secondly, store all polygon edges.
m_localSegCount = 0;
for (int j = 0; j < nlocals; ++j)
{
float segs[DT_VERTS_PER_POLYGON*3*2];
const int nsegs = navquery->getPolyWallSegments(locals[j], filter, segs);
static const int MAX_SEGS = DT_VERTS_PER_POLYGON*2;
float segs[MAX_SEGS*6];
const int nsegs = navquery->getPolyWallSegments(locals[j], filter, segs, MAX_SEGS);
for (int k = 0; k < nsegs; ++k)
{
const float* s = &segs[k*6];