@wave3d/core 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/model.d.ts +34 -0
- package/dist/config/model.js +33 -0
- package/dist/config/model.js.map +1 -1
- package/dist/renderer/WaveRenderer.d.ts +25 -0
- package/dist/renderer/WaveRenderer.js +190 -1
- package/dist/renderer/WaveRenderer.js.map +1 -1
- package/dist/renderer/shaders.js +213 -6
- package/dist/renderer/shaders.js.map +1 -1
- package/dist/standalone/wave3d.standalone.js +367 -219
- package/dist/studio/index.d.ts +2 -2
- package/dist/studio/index.js +2 -2
- package/dist/studio/randomize.d.ts +4 -1
- package/dist/studio/randomize.js +48 -1
- package/dist/studio/randomize.js.map +1 -1
- package/package.json +1 -1
- package/skills/wave3d/SKILL.md +40 -4
package/dist/config/model.d.ts
CHANGED
|
@@ -238,6 +238,11 @@ interface SceneInteractionConfig {
|
|
|
238
238
|
enabled?: boolean;
|
|
239
239
|
/** Pointer falloff radius, as a fraction of viewport height. Default 0.3. */
|
|
240
240
|
radius?: number;
|
|
241
|
+
/** Ribbon flow (0..1, default 0.8): stretch the pointer footprint along each wave's own length axis
|
|
242
|
+
* so the influence reaches ALONG the ribbon instead of as a circular screen disc. On by default;
|
|
243
|
+
* set 0 for the plain circle. Scene-level (shared like `radius`); each wave uses its own length
|
|
244
|
+
* tangent. Only affects waves that already react to the cursor (non-interactive waves are inert). */
|
|
245
|
+
ribbonFlow?: number;
|
|
241
246
|
/** Follow coarse (touch) pointers. Default false — touch is ignored unless this is true. */
|
|
242
247
|
touch?: boolean;
|
|
243
248
|
/** Input→param bindings driving SCENE params (timeOffset, cameraZoom, blur, grain). */
|
|
@@ -291,6 +296,35 @@ interface SceneConfig {
|
|
|
291
296
|
bloomStrength?: number;
|
|
292
297
|
bloomRadius?: number;
|
|
293
298
|
bloomThreshold?: number;
|
|
299
|
+
/** Ordered (Bayer) dithering over the finished composite — a self-contained "layered" post
|
|
300
|
+
* shader in the spirit of paper-design/shaders. 0 removes the pass entirely (cost/pixels match
|
|
301
|
+
* dither-off); scale & steps only bite once dither > 0. Runs last, after tone-map + sRGB. */
|
|
302
|
+
dither?: number;
|
|
303
|
+
/** Dither cell size in device pixels (>=1) — larger = chunkier pattern. */
|
|
304
|
+
ditherScale?: number;
|
|
305
|
+
/** Quantization levels per channel (>=2) — lower = heavier posterization. */
|
|
306
|
+
ditherSteps?: number;
|
|
307
|
+
/** Volumetric light streaks (innerLight) scattered from the bright wave toward a light point
|
|
308
|
+
* (innerLightX/Y in UV). 0 removes the pass; density/decay/centre only bite once innerLight > 0.
|
|
309
|
+
* Scene-zone (scatters the raw wave, like bloom). */
|
|
310
|
+
innerLight?: number;
|
|
311
|
+
innerLightDensity?: number;
|
|
312
|
+
innerLightDecay?: number;
|
|
313
|
+
innerLightX?: number;
|
|
314
|
+
innerLightY?: number;
|
|
315
|
+
/** Halftone: a rotated dot screen (dot size scales with local brightness) over the final image.
|
|
316
|
+
* 0 removes the pass; cell/angle only bite once halftone > 0. Finish-zone stylization. */
|
|
317
|
+
halftone?: number;
|
|
318
|
+
halftoneCell?: number;
|
|
319
|
+
halftoneAngle?: number;
|
|
320
|
+
/** Heatmap recolour (luminance → thermal palette). 0 removes the pass. Finish-zone. */
|
|
321
|
+
heatmap?: number;
|
|
322
|
+
/** Paper-texture overlay (fibrous substrate shading). 0 removes the pass; scale = grain size. */
|
|
323
|
+
paperTexture?: number;
|
|
324
|
+
paperTextureScale?: number;
|
|
325
|
+
/** CMYK halftone (four rotated dot screens). 0 removes the pass; cell = dot size px. */
|
|
326
|
+
halftoneCmyk?: number;
|
|
327
|
+
halftoneCmykCell?: number;
|
|
294
328
|
/** Base ambient light level (0–1). */
|
|
295
329
|
ambient: number;
|
|
296
330
|
lights: LightConfig[];
|
package/dist/config/model.js
CHANGED
|
@@ -341,6 +341,22 @@ function createDefaultConfig() {
|
|
|
341
341
|
grain: 1.1,
|
|
342
342
|
blur: .02,
|
|
343
343
|
blurSamples: 6,
|
|
344
|
+
dither: 0,
|
|
345
|
+
ditherScale: 2,
|
|
346
|
+
ditherSteps: 4,
|
|
347
|
+
innerLight: 0,
|
|
348
|
+
innerLightDensity: .5,
|
|
349
|
+
innerLightDecay: .95,
|
|
350
|
+
innerLightX: .5,
|
|
351
|
+
innerLightY: .15,
|
|
352
|
+
halftone: 0,
|
|
353
|
+
halftoneCell: 6,
|
|
354
|
+
halftoneAngle: .4,
|
|
355
|
+
heatmap: 0,
|
|
356
|
+
paperTexture: 0,
|
|
357
|
+
paperTextureScale: 2,
|
|
358
|
+
halftoneCmyk: 0,
|
|
359
|
+
halftoneCmykCell: 6,
|
|
344
360
|
ambient: .45,
|
|
345
361
|
lights: [],
|
|
346
362
|
mirrorH: false,
|
|
@@ -517,6 +533,22 @@ function ensureSceneDefaults(config) {
|
|
|
517
533
|
if (typeof config.bloomStrength !== "number") config.bloomStrength = 0;
|
|
518
534
|
if (typeof config.bloomRadius !== "number") config.bloomRadius = .4;
|
|
519
535
|
if (typeof config.bloomThreshold !== "number") config.bloomThreshold = .85;
|
|
536
|
+
if (typeof config.dither !== "number") config.dither = 0;
|
|
537
|
+
if (typeof config.ditherScale !== "number") config.ditherScale = 2;
|
|
538
|
+
if (typeof config.ditherSteps !== "number") config.ditherSteps = 4;
|
|
539
|
+
if (typeof config.innerLight !== "number") config.innerLight = 0;
|
|
540
|
+
if (typeof config.innerLightDensity !== "number") config.innerLightDensity = .5;
|
|
541
|
+
if (typeof config.innerLightDecay !== "number") config.innerLightDecay = .95;
|
|
542
|
+
if (typeof config.innerLightX !== "number") config.innerLightX = .5;
|
|
543
|
+
if (typeof config.innerLightY !== "number") config.innerLightY = .15;
|
|
544
|
+
if (typeof config.halftone !== "number") config.halftone = 0;
|
|
545
|
+
if (typeof config.halftoneCell !== "number") config.halftoneCell = 6;
|
|
546
|
+
if (typeof config.halftoneAngle !== "number") config.halftoneAngle = .4;
|
|
547
|
+
if (typeof config.heatmap !== "number") config.heatmap = 0;
|
|
548
|
+
if (typeof config.paperTexture !== "number") config.paperTexture = 0;
|
|
549
|
+
if (typeof config.paperTextureScale !== "number") config.paperTextureScale = 2;
|
|
550
|
+
if (typeof config.halftoneCmyk !== "number") config.halftoneCmyk = 0;
|
|
551
|
+
if (typeof config.halftoneCmykCell !== "number") config.halftoneCmykCell = 6;
|
|
520
552
|
if (typeof config.showCameraRig !== "boolean") config.showCameraRig = false;
|
|
521
553
|
if (typeof config.paused !== "boolean") config.paused = false;
|
|
522
554
|
if (typeof config.loopSeconds !== "number") config.loopSeconds = 0;
|
|
@@ -586,6 +618,7 @@ function normalizeSceneInteraction(config) {
|
|
|
586
618
|
const it = config.interaction;
|
|
587
619
|
if (!it) return;
|
|
588
620
|
if (it.radius !== void 0) it.radius = clampNumber(it.radius, .02, 2, .3);
|
|
621
|
+
if (it.ribbonFlow !== void 0) it.ribbonFlow = clampNumber(it.ribbonFlow, 0, 1, .8);
|
|
589
622
|
if (it.bindings !== void 0) it.bindings = cleanBindings(it.bindings, SCENE_TARGET_NAMES);
|
|
590
623
|
}
|
|
591
624
|
/** Normalize an ingested config to the wave model: backfill the scene + every wave, and drop in
|
package/dist/config/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":[],"sources":["../../src/config/model.ts"],"sourcesContent":["/**\n * Configuration schema for the wave: a flat sheet displaced by noise (X/Z frequency\n * + amount) then twisted by three axis-rotations (twistFrequency + twistPower per\n * axis), then scaled / rotated / positioned. Plain JSON — doubles as the save-state\n * format.\n */\n\nimport { clamp, clamp01 } from \"../util/math\";\n\nexport const MAX_COLORS = 8;\nexport const MAX_MESH_POINTS = 8;\nexport const MAX_LIGHTS = 8;\nexport const MAX_NOISE_BANDS = 4;\n/** Cap on stacked waves (keeps total geometry bounded — see WaveRenderer segment scaling). */\nexport const MAX_WAVES = 6;\n\nexport interface Vec2 {\n x: number;\n y: number;\n}\n\nexport interface Vec3 {\n x: number;\n y: number;\n z: number;\n}\n\n// \"squared\" = the hero material blend: SrcColor × Zero (framebuffer = fragColor²), which\n// deepens the colours — the faithful default. \"normal\"/\"additive\"/\"multiply\" are authoring\n// overrides (\"multiply\" darkens where waves/background overlap).\nexport type BlendMode = \"squared\" | \"normal\" | \"additive\" | \"multiply\";\n\n/** How the palette is mapped across the surface. */\nexport type BasicGradientType = \"linear\" | \"radial\" | \"conic\";\nexport type GradientType = BasicGradientType | \"mesh\";\n\nexport type BackgroundMode = \"color\" | \"gradient\" | \"image\";\nexport type BackgroundImageFit = \"cover\" | \"contain\" | \"stretch\";\n\n/** What fills the 2D palette texture: the baked hero LUT, our editable stops, or\n * a named built-in map (see PALETTE_MAPS). Any string is allowed for forward-compat. */\nexport type PaletteSource = \"hero\" | \"stops\" | (string & {});\n\n/** A positionable light. `position` lives in the same 3D space as the wave. */\nexport interface LightConfig {\n position: Vec3;\n color: string;\n intensity: number;\n}\n\n/** A default light; pass overrides for added fill lights. */\nexport function createLight(\n position: Vec3 = { x: 300, y: 500, z: 800 },\n intensity = 1,\n): LightConfig {\n return { position: { ...position }, color: \"#ffffff\", intensity };\n}\n\n/** Where the first light lands when you engage lights from an empty scene. Shared by the\n * \"drag in 3D\" control and the camera-rig minimap, which previews a light marker here so the\n * rig always shows the light — even before one has been explicitly added. */\nexport const DEFAULT_LIGHT_POSITION: Vec3 = { x: 800, y: 900, z: 1100 };\n\n/**\n * A noise band: inside a rectangular uv region (startX..endX along the length,\n * startY..endY across the width, softened by `feather`), the fiber streaks are\n * overridden — strength, frequency (density), colourAttenuation (how much the local\n * colour suppresses them), and the end-weighting parabolaPower. Lets the fibers vary\n * per region instead of uniform.\n */\nexport interface NoiseBand {\n startX: number;\n endX: number;\n startY: number;\n endY: number;\n feather: number;\n strength: number;\n frequency: number;\n colorAttenuation: number;\n parabolaPower: number;\n}\n\n/** A default band: a strong, coarse streak region over the first half. */\nexport function createNoiseBand(): NoiseBand {\n return {\n startX: 0.0,\n endX: 0.5,\n startY: 0.0,\n endY: 1.0,\n feather: 0.3,\n strength: 1.0,\n frequency: 220,\n colorAttenuation: 0.0,\n parabolaPower: 2.0,\n };\n}\n\n/** One gradient stop: a colour at a normalized position (0–1) across the width. */\nexport interface ColorStop {\n color: string;\n pos: number;\n}\n\n/** One colour influence point in the 2D mesh-gradient field. */\nexport interface MeshGradientPoint {\n color: string;\n /** Horizontal UV position (0–1). */\n x: number;\n /** Vertical UV position (0–1). */\n y: number;\n /** Relative reach of this point's colour field. */\n influence: number;\n}\n\n/** Build evenly-spaced stops from a plain list of colours. */\nexport function makeStops(colors: string[]): ColorStop[] {\n const n = colors.length;\n return colors.map((color, i) => ({ color, pos: n > 1 ? i / (n - 1) : 0 }));\n}\n\n/** A balanced iOS-style field shown the first time Mesh is selected. */\nexport function createDefaultMeshPoints(): MeshGradientPoint[] {\n return [\n { color: \"#5e5ce6\", x: 0.08, y: 0.12, influence: 0.78 },\n { color: \"#64d2ff\", x: 0.88, y: 0.08, influence: 0.72 },\n { color: \"#ff375f\", x: 0.12, y: 0.88, influence: 0.72 },\n { color: \"#ff9f0a\", x: 0.9, y: 0.86, influence: 0.78 },\n { color: \"#bf5af2\", x: 0.5, y: 0.48, influence: 0.58 },\n ];\n}\n\n/**\n * A single wave: a COMPLETE, self-contained wave — its own shape, twist, colour, finish,\n * transform and blend. Stacking waves composites independent waves; there is no shared\n * \"base wave\" any more, so nothing is duplicated between a global section and the waves.\n * Field names mirror the legacy top-level wave fields so migration + the per-section helpers\n * (normalizeWaveColour, randomize*) map 1:1.\n */\nexport interface WaveConfig {\n // Colour & gradient\n palette: ColorStop[];\n gradientType: GradientType;\n gradientAngle: number;\n gradientShift: number;\n meshGradientPoints: MeshGradientPoint[];\n meshGradientSoftness: number;\n usePaletteTexture: boolean;\n paletteSource: PaletteSource;\n paletteImageUrl?: string;\n paletteVideoUrl?: string;\n paletteTextureScale: Vec2;\n paletteTextureOffset: Vec2;\n paletteTextureRotation: number;\n /** Palette-offset drift per second (animates colour independently of the geometry; 0 = static).\n * Applies to any texture palette (not mesh / procedural stops). */\n paletteDriftX: number;\n paletteDriftY: number;\n paletteEdgeColor: string;\n paletteEdgeAmount: number;\n hueShift: number;\n colorContrast: number;\n colorSaturation: number;\n // Surface finish\n fiberCount: number;\n fiberStrength: number;\n noiseBands: NoiseBand[];\n texture: number;\n creaseLight: number;\n creaseSharpness: number;\n creaseSoftness: number;\n sheen: number;\n roundness: number;\n /** Thin-film / holographic hue response that shifts with view angle (0 = off). */\n iridescence: number;\n edgeFade: number;\n /** Softness of the ribbon's long edges (smoothstep width across uv.y). 0.1 = the original\n * hardcoded value; smaller = razor-crisp graphic ribbons, larger = soft vapor. */\n edgeFeather: number;\n /** Depth tint (solid theme): fade far fragments toward depthTintColor for atmospheric\n * separation in multi-wave stacks (0 = off). */\n depthTint: number;\n depthTintColor: string;\n // Displacement + twist (the wave shape)\n displaceFrequency: Vec2;\n displaceAmount: number;\n /** Optional 2nd displacement octave: finer ripples riding on the broad swell (amount 0 = off). */\n detailFrequency: number;\n detailAmount: number;\n twistFrequency: Vec3;\n twistPower: Vec3;\n twistMotion?: boolean;\n // Material (\"solid\" surface vs \"wireframe\" line shader)\n theme?: \"solid\" | \"wireframe\";\n lineAmount?: number;\n lineThickness?: number;\n lineDerivativePower?: number;\n maxWidth?: number;\n // Transform (absolute — no shared base to offset from)\n position: Vec3;\n rotation: Vec3;\n scale: Vec3;\n // Compositing\n blendMode: BlendMode;\n /** Absolute animation speed for this wave (legacy global speed × per-layer multiplier). */\n speed: number;\n /** Overall opacity of this wave. */\n opacity: number;\n /** Phase/seed so waves don't move in lockstep. */\n seed: number;\n /** Optional per-wave interactivity: how THIS wave reacts to the shared pointer + inputs (hover\n * field, click ripples, param bindings). ABSENT = this wave is inert / byte-identical. */\n interaction?: WaveInteractionConfig;\n}\n\n// ---------------------------------------------------------------------------------------------\n// Interactivity layer (optional, additive, default-off). Split by concern: the SHARED inputs (one\n// cursor + scroll + smoothing/touch) and scene-param effects live on SceneConfig.interaction; each\n// wave's own RESPONSE (hover field, click ripples, param bindings) lives on WaveConfig.interaction.\n// ABSENT blocks mean fully off — the compiled shader and rendered pixels stay byte-identical to a\n// non-interactive wave (the normalizers below run present-only; ensureSceneDefaults never calls them).\n// ---------------------------------------------------------------------------------------------\n\n/** The built-in interaction input names (the open-ended `custom:*` family is handled separately).\n * Kept in sync by hand with the {@link InteractionSource} union below. */\nconst INTERACTION_SOURCE_NAMES = [\n \"scroll\",\n \"hover\",\n \"pointerX\",\n \"pointerY\",\n \"pointerSpeed\",\n \"press\",\n \"scrollVelocity\",\n \"appear\",\n] as const;\n\n/**\n * An interaction INPUT: a normalized signal that can smoothly drive config params through an\n * {@link InteractionBinding}. Every source is exponentially smoothed before it is applied.\n */\nexport type InteractionSource =\n | \"scroll\" // container progress through the viewport, 0 (entering) .. 1 (scrolled past)\n | \"hover\" // smoothed pointer presence over the container, 0..1\n | \"pointerX\" // smoothed pointer X across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerY\" // smoothed pointer Y across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerSpeed\" // normalized smoothed pointer speed, 0..1\n | \"press\" // pointer button / touch held, smoothed 0..1\n | \"scrollVelocity\" // normalized smoothed |d(scroll progress)/dt|, 0..1\n | \"appear\" // one-shot 0→1 latch on first visibility (entrance choreography)\n | `custom:${string}`; // developer-fed each frame via setInteractionInput(name, value)\n\n/** Per-WAVE params a binding may drive. Single source of truth for WAVE_APPLIERS in\n * renderer/interaction.ts (checked via `satisfies`) and validated by normalizeWaveInteraction. */\nconst WAVE_TARGET_NAMES = [\n \"displaceAmount\",\n \"detailAmount\",\n \"twistPowerX\",\n \"twistPowerY\",\n \"twistPowerZ\",\n \"twistFrequencyX\",\n \"twistFrequencyY\",\n \"twistFrequencyZ\",\n \"hueShift\",\n \"gradientShift\",\n \"colorSaturation\",\n \"opacity\",\n \"lineThickness\",\n \"lineAmount\",\n \"fiberStrength\",\n \"sheen\",\n \"iridescence\",\n \"positionX\",\n \"positionY\",\n] as const;\n/** A per-wave param a {@link WaveInteractionBinding} can drive. */\nexport type WaveInteractionTarget = (typeof WAVE_TARGET_NAMES)[number];\n\n/** SCENE params a binding may drive (post / camera / time — shared, not per wave). Single source of\n * truth for SCENE_APPLIERS in renderer/interaction.ts, validated by normalizeSceneInteraction. */\nconst SCENE_TARGET_NAMES = [\"timeOffset\", \"cameraZoom\", \"blur\", \"grain\"] as const;\n/** A scene-level param a {@link SceneInteractionBinding} can drive. */\nexport type SceneInteractionTarget = (typeof SCENE_TARGET_NAMES)[number];\n\n/** Shared fields of an input→param binding: per frame `value = mix(from ?? authoredBase, to,\n * smoothedSource)`, written straight to uniforms — never mutates config, so any refresh restores\n * the authored base (removal needs no undo step). */\ninterface InteractionBindingBase {\n /** The input signal driving this binding. */\n source: InteractionSource;\n /** Value at source = 0. OMITTED = the authored base value, so at rest the authored look shows. */\n from?: number;\n /** Value at source = 1. */\n to: number;\n /** Exponential smoothing time constant, seconds (default 0.25); also shapes the `appear` ramp. */\n smoothing?: number;\n}\n/** A binding on a wave, driving one of that wave's params. */\nexport interface WaveInteractionBinding extends InteractionBindingBase {\n target: WaveInteractionTarget;\n}\n/** A scene-level binding, driving a shared scene param. */\nexport interface SceneInteractionBinding extends InteractionBindingBase {\n target: SceneInteractionTarget;\n}\n\n/** Hover pointer-field: localized effects that follow the cursor over this wave. Present ⇒ the\n * POINTER_FX shader path compiles for this wave; an absent effect is 0 (inert). */\nexport interface WaveHoverConfig {\n /** Local churn-octave amplitude near the cursor — the wave agitates under the pointer. The studio\n * defaults this positive when you enable a hover field, so a fresh hover reacts out of the box. */\n agitate?: number;\n /** Membrane push/pull: a smooth dome at the cursor that swells toward you (repel, +) or dents away\n * (attract, −), carried by the sprung field so it drags like a poke under fabric. World units;\n * 0 = off. */\n push?: number;\n /** Drag-wake: while the cursor moves, the surface just BEHIND it is pulled into a trailing trough\n * that heals once you stop; scales with pointer speed. World units; 0 = off. */\n wake?: number;\n /** 0..1 — wireframe strands taper to hairlines; solid gains local translucency. */\n thin?: number;\n /** Local hue rotation near the cursor, degrees. */\n hueShift?: number;\n /** Local brightness lift near the cursor, -1..1. */\n lighten?: number;\n /** Pointer-follow smoothing for THIS wave's hover field, seconds — how quickly the swell trails\n * the cursor. Vary it across a stack so strands lag at different rates (a parallax drag).\n * Default 0.12. */\n smoothing?: number;\n}\n\n/** Click / touch pointer-field: what a tap or click on this wave triggers. */\nexport interface WavePressConfig {\n /** Click-ripple amplitude; 0 keeps this wave's POINTER_RIPPLES path uncompiled. */\n ripple?: number;\n}\n\n/** Per-wave interactivity: this wave's own reaction to the shared pointer + inputs. ABSENT ⇒ inert. */\nexport interface WaveInteractionConfig {\n /** Hover field (cursor-follow agitation / thinning / hue-lighten). */\n hover?: WaveHoverConfig;\n /** Click & touch (ripples radiating from a tap/click on this wave). */\n press?: WavePressConfig;\n /** Input→param bindings driving THIS wave's params (any source, incl. scroll / hover / custom). */\n bindings?: WaveInteractionBinding[];\n}\n\n/** Scene-level interactivity: the SHARED inputs (one cursor + scroll, touch) plus bindings that\n * drive shared scene params. Pointer-follow smoothing is per-wave (see WaveHoverConfig.smoothing).\n * ABSENT ⇒ inputs use defaults; `enabled: false` is the master OFF switch for the whole layer. */\nexport interface SceneInteractionConfig {\n /** Master switch for the whole interaction layer. Default true (only `false` turns it all off). */\n enabled?: boolean;\n /** Pointer falloff radius, as a fraction of viewport height. Default 0.3. */\n radius?: number;\n /** Follow coarse (touch) pointers. Default false — touch is ignored unless this is true. */\n touch?: boolean;\n /** Input→param bindings driving SCENE params (timeOffset, cameraZoom, blur, grain). */\n bindings?: SceneInteractionBinding[];\n}\n\n/**\n * Scene-level settings shared by every wave: output/background/camera/lights, the post-fx\n * pass (grain/blur), playback, quality, and the whole-composition mirror. Everything that\n * describes an individual wave lives on WaveConfig instead.\n */\nexport interface SceneConfig {\n background: string;\n transparentBackground: boolean;\n backgroundMode: BackgroundMode;\n backgroundPalette: ColorStop[];\n backgroundGradientType: GradientType;\n backgroundGradientAngle: number;\n backgroundGradientSource: PaletteSource;\n backgroundMeshPoints: MeshGradientPoint[];\n backgroundMeshSoftness: number;\n backgroundImageSource: PaletteSource;\n backgroundImageUrl?: string;\n backgroundVideoUrl?: string;\n backgroundImageFit: BackgroundImageFit;\n backgroundImageZoom: number;\n backgroundImagePosition: Vec2;\n /** Number of stacked waves (kept in sync with waves.length). */\n waveCount: number;\n quality: number;\n dprMax: number;\n paused: boolean;\n /** Noise phase offset — scrubs the noise pattern to pick a still frame. */\n timeOffset?: number;\n /** Seamless-loop period in seconds (0 = off). When >0, the motion is mapped onto a circle in\n * noise space so it repeats exactly every `loopSeconds` — scene-level so a multi-wave stack\n * shares one period and the whole composite loops. */\n loopSeconds?: number;\n introRamp?: boolean;\n showCameraRig: boolean;\n cameraDistance: number;\n cameraZoom: number;\n cameraPosition: Vec3;\n cameraTarget: Vec3;\n /** Film grain amount (post pass). */\n grain: number;\n /** Soft-focus / spin blur amount (post pass). */\n blur: number;\n blurSamples?: number;\n /** Bloom (post pass, UnrealBloomPass). strength 0 removes the pass entirely, so cost and pixels\n * are identical to bloom-off; radius/threshold only take effect once strength > 0. */\n bloomStrength?: number;\n bloomRadius?: number;\n bloomThreshold?: number;\n /** Base ambient light level (0–1). */\n ambient: number;\n lights: LightConfig[];\n /** Mirror the whole composition on screen (world-space flip). */\n mirrorH: boolean;\n mirrorV: boolean;\n /** Shared interaction inputs (one cursor + scroll) + scene-param bindings. Per-wave response\n * lives on each WaveConfig.interaction. ABSENT = defaults; `enabled:false` disables the layer. */\n interaction?: SceneInteractionConfig;\n}\n\n/** The full save-state: scene settings + one or more complete waves. */\nexport interface StudioConfig extends SceneConfig {\n waves: WaveConfig[];\n}\n\n/** Spread a base wave into `count` overlapping waves — each with a slightly varied hue, width,\n * speed, phase, vertical offset and roll so a stack reads as one composition. `count === 1`\n * returns the base unchanged. Used to author multi-wave presets. */\nexport function makeWaveSpread(base: WaveConfig, count: number): WaveConfig[] {\n if (count <= 1) return [structuredClone(base)];\n const out: WaveConfig[] = [];\n for (let i = 0; i < count; i++) {\n const f = i / (count - 1);\n const w = structuredClone(base);\n w.opacity = 1.0 - f * 0.3;\n w.hueShift = base.hueShift + i * 18;\n w.scale = { x: base.scale.x, y: base.scale.y * (1 - f * 0.2), z: base.scale.z };\n w.speed = base.speed * (1 + f * 0.15);\n w.seed = i * 3.3;\n w.position = {\n x: base.position.x,\n y: base.position.y + (f - 0.5) * 1.5,\n z: base.position.z - i * 0.8,\n };\n w.rotation = { x: base.rotation.x, y: base.rotation.y, z: base.rotation.z + i * 20 };\n out.push(w);\n }\n return out;\n}\n\n/** The hero wave (a single complete wave) — the base for the default config and most presets. */\nfunction defaultWave(): WaveConfig {\n return {\n // The hero palette: a periwinkle tip/edge, a dominant orange core, then coral → magenta →\n // pink, with a violet twist tip. gradientShift warps it to mimic a baked 2D palette texture.\n palette: [\n { color: \"#8e9dff\", pos: 0 }, // periwinkle (blue tip/edge)\n { color: \"#c98fd0\", pos: 0.14 }, // lavender transition\n { color: \"#ff9326\", pos: 0.3 }, // orange (rising)\n { color: \"#fd8108\", pos: 0.52 }, // orange core\n { color: \"#fb7a36\", pos: 0.64 }, // orange-coral (keeps orange dominant)\n { color: \"#d24ecc\", pos: 0.78 }, // true magenta (hue ~303, not pink)\n { color: \"#e95cae\", pos: 0.9 }, // pink-magenta\n { color: \"#9b6ae0\", pos: 1.0 }, // violet (twist tip)\n ],\n gradientType: \"linear\",\n gradientAngle: 90, // 90° = the gradient runs ALONG the length (uv.x)\n gradientShift: 0.15,\n meshGradientPoints: createDefaultMeshPoints(),\n meshGradientSoftness: 0.62,\n usePaletteTexture: true, // default to the baked hero LUT\n paletteSource: \"hero\",\n paletteTextureScale: { x: 1, y: 1 },\n paletteTextureOffset: { x: 0, y: 0 },\n paletteTextureRotation: 0,\n paletteDriftX: 0,\n paletteDriftY: 0,\n paletteEdgeColor: \"#8e9dff\",\n paletteEdgeAmount: 0.3,\n hueShift: -1.81, // hero colorHueShift ≈ -1.81°\n colorContrast: 1.0,\n colorSaturation: 1.15,\n // Hero fibers: the surfaceColor fragment hardcodes freq 600 / strength 0.2; the line* fields\n // feed the wireframe theme (unused by the solid hero).\n fiberCount: 600,\n fiberStrength: 0.2,\n noiseBands: [],\n texture: 0,\n creaseLight: 0.6,\n creaseSharpness: 0.589,\n creaseSoftness: 1.0,\n // sheen 0 + roundness 0: the ortho crop makes crease low, so the hero look comes from the\n // SrcColor² blend + the palette, not the derivative white-lift.\n sheen: 0.0,\n roundness: 0.0,\n iridescence: 0,\n edgeFade: 0.04,\n edgeFeather: 0.1, // the original hardcoded ribbon-edge softness\n depthTint: 0,\n depthTintColor: \"#0a2540\",\n // Hero deformation on the native 400-unit folded() geometry.\n displaceFrequency: { x: 0.003234, y: 0.00799 },\n displaceAmount: 6.051,\n detailFrequency: 0.04, // finer than the base swell; only bites once detailAmount > 0\n detailAmount: 0,\n // Small twist frequencies + high powers — a gentle twist; the drama is the ortho crop.\n twistFrequency: { x: -0.055, y: 0.077, z: -0.518 },\n twistPower: { x: 3.95, y: 5.85, z: 6.33 },\n twistMotion: false,\n theme: \"solid\",\n lineAmount: 425, // wireframe-theme line params (defaults)\n lineThickness: 1,\n lineDerivativePower: 0.95,\n maxWidth: 1232,\n // Hero mesh transform at FULL scale (the ortho camera frames in pixels).\n position: { x: -24.3, y: -56.4, z: -11.1 },\n rotation: { x: -9.14, y: -16.25, z: -161.32 },\n scale: { x: 10, y: 10, z: 7 },\n blendMode: \"squared\", // the hero squaring blend (SrcColor²)\n speed: 0.04, // hero speed: 4e-5 vs ms-time ≈ 0.04/s\n opacity: 1,\n seed: 0,\n };\n}\n\n/** A fresh default wave (the hero wave as one complete wave). */\nexport function makeWave(): WaveConfig {\n return defaultWave();\n}\n\n/** Resize `waves` to match `waveCount`. New waves CLONE the last one (inherit every\n * property of the preceding wave); extras are dropped. */\nexport function resizeWaves(config: StudioConfig): void {\n const target = Math.max(1, Math.round(config.waveCount) || 1);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n while (config.waves.length < target) {\n config.waves.push(structuredClone(config.waves[config.waves.length - 1]));\n }\n while (config.waves.length > target) config.waves.pop();\n config.waveCount = config.waves.length;\n}\n\n/** The default studio config: the hero wave + its scene, in the canonical wave model. */\nexport function createDefaultConfig(): StudioConfig {\n return {\n background: \"#ffffff\",\n transparentBackground: true,\n backgroundMode: \"color\",\n backgroundPalette: makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]),\n backgroundGradientType: \"linear\",\n backgroundGradientAngle: 135,\n backgroundGradientSource: \"stops\",\n backgroundMeshPoints: createDefaultMeshPoints(),\n backgroundMeshSoftness: 0.62,\n backgroundImageSource: \"vaporwave\",\n backgroundImageFit: \"cover\",\n backgroundImageZoom: 1,\n backgroundImagePosition: { x: 0, y: 0 },\n waveCount: 1,\n quality: 1,\n dprMax: 2,\n paused: false,\n timeOffset: 0, // noise phase (scrub to pick a still)\n introRamp: true, // ease the animation in over ~1s on load (skipped in dev; see WaveRenderer.updateTime)\n showCameraRig: false,\n // The hero camera: ORTHOGRAPHIC at (100,0,5000) looking at the origin. The mesh is ×10 so\n // the wave overflows the frame and only the twist shows. cameraZoom is a user multiplier on\n // the responsive base zoom (1 = the hero crop); cameraTarget pans the look-at to the twist.\n cameraDistance: 5001,\n cameraPosition: { x: 100, y: 0, z: 5000 },\n cameraTarget: { x: -44, y: -250, z: 0 },\n cameraZoom: 1.0,\n // Post (one pass over the whole composite): hero grain 1.1, blur 0.02.\n grain: 1.1,\n blur: 0.02,\n blurSamples: 6,\n ambient: 0.45,\n lights: [], // hero has no lights — colour is the palette + the SrcColor² blend\n mirrorH: false,\n mirrorV: false,\n waves: [defaultWave()],\n };\n}\n\n/** Clamp/backfill a single wave's colour + palette fields (legacy `string[]` palettes become\n * ColorStop[]; mesh points + texture transform are clamped). */\nfunction normalizeWaveColour(config: WaveConfig): void {\n const p = config.palette as unknown as Array<string | ColorStop>;\n if (p.length > 0 && typeof p[0] === \"string\") {\n config.palette = makeStops(p as string[]);\n }\n if (\n config.gradientType !== \"radial\" &&\n config.gradientType !== \"conic\" &&\n config.gradientType !== \"mesh\" &&\n config.gradientType !== \"linear\"\n ) {\n config.gradientType = \"linear\";\n }\n const rawMeshPoints = config.meshGradientPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(rawMeshPoints) || rawMeshPoints.length < 2) {\n config.meshGradientPoints = createDefaultMeshPoints();\n } else {\n const defaults = createDefaultMeshPoints();\n config.meshGradientPoints = rawMeshPoints.slice(0, MAX_MESH_POINTS).map((point, index) => {\n const fallback = defaults[index] ?? defaults[defaults.length - 1];\n const x = Number(point.x);\n const y = Number(point.y);\n const influence = Number(point.influence);\n return {\n color: typeof point.color === \"string\" ? point.color : fallback.color,\n x: clamp01(Number.isFinite(x) ? x : fallback.x),\n y: clamp01(Number.isFinite(y) ? y : fallback.y),\n influence: clamp(Number.isFinite(influence) ? influence : fallback.influence, 0.15, 1.5),\n };\n });\n }\n if (!Number.isFinite(config.meshGradientSoftness)) config.meshGradientSoftness = 0.62;\n config.meshGradientSoftness = clamp01(config.meshGradientSoftness);\n if (!config.paletteTextureScale) config.paletteTextureScale = { x: 1, y: 1 };\n if (!config.paletteTextureOffset) config.paletteTextureOffset = { x: 0, y: 0 };\n config.paletteTextureScale.x = clamp(Number(config.paletteTextureScale.x) || 1, 0.1, 8);\n config.paletteTextureScale.y = clamp(Number(config.paletteTextureScale.y) || 1, 0.1, 8);\n config.paletteTextureOffset.x = clamp(Number(config.paletteTextureOffset.x) || 0, -4, 4);\n config.paletteTextureOffset.y = clamp(Number(config.paletteTextureOffset.y) || 0, -4, 4);\n config.paletteTextureRotation = clamp(Number(config.paletteTextureRotation) || 0, -180, 180);\n}\n\n/** Backfill background styling for states saved before gradient/image backgrounds existed. */\nexport function normalizeBackground(config: StudioConfig): void {\n if (\n config.backgroundMode !== \"gradient\" &&\n config.backgroundMode !== \"image\" &&\n config.backgroundMode !== \"color\"\n ) {\n config.backgroundMode = \"color\";\n }\n const palette = config.backgroundPalette as unknown as Array<string | ColorStop> | undefined;\n if (!palette || palette.length < 2) {\n config.backgroundPalette = makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]);\n } else if (typeof palette[0] === \"string\") {\n config.backgroundPalette = makeStops(palette as string[]);\n }\n if (\n config.backgroundGradientType !== \"radial\" &&\n config.backgroundGradientType !== \"conic\" &&\n config.backgroundGradientType !== \"mesh\" &&\n config.backgroundGradientType !== \"linear\"\n ) {\n config.backgroundGradientType = \"linear\";\n }\n const bgMesh = config.backgroundMeshPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(bgMesh) || bgMesh.length < 2) {\n config.backgroundMeshPoints = createDefaultMeshPoints();\n }\n if (!Number.isFinite(config.backgroundMeshSoftness)) config.backgroundMeshSoftness = 0.62;\n config.backgroundMeshSoftness = clamp01(config.backgroundMeshSoftness);\n if (typeof config.backgroundGradientAngle !== \"number\") config.backgroundGradientAngle = 135;\n if (typeof config.backgroundGradientSource !== \"string\")\n config.backgroundGradientSource = \"stops\";\n if (typeof config.backgroundImageSource !== \"string\") config.backgroundImageSource = \"vaporwave\";\n if (\n config.backgroundImageFit !== \"contain\" &&\n config.backgroundImageFit !== \"stretch\" &&\n config.backgroundImageFit !== \"cover\"\n ) {\n config.backgroundImageFit = \"cover\";\n }\n if (typeof config.backgroundImageZoom !== \"number\") config.backgroundImageZoom = 1;\n config.backgroundImageZoom = clamp(config.backgroundImageZoom, 0.1, 8);\n if (!config.backgroundImagePosition) config.backgroundImagePosition = { x: 0, y: 0 };\n if (typeof config.backgroundImagePosition.x !== \"number\") config.backgroundImagePosition.x = 0;\n if (typeof config.backgroundImagePosition.y !== \"number\") config.backgroundImagePosition.y = 0;\n config.backgroundImagePosition.x = clamp(config.backgroundImagePosition.x, -100, 100);\n config.backgroundImagePosition.y = clamp(config.backgroundImagePosition.y, -100, 100);\n}\n\n/** Backfill camera position/target for states saved before they existed. */\nexport function ensureCamera(config: StudioConfig): void {\n if (!config.cameraPosition)\n config.cameraPosition = { x: 0, y: 0, z: config.cameraDistance ?? 62 };\n if (!config.cameraTarget) config.cameraTarget = { x: 0, y: 0, z: 0 };\n if (typeof config.cameraZoom !== \"number\") config.cameraZoom = 1;\n}\n\n/** Backfill/repair a wave so the renderer can consume it (covers partial wave-model JSON). */\nexport function normalizeWave(s: WaveConfig): void {\n normalizeWaveColour(s);\n if (typeof s.gradientAngle !== \"number\") s.gradientAngle = 90;\n if (typeof s.gradientShift !== \"number\") s.gradientShift = 0.15;\n if (typeof s.usePaletteTexture !== \"boolean\") s.usePaletteTexture = true;\n if (typeof s.paletteSource !== \"string\") s.paletteSource = \"hero\";\n if (typeof s.paletteEdgeColor !== \"string\") s.paletteEdgeColor = \"#8e9dff\";\n if (typeof s.paletteEdgeAmount !== \"number\") s.paletteEdgeAmount = 0.3;\n if (typeof s.paletteDriftX !== \"number\") s.paletteDriftX = 0;\n if (typeof s.paletteDriftY !== \"number\") s.paletteDriftY = 0;\n if (typeof s.hueShift !== \"number\") s.hueShift = 0;\n if (typeof s.colorContrast !== \"number\") s.colorContrast = 1;\n if (typeof s.colorSaturation !== \"number\") s.colorSaturation = 1;\n if (typeof s.fiberCount !== \"number\") s.fiberCount = 600;\n if (typeof s.fiberStrength !== \"number\") s.fiberStrength = 0.2;\n if (!Array.isArray(s.noiseBands)) s.noiseBands = [];\n if (typeof s.texture !== \"number\") s.texture = 0;\n if (typeof s.creaseLight !== \"number\") s.creaseLight = 0.6;\n if (typeof s.creaseSharpness !== \"number\") s.creaseSharpness = 0.589;\n if (typeof s.creaseSoftness !== \"number\") s.creaseSoftness = 1;\n if (typeof s.sheen !== \"number\") s.sheen = 0;\n if (typeof s.roundness !== \"number\") s.roundness = 0;\n if (typeof s.iridescence !== \"number\") s.iridescence = 0;\n if (typeof s.edgeFade !== \"number\") s.edgeFade = 0.04;\n if (typeof s.edgeFeather !== \"number\") s.edgeFeather = 0.1;\n if (typeof s.depthTint !== \"number\") s.depthTint = 0;\n if (typeof s.depthTintColor !== \"string\") s.depthTintColor = \"#0a2540\";\n if (!s.displaceFrequency) s.displaceFrequency = { x: 0.003234, y: 0.00799 };\n if (typeof s.displaceAmount !== \"number\") s.displaceAmount = 6.051;\n if (typeof s.detailFrequency !== \"number\") s.detailFrequency = 0.04;\n if (typeof s.detailAmount !== \"number\") s.detailAmount = 0;\n if (!s.twistFrequency) s.twistFrequency = { x: -0.055, y: 0.077, z: -0.518 };\n if (!s.twistPower) s.twistPower = { x: 3.95, y: 5.85, z: 6.33 };\n if (typeof s.theme !== \"string\") s.theme = \"solid\";\n if (typeof s.lineAmount !== \"number\") s.lineAmount = 425;\n if (typeof s.lineThickness !== \"number\") s.lineThickness = 1;\n if (typeof s.lineDerivativePower !== \"number\") s.lineDerivativePower = 0.95;\n if (typeof s.maxWidth !== \"number\") s.maxWidth = 1232;\n if (!s.position) s.position = { x: 0, y: 0, z: 0 };\n if (!s.rotation) s.rotation = { x: 0, y: 0, z: 0 };\n if (!s.scale) s.scale = { x: 10, y: 10, z: 7 };\n if (typeof s.blendMode !== \"string\") s.blendMode = \"squared\";\n if (typeof s.speed !== \"number\") s.speed = 0.04;\n if (typeof s.opacity !== \"number\") s.opacity = 1;\n if (typeof s.seed !== \"number\") s.seed = 0;\n if (s.interaction) normalizeWaveInteraction(s); // present-only; absence stays inert\n}\n\n/** Backfill scene-level defaults (background/camera/post/lights/quality/mirror). */\nexport function ensureSceneDefaults(config: StudioConfig): void {\n normalizeBackground(config);\n ensureCamera(config);\n if (typeof config.ambient !== \"number\") config.ambient = 0.45;\n if (!Array.isArray(config.lights)) config.lights = [];\n if (typeof config.quality !== \"number\") config.quality = 1;\n if (typeof config.dprMax !== \"number\") config.dprMax = 2;\n if (typeof config.grain !== \"number\") config.grain = 1.1;\n if (typeof config.blur !== \"number\") config.blur = 0.02;\n if (typeof config.blurSamples !== \"number\") config.blurSamples = 6;\n if (typeof config.bloomStrength !== \"number\") config.bloomStrength = 0;\n if (typeof config.bloomRadius !== \"number\") config.bloomRadius = 0.4;\n if (typeof config.bloomThreshold !== \"number\") config.bloomThreshold = 0.85;\n if (typeof config.showCameraRig !== \"boolean\") config.showCameraRig = false;\n if (typeof config.paused !== \"boolean\") config.paused = false;\n if (typeof config.loopSeconds !== \"number\") config.loopSeconds = 0;\n if (typeof config.mirrorH !== \"boolean\") config.mirrorH = false;\n if (typeof config.mirrorV !== \"boolean\") config.mirrorV = false;\n // NOTE: `interaction` (scene + per-wave) is deliberately NOT backfilled — absence is semantically\n // \"off\" and keeps the compiled shader byte-identical. The present-only normalizers below run from\n // ensureStudioConfig / normalizeWave only when a block is actually present.\n}\n\n/** Clamp an untrusted numeric field, falling back to `dflt` when it isn't a finite number. */\nfunction clampNumber(v: unknown, min: number, max: number, dflt: number): number {\n const n = Number(v);\n return Number.isFinite(n) ? clamp(n, min, max) : dflt;\n}\n\n/** True for a valid interaction source string: a built-in name or a non-empty `custom:<name>`. */\nfunction isInteractionSource(v: unknown): v is InteractionSource {\n return (\n typeof v === \"string\" &&\n ((INTERACTION_SOURCE_NAMES as readonly string[]).includes(v) ||\n (v.startsWith(\"custom:\") && v.length > \"custom:\".length))\n );\n}\n\n/** Rebuild an untrusted bindings array into valid bindings for `valid` targets (loaded share-links /\n * presets are untrusted JSON; we validate source/target/to and rebuild clean objects). */\nfunction cleanBindings<T extends string>(\n raw: unknown,\n valid: readonly string[],\n): Array<InteractionBindingBase & { target: T }> {\n const out: Array<InteractionBindingBase & { target: T }> = [];\n if (!Array.isArray(raw)) return out;\n for (const item of raw) {\n if (!item || typeof item !== \"object\") continue;\n const b = item as Record<string, unknown>;\n if (!isInteractionSource(b.source)) continue;\n if (!valid.includes(b.target as string)) continue;\n const to = Number(b.to);\n if (!Number.isFinite(to)) continue;\n const clean: InteractionBindingBase & { target: T } = {\n source: b.source,\n target: b.target as T,\n to,\n };\n if (b.from !== undefined) {\n const f = Number(b.from);\n if (Number.isFinite(f)) clean.from = f;\n }\n if (b.smoothing !== undefined) clean.smoothing = clampNumber(b.smoothing, 0, 2, 0.25);\n out.push(clean);\n }\n return out;\n}\n\n/**\n * Present-only normalizer for a WAVE's interaction block: clamp the hover/press numerics that are\n * present (absent fields stay absent, so the block stays lean and the renderer's defaults apply) and\n * drop bindings with an unknown source/target or a non-finite `to`. NEVER call when the block is\n * absent — absence is inert and byte-identical (normalizeWave gates on presence).\n */\nexport function normalizeWaveInteraction(wave: WaveConfig): void {\n const it = wave.interaction;\n if (!it) return;\n const h = it.hover;\n if (h) {\n if (h.agitate !== undefined) h.agitate = clampNumber(h.agitate, 0, 60, 0);\n if (h.push !== undefined) h.push = clampNumber(h.push, -40, 40, 0);\n if (h.wake !== undefined) h.wake = clampNumber(h.wake, 0, 40, 0);\n if (h.thin !== undefined) h.thin = clampNumber(h.thin, 0, 1, 0);\n if (h.hueShift !== undefined) h.hueShift = clampNumber(h.hueShift, -360, 360, 0);\n if (h.lighten !== undefined) h.lighten = clampNumber(h.lighten, -1, 1, 0);\n if (h.smoothing !== undefined) h.smoothing = clampNumber(h.smoothing, 0, 2, 0.12);\n }\n if (it.press && it.press.ripple !== undefined) {\n it.press.ripple = clampNumber(it.press.ripple, 0, 60, 0);\n }\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<WaveInteractionTarget>(it.bindings, WAVE_TARGET_NAMES);\n }\n}\n\n/** Present-only normalizer for the SCENE interaction block: clamp the shared pointer inputs and drop\n * invalid scene bindings. NEVER call when the block is absent. */\nexport function normalizeSceneInteraction(config: StudioConfig): void {\n const it = config.interaction;\n if (!it) return;\n if (it.radius !== undefined) it.radius = clampNumber(it.radius, 0.02, 2, 0.3);\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<SceneInteractionTarget>(it.bindings, SCENE_TARGET_NAMES);\n }\n}\n\n/** Normalize an ingested config to the wave model: backfill the scene + every wave, and drop in\n * a default wave if none are present. Idempotent, so it is safe on the renderer's own config as\n * well as freshly loaded save-states / share links. */\nexport function ensureStudioConfig(input: StudioConfig): StudioConfig {\n const config = input;\n ensureSceneDefaults(config);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n config.waves.forEach(normalizeWave); // each wave's normalizeWave runs normalizeWaveInteraction\n config.waveCount = config.waves.length;\n // Present-only: a config without a scene `interaction` block is left untouched (stays \"off\").\n if (config.interaction) normalizeSceneInteraction(config);\n return config;\n}\n"],"mappings":";;;;;;;;AASA,MAAa,aAAa;AAC1B,MAAa,kBAAkB;AAC/B,MAAa,aAAa;AAC1B,MAAa,kBAAkB;;AAE/B,MAAa,YAAY;;AAqCzB,SAAgB,YACd,WAAiB;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAI,GAC1C,YAAY,GACC;CACb,OAAO;EAAE,UAAU,EAAE,GAAG,SAAS;EAAG,OAAO;EAAW;CAAU;AAClE;;;;AAKA,MAAa,yBAA+B;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;;AAsBtE,SAAgB,kBAA6B;CAC3C,OAAO;EACL,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,MAAM;EACN,SAAS;EACT,UAAU;EACV,WAAW;EACX,kBAAkB;EAClB,eAAe;CACjB;AACF;;AAoBA,SAAgB,UAAU,QAA+B;CACvD,MAAM,IAAI,OAAO;CACjB,OAAO,OAAO,KAAK,OAAO,OAAO;EAAE;EAAO,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK;CAAE,EAAE;AAC3E;;AAGA,SAAgB,0BAA+C;CAC7D,OAAO;EACL;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAK,GAAG;GAAM,WAAW;EAAK;EACrD;GAAE,OAAO;GAAW,GAAG;GAAK,GAAG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O,MAAM,QAAQ,aAAa;CAClC,OAAO,YAAY,OAAO,MAAM;CAEhC,IAAI,OAAO,aAAa,0BAA0B,MAAM;CACxD,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../src/config/model.ts"],"sourcesContent":["/**\n * Configuration schema for the wave: a flat sheet displaced by noise (X/Z frequency\n * + amount) then twisted by three axis-rotations (twistFrequency + twistPower per\n * axis), then scaled / rotated / positioned. Plain JSON — doubles as the save-state\n * format.\n */\n\nimport { clamp, clamp01 } from \"../util/math\";\n\nexport const MAX_COLORS = 8;\nexport const MAX_MESH_POINTS = 8;\nexport const MAX_LIGHTS = 8;\nexport const MAX_NOISE_BANDS = 4;\n/** Cap on stacked waves (keeps total geometry bounded — see WaveRenderer segment scaling). */\nexport const MAX_WAVES = 6;\n\nexport interface Vec2 {\n x: number;\n y: number;\n}\n\nexport interface Vec3 {\n x: number;\n y: number;\n z: number;\n}\n\n// \"squared\" = the hero material blend: SrcColor × Zero (framebuffer = fragColor²), which\n// deepens the colours — the faithful default. \"normal\"/\"additive\"/\"multiply\" are authoring\n// overrides (\"multiply\" darkens where waves/background overlap).\nexport type BlendMode = \"squared\" | \"normal\" | \"additive\" | \"multiply\";\n\n/** How the palette is mapped across the surface. */\nexport type BasicGradientType = \"linear\" | \"radial\" | \"conic\";\nexport type GradientType = BasicGradientType | \"mesh\";\n\nexport type BackgroundMode = \"color\" | \"gradient\" | \"image\";\nexport type BackgroundImageFit = \"cover\" | \"contain\" | \"stretch\";\n\n/** What fills the 2D palette texture: the baked hero LUT, our editable stops, or\n * a named built-in map (see PALETTE_MAPS). Any string is allowed for forward-compat. */\nexport type PaletteSource = \"hero\" | \"stops\" | (string & {});\n\n/** A positionable light. `position` lives in the same 3D space as the wave. */\nexport interface LightConfig {\n position: Vec3;\n color: string;\n intensity: number;\n}\n\n/** A default light; pass overrides for added fill lights. */\nexport function createLight(\n position: Vec3 = { x: 300, y: 500, z: 800 },\n intensity = 1,\n): LightConfig {\n return { position: { ...position }, color: \"#ffffff\", intensity };\n}\n\n/** Where the first light lands when you engage lights from an empty scene. Shared by the\n * \"drag in 3D\" control and the camera-rig minimap, which previews a light marker here so the\n * rig always shows the light — even before one has been explicitly added. */\nexport const DEFAULT_LIGHT_POSITION: Vec3 = { x: 800, y: 900, z: 1100 };\n\n/**\n * A noise band: inside a rectangular uv region (startX..endX along the length,\n * startY..endY across the width, softened by `feather`), the fiber streaks are\n * overridden — strength, frequency (density), colourAttenuation (how much the local\n * colour suppresses them), and the end-weighting parabolaPower. Lets the fibers vary\n * per region instead of uniform.\n */\nexport interface NoiseBand {\n startX: number;\n endX: number;\n startY: number;\n endY: number;\n feather: number;\n strength: number;\n frequency: number;\n colorAttenuation: number;\n parabolaPower: number;\n}\n\n/** A default band: a strong, coarse streak region over the first half. */\nexport function createNoiseBand(): NoiseBand {\n return {\n startX: 0.0,\n endX: 0.5,\n startY: 0.0,\n endY: 1.0,\n feather: 0.3,\n strength: 1.0,\n frequency: 220,\n colorAttenuation: 0.0,\n parabolaPower: 2.0,\n };\n}\n\n/** One gradient stop: a colour at a normalized position (0–1) across the width. */\nexport interface ColorStop {\n color: string;\n pos: number;\n}\n\n/** One colour influence point in the 2D mesh-gradient field. */\nexport interface MeshGradientPoint {\n color: string;\n /** Horizontal UV position (0–1). */\n x: number;\n /** Vertical UV position (0–1). */\n y: number;\n /** Relative reach of this point's colour field. */\n influence: number;\n}\n\n/** Build evenly-spaced stops from a plain list of colours. */\nexport function makeStops(colors: string[]): ColorStop[] {\n const n = colors.length;\n return colors.map((color, i) => ({ color, pos: n > 1 ? i / (n - 1) : 0 }));\n}\n\n/** A balanced iOS-style field shown the first time Mesh is selected. */\nexport function createDefaultMeshPoints(): MeshGradientPoint[] {\n return [\n { color: \"#5e5ce6\", x: 0.08, y: 0.12, influence: 0.78 },\n { color: \"#64d2ff\", x: 0.88, y: 0.08, influence: 0.72 },\n { color: \"#ff375f\", x: 0.12, y: 0.88, influence: 0.72 },\n { color: \"#ff9f0a\", x: 0.9, y: 0.86, influence: 0.78 },\n { color: \"#bf5af2\", x: 0.5, y: 0.48, influence: 0.58 },\n ];\n}\n\n/**\n * A single wave: a COMPLETE, self-contained wave — its own shape, twist, colour, finish,\n * transform and blend. Stacking waves composites independent waves; there is no shared\n * \"base wave\" any more, so nothing is duplicated between a global section and the waves.\n * Field names mirror the legacy top-level wave fields so migration + the per-section helpers\n * (normalizeWaveColour, randomize*) map 1:1.\n */\nexport interface WaveConfig {\n // Colour & gradient\n palette: ColorStop[];\n gradientType: GradientType;\n gradientAngle: number;\n gradientShift: number;\n meshGradientPoints: MeshGradientPoint[];\n meshGradientSoftness: number;\n usePaletteTexture: boolean;\n paletteSource: PaletteSource;\n paletteImageUrl?: string;\n paletteVideoUrl?: string;\n paletteTextureScale: Vec2;\n paletteTextureOffset: Vec2;\n paletteTextureRotation: number;\n /** Palette-offset drift per second (animates colour independently of the geometry; 0 = static).\n * Applies to any texture palette (not mesh / procedural stops). */\n paletteDriftX: number;\n paletteDriftY: number;\n paletteEdgeColor: string;\n paletteEdgeAmount: number;\n hueShift: number;\n colorContrast: number;\n colorSaturation: number;\n // Surface finish\n fiberCount: number;\n fiberStrength: number;\n noiseBands: NoiseBand[];\n texture: number;\n creaseLight: number;\n creaseSharpness: number;\n creaseSoftness: number;\n sheen: number;\n roundness: number;\n /** Thin-film / holographic hue response that shifts with view angle (0 = off). */\n iridescence: number;\n edgeFade: number;\n /** Softness of the ribbon's long edges (smoothstep width across uv.y). 0.1 = the original\n * hardcoded value; smaller = razor-crisp graphic ribbons, larger = soft vapor. */\n edgeFeather: number;\n /** Depth tint (solid theme): fade far fragments toward depthTintColor for atmospheric\n * separation in multi-wave stacks (0 = off). */\n depthTint: number;\n depthTintColor: string;\n // Displacement + twist (the wave shape)\n displaceFrequency: Vec2;\n displaceAmount: number;\n /** Optional 2nd displacement octave: finer ripples riding on the broad swell (amount 0 = off). */\n detailFrequency: number;\n detailAmount: number;\n twistFrequency: Vec3;\n twistPower: Vec3;\n twistMotion?: boolean;\n // Material (\"solid\" surface vs \"wireframe\" line shader)\n theme?: \"solid\" | \"wireframe\";\n lineAmount?: number;\n lineThickness?: number;\n lineDerivativePower?: number;\n maxWidth?: number;\n // Transform (absolute — no shared base to offset from)\n position: Vec3;\n rotation: Vec3;\n scale: Vec3;\n // Compositing\n blendMode: BlendMode;\n /** Absolute animation speed for this wave (legacy global speed × per-layer multiplier). */\n speed: number;\n /** Overall opacity of this wave. */\n opacity: number;\n /** Phase/seed so waves don't move in lockstep. */\n seed: number;\n /** Optional per-wave interactivity: how THIS wave reacts to the shared pointer + inputs (hover\n * field, click ripples, param bindings). ABSENT = this wave is inert / byte-identical. */\n interaction?: WaveInteractionConfig;\n}\n\n// ---------------------------------------------------------------------------------------------\n// Interactivity layer (optional, additive, default-off). Split by concern: the SHARED inputs (one\n// cursor + scroll + smoothing/touch) and scene-param effects live on SceneConfig.interaction; each\n// wave's own RESPONSE (hover field, click ripples, param bindings) lives on WaveConfig.interaction.\n// ABSENT blocks mean fully off — the compiled shader and rendered pixels stay byte-identical to a\n// non-interactive wave (the normalizers below run present-only; ensureSceneDefaults never calls them).\n// ---------------------------------------------------------------------------------------------\n\n/** The built-in interaction input names (the open-ended `custom:*` family is handled separately).\n * Kept in sync by hand with the {@link InteractionSource} union below. */\nconst INTERACTION_SOURCE_NAMES = [\n \"scroll\",\n \"hover\",\n \"pointerX\",\n \"pointerY\",\n \"pointerSpeed\",\n \"press\",\n \"scrollVelocity\",\n \"appear\",\n] as const;\n\n/**\n * An interaction INPUT: a normalized signal that can smoothly drive config params through an\n * {@link InteractionBinding}. Every source is exponentially smoothed before it is applied.\n */\nexport type InteractionSource =\n | \"scroll\" // container progress through the viewport, 0 (entering) .. 1 (scrolled past)\n | \"hover\" // smoothed pointer presence over the container, 0..1\n | \"pointerX\" // smoothed pointer X across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerY\" // smoothed pointer Y across the container, 0..1; relaxes to 0.5 on leave\n | \"pointerSpeed\" // normalized smoothed pointer speed, 0..1\n | \"press\" // pointer button / touch held, smoothed 0..1\n | \"scrollVelocity\" // normalized smoothed |d(scroll progress)/dt|, 0..1\n | \"appear\" // one-shot 0→1 latch on first visibility (entrance choreography)\n | `custom:${string}`; // developer-fed each frame via setInteractionInput(name, value)\n\n/** Per-WAVE params a binding may drive. Single source of truth for WAVE_APPLIERS in\n * renderer/interaction.ts (checked via `satisfies`) and validated by normalizeWaveInteraction. */\nconst WAVE_TARGET_NAMES = [\n \"displaceAmount\",\n \"detailAmount\",\n \"twistPowerX\",\n \"twistPowerY\",\n \"twistPowerZ\",\n \"twistFrequencyX\",\n \"twistFrequencyY\",\n \"twistFrequencyZ\",\n \"hueShift\",\n \"gradientShift\",\n \"colorSaturation\",\n \"opacity\",\n \"lineThickness\",\n \"lineAmount\",\n \"fiberStrength\",\n \"sheen\",\n \"iridescence\",\n \"positionX\",\n \"positionY\",\n] as const;\n/** A per-wave param a {@link WaveInteractionBinding} can drive. */\nexport type WaveInteractionTarget = (typeof WAVE_TARGET_NAMES)[number];\n\n/** SCENE params a binding may drive (post / camera / time — shared, not per wave). Single source of\n * truth for SCENE_APPLIERS in renderer/interaction.ts, validated by normalizeSceneInteraction. */\nconst SCENE_TARGET_NAMES = [\"timeOffset\", \"cameraZoom\", \"blur\", \"grain\"] as const;\n/** A scene-level param a {@link SceneInteractionBinding} can drive. */\nexport type SceneInteractionTarget = (typeof SCENE_TARGET_NAMES)[number];\n\n/** Shared fields of an input→param binding: per frame `value = mix(from ?? authoredBase, to,\n * smoothedSource)`, written straight to uniforms — never mutates config, so any refresh restores\n * the authored base (removal needs no undo step). */\ninterface InteractionBindingBase {\n /** The input signal driving this binding. */\n source: InteractionSource;\n /** Value at source = 0. OMITTED = the authored base value, so at rest the authored look shows. */\n from?: number;\n /** Value at source = 1. */\n to: number;\n /** Exponential smoothing time constant, seconds (default 0.25); also shapes the `appear` ramp. */\n smoothing?: number;\n}\n/** A binding on a wave, driving one of that wave's params. */\nexport interface WaveInteractionBinding extends InteractionBindingBase {\n target: WaveInteractionTarget;\n}\n/** A scene-level binding, driving a shared scene param. */\nexport interface SceneInteractionBinding extends InteractionBindingBase {\n target: SceneInteractionTarget;\n}\n\n/** Hover pointer-field: localized effects that follow the cursor over this wave. Present ⇒ the\n * POINTER_FX shader path compiles for this wave; an absent effect is 0 (inert). */\nexport interface WaveHoverConfig {\n /** Local churn-octave amplitude near the cursor — the wave agitates under the pointer. The studio\n * defaults this positive when you enable a hover field, so a fresh hover reacts out of the box. */\n agitate?: number;\n /** Membrane push/pull: a smooth dome at the cursor that swells toward you (repel, +) or dents away\n * (attract, −), carried by the sprung field so it drags like a poke under fabric. World units;\n * 0 = off. */\n push?: number;\n /** Drag-wake: while the cursor moves, the surface just BEHIND it is pulled into a trailing trough\n * that heals once you stop; scales with pointer speed. World units; 0 = off. */\n wake?: number;\n /** 0..1 — wireframe strands taper to hairlines; solid gains local translucency. */\n thin?: number;\n /** Local hue rotation near the cursor, degrees. */\n hueShift?: number;\n /** Local brightness lift near the cursor, -1..1. */\n lighten?: number;\n /** Pointer-follow smoothing for THIS wave's hover field, seconds — how quickly the swell trails\n * the cursor. Vary it across a stack so strands lag at different rates (a parallax drag).\n * Default 0.12. */\n smoothing?: number;\n}\n\n/** Click / touch pointer-field: what a tap or click on this wave triggers. */\nexport interface WavePressConfig {\n /** Click-ripple amplitude; 0 keeps this wave's POINTER_RIPPLES path uncompiled. */\n ripple?: number;\n}\n\n/** Per-wave interactivity: this wave's own reaction to the shared pointer + inputs. ABSENT ⇒ inert. */\nexport interface WaveInteractionConfig {\n /** Hover field (cursor-follow agitation / thinning / hue-lighten). */\n hover?: WaveHoverConfig;\n /** Click & touch (ripples radiating from a tap/click on this wave). */\n press?: WavePressConfig;\n /** Input→param bindings driving THIS wave's params (any source, incl. scroll / hover / custom). */\n bindings?: WaveInteractionBinding[];\n}\n\n/** Scene-level interactivity: the SHARED inputs (one cursor + scroll, touch) plus bindings that\n * drive shared scene params. Pointer-follow smoothing is per-wave (see WaveHoverConfig.smoothing).\n * ABSENT ⇒ inputs use defaults; `enabled: false` is the master OFF switch for the whole layer. */\nexport interface SceneInteractionConfig {\n /** Master switch for the whole interaction layer. Default true (only `false` turns it all off). */\n enabled?: boolean;\n /** Pointer falloff radius, as a fraction of viewport height. Default 0.3. */\n radius?: number;\n /** Ribbon flow (0..1, default 0.8): stretch the pointer footprint along each wave's own length axis\n * so the influence reaches ALONG the ribbon instead of as a circular screen disc. On by default;\n * set 0 for the plain circle. Scene-level (shared like `radius`); each wave uses its own length\n * tangent. Only affects waves that already react to the cursor (non-interactive waves are inert). */\n ribbonFlow?: number;\n /** Follow coarse (touch) pointers. Default false — touch is ignored unless this is true. */\n touch?: boolean;\n /** Input→param bindings driving SCENE params (timeOffset, cameraZoom, blur, grain). */\n bindings?: SceneInteractionBinding[];\n}\n\n/**\n * Scene-level settings shared by every wave: output/background/camera/lights, the post-fx\n * pass (grain/blur), playback, quality, and the whole-composition mirror. Everything that\n * describes an individual wave lives on WaveConfig instead.\n */\nexport interface SceneConfig {\n background: string;\n transparentBackground: boolean;\n backgroundMode: BackgroundMode;\n backgroundPalette: ColorStop[];\n backgroundGradientType: GradientType;\n backgroundGradientAngle: number;\n backgroundGradientSource: PaletteSource;\n backgroundMeshPoints: MeshGradientPoint[];\n backgroundMeshSoftness: number;\n backgroundImageSource: PaletteSource;\n backgroundImageUrl?: string;\n backgroundVideoUrl?: string;\n backgroundImageFit: BackgroundImageFit;\n backgroundImageZoom: number;\n backgroundImagePosition: Vec2;\n /** Number of stacked waves (kept in sync with waves.length). */\n waveCount: number;\n quality: number;\n dprMax: number;\n paused: boolean;\n /** Noise phase offset — scrubs the noise pattern to pick a still frame. */\n timeOffset?: number;\n /** Seamless-loop period in seconds (0 = off). When >0, the motion is mapped onto a circle in\n * noise space so it repeats exactly every `loopSeconds` — scene-level so a multi-wave stack\n * shares one period and the whole composite loops. */\n loopSeconds?: number;\n introRamp?: boolean;\n showCameraRig: boolean;\n cameraDistance: number;\n cameraZoom: number;\n cameraPosition: Vec3;\n cameraTarget: Vec3;\n /** Film grain amount (post pass). */\n grain: number;\n /** Soft-focus / spin blur amount (post pass). */\n blur: number;\n blurSamples?: number;\n /** Bloom (post pass, UnrealBloomPass). strength 0 removes the pass entirely, so cost and pixels\n * are identical to bloom-off; radius/threshold only take effect once strength > 0. */\n bloomStrength?: number;\n bloomRadius?: number;\n bloomThreshold?: number;\n /** Ordered (Bayer) dithering over the finished composite — a self-contained \"layered\" post\n * shader in the spirit of paper-design/shaders. 0 removes the pass entirely (cost/pixels match\n * dither-off); scale & steps only bite once dither > 0. Runs last, after tone-map + sRGB. */\n dither?: number;\n /** Dither cell size in device pixels (>=1) — larger = chunkier pattern. */\n ditherScale?: number;\n /** Quantization levels per channel (>=2) — lower = heavier posterization. */\n ditherSteps?: number;\n /** Volumetric light streaks (innerLight) scattered from the bright wave toward a light point\n * (innerLightX/Y in UV). 0 removes the pass; density/decay/centre only bite once innerLight > 0.\n * Scene-zone (scatters the raw wave, like bloom). */\n innerLight?: number;\n innerLightDensity?: number;\n innerLightDecay?: number;\n innerLightX?: number;\n innerLightY?: number;\n /** Halftone: a rotated dot screen (dot size scales with local brightness) over the final image.\n * 0 removes the pass; cell/angle only bite once halftone > 0. Finish-zone stylization. */\n halftone?: number;\n halftoneCell?: number;\n halftoneAngle?: number;\n /** Heatmap recolour (luminance → thermal palette). 0 removes the pass. Finish-zone. */\n heatmap?: number;\n /** Paper-texture overlay (fibrous substrate shading). 0 removes the pass; scale = grain size. */\n paperTexture?: number;\n paperTextureScale?: number;\n /** CMYK halftone (four rotated dot screens). 0 removes the pass; cell = dot size px. */\n halftoneCmyk?: number;\n halftoneCmykCell?: number;\n /** Base ambient light level (0–1). */\n ambient: number;\n lights: LightConfig[];\n /** Mirror the whole composition on screen (world-space flip). */\n mirrorH: boolean;\n mirrorV: boolean;\n /** Shared interaction inputs (one cursor + scroll) + scene-param bindings. Per-wave response\n * lives on each WaveConfig.interaction. ABSENT = defaults; `enabled:false` disables the layer. */\n interaction?: SceneInteractionConfig;\n}\n\n/** The full save-state: scene settings + one or more complete waves. */\nexport interface StudioConfig extends SceneConfig {\n waves: WaveConfig[];\n}\n\n/** Spread a base wave into `count` overlapping waves — each with a slightly varied hue, width,\n * speed, phase, vertical offset and roll so a stack reads as one composition. `count === 1`\n * returns the base unchanged. Used to author multi-wave presets. */\nexport function makeWaveSpread(base: WaveConfig, count: number): WaveConfig[] {\n if (count <= 1) return [structuredClone(base)];\n const out: WaveConfig[] = [];\n for (let i = 0; i < count; i++) {\n const f = i / (count - 1);\n const w = structuredClone(base);\n w.opacity = 1.0 - f * 0.3;\n w.hueShift = base.hueShift + i * 18;\n w.scale = { x: base.scale.x, y: base.scale.y * (1 - f * 0.2), z: base.scale.z };\n w.speed = base.speed * (1 + f * 0.15);\n w.seed = i * 3.3;\n w.position = {\n x: base.position.x,\n y: base.position.y + (f - 0.5) * 1.5,\n z: base.position.z - i * 0.8,\n };\n w.rotation = { x: base.rotation.x, y: base.rotation.y, z: base.rotation.z + i * 20 };\n out.push(w);\n }\n return out;\n}\n\n/** The hero wave (a single complete wave) — the base for the default config and most presets. */\nfunction defaultWave(): WaveConfig {\n return {\n // The hero palette: a periwinkle tip/edge, a dominant orange core, then coral → magenta →\n // pink, with a violet twist tip. gradientShift warps it to mimic a baked 2D palette texture.\n palette: [\n { color: \"#8e9dff\", pos: 0 }, // periwinkle (blue tip/edge)\n { color: \"#c98fd0\", pos: 0.14 }, // lavender transition\n { color: \"#ff9326\", pos: 0.3 }, // orange (rising)\n { color: \"#fd8108\", pos: 0.52 }, // orange core\n { color: \"#fb7a36\", pos: 0.64 }, // orange-coral (keeps orange dominant)\n { color: \"#d24ecc\", pos: 0.78 }, // true magenta (hue ~303, not pink)\n { color: \"#e95cae\", pos: 0.9 }, // pink-magenta\n { color: \"#9b6ae0\", pos: 1.0 }, // violet (twist tip)\n ],\n gradientType: \"linear\",\n gradientAngle: 90, // 90° = the gradient runs ALONG the length (uv.x)\n gradientShift: 0.15,\n meshGradientPoints: createDefaultMeshPoints(),\n meshGradientSoftness: 0.62,\n usePaletteTexture: true, // default to the baked hero LUT\n paletteSource: \"hero\",\n paletteTextureScale: { x: 1, y: 1 },\n paletteTextureOffset: { x: 0, y: 0 },\n paletteTextureRotation: 0,\n paletteDriftX: 0,\n paletteDriftY: 0,\n paletteEdgeColor: \"#8e9dff\",\n paletteEdgeAmount: 0.3,\n hueShift: -1.81, // hero colorHueShift ≈ -1.81°\n colorContrast: 1.0,\n colorSaturation: 1.15,\n // Hero fibers: the surfaceColor fragment hardcodes freq 600 / strength 0.2; the line* fields\n // feed the wireframe theme (unused by the solid hero).\n fiberCount: 600,\n fiberStrength: 0.2,\n noiseBands: [],\n texture: 0,\n creaseLight: 0.6,\n creaseSharpness: 0.589,\n creaseSoftness: 1.0,\n // sheen 0 + roundness 0: the ortho crop makes crease low, so the hero look comes from the\n // SrcColor² blend + the palette, not the derivative white-lift.\n sheen: 0.0,\n roundness: 0.0,\n iridescence: 0,\n edgeFade: 0.04,\n edgeFeather: 0.1, // the original hardcoded ribbon-edge softness\n depthTint: 0,\n depthTintColor: \"#0a2540\",\n // Hero deformation on the native 400-unit folded() geometry.\n displaceFrequency: { x: 0.003234, y: 0.00799 },\n displaceAmount: 6.051,\n detailFrequency: 0.04, // finer than the base swell; only bites once detailAmount > 0\n detailAmount: 0,\n // Small twist frequencies + high powers — a gentle twist; the drama is the ortho crop.\n twistFrequency: { x: -0.055, y: 0.077, z: -0.518 },\n twistPower: { x: 3.95, y: 5.85, z: 6.33 },\n twistMotion: false,\n theme: \"solid\",\n lineAmount: 425, // wireframe-theme line params (defaults)\n lineThickness: 1,\n lineDerivativePower: 0.95,\n maxWidth: 1232,\n // Hero mesh transform at FULL scale (the ortho camera frames in pixels).\n position: { x: -24.3, y: -56.4, z: -11.1 },\n rotation: { x: -9.14, y: -16.25, z: -161.32 },\n scale: { x: 10, y: 10, z: 7 },\n blendMode: \"squared\", // the hero squaring blend (SrcColor²)\n speed: 0.04, // hero speed: 4e-5 vs ms-time ≈ 0.04/s\n opacity: 1,\n seed: 0,\n };\n}\n\n/** A fresh default wave (the hero wave as one complete wave). */\nexport function makeWave(): WaveConfig {\n return defaultWave();\n}\n\n/** Resize `waves` to match `waveCount`. New waves CLONE the last one (inherit every\n * property of the preceding wave); extras are dropped. */\nexport function resizeWaves(config: StudioConfig): void {\n const target = Math.max(1, Math.round(config.waveCount) || 1);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n while (config.waves.length < target) {\n config.waves.push(structuredClone(config.waves[config.waves.length - 1]));\n }\n while (config.waves.length > target) config.waves.pop();\n config.waveCount = config.waves.length;\n}\n\n/** The default studio config: the hero wave + its scene, in the canonical wave model. */\nexport function createDefaultConfig(): StudioConfig {\n return {\n background: \"#ffffff\",\n transparentBackground: true,\n backgroundMode: \"color\",\n backgroundPalette: makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]),\n backgroundGradientType: \"linear\",\n backgroundGradientAngle: 135,\n backgroundGradientSource: \"stops\",\n backgroundMeshPoints: createDefaultMeshPoints(),\n backgroundMeshSoftness: 0.62,\n backgroundImageSource: \"vaporwave\",\n backgroundImageFit: \"cover\",\n backgroundImageZoom: 1,\n backgroundImagePosition: { x: 0, y: 0 },\n waveCount: 1,\n quality: 1,\n dprMax: 2,\n paused: false,\n timeOffset: 0, // noise phase (scrub to pick a still)\n introRamp: true, // ease the animation in over ~1s on load (skipped in dev; see WaveRenderer.updateTime)\n showCameraRig: false,\n // The hero camera: ORTHOGRAPHIC at (100,0,5000) looking at the origin. The mesh is ×10 so\n // the wave overflows the frame and only the twist shows. cameraZoom is a user multiplier on\n // the responsive base zoom (1 = the hero crop); cameraTarget pans the look-at to the twist.\n cameraDistance: 5001,\n cameraPosition: { x: 100, y: 0, z: 5000 },\n cameraTarget: { x: -44, y: -250, z: 0 },\n cameraZoom: 1.0,\n // Post (one pass over the whole composite): hero grain 1.1, blur 0.02.\n grain: 1.1,\n blur: 0.02,\n blurSamples: 6,\n dither: 0, // off by default — the hero look is unchanged (the pass isn't inserted)\n ditherScale: 2,\n ditherSteps: 4,\n innerLight: 0,\n innerLightDensity: 0.5,\n innerLightDecay: 0.95,\n innerLightX: 0.5,\n innerLightY: 0.15,\n halftone: 0,\n halftoneCell: 6,\n halftoneAngle: 0.4,\n heatmap: 0,\n paperTexture: 0,\n paperTextureScale: 2,\n halftoneCmyk: 0,\n halftoneCmykCell: 6,\n ambient: 0.45,\n lights: [], // hero has no lights — colour is the palette + the SrcColor² blend\n mirrorH: false,\n mirrorV: false,\n waves: [defaultWave()],\n };\n}\n\n/** Clamp/backfill a single wave's colour + palette fields (legacy `string[]` palettes become\n * ColorStop[]; mesh points + texture transform are clamped). */\nfunction normalizeWaveColour(config: WaveConfig): void {\n const p = config.palette as unknown as Array<string | ColorStop>;\n if (p.length > 0 && typeof p[0] === \"string\") {\n config.palette = makeStops(p as string[]);\n }\n if (\n config.gradientType !== \"radial\" &&\n config.gradientType !== \"conic\" &&\n config.gradientType !== \"mesh\" &&\n config.gradientType !== \"linear\"\n ) {\n config.gradientType = \"linear\";\n }\n const rawMeshPoints = config.meshGradientPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(rawMeshPoints) || rawMeshPoints.length < 2) {\n config.meshGradientPoints = createDefaultMeshPoints();\n } else {\n const defaults = createDefaultMeshPoints();\n config.meshGradientPoints = rawMeshPoints.slice(0, MAX_MESH_POINTS).map((point, index) => {\n const fallback = defaults[index] ?? defaults[defaults.length - 1];\n const x = Number(point.x);\n const y = Number(point.y);\n const influence = Number(point.influence);\n return {\n color: typeof point.color === \"string\" ? point.color : fallback.color,\n x: clamp01(Number.isFinite(x) ? x : fallback.x),\n y: clamp01(Number.isFinite(y) ? y : fallback.y),\n influence: clamp(Number.isFinite(influence) ? influence : fallback.influence, 0.15, 1.5),\n };\n });\n }\n if (!Number.isFinite(config.meshGradientSoftness)) config.meshGradientSoftness = 0.62;\n config.meshGradientSoftness = clamp01(config.meshGradientSoftness);\n if (!config.paletteTextureScale) config.paletteTextureScale = { x: 1, y: 1 };\n if (!config.paletteTextureOffset) config.paletteTextureOffset = { x: 0, y: 0 };\n config.paletteTextureScale.x = clamp(Number(config.paletteTextureScale.x) || 1, 0.1, 8);\n config.paletteTextureScale.y = clamp(Number(config.paletteTextureScale.y) || 1, 0.1, 8);\n config.paletteTextureOffset.x = clamp(Number(config.paletteTextureOffset.x) || 0, -4, 4);\n config.paletteTextureOffset.y = clamp(Number(config.paletteTextureOffset.y) || 0, -4, 4);\n config.paletteTextureRotation = clamp(Number(config.paletteTextureRotation) || 0, -180, 180);\n}\n\n/** Backfill background styling for states saved before gradient/image backgrounds existed. */\nexport function normalizeBackground(config: StudioConfig): void {\n if (\n config.backgroundMode !== \"gradient\" &&\n config.backgroundMode !== \"image\" &&\n config.backgroundMode !== \"color\"\n ) {\n config.backgroundMode = \"color\";\n }\n const palette = config.backgroundPalette as unknown as Array<string | ColorStop> | undefined;\n if (!palette || palette.length < 2) {\n config.backgroundPalette = makeStops([\"#0a2540\", \"#425466\", \"#7a73ff\", \"#f6f9fc\"]);\n } else if (typeof palette[0] === \"string\") {\n config.backgroundPalette = makeStops(palette as string[]);\n }\n if (\n config.backgroundGradientType !== \"radial\" &&\n config.backgroundGradientType !== \"conic\" &&\n config.backgroundGradientType !== \"mesh\" &&\n config.backgroundGradientType !== \"linear\"\n ) {\n config.backgroundGradientType = \"linear\";\n }\n const bgMesh = config.backgroundMeshPoints as MeshGradientPoint[] | undefined;\n if (!Array.isArray(bgMesh) || bgMesh.length < 2) {\n config.backgroundMeshPoints = createDefaultMeshPoints();\n }\n if (!Number.isFinite(config.backgroundMeshSoftness)) config.backgroundMeshSoftness = 0.62;\n config.backgroundMeshSoftness = clamp01(config.backgroundMeshSoftness);\n if (typeof config.backgroundGradientAngle !== \"number\") config.backgroundGradientAngle = 135;\n if (typeof config.backgroundGradientSource !== \"string\")\n config.backgroundGradientSource = \"stops\";\n if (typeof config.backgroundImageSource !== \"string\") config.backgroundImageSource = \"vaporwave\";\n if (\n config.backgroundImageFit !== \"contain\" &&\n config.backgroundImageFit !== \"stretch\" &&\n config.backgroundImageFit !== \"cover\"\n ) {\n config.backgroundImageFit = \"cover\";\n }\n if (typeof config.backgroundImageZoom !== \"number\") config.backgroundImageZoom = 1;\n config.backgroundImageZoom = clamp(config.backgroundImageZoom, 0.1, 8);\n if (!config.backgroundImagePosition) config.backgroundImagePosition = { x: 0, y: 0 };\n if (typeof config.backgroundImagePosition.x !== \"number\") config.backgroundImagePosition.x = 0;\n if (typeof config.backgroundImagePosition.y !== \"number\") config.backgroundImagePosition.y = 0;\n config.backgroundImagePosition.x = clamp(config.backgroundImagePosition.x, -100, 100);\n config.backgroundImagePosition.y = clamp(config.backgroundImagePosition.y, -100, 100);\n}\n\n/** Backfill camera position/target for states saved before they existed. */\nexport function ensureCamera(config: StudioConfig): void {\n if (!config.cameraPosition)\n config.cameraPosition = { x: 0, y: 0, z: config.cameraDistance ?? 62 };\n if (!config.cameraTarget) config.cameraTarget = { x: 0, y: 0, z: 0 };\n if (typeof config.cameraZoom !== \"number\") config.cameraZoom = 1;\n}\n\n/** Backfill/repair a wave so the renderer can consume it (covers partial wave-model JSON). */\nexport function normalizeWave(s: WaveConfig): void {\n normalizeWaveColour(s);\n if (typeof s.gradientAngle !== \"number\") s.gradientAngle = 90;\n if (typeof s.gradientShift !== \"number\") s.gradientShift = 0.15;\n if (typeof s.usePaletteTexture !== \"boolean\") s.usePaletteTexture = true;\n if (typeof s.paletteSource !== \"string\") s.paletteSource = \"hero\";\n if (typeof s.paletteEdgeColor !== \"string\") s.paletteEdgeColor = \"#8e9dff\";\n if (typeof s.paletteEdgeAmount !== \"number\") s.paletteEdgeAmount = 0.3;\n if (typeof s.paletteDriftX !== \"number\") s.paletteDriftX = 0;\n if (typeof s.paletteDriftY !== \"number\") s.paletteDriftY = 0;\n if (typeof s.hueShift !== \"number\") s.hueShift = 0;\n if (typeof s.colorContrast !== \"number\") s.colorContrast = 1;\n if (typeof s.colorSaturation !== \"number\") s.colorSaturation = 1;\n if (typeof s.fiberCount !== \"number\") s.fiberCount = 600;\n if (typeof s.fiberStrength !== \"number\") s.fiberStrength = 0.2;\n if (!Array.isArray(s.noiseBands)) s.noiseBands = [];\n if (typeof s.texture !== \"number\") s.texture = 0;\n if (typeof s.creaseLight !== \"number\") s.creaseLight = 0.6;\n if (typeof s.creaseSharpness !== \"number\") s.creaseSharpness = 0.589;\n if (typeof s.creaseSoftness !== \"number\") s.creaseSoftness = 1;\n if (typeof s.sheen !== \"number\") s.sheen = 0;\n if (typeof s.roundness !== \"number\") s.roundness = 0;\n if (typeof s.iridescence !== \"number\") s.iridescence = 0;\n if (typeof s.edgeFade !== \"number\") s.edgeFade = 0.04;\n if (typeof s.edgeFeather !== \"number\") s.edgeFeather = 0.1;\n if (typeof s.depthTint !== \"number\") s.depthTint = 0;\n if (typeof s.depthTintColor !== \"string\") s.depthTintColor = \"#0a2540\";\n if (!s.displaceFrequency) s.displaceFrequency = { x: 0.003234, y: 0.00799 };\n if (typeof s.displaceAmount !== \"number\") s.displaceAmount = 6.051;\n if (typeof s.detailFrequency !== \"number\") s.detailFrequency = 0.04;\n if (typeof s.detailAmount !== \"number\") s.detailAmount = 0;\n if (!s.twistFrequency) s.twistFrequency = { x: -0.055, y: 0.077, z: -0.518 };\n if (!s.twistPower) s.twistPower = { x: 3.95, y: 5.85, z: 6.33 };\n if (typeof s.theme !== \"string\") s.theme = \"solid\";\n if (typeof s.lineAmount !== \"number\") s.lineAmount = 425;\n if (typeof s.lineThickness !== \"number\") s.lineThickness = 1;\n if (typeof s.lineDerivativePower !== \"number\") s.lineDerivativePower = 0.95;\n if (typeof s.maxWidth !== \"number\") s.maxWidth = 1232;\n if (!s.position) s.position = { x: 0, y: 0, z: 0 };\n if (!s.rotation) s.rotation = { x: 0, y: 0, z: 0 };\n if (!s.scale) s.scale = { x: 10, y: 10, z: 7 };\n if (typeof s.blendMode !== \"string\") s.blendMode = \"squared\";\n if (typeof s.speed !== \"number\") s.speed = 0.04;\n if (typeof s.opacity !== \"number\") s.opacity = 1;\n if (typeof s.seed !== \"number\") s.seed = 0;\n if (s.interaction) normalizeWaveInteraction(s); // present-only; absence stays inert\n}\n\n/** Backfill scene-level defaults (background/camera/post/lights/quality/mirror). */\nexport function ensureSceneDefaults(config: StudioConfig): void {\n normalizeBackground(config);\n ensureCamera(config);\n if (typeof config.ambient !== \"number\") config.ambient = 0.45;\n if (!Array.isArray(config.lights)) config.lights = [];\n if (typeof config.quality !== \"number\") config.quality = 1;\n if (typeof config.dprMax !== \"number\") config.dprMax = 2;\n if (typeof config.grain !== \"number\") config.grain = 1.1;\n if (typeof config.blur !== \"number\") config.blur = 0.02;\n if (typeof config.blurSamples !== \"number\") config.blurSamples = 6;\n if (typeof config.bloomStrength !== \"number\") config.bloomStrength = 0;\n if (typeof config.bloomRadius !== \"number\") config.bloomRadius = 0.4;\n if (typeof config.bloomThreshold !== \"number\") config.bloomThreshold = 0.85;\n if (typeof config.dither !== \"number\") config.dither = 0;\n if (typeof config.ditherScale !== \"number\") config.ditherScale = 2;\n if (typeof config.ditherSteps !== \"number\") config.ditherSteps = 4;\n if (typeof config.innerLight !== \"number\") config.innerLight = 0;\n if (typeof config.innerLightDensity !== \"number\") config.innerLightDensity = 0.5;\n if (typeof config.innerLightDecay !== \"number\") config.innerLightDecay = 0.95;\n if (typeof config.innerLightX !== \"number\") config.innerLightX = 0.5;\n if (typeof config.innerLightY !== \"number\") config.innerLightY = 0.15;\n if (typeof config.halftone !== \"number\") config.halftone = 0;\n if (typeof config.halftoneCell !== \"number\") config.halftoneCell = 6;\n if (typeof config.halftoneAngle !== \"number\") config.halftoneAngle = 0.4;\n if (typeof config.heatmap !== \"number\") config.heatmap = 0;\n if (typeof config.paperTexture !== \"number\") config.paperTexture = 0;\n if (typeof config.paperTextureScale !== \"number\") config.paperTextureScale = 2;\n if (typeof config.halftoneCmyk !== \"number\") config.halftoneCmyk = 0;\n if (typeof config.halftoneCmykCell !== \"number\") config.halftoneCmykCell = 6;\n if (typeof config.showCameraRig !== \"boolean\") config.showCameraRig = false;\n if (typeof config.paused !== \"boolean\") config.paused = false;\n if (typeof config.loopSeconds !== \"number\") config.loopSeconds = 0;\n if (typeof config.mirrorH !== \"boolean\") config.mirrorH = false;\n if (typeof config.mirrorV !== \"boolean\") config.mirrorV = false;\n // NOTE: `interaction` (scene + per-wave) is deliberately NOT backfilled — absence is semantically\n // \"off\" and keeps the compiled shader byte-identical. The present-only normalizers below run from\n // ensureStudioConfig / normalizeWave only when a block is actually present.\n}\n\n/** Clamp an untrusted numeric field, falling back to `dflt` when it isn't a finite number. */\nfunction clampNumber(v: unknown, min: number, max: number, dflt: number): number {\n const n = Number(v);\n return Number.isFinite(n) ? clamp(n, min, max) : dflt;\n}\n\n/** True for a valid interaction source string: a built-in name or a non-empty `custom:<name>`. */\nfunction isInteractionSource(v: unknown): v is InteractionSource {\n return (\n typeof v === \"string\" &&\n ((INTERACTION_SOURCE_NAMES as readonly string[]).includes(v) ||\n (v.startsWith(\"custom:\") && v.length > \"custom:\".length))\n );\n}\n\n/** Rebuild an untrusted bindings array into valid bindings for `valid` targets (loaded share-links /\n * presets are untrusted JSON; we validate source/target/to and rebuild clean objects). */\nfunction cleanBindings<T extends string>(\n raw: unknown,\n valid: readonly string[],\n): Array<InteractionBindingBase & { target: T }> {\n const out: Array<InteractionBindingBase & { target: T }> = [];\n if (!Array.isArray(raw)) return out;\n for (const item of raw) {\n if (!item || typeof item !== \"object\") continue;\n const b = item as Record<string, unknown>;\n if (!isInteractionSource(b.source)) continue;\n if (!valid.includes(b.target as string)) continue;\n const to = Number(b.to);\n if (!Number.isFinite(to)) continue;\n const clean: InteractionBindingBase & { target: T } = {\n source: b.source,\n target: b.target as T,\n to,\n };\n if (b.from !== undefined) {\n const f = Number(b.from);\n if (Number.isFinite(f)) clean.from = f;\n }\n if (b.smoothing !== undefined) clean.smoothing = clampNumber(b.smoothing, 0, 2, 0.25);\n out.push(clean);\n }\n return out;\n}\n\n/**\n * Present-only normalizer for a WAVE's interaction block: clamp the hover/press numerics that are\n * present (absent fields stay absent, so the block stays lean and the renderer's defaults apply) and\n * drop bindings with an unknown source/target or a non-finite `to`. NEVER call when the block is\n * absent — absence is inert and byte-identical (normalizeWave gates on presence).\n */\nexport function normalizeWaveInteraction(wave: WaveConfig): void {\n const it = wave.interaction;\n if (!it) return;\n const h = it.hover;\n if (h) {\n if (h.agitate !== undefined) h.agitate = clampNumber(h.agitate, 0, 60, 0);\n if (h.push !== undefined) h.push = clampNumber(h.push, -40, 40, 0);\n if (h.wake !== undefined) h.wake = clampNumber(h.wake, 0, 40, 0);\n if (h.thin !== undefined) h.thin = clampNumber(h.thin, 0, 1, 0);\n if (h.hueShift !== undefined) h.hueShift = clampNumber(h.hueShift, -360, 360, 0);\n if (h.lighten !== undefined) h.lighten = clampNumber(h.lighten, -1, 1, 0);\n if (h.smoothing !== undefined) h.smoothing = clampNumber(h.smoothing, 0, 2, 0.12);\n }\n if (it.press && it.press.ripple !== undefined) {\n it.press.ripple = clampNumber(it.press.ripple, 0, 60, 0);\n }\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<WaveInteractionTarget>(it.bindings, WAVE_TARGET_NAMES);\n }\n}\n\n/** Present-only normalizer for the SCENE interaction block: clamp the shared pointer inputs and drop\n * invalid scene bindings. NEVER call when the block is absent. */\nexport function normalizeSceneInteraction(config: StudioConfig): void {\n const it = config.interaction;\n if (!it) return;\n if (it.radius !== undefined) it.radius = clampNumber(it.radius, 0.02, 2, 0.3);\n if (it.ribbonFlow !== undefined) it.ribbonFlow = clampNumber(it.ribbonFlow, 0, 1, 0.8);\n if (it.bindings !== undefined) {\n it.bindings = cleanBindings<SceneInteractionTarget>(it.bindings, SCENE_TARGET_NAMES);\n }\n}\n\n/** Normalize an ingested config to the wave model: backfill the scene + every wave, and drop in\n * a default wave if none are present. Idempotent, so it is safe on the renderer's own config as\n * well as freshly loaded save-states / share links. */\nexport function ensureStudioConfig(input: StudioConfig): StudioConfig {\n const config = input;\n ensureSceneDefaults(config);\n if (!Array.isArray(config.waves) || config.waves.length === 0) {\n config.waves = [makeWave()];\n }\n config.waves.forEach(normalizeWave); // each wave's normalizeWave runs normalizeWaveInteraction\n config.waveCount = config.waves.length;\n // Present-only: a config without a scene `interaction` block is left untouched (stays \"off\").\n if (config.interaction) normalizeSceneInteraction(config);\n return config;\n}\n"],"mappings":";;;;;;;;AASA,MAAa,aAAa;AAC1B,MAAa,kBAAkB;AAC/B,MAAa,aAAa;AAC1B,MAAa,kBAAkB;;AAE/B,MAAa,YAAY;;AAqCzB,SAAgB,YACd,WAAiB;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAI,GAC1C,YAAY,GACC;CACb,OAAO;EAAE,UAAU,EAAE,GAAG,SAAS;EAAG,OAAO;EAAW;CAAU;AAClE;;;;AAKA,MAAa,yBAA+B;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;;AAsBtE,SAAgB,kBAA6B;CAC3C,OAAO;EACL,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,MAAM;EACN,SAAS;EACT,UAAU;EACV,WAAW;EACX,kBAAkB;EAClB,eAAe;CACjB;AACF;;AAoBA,SAAgB,UAAU,QAA+B;CACvD,MAAM,IAAI,OAAO;CACjB,OAAO,OAAO,KAAK,OAAO,OAAO;EAAE;EAAO,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK;CAAE,EAAE;AAC3E;;AAGA,SAAgB,0BAA+C;CAC7D,OAAO;EACL;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,GAAG;GAAM,GAAG;GAAM,WAAW;EAAK;EACtD;GAAE,OAAO;GAAW,G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OAAO,aAAa,0BAA0B,MAAM;CACxD,OAAO;AACT"}
|
|
@@ -71,6 +71,12 @@ declare class WaveRenderer {
|
|
|
71
71
|
private readonly postPass;
|
|
72
72
|
/** Optional bloom pass — created lazily when bloomStrength first goes >0, removed at 0. */
|
|
73
73
|
private bloomPass?;
|
|
74
|
+
private ditherPass?;
|
|
75
|
+
private innerLightPass?;
|
|
76
|
+
private halftonePass?;
|
|
77
|
+
private heatmapPass?;
|
|
78
|
+
private paperTexturePass?;
|
|
79
|
+
private halftoneCmykPass?;
|
|
74
80
|
protected readonly container: HTMLElement;
|
|
75
81
|
private readonly respectReducedMotion;
|
|
76
82
|
private readonly skipIntroRamp;
|
|
@@ -172,6 +178,25 @@ declare class WaveRenderer {
|
|
|
172
178
|
* created lazily the first time bloom is enabled and disposed when turned back off. It sits
|
|
173
179
|
* right after the scene RenderPass so it blooms the wave before the grain/blur pass. */
|
|
174
180
|
private applyBloom;
|
|
181
|
+
/** Insert / tune / remove the dithering pass — a self-contained "layered" post shader (an ordered
|
|
182
|
+
* Bayer dither, in the spirit of paper-design/shaders). Like bloom, dither 0 removes the pass
|
|
183
|
+
* entirely so cost and pixels match dither-off, and it's created lazily on first enable. It is
|
|
184
|
+
* appended AFTER OutputPass so it runs last and quantizes display-space colour (tone-mapped +
|
|
185
|
+
* sRGB) — dithering the linear composer buffer would crush the steps in the shadows. */
|
|
186
|
+
private applyDither;
|
|
187
|
+
/** Insert / tune / remove the innerLight pass — volumetric light streaks scattered from the bright
|
|
188
|
+
* wave toward a light point (innerLightX/Y in UV). Scene zone (index 1) so it scatters the raw wave
|
|
189
|
+
* like bloom. innerLight 0 removes the pass entirely; created lazily on first enable. */
|
|
190
|
+
private applyInnerLight;
|
|
191
|
+
/** Insert / tune / remove the halftone pass — a rotated dot screen (dot size scales with local
|
|
192
|
+
* brightness) over the finished image. halftone 0 removes the pass; created lazily on enable. */
|
|
193
|
+
private applyHalftone;
|
|
194
|
+
/** Heatmap: recolour the final image by luminance → thermal palette. Finish zone. */
|
|
195
|
+
private applyHeatmap;
|
|
196
|
+
/** Paper texture: fibrous substrate shading multiplied over the image. Finish zone. */
|
|
197
|
+
private applyPaperTexture;
|
|
198
|
+
/** CMYK halftone: four rotated dot screens (cyan/magenta/yellow/black). Finish zone. */
|
|
199
|
+
private applyHalftoneCmyk;
|
|
175
200
|
private onResize;
|
|
176
201
|
private onContextLost;
|
|
177
202
|
private onContextRestored;
|