TomTom Maps for JavaScript
    Preparing search index...

    Interface BuildingsLayer

    MapLibre custom layer drawing the vector tiles' buildings with Three.js: extruded walls and roofs, procedural windows, a sun with soft shadows on the buildings and the ground, and sky light.

    It extrudes the buildings of the tiles MapLibre already loaded for the map, so it makes no requests of its own. After changing one of its fields yourself, call triggerRepaint() on the MapLibre map.

    interface BuildingsLayer {
        id: string;
        renderingMode: "3d";
        source: { id: string; layer: string };
        type: "custom";
        onAdd(map: Map$1, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
        render(
            gl: WebGLRenderingContext | WebGL2RenderingContext,
            options: CustomRenderMethodInput,
        ): void;
        setLook(look: Buildings3DLook): void;
    }

    Implements

    Index
    id: string

    A unique layer id.

    renderingMode: "3d"

    Either "2d" or "3d". Defaults to "2d".

    source: { id: string; layer: string }

    The vector source and source layer the buildings come from.

    type: "custom"

    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.

      Parameters

      • map: Map$1

        The Map this custom layer was just added to.

      • gl: WebGLRenderingContext | WebGL2RenderingContext

        The gl context for the map.

      Returns void

    • 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).

      Parameters

      Returns void

    • Draws the buildings with this look, from the next frame.

      Parameters

      • look: Buildings3DLook

      Returns void