Log is printed to stdout after build.

Fixed tile data deletion in tilenavmesh (thanks jswigart).
Adjusted default border size in tiled versions.
Added experimental monotone region builder.
This commit is contained in:
Mikko Mononen 2009-08-27 09:01:15 +00:00
parent 40b8b093a3
commit 5fc5626938
11 changed files with 1445 additions and 2067 deletions

View File

@ -90,7 +90,7 @@ dtTiledNavMesh::~dtTiledNavMesh()
{
for (int i = 0; i < DT_MAX_TILES; ++i)
{
if (m_tiles[i].data && m_tiles[i].dataSize < 0)
if (m_tiles[i].data && m_tiles[i].ownsData)
{
delete [] m_tiles[i].data;
m_tiles[i].data = 0;

View File

@ -443,7 +443,7 @@ bool rcBuildCompactHeightfield(const int walkableHeight, const int walkableClimb
// Returns false if operation ran out of memory.
bool rcBuildDistanceField(rcCompactHeightfield& chf);
// Divides the walkable heighfied into simple regions.
// Divides the walkable heighfied into simple regions using watershed partitioning.
// Each region has only one contour and no overlaps.
// The regions are stored in the compact heightfield 'reg' field.
// The regions will be shrinked by the radius of the agent.
@ -461,6 +461,24 @@ bool rcBuildRegions(rcCompactHeightfield& chf,
int walkableRadius, int borderSize,
int minRegionSize, int mergeRegionSize);
// Divides the walkable heighfied into simple regions using simple monotone partitioning.
// Each region has only one contour and no overlaps.
// The regions are stored in the compact heightfield 'reg' field.
// The regions will be shrinked by the radius of the agent.
// The process sometimes creates small regions. The parameter
// 'minRegionSize' specifies the smallest allowed regions size.
// If the area of a regions is smaller than allowed, the regions is
// 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);
// Builds simplified contours from the regions outlines.
// Params:
// chf - (in) compact heightfield which has regions set.

View File

@ -947,6 +947,179 @@ static void paintRectRegion(int minx, int maxx, int miny, int maxy,
}
}
struct rcSweepSpan
{
unsigned short rid; // row id
unsigned short id; // region id
unsigned short ns; // number samples
unsigned short nei; // neighbour id
};
bool rcBuildRegionsMonotone(rcCompactHeightfield& chf,
int walkableRadius, int borderSize,
int minRegionSize, int mergeRegionSize)
{
rcTimeVal startTime = rcGetPerformanceTimer();
unsigned short* src = 0;
rcSweepSpan* sweeps = 0;
rcIntArray prev(256);
const int w = chf.width;
const int h = chf.height;
unsigned short minLevel = (unsigned short)(walkableRadius*2);
unsigned short id = 1;
src = new unsigned short[chf.spanCount*2];
if (!src)
{
if (rcGetLog())
rcGetLog()->log(RC_LOG_ERROR, "rcBuildRegionsMonotone: Out of memory 'src' (%d).", chf.spanCount*2);
goto failure;
}
memset(src,0,sizeof(unsigned short)*2*chf.spanCount);
sweeps = new rcSweepSpan[chf.width];
if (!sweeps)
{
if (rcGetLog())
rcGetLog()->log(RC_LOG_ERROR, "rcBuildDistanceField: Out of memory 'sweeps' (%d).", chf.width);
goto failure;
}
// Mark border regions.
paintRectRegion(0, borderSize, 0, h, id|RC_BORDER_REG, minLevel, chf, src); id++;
paintRectRegion(w-borderSize, w, 0, h, id|RC_BORDER_REG, minLevel, chf, src); id++;
paintRectRegion(0, w, 0, borderSize, id|RC_BORDER_REG, minLevel, chf, src); id++;
paintRectRegion(0, w, h-borderSize, h, id|RC_BORDER_REG, minLevel, chf, src); id++;
// Sweep one line at a time.
for (int y = borderSize; y < h-borderSize; ++y)
{
// Collect spans from this row.
prev.resize(id+1);
memset(&prev[0],0,sizeof(int)*id);
unsigned short rid = 1;
for (int x = borderSize; x < w-borderSize; ++x)
{
const rcCompactCell& c = chf.cells[x+y*w];
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
{
const rcCompactSpan& s = chf.spans[i];
if (s.dist < minLevel) continue;
// -x
unsigned short previd = 0;
if (rcGetCon(s, 0) != 0xf)
{
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 ((src[ai*2] & RC_BORDER_REG) == 0)
previd = src[ai*2];
}
if (!previd)
{
previd = rid++;
sweeps[previd].rid = previd;
sweeps[previd].ns = 0;
sweeps[previd].nei = 0;
}
if (previd != 0)
{
// -y
if (rcGetCon(s,3) != 0xf)
{
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 (src[ai*2] && (src[ai*2] & RC_BORDER_REG) == 0)
{
unsigned char nr = src[ai*2];
if (!sweeps[previd].nei || sweeps[previd].nei == nr)
{
sweeps[previd].nei = nr;
sweeps[previd].ns++;
prev[nr]++;
}
else
{
sweeps[previd].nei = 0xffff;
}
}
}
}
src[i*2] = previd;
}
}
// Create unique ID.
for (int i = 1; i < rid; ++i)
{
if (sweeps[i].nei != 0xffff && sweeps[i].nei != 0 &&
prev[sweeps[i].nei] == (int)sweeps[i].ns)
{
sweeps[i].id = sweeps[i].nei;
}
else
{
sweeps[i].id = id++;
}
}
// Remap IDs
for (int x = borderSize; x < w-borderSize; ++x)
{
const rcCompactCell& c = chf.cells[x+y*w];
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
{
if (src[i*2] > 0 && src[i*2] < rid)
src[i*2] = sweeps[src[i*2]].id;
}
}
}
rcTimeVal filterStartTime = rcGetPerformanceTimer();
// Filter out small regions.
chf.maxRegions = id;
if (!filterSmallRegions(minRegionSize, mergeRegionSize, chf.maxRegions, chf, src))
goto failure;
rcTimeVal filterEndTime = rcGetPerformanceTimer();
// Write the result out.
for (int i = 0; i < chf.spanCount; ++i)
chf.spans[i].reg = src[i*2];
delete [] src;
delete [] sweeps;
rcTimeVal endTime = rcGetPerformanceTimer();
if (rcGetBuildTimes())
{
rcGetBuildTimes()->buildRegions += rcGetDeltaTimeUsec(startTime, endTime);
rcGetBuildTimes()->buildRegionsFilter += rcGetDeltaTimeUsec(filterStartTime, filterEndTime);
}
return true;
failure:
delete [] src;
delete [] sweeps;
return false;
}
bool rcBuildRegions(rcCompactHeightfield& chf,
int walkableRadius, int borderSize,
int minRegionSize, int mergeRegionSize)

File diff suppressed because it is too large Load Diff

View File

@ -268,9 +268,7 @@
<array>
<string>29B97314FDCFA39411CA2CEA</string>
<string>080E96DDFE201D6D7F000001</string>
<string>6BDD9E030F91110C00904EEF</string>
<string>6B137C7D0F7FCBE800459200</string>
<string>6B555DF5100B25FC00247EA3</string>
<string>29B97315FDCFA39411CA2CEA</string>
<string>29B97317FDCFA39411CA2CEA</string>
<string>1C37FBAC04509CD000000102</string>
@ -279,14 +277,14 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>32</integer>
<integer>18</integer>
<integer>14</integer>
<integer>4</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 25}, {282, 628}}</string>
<string>{{0, 0}, {282, 628}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@ -321,7 +319,7 @@
<key>PBXProjectModuleGUID</key>
<string>6B8632A30F78115100E2684A</string>
<key>PBXProjectModuleLabel</key>
<string>RecastMeshDetail.cpp</string>
<string>Recast.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -329,189 +327,26 @@
<key>PBXProjectModuleGUID</key>
<string>6B8632A40F78115100E2684A</string>
<key>PBXProjectModuleLabel</key>
<string>RecastMeshDetail.cpp</string>
<string>Recast.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>6B3315851042CB6F00E98B50</string>
<string>6B33180B104680C900E98B50</string>
<key>history</key>
<array>
<string>6B7707F00FBD90F100D21BAE</string>
<string>6B9B7D9D0FF91AC600A9090F</string>
<string>6B25B43E0FFA1786004F1BC4</string>
<string>6B25B44B0FFA1968004F1BC4</string>
<string>6B2AEC670FFB8AB0005BE9CC</string>
<string>6B092B500FFCA0A20088D3A5</string>
<string>6B0249BE1003793900CF7107</string>
<string>6B024C011006098300CF7107</string>
<string>6B024C1110060C7600CF7107</string>
<string>6B1186211006945C0018F96F</string>
<string>6B7EBB69100721310066EF8C</string>
<string>6B555D30100B143200247EA3</string>
<string>6B555E01100B285300247EA3</string>
<string>6B555F0D100B473F00247EA3</string>
<string>6B555F0E100B473F00247EA3</string>
<string>6B92CE69100E0577003DA304</string>
<string>6B92CE6A100E0577003DA304</string>
<string>6B92CE8A100E0739003DA304</string>
<string>6B995F9F100F336B00D7BF5A</string>
<string>6B995FA2100F336B00D7BF5A</string>
<string>6B995FDF100F387200D7BF5A</string>
<string>6B8AE8FA10123B5700FF1D07</string>
<string>6B9D0AF4102991F0009B1A6C</string>
<string>6B93FDBB102FFCFE00F0C0DA</string>
<string>6B6241E91034B2FA0002E346</string>
<string>6B6241EB1034B2FA0002E346</string>
<string>6B955A0610359EBB00FE9FE3</string>
<string>6B955A0810359EBB00FE9FE3</string>
<string>6B955A0A10359EBB00FE9FE3</string>
<string>6B955A0C10359EBB00FE9FE3</string>
<string>6B95069A103869D900213080</string>
<string>6B9506F810388A4200213080</string>
<string>6B41876A1039827000FBF4A5</string>
<string>6B41878E1039854600FBF4A5</string>
<string>6B74D091103DDCC300623975</string>
<string>6B05B00C10405F0A004A71D1</string>
<string>6B05B01010405F0A004A71D1</string>
<string>6BF26BC5104158E90099C14A</string>
<string>6BF26BC9104158E90099C14A</string>
<string>6B3314EC1042BC8200E98B50</string>
<string>6B3314ED1042BC8200E98B50</string>
<string>6B3314EE1042BC8200E98B50</string>
<string>6B3314EF1042BC8200E98B50</string>
<string>6B3314F11042BC8200E98B50</string>
<string>6B3314F21042BC8200E98B50</string>
<string>6B3314F41042BC8200E98B50</string>
<string>6B3314F61042BC8200E98B50</string>
<string>6B3314F71042BC8200E98B50</string>
<string>6B3314F91042BC8200E98B50</string>
<string>6B33152E1042BD3500E98B50</string>
<string>6B3315321042BE1600E98B50</string>
<string>6B3315331042BE1600E98B50</string>
<string>6B3315351042BE1600E98B50</string>
<string>6B3315361042BE1600E98B50</string>
<string>6B3315381042BE1600E98B50</string>
<string>6B33154D1042C42500E98B50</string>
<string>6B33154E1042C42500E98B50</string>
<string>6B33154F1042C42500E98B50</string>
<string>6B3315501042C42500E98B50</string>
<string>6B3315521042C42500E98B50</string>
<string>6B3315531042C42500E98B50</string>
<string>6B33156B1042C54200E98B50</string>
<string>6B3315771042C6A000E98B50</string>
<string>6B3315821042CB6F00E98B50</string>
<string>6B3315831042CB6F00E98B50</string>
<string>6B3317F01046805E00E98B50</string>
<string>6B3317F21046805E00E98B50</string>
<string>6B3317F31046805E00E98B50</string>
<string>6B3317F51046805E00E98B50</string>
<string>6B3317F71046805E00E98B50</string>
<string>6B3317F91046805E00E98B50</string>
<string>6B331808104680C900E98B50</string>
<string>6B331809104680C900E98B50</string>
</array>
<key>prevStack</key>
<array>
<string>6B1E032E0F925D9100CC0038</string>
<string>6B8DB3900F9798DE007FA9E1</string>
<string>6B458EA80FB4540500044EA9</string>
<string>6B7707B90FBD66CF00D21BAE</string>
<string>6B7707F90FBD90F100D21BAE</string>
<string>6B7708F70FBDA96300D21BAE</string>
<string>6BB788290FC0593E003C24DB</string>
<string>6BB7882A0FC0593E003C24DB</string>
<string>6BB7882B0FC0593E003C24DB</string>
<string>6BB85D3E0FCEAA6300758966</string>
<string>6BC745AF0FF527E50083A694</string>
<string>6B25B4120FFA1545004F1BC4</string>
<string>6B86333B0F7813A600E2684A</string>
<string>6B25B4080FFA13E9004F1BC4</string>
<string>6B25B6250FFA63C8004F1BC4</string>
<string>6B2AEC740FFB8AB0005BE9CC</string>
<string>6B2AEC750FFB8AB0005BE9CC</string>
<string>6B092BBC0FFCEC1A0088D3A5</string>
<string>6B02498D1003751300CF7107</string>
<string>6B024A721004A2FE00CF7107</string>
<string>6B024BCF1005DFAB00CF7107</string>
<string>6B024C041006098300CF7107</string>
<string>6B024C1310060C7600CF7107</string>
<string>6B11862D1006945C0018F96F</string>
<string>6B1186301006945C0018F96F</string>
<string>6B1186311006945C0018F96F</string>
<string>6B1186411006945C0018F96F</string>
<string>6B555D26100B136A00247EA3</string>
<string>6B555DC9100B236A00247EA3</string>
<string>6B555E13100B285300247EA3</string>
<string>6B555EE0100B39A600247EA3</string>
<string>6B555EF9100B42E600247EA3</string>
<string>6B8AE8DF10121C6000FF1D07</string>
<string>6B93FDF010300CBE00F0C0DA</string>
<string>6B95065010383C6900213080</string>
<string>6B9506891038680900213080</string>
<string>6B9507401038910D00213080</string>
<string>6B41875F10397C9F00FBF4A5</string>
<string>6B4187C41039909100FBF4A5</string>
<string>6B418869103ACAC700FBF4A5</string>
<string>6B74D052103DD64C00623975</string>
<string>6B05AF59104042D5004A71D1</string>
<string>6B05AFA810404FAB004A71D1</string>
<string>6B05AFA910404FAB004A71D1</string>
<string>6BF26BB51041520F0099C14A</string>
<string>6BF26BD4104158E90099C14A</string>
<string>6BF26BD5104158E90099C14A</string>
<string>6BF26BD8104158E90099C14A</string>
<string>6BF26C1110415C680099C14A</string>
<string>6BF26C1210415C680099C14A</string>
<string>6B3314FD1042BC8200E98B50</string>
<string>6B3314FE1042BC8200E98B50</string>
<string>6B3314FF1042BC8200E98B50</string>
<string>6B3315001042BC8200E98B50</string>
<string>6B3315011042BC8200E98B50</string>
<string>6B3315021042BC8200E98B50</string>
<string>6B3315031042BC8200E98B50</string>
<string>6B3315041042BC8200E98B50</string>
<string>6B3315051042BC8200E98B50</string>
<string>6B3315061042BC8200E98B50</string>
<string>6B3315071042BC8200E98B50</string>
<string>6B3315081042BC8200E98B50</string>
<string>6B3315091042BC8200E98B50</string>
<string>6B33150A1042BC8200E98B50</string>
<string>6B33150B1042BC8200E98B50</string>
<string>6B33150C1042BC8200E98B50</string>
<string>6B33150D1042BC8200E98B50</string>
<string>6B33150E1042BC8200E98B50</string>
<string>6B33150F1042BC8200E98B50</string>
<string>6B3315101042BC8200E98B50</string>
<string>6B3315111042BC8200E98B50</string>
<string>6B3315121042BC8200E98B50</string>
<string>6B3315131042BC8200E98B50</string>
<string>6B3315141042BC8200E98B50</string>
<string>6B3315151042BC8200E98B50</string>
<string>6B3315161042BC8200E98B50</string>
<string>6B3315171042BC8200E98B50</string>
<string>6B3315181042BC8200E98B50</string>
<string>6B3315191042BC8200E98B50</string>
<string>6B33151A1042BC8200E98B50</string>
<string>6B33151B1042BC8200E98B50</string>
<string>6B33151C1042BC8200E98B50</string>
<string>6B3315301042BD3500E98B50</string>
<string>6B33153B1042BE1600E98B50</string>
<string>6B33153C1042BE1600E98B50</string>
<string>6B33153D1042BE1600E98B50</string>
<string>6B33153E1042BE1600E98B50</string>
<string>6B33153F1042BE1600E98B50</string>
<string>6B3315401042BE1600E98B50</string>
<string>6B3315411042BE1600E98B50</string>
<string>6B3315421042BE1600E98B50</string>
<string>6B3315561042C42500E98B50</string>
<string>6B3315571042C42500E98B50</string>
<string>6B3315581042C42500E98B50</string>
<string>6B3315591042C42500E98B50</string>
<string>6B33155A1042C42500E98B50</string>
<string>6B33155B1042C42500E98B50</string>
<string>6B33155C1042C42500E98B50</string>
<string>6B33155D1042C42500E98B50</string>
<string>6B33155E1042C42500E98B50</string>
<string>6B33155F1042C42500E98B50</string>
<string>6B3315601042C42500E98B50</string>
<string>6B3315611042C42500E98B50</string>
<string>6B3315621042C42500E98B50</string>
<string>6B33156D1042C54200E98B50</string>
<string>6B3315791042C6A000E98B50</string>
<string>6B33157A1042C6A000E98B50</string>
<string>6B3315841042CB6F00E98B50</string>
<string>6B3317FB1046805E00E98B50</string>
<string>6B33180A104680C900E98B50</string>
</array>
</dict>
<key>SplitCount</key>
@ -525,18 +360,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {976, 641}}</string>
<string>{{0, 0}, {976, 552}}</string>
<key>RubberWindowFrame</key>
<string>0 91 1280 687 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>641pt</string>
<string>552pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>0pt</string>
<string>89pt</string>
<key>Tabs</key>
<array>
<dict>
@ -550,7 +385,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {976, 55}}</string>
<string>{{10, 27}, {976, 62}}</string>
<key>RubberWindowFrame</key>
<string>0 91 1280 687 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -567,8 +404,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {976, -27}}</string>
<key>RubberWindowFrame</key>
<string>0 91 1280 687 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXProjectFindModule</string>
@ -606,7 +441,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {976, 86}}</string>
<string>{{10, 27}, {976, 62}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -634,11 +469,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>6B33151E1042BC8200E98B50</string>
<string>6B3317FF1046807A00E98B50</string>
<string>1CA23ED40692098700951B8B</string>
<string>6B33151F1042BC8200E98B50</string>
<string>6B3318001046807A00E98B50</string>
<string>6B8632A30F78115100E2684A</string>
<string>6B3315201042BC8200E98B50</string>
<string>6B3318011046807A00E98B50</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -687,12 +522,12 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {1280, 356}}</string>
<string>{{0, 0}, {1280, 438}}</string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
<key>Proportion</key>
<string>356pt</string>
<string>438pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
@ -711,8 +546,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {623, 117}}</string>
<string>{{623, 0}, {657, 117}}</string>
<string>{{0, 0}, {623, 83}}</string>
<string>{{623, 0}, {657, 83}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
@ -727,8 +562,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {1280, 117}}</string>
<string>{{0, 117}, {1280, 168}}</string>
<string>{{0, 0}, {1280, 83}}</string>
<string>{{0, 83}, {1280, 120}}</string>
</array>
</dict>
</dict>
@ -748,7 +583,7 @@
<key>DebugSTDIOWindowFrame</key>
<string>{{200, 200}, {500, 300}}</string>
<key>Frame</key>
<string>{{0, 361}, {1280, 285}}</string>
<string>{{0, 443}, {1280, 203}}</string>
<key>PBXDebugSessionStackFrameViewKey</key>
<dict>
<key>DebugVariablesTableConfiguration</key>
@ -761,13 +596,13 @@
<real>427</real>
</array>
<key>Frame</key>
<string>{{623, 0}, {657, 117}}</string>
<string>{{623, 0}, {657, 83}}</string>
</dict>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
<key>Proportion</key>
<string>285pt</string>
<string>203pt</string>
</dict>
</array>
<key>Name</key>
@ -785,14 +620,14 @@
</array>
<key>TableOfContents</key>
<array>
<string>6B3315211042BC8200E98B50</string>
<string>6B3318021046807A00E98B50</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
<string>6B3315221042BC8200E98B50</string>
<string>6B3315231042BC8200E98B50</string>
<string>6B3315241042BC8200E98B50</string>
<string>6B3315251042BC8200E98B50</string>
<string>6B3315261042BC8200E98B50</string>
<string>6B3318031046807A00E98B50</string>
<string>6B3318041046807A00E98B50</string>
<string>6B3318051046807A00E98B50</string>
<string>6B3318061046807A00E98B50</string>
<string>6B8632A30F78115100E2684A</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>

