diff --git a/src/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp b/src/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp index d77328f5..c08297dd 100644 --- a/src/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp +++ b/src/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp @@ -532,14 +532,14 @@ static bool walkContour(dtTileCacheLayer& layer, int x, int y, dtTempContour& co static float distancePtSeg(const int x, const int y, const int px, const int py, - const int qx, const int qz) + const int qx, const int qy) { float pqx = (float)(qx - px); - float pqz = (float)(qz - py); + float pqy = (float)(qy - py); float dx = (float)(x - px); float dy = (float)(y - py); - float d = pqx*pqx + pqz*pqz; - float t = pqx*dx + pqz*dy; + float d = pqx*pqx + pqy*pqy; + float t = pqx*dx + pqy*dy; if (d > 0) t /= d; if (t < 0) @@ -548,7 +548,7 @@ static float distancePtSeg(const int x, const int y, t = 1; dx = px + t*pqx - x; - dy = py + t*pqz - y; + dy = py + t*pqy - y; return dx*dx + dy*dy; } diff --git a/src/thirdparty/recast/Recast/Source/Recast.cpp b/src/thirdparty/recast/Recast/Source/Recast.cpp index 8b284b72..d95ea454 100644 --- a/src/thirdparty/recast/Recast/Source/Recast.cpp +++ b/src/thirdparty/recast/Recast/Source/Recast.cpp @@ -482,12 +482,12 @@ bool rcBuildCompactHeightfield(rcContext* context, const int walkableHeight, con // Find neighbour connections. const int MAX_LAYERS = RC_NOT_CONNECTED - 1; int maxLayerIndex = 0; - const int zStride = xSize; // for readability + const int yStride = xSize; // for readability for (int y = 0; y < ySize; ++y) { for (int x = 0; x < xSize; ++x) { - const rcCompactCell& cell = compactHeightfield.cells[x + y * zStride]; + const rcCompactCell& cell = compactHeightfield.cells[x + y * yStride]; for (int i = (int)cell.index, ni = (int)(cell.index + cell.count); i < ni; ++i) { rcCompactSpan& span = compactHeightfield.spans[i]; @@ -496,16 +496,16 @@ bool rcBuildCompactHeightfield(rcContext* context, const int walkableHeight, con { rcSetCon(span, dir, RC_NOT_CONNECTED); const int neighborX = x + rcGetDirOffsetX(dir); - const int neighborZ = y + rcGetDirOffsetY(dir); + const int neighborY = y + rcGetDirOffsetY(dir); // First check that the neighbour cell is in bounds. - if (neighborX < 0 || neighborZ < 0 || neighborX >= xSize || neighborZ >= ySize) + if (neighborX < 0 || neighborY < 0 || neighborX >= xSize || neighborY >= ySize) { continue; } // Iterate over all neighbour spans and check if any of the is // accessible from current cell. - const rcCompactCell& neighborCell = compactHeightfield.cells[neighborX + neighborZ * zStride]; + const rcCompactCell& neighborCell = compactHeightfield.cells[neighborX + neighborY * yStride]; for (int k = (int)neighborCell.index, nk = (int)(neighborCell.index + neighborCell.count); k < nk; ++k) { const rcCompactSpan& neighborSpan = compactHeightfield.spans[k];