# 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 (opens new window) 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 (opens new window))

A unique layer id.

# lightColor (number (opens new window) | Color (opens new window) | string (opens new window))

A color of the lights. It can be a hexadecimal color, a three.js Color (opens new window) 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 (opens new window))

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 (opens new window))

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 (opens new window))

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 (opens new window)) three.js renderer, scene and camera this layer contains.

Name Description
context.camera
PerspectiveCamera (opens new window)
Camera object.
context.renderer
WebGLRenderer (opens new window)
Renderer object.
context.scene
Scene (opens new window)
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 (opens new window)) three.js renderer, scene and camera this layer contains.

Name Description
context.camera
PerspectiveCamera (opens new window)
Camera object.
context.renderer
WebGLRenderer (opens new window)
Renderer object.
context.scene
Scene (opens new window)
Scene object.
Last Updated: 4/11/2023, 7:24:56 PM