rcBuildRegionsMonotone works again too.

This commit is contained in:
Mikko Mononen 2010-02-01 14:57:26 +00:00
parent 9b881bde8c
commit 9035462e86
2 changed files with 5 additions and 8 deletions

View File

@ -547,13 +547,11 @@ bool rcBuildRegions(rcCompactHeightfield& chf,
// removed or merged to neighbour region.
// Params:
// chf - (in/out) compact heightfield representing the open space.
// walkableRadius - (in) the radius of the agent.
// minRegionSize - (in) the smallest allowed regions size.
// maxMergeRegionSize - (in) the largest allowed regions size which can be merged.
// Returns false if operation ran out of memory.
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
int walkableRadius, int borderSize,
int minRegionSize, int mergeRegionSize);
int borderSize, int minRegionSize, int mergeRegionSize);
// Builds simplified contours from the regions outlines.
// Params:

View File

@ -991,7 +991,7 @@ struct rcSweepSpan
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
int borderSize, int minRegionSize, int mergeRegionSize)
{
/* rcTimeVal startTime = rcGetPerformanceTimer();
rcTimeVal startTime = rcGetPerformanceTimer();
const int w = chf.width;
const int h = chf.height;
@ -1047,7 +1047,7 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
{
const rcCompactSpan& s = chf.spans[i];
if (chf.dist[i] < minLevel) continue;
if (chf.areas[i] == RC_NULL_AREA) continue;
// -x
unsigned short previd = 0;
@ -1056,7 +1056,7 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
const int ax = x + rcGetDirOffsetX(0);
const int ay = y + rcGetDirOffsetY(0);
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 0);
if ((srcReg[ai] & RC_BORDER_REG) == 0)
if ((srcReg[ai] & RC_BORDER_REG) == 0 && chf.areas[i] == chf.areas[ai])
previd = srcReg[ai];
}
@ -1074,7 +1074,7 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
const int ax = x + rcGetDirOffsetX(3);
const int ay = y + rcGetDirOffsetY(3);
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 3);
if (srcReg[ai] && (srcReg[ai] & RC_BORDER_REG) == 0)
if (srcReg[ai] && (srcReg[ai] & RC_BORDER_REG) == 0 && chf.areas[i] == chf.areas[ai])
{
unsigned short nr = srcReg[ai];
if (!sweeps[previd].nei || sweeps[previd].nei == nr)
@ -1141,7 +1141,6 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
rcGetBuildTimes()->buildRegions += rcGetDeltaTimeUsec(startTime, endTime);
rcGetBuildTimes()->buildRegionsFilter += rcGetDeltaTimeUsec(filterStartTime, filterEndTime);
}
*/
return true;
}