Re-introduce #10444: Don't load unnecessary tiles on terrain #10467
+132
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The commit includes original #10444 and #10446 with fix for issue reported in #10462.
The issue in #10462 is about assuming center elevation for parent nodes in tile pyramid: the approach needs to be applied only to final tile cover tiles.
This is because parent tiles don't have corresponding DEM tiles cover and could get clipped out "too early" from cover.
Fixes: #10463
The case #10462 is good for illustrating the issue with original PR and improvement compared to main. Following patch is used to log tiles loaded:
This view uses 37 vector tiles and only those are loaded while opening screen.
Code in main branch loads 71 vector tiles, uses 37 of those once view is loaded.
TODO:
Considered refactoring getMinElevationBelowMSL() to MinMax and cache it for e.g. getBounds3D could also reuse it. However, for this case, only getMinElevationBelowMSL() is needed and performance impact is not such that it would require caching. getBounds3D is called only on getBounds() or query API calls. Caching would be orthogonal to the work here so leaving the PR as it is.