feat: Add render hooks to Painter for external render passes#7099
feat: Add render hooks to Painter for external render passes#7099cavencj wants to merge 21 commits intomaplibre:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7099 +/- ##
==========================================
- Coverage 92.61% 92.58% -0.03%
==========================================
Files 289 289
Lines 24010 24026 +16
Branches 5085 5087 +2
==========================================
+ Hits 22237 22245 +8
- Misses 1773 1781 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for taking the time to open this PR! |
Some advanced integrations require executing external rendering logic at specific points in the render pipeline. While custom layers provide a flexible extension mechanism, they are rendered as part of the layer-based pipeline and cannot be inserted at arbitrary render pass boundaries.
This PR introduces a lightweight render hook mechanism to Painter that allows external rendering logic to be executed at well-defined points in the render pipeline, without modifying the existing layer system or render order.
The goal is to enable advanced integrations (e.g. external renderers, custom GPU passes, Three.js) while keeping the core render flow intact and easy to maintain.
What’s added
A small, synchronous render hook API on Painter
Four hook phases aligned with the existing render passes:
beforeOpaque
afterOpaque
beforeTranslucent
afterTranslucent
Hooks receive the active Painter instance and current RenderOptions
No existing rendering logic is changed; hooks are executed strictly in addition to the current pipeline.