Renamed 'region size' to 'region area' and improved documentation.

This commit is contained in:
Mikko Mononen 2010-10-10 11:04:13 +00:00
parent b429ee7304
commit ab9ada50c5
8 changed files with 200 additions and 99 deletions

View File

@ -115,8 +115,8 @@ struct rcConfig
int walkableRadius; // Radius of the agent in cells (vx) int walkableRadius; // Radius of the agent in cells (vx)
int maxEdgeLen; // Maximum contour edge length (vx) int maxEdgeLen; // Maximum contour edge length (vx)
float maxSimplificationError; // Maximum distance error from contour to cells (vx) float maxSimplificationError; // Maximum distance error from contour to cells (vx)
int minRegionSize; // Minimum regions size. Smaller regions will be deleted (vx) int minRegionArea; // Regions whose area is smaller than this threshold will be removed. (vx)
int mergeRegionSize; // Minimum regions size. Smaller regions will be merged (vx) int mergeRegionArea; // Regions whose area is smaller than this threshold will be merged (vx)
int maxVertsPerPoly; // Max number of vertices per polygon int maxVertsPerPoly; // Max number of vertices per polygon
float detailSampleDist; // Detail mesh sample spacing. float detailSampleDist; // Detail mesh sample spacing.
float detailSampleMaxError; // Detail mesh simplification max sample error. float detailSampleMaxError; // Detail mesh simplification max sample error.
@ -619,32 +619,34 @@ bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf);
// Divides the walkable heighfied into simple regions using watershed partitioning. // Divides the walkable heighfied into simple regions using watershed partitioning.
// Each region has only one contour and no overlaps. // Each region has only one contour and no overlaps.
// The regions are stored in the compact heightfield 'reg' field. // The regions are stored in the compact heightfield 'reg' field.
// The process sometimes creates small regions. The parameter // The process sometimes creates small regions. If the area of a regions is
// 'minRegionSize' specifies the smallest allowed regions size. // smaller than 'mergeRegionArea' then the region will be merged with a neighbour
// If the area of a regions is smaller than allowed, the regions is // region if possible. If multiple regions form an area which is smaller than
// removed or merged to neighbour region. // 'minRegionArea' all the regions belonging to that area will be removed.
// Here area means the count of spans in an area.
// Params: // Params:
// chf - (in/out) compact heightfield representing the open space. // chf - (in/out) compact heightfield representing the open space.
// minRegionSize - (in) the smallest allowed regions size. // minRegionArea - (in) the smallest allowed region area.
// maxMergeRegionSize - (in) the largest allowed regions size which can be merged. // maxMergeRegionArea - (in) the largest allowed region area which can be merged.
// Returns false if operation ran out of memory. // Returns false if operation ran out of memory.
bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf, bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
const int borderSize, const int minRegionSize, const int mergeRegionSize); const int borderSize, const int minRegionArea, const int mergeRegionArea);
// Divides the walkable heighfied into simple regions using simple monotone partitioning. // Divides the walkable heighfied into simple regions using simple monotone partitioning.
// Each region has only one contour and no overlaps. // Each region has only one contour and no overlaps.
// The regions are stored in the compact heightfield 'reg' field. // The regions are stored in the compact heightfield 'reg' field.
// The process sometimes creates small regions. The parameter // The process sometimes creates small regions. If the area of a regions is
// 'minRegionSize' specifies the smallest allowed regions size. // smaller than 'mergeRegionArea' then the region will be merged with a neighbour
// If the area of a regions is smaller than allowed, the regions is // region if possible. If multiple regions form an area which is smaller than
// removed or merged to neighbour region. // 'minRegionArea' all the regions belonging to that area will be removed.
// Here area means the count of spans in an area.
// Params: // Params:
// chf - (in/out) compact heightfield representing the open space. // chf - (in/out) compact heightfield representing the open space.
// minRegionSize - (in) the smallest allowed regions size. // minRegionArea - (in) the smallest allowed regions size.
// maxMergeRegionSize - (in) the largest allowed regions size which can be merged. // maxMergeRegionArea - (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(rcContext* ctx, rcCompactHeightfield& chf, bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
const int borderSize, const int minRegionSize, const int mergeRegionSize); const int borderSize, const int minRegionArea, const int mergeRegionArea);
// Builds simplified contours from the regions outlines. // Builds simplified contours from the regions outlines.
// Params: // Params:

View File

