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
SegmentInstanceuses, so the two kinds place geometry in one coordinate system and stroke it to one profile. - Line
Renderer - Draws segment buffers as thick glowing quads. Owns its pipeline, a fixed-capacity instance buffer, and the aspect/glow uniform.
- Segment
Instance - One line segment: endpoints
a/bin 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§
- Stroke
Metric - 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 fromprevand leaves fornext, clamped toMITER_LIMIThalf-widths (ADR-0158). - miter_
extension_ between miter_extensionfor 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.