diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-01-26 19:44:50 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-11-22 00:17:11 +0100 |
commit | cb8b6370612e6684b3b3fbdb4a08f8ec21d51f3e (patch) | |
tree | 5c92922f659b434a759d755eb860d3dfe3e7a9ad /dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp | |
parent | b6c9ebec715d7e7d25de909f55abfd88a5941deb (diff) |
Dep/Recast: Update recastnavigation to https://github.com/recastnavigation/recastnavigation/commit/14b2631527c4792e95b2c78ebfa8ac4cd3413363
Rebuilding mmaps IS required
(cherry picked from commit 5ff88ea04aec4677f1c1d669674e5442288a25e3)
Diffstat (limited to 'dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp')
-rw-r--r-- | dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp index f953132f74c..68ab726aabb 100644 --- a/dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp +++ b/dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp @@ -557,15 +557,16 @@ static float polyMinExtent(const float* verts, const int nverts) inline int prev(int i, int n) { return i-1 >= 0 ? i-1 : n-1; } inline int next(int i, int n) { return i+1 < n ? i+1 : 0; } -static void triangulateHull(const int /*nverts*/, const float* verts, const int nhull, const int* hull, rcIntArray& tris) +static void triangulateHull(const int /*nverts*/, const float* verts, const int nhull, const int* hull, const int nin, rcIntArray& tris) { int start = 0, left = 1, right = nhull-1; // Start from an ear with shortest perimeter. // This tends to favor well formed triangles as starting point. - float dmin = 0; + float dmin = FLT_MAX; for (int i = 0; i < nhull; i++) { + if (hull[i] >= nin) continue; // Ears are triangles with original vertices as middle vertex while others are actually line segments on edges int pi = prev(i, nhull); int ni = next(i, nhull); const float* pv = &verts[hull[pi]*3]; @@ -770,7 +771,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin, // If the polygon minimum extent is small (sliver or small triangle), do not try to add internal points. if (minExtent < sampleDist*2) { - triangulateHull(nverts, verts, nhull, hull, tris); + triangulateHull(nverts, verts, nhull, hull, nin, tris); return true; } @@ -778,7 +779,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin, // We're using the triangulateHull instead of delaunayHull as it tends to // create a bit better triangulation for long thin triangles when there // are no internal points. - triangulateHull(nverts, verts, nhull, hull, tris); + triangulateHull(nverts, verts, nhull, hull, nin, tris); if (tris.size() == 0) { |