Skip to Content
Bear documentation

loadGlb

Import from bear/engine/loadGlb.

Functions

bufferGeometryToManifold()

function bufferGeometryToManifold(geometry, scale?): Promise<Manifold>;

Defined in: bear/engine/loadGlb.ts:97

Convert a Three.js BufferGeometry to a Manifold.

The geometry must represent a closed, watertight mesh (valid 2-manifold). If the geometry is non-indexed (triangle soup), coincident vertices are merged using a spatial hash so Manifold can reconstruct shared edges.

Parameters

ParameterTypeDefault value
geometryBufferGeometryundefined
scale?number1

Returns

Promise<Manifold>


clearGlbCache()

function clearGlbCache(): void;

Defined in: bear/engine/loadGlb.ts:42

Clear the GLB cache (useful for tests).

Returns

void


loadGlb()

function loadGlb(url, options?): Promise<Manifold>;

Defined in: bear/engine/loadGlb.ts:26

Load a GLB file and convert its geometry to a Manifold.

Uses Manifold's native GLTF I/O pipeline (@gltf-transform/core + readMesh) for robust mesh import with automatic merge vector handling.

The mesh is automatically scaled from meters (GLB standard) to project units (32nds of an inch) unless units is "project-units".

Results are cached by URL. The cache owns the loaded solid and each call gets its own share of it, which the caller owns.

Parameters

ParameterType
urlstring
options?{ units?: "meters" | "project-units"; }
options.units?"meters" | "project-units"

Returns

Promise<Manifold>

On this page