A unique layer id.
Either "2d" or "3d". Defaults to "2d".
The layer's type. Must be "custom".
Optional method called when the layer has been added to the Map with Map.addLayer. This gives the layer a chance to initialize gl resources and register event listeners.
The Map this custom layer was just added to.
The gl context for the map.
Called during a render frame allowing the layer to draw into the GL context.
The layer can assume blending and depth state is set to allow the layer to properly blend and clip other layers. The layer cannot make any other assumptions about the current GL state.
If the layer needs to render to a texture, it should implement the prerender method
to do this and only use the render method for drawing directly into the main framebuffer.
The blend function is set to gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA). This expects
colors to be provided in premultiplied alpha form where the r, g and b values are already
multiplied by the a value. If you are unable to provide colors in premultiplied form you
may want to change the blend function to
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).
Mirrors the basemap's fill-extrusion-vertical-gradient on the landmark shading.
MapLibre custom layer that renders tiled glTF/GLB models with Three.js.
The layer owns a ModelsSource that streams model tiles for the current viewport, renders them as maplibre-style fill-extrusion buildings, and keeps its lighting in sync with the map style light.
It draws whenever the map draws, and asks for a frame of its own only when a tile arrives, so a still map stays idle. After changing one of its fields yourself, call
triggerRepaint()on the MapLibre map.