Added PLC_Navigation hint for gathering navmesh polygon data.

This commit is contained in:
Daniel Buckmaster 2013-07-04 17:23:23 +10:00
parent 95ef5ec226
commit d9c731b73f
4 changed files with 77 additions and 2 deletions

View file

@ -480,7 +480,7 @@ static void clrbuf(U32* p, U32 s)
*p++ = U32_MAX;
}
bool TerrainBlock::buildPolyList(PolyListContext, AbstractPolyList* polyList, const Box3F &box, const SphereF&)
bool TerrainBlock::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF&)
{
PROFILE_SCOPE( TerrainBlock_buildPolyList );
@ -530,12 +530,25 @@ bool TerrainBlock::buildPolyList(PolyListContext, AbstractPolyList* polyList, co
swap(vb[0],vb[1]);
clrbuf(vb[1],xExt + 1);
F32 wy1 = y * mSquareSize, wy2 = (y + 1) * mSquareSize;
if(context == PLC_Navigation &&
((wy1 > osBox.maxExtents.y && wy2 > osBox.maxExtents.y) ||
(wy1 < osBox.minExtents.y && wy2 < osBox.minExtents.y)))
continue;
//
for (S32 x = xStart; x < xEnd; x++)
{
S32 xi = x & BlockMask;
const TerrainSquare *sq = mFile->findSquare( 0, xi, yi );
F32 wx1 = x * mSquareSize, wx2 = (x + 1) * mSquareSize;
if(context == PLC_Navigation &&
((wx1 > osBox.maxExtents.x && wx2 > osBox.maxExtents.x) ||
(wx1 < osBox.minExtents.x && wx2 < osBox.minExtents.x)))
continue;
if ( x != xi || y != yi )
continue;