@ -438,16 +438,16 @@ static unsigned short* expandRegions(int maxIter, unsigned short level,
struct rcRegion struct rcRegion
{ {
inline rcRegion(unsigned short i) : inline rcRegion(unsigned short i) :
count(0), spanCount(0),
id(i), id(i),
area(0), areaType(0),
remap(false), remap(false),
visited(false) visited(false)
{} {}
int count; int spanCount; // Number of spans belonging to this region
unsigned short id; unsigned short id; // ID of the region
unsigned char area; unsigned char areaType; // Are type.
bool remap; bool remap;
bool visited; bool visited;
rcIntArray connections; rcIntArray connections;
@ -494,7 +494,7 @@ static void replaceNeighbour(rcRegion& reg, unsigned short oldId, unsigned short
static bool canMergeWithRegion(const rcRegion& rega, const rcRegion& regb) static bool canMergeWithRegion(const rcRegion& rega, const rcRegion& regb)
{ {
if (rega.area != regb.area) if (rega.areaType != regb.areaType)
return false; return false;
int n = 0; int n = 0;
for (int i = 0; i < rega.connections.size(); ++i) for (int i = 0; i < rega.connections.size(); ++i)
@ -570,8 +570,8 @@ static bool mergeRegions(rcRegion& rega, rcRegion& regb)
for (int j = 0; j < regb.floors.size(); ++j) for (int j = 0; j < regb.floors.size(); ++j)
addUniqueFloorRegion(rega, regb.floors[j]); addUniqueFloorRegion(rega, regb.floors[j]);
rega.count += regb.count; rega.spanCount += regb.spanCount;
regb.count = 0; regb.spanCount = 0;
regb.connections.resize(0); regb.connections.resize(0);
return true; return true;
@ -694,7 +694,7 @@ static void walkContour(int x, int y, int i, int dir,
} }
} }
static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegionSize, static bool filterSmallRegions(rcContext* ctx, int minRegionArea, int mergeRegionSize,
unsigned short& maxRegionId, unsigned short& maxRegionId,
rcCompactHeightfield& chf, rcCompactHeightfield& chf,
unsigned short* srcReg) unsigned short* srcReg)
@ -727,7 +727,7 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
continue; continue;
rcRegion& reg = regions[r]; rcRegion& reg = regions[r];
reg.count++; reg.spanCount++;
// Update floors. // Update floors.
@ -744,7 +744,7 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
if (reg.connections.size() > 0) if (reg.connections.size() > 0)
continue; continue;
reg.area = chf.areas[i]; reg.areaType = chf.areas[i];
// Check if this cell is next to a border. // Check if this cell is next to a border.
int ndir = -1; int ndir = -1;
@ -775,7 +775,7 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
rcRegion& reg = regions[i]; rcRegion& reg = regions[i];
if (reg.id == 0 || (reg.id & RC_BORDER_REG)) if (reg.id == 0 || (reg.id & RC_BORDER_REG))
continue; continue;
if (reg.count == 0) if (reg.spanCount == 0)
continue; continue;
if (reg.visited) if (reg.visited)
continue; continue;
@ -783,7 +783,7 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
// Count the total size of all the connected regions. // Count the total size of all the connected regions.
// Also keep track of the regions connects to a tile border. // Also keep track of the regions connects to a tile border.
bool connectsToBorder = false; bool connectsToBorder = false;
int count = 0; int spanCount = 0;
stack.resize(0); stack.resize(0);
trace.resize(0); trace.resize(0);
@ -797,7 +797,7 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
rcRegion& creg = regions[ri]; rcRegion& creg = regions[ri];
count += creg.count; spanCount += creg.spanCount;
trace.push(ri); trace.push(ri);
for (int j = 0; j < creg.connections.size(); ++j) for (int j = 0; j < creg.connections.size(); ++j)
@ -822,12 +822,12 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
// Do not remove areas which connect to tile borders // Do not remove areas which connect to tile borders
// as their size cannot be estimated correctly and removing them // as their size cannot be estimated correctly and removing them
// can potentially remove necessary areas. // can potentially remove necessary areas.
if (count < minRegionSize && !connectsToBorder) if (spanCount < minRegionArea && !connectsToBorder)
{ {
// Kill all visited regions. // Kill all visited regions.
for (int j = 0; j < trace.size(); ++j) for (int j = 0; j < trace.size(); ++j)
{ {
regions[trace[j]].count = 0; regions[trace[j]].spanCount = 0;
regions[trace[j]].id = 0; regions[trace[j]].id = 0;
} }
} }
@ -843,11 +843,11 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
rcRegion& reg = regions[i]; rcRegion& reg = regions[i];
if (reg.id == 0 || (reg.id & RC_BORDER_REG)) if (reg.id == 0 || (reg.id & RC_BORDER_REG))
continue; continue;
if (reg.count == 0) if (reg.spanCount == 0)
continue; continue;
// Check to see if the region should be merged. // Check to see if the region should be merged.
if (reg.count > mergeRegionSize && isRegionConnectedToBorder(reg)) if (reg.spanCount > mergeRegionSize && isRegionConnectedToBorder(reg))
continue; continue;
// Small region with more than 1 connection. // Small region with more than 1 connection.
@ -860,11 +860,11 @@ static bool filterSmallRegions(rcContext* ctx, int minRegionSize, int mergeRegio
if (reg.connections[j] & RC_BORDER_REG) continue; if (reg.connections[j] & RC_BORDER_REG) continue;
rcRegion& mreg = regions[reg.connections[j]]; rcRegion& mreg = regions[reg.connections[j]];
if (mreg.id == 0 || (mreg.id & RC_BORDER_REG)) continue; if (mreg.id == 0 || (mreg.id & RC_BORDER_REG)) continue;
if (mreg.count < smallest && if (mreg.spanCount < smallest &&
canMergeWithRegion(reg, mreg) && canMergeWithRegion(reg, mreg) &&
canMergeWithRegion(mreg, reg)) canMergeWithRegion(mreg, reg))
{ {
smallest = mreg.count; smallest = mreg.spanCount;
mergeId = mreg.id; mergeId = mreg.id;
} }
} }
@ -1022,7 +1022,7 @@ struct rcSweepSpan
}; };
bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf, bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
const int borderSize, const int minRegionSize, const int mergeRegionSize) const int borderSize, const int minRegionArea, const int mergeRegionArea)
{ {
rcAssert(ctx); rcAssert(ctx);
@ -1153,7 +1153,7 @@ bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
// Filter out small regions. // Filter out small regions.
chf.maxRegions = id; chf.maxRegions = id;
if (!filterSmallRegions(ctx, minRegionSize, mergeRegionSize, chf.maxRegions, chf, srcReg)) if (!filterSmallRegions(ctx, minRegionArea, mergeRegionArea, chf.maxRegions, chf, srcReg))
return false; return false;
ctx->stopTimer(RC_TIMER_BUILD_REGIONS_FILTER); ctx->stopTimer(RC_TIMER_BUILD_REGIONS_FILTER);
@ -1168,7 +1168,7 @@ bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
} }
bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf, bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
const int borderSize, const int minRegionSize, const int mergeRegionSize) const int borderSize, const int minRegionArea, const int mergeRegionArea)
{ {
rcAssert(ctx); rcAssert(ctx);
@ -1263,7 +1263,7 @@ bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
// Filter out small regions. // Filter out small regions.
chf.maxRegions = regionId; chf.maxRegions = regionId;
if (!filterSmallRegions(ctx, minRegionSize, mergeRegionSize, chf.maxRegions, chf, srcReg)) if (!filterSmallRegions(ctx, minRegionArea, mergeRegionArea, chf.maxRegions, chf, srcReg))
return false; return false;
ctx->stopTimer(RC_TIMER_BUILD_REGIONS_FILTER); ctx->stopTimer(RC_TIMER_BUILD_REGIONS_FILTER);

View File

@ -220,6 +220,15 @@
6BB2EE3F1261D02000E350F8 /* PBXTextBookmark */ = 6BB2EE3F1261D02000E350F8 /* PBXTextBookmark */; 6BB2EE3F1261D02000E350F8 /* PBXTextBookmark */ = 6BB2EE3F1261D02000E350F8 /* PBXTextBookmark */;
6BB2EE401261D02000E350F8 /* PBXTextBookmark */ = 6BB2EE401261D02000E350F8 /* PBXTextBookmark */; 6BB2EE401261D02000E350F8 /* PBXTextBookmark */ = 6BB2EE401261D02000E350F8 /* PBXTextBookmark */;
6BB2EE411261D02000E350F8 /* PBXTextBookmark */ = 6BB2EE411261D02000E350F8 /* PBXTextBookmark */; 6BB2EE411261D02000E350F8 /* PBXTextBookmark */ = 6BB2EE411261D02000E350F8 /* PBXTextBookmark */;
6BB2EE641261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE641261D48100E350F8 /* PBXTextBookmark */;
6BB2EE651261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE651261D48100E350F8 /* PBXTextBookmark */;
6BB2EE661261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE661261D48100E350F8 /* PBXTextBookmark */;
6BB2EE671261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE671261D48100E350F8 /* PBXTextBookmark */;
6BB2EE681261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE681261D48100E350F8 /* PBXTextBookmark */;
6BB2EE691261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE691261D48100E350F8 /* PBXTextBookmark */;
6BB2EE6A1261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE6A1261D48100E350F8 /* PBXTextBookmark */;
6BB2EE6B1261D48100E350F8 /* PBXTextBookmark */ = 6BB2EE6B1261D48100E350F8 /* PBXTextBookmark */;
6BB2EE6D1261D4A400E350F8 /* PBXTextBookmark */ = 6BB2EE6D1261D4A400E350F8 /* PBXTextBookmark */;
6BBB0361124E242E00533229 = 6BBB0361124E242E00533229 /* PBXTextBookmark */; 6BBB0361124E242E00533229 = 6BBB0361124E242E00533229 /* PBXTextBookmark */;
6BBB0363124E242E00533229 = 6BBB0363124E242E00533229 /* PBXTextBookmark */; 6BBB0363124E242E00533229 = 6BBB0363124E242E00533229 /* PBXTextBookmark */;
6BBB0365124E242E00533229 = 6BBB0365124E242E00533229 /* PBXTextBookmark */; 6BBB0365124E242E00533229 = 6BBB0365124E242E00533229 /* PBXTextBookmark */;
@ -360,9 +369,9 @@
}; };
6B137C7E0F7FCBFE00459200 /* Recast.h */ = { 6B137C7E0F7FCBFE00459200 /* Recast.h */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 8944}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 8606}}";
sepNavSelRange = "{960, 84}"; sepNavSelRange = "{23762, 14}";
sepNavVisRange = "{521, 923}"; sepNavVisRange = "{22925, 2730}";
sepNavWindowFrame = "{{15, 51}, {1214, 722}}"; sepNavWindowFrame = "{{15, 51}, {1214, 722}}";
}; };
}; };
@ -406,9 +415,9 @@
}; };
6B137C890F7FCC1100459200 /* RecastRegion.cpp */ = { 6B137C890F7FCC1100459200 /* RecastRegion.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 17082}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 16926}}";
sepNavSelRange = "{19532, 0}"; sepNavSelRange = "{22090, 0}";
sepNavVisRange = "{17831, 971}"; sepNavVisRange = "{21330, 766}";
}; };
}; };
6B1C8E08121EB4FF0048697F /* PBXTextBookmark */ = { 6B1C8E08121EB4FF0048697F /* PBXTextBookmark */ = {
@ -423,23 +432,23 @@
}; };
6B25B6100FFA62AD004F1BC4 /* Sample.h */ = { 6B25B6100FFA62AD004F1BC4 /* Sample.h */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {933, 1677}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 1976}}";
sepNavSelRange = "{3880, 19}"; sepNavSelRange = "{2579, 0}";
sepNavVisRange = "{3295, 748}"; sepNavVisRange = "{2271, 551}";
}; };
}; };
6B25B6140FFA62BE004F1BC4 /* Sample.cpp */ = { 6B25B6140FFA62BE004F1BC4 /* Sample.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 2769}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 2834}}";
sepNavSelRange = "{2884, 0}"; sepNavSelRange = "{2904, 0}";
sepNavVisRange = "{2623, 1223}"; sepNavVisRange = "{2623, 730}";
}; };
}; };
6B25B6180FFA62BE004F1BC4 /* main.cpp */ = { 6B25B6180FFA62BE004F1BC4 /* main.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 12025}}"; sepNavIntBoundsRect = "{{0, 0}, {1217, 12025}}";
sepNavSelRange = "{20913, 0}"; sepNavSelRange = "{1985, 0}";
sepNavVisRange = "{20575, 601}"; sepNavVisRange = "{1794, 437}";
sepNavWindowFrame = "{{15, 51}, {1214, 722}}"; sepNavWindowFrame = "{{15, 51}, {1214, 722}}";
}; };
}; };
@ -453,9 +462,9 @@
}; };
6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */ = { 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {936, 18560}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 15392}}";
sepNavSelRange = "{25434, 0}"; sepNavSelRange = "{24602, 0}";
sepNavVisRange = "{25185, 649}"; sepNavVisRange = "{23873, 1419}";
sepNavWindowFrame = "{{38, 30}, {1214, 722}}"; sepNavWindowFrame = "{{38, 30}, {1214, 722}}";
}; };
}; };
@ -820,7 +829,7 @@
fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */;
name = "RecastRegion.cpp: 931"; name = "RecastRegion.cpp: 931";
rLen = 0; rLen = 0;
rLoc = 23307; rLoc = 23477;
rType = 0; rType = 0;
vrLen = 751; vrLen = 751;
vrLoc = 21660; vrLoc = 21660;
@ -844,9 +853,9 @@
}; };
6B98463211E6144400FA177B /* Sample_SoloMeshTiled.cpp */ = { 6B98463211E6144400FA177B /* Sample_SoloMeshTiled.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {933, 14560}}"; sepNavIntBoundsRect = "{{0, 0}, {1013, 14274}}";
sepNavSelRange = "{11617, 0}"; sepNavSelRange = "{26519, 0}";
sepNavVisRange = "{11096, 1076}"; sepNavVisRange = "{20368, 1429}";
sepNavWindowFrame = "{{38, 30}, {1214, 722}}"; sepNavWindowFrame = "{{38, 30}, {1214, 722}}";
}; };
}; };
@ -904,9 +913,9 @@
}; };
6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */ = { 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 8307}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 8684}}";
sepNavSelRange = "{11545, 0}"; sepNavSelRange = "{11552, 0}";
sepNavVisRange = "{10675, 1806}"; sepNavVisRange = "{10928, 1315}";
}; };
}; };
6BA1E88E10C7BFD3008007F6 /* Sample_SoloMeshSimple.h */ = { 6BA1E88E10C7BFD3008007F6 /* Sample_SoloMeshSimple.h */ = {
@ -986,7 +995,7 @@
fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */; fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */;
name = "Sample_TileMesh.cpp: 929"; name = "Sample_TileMesh.cpp: 929";
rLen = 0; rLen = 0;
rLoc = 25434; rLoc = 25487;
rType = 0; rType = 0;
vrLen = 649; vrLen = 649;
vrLoc = 25185; vrLoc = 25185;
@ -1691,7 +1700,7 @@
fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */;
name = "RecastRegion.cpp: 849"; name = "RecastRegion.cpp: 849";
rLen = 0; rLen = 0;
rLoc = 19562; rLoc = 19716;
rType = 0; rType = 0;
vrLen = 1078; vrLen = 1078;
vrLoc = 19104; vrLoc = 19104;
@ -1701,7 +1710,7 @@
fRef = 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */; fRef = 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */;
name = "Sample_SoloMeshSimple.cpp: 380"; name = "Sample_SoloMeshSimple.cpp: 380";
rLen = 0; rLen = 0;
rLoc = 11545; rLoc = 11598;
rType = 0; rType = 0;
vrLen = 1806; vrLen = 1806;
vrLoc = 10675; vrLoc = 10675;
@ -1751,7 +1760,7 @@
fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */;
name = "RecastRegion.cpp: 849"; name = "RecastRegion.cpp: 849";
rLen = 0; rLen = 0;
rLoc = 19562; rLoc = 19716;
rType = 0; rType = 0;
vrLen = 1093; vrLen = 1093;
vrLoc = 19103; vrLoc = 19103;
@ -1761,11 +1770,101 @@
fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */;
name = "RecastRegion.cpp: 830"; name = "RecastRegion.cpp: 830";
rLen = 0; rLen = 0;
rLoc = 19532; rLoc = 19686;
rType = 0; rType = 0;
vrLen = 971; vrLen = 971;
vrLoc = 17831; vrLoc = 17831;
}; };
6BB2EE641261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B137C7E0F7FCBFE00459200 /* Recast.h */;
name = "Recast.h: 632";
rLen = 14;
rLoc = 23762;
rType = 0;
vrLen = 2730;
vrLoc = 22925;
};
6BB2EE651261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */;
name = "RecastRegion.cpp: 917";
rLen = 0;
rLoc = 22090;
rType = 0;
vrLen = 766;
vrLoc = 21330;
};
6BB2EE661261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B25B6100FFA62AD004F1BC4 /* Sample.h */;
name = "Sample.h: 87";
rLen = 0;
rLoc = 2579;
rType = 0;
vrLen = 551;
vrLoc = 2271;
};
6BB2EE671261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B25B6140FFA62BE004F1BC4 /* Sample.cpp */;
name = "Sample.cpp: 122";
rLen = 0;
rLoc = 2904;
rType = 0;
vrLen = 730;
vrLoc = 2623;
};
6BB2EE681261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B98463211E6144400FA177B /* Sample_SoloMeshTiled.cpp */;
name = "Sample_SoloMeshTiled.cpp: 866";
rLen = 0;
rLoc = 26519;
rType = 0;
vrLen = 1429;
vrLoc = 20368;
};
6BB2EE691261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */;
name = "Sample_SoloMeshSimple.cpp: 379";
rLen = 0;
rLoc = 11552;
rType = 0;
vrLen = 1315;
vrLoc = 10928;
};
6BB2EE6A1261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */;
name = "Sample_TileMesh.cpp: 903";
rLen = 0;
rLoc = 24421;
rType = 0;
vrLen = 1348;
vrLoc = 23835;
};
6BB2EE6B1261D48100E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */;
name = "Sample_TileMesh.cpp: 903";
rLen = 0;
rLoc = 24453;
rType = 0;
vrLen = 1363;
vrLoc = 23873;
};
6BB2EE6D1261D4A400E350F8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */;
name = "Sample_TileMesh.cpp: 906";
rLen = 0;
rLoc = 24602;
rType = 0;
vrLen = 1419;
vrLoc = 23873;
};
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */ = { 6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {933, 3712}}"; sepNavIntBoundsRect = "{{0, 0}, {933, 3712}}";
@ -2237,7 +2336,7 @@
fRef = 6B137C7E0F7FCBFE00459200 /* Recast.h */; fRef = 6B137C7E0F7FCBFE00459200 /* Recast.h */;
name = "Recast.h: 256"; name = "Recast.h: 256";
rLen = 0; rLen = 0;
rLoc = 9742; rLoc = 9767;
rType = 0; rType = 0;
vrLen = 1723; vrLen = 1723;
vrLoc = 8968; vrLoc = 8968;

