rcBuildRegionsMonotone works again too.
This commit is contained in:
parent
9b881bde8c
commit
9035462e86
@ -547,13 +547,11 @@ bool rcBuildRegions(rcCompactHeightfield& chf,
|
|||||||
// removed or merged to neighbour region.
|
// removed or merged to neighbour region.
|
||||||
// Params:
|
// Params:
|
||||||
// chf - (in/out) compact heightfield representing the open space.
|
// chf - (in/out) compact heightfield representing the open space.
|
||||||
// walkableRadius - (in) the radius of the agent.
|
|
||||||
// minRegionSize - (in) the smallest allowed regions size.
|
// minRegionSize - (in) the smallest allowed regions size.
|
||||||
// maxMergeRegionSize - (in) the largest allowed regions size which can be merged.
|
// maxMergeRegionSize - (in) the largest allowed regions size which can be merged.
|
||||||
// Returns false if operation ran out of memory.
|
// Returns false if operation ran out of memory.
|
||||||
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
||||||
int walkableRadius, int borderSize,
|
int borderSize, int minRegionSize, int mergeRegionSize);
|
||||||
int minRegionSize, int mergeRegionSize);
|
|
||||||
|
|
||||||
// Builds simplified contours from the regions outlines.
|
// Builds simplified contours from the regions outlines.
|
||||||
// Params:
|
// Params:
|
||||||
|
@ -991,7 +991,7 @@ struct rcSweepSpan
|
|||||||
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
||||||
int borderSize, int minRegionSize, int mergeRegionSize)
|
int borderSize, int minRegionSize, int mergeRegionSize)
|
||||||
{
|
{
|
||||||
/* rcTimeVal startTime = rcGetPerformanceTimer();
|
rcTimeVal startTime = rcGetPerformanceTimer();
|
||||||
|
|
||||||
const int w = chf.width;
|
const int w = chf.width;
|
||||||
const int h = chf.height;
|
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)
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
{
|
{
|
||||||
const rcCompactSpan& s = chf.spans[i];
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
if (chf.dist[i] < minLevel) continue;
|
if (chf.areas[i] == RC_NULL_AREA) continue;
|
||||||
|
|
||||||
// -x
|
// -x
|
||||||
unsigned short previd = 0;
|
unsigned short previd = 0;
|
||||||
@ -1056,7 +1056,7 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
|||||||
const int ax = x + rcGetDirOffsetX(0);
|
const int ax = x + rcGetDirOffsetX(0);
|
||||||
const int ay = y + rcGetDirOffsetY(0);
|
const int ay = y + rcGetDirOffsetY(0);
|
||||||
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 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];
|
previd = srcReg[ai];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,7 +1074,7 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
|||||||
const int ax = x + rcGetDirOffsetX(3);
|
const int ax = x + rcGetDirOffsetX(3);
|
||||||
const int ay = y + rcGetDirOffsetY(3);
|
const int ay = y + rcGetDirOffsetY(3);
|
||||||
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 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];
|
unsigned short nr = srcReg[ai];
|
||||||
if (!sweeps[previd].nei || sweeps[previd].nei == nr)
|
if (!sweeps[previd].nei || sweeps[previd].nei == nr)
|
||||||
@ -1141,7 +1141,6 @@ bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
|
|||||||
rcGetBuildTimes()->buildRegions += rcGetDeltaTimeUsec(startTime, endTime);
|
rcGetBuildTimes()->buildRegions += rcGetDeltaTimeUsec(startTime, endTime);
|
||||||
rcGetBuildTimes()->buildRegionsFilter += rcGetDeltaTimeUsec(filterStartTime, filterEndTime);
|
rcGetBuildTimes()->buildRegionsFilter += rcGetDeltaTimeUsec(filterStartTime, filterEndTime);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user