Renderer · function

setPolyline

Rewrite a polyline from a flat point list, three floats a point.

Explained in Hello world.

function setPolyline(out: LineSegments, points: ArrayLike<number>, pointCount: number): number
import { setPolyline } from '@driftengine/core';

Parameters

ParameterTypeDescription
outLineSegments
pointsArrayLike<number>
pointCountnumber

In depth

Returns how many segments were written, which is pointCount - 1 clamped to capacity: a caller that overruns loses its tail rather than its frame, the same rule expandBoltSegments follows.

A list of one point writes nothing rather than a zero-length segment. A degenerate segment is not harmless: its direction is undefined, so the shader falls back to an arbitrary perpendicular and draws a quad of full width pointing nowhere.