View File

@ -284,8 +284,8 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array> <array>
<array> <array>
<integer>34</integer> <integer>48</integer>
<integer>27</integer> <integer>40</integer>
<integer>1</integer> <integer>1</integer>
<integer>0</integer> <integer>0</integer>
</array> </array>
@ -326,7 +326,7 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>6B8632A30F78115100E2684A</string> <string>6B8632A30F78115100E2684A</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>RecastRegion.cpp</string> <string>Sample_TileMesh.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key> <key>PBXSplitModuleInNavigatorKey</key>
<dict> <dict>
<key>Split0</key> <key>Split0</key>
@ -334,11 +334,11 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>6B8632A40F78115100E2684A</string> <string>6B8632A40F78115100E2684A</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>RecastRegion.cpp</string> <string>Sample_TileMesh.cpp</string>
<key>_historyCapacity</key> <key>_historyCapacity</key>
<integer>0</integer> <integer>0</integer>
<key>bookmark</key> <key>bookmark</key>
<string>6BB2EE411261D02000E350F8</string> <string>6BB2EE6D1261D4A400E350F8</string>
<key>history</key> <key>history</key>
<array> <array>
<string>6BBB4AA5115B4F3400CF791D</string> <string>6BBB4AA5115B4F3400CF791D</string>
@ -369,7 +369,6 @@
<string>6BD402B4122441CB00995864</string> <string>6BD402B4122441CB00995864</string>
<string>6B920A521225C0AC00D5B5AD</string> <string>6B920A521225C0AC00D5B5AD</string>
<string>6B920A6D1225C5DD00D5B5AD</string> <string>6B920A6D1225C5DD00D5B5AD</string>
<string>6BA7F8AC1226EF0400C8C47A</string>
<string>6BA7F8EC1227002300C8C47A</string> <string>6BA7F8EC1227002300C8C47A</string>
<string>6BA7F8ED1227002300C8C47A</string> <string>6BA7F8ED1227002300C8C47A</string>
<string>6BA7F8EE1227002300C8C47A</string> <string>6BA7F8EE1227002300C8C47A</string>
@ -406,10 +405,8 @@
<string>6BA8CEEF1255C4B700272A3B</string> <string>6BA8CEEF1255C4B700272A3B</string>
<string>6BA8CF4A1255D44700272A3B</string> <string>6BA8CF4A1255D44700272A3B</string>
<string>6BA8CF4D1255D44700272A3B</string> <string>6BA8CF4D1255D44700272A3B</string>
<string>6BA8CF501255D44700272A3B</string>
<string>6BA8CF511255D44700272A3B</string> <string>6BA8CF511255D44700272A3B</string>
<string>6BA8CF5B1255D49B00272A3B</string> <string>6BA8CF5B1255D49B00272A3B</string>
<string>6BA8CF7C1255D5FE00272A3B</string>
<string>6BA8CF941255D97400272A3B</string> <string>6BA8CF941255D97400272A3B</string>
<string>6BA8CF951255D97400272A3B</string> <string>6BA8CF951255D97400272A3B</string>
<string>6BA8CFA81255DC6500272A3B</string> <string>6BA8CFA81255DC6500272A3B</string>
@ -419,7 +416,6 @@
<string>6BA8D10D125B0E8E00272A3B</string> <string>6BA8D10D125B0E8E00272A3B</string>
<string>6BB2EDF61261C75400E350F8</string> <string>6BB2EDF61261C75400E350F8</string>
<string>6BB2EDF91261C75400E350F8</string> <string>6BB2EDF91261C75400E350F8</string>
<string>6BB2EE231261C92300E350F8</string>
<string>6BB2EE241261C92300E350F8</string> <string>6BB2EE241261C92300E350F8</string>
<string>6BB2EE251261C92300E350F8</string> <string>6BB2EE251261C92300E350F8</string>
<string>6BB2EE261261C92300E350F8</string> <string>6BB2EE261261C92300E350F8</string>
@ -427,10 +423,14 @@
<string>6BB2EE281261C92300E350F8</string> <string>6BB2EE281261C92300E350F8</string>
<string>6BB2EE351261CEB800E350F8</string> <string>6BB2EE351261CEB800E350F8</string>
<string>6BB2EE361261CEB800E350F8</string> <string>6BB2EE361261CEB800E350F8</string>
<string>6BB2EE381261CEB800E350F8</string>
<string>6BB2EE3E1261D02000E350F8</string>
<string>6BB2EE3F1261D02000E350F8</string> <string>6BB2EE3F1261D02000E350F8</string>
<string>6BB2EE401261D02000E350F8</string> <string>6BB2EE641261D48100E350F8</string>
<string>6BB2EE651261D48100E350F8</string>
<string>6BB2EE661261D48100E350F8</string>
<string>6BB2EE671261D48100E350F8</string>
<string>6BB2EE681261D48100E350F8</string>
<string>6BB2EE691261D48100E350F8</string>
<string>6BB2EE6A1261D48100E350F8</string>
</array> </array>
</dict> </dict>
<key>SplitCount</key> <key>SplitCount</key>
@ -444,18 +444,18 @@
<key>GeometryConfiguration</key> <key>GeometryConfiguration</key>
<dict> <dict>
<key>Frame</key> <key>Frame</key>
<string>{{0, 0}, {992, 673}}</string> <string>{{0, 0}, {992, 471}}</string>
<key>RubberWindowFrame</key> <key>RubberWindowFrame</key>
<string>0 59 1278 719 0 0 1280 778 </string> <string>0 59 1278 719 0 0 1280 778 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXNavigatorGroup</string> <string>PBXNavigatorGroup</string>
<key>Proportion</key> <key>Proportion</key>
<string>673pt</string> <string>471pt</string>
</dict> </dict>
<dict> <dict>
<key>Proportion</key> <key>Proportion</key>
<string>0pt</string> <string>202pt</string>
<key>Tabs</key> <key>Tabs</key>
<array> <array>
<dict> <dict>
@ -485,9 +485,7 @@
<key>GeometryConfiguration</key> <key>GeometryConfiguration</key>
<dict> <dict>
<key>Frame</key> <key>Frame</key>
<string>{{10, 27}, {992, -27}}</string> <string>{{10, 27}, {992, 175}}</string>
<key>RubberWindowFrame</key>
<string>0 59 1278 719 0 0 1280 778 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXProjectFindModule</string> <string>PBXProjectFindModule</string>
@ -525,7 +523,9 @@
<key>GeometryConfiguration</key> <key>GeometryConfiguration</key>
<dict> <dict>
<key>Frame</key> <key>Frame</key>
<string>{{10, 27}, {992, 99}}</string> <string>{{10, 27}, {992, 175}}</string>
<key>RubberWindowFrame</key>
<string>0 59 1278 719 0 0 1280 778 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXBuildResultsModule</string> <string>PBXBuildResultsModule</string>

