Mesher
Mesher is a class that manages the creation and removal of THREE.Mesh objects from fragment data. It allows to efficiently retrieve and remove meshes for specific model items. 📘 API.
Extends
Component
Implements
Disposable_2
Properties
geometries
readonlygeometries:ModelIdDataMap<object[]>
A map of model IDs to arrays of THREE.BufferGeometry objects. This is used to store and reuse the geometries generated by the mesher.
Methods
get()
get(
modelIdMap,_config?):Promise<ModelIdDataMap<Mesh<BufferGeometry<NormalBufferAttributes>,Material|Material[],Object3DEventMap>[]>>
Retrieves meshes for specified model items, optionally applying a material and coordinate system transformation.
Parameters
| Parameter | Type | Description |
|---|---|---|
modelIdMap | ModelIdMap | A map of model IDs to an array of local IDs, specifying which items to retrieve meshes for. |
_config? | object | Optional configuration object. |
_config.applyTransformation? | boolean | Whether to bring the mesh to its original position or leave it at 0,0,0. Defaults to true. |
_config.coordinate? | boolean | - |
_config.material? | Material | Optional material to apply to the meshes. If not provided, the default material is used. |
Returns
Promise<ModelIdDataMap<Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>[]>>
A map of model IDs to a map of local IDs to an array of THREE.Mesh objects.
remove()
remove(
modelIds):void
Removes the cached geometries by disposing the resources. This makes the meshes created by the component unusable as the geometry will no longer be present.
Parameters
| Parameter | Type | Description |
|---|---|---|
modelIds | string[] | An optional array of model IDs to remove. If not provided, all meshes will be removed. |
Returns
void