Skip to main content

Module renderer

Module renderer 

Source
Expand description

The shared line primitive: a GPU helper that draws thick, glowing lines as instanced camera-facing quads. Each SegmentInstance (two endpoints, a colour, a half-width) is expanded in the vertex shader into a quad whose width is uniform on screen — the swarm scene’s instanced-quad pipeline (ADR-0007) with segments in place of points. Additive blend, so overlapping and dense strokes bloom.

Native wgpu line primitives are deliberately not used: their width is locked near 1px and varies by backend (ADR-0007). The buffer is fixed-capacity and reused every frame, so a full curve upload never allocates on the hot path.

Structs§

ArcInstance
One circular arc: a centre and radius in world space, a signed angular span in radians, an RGB colour and a half-width in NDC-y units — the same conventions SegmentInstance uses, so the two kinds place geometry in one coordinate system and stroke it to one profile.
LineRenderer
Draws segment buffers as thick glowing quads. Owns its pipeline, a fixed-capacity instance buffer, and the aspect/glow uniform.
SegmentInstance
One line segment: endpoints a/b in world space (x is divided by aspect in the shader, matching the swarm’s convention), an RGB colour, a half-width in world units, and the per-endpoint extension length the join needs.

Enums§

StrokeMetric
Which space the stroke is measured in (ADR-0160) — the half-width, the join extensions and the direction all three are taken along.

Constants§

MITER_LIMIT
The sharpest corner a miter is drawn for, as a multiple of the half-width the miter would reach (ADR-0158).

Functions§

miter_extension
The extension a joined end needs to reach its corner’s point: the miter length at vertex, where the chain arrives from prev and leaves for next, clamped to MITER_LIMIT half-widths (ADR-0158).
miter_extension_between
miter_extension for a chain that carries its own tangents rather than a third point — a fitted arc/line chain, where the direction a neighbour arrives or leaves at is a property of the piece and not of any vertex.