View File

@ -375,8 +375,8 @@ bool Sample_SoloMeshSimple::handleBuild()
m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs); m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs);
m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize); m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize);
m_cfg.maxSimplificationError = m_edgeMaxError; m_cfg.maxSimplificationError = m_edgeMaxError;
m_cfg.minRegionSize = (int)rcSqr(m_regionMinSize); m_cfg.minRegionArea = (int)rcSqr(m_regionMinSize); // Note: area = size*size
m_cfg.mergeRegionSize = (int)rcSqr(m_regionMergeSize); m_cfg.mergeRegionArea = (int)rcSqr(m_regionMergeSize); // Note: area = size*size
m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly; m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly;
m_cfg.detailSampleDist = m_detailSampleDist < 0.9f ? 0 : m_cellSize * m_detailSampleDist; m_cfg.detailSampleDist = m_detailSampleDist < 0.9f ? 0 : m_cellSize * m_detailSampleDist;
m_cfg.detailSampleMaxError = m_cellHeight * m_detailSampleMaxError; m_cfg.detailSampleMaxError = m_cellHeight * m_detailSampleMaxError;
@ -495,7 +495,7 @@ bool Sample_SoloMeshSimple::handleBuild()
} }
// Partition the walkable surface into simple regions without holes. // Partition the walkable surface into simple regions without holes.
if (!rcBuildRegions(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionSize, m_cfg.mergeRegionSize)) if (!rcBuildRegions(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionArea, m_cfg.mergeRegionArea))
{ {
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions."); m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions.");
return false; return false;

View File

@ -720,8 +720,8 @@ bool Sample_SoloMeshTiled::handleBuild()
m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs); m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs);
m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize); m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize);
m_cfg.maxSimplificationError = m_edgeMaxError; m_cfg.maxSimplificationError = m_edgeMaxError;
m_cfg.minRegionSize = (int)rcSqr(m_regionMinSize); m_cfg.minRegionArea = (int)rcSqr(m_regionMinSize); // Note: area = size*size
m_cfg.mergeRegionSize = (int)rcSqr(m_regionMergeSize); m_cfg.mergeRegionArea = (int)rcSqr(m_regionMergeSize); // Note: area = size*size
m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly; m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly;
m_cfg.tileSize = (int)m_tileSize; m_cfg.tileSize = (int)m_tileSize;
m_cfg.borderSize = m_cfg.walkableRadius + 3; // Reserve enough padding. m_cfg.borderSize = m_cfg.walkableRadius + 3; // Reserve enough padding.
@ -867,7 +867,7 @@ bool Sample_SoloMeshTiled::handleBuild()
continue; continue;
} }
if (!rcBuildRegions(m_ctx, *tile.chf, tileCfg.borderSize, tileCfg.minRegionSize, tileCfg.mergeRegionSize)) if (!rcBuildRegions(m_ctx, *tile.chf, tileCfg.borderSize, tileCfg.minRegionArea, tileCfg.mergeRegionArea))
{ {
m_ctx->log(RC_LOG_ERROR, "buildTiledNavigation: [%d,%d] Could not build regions.", x, y); m_ctx->log(RC_LOG_ERROR, "buildTiledNavigation: [%d,%d] Could not build regions.", x, y);
continue; continue;

View File

@ -899,8 +899,8 @@ unsigned char* Sample_TileMesh::buildTileMesh(const int tx, const int ty, const
m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs); m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs);
m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize); m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize);
m_cfg.maxSimplificationError = m_edgeMaxError; m_cfg.maxSimplificationError = m_edgeMaxError;
m_cfg.minRegionSize = (int)rcSqr(m_regionMinSize); m_cfg.minRegionArea = (int)rcSqr(m_regionMinSize); // Note: area = size*size
m_cfg.mergeRegionSize = (int)rcSqr(m_regionMergeSize); m_cfg.mergeRegionArea = (int)rcSqr(m_regionMergeSize); // Note: area = size*size
m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly; m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly;
m_cfg.tileSize = (int)m_tileSize; m_cfg.tileSize = (int)m_tileSize;
m_cfg.borderSize = m_cfg.walkableRadius + 3; // Reserve enough padding. m_cfg.borderSize = m_cfg.walkableRadius + 3; // Reserve enough padding.
@ -1030,7 +1030,7 @@ unsigned char* Sample_TileMesh::buildTileMesh(const int tx, const int ty, const
} }
// Partition the walkable surface into simple regions without holes. // Partition the walkable surface into simple regions without holes.
if (!rcBuildRegions(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionSize, m_cfg.mergeRegionSize)) if (!rcBuildRegions(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionArea, m_cfg.mergeRegionArea))
{ {
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions."); m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions.");
return 0; return 0;