Class WebGLRenderManager

Manages the WebGL rendering for all 3D layers on the map. This class is responsible for setting up the THREE.js WebGLRenderer, adding and removing layers, and running the animation loop. It ensures that all 3D content is rendered by a single ThreeJS renderer.

Index

Constructors

  • Constructs a new WebGLRenderManager.

    Parameters

    • options: { gl: WebGL2RenderingContext | WebGLRenderingContext; map: Map }

      The options for initialization.

      • gl: WebGL2RenderingContext | WebGLRenderingContext

        The WebGL rendering context from the map.

      • map: Map

        The MapTiler SDK map instance.

    Returns WebGLRenderManager

Methods

  • Adds an animation loop for a specific layer.

    Parameters

    • animationID: string

      A unique ID for the animation.

    • callback: () => void

      The function to call on each animation frame.

    Returns void

  • The main animation loop that runs on every frame. It executes all registered animation callbacks.

    Returns void

  • Disposes of a layer's resources and removes it from the manager. If it's the last layer, it cleans up the renderer and removes the manager layer from the map.

    Parameters

    • layerID: string

      The ID of the layer to dispose of.

    Returns void

  • Handle the mouse click event for a mesh and delegate to the correct layer, which then delegates to the correct Item3D instance which then emits the event.

    Parameters

    • event: MapMouseEvent

      The event data

    Returns void

  • Handle the mouse double click event for a mesh, and delegate to the correct layer, which then delegates to the correct Item3D instance which then emits the dblclick event. NOTE: Dblclick events also fire a two click events for each click.

    Parameters

    • event: MapMouseEvent

      The event data

    Returns void

  • Handle the mouse down event for a mesh and delegate to the correct layer, which then delegates to the correct Item3D instance which then emits the mousedown event.

    Parameters

    • event: MapMouseEvent

      The event data

    Returns void

  • Handle the mouse move event for a mesh and delegate to the correct layer, which then delegates to the correct Item3D instance which then emits the mouseneter or mouseleave event.

    Parameters

    • point: Point2D

      The mouse position in screen coordinates.

    Returns void

  • Handle the mouse up event for a mesh and delegate to the correct layer, which then delegates to the correct Item3D instance which then emits the mouseup event.

    Parameters

    • event: MapMouseEvent

      The event data

    Returns void

  • Removes an animation loop associated with a layer.

    Parameters

    • layerID: string

      The ID of the layer whose animation loop should be removed.

    Returns void

  • Renders all managed 3D layers. This is called by the WebGLManagerLayer.

    Parameters

    • options: CustomRenderMethodInput

      The render options provided by the MapTiler SDK.

    Returns void

Was this helpful?