manifold
Import from bear/geometry/manifold.
Functions
createFallbackMaterial()
function createFallbackMaterial(): MeshStandardMaterial;Defined in: bear/geometry/manifold.ts:65
Creates a default gray material for manifolds without a specified material.
Returns
MeshStandardMaterial
instantiateMaterial()
function instantiateMaterial(descriptor, onTextureLoaded?): MeshStandardMaterial;Defined in: bear/geometry/manifold.ts:107
Instantiates (or retrieves from cache) a MeshStandardMaterial from a lightweight MaterialDescriptor.
Textures referenced by the descriptor are loaded asynchronously;
the material is returned immediately and textures are assigned
as they resolve. Callers should provide an onTextureLoaded
callback to trigger a re-render when textures arrive.
Parameters
| Parameter | Type |
|---|---|
descriptor | MaterialDescriptor |
onTextureLoaded? | () => void |
Returns
MeshStandardMaterial
manifoldMeshToGeometry()
function manifoldMeshToGeometry(mesh): BufferGeometry;Defined in: bear/geometry/manifold.ts:28
Converts a Manifold Mesh to a Three.js BufferGeometry. Generates vertex normals and UV coordinates using bounding box projection.
Parameters
| Parameter | Type |
|---|---|
mesh | Mesh |
Returns
BufferGeometry
manifoldToObject3D()
function manifoldToObject3D(
manifold,
material?,
onTextureLoaded?,
materials?
): Object3D<Object3DEventMap> | null;Defined in: bear/geometry/manifold.ts:160
Converts a Manifold to a Three.js Object3D (Mesh). Returns null if conversion fails.
Parameters
| Parameter | Type | Description |
|---|---|---|
manifold | Manifold | The Manifold to convert |
material? | | MaterialDescriptor | Material<MaterialEventMap> | Material<MaterialEventMap>[] | Optional Material or MaterialDescriptor. If a descriptor is provided it is instantiated into a real Three.js material. If not provided, a fallback gray material is used. |
onTextureLoaded? | () => void | Callback fired when an async texture finishes loading. |
materials? | Readonly<Record<number, MaterialDescriptor>> | Descriptors by Manifold original ID. Each run of triangles becomes a group shaded by its ID's entry, else by material. |
Returns
Object3D<Object3DEventMap> | null
updateManifoldMaterial()
function updateManifoldMaterial(
geometry,
material?,
onTextureLoaded?
): void;Defined in: bear/geometry/manifold.ts:249
Updates the material of a manifold-generated geometry. Handles fallback material creation and disposal.
Parameters
| Parameter | Type | Description |
|---|---|---|
geometry | Object3D | The Object3D (must be a Mesh) to update |
material? | | MaterialDescriptor | Material<MaterialEventMap> | Material<MaterialEventMap>[] | The new material to apply. If not provided, a fallback material is used. |
onTextureLoaded? | () => void | Callback fired when an async texture finishes loading. |
Returns
void