Replies: 1 comment
-
Not sure I fully follow, but if you have a good idea how to improve this without introducing any breaking changes feel free to open a PR. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
render_to_texture.ts
file, render the tiles by multiple layers and use the finished tile texture(were to pulled fromRenderPool
) to render the terrain.However, in the
if
statement below,LAYER
object does not havecustom
property, so the custom type layer is not entered in the if statement and is not pushed tothis._stacks
.see the code here.
For the above reasons, the tile texture is not directly accessible on the custom type layer.
Also, in
RenderPool
, the tile texture is returned to the pool and reused, so even if access is possible, the custom layer does not know if it is the right timing tile texture.That is why the custom layer does not have access to the textures used in the final terrain and therefore cannot interact with the terrain provided by maplibre.
To correct this issue, we need to add
custom
property to theLAYER
object and add Tile and Framebuffer to the render parameter to make it accessible to the custom layer. Alternatively, you can add an optional new function such as.renderToTile
toCustomLayerInterface
.// render_to_texture.ts /** * lookup table which layers should rendered to texture */ const LAYERS: { [keyof in StyleLayer['type']]?: boolean } = { + custom: true, background: true, fill: true, line: true, raster: true, hillshade: true };
The function of
painter.renderLayer(painter, painter.style.sourceCaches[layer.source], layer, coords, options);
does not seem to have a big problem because the function that handles the custom layer is working properly.However, the
coords
parameter is notundefined
. so must be passed to the custom layer.Beta Was this translation helpful? Give feedback.
All reactions