diff --git a/Runtime/3rdParty/VectorTile/VectorTileFeature.cs b/Runtime/3rdParty/VectorTile/VectorTileFeature.cs index bde5b106483d7b18515aa2b87e44e3a00b49ea11..732ce80fed0ef30d59f4fc0048e59d2644adc76d 100644 --- a/Runtime/3rdParty/VectorTile/VectorTileFeature.cs +++ b/Runtime/3rdParty/VectorTile/VectorTileFeature.cs @@ -13,6 +13,7 @@ namespace Mapbox.Vector.Tile /* Added to this struct for easier managing layer info. */ public int SelectedLayerIdx { get; set; } + public int RelativeHeight { get; set; } } diff --git a/Runtime/VectorTile.cs b/Runtime/VectorTile.cs index 61b08dc918729b75a2dff17a6940da7e0614efbd..1b9f62f411250c853052fbf2dc0784127ff862ed 100644 --- a/Runtime/VectorTile.cs +++ b/Runtime/VectorTile.cs @@ -197,7 +197,8 @@ namespace Wander // Identify feature by specifying a (unique) index based on some criteria. This can very per // vector tile provider. - public void IdentifyLayers( Func<VectorTileLayer, List<KeyValuePair<string, object>>, int> selectionCallback ) + public void IdentifyLayers( Func<VectorTileLayer, List<KeyValuePair<string, object>>, int> selectionCallback, + Func<VectorTileLayer, List<KeyValuePair<string, object>>, int> relativeHeightCallback ) { for (int l = 0;l < layers.Count;l++) { @@ -212,6 +213,8 @@ namespace Wander { feature.SelectedLayerIdx = uniqueId; } + uniqueId = relativeHeightCallback( layer, feature.Attributes ); + feature.RelativeHeight = uniqueId; } } layersIdentified = true; @@ -269,6 +272,12 @@ namespace Wander if (polygons.vertices.Count == 0) continue; + if (feature.SelectedLayerIdx == 254) + continue; + + if (feature.RelativeHeight > 0) + continue; + var poly = polygonLayers[lIdx][ftrIdx]; var mins = poly.mins; var maxs = poly.maxs; @@ -293,7 +302,8 @@ namespace Wander if (hit) break; - cachedTriIdx = 0; + cachedTriIdx += 1; + if(cachedTriIdx == triCount) cachedTriIdx = 0; } if (hit) break;