Class WebGLRenderManager
Constructors
constructor
- new WebGLRenderManager(
options: {
gl: WebGL2RenderingContext | WebGLRenderingContext;
map: Map;
},
): WebGLRenderManagerConstructs 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
- options: { gl: WebGL2RenderingContext | WebGLRenderingContext; map: Map }
Methods
addAnimationLoop
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
- animationID: string
animate
The main animation loop that runs on every frame. It executes all registered animation callbacks.
Returns void
clear
Clears the renderer's buffers.
Returns void
dispose
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
- layerID: string
handleAddLayer
Adds a 3D layer to be managed and rendered.
Parameters
- layer: Layer3D
The 3D layer to add.
- scene: Scene
The THREE.js scene associated with the layer.
- camera: Camera
The THREE.js camera associated with the layer.
Returns WebGLRenderManager
The instance of the WebGLRenderManager.
- layer: Layer3D
handleMouseClick
handleMouseDoubleClick
handleMouseDown
handleMouseMove
handleMouseUp
removeAnimationLoop
Removes an animation loop associated with a layer.
Parameters
- layerID: string
The ID of the layer whose animation loop should be removed.
Returns void
- layerID: string
render
Renders all managed 3D layers. This is called by the
WebGLManagerLayer.Parameters
- options: CustomRenderMethodInput
The render options provided by the MapTiler SDK.
Returns void
- options: CustomRenderMethodInput
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.