Skip to content

Class: FillPrimitive ​

Experimental

Batched polygon fills: one merged indexed geometry, one draw call for any number of polygons.

Updates: geometry keys (x, y, z, rings, polygons, fillRule) re-triangulate; color alone rewrites only the color attribute, paint only the gradient coordinates and LUT; opacity and setTransform touch uniforms only.

Implements ​

Constructors ​

Constructor ​

ts
new FillPrimitive(
   context,
   data,
   mesh?
): FillPrimitive;

Experimental

Parameters ​

ParameterTypeDescription
contextPrimitiveContext-
dataFillData-
mesh?Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>Draw into this mesh (its geometry and material are replaced) instead of a new one: LazyFillPrimitive (fill-loader.ts) hands over the placeholder it gave its caller before the fill code loaded, so the object callers hold (and its renderOrder) stays.

Returns ​

FillPrimitive

Properties ​

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

Accessors ​

current ​

Get Signature ​

ts
get current(): Readonly<FillData>;

Experimental

The current data (read-only; extruded fills take their colors from it).

Returns ​

Readonly<FillData>


polygonCount ​

Get Signature ​

ts
get polygonCount(): number;

Experimental

Number of polygons (items addressed by per-polygon colors).

Returns ​

number


ready ​

Get Signature ​

ts
get ready(): Promise<void>;

Experimental

Resolves once the pattern paint (if any) is drawn: its code loads on first use.

Returns ​

Promise<void>


triangulation ​

Get Signature ​

ts
get triangulation(): Readonly<FillTriangulation>;

Experimental

Current triangulation (read-only; for picking and tests).

Returns ​

Readonly<FillTriangulation>

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

Screen-space sizing of pattern tiles.

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

Returns ​

void

Implementation of ​

Primitive.update

Released under the MIT License.