Skip to Content
Bear documentation

shapes

Import from bear/engine/shapes.

Classes

ShapeCache

Defined in: bear/engine/shapes.ts:85

Constructors

Constructor
new ShapeCache(): ShapeCache;
Returns

ShapeCache

Methods

dispose()
dispose(): Promise<void>;

Defined in: bear/engine/shapes.ts:136

Drop every shape, each once its load has settled.

Returns

Promise<void>

keeping()
keeping<T>(build): Promise<T>;

Defined in: bear/engine/shapes.ts:115

Run a build that replaces the current model, then drop every shape it did not use.

Type Parameters
Type Parameter
T
Parameters
ParameterType
build() => Promise<T>
Returns

Promise<T>

load()
load(
   part, 
   key, 
   load
): Promise<Manifold | undefined>;

Defined in: bear/engine/shapes.ts:92

A share of the solid load resolves to, loaded once per (part, key). load hands its solid to the cache; the caller owns the share.

Parameters
ParameterType
partobject
keystring
load() => Promise<Manifold | undefined>
Returns

Promise<Manifold | undefined>

visiting()
visiting<T>(build): Promise<T>;

Defined in: bear/engine/shapes.ts:126

Run a build beside the current model (a picture of something else), then drop every shape it added. A scene still drawing one owns its geometry.

Type Parameters
Type Parameter
T
Parameters
ParameterType
build() => Promise<T>
Returns

Promise<T>

Interfaces

SolidMesh

Defined in: bear/engine/shapes.ts:22

A solid as Three.js draws it.

Properties

PropertyTypeDescription
geometryBufferGeometry-
runs?Uint32Array<ArrayBufferLike>Each run's original ID, when the geometry has a group per run.

Functions

isShared()

function isShared(geometry): boolean;

Defined in: bear/engine/shapes.ts:79

Whether a shape cache owns geometry: a scene drawing it must not free it.

Parameters

ParameterType
geometryBufferGeometry

Returns

boolean


meshOf()

function meshOf(
   solid, 
   grouped, 
   make
): SolidMesh;

Defined in: bear/engine/shapes.ts:70

The mesh of solid, with a group per run or without. A share of a live shape gets the shape's, made once and owned by its cache; any other solid gets its own, the caller's to free.

Parameters

ParameterType
solidManifold
groupedboolean
makeMake

Returns

SolidMesh

On this page