First valuable feature: real terrain source for 3D Tiles quantized-mesh (#4493)#7953
First valuable feature: real terrain source for 3D Tiles quantized-mesh (#4493)#7953clement-igonet wants to merge 3 commits into
Conversation
|
The text was too long for me to read, but why not simply use addProtocol and convert the tiles' data into terrainRGB like the geotiff plugin does? |
|
Please make sure to read our AI policy. This is somewhat violating it and impacts my motivation to review the other PRs you opened... |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7953 +/- ##
=======================================
Coverage 93.25% 93.25%
=======================================
Files 290 290
Lines 24650 24650
Branches 6471 6471
=======================================
Hits 22987 22987
Misses 1663 1663 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
84c073f to
f6bd0f6
Compare
OK Guy ! |
dceb263 to
470265c
Compare
…maplibre#4493) Converts quantized-mesh tiles to terrain-RGB on the fly via addProtocol (same pattern as the geotiff plugin), so the terrain source is a normal raster-dem source - map.setTerrain(), queryTerrainElevation(), hillshade, and plain Markers sitting on the terrain all work with zero core changes. The decoder (header, delta+zigzag vertices, high-water-mark indices) is shared with the POC example; new here is barycentric resampling of the irregular TIN onto the regular grid raster-dem expects, EPSG:4326 to Web Mercator tile-covering resolution, and a distance-based taper where requested tiles extend past the bundled tile's coverage. Bundles the same single real Cesium World Terrain tile as the POC (Mont Blanc massif, zoom 9) to keep the PR light.
470265c to
f4158fc
Compare
📝 WalkthroughWalkthroughAdds a bundled Mont Blanc quantized-mesh terrain tile and an example that decodes it, resamples it into Terrarium terrain-RGB tiles, and renders the result through MapLibre’s ChangesTerrain source example
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant MapLibre
participant quantizedMeshProtocol
participant decodeQuantizedMesh
participant buildTerrainRgbImageData
participant RasterDemSource
MapLibre->>quantizedMeshProtocol: request quantized-mesh://z/x/y
quantizedMeshProtocol->>decodeQuantizedMesh: fetch bundled terrain payload
decodeQuantizedMesh->>buildTerrainRgbImageData: decoded mesh
buildTerrainRgbImageData->>RasterDemSource: ImageBitmap terrain-RGB tile
RasterDemSource->>MapLibre: terrain elevation data
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/examples/render-3d-tiles-terrain-source.html`:
- Around line 328-335: Update findCoveringQMTiles to collect and return
intersecting tiles from every zoom in descending order instead of returning on
the first non-empty zoom. Preserve each tile’s computed bounds so
multiMeshElevationAt can select the deepest available mesh per point and use
lower-resolution parents for uncovered areas.
- Around line 357-375: The buildTerrainRgbImageData rasterization currently
performs synchronous per-pixel work without cancellation. Thread the protocol
handler’s AbortController signal through the tile fetch and rasterization path,
and make the row/pixel loops stop promptly when the signal is aborted; ensure
aborted work does not continue producing obsolete tile data.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d79f998f-e5c8-491d-a875-37fb5d598bc5
⛔ Files ignored due to path filters (1)
docs/assets/examples/render-3d-tiles-terrain-source.pngis excluded by!**/*.png
📒 Files selected for processing (3)
.gitattributesdocs/assets/examples/mont-blanc-terrain-tiles/9-531-386.terraintest/examples/render-3d-tiles-terrain-source.html
…andler Per review: findCoveringQMTiles returns intersecting tiles from every zoom (deepest first) so lower-resolution parents fill gaps in patchy child coverage, and the protocol handler threads its AbortController signal through the tile fetch and rasterization loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Phase 2 of #4493, following the POC in #7952.
Converts quantized-mesh terrain tiles to terrain-RGB via
addProtocol(same pattern as the geotiff plugin, per @HarelM's suggestion below), so the terrain source is a normalraster-demsource —map.setTerrain(),queryTerrainElevation(), draping, hillshade, and color-relief all work with zero core changes.Bundles a single real Cesium World Terrain tile (Mont Blanc massif, z9) to keep the PR light; dynamic tile-covering resolution maps requested Mercator tiles onto it. The hardening follow-up (#7958) extends this to multi-zoom, live endpoints, and a worker.
Launch Checklist
Assisted-By: Claude Sonnet 5 (claude-sonnet-5)
Summary by CodeRabbit
New Features
Chores