Recast: light variable name cleanup

Enforce consistency
This commit is contained in:
Kawe Mazidjatari 2024-07-06 20:02:37 +02:00
parent 602fa7d1ec
commit d7235a799a
3 changed files with 15 additions and 15 deletions

View File

@ -242,32 +242,32 @@ int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm,
return n;
}
int rcGetChunksOverlappingRect(const rcChunkyTriMesh * cm, float bmin[2], float bmax[2], int * ids, const int maxIds, int& count_returned, int & current_idx)
int rcGetChunksOverlappingRect(const rcChunkyTriMesh * cm, float bmin[2], float bmax[2], int * ids, const int maxIds, int& currentCount, int& currentNode)
{
// Traverse tree
while (current_idx < cm->nnodes)
while (currentNode < cm->nnodes)
{
const rcChunkyTriMeshNode* node = &cm->nodes[current_idx];
const rcChunkyTriMeshNode* node = &cm->nodes[currentNode];
const bool overlap = checkOverlapRect(bmin, bmax, node->bmin, node->bmax);
const bool isLeafNode = node->i >= 0;
if (isLeafNode && overlap)
{
if (count_returned < maxIds)
if (currentCount < maxIds)
{
ids[count_returned] = current_idx;
count_returned++;
ids[currentCount] = currentNode;
currentCount++;
}
}
if (overlap || isLeafNode)
current_idx++;
currentNode++;
else
{
const int escapeIndex = -node->i;
current_idx += escapeIndex;
currentNode += escapeIndex;
}
if (count_returned == maxIds)
if (currentCount == maxIds)
{
return 0;
}

View File

@ -999,14 +999,14 @@ unsigned char* Editor_TileMesh::buildTileMesh(const int tx, const int ty, const
}
#else //NOTE(warmist): algo with limited return but can be reinvoked to continue the query
int cid[1024];//NOTE: we don't grow it but we reuse it (e.g. like a yieldable function or iterator or sth)
int current_node = 0;
int currentNode = 0;
bool done = false;
m_tileTriCount = 0;
do{
int current_count = 0;
done=rcGetChunksOverlappingRect(chunkyMesh, tbmin, tbmax, cid, 1024,current_count,current_node);
for (int i = 0; i < current_count; ++i)
int currentCount = 0;
done=rcGetChunksOverlappingRect(chunkyMesh, tbmin, tbmax, cid, 1024,currentCount,currentNode);
for (int i = 0; i < currentCount; ++i)
{
const rcChunkyTriMeshNode& node = chunkyMesh->nodes[cid[i]];
const int* ctris = &chunkyMesh->tris[node.i*3];

View File

@ -53,7 +53,7 @@ bool rcCreateChunkyTriMesh(const float* verts, const int* tris, int ntris,
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm, float bmin[2], float bmax[2], int* ids, const int maxIds);
/// Returns the chunk indices which overlap the input rectable. Return value is "we are done". Can be reinvoked to continue
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm, float bmin[2], float bmax[2], int* ids, const int maxIds,int& count_returned,int& current_idx);
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm, float bmin[2], float bmax[2], int* ids, const int maxIds,int& currentCount,int& currentNode);
/// Returns the chunk indices which overlap the input segment.
int rcGetChunksOverlappingSegment(const rcChunkyTriMesh* cm, float p[2], float q[2], int* ids, const int maxIds);