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; 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 // 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 overlap = checkOverlapRect(bmin, bmax, node->bmin, node->bmax);
const bool isLeafNode = node->i >= 0; const bool isLeafNode = node->i >= 0;
if (isLeafNode && overlap) if (isLeafNode && overlap)
{ {
if (count_returned < maxIds) if (currentCount < maxIds)
{ {
ids[count_returned] = current_idx; ids[currentCount] = currentNode;
count_returned++; currentCount++;
} }
} }
if (overlap || isLeafNode) if (overlap || isLeafNode)
current_idx++; currentNode++;
else else
{ {
const int escapeIndex = -node->i; const int escapeIndex = -node->i;
current_idx += escapeIndex; currentNode += escapeIndex;
} }
if (count_returned == maxIds) if (currentCount == maxIds)
{ {
return 0; return 0;
} }

View File

@ -999,17 +999,17 @@ 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 #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 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; bool done = false;
m_tileTriCount = 0; m_tileTriCount = 0;
do{ do{
int current_count = 0; int currentCount = 0;
done=rcGetChunksOverlappingRect(chunkyMesh, tbmin, tbmax, cid, 1024,current_count,current_node); done=rcGetChunksOverlappingRect(chunkyMesh, tbmin, tbmax, cid, 1024,currentCount,currentNode);
for (int i = 0; i < current_count; ++i) for (int i = 0; i < currentCount; ++i)
{ {
const rcChunkyTriMeshNode& node = chunkyMesh->nodes[cid[i]]; const rcChunkyTriMeshNode& node = chunkyMesh->nodes[cid[i]];
const int* ctris = &chunkyMesh->tris[node.i * 3]; const int* ctris = &chunkyMesh->tris[node.i*3];
const int nctris = node.n; const int nctris = node.n;
m_tileTriCount += nctris; m_tileTriCount += nctris;

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); 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 /// 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. /// 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); int rcGetChunksOverlappingSegment(const rcChunkyTriMesh* cm, float p[2], float q[2], int* ids, const int maxIds);