3.7 KiB
ThreeLayerInterface
Interface for custom three.js layers. This is a specification for implementers to model: it is not an exported method or class.
A custom three.js layer contains a three.js scene. It allows a developer to render three.js objects directly into the map's GL context using the map's camera. These layers can be added to the map using Map#addLayer.
Custom three.js layers must have a unique id
and must have the type
of 'three'
. They may implement onAdd
and onRemove
.
Properties
id
(string
)
A unique layer id.
lightColor
(number
| Color
| string
)
A color of the lights. It can be a hexadecimal color, a three.js Color instance or a CSS-style string. If not specified, the dynamic light color based on the current date and time will be used.
maxzoom
(number
)
The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden. The value can be any number between 0
and 24
(inclusive). If no maxzoom is provided, the layer will be visible at all zoom levels.
minzoom
(number
)
The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden. The value can be any number between 0
and 24
(inclusive). If no minzoom is provided, the layer will be visible at all zoom levels.
type
(string
)
The layer's type. Must be 'three'
.
Instance Members
onAdd(map, context)
Optional method called when the layer has been added to the Map with Map#addLayer. This gives the layer a chance to initialize three.js resources and register event listeners.
Parameters
map
(Map
) The Mini Tokyo 3D Map this layer was just added to.
context
(Object
) three.js renderer, scene and camera this layer contains.
Name | Description |
---|---|
context.camera PerspectiveCamera |
Camera object. |
context.renderer WebGLRenderer |
Renderer object. |
context.scene Scene |
Scene object. |
onRemove(map, context)
Optional method called when the layer has been removed from the Map with Map#removeLayer. This gives the layer a chance to clean up three.js resources and event listeners.
Parameters
map
(Map
) The Mini Tokyo 3D Map this layer was just removed from.
context
(Object
) three.js renderer, scene and camera this layer contains.
Name | Description |
---|---|
context.camera PerspectiveCamera |
Camera object. |
context.renderer WebGLRenderer |
Renderer object. |
context.scene Scene |
Scene object. |