Constructor
Sets up a Threebox scene using a Mapbox map and WebGL rendering context.Parameters
Mapbox GL JS map instance
WebGL rendering context, obtained from
map.getCanvas().getContext('webgl') or from the onAdd(map, gl) method of a custom layerConfiguration options for the Threebox instance
Whether to add some default lighting to the scene. If no lighting added, most objects in the scene will render as black
Sets lights that simulate Sun position for the map center coords and user local datetime. This sunlight can be updated through
tb.setSunlight method. Calls internally to suncalc moduleSets if a light helper will be shown when
realSunlight is trueWhen true, Threebox only renders when the map moves or changes
Whether to preserve the drawing buffer after rendering. Required for
map.getCanvas().toDataURL()Enables the mouseover and selection of fill-extrusion features. Fires the
SelectedFeatureChange eventEnables the mouseover and selection of 3D objects. Fires the
SelectedChange event. This value will set the options.bbox value of the objects createdEnables dragging of 3D objects. Fires the
ObjectDragged event where draggedAction = 'translate' or draggedAction = 'altitude'Enables rotation of 3D objects. Fires the
ObjectDragged event where draggedAction = 'rotate'Enables the default tooltips on fill-extrusion features and 3D objects
Enables the default help tooltips when an object is being moved, rotated or measured
Enables the option for multi-layer pages where a default layer will be created internally that will manage the
tb.update callsEnables the option to set a
THREE.OrthographicCamera instead of a THREE.PerspectiveCamera which is the default in MapboxSets the FOV of the default
THREE.PerspectiveCamera. This value has no effect if orthographic: trueSets a built-in atmospheric sky layer initially set with the time and the map center position. This layer is automatically updated if
realSunlight is also trueSets a built-in terrain layer initially set with the time and the map center position. This layer is automatically updated if
realSunlight is also trueReturns
A Threebox instance with synchronized camera, scene, and renderer