Expand description
Line-geometry scenes (ADR-0007): a line-art category built on one shared
LineRenderer (segments -> thick glowing instanced quads) and two build
models over it — a cheap parametric system sampled every frame (the
Maurer rose) and, from Phase 3, an expensive generator system built and
cached at preset load. Ported in spirit from the user’s Maurer rose,
L-system, and Islamic-star sketches; none of that JavaScript is reused, only
the math.
The renderer and the per-frame scene halves are hot-path; the generators
(grammar/turtle/Hankin, from later phases) run only at load. All files here
live under render/ and so carry the panic pragma the hygiene guard scans
for recursively — the build-time files are written panic-free too.
Re-exports§
pub use lsystem::LSystemScene;pub use parametric::ParametricCurveScene;pub use renderer::ArcInstance;pub use renderer::LineRenderer;pub use renderer::MITER_LIMIT;pub use renderer::SegmentInstance;pub use renderer::StrokeMetric;pub use renderer::miter_extension;pub use spectrum::SpectrumLayout;pub use spectrum::SpectrumScene;pub use star::StarPatternScene;pub use super::CapOverflow;pub use super::GeneratorConfig;pub use super::OverflowContext;
Modules§
- biarc
- Biarc fitting: a sampled outline in, a G1-continuous chain of circular arcs out (ADR-0098).
- curves
- Parametric curve samplers: pure
t -> (x, y)functions written straight into a preallocated segment buffer. Cheap enough to resample every frame (ADR-0007 parametric build model), so continuous audio can sweep the shape live. Deterministic: no wall-clock, no randomness — the same parameters always yield the same segments (NFR 6). - grammar
- L-system grammar expansion: pure, deterministic string rewriting. Applies a
production rule set to an axiom
depthtimes — each character is replaced by its successor (or kept if no rule matches). This is a build-time step (runs insideScene::configure, off the hot path), not per-frame work. - hankin
- Hankin star patterns: build an n-fold star rosette by the contact-angle
method.
ncontact points sit symmetrically on a circle; from each, a ray leaves at the contact angle from the inward normal, and adjacent rays meet at the petal tips. Connecting each contact point to its two neighbouring tips traces the interlaced star. - lsystem
- L-system scene: expensive to build, cheap to animate (ADR-0007 generator
build model). At preset load (
configure, off the hot path) the grammar is expanded and turtle-walked into one cached segment buffer per depth1..=max_depth. Per frame the scene only picks the visible depth and applies a rotation / scale / colour / draw-on transform into the draw buffer — no expansion, no allocation. - parametric
- Parametric-curve scene: a pure
t -> (x, y)curve resampled every frame into the sharedLineRenderer(ADR-0007 parametric build model). Phase 1 is hardcoded to one Maurer rose that gently rotates on the deterministic scene clock; Phase 2 makes the curve family and every named parameter preset-driven so audio can sweep it live. - renderer
- 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. - spectrum
- Spectrum scene (Plan 0034 / ADR-0036): the analysis frame’s log-spaced band array, drawn as N elements.
- star
- Star-pattern scene: a Hankin star rosette built from a continuous contact
angle and cached (ADR-0007 generator build model), cheap to animate. Per
frame the scene resolves
variantto an angle, reuses the cached rosette unless the request has moved more than one step, and applies a rotate/scale/colour/draw-on transform (allocation-free). - turtle
- Turtle interpretation: walk an L-system string into line segments, with a
branch stack for
[/]. A build-time step (runs insideScene::configure, off the hot path) that produces the base geometry a generator scene caches and then only transforms per frame.
Structs§
- View
Transform - The shared camera transform every scene family applies (ADR-0018): a uniform
zoom about the frame centre, then a pan, in world space before the
aspect divide. Identity (
zoom = 1,pan = 0) leaves geometry exactly where a scene placed it, so a preset that binds none ofzoom/pan_x/pan_yis unchanged.#[repr(C)]+Podso it uploads straight into a line-renderer uniform slot. Rotate is reserved for a follow-up (ADR-0018 reserves it).
Enums§
- Curve
Family - Which parametric curve family a
[curve]preset draws. Extend as Plan 0010’s follow-ups add curve families (epicycloids, Lissajous, …); unknown names are rejected at load.
Constants§
- ADDITIVE_
BLEND - The
stroke_blenda line scene draws at when its preset binds nothing — additive light, ADR-0056’s seam, and what every line scene drew before the selector existed. - DEFAULT_
SOFTNESS - The across-the-stroke profile the four line families draw at unless a
preset binds
softnessitself (ADR-0124). - DRAW_
PROGRESS draw_progress, shared: how much of the figure has been drawn.- GLOW
glow, shared: the halo around a stroke, on top of the stroke itself.- MAX_
LSYSTEM_ DEPTH - Hard clamp on L-system iteration depth, enforced at preset load. A branching
rule expands exponentially, so an unbounded
max_depthwould stall a preset switch and blow the segment cap (ADR-0007 Risks). Curated presets stay well under this; the turtle’s own segment cap is the second backstop. - MAX_
MIRROR_ ORDER - Hard clamp on the geometry-mirror rotational order (Plan 0018 Phase 4). Beyond
a couple dozen the fold is visually indistinguishable and only multiplies
segment count toward the cap; a sane ceiling keeps a runaway
mirror_orderexpression from doing useless work before the segment cap bites. - MIN_
HALF_ WIDTH - The smallest half-width a stroke is drawn at, whatever
thicknessasks for. - MIN_
USEFUL_ THICKNESS - The
thicknessat whichMIN_HALF_WIDTHstops binding — about0.167. - MIRROR_
ORDER mirror_order, shared: how many copies of the geometry ring the centre.- MIRROR_
REFLECT mirror_reflect, shared: whether those copies alternate as mirror images.- OPAQUE_
BLEND - The
stroke_blendlevel at or above which a line scene draws through the opacity-preserving seam (ADR-0138). Below it the batch is additive light. - SOFTNESS
- The stroke and framing parameters every line system shares, declared once
(ADR-0170) — the line-art half of what
scenes::commondoes for colour. - STROKE_
BLEND stroke_blend, shared: additive light at 0, opaque paint at 1.- WIDTH_
SCALE - Maps the
thicknessparameter (a small integer-ish stroke weight) to an NDC-y half-width;thickness = 2gives a comfortably thick projector line.
Functions§
- half_
width - The NDC-y half-width a line scene strokes
thicknessat — the one place the scale and the floor are applied, shared by all four line scenes. - hue_
spread hue_spreadat the scene’s own resting width.- palette
- iq-style cosine palette (RGB phase-shifted), matching the swarm/fragment scenes so line art shares the engine’s colour language.
- scale
scaleat the scene’s own resting size.- thickness
thicknessat the scene’s own resting width, in pixels at the render target.