add
Adds an object to the Threebox scene.Parameters
The 3D object to add to the scene
Optional layer ID to associate with this object
Optional source ID to associate with this object
Example
remove
Removes an object from the Threebox scene.Parameters
The 3D object to remove from the scene. If the object has a
dispose method, it will be called automaticallyExample
removeByName
Removes an object from the Threebox scene by name.Parameters
The name of the object to remove. Searches through the scene and its children, starting with the object itself, and removes the first with a matching name
Example
update
Updates the Threebox scene and renders it. This is the most important method in Threebox as it’s responsible for invoking theTHREE.WebGLRenderer.render(scene, camera) method.
render function of your custom layer:
Example
clear
Removes all children from the Threebox scene.Parameters
Optional layer ID. If provided, only objects in that layer will be removed. If omitted, all objects are removed
If true, will also call
obj.dispose() on each object to dispose all resourcesReturns
Returns a Promise that resolves with “clear” when complete
Example
dispose
Fully disposes the Threebox instance and all associated resources from Three.js and Mapbox GL.- Dispose every object, geometry, material and texture in Three.js
- Dispose all resources from Mapbox GL
- Dispose the WebGLRenderingContext
- Remove the map instance
Returns
Returns a Promise that resolves when disposal is complete
Example
removeLayer
Removes a layer from Mapbox, including all 3D objects from the Threebox scene.Parameters
The ID of the layer to remove