Class: LinePrimitive
Experimental
Thick anti-aliased polylines with joins, caps, dashes, per-vertex color and per-segment width, drawn in a single instanced draw call.
Implements
Constructors
Constructor
new LinePrimitive(
ctx,
data?,
options?
): LinePrimitive;Experimental
Parameters
| Parameter | Type |
|---|---|
ctx | PrimitiveContext |
data | Partial<LineData> |
options | LinePrimitiveOptions |
Returns
LinePrimitive
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
object | readonly | Mesh<InstancedBufferGeometry, ShaderMaterial> | Experimental The mesh to add to a scene. |
Accessors
instanceCount
Get Signature
get instanceCount(): number;Experimental
Number of segment instances currently drawn (including culled gap instances).
Returns
number
stream
Get Signature
get stream(): Readonly<{
capacity: number;
head: number;
origin: Readonly<Vec3>;
sourceBase: number;
vertexCount: number;
}>;Experimental
The live vertex stream (debugging, tests): first vertex, vertex count, source serial base (see LineLayout), the RTC origin and the allocated capacity.
Returns
Readonly<{ capacity: number; head: number; origin: Readonly<Vec3>; sourceBase: number; vertexCount: number; }>
Methods
dispose()
dispose(): void;Experimental
Release GPU resources. The primitive must not be used afterwards.
Returns
void
Implementation of
setTransform()
setTransform(transform): void;Experimental
Set the data → world transform (cheap: uniforms only, no buffer uploads).
Parameters
| Parameter | Type |
|---|---|
transform | DataTransform |
Returns
void
Implementation of
setViewport()
setViewport(size): void;Experimental
Update viewport-dependent uniforms (resolution, pixel ratio).
Parameters
| Parameter | Type |
|---|---|
size | ViewportSize |
Returns
void
Implementation of
splice()
splice(
x,
y,
retain
): void;Experimental
Streaming geometry update (E7.2): equivalent to update({ x, y }), given that input vertices [retain.at, retain.at + retain.to - retain.from) of x/y equal vertices [retain.from, retain.to) of the previous input (the caller guarantees it). Only the vertex stream before and after that range is rebuilt and uploaded; the retained vertices stay where they are in the buffers and the live range slides.
Falls back to a full update for 3D (z), multiple polylines (starts), per-point colors or widths, or when the buffers have no room at the growing end (then the stream is rebuilt with slack for the next edits). Dashed lines recompute their phase (O(n) CPU, one small upload).
Parameters
| Parameter | Type |
|---|---|
x | NumericArray |
y | NumericArray |
retain | LineRetain |
Returns
void
update()
update(patch): void;Experimental
Replace or patch the primitive's data. Omitted fields keep their previous values.
Parameters
| Parameter | Type |
|---|---|
patch | Partial<LineData> |
Returns
void