Skip to content

Class: ImagePrimitive ​

Experimental

A single fitted image. ready resolves (never rejects) once the current source has loaded or failed; nothing is drawn until then, or after a failure.

Implements ​

Constructors ​

Constructor ​

ts
new ImagePrimitive(
   context,
   data,
   options?
): ImagePrimitive;

Experimental

Parameters ​

ParameterType
contextPrimitiveContext
dataPick<ImageQuadData, "source" | "x0" | "y0" | "x1" | "y1"> & Partial<ImageQuadData>
optionsImageOptions

Returns ​

ImagePrimitive

Properties ​

PropertyModifierTypeDescription
objectreadonlyMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, ShaderMaterial>Experimental Root object to add to a viewport's scene.

Accessors ​

naturalHeight ​

Get Signature ​

ts
get naturalHeight(): number;

Experimental

Natural pixel height of the loaded image (0 until loaded).

Returns ​

number


naturalWidth ​

Get Signature ​

ts
get naturalWidth(): number;

Experimental

Natural pixel width of the loaded image (0 until loaded).

Returns ​

number


ready ​

Get Signature ​

ts
get ready(): Promise<void>;

Experimental

Resolves once the current source has loaded or failed (never rejects).

Returns ​

Promise<void>


status ​

Get Signature ​

ts
get status(): ImageStatus;

Experimental

Returns ​

ImageStatus

Methods ​

dispose() ​

ts
dispose(): void;

Experimental

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

Returns ​

void

Implementation of ​

Primitive.dispose


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

Images have no screen-space sizing.

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<ImageQuadData>

Returns ​

void

Implementation of ​

Primitive.update

Released under the MIT License.