Recast: light cleanup

This commit is contained in:
Kawe Mazidjatari 2024-07-12 12:49:41 +02:00
parent ba23bfa471
commit 06ba52d4e6
3 changed files with 6 additions and 5 deletions

View File

@ -399,7 +399,7 @@ static void simplifyContour(rdIntArray& points, rdIntArray& simplified,
if (dx*dx + dy*dy > maxEdgeLen*maxEdgeLen) if (dx*dx + dy*dy > maxEdgeLen*maxEdgeLen)
{ {
// Round based on the segments in lexilogical order so that the // Round based on the segments in lexilogical order so that the
// max tesselation is consistent regardles in which direction // max tessellation is consistent regardless in which direction
// segments are traversed. // segments are traversed.
const int n = bi < ai ? (bi+pn - ai) : (bi - ai); const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
if (n > 1) if (n > 1)

View File

@ -163,7 +163,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
const unsigned char nr = srcReg[ai]; const unsigned char nr = srcReg[ai];
if (nr != 0xff) if (nr != 0xff)
{ {
// Set neighbour when first valid neighbour is encoutered. // Set neighbour when first valid neighbour is encountered.
if (sweeps[sid].ns == 0) if (sweeps[sid].ns == 0)
sweeps[sid].nei = nr; sweeps[sid].nei = nr;
@ -175,7 +175,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
} }
else else
{ {
// This is hit if there is nore than one neighbour. // This is hit if there is more than one neighbour.
// Invalidate the neighbour. // Invalidate the neighbour.
sweeps[sid].nei = 0xff; sweeps[sid].nei = 0xff;
} }

View File

@ -509,6 +509,7 @@ inline bool uright(const unsigned short* a, const unsigned short* b, const unsig
return ((int)b[0] - (int)a[0]) * ((int)c[1] - (int)a[1]) - return ((int)b[0] - (int)a[0]) * ((int)c[1] - (int)a[1]) -
((int)c[0] - (int)a[0]) * ((int)b[1] - (int)a[1]) > 0; ((int)c[0] - (int)a[0]) * ((int)b[1] - (int)a[1]) > 0;
} }
static int getPolyMergeValue(unsigned short* pa, unsigned short* pb, static int getPolyMergeValue(unsigned short* pa, unsigned short* pb,
const unsigned short* verts, int& ea, int& eb, const unsigned short* verts, int& ea, int& eb,
const int nvp) const int nvp)
@ -559,7 +560,7 @@ static int getPolyMergeValue(unsigned short* pa, unsigned short* pb,
if (!uright(&verts[va*3], &verts[vb*3], &verts[vc*3])) if (!uright(&verts[va*3], &verts[vb*3], &verts[vc*3]))
return -1; return -1;
#else #else
if (!uleft(&verts[va * 3], &verts[vb * 3], &verts[vc * 3])) if (!uleft(&verts[va*3], &verts[vb*3], &verts[vc*3]))
return -1; return -1;
#endif #endif
va = pb[(eb+nb-1) % nb]; va = pb[(eb+nb-1) % nb];
@ -1359,7 +1360,7 @@ bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMe
} }
} }
// Just allocate the mesh flags array. The user is resposible to fill it. // Just allocate the mesh flags array. The user is responsible to fill it.
mesh.flags = (unsigned short*)rdAlloc(sizeof(unsigned short)*mesh.npolys, RD_ALLOC_PERM); mesh.flags = (unsigned short*)rdAlloc(sizeof(unsigned short)*mesh.npolys, RD_ALLOC_PERM);
if (!mesh.flags) if (!mesh.flags)
{ {