Skip to content

Class: LazyMeshPrimitive ​

Experimental

A MeshPrimitive whose code loads on first use: the same data, updates, transform, light rig and picking once loaded. Until then it keeps the latest of each and draws nothing (its object is a hidden placeholder the mesh draws into later, so callers can hold it and set its renderOrder at any time). A failed load resolves ready (the mesh stays undrawn) and is retried by the next update.

Implements ​

Constructors ​

Constructor ​

ts
new LazyMeshPrimitive(context, data): LazyMeshPrimitive;

Experimental

Parameters ​

ParameterType
contextPrimitiveContext
dataMeshInput

Returns ​

LazyMeshPrimitive

Properties ​

PropertyModifierTypeDescription
objectreadonlyMeshExperimental Root object to add to a viewport's scene.

Accessors ​

mesh ​

Get Signature ​

ts
get mesh(): MeshPrimitive | null;

Experimental

The underlying mesh primitive, once loaded (else null).

Returns ​

MeshPrimitive | null


pickCount ​

Get Signature ​

ts
get pickCount(): number;

Experimental

Number of ids the pick material may write (e.g. drawn instances).

Returns ​

number

Experimental

Number of ids the pick material may write (e.g. drawn instances).

Implementation of ​

PickablePrimitive.pickCount


pickKind ​

Get Signature ​

ts
get pickKind(): "vertex" | "triangle";

Experimental

What a pick id offset counts (e.g. 'point' for markers).

Returns ​

"vertex" | "triangle"

Experimental

What a pick id offset counts (e.g. 'point' for markers).

Implementation of ​

PickablePrimitive.pickKind


ready ​

Get Signature ​

ts
get ready(): Promise<void>;

Experimental

Resolves once the mesh code has loaded (or failed to) and the mesh holds the data.

Returns ​

Promise<void>

Methods ​

createPickMaterial() ​

ts
createPickMaterial(): PickMaterialHandle;

Experimental

Only called by the picker once the mesh is drawn (the placeholder is hidden until then).

Returns ​

PickMaterialHandle

Implementation of ​

PickablePrimitive.createPickMaterial


dispose() ​

ts
dispose(): void;

Experimental

Release GPU resources. The primitive must not be used afterwards.

Returns ​

void

Implementation of ​

Primitive.dispose


setLightRig() ​

ts
setLightRig(rig): void;

Experimental

See MeshPrimitive.setLightRig.

Parameters ​

ParameterType
rigLightRig | null

Returns ​

void


setTransform() ​

ts
setTransform(transform): void;

Experimental

Set the data → world transform (cheap: uniforms only, no buffer uploads).

Parameters ​

ParameterType
transformDataTransform

Returns ​

void

Implementation of ​

Primitive.setTransform


setViewport() ​

ts
setViewport(size): void;

Experimental

Update viewport-dependent uniforms (resolution, pixel ratio).

Parameters ​

ParameterType
sizeViewportSize

Returns ​

void

Implementation of ​

Primitive.setViewport


update() ​

ts
update(patch): void;

Experimental

Replace or patch the primitive's data. Omitted fields keep their previous values.

Parameters ​

ParameterType
patchPartial<MeshData>

Returns ​

void

Implementation of ​

Primitive.update

Released under the MIT License.