Renderer · interface

LineSegments

A polyline as the segments a renderer draws, rewritten in place.

Explained in Hello world.

interface LineSegments
import type { LineSegments } from '@driftengine/core';

In depth

No GL here, for the reason sdfTextLayout.ts gives: which segments a point list produces is the same arithmetic on either backend, so it lives once and the two renderers own only their buffers. It is also the half worth testing, and testing it needs no context.

A caller owns one of these for the life of its polyline and rewrites it per frame. That is the whole shape of the thing: an audio waveform, a moving trail and a plotted curve all have a fixed point count and moving points, and none of them should be allocating.

Properties

NameTypeDescription
fromFloat32Arrayfrom and to per segment, three floats each, live segments first.
toFloat32Array
countnumberHow many segments of the above are live.
capacityreadonlynumber