From 4c29fa0686ce08faed7694d6115b93a0d4574776 Mon Sep 17 00:00:00 2001 From: ikpil Date: Mon, 13 Nov 2023 23:35:43 +0900 Subject: [PATCH] [Upstream] fix:rcBuildLayerRegions missing areaType (#470) - https://github.com/recastnavigation/recastnavigation/commit/ddaa361b0893ddc7602a3bd5c20ad2cfd0a8df7c It's already been modified, just align the code. --- src/DotRecast.Recast/RcRegions.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DotRecast.Recast/RcRegions.cs b/src/DotRecast.Recast/RcRegions.cs index 3970f5c..dd25089 100644 --- a/src/DotRecast.Recast/RcRegions.cs +++ b/src/DotRecast.Recast/RcRegions.cs @@ -1169,8 +1169,7 @@ namespace DotRecast.Recast } } - private static int MergeAndFilterLayerRegions(RcTelemetry ctx, int minRegionArea, int maxRegionId, - RcCompactHeightfield chf, int[] srcReg, List overlaps) + private static int MergeAndFilterLayerRegions(RcTelemetry ctx, int minRegionArea, int maxRegionId, RcCompactHeightfield chf, int[] srcReg, List overlaps) { int w = chf.width; int h = chf.height; @@ -1197,6 +1196,7 @@ namespace DotRecast.Recast for (int i = c.index, ni = c.index + c.count; i < ni; ++i) { ref RcCompactSpan s = ref chf.spans[i]; + int area = chf.areas[i]; int ri = srcReg[i]; if (ri == 0 || ri >= nreg) { @@ -1206,9 +1206,11 @@ namespace DotRecast.Recast RcRegion reg = regions[ri]; reg.spanCount++; - reg.areaType = chf.areas[i]; + reg.areaType = area; + reg.ymin = Math.Min(reg.ymin, s.y); reg.ymax = Math.Max(reg.ymax, s.y); + // Collect all region layers. lregs.Add(ri);