| 1 |
From ddaa361b0893ddc7602a3bd5c20ad2cfd0a8df7c Mon Sep 17 00:00:00 2001 |
| 2 |
From: shine <[email protected]> |
| 3 |
Date: Mon, 13 Nov 2023 05:30:28 +0800 |
| 4 |
Subject: [PATCH 13/36] fix:rcBuildLayerRegions missing areaType (#470) |
| 5 |
|
| 6 |
Co-authored-by: sunming <[email protected]> |
| 7 |
Co-authored-by: Graham Pentheny <[email protected]> |
| 8 |
--- |
| 9 |
Recast/Source/RecastRegion.cpp | 7 ++++++- |
| 10 |
1 file changed, 6 insertions(+), 1 deletion(-) |
| 11 |
|
| 12 |
diff --git a/Recast/Source/RecastRegion.cpp b/Recast/Source/RecastRegion.cpp |
| 13 |
index bc08ecd..684987e 100644 |
| 14 |
--- a/Recast/Source/RecastRegion.cpp |
| 15 |
+++ b/Recast/Source/RecastRegion.cpp |
| 16 |
@@ -1072,12 +1072,14 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea, |
| 17 |
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i) |
| 18 |
{ |
| 19 |
const rcCompactSpan& s = chf.spans[i]; |
| 20 |
+ const unsigned char area = chf.areas[i]; |
| 21 |
const unsigned short ri = srcReg[i]; |
| 22 |
if (ri == 0 || ri >= nreg) continue; |
| 23 |
rcRegion& reg = regions[ri]; |
| 24 |
|
| 25 |
reg.spanCount++; |
| 26 |
- |
| 27 |
+ reg.areaType = area; |
| 28 |
+ |
| 29 |
reg.ymin = rcMin(reg.ymin, s.y); |
| 30 |
reg.ymax = rcMax(reg.ymax, s.y); |
| 31 |
|
| 32 |
@@ -1157,6 +1159,9 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea, |
| 33 |
// Skip already visited. |
| 34 |
if (regn.id != 0) |
| 35 |
continue; |
| 36 |
+ // Skip if different area type, do not connect regions with different area type. |
| 37 |
+ if (reg.areaType != regn.areaType) |
| 38 |
+ continue; |
| 39 |
// Skip if the neighbour is overlapping root region. |
| 40 |
bool overlap = false; |
| 41 |
for (int k = 0; k < root.floors.size(); k++) |
| 42 |
-- |
| 43 |
2.43.0 |
| 44 |
|