View File

@ -31,6 +31,7 @@
6B2AEC530FFB8958005BE9CC /* Sample_TileMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */; };
6B2AEC560FFB89E7005BE9CC /* Sample_StatMeshTiled.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC550FFB89E7005BE9CC /* Sample_StatMeshTiled.cpp */; };
6B2AEC5A0FFB8A7A005BE9CC /* DetourTileNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC590FFB8A7A005BE9CC /* DetourTileNavMesh.cpp */; };
6B3317081045682A00E98B50 /* transGizmo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B3317071045682A00E98B50 /* transGizmo.cpp */; };
6B555DB1100B212E00247EA3 /* imguiRenderGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B555DB0100B212E00247EA3 /* imguiRenderGL.cpp */; };
6B62416A103434880002E346 /* RecastMeshDetail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B624169103434880002E346 /* RecastMeshDetail.cpp */; };
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632D90F78122C00E2684A /* SDL.framework */; };
@ -90,6 +91,7 @@
6B2AEC570FFB89F4005BE9CC /* Sample_StatMeshTiled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_StatMeshTiled.h; path = ../../Include/Sample_StatMeshTiled.h; sourceTree = SOURCE_ROOT; };
6B2AEC580FFB8A68005BE9CC /* DetourTileNavMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourTileNavMesh.h; path = ../../../Detour/Include/DetourTileNavMesh.h; sourceTree = SOURCE_ROOT; };
6B2AEC590FFB8A7A005BE9CC /* DetourTileNavMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourTileNavMesh.cpp; path = ../../../Detour/Source/DetourTileNavMesh.cpp; sourceTree = SOURCE_ROOT; };
6B3317071045682A00E98B50 /* transGizmo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = transGizmo.cpp; path = ../../Source/transGizmo.cpp; sourceTree = SOURCE_ROOT; };
6B555DAE100B211D00247EA3 /* imguiRenderGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imguiRenderGL.h; path = ../../Include/imguiRenderGL.h; sourceTree = SOURCE_ROOT; };
6B555DB0100B212E00247EA3 /* imguiRenderGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imguiRenderGL.cpp; path = ../../Source/imguiRenderGL.cpp; sourceTree = SOURCE_ROOT; };
6B555DF6100B273500247EA3 /* stb_truetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../Contrib/stb_truetype.h; sourceTree = SOURCE_ROOT; };
@ -130,6 +132,7 @@
6B137C7D0F7FCBE800459200 /* Recast */,
6B555DF5100B25FC00247EA3 /* Samples */,
6B25B6180FFA62BE004F1BC4 /* main.cpp */,
6B3317071045682A00E98B50 /* transGizmo.cpp */,
6B137C7A0F7FCBE400459200 /* imgui.h */,
6B137C6C0F7FCBBB00459200 /* imgui.cpp */,
6B555DAE100B211D00247EA3 /* imguiRenderGL.h */,
@ -355,6 +358,7 @@
6B1185FE10068B150018F96F /* DetourCommon.cpp in Sources */,
6B555DB1100B212E00247EA3 /* imguiRenderGL.cpp in Sources */,
6B62416A103434880002E346 /* RecastMeshDetail.cpp in Sources */,
6B3317081045682A00E98B50 /* transGizmo.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -6,6 +6,7 @@
#include "Recast.h"
#include "RecastLog.h"
class Sample_StatMeshSimple : public Sample_StatMesh
{
protected:

View File

@ -575,7 +575,7 @@ bool Sample_StatMeshTiled::handleBuild()
m_cfg.mergeRegionSize = (int)rcSqr(m_regionMergeSize);
m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly;
m_cfg.tileSize = (int)m_tileSize;
m_cfg.borderSize = m_cfg.walkableRadius*2 + 2; // Reserve enough padding.
m_cfg.borderSize = m_cfg.walkableRadius + 3; // Reserve enough padding.
m_cfg.detailSampleDist = m_detailSampleDist < 0.9f ? 0 : m_cellSize * m_detailSampleDist;
m_cfg.detailSampleMaxError = m_cellHeight * m_detailSampleMaxError;

View File

@ -611,7 +611,7 @@ unsigned char* Sample_TileMesh::buildTileMesh(const float* bmin, const float* bm
m_cfg.mergeRegionSize = (int)rcSqr(m_regionMergeSize);
m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly;
m_cfg.tileSize = (int)m_tileSize;
m_cfg.borderSize = m_cfg.walkableRadius*2 + 2; // Reserve enough padding.
m_cfg.borderSize = m_cfg.walkableRadius + 3; // Reserve enough padding.
m_cfg.width = m_cfg.tileSize + m_cfg.borderSize*2;
m_cfg.height = m_cfg.tileSize + m_cfg.borderSize*2;
m_cfg.detailSampleDist = m_detailSampleDist < 0.9f ? 0 : m_cellSize * m_detailSampleDist;
@ -864,7 +864,7 @@ unsigned char* Sample_TileMesh::buildTileMesh(const float* bmin, const float* bm
rcGetLog()->log(RC_LOG_PROGRESS, "TOTAL: %.1fms", rcGetDeltaTimeUsec(totStartTime, totEndTime)/1000.0f);
}
m_tileBuildTime = rcGetDeltaTimeUsec(totStartTime, totEndTime)/1000.0f;
dataSize = navDataSize;

View File

@ -22,6 +22,8 @@
# define snprintf _snprintf
#endif
/*GLFont g_font;
void drawText(int x, int y, int dir, const char* text, unsigned int col)
{
@ -566,6 +568,9 @@ int main(int argc, char *argv[])
showLog = true;
logScroll = 0;
}
printf("Build log:\n");
for (int i = 0; i < log.getMessageCount(); ++i)
printf("%s\n", log.getMessageText(i));
}
imguiSeparator();