Recast: Update to upstream commit 5a870d4 (2022)

This commit is contained in:
Rémi Verschelde 2022-05-17 22:59:40 +02:00
parent d5c1de784c
commit 4635f24322
5 changed files with 51 additions and 30 deletions

View file

@ -921,8 +921,8 @@ bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
continue;
const unsigned char area = chf.areas[i];
verts.resize(0);
simplified.resize(0);
verts.clear();
simplified.clear();
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
walkContour(x, y, i, chf, flags, verts);

View file

@ -653,8 +653,8 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
for (int i = 0; i < nin; ++i)
rcVcopy(&verts[i*3], &in[i*3]);
edges.resize(0);
tris.resize(0);
edges.clear();
tris.clear();
const float cs = chf.cs;
const float ics = 1.0f/cs;
@ -803,7 +803,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
int x1 = (int)ceilf(bmax[0]/sampleDist);
int z0 = (int)floorf(bmin[2]/sampleDist);
int z1 = (int)ceilf(bmax[2]/sampleDist);
samples.resize(0);
samples.clear();
for (int z = z0; z < z1; ++z)
{
for (int x = x0; x < x1; ++x)
@ -864,8 +864,8 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
// Create new triangulation.
// TODO: Incremental add instead of full rebuild.
edges.resize(0);
tris.resize(0);
edges.clear();
tris.clear();
delaunayHull(ctx, nverts, verts, nhull, hull, tris, edges);
}
}
@ -935,7 +935,7 @@ static void seedArrayWithPolyCenter(rcContext* ctx, const rcCompactHeightfield&
pcy /= npoly;
// Use seeds array as a stack for DFS
array.resize(0);
array.clear();
array.push(startCellX);
array.push(startCellY);
array.push(startSpanIndex);
@ -1001,7 +1001,7 @@ static void seedArrayWithPolyCenter(rcContext* ctx, const rcCompactHeightfield&
rcSwap(dirs[directDir], dirs[3]);
}
array.resize(0);
array.clear();
// getHeightData seeds are given in coordinates with borders
array.push(cx+bs);
array.push(cy+bs);
@ -1030,7 +1030,7 @@ static void getHeightData(rcContext* ctx, const rcCompactHeightfield& chf,
// Note: Reads to the compact heightfield are offset by border size (bs)
// since border size offset is already removed from the polymesh vertices.
queue.resize(0);
queue.clear();
// Set all heights to RC_UNSET_HEIGHT.
memset(hp.data, 0xff, sizeof(unsigned short)*hp.width*hp.height);

View file

@ -650,7 +650,7 @@ static bool mergeRegions(rcRegion& rega, rcRegion& regb)
return false;
// Merge neighbours.
rega.connections.resize(0);
rega.connections.clear();
for (int i = 0, ni = acon.size(); i < ni-1; ++i)
rega.connections.push(acon[(insa+1+i) % ni]);
@ -876,8 +876,8 @@ static bool mergeAndFilterRegions(rcContext* ctx, int minRegionArea, int mergeRe
// Also keep track of the regions connects to a tile border.
bool connectsToBorder = false;
int spanCount = 0;
stack.resize(0);
trace.resize(0);
stack.clear();
trace.clear();
reg.visited = true;
stack.push(i);
@ -1068,7 +1068,7 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
{
const rcCompactCell& c = chf.cells[x+y*w];
lregs.resize(0);
lregs.clear();
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
{
@ -1139,7 +1139,7 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
// Start search.
root.id = layerId;
stack.resize(0);
stack.clear();
stack.push(i);
while (stack.size() > 0)