Class CubemapLayerMaptiler
Implements
Index
Constructors
Properties
Methods
Constructors
Maptilerconstructor
Creates a new instance of CubemapLayer
Parameters
- cubemapConfig: true | CubemapLayerConstructorOptions
Configuration options for the cubemap layer or
trueto use default options. Can specify faces, preset, path, and color properties to configure the cubemap.
Returns CubemapLayer
Remarks
You shouldn't have to use this class directly. Instead, use the
Map.setHalomethod to create and add a halo layer to the map. The constructor initializes the cubemap with the provided configuration. It processes the faces definition, sets up background colors, and determines whether to use a cubemap texture based on the provided options.- cubemapConfig: true | CubemapLayerConstructorOptions
Properties
MaptilercurrentFacesDefinitionKey
The key representing the current faces definition, used to diff / track changes in the cubemap faces.
Maptilerid
A unique layer id.
MaptilerrenderingMode
Either "2d" or "3d". Defaults to "2d".
Maptilertype
The layer's type. Must be "custom".
Methods
MaptilergetConfig
Returns the current configuration options for the cubemap layer.
Returns CubemapLayerConstructorOptions
The current configuration options.
Maptilerhide
Hides the cubemap layer by setting its visibility to "none". This method is used to remove the cubemap layer from the map without deleting it.
Returns void
MaptileronAdd
Called when the layer is added to the map. Initializes the cubemap and sets up the WebGL context.
Parameters
- map: Map
The map instance to which this layer is added.
- gl: WebGLRenderingContext | WebGL2RenderingContext
The WebGL context used for rendering.
Returns void
- map: Map
MaptileronRemove
Called when the layer is removed from the map. Cleans up the cubemap resources and WebGL buffers.
Parameters
- _map: Map
The map instance from which this layer is removed.
- gl: WebGLRenderingContext | WebGL2RenderingContext
The WebGL context used for rendering.
Returns void
- _map: Map
Maptilerprerender
Called before the layer is rendered. Updates the cubemap texture with the current faces.
Parameters
- _gl: WebGLContext
- _options: CustomRenderMethodInput
Additional options for the render method.
Returns void
Maptilerrender
- render(
gl: WebGLRenderingContext | WebGL2RenderingContext,
_options: CustomRenderMethodInput,
): voidRenders the cubemap layer to the WebGL context. This method is called internally during the rendering phase of the map.
Parameters
- gl: WebGLRenderingContext | WebGL2RenderingContext
The WebGL context used for rendering.
- _options: CustomRenderMethodInput
Additional options for the render method.
Returns void
- gl: WebGLRenderingContext | WebGL2RenderingContext
MaptilersetAnimationActive
Parameters
- active: boolean
Returns void
MaptilersetCubemap
Sets the cubemap for the layer based on the provided definition. This method updates the cubemap faces, background color, and triggers a repaint of the map.
Parameters
- spec: boolean | CubemapDefinition
Returns Promise<void>
A promise that resolves when the cubemap is set and the map is updated.
Remarks
This method checks if the provided cubemap definition has a color, and if so, it updates the background color. It also checks if the faces definition has changed compared to the current one, and if so, it updates the cubemap faces. Finally, it calls
updateCubemapto apply the changes and trigger a repaint of the map.
MaptilershouldUpdate
Checks if the cubemap needs to be updated based on the provided specification.
Parameters
OptionalnewSpec: boolean | CubemapDefinition
Returns boolean
True if the cubemap needs to be updated, false otherwise.
Maptilershow
Shows the cubemap layer by setting its visibility to "visible". This method is used to make the cubemap layer visible on the map.
Returns void
MaptilerupdateCubemap
Updates the cubemap object with the current faces and shader configuration. This method is called when the cubemap faces change or when the layer is initialized.
Parameters
- __namedParameters: { facesNeedUpdate: boolean } = ...
Returns void
MaptilerupdateTexture
Updates the cubemap texture with the provided faces. This method is called when the cubemap faces change or when the layer is initialized.
Parameters
- gl: WebGLContext
The WebGL context used for rendering.
- faces: CubemapFaces
The cubemap faces to be loaded into the texture.
Returns void
- gl: WebGLContext
Interface for custom style layers. This is a specification for implementers to model: it is not an exported method or class.
Custom layers allow a user to render directly into the map's GL context using the map's camera. These layers can be added between any regular layers using Map.addLayer.
Custom layers must have a unique
idand must have thetypeof"custom". They must implementrenderand may implementprerender,onAddandonRemove. They can trigger rendering using Map.triggerRepaint and they should appropriately handle MapContextEvent withwebglcontextlostandwebglcontextrestored.The
renderingModeproperty controls whether the layer is treated as a"2d"or"3d"map layer. Use:"renderingMode": "3d"to use the depth buffer and share it with other layers"renderingMode": "2d"to add a layer with no depth. If you need to use the depth buffer for a"2d"layer you must use an offscreen framebuffer and CustomLayerInterface.prerenderExample
Custom layer implemented as ES6 class