@mkbabb/glass-ui 3.9.0 → 3.10.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/{CardAction-DuArVky-.js → CardAction-DrAcAV4d.js} +2 -2
- package/dist/{CommandShortcut-CefCj5mt.js → CommandShortcut-mV2e1aG6.js} +2 -2
- package/dist/{DataTable-CUHMukiQ.js → DataTable-C3E6jZ5B.js} +2 -2
- package/dist/{DialogContent-BRkT1cjP.js → DialogContent-BxaaafFi.js} +1 -1
- package/dist/{HoverPopover-2LOIW34a.js → HoverPopover-CDA_SaCe.js} +1 -1
- package/dist/{MetricBadge-lTc002u2.js → MetricBadge-idgrkqoP.js} +1 -1
- package/dist/{Notification-BxK8LZMw.js → Notification-Cu0nN17_.js} +3 -3
- package/dist/{NumberFieldContent-BbLOh8RU.js → NumberFieldContent-CHEWghnY.js} +2 -2
- package/dist/{PopoverContent-BId6ggf_.js → PopoverContent-DpUvdYY-.js} +1 -1
- package/dist/{Progress-iEuD9pxG.js → Progress-BW-StFw2.js} +1 -1
- package/dist/{ScrollingText-BPP84wKo.js → ScrollingText-DruYCni_.js} +1 -1
- package/dist/{SelectScrollDownButton-T32cVFeM.js → SelectScrollDownButton-pirzjm--.js} +3 -3
- package/dist/{Switch-LDKLmmgx.js → Switch-DeAqg6pi.js} +1 -1
- package/dist/{TabsList-B8CVOQPC.js → TabsList-BAVzOZpg.js} +2 -2
- package/dist/{Toaster-1rYWrmAm.js → Toaster-CvuuW_y9.js} +49 -46
- package/dist/{ToggleGroupItem-Cev4pOVK.js → ToggleGroupItem-DtD37b4G.js} +4 -4
- package/dist/animated-digit.js +2 -2
- package/dist/api/index.d.ts +4 -4
- package/dist/api.js +1 -1
- package/dist/aurora.js +238 -547
- package/dist/{badge-BvwvT50i.js → badge-NdCQMvvB.js} +2 -2
- package/dist/badge.js +1 -1
- package/dist/{button-DN39cGqL.js → button-DyiWFAOE.js} +12 -12
- package/dist/button.js +1 -1
- package/dist/canvas.js +2 -2
- package/dist/card.js +1 -1
- package/dist/carousel.js +5 -5
- package/dist/collapsible.js +1 -1
- package/dist/{color-8jBjWiJ6.js → color-B65wWyQz.js} +9 -7
- package/dist/color.js +1 -1
- package/dist/command.js +1 -1
- package/dist/{compile-DAjIoEy2.js → compile-Ce_V55zi.js} +23 -23
- package/dist/components/custom/aurora/composables/atoms.d.ts +21 -4
- package/dist/components/custom/aurora/composables/runtime.d.ts +0 -9
- package/dist/components/custom/aurora/composables/uniformBridge.d.ts +0 -11
- package/dist/components/custom/aurora/constants/renderMode.d.ts +0 -32
- package/dist/components/custom/aurora/constants/shaders/brush.glsl.d.ts +1 -1
- package/dist/components/custom/aurora/constants/shaders/mediums.glsl.d.ts +2 -2
- package/dist/components/custom/aurora/constants/shaders/tonemap.glsl.d.ts +1 -1
- package/dist/components/custom/aurora/constants/shaders/vangogh-medium.glsl.d.ts +1 -0
- package/dist/components/custom/aurora/index.d.ts +1 -1
- package/dist/components/custom/constellation/Constellation.vue.d.ts +85 -1
- package/dist/components/custom/constellation/composables/createConstellationField.d.ts +35 -0
- package/dist/components/custom/constellation/composables/useConstellationPointer.d.ts +35 -0
- package/dist/components/custom/constellation/constants.d.ts +36 -0
- package/dist/components/custom/constellation/constellationDraw.d.ts +18 -0
- package/dist/components/custom/constellation/constellationField.d.ts +174 -63
- package/dist/components/custom/constellation/constellationInteraction.d.ts +102 -0
- package/dist/components/custom/constellation/index.d.ts +4 -2
- package/dist/components/custom/controls/DarkModeToggle.vue.d.ts +11 -0
- package/dist/components/custom/dock/GlassDock.vue.d.ts +2 -110
- package/dist/components/custom/dock/composables/dockMorphContext.d.ts +36 -0
- package/dist/components/custom/dock/composables/useDockMorphWindow.d.ts +15 -0
- package/dist/components/custom/dock/composables/useDockShellProps.d.ts +131 -0
- package/dist/components/custom/dock/composables/useLayerTransition.d.ts +44 -0
- package/dist/components/custom/dock/constants.d.ts +23 -0
- package/dist/components/custom/fourier-field/FourierField.vue.d.ts +6 -0
- package/dist/components/custom/fourier-field/index.d.ts +25 -1
- package/dist/components/custom/fourier-field/math.d.ts +20 -8
- package/dist/components/custom/fourier-field/presets.d.ts +54 -0
- package/dist/components/custom/goo-blob/GooBlob.vue.d.ts +8 -10
- package/dist/components/custom/goo-blob/composables/buildMetaballProgram.d.ts +18 -0
- package/dist/components/custom/goo-blob/composables/uploadBlobUniforms.d.ts +41 -0
- package/dist/components/custom/goo-blob/composables/useBlobPointer.d.ts +4 -3
- package/dist/components/custom/goo-blob/composables/useMetaballRenderer.d.ts +16 -21
- package/dist/components/custom/goo-blob/constants.d.ts +52 -0
- package/dist/components/custom/goo-blob/index.d.ts +1 -1
- package/dist/components/custom/goo-blob/shaders/metaball-uniforms.glsl.d.ts +1 -0
- package/dist/components/custom/goo-blob/types.d.ts +59 -25
- package/dist/components/custom/instrument-chassis/InstrumentChassis.vue.d.ts +2 -2
- package/dist/components/custom/tabs/constants.d.ts +12 -0
- package/dist/components/custom/underline/GlassUnderline.vue.d.ts +84 -0
- package/dist/components/custom/underline/index.d.ts +2 -0
- package/dist/components/custom/underline/types.d.ts +56 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts +1 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +2 -2
- package/dist/components/ui/slider/index.d.ts +25 -18
- package/dist/components/ui/toast/use-toast.d.ts +2 -2
- package/dist/composables/color/index.d.ts +24 -7
- package/dist/composables/glass/useSpecularTracking.d.ts +12 -3
- package/dist/composables/glass/webgl/shaders/procedural-color.glsl.d.ts +1 -6
- package/dist/composables/motion/curves.d.ts +48 -0
- package/dist/composables/motion/index.d.ts +2 -0
- package/dist/composables/motion/springPresets.d.ts +33 -0
- package/dist/composables/motion/suite.d.ts +2 -0
- package/dist/composables/motion/useSpringMount.d.ts +1 -1
- package/dist/configurator.js +1 -1
- package/dist/confirm-dialog.js +2 -2
- package/dist/constellation.js +322 -147
- package/dist/controls.js +48 -14
- package/dist/dark.js +1 -1
- package/dist/data-table.js +1 -1
- package/dist/dialog.js +2 -2
- package/dist/dock.js +340 -327
- package/dist/dockContext-bho8B1A4.js +17 -0
- package/dist/{dropdown-menu-D77jX6Df.js → dropdown-menu-DVnQcA0E.js} +7 -4
- package/dist/dropdown-menu.js +1 -1
- package/dist/expandable-container.js +1 -1
- package/dist/forms.js +2 -2
- package/dist/fourier-field.js +147 -120
- package/dist/fourier-math.d.ts +1 -0
- package/dist/fourier-math.js +2 -0
- package/dist/glass-ui.css +1 -1
- package/dist/glass-ui.js +286 -207
- package/dist/goo-blob.js +368 -322
- package/dist/hover-popover.js +1 -1
- package/dist/icon-tooltip.js +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/keyboard.js +1 -1
- package/dist/labeled-field.js +5 -5
- package/dist/math-BUU9hHID.js +43 -0
- package/dist/metric-badge.js +1 -1
- package/dist/metric-stack.js +2 -2
- package/dist/motion-core.js +4 -4
- package/dist/motion-curves.d.ts +1 -0
- package/dist/motion-curves.js +130 -0
- package/dist/motion.js +38 -37
- package/dist/notification.js +1 -1
- package/dist/number-field.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress.js +1 -1
- package/dist/pulse.js +1 -1
- package/dist/reactive.js +1 -1
- package/dist/scrolling-text.js +1 -1
- package/dist/search.js +6 -6
- package/dist/select.js +1 -1
- package/dist/{sheet-VZEtNFvO.js → sheet-ChSXcJpU.js} +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-DC2mwuoe.js → slider-sfl8gFDD.js} +8 -8
- package/dist/slider.js +1 -1
- package/dist/sortable-list.js +2 -2
- package/dist/springPresets-aRSm-4_k.js +40 -0
- package/dist/stacked-icons.js +6 -6
- package/dist/styles/cards.css +2 -2
- package/dist/styles/components.css +1 -1
- package/dist/styles/dock/layer-group.css +38 -4
- package/dist/styles/dock/layers.css +11 -1
- package/dist/styles/dock/morph.css +95 -19
- package/dist/styles/dock/shell.css +12 -0
- package/dist/styles/dock-controls.css +25 -12
- package/dist/styles/drawer.css +14 -4
- package/dist/styles/floating-panel.css +2 -0
- package/dist/styles/glass/a11y-fallback.css +245 -0
- package/dist/styles/glass/ladder.css +304 -0
- package/dist/styles/glass/material.css +238 -0
- package/dist/styles/glass/progress-rail.css +78 -0
- package/dist/styles/glass/squircle.css +66 -0
- package/dist/styles/glass/surfaces.css +306 -0
- package/dist/styles/glass-refract.css +2 -0
- package/dist/styles/glass.css +31 -1052
- package/dist/styles/hover-popover.css +2 -0
- package/dist/styles/index.css +24 -6
- package/dist/styles/instrument-chassis.css +4 -0
- package/dist/styles/theme.css +14 -14
- package/dist/styles/tokens/color-radius.css +250 -0
- package/dist/styles/tokens/dark-arm.css +194 -0
- package/dist/styles/tokens/glass.css +413 -0
- package/dist/styles/tokens/light-dark.css +158 -0
- package/dist/styles/tokens/offsets-sizing.css +406 -0
- package/dist/styles/tokens/property-regs.css +169 -0
- package/dist/styles/tokens/scale-paper.css +361 -0
- package/dist/styles/tokens/scheme-motion.css +334 -0
- package/dist/styles/tokens/shadow.css +132 -0
- package/dist/styles/tokens.css +22 -2269
- package/dist/styles/transitions.css +20 -2
- package/dist/styles/typography.css +18 -6
- package/dist/styles/utilities/a11y-overrides.css +140 -0
- package/dist/styles/utilities/animate.css +26 -0
- package/dist/styles/utilities/base.css +365 -0
- package/dist/styles/utilities/btn.css +399 -0
- package/dist/styles/utilities/components.css +317 -0
- package/dist/styles/utilities.css +19 -1170
- package/dist/switch.js +1 -1
- package/dist/tabs.js +98 -98
- package/dist/timeline.js +2 -2
- package/dist/toast.js +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/underline.d.ts +1 -0
- package/dist/underline.js +85 -0
- package/dist/{useAnimatedNumber-C5I3wWd8.js → useAnimatedNumber-DfVgP4te.js} +1 -1
- package/dist/{useConfiguratorState-DxAqksK6.js → useConfiguratorState-BdQXh9ie.js} +1 -1
- package/dist/useSpecularTracking-DFK_fhpG.js +32 -0
- package/dist/useSpringMount-DXUzxBjV.js +108 -0
- package/dist/watercolor-dot.js +2 -2
- package/package.json +62 -38
- package/src/styles/cards.css +2 -2
- package/src/styles/dock/layer-group.css +38 -4
- package/src/styles/dock/layers.css +11 -1
- package/src/styles/dock/morph.css +95 -19
- package/src/styles/dock/shell.css +12 -0
- package/src/styles/dock-controls.css +25 -12
- package/src/styles/drawer.css +12 -4
- package/src/styles/glass/a11y-fallback.css +245 -0
- package/src/styles/glass/ladder.css +304 -0
- package/src/styles/glass/material.css +238 -0
- package/src/styles/glass/progress-rail.css +78 -0
- package/src/styles/glass/squircle.css +66 -0
- package/src/styles/glass/surfaces.css +306 -0
- package/src/styles/glass.css +31 -1052
- package/src/styles/index.css +24 -6
- package/src/styles/theme.css +14 -14
- package/src/styles/tokens/color-radius.css +250 -0
- package/src/styles/tokens/dark-arm.css +194 -0
- package/src/styles/tokens/glass.css +413 -0
- package/src/styles/tokens/light-dark.css +158 -0
- package/src/styles/tokens/offsets-sizing.css +406 -0
- package/src/styles/tokens/property-regs.css +169 -0
- package/src/styles/tokens/scale-paper.css +361 -0
- package/src/styles/tokens/scheme-motion.css +334 -0
- package/src/styles/tokens/shadow.css +132 -0
- package/src/styles/tokens.css +22 -2269
- package/src/styles/transitions.css +20 -2
- package/src/styles/typography.css +18 -6
- package/src/styles/utilities/a11y-overrides.css +140 -0
- package/src/styles/utilities/animate.css +26 -0
- package/src/styles/utilities/base.css +365 -0
- package/src/styles/utilities/btn.css +399 -0
- package/src/styles/utilities/components.css +317 -0
- package/src/styles/utilities.css +19 -1170
- package/dist/DeckProgress-Dmk4_AKN.js +0 -23
- package/dist/InstrumentRail-CUJ05YVG.js +0 -44
- package/dist/components/custom/aurora/composables/gpuRuntime.d.ts +0 -16
- package/dist/components/custom/aurora/constants/shaders/aurora.wgsl.d.ts +0 -7
- package/dist/components/custom/deck-progress/DeckProgress.vue.d.ts +0 -27
- package/dist/components/custom/deck-progress/index.d.ts +0 -2
- package/dist/components/custom/dialog-native/GlassDialogNative.vue.d.ts +0 -57
- package/dist/components/custom/dialog-native/index.d.ts +0 -1
- package/dist/components/custom/glass-panel/GlassPanel.vue.d.ts +0 -41
- package/dist/components/custom/glass-panel/index.d.ts +0 -2
- package/dist/components/custom/header-ribbon/HeaderRibbon.vue.d.ts +0 -31
- package/dist/components/custom/header-ribbon/index.d.ts +0 -2
- package/dist/components/custom/header-ribbon/types.d.ts +0 -7
- package/dist/components/custom/instrument-rail/InstrumentRail.vue.d.ts +0 -91
- package/dist/components/custom/instrument-rail/index.d.ts +0 -2
- package/dist/composables/glass/createGPUCanvas.d.ts +0 -40
- package/dist/deck-progress.d.ts +0 -1
- package/dist/deck-progress.js +0 -2
- package/dist/dockContext-BKeIMmNk.js +0 -9
- package/dist/glass-panel.d.ts +0 -1
- package/dist/glass-panel.js +0 -44
- package/dist/header-ribbon.d.ts +0 -1
- package/dist/header-ribbon.js +0 -63
- package/dist/instrument-rail.d.ts +0 -1
- package/dist/instrument-rail.js +0 -2
- package/dist/useGlassRenderer-5I0YkI4t.js +0 -69
- package/dist/useSpecularTracking-BVRZsRHA.js +0 -26
- package/dist/useSpringMount-BJSHcLl3.js +0 -113
- /package/dist/{CollapsibleContent-CP9qF1v4.js → CollapsibleContent-Drow5WkV.js} +0 -0
- /package/dist/{DialogFooter-Gprw8H_A.js → DialogFooter-DufLHi0y.js} +0 -0
- /package/dist/{IconTooltip-yefK7cJc.js → IconTooltip-BrQ5p181.js} +0 -0
- /package/dist/{Input-DWQQIOC4.js → Input-B-F818RU.js} +0 -0
- /package/dist/{_plugin-vue_export-helper-ok8pgSl5.js → _plugin-vue_export-helper-DWghtRt7.js} +0 -0
- /package/dist/{constants-CS75AWHG.js → constants-C8NMonuo.js} +0 -0
- /package/dist/{presets-BKVyQfbt.js → presets-1OhFpaIC.js} +0 -0
- /package/dist/{prng-wHuHlNHE.js → prng-CjVgzjQT.js} +0 -0
- /package/dist/{resolveCanvasColor-BBiYfp8g.js → resolveCanvasColor-CRvVzOvP.js} +0 -0
- /package/dist/{useCanvas2D-ClrQuZtp.js → useCanvas2D-CSeH8h16.js} +0 -0
- /package/dist/{useGlobalDark-yhL4Wp-s.js → useGlobalDark-D7R9OypB.js} +0 -0
- /package/dist/{useIntersectionPause-Cc-H9ees.js → useIntersectionPause-DAdVPVp4.js} +0 -0
- /package/dist/{useInterval-Dsmqwi03.js → useInterval-D3USn0yc.js} +0 -0
- /package/dist/{useKeyboardShortcuts-Be3w_Rwk.js → useKeyboardShortcuts-i8tHd5WO.js} +0 -0
- /package/dist/{useScrollProgress-CAH8Ofwt.js → useScrollProgress-CcgmgMQt.js} +0 -0
- /package/dist/{useSortable-C8ReQ50P.js → useSortable-DnyGXKKY.js} +0 -0
- /package/dist/{useTextHighlight-DON84L8w.js → useTextHighlight-B3b10W6r.js} +0 -0
package/dist/aurora.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as e } from "./_plugin-vue_export-helper-
|
|
2
|
-
import { a as t, c as n,
|
|
3
|
-
import { n as
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { computed as
|
|
8
|
-
import { interpolateHue as
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-DWghtRt7.js";
|
|
2
|
+
import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./compile-Ce_V55zi.js";
|
|
3
|
+
import { n as d, r as f, t as p } from "./presets-1OhFpaIC.js";
|
|
4
|
+
import { a as m, c as h, i as g, l as _, o as v, t as y } from "./color-B65wWyQz.js";
|
|
5
|
+
import { t as ee } from "./useIntersectionPause-DAdVPVp4.js";
|
|
6
|
+
import { t as te } from "./useScrollProgress-CcgmgMQt.js";
|
|
7
|
+
import { computed as b, createElementBlock as x, createElementVNode as S, defineComponent as ne, normalizeClass as re, normalizeStyle as C, onBeforeUnmount as w, onMounted as T, openBlock as ie, readonly as E, ref as D, unref as O, watch as k } from "vue";
|
|
8
|
+
import { interpolateHue as ae, rawOklabToOklch as oe, srgbToOKLab as se } from "@mkbabb/value.js";
|
|
9
9
|
//#region src/components/custom/aurora/constants/shaders/aurora.vert.ts
|
|
10
|
-
var pe = "#version 300 es\nin vec2 aPos;\nout vec2 vUv;\nvoid main() {\n vUv = aPos * 0.5 + 0.5;\n gl_Position = vec4(aPos, 0.0, 1.0);\n}", me = "// ── Palette LUT (W5 — OKLCh/OKLab interpolation) ──────────────────────────────\n// The endpoints stay CPU-baked to LINEAR sRGB (the Aras precompute pattern); only\n// the BETWEEN-endpoint interpolation runs in perceptual space. AX.W11 — the ramp\n// itself (the smoothstep ease + the OKLab-rectangular-vs-OKLCh-hue-arc dispatch on\n// uHuePath) is the shared samplePaletteRamp from procedural-color.glsl, the SAME\n// source the WebGPU twin splices; samplePalette here only selects the bracketing\n// stop pair + the raw inter-stop t and hands them to the shared ramp.\nvec3 samplePalette(float id) {\n id = clamp(id, 0.0, 1.0);\n float scaled = id * float(uStopCount - 1);\n int i0 = int(floor(scaled));\n int i1 = min(i0 + 1, uStopCount - 1);\n float t = fract(scaled);\n return samplePaletteRamp(uPalette[i0], uPalette[i1], t, uHuePath);\n}\n\n// ── Nuclei field ──────────────────────────────────────────────────────────\nvoid nucleiField(vec2 p, float t, out float paletteId, out float valueMod) {\n float accumBias = 0.0;\n float accumValue = 0.0;\n float accumW = 0.0;\n for (int i = 0; i < MAX_NUCLEI; i++) {\n if (i >= uNucleiCount) break;\n vec2 posI = uNucleiPos[i]\n + uNucleiDriftRadius[i] * vec2(\n cos(t * uNucleiDrift * K_NUCLEI + uNucleiDriftPhase[i]),\n sin(t * uNucleiDrift * K_NUCLEI + uNucleiDriftPhase[i] * 1.13)\n );\n vec2 diff = p - posI;\n // Anisotropic Gaussian: rotate diff into the nucleus's local frame\n // (major axis along uNucleiAngle), then scale the major-axis component by\n // 1/elongation so the squared distance describes an ellipse. Defaults\n // 1.0/0.0 reduce to the isotropic dot(diff, diff).\n float ca = cos(uNucleiAngle[i]);\n float sa = sin(uNucleiAngle[i]);\n vec2 local = vec2( ca * diff.x + sa * diff.y,\n -sa * diff.x + ca * diff.y);\n float along = local.x / max(uNucleiElong[i], 0.01);\n float across = local.y;\n float d2 = along * along + across * across;\n float r = max(uNucleiRadius[i], 0.01);\n float w = exp(-uSoftmaxBeta * d2 / (r * r));\n accumBias += w * uNucleiPaletteBias[i];\n accumValue += w * uNucleiValueBias[i];\n accumW += w;\n }\n paletteId = accumBias / max(accumW, 1e-4);\n valueMod = accumValue / max(accumW, 1e-4);\n\n // Palette drift — slow global paletteId breathe between adjacent stops. The\n // rate rides K_PAL (perceptible ~30–60s hue cycle at the default coefficient);\n // the amplitude lifts the authored coefficient into a 0.03..0.06 paletteId band\n // so the palette visibly travels rather than dithering within one stop.\n float palAmp = clamp(uPaletteDrift * 6.0, 0.0, 0.06);\n paletteId += palAmp * sin(t * uPaletteDrift * K_PAL);\n paletteId = clamp(paletteId, 0.0, 1.0);\n}\n", he = "// ── Flow field ────────────────────────────────────────────────────────────\n// Structure-tensor prototype (body defined post-sampleBase in the mediums block).\n// Returns vec3(dir.x, dir.y, coherence) — the minor-eigenvector tangent + A.\nvec3 structureTensorField(vec2 p, float t, vec2 fallbackDir);\n\nvec2 flowField(vec2 p, float t) {\n vec2 dir = vec2(1.0, 0.0);\n if (uFlowPattern == 1) {\n // radial\n dir = normalize(p - uFlowFocal + 1e-4);\n } else if (uFlowPattern == 2) {\n // swirl — tangent to radial\n vec2 rad = normalize(p - uFlowFocal + 1e-4);\n dir = vec2(-rad.y, rad.x);\n } else if (uFlowPattern == 3) {\n // diagonal\n float a = radians(uFlowAngle);\n dir = vec2(cos(a), sin(a));\n } else if (uFlowPattern == 4) {\n // multi — curl-noise driven\n float n = fbm(p * 2.0 + t * 0.02);\n float a = n * 6.2831;\n dir = vec2(cos(a), sin(a));\n } else if (uFlowPattern == 5) {\n // tensor / ETF — the color field's OWN edge-tangent flow (AW.W4.1). The\n // diagonal angle seeds the smooth fallback the coherence-weighted blend\n // relaxes toward in low-structure zones. Returns directly (no curl/cursor\n // post-mix — the tensor field already carries the structure orientation;\n // the cursor warp still drives the underlying color field in domainWarp).\n float a = radians(uFlowAngle);\n vec2 fallback = vec2(cos(a), sin(a));\n return structureTensorField(p, t, fallback).xy;\n }\n // curl — perturb by noise. Radial gets much less curl so rays stay clean.\n if (uFlowCurl > 0.0) {\n float n = fbm(p * 3.0) - 0.5;\n float curlAmt = uFlowCurl;\n if (uFlowPattern == 1) curlAmt *= 0.25; // radial: preserve ray clarity\n if (uFlowPattern == 2) curlAmt *= 0.55; // swirl: allow moderate curl\n float a = atan(dir.y, dir.x) + n * 3.14159 * curlAmt;\n dir = vec2(cos(a), sin(a));\n }\n // cursor influence — swirl around the cursor position\n if (uCursorStrength > 0.001) {\n vec2 toCur = uCursor - p;\n float d = length(toCur);\n float r = max(uCursorRadius, 0.01);\n float w = exp(-(d * d) / (r * r * 0.5));\n // swirl tangent\n vec2 tangent = vec2(-toCur.y, toCur.x) / max(d, 1e-4);\n float a0 = atan(dir.y, dir.x);\n float a1 = atan(tangent.y, tangent.x);\n // blend angle\n float da = a1 - a0;\n da = atan(sin(da), cos(da)); // wrap to [-pi, pi]\n float a = a0 + da * w * uCursorStrength;\n dir = vec2(cos(a), sin(a));\n }\n // AW.W8.1 — velocity-reactive swirl-BURST: a fast flick (uCursorBurst, decaying\n // over ~1s) injects a transient flow bias along the pointer velocity, distinct from\n // the steady attraction above (the stateless swirl is SUPERSEDED by this form). The\n // burst is gated by the master tempo scalar on the CPU side (it decays to 0 under\n // PRM/pause), so this term cannot leak motion under reduced-motion.\n if (uCursorBurst > 0.001) {\n vec2 toCur = uCursor - p;\n float d = length(toCur);\n float r = max(uCursorRadius, 0.01);\n float w = exp(-(d * d) / (r * r * 0.7));\n // Bias the flow toward the velocity direction, scaled by the decaying burst.\n vec2 velDir = uCursorVelocity / max(length(uCursorVelocity), 1e-4);\n float a0 = atan(dir.y, dir.x);\n float a1 = atan(velDir.y, velDir.x);\n float da = atan(sin(a1 - a0), cos(a1 - a0));\n float a = a0 + da * w * uCursorBurst * 0.8;\n dir = vec2(cos(a), sin(a));\n }\n return dir;\n}\n", ge = "// ACES approximation\nvec3 aces(vec3 x) {\n float a = 2.51;\n float b = 0.03;\n float c = 2.43;\n float d = 0.59;\n float e = 0.14;\n return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);\n}\n", _e = "// ── Curved swept brushstroke primitive ────────────────────────────────────\n// A stroke is a curved spine from A to B with quadratic bulge K (sideways offset\n// at midpoint). Width varies along length via a shape profile. Edge is ragged\n// (bristle-modulated), ends are rounded blobs, inside has streak modulation.\n//\n// For pixel p, we invert an approximate projection onto the curved spine:\n// 1) project p onto straight AB axis -> along0, cross0\n// 2) at parameter along0, spine offset = 4·K·along0·(1-along0) perpendicular\n// 3) cross = cross0 - spineOffset, refine along one iteration\n// Coverage blends paint atop col based on per-stroke color sampled from the\n// underlying base at spine midpoint — so overlapping strokes from different\n// palette regions meet at hard, ragged demarcations.\n\nstruct StrokeHit {\n float coverage; // 0..1\n vec3 color;\n float alongT; // 0..1 along spine, for internal modulation\n float crossN; // cross distance / current half-width, signed\n float edgeN; // distance to edge in half-widths (0 = at edge, 1 = at spine)\n};\n\nStrokeHit noHit() { return StrokeHit(0.0, vec3(0.0), 0.0, 0.0, 0.0); }\n\nvec2 rotateDir(vec2 dir, float angle) {\n float ca = cos(angle), sa = sin(angle);\n return vec2(dir.x * ca - dir.y * sa, dir.x * sa + dir.y * ca);\n}\n\nvec2 safeDir(vec2 dir) {\n float len = length(dir);\n return len > 1e-4 ? dir / len : vec2(1.0, 0.0);\n}\n\n// Shape profile along the stroke. type:\n// 0 tapered — thin-fat-thin (classic brush)\n// 1 load-drag — fat start, tapers to a point\n// 2 dab — ellipse-like, round center\n// 3 even — near-constant, slight end taper\n// 4 comma — van-Gogh atomic dab: ASYMMETRIC taper, fat near one end and\n// drawn to a fine point at the other (the divisionist crescent\n// mark). The width peak sits off-centre (~0.32) so the two ends\n// taper at DIFFERENT rates — a loaded round head + a dragged tail.\nfloat strokeShape(float t, int type) {\n t = clamp(t, 0.0, 1.0);\n if (type == 1) {\n // loaded at t=0, tapering\n return pow(1.0 - t, 0.55) * smoothstep(0.0, 0.08, t);\n } else if (type == 2) {\n // dab / blob\n float d = t - 0.5;\n return exp(-d * d * 12.0);\n } else if (type == 3) {\n // mostly even, slight end softening\n return smoothstep(0.0, 0.08, t) * smoothstep(1.0, 0.92, t) * 0.95 + 0.05;\n } else if (type == 4) {\n // comma / crescent — width peaks at ~0.32 then drags to a fine tail. The two\n // sides of the peak fall at different exponents (a fat round head, a long thin\n // tail), so the mark reads as a directional van-Gogh comma, not a symmetric oval.\n float peak = 0.32;\n float head = smoothstep(0.0, peak, t); // rounded loaded head\n float tail = pow(clamp((1.0 - t) / (1.0 - peak), 0.0, 1.0), 1.6); // dragged thin tail\n return clamp(min(head, tail) * 1.04, 0.0, 1.0);\n }\n // 0 tapered\n return smoothstep(0.0, 0.22, t) * smoothstep(1.0, 0.78, t);\n}\n\n// A single curved stroke.\n// a, b — endpoints\n// halfW — base half-width (world units)\n// bulge — signed perpendicular midpoint offset, in world units\n// shapeType — 0..3\n// bristleFreq — spatial frequency of edge raggedness\n// bristleAmp — 0..0.5 fraction of halfW chewed away at edge extrema\n// streakSeed — uniqueness seed for internal streaks\n// colAtMid — pre-sampled color at midpoint\nStrokeHit curvedStroke(vec2 p, vec2 a, vec2 b, float halfW,\n float bulge, int shapeType,\n float bristleFreq, float bristleAmp,\n float streakSeed, vec3 colAtMid) {\n vec2 ab = b - a;\n float L = length(ab);\n if (L < 1e-5) return noHit();\n vec2 tang = ab / L;\n vec2 norm = vec2(-tang.y, tang.x);\n\n vec2 rel = p - a;\n float along0 = dot(rel, tang) / L; // straight projection 0..1 along AB\n float cross0 = dot(rel, norm); // signed cross\n\n // Spine sideways offset due to bulge (parabolic)\n float bend = 4.0 * bulge * along0 * (1.0 - along0);\n float cross1 = cross0 - bend;\n\n // One refinement step: as the spine bends, the closest-point along shifts.\n // Spine tangent differs from straight tangent; first-order correction:\n float dBend = 4.0 * bulge * (1.0 - 2.0 * along0); // d(bend)/d(along)\n float along1 = along0 + (cross1 * dBend) / (L * (1.0 + dBend * dBend / (L * L)));\n\n // Bristle-ragged edge: half-width gets chewed by 1D noise along the spine\n float edgeNoise = fbm(vec2(along1 * bristleFreq, streakSeed * 7.3)) - 0.5;\n float edgeNoise2 = fbm(vec2(along1 * bristleFreq * 2.3, streakSeed * 3.1 + 17.0)) - 0.5;\n float edgeMod = 1.0 - bristleAmp * (0.6 + 0.4 * edgeNoise) * (0.5 + edgeNoise2);\n\n // Width profile along the stroke\n float shape = strokeShape(along1, shapeType);\n float halfWNow = halfW * shape * edgeMod;\n\n // Inside-segment coverage\n float cov = 0.0;\n if (along1 >= 0.0 && along1 <= 1.0 && halfWNow > 1e-6) {\n float cn = abs(cross1) / halfWNow;\n // fwidth-derived AA: half-width from the field's screen-space gradient so the\n // edge holds ~1px regardless of zoom/DPR (mirrors metaball.frag.ts:252-255).\n float aaC = max(fwidth(cn), 1e-6);\n cov = 1.0 - smoothstep(1.0 - aaC, 1.0 + aaC, cn);\n }\n\n // End-cap blobs (rounded tips, not perpendicular cuts)\n float capA = 0.0, capB = 0.0;\n {\n vec2 capCenterA = a + norm * (bulge * 0.0); // at a\n vec2 capCenterB = a + tang * L + norm * bend * 0.0 + norm * 0.0; // at b; bend is 0 at endpoints\n capCenterB = b;\n float endShapeA = strokeShape(0.02, shapeType);\n float endShapeB = strokeShape(0.98, shapeType);\n float rA = halfW * endShapeA * (0.9 + 0.2 * fbm(vec2(streakSeed * 13.0)));\n float rB = halfW * endShapeB * (0.9 + 0.2 * fbm(vec2(streakSeed * 19.0 + 5.0)));\n float dA = length(p - capCenterA);\n float dB = length(p - capCenterB);\n // fwidth-derived AA on the clean Euclidean cap distances (mirrors metaball.frag.ts:252-255).\n float aaA = max(fwidth(dA), 1e-6);\n float aaB = max(fwidth(dB), 1e-6);\n capA = 1.0 - smoothstep(rA - aaA, rA + aaA, dA);\n capB = 1.0 - smoothstep(rB - aaB, rB + aaB, dB);\n // Only apply caps if we're BEYOND the segment; otherwise the segment wins.\n capA *= (along1 < 0.05) ? 1.0 : 0.0;\n capB *= (along1 > 0.95) ? 1.0 : 0.0;\n }\n\n float coverage = max(cov, max(capA, capB));\n if (coverage < 0.002) return noHit();\n\n // Edge distance (for impasto later): 0 at edge, 1 at spine\n float edgeDist = halfWNow > 1e-6 ? clamp(1.0 - abs(cross1) / halfWNow, 0.0, 1.0) : 0.0;\n\n return StrokeHit(\n coverage,\n colAtMid,\n clamp(along1, 0.0, 1.0),\n halfWNow > 1e-6 ? cross1 / halfWNow : 0.0,\n edgeDist\n );\n}\n\n// The painterly STROKE mediums (those that deposit via paintStrokeLayers/paintOver):\n// oil (3), van-Gogh (5), oil-pastel (6). For these the stroke OVER-composite runs in\n// OKLab so overlapping complementaries mix through a chromatic path, not the linear-\n// RGB grey mud; the smooth/atmospheric pole never reaches paintOver so it pays nothing.\nbool isPainterlyStroke() {\n return uMedium == 3 || uMedium == 5 || uMedium == 6;\n}\n\n// OKLab OVER-composite: lerp L,a,b of the over-color toward the under-color (the\n// Ottosson matrices spliced from procedural-color.glsl.ts — no new color math). Two\n// complementary-hued strokes overlapping transition through OKLab, where the midpoint\n// holds chroma, instead of the linear mix() that desaturates toward grey (slice 8 F2).\nvec3 paintOverOklab(vec3 under, vec3 over, float alpha) {\n vec3 labU = linOklab(under);\n vec3 labO = linOklab(over);\n return max(oklabToLinearSrgb(mix(labU, labO, alpha)), vec3(0.0));\n}\n\n// Composite stroke over col with internal streaking + ACCUMULATE paint HEIGHT.\n// streakAmp — 0..0.2 how much internal streaks darken/lighten\n// impastoAmp — 0..1 paint-thickness contribution (the height the relight reads)\n// hardness — 0..1 how crisp the compositing transition is (1 = razor, 0 = creamy)\n//\n// AW.W4.2 — the fixed-RGB edge rim (the phantom upper-left light) is RETIRED. Each\n// stroke now deposits PAINT HEIGHT into the height accumulator (coverage x per-stroke\n// thickness, perturbed by the bristle/streak fbm for ridges/grooves); mediumOil\n// derives a normal from the accumulated height gradient (dFdx/dFdy) and relights it\n// once with the movable uLightDir source (relightImpasto), in linear before aces().\n//\n// AX.W13 — the internal streak now perturbs HUE + CHROMA in OKLCh (not value-only),\n// so a single stroke carries a small hue gradient (broken color at the ATOM level —\n// adjacent strokes shimmer like real impasto, not flat stamped swatches; slice 8 F5);\n// and the OVER-composite runs in OKLab on the painterly stroke mediums so overlapping\n// complementaries mix as pigment, not the linear-mix grey (slice 8 F2).\n// impastoFloor — the per-stroke height-crown floor: oil's 0.4+0.6*edgeN reads\n// floor=0.4 (the crown tapers to 40% at the stroke edge); the van-Gogh\n// profile passes floor=1.0 so each atomic dab catches a FULL-height\n// glint (scope item 1d). The crown magnitude is floor + (1-floor)*edgeN.\nvoid paintOver(inout vec3 col, inout float height, StrokeHit s,\n float streakFreq, float streakAmp,\n float impastoAmp, float hardness, float streakSeed,\n float impastoFloor) {\n if (s.coverage < 0.002) return;\n float strokeOpacity = clamp(uStrokeAmount, 0.0, 1.0);\n if (strokeOpacity <= 0.001) return;\n vec3 c = s.color;\n\n // Internal streaks — fbm along spine, modulated by cross position. Gives\n // the loaded-brush look: some bristles carry more pigment than others.\n float streakA = fbm(vec2(s.alongT * streakFreq, s.crossN * 2.7 + streakSeed));\n float streakB = fbm(vec2(s.alongT * streakFreq * 0.6 + streakSeed * 3.7, s.crossN * 4.1));\n float streak = 0.6 * (streakA - 0.5) + 0.4 * (streakB - 0.5);\n\n // ── WITHIN-stroke OKLCh broken color (AX.W13, slice 8 F5). The streak fBm perturbs\n // the stroke's HUE + CHROMA along alongT/crossN, seeded per-stroke, so a single\n // stroke reads a small hue gradient (the atom-level broken-color shimmer). Value is\n // carried by the same streak so the loaded-brush light/dark survives. Gated to the\n // painterly stroke mediums + uBrokenColor (the smooth pole keeps the cheap value-only\n // streak). A second decorrelated fBm drives the hue axis so hue ≠ a scaled value.\n float hueStreak = fbm(vec2(s.alongT * streakFreq * 0.45 + streakSeed * 5.3,\n s.crossN * 1.9 + streakSeed * 1.7)) - 0.5;\n if (isPainterlyStroke() && uBrokenColor > 0.001) {\n vec3 lch = oklabToOklch(linOklab(c));\n // ±~10° within-stroke hue swing + ±~9% chroma, scaled by uBrokenColor. Smaller\n // than the per-stroke cell jitter (brokenColorJitter) — this is the intra-stroke\n // gradient layered on top of the per-cell pigment patch.\n lch.z += hueStreak * (20.0 * PI / 180.0) * uBrokenColor;\n lch.y = max(lch.y * (1.0 + (streak) * 0.18 * uBrokenColor), 0.0);\n c = max(oklabToLinearSrgb(oklchToOklab(lch)), vec3(0.0));\n }\n // Value streak (the loaded-brush light/dark across the bristles) — kept for every\n // medium that reaches paintOver (the smooth pole never does).\n c *= 1.0 + streak * streakAmp * 2.0;\n\n // Subtle value variance across width (hollow-center catch-light)\n float crossShade = smoothstep(0.0, 0.4, s.edgeN) * (1.0 - smoothstep(0.65, 1.0, s.edgeN));\n c *= 1.0 + crossShade * 0.05;\n\n float softLimit = mix(0.35, 0.98, hardness);\n float alpha = smoothstep(0.0, 1.0 - softLimit, s.coverage) * strokeOpacity;\n // OKLab OVER-composite on the painterly stroke mediums (overlap mixes as pigment,\n // not grey); the smooth pole never reaches paintOver, so it keeps the cheap path.\n col = isPainterlyStroke() ? paintOverOklab(col, c, alpha) : mix(col, c, alpha);\n\n // ── Accumulate paint HEIGHT (AW.W4.2). Thickness peaks at the stroke spine and\n // falls toward the impastoFloor at the edge (edgeN: 0=edge, 1=spine), perturbed by\n // the bristle streak so ridges/grooves form. The relight reads the gradient of this\n // field. The van-Gogh profile's floor=1.0 gives every atomic dab a full-height crown.\n float ridge = 0.7 + 0.3 * (streak + 0.5);\n float crown = impastoFloor + (1.0 - impastoFloor) * s.edgeN;\n height += s.coverage * impastoAmp * crown * ridge * alpha;\n}\n\n// AW.W4.2 — relight the accumulated paint height. Derive a normal from the height\n// gradient (dFdx/dFdy — derivatives are in-pattern; fwidth is already used for AA),\n// then apply diffuse + Blinn specular from the movable uLightDir/uLightColor source.\n// LINEAR-space lighting BEFORE aces() (the tonemap/OETF stay locked); thin strokes\n// inherit a low shininess, thick impasto raises it (high-height ridges catch a sharp\n// glint). canvasBase is the tooth height so the canvas weave also catches the light.\nvec3 relightImpasto(vec3 col, float height, float canvasBase) {\n float h = height + canvasBase;\n // Height-gradient normal. heightScale trades relief depth for surface flatness.\n float heightScale = 6.0;\n vec3 N = normalize(vec3(-dFdx(h) * 40.0, -dFdy(h) * 40.0, 1.0 / heightScale));\n vec3 L = normalize(uLightDir);\n vec3 V = vec3(0.0, 0.0, 1.0); // view straight on\n vec3 H = normalize(L + V);\n float diff = max(dot(N, L), 0.0);\n // Thick impasto → high shininess (sharp glint); thin paint → broad soft sheen.\n float shininess = mix(8.0, 64.0, clamp(height * 2.0, 0.0, 1.0));\n float spec = pow(max(dot(N, H), 0.0), shininess);\n // Modulate the lit terms by how much paint sits here (no relief on bare ground).\n float relief = clamp(h * 1.5, 0.0, 1.0);\n vec3 lit = col * (1.0 + uImpasto * relief * (diff - 0.5) * 0.5 * uLightColor);\n lit += uImpasto * relief * spec * 0.6 * uLightColor;\n return lit;\n}\n\n// Best-of-9-neighbor placement: sample 3x3 surrounding cells and take the\n// stroke that covers this pixel most. Breaks the grid by per-cell jitter and\n// sparse density via noise thresholding.\n// energyGrade — the SBR energy-grade magnitude (0 = none, the oil/oil-pastel\n// baseline; 1 = the full van-Gogh Starry-Night cascade — long\n// confident strokes in the lights/coherent zones, short dabs in\n// the darks/flat zones). The van-Gogh profile carries 1.0 (the\n// energy grade is a PROFILE field, not a buried uMedium==5 branch).\nStrokeHit bestOil(vec2 p, float cellSize, float lenMul, float halfWMul,\n float jitterAmt, float density, int shapeType,\n float bristleAmp, vec2 flow, float t, float seed,\n float energyGrade) {\n vec2 cell = floor(p / cellSize);\n\n StrokeHit best = noHit();\n // 3x3 neighborhood\n for (int dy = -1; dy <= 1; dy++) {\n for (int dx = -1; dx <= 1; dx++) {\n vec2 cc = cell + vec2(float(dx), float(dy));\n vec2 hh = hash22(cc + seed) - 0.5;\n // Density gate — noise threshold; sparse placement.\n float gate = hash21(cc * 1.7 + seed * 0.3);\n if (gate > density) continue;\n\n vec2 center = (cc + 0.5 + hh * jitterAmt) * cellSize;\n\n // Per-stroke direction source — the AW.W4.1 strokeOrient switch:\n // uStrokeOrient==0 (flow) — the layer-provided hand-authored flowField.\n // uStrokeOrient==1 (tensor) — the structure-tensor minor eigenvector at the\n // cell center (the color field's edge-tangent),\n // so strokes hug the color zones (van Gogh).\n // coh carries the per-cell coherence A for the W4.3 energy grading (long\n // confident strokes where structure is coherent, stubby dabs in flat zones).\n vec2 f;\n float coh = 1.0;\n if (uStrokeOrient == 1) {\n vec3 tf = structureTensorField(center, t, safeDir(flow));\n f = safeDir(tf.xy);\n coh = tf.z;\n } else {\n f = safeDir(flow);\n }\n // Per-stroke deterministic local perturbation so alternate stroke layers stay\n // live. Tensor strokes get LESS angular jitter (the field already orients them).\n float jScale = (uStrokeOrient == 1) ? 0.4 : 1.0;\n float angJ = (hash21(cc + seed + 11.0) - 0.5) * 0.9 * jScale; // +/- 0.45/0.18 rad\n float localCurl = (fbm(center * (2.6 + seed * 0.11) + seed * 1.9) - 0.5) * 0.55 * uFlowCurl;\n vec2 dir = rotateDir(f, angJ + localCurl);\n\n // AX.W13 — the SBR energy grade is a PROFILE field (energyGrade), not a buried\n // uMedium==5 branch. The van-Gogh profile passes energyGrade=1.0 (the full\n // Starry-Night cascade); oil/oil-pastel pass 0.0 (uniform length). The grade\n // modulates stroke length by local luminance (bright → long confident strokes,\n // dark → short dabs, the Kolmogorov/Batchelor congruence) AND by coherence\n // (coherent zones → long, flat → stubby), lerped in by energyGrade so a profile\n // can dial the cascade from off (0) to full (1).\n float energy = 1.0;\n if (energyGrade > 0.001) {\n float luma = clamp(dot(sampleBase(center, t), W_LUMA), 0.0, 1.0);\n float graded = mix(0.5, 1.5, luma) * mix(0.6, 1.0, coh);\n energy = mix(1.0, graded, energyGrade);\n }\n\n float lenV = cellSize * lenMul * (0.65 + 0.55 * hash21(cc + seed + 23.0)) * energy;\n float halfW = cellSize * halfWMul * (0.70 + 0.55 * hash21(cc + seed + 41.0));\n float bulge = (hash21(cc + seed + 53.0) - 0.5) * lenV * 0.35;\n\n vec2 a = center - dir * (lenV * 0.5);\n vec2 b = center + dir * (lenV * 0.5);\n\n vec3 colMid = brokenColorJitter(\n sampleBase(center, t),\n hash21(cc + seed + 89.0),\n hash21(cc * 2.3 + seed + 97.0),\n 1.0\n );\n\n StrokeHit h = curvedStroke(p, a, b, halfW, bulge, shapeType,\n 7.0, bristleAmp,\n hash21(cc + seed + 67.0), colMid);\n if (h.coverage > best.coverage) best = h;\n }\n }\n return best;\n}\n", ve = "// ── Medium overlays ───────────────────────────────────────────────────────\n\n// A quick re-computation of base color for edge-mask sampling\nvec3 sampleBase(vec2 p, float t) {\n vec2 pw = domainWarp(p, t);\n float id; float vm;\n nucleiField(pw, t, id, vm);\n vec3 c = samplePalette(id);\n c *= 1.0 + uValueVariance * vm;\n return c;\n}\n\n// ── Structure-tensor / edge-tangent-flow (AW.W4.1) ─────────────────────────\n// The keystone of the painterly engine: derive stroke orientation from the COLOR\n// FIELD's OWN structure, not a hand-authored flow pattern. A 3x3 Sobel over\n// luma(sampleBase) yields the gradient (Gx,Gy); the 2x2 structure tensor\n// J = [[Gx², GxGy],[GxGy, Gy²]] eigen-decomposes closed-form into the MINOR\n// eigenvector (the edge-TANGENT — least color change, the stroke direction; the\n// MAJOR eigenvector is the gradient/edge-NORMAL and would make strokes cross the\n// bands) and the coherence A = (λ1-λ2)/(λ1+λ2). Low-coherence (flat) zones relax\n// toward the smooth fallbackDir by (1-A) so tensor noise never reads as jitter.\n// Single-pass small-tap WebGL2 form; the Gaussian-smoothed multi-tap + LIC smear\n// is the AW.W7 WebGPU multi-pass fold. Returns vec3(tangent.x, tangent.y, A).\nvec3 structureTensorField(vec2 p, float t, vec2 fallbackDir) {\n float e = 0.0035; // small-tap neighborhood (edge-mask scale)\n // 3x3 luma samples.\n float l00 = dot(sampleBase(p + vec2(-e, -e), t), W_LUMA);\n float l10 = dot(sampleBase(p + vec2( 0.0, -e), t), W_LUMA);\n float l20 = dot(sampleBase(p + vec2( e, -e), t), W_LUMA);\n float l01 = dot(sampleBase(p + vec2(-e, 0.0), t), W_LUMA);\n float l21 = dot(sampleBase(p + vec2( e, 0.0), t), W_LUMA);\n float l02 = dot(sampleBase(p + vec2(-e, e), t), W_LUMA);\n float l12 = dot(sampleBase(p + vec2( 0.0, e), t), W_LUMA);\n float l22 = dot(sampleBase(p + vec2( e, e), t), W_LUMA);\n // Sobel derivatives.\n float Gx = (l20 + 2.0 * l21 + l22) - (l00 + 2.0 * l01 + l02);\n float Gy = (l02 + 2.0 * l12 + l22) - (l00 + 2.0 * l10 + l20);\n // Structure tensor components.\n float Jxx = Gx * Gx;\n float Jyy = Gy * Gy;\n float Jxy = Gx * Gy;\n // Closed-form 2x2 eigenvalues: λ = 0.5(tr ± sqrt((Jxx-Jyy)² + 4Jxy²)).\n float tr = Jxx + Jyy;\n float disc = sqrt(max((Jxx - Jyy) * (Jxx - Jyy) + 4.0 * Jxy * Jxy, 0.0));\n float lambdaMaj = 0.5 * (tr + disc);\n float lambdaMin = 0.5 * (tr - disc);\n // The MAJOR eigenvector points along the gradient (the edge NORMAL); the MINOR\n // is its perpendicular — the edge TANGENT (the stroke direction). The principal\n // angle is θ = 0.5·atan2(2·Jxy, Jxx-Jyy); this form is robust at Jxy≈0 (where the\n // (λ-Jyy, Jxy) eigenvector formula collapses to a zero vector). The tangent is at\n // θ + 90°. Guard the fully-isotropic (no-gradient) degenerate case → fallback dir.\n vec2 tangent;\n if (disc < 1e-7) {\n tangent = fallbackDir;\n } else {\n float theta = 0.5 * atan(2.0 * Jxy, Jxx - Jyy); // major (gradient) angle\n tangent = vec2(-sin(theta), cos(theta)); // perpendicular = tangent\n }\n // Coherence A in [0,1] — high where one eigenvalue dominates (a strong edge),\n // ~0 in flat zones. Relax toward the smooth fallback by (1 - A).\n float A = (lambdaMaj - lambdaMin) / (lambdaMaj + lambdaMin + 1e-6);\n A = clamp(A, 0.0, 1.0);\n // Coherence-weighted blend: full tensor in coherent zones, smooth in flat ones.\n // Resolve the 180° sign ambiguity toward the fallback so the blend is continuous.\n if (dot(tangent, fallbackDir) < 0.0) tangent = -tangent;\n vec2 dir = normalize(mix(fallbackDir, tangent, A) + 1e-6);\n return vec3(dir, A);\n}\n\nvec3 mediumWatercolor(vec3 col, vec2 p, float t) {\n // Wet-edge cauliflowers via luma-gradient magnitude\n float eps = 0.004;\n vec3 cx1 = sampleBase(p + vec2(eps, 0.0), t);\n vec3 cx2 = sampleBase(p - vec2(eps, 0.0), t);\n vec3 cy1 = sampleBase(p + vec2(0.0, eps), t);\n vec3 cy2 = sampleBase(p - vec2(0.0, eps), t);\n float gx = dot(cx1 - cx2, W_LUMA);\n float gy = dot(cy1 - cy2, W_LUMA);\n float edge = sqrt(gx * gx + gy * gy) / (2.0 * eps);\n float mask = smoothstep(0.0, 2.5, edge);\n col *= mix(1.0, 0.78, mask * uWetEdge);\n\n // Granulation — pigment settles in paper tooth\n float paper = 0.5 * vnoise(p * 160.0) + 0.5 * vnoise(p * 360.0);\n float pigLoad = 1.0 - dot(col, W_LUMA);\n col *= 1.0 - uGranulation * pigLoad * (paper - 0.5);\n\n // Wash banding — faint horizontal wet gradient\n float band = fbm(vec2(p.x * 1.5, p.y * 0.4));\n col *= 1.0 + 0.04 * (band - 0.5);\n return col;\n}\n\nvec3 mediumPastel(vec3 col, vec2 p, float t) {\n vec2 flow = flowField(p, t);\n vec2 perp = vec2(-flow.y, flow.x);\n float along = dot(p, flow) * uStrokeScale;\n float across = dot(p, perp) * uStrokeScale;\n across += 0.03 * (vnoise(p * 260.0) - 0.5);\n\n float aniso = mix(1.0, 0.18, uStrokeAnisotropy);\n float stroke = fbm(vec2(along * aniso, across));\n col *= mix(1.0, 0.82 + 0.32 * stroke, uStrokeAmount);\n\n // Pastel tooth — tiny high-frequency grain\n float tooth = vnoise(p * 800.0);\n col *= 1.0 - 0.08 * uStrokeAmount * (tooth - 0.5);\n return col;\n}\n", ye = "// ── Medium id constants (mirror uniformBridge.ts MEDIUM_ID — the uMedium ladder) ──\n// The StrokeProfile selector (AX.W12 + AX.W13) dispatches on the medium id: oil,\n// van-Gogh, and oil-pastel each AUTHOR a first-class profile in profileFor.\n#define MEDIUM_OIL 3\n#define MEDIUM_CRAYON 4\n#define MEDIUM_VANGOGH 5\n#define MEDIUM_OILPASTEL 6\n\n// ── Crayon — DRY wax pigment on paper tooth (first-class medium, uMedium==4) ──\n// Crayon is not strokes. It's dry pigment crumbs dragged across paper tooth — the\n// DRY tooth-multiply model: anisotropic tooth noise multiplied into the base, a hard\n// SCUMBLE that lets the lower color show through the broken upper layer, and stable\n// OKLCh broken-color pigment patches. NO sheen, NO burnish film — that waxy gloss is\n// the OIL-PASTEL deposition's signature (mediumOilPastel), distinct from dry crayon\n// (AX.W13 slice 8 F1 — the split). Crayon shares the SUBSTRATE (the structure-tensor\n// orientation, the tooth noise, OKLCh brokenColorJitter), not the dispatch body.\nvec3 mediumCrayon(vec3 col, vec2 p, float t) {\n // Orient the deposition along the structure-tensor edge-tangent (the bridge forces\n // tensor for crayon, so read the tensor field directly).\n vec2 flow = structureTensorField(p, t, flowField(p, t)).xy;\n float ang = atan(flow.y, flow.x);\n float ca = cos(-ang), sa = sin(-ang);\n vec2 pr = vec2(p.x * ca - p.y * sa, p.x * sa + p.y * ca);\n\n float aniso = mix(0.45, 0.95, uStrokeAnisotropy);\n float scale = max(uStrokeScale * 1.6, 180.0);\n\n // ── Paper TOOTH height field — the relief the dry pigment rides. Anisotropic\n // (squished along flow, coarse cross-flow). Peaks = ridges, valleys = paper pits.\n float t1 = vnoise(vec2(pr.x * scale * aniso, pr.y * scale));\n float t2 = vnoise(vec2(pr.x * scale * aniso * 0.4, pr.y * scale * 0.4) + 11.0);\n float t3 = vnoise(vec2(pr.x * scale * aniso * 2.1, pr.y * scale * 2.1) + 23.0);\n float tooth = 0.55 * t1 + 0.30 * t2 + 0.15 * t3;\n\n // ── DRY TOOTH-MULTIPLY — the crayon multiplies the tooth relief into the base\n // color (dark in the pits, bright on the ridges). The pressure (uStrokeAmount) sets\n // how hard the multiply bites. This is the DRY model — no pigment build-up, no sheen.\n float pressure = clamp(uStrokeAmount, 0.0, 1.0);\n float bite = mix(0.18, 0.46, pressure); // multiply strength\n vec3 result = col * (1.0 - bite * (0.5 - tooth));\n\n // ── HARD SCUMBLE — a broken upper layer that lets the lower color show through the\n // gaps. A coarse mask gates a HARD (high-contrast) dragged pass so the dry crayon\n // reads as broken pigment crumbs, not a smooth wash. Drag follows the tensor flow.\n float scumbleMask = smoothstep(0.42, 0.78, vnoise(vec2(pr.x * scale * 0.55, pr.y * scale * 0.22) + 7.0));\n float scumbleCoverage = scumbleMask * pressure * 0.7; // hard broken upper layer\n vec3 paper = col * mix(0.80, 0.94, pressure); // the paper showing through\n result = mix(paper, result, scumbleCoverage);\n\n // ── Broken-color pigment: stable wax/pigment patches in OKLCh (W5), not flicker.\n vec2 pigmentCell = floor(pr * max(scale * 0.18, 32.0));\n float pigmentMask = smoothstep(0.28, 0.82, vnoise(pr * scale * 0.21 + 19.0));\n result = brokenColorJitter(\n result,\n hash21(pigmentCell + 17.0),\n hash21(pigmentCell * 2.1 + 31.0),\n 0.45 + 0.55 * pigmentMask\n );\n\n // Crayon is saturation-amplified (the wax chroma punch — but DRY, no sheen).\n result = saturate3(result, 1.08);\n\n return result;\n}\n\n// ── StrokeProfile — the oil-stroke parameter vector (AX.W12, slice 8 F6) ──────\n// The SBR \"stroke = parameter vector\" canon (facet 11): the per-mode if-ladder knobs\n// become struct FIELDS — logic-as-DATA, not an imperative branch. profileFor(medium,\n// mode) populates the profile for a (medium, mode) pair; paintStrokeLayers(profile) runs\n// the four-layer bestOil/paintOver cascade off it. A new medium (the W13 van-Gogh /\n// oil-pastel profiles) AUTHORS a profile entry — it never edits a monolith.\nstruct StrokeProfile {\n int shapeType; // 0 tapered, 1 load-drag, 2 dab, 3 even, 4 comma/crescent\n float bristleAmp; // edge raggedness 0..0.5\n float streakFreq; // internal-streak spatial frequency\n float streakAmp; // internal-streak amplitude\n float impastoAmp; // paint-thickness contribution (the relight reads the height)\n float hardness; // edge-compositing crispness 0..1\n float toothScale; // canvas-tooth (linen weave) spatial frequency\n float toothAmp; // canvas-tooth amplitude\n float pigmentSat; // pigment saturation boost (OKLCh chroma scale)\n float densityBig; // layer-1 (big gestural) placement density gate\n float densityMed; // layer-2 (medium body) placement density gate\n float densitySml; // layer-3 (small dabs) placement density gate\n float energyGrade; // AX.W13 — SBR energy-grade magnitude (0 off; 1 the van-Gogh\n // Starry-Night length cascade). The energy grade is a PROFILE\n // field, NOT a buried uMedium==5 bestOil branch (slice 8 F0).\n float impastoFloor;// AX.W13 — the per-stroke height-crown floor (0.4 oil falloff;\n // 1.0 van-Gogh FULL-height crown so each dab catches its glint).\n float densityFill; // AX.W13 — layer-4 fill-dab density. Oil/oil-pastel fill the\n // bald spots (0.95, full coverage); van-Gogh sets it LOW so the\n // sparse atomic dabs keep their visible inter-stroke ground gaps\n // (the atomicity read — a 0.95 fill would close every gap to a smear).\n float groundFloor; // AX.W13 — the bare-ground darken floor. The gaps between strokes\n // (low accumulated height) multiply toward this floor, so van-Gogh's\n // sparse atomic dabs read over a visibly darker underpainting (the\n // Starry-Night visible ground). Oil/oil-pastel keep 1.0 (no darken).\n};\n\n// The (medium, mode) -> StrokeProfile selector. The if-ladder's knobs are the profile's\n// fields; a new medium adds a CASE here (never an edit to a dispatch body). mode is the\n// uStrokeMode oil-stroke sub-mode (0 oil, 1 palette-knife, 3 brushwork). crayon\n// (uMedium==4) is a PEER tooth-multiply medium that never reaches the stroke cascade.\n// The painterly STROKE mediums are oil (MEDIUM_OIL), van-Gogh (MEDIUM_VANGOGH) and\n// oil-pastel (MEDIUM_OILPASTEL) — each AUTHORS its own profile entry below.\nStrokeProfile profileFor(int medium, int mode) {\n // The oil baseline (mode 0) — balanced modern-abstract/palette-knife hybrid.\n StrokeProfile prof = StrokeProfile(\n 0, // shapeType — tapered\n 0.25, // bristleAmp\n 9.0, // streakFreq\n 0.09, // streakAmp\n 0.9, // impastoAmp\n 0.80, // hardness\n 240.0, // toothScale\n 0.09, // toothAmp\n 1.03, // pigmentSat\n 0.65, // densityBig\n 0.78, // densityMed\n 0.90, // densitySml\n 0.0, // energyGrade — oil is uniform-length (no Starry-Night cascade)\n 0.4, // impastoFloor — oil's 0.4+0.6·edgeN crown falloff\n 0.95, // densityFill — oil fills the bald spots (full coverage, no bare canvas)\n 1.0 // groundFloor — oil keeps the full base (no ground darken; fills everywhere)\n );\n\n // ── Van-Gogh — first-class atomic comma/crescent dabs (slice 8 F0). NOT a length\n // modulation of oil: sparse high-contrast SEPARABLE marks with their own asymmetric\n // shape, the full Starry-Night energy cascade (energyGrade=1), and full-height\n // impasto crowns so each dab catches its own glint. The mode sub-modes don't apply\n // (van-Gogh has its own grammar), so this returns early.\n if (medium == MEDIUM_VANGOGH) {\n prof.shapeType = 4; // comma / crescent — the divisionist atomic dab\n prof.bristleAmp = 0.22; // a touch of raggedness on the loaded head\n prof.streakFreq = 16.0; // tight within-stroke streaks (the loaded comma)\n prof.streakAmp = 0.16;\n prof.impastoAmp = 1.5; // heavy paint per atomic dab\n prof.hardness = 0.92; // crisp separable edges (visible inter-stroke gaps)\n prof.toothScale = 220.0;\n prof.toothAmp = 0.06;\n prof.pigmentSat = 1.12; // the van-Gogh chroma punch\n // SPARSE placement — visible inter-stroke canvas gaps (the atomicity read). Lower\n // density gates than oil so each mark stays separable, not a coverage smear.\n prof.densityBig = 0.42;\n prof.densityMed = 0.52;\n prof.densitySml = 0.60;\n prof.energyGrade = 1.0; // the full Starry-Night length cascade (the profile field)\n prof.impastoFloor = 1.0; // FULL-height crowns — every atomic dab catches its glint\n prof.densityFill = 0.09; // SPARSE fill — the bald-spot layer stays mostly open so\n // the atomic dabs read as separable marks over a bare\n // ground, not a fill-closed coverage smear (the gap read).\n prof.groundFloor = 0.38; // darken the bare-ground gaps to the visible Starry-Night\n // underpainting so the bright impasto dabs read separable.\n return prof;\n }\n\n // ── Oil-pastel — broad smeared directional strokes deposited via the brush engine\n // (slice 8 F1). Creamy soft edges (low hardness), heavy build-up, and a chroma punch.\n // Distinct from the dry-crayon tooth-multiply (mediumCrayon): oil-pastel LAYS strokes.\n if (medium == MEDIUM_OILPASTEL) {\n prof.shapeType = 2; // dab / blob — broad short smeared marks\n prof.bristleAmp = 0.10; // smooth creamy edges (waxy pastel, not bristle)\n prof.streakFreq = 6.0; // soft low-frequency internal smear\n prof.streakAmp = 0.07;\n prof.impastoAmp = 0.7; // build-up, but flatter than oil impasto\n prof.hardness = 0.42; // CREAMY — soft compositing, strokes blend on overlap\n prof.toothScale = 280.0;\n prof.toothAmp = 0.12; // the pastel tooth reads stronger\n prof.pigmentSat = 1.16; // the waxy chroma punch\n prof.densityBig = 0.80; // dense — broad coverage, pigment-on-pigment build-up\n prof.densityMed = 0.90;\n prof.densitySml = 0.95;\n prof.energyGrade = 0.0; // uniform (no Starry-Night grade)\n prof.impastoFloor = 0.55; // a softer crown than van-Gogh's full-height glint\n return prof;\n }\n\n // ── Oil sub-modes (mode dispatch on the oil medium).\n if (mode == 1) { // palette knife — razor edges, heavy impasto\n prof.shapeType = 3; // flat, even\n prof.bristleAmp = 0.12;\n prof.streakFreq = 4.0; prof.streakAmp = 0.05;\n prof.impastoAmp = 1.6;\n prof.hardness = 0.95;\n prof.toothAmp = 0.04;\n prof.densityBig = 0.80; prof.densityMed = 0.88; prof.densitySml = 0.70;\n } else if (mode == 3) { // thick brushwork — heavy bristle brush\n prof.shapeType = 0; // tapered\n prof.bristleAmp = 0.32;\n prof.streakFreq = 14.0; prof.streakAmp = 0.14;\n prof.impastoAmp = 1.2;\n prof.hardness = 0.85;\n prof.toothAmp = 0.07;\n }\n return prof;\n}\n\n// The single parameterized four-layer stroke cascade (AX.W12). The four hand-unrolled\n// bestOil/paintOver invocations collapse into ONE body driven by the profile + the\n// uniform-derived per-layer scale/anisotropy multipliers (which are mode-INVARIANT — the\n// per-layer offsets, seeds, and len/wid muls are fixed across modes, so they stay here as\n// the cascade's structure; only the profile's knobs differentiate the medium). The\n// mode passes through for the two mode-special-cased shapes (knife layer-3 dabs +\n// layer-4 fill shape), which are placement details of the cascade, not profile knobs.\nvoid paintStrokeLayers(inout vec3 col, inout float height, StrokeProfile prof,\n int mode, vec2 p, float t) {\n // Scales & multipliers from uniforms (mode-invariant cascade structure).\n float baseScale = max(uStrokeScale * 0.006, 0.008);\n // Three primary layers: big gestural, medium body, small dabs.\n float sBig = baseScale * 2.4;\n float sMed = baseScale * 1.1;\n float sSml = baseScale * 0.45;\n\n float lenMulBig = mix(2.2, 3.8, uStrokeAnisotropy);\n float widMulBig = mix(0.55, 0.32, uStrokeAnisotropy);\n float lenMulMed = mix(2.0, 3.4, uStrokeAnisotropy);\n float widMulMed = mix(0.50, 0.30, uStrokeAnisotropy);\n float lenMulSml = mix(1.6, 2.6, uStrokeAnisotropy);\n float widMulSml = mix(0.45, 0.32, uStrokeAnisotropy);\n\n float jitterAmt = 0.75; // large jitter — no grid\n vec2 flow = flowField(p, t);\n\n // Layer 1 — big gestural strokes (sparse, shaping)\n StrokeHit hBig = bestOil(p, sBig, lenMulBig, widMulBig, jitterAmt * 0.55,\n prof.densityBig, prof.shapeType, prof.bristleAmp, flow, t, 1.3,\n prof.energyGrade);\n paintOver(col, height, hBig, prof.streakFreq * 0.7, prof.streakAmp,\n uImpasto * prof.impastoAmp * uStrokeAmount, prof.hardness, 1.3, prof.impastoFloor);\n\n // Layer 2 — medium body strokes\n StrokeHit hMed = bestOil(p + vec2(11.3, 3.7), sMed, lenMulMed, widMulMed,\n jitterAmt, prof.densityMed, prof.shapeType, prof.bristleAmp, flow, t, 2.7,\n prof.energyGrade);\n paintOver(col, height, hMed, prof.streakFreq, prof.streakAmp,\n uImpasto * prof.impastoAmp * uStrokeAmount, prof.hardness, 2.7, prof.impastoFloor);\n\n // Layer 3 — small dabs (more frequent, smaller)\n int smlShape = (mode == 1) ? 2 : prof.shapeType; // knife uses dabs for sparkle\n StrokeHit hSml = bestOil(p + vec2(-5.1, 8.4), sSml, lenMulSml, widMulSml,\n jitterAmt * 1.3, prof.densitySml, smlShape,\n prof.bristleAmp * 0.85, flow, t, 4.1, prof.energyGrade);\n paintOver(col, height, hSml, prof.streakFreq * 1.4, prof.streakAmp * 0.8,\n uImpasto * prof.impastoAmp * 0.65 * uStrokeAmount, prof.hardness, 4.1, prof.impastoFloor);\n\n // Layer 4 — fill dabs (very dense, very small) — covers bald spots. The density is\n // PROFILE-driven (prof.densityFill): oil/oil-pastel fill to full coverage; van-Gogh\n // keeps it sparse so the bare-ground gaps between its atomic dabs survive.\n float sFill = baseScale * 0.22;\n float lenMulFill = mix(1.4, 2.0, uStrokeAnisotropy);\n float widMulFill = mix(0.50, 0.38, uStrokeAnisotropy);\n int fillShape = (mode == 1) ? 3 : 2; // knife=even, others=dab (round fills)\n StrokeHit hFill = bestOil(p + vec2(3.9, -6.2), sFill, lenMulFill, widMulFill,\n jitterAmt * 1.5, prof.densityFill, fillShape,\n prof.bristleAmp * 0.6, flow, t, 8.9, prof.energyGrade);\n paintOver(col, height, hFill, prof.streakFreq * 1.8, prof.streakAmp * 0.6,\n uImpasto * prof.impastoAmp * 0.4 * uStrokeAmount, prof.hardness * 0.9, 8.9, prof.impastoFloor);\n\n // Optional crosshatch layer\n if (uStrokeLayers == 2) {\n vec2 flow2 = vec2(-flow.y, flow.x);\n StrokeHit hX = bestOil(p + vec2(7.3, -2.1), sMed, lenMulMed * 0.9, widMulMed,\n jitterAmt, prof.densityMed * 0.7, prof.shapeType, prof.bristleAmp, flow2, t, 6.5,\n prof.energyGrade);\n paintOver(col, height, hX, prof.streakFreq, prof.streakAmp * 0.85,\n uImpasto * prof.impastoAmp * 0.55 * uStrokeAmount, prof.hardness, 6.5, prof.impastoFloor);\n }\n}\n\n// The shared stroke-medium SUBSTRATE finish (AX.W12 + AX.W13): paint the four-layer\n// cascade off the profile, then canvas-tooth + relight + saturation. The three painterly\n// STROKE mediums (oil / van-Gogh / oil-pastel) each AUTHOR their own profile and call\n// this — the substrate is shared, the PROFILE (not a dispatch-body fork) differentiates\n// the medium (slice 8 F6). mode passes through for the cascade's mode-special-cased shapes.\nvec3 paintStrokeMedium(vec3 col, vec2 p, float t, StrokeProfile prof, int mode) {\n vec3 result = col;\n // AW.W4.2 — accumulated paint HEIGHT across the stroke layers. The relight reads\n // its gradient for the normal; the canvas tooth seeds the base relief.\n float height = 0.0;\n paintStrokeLayers(result, height, prof, mode, p, t);\n\n // Canvas tooth — linen weave\n float tooth1 = vnoise(p * prof.toothScale);\n float tooth2 = vnoise(p * prof.toothScale * vec2(0.6, 2.4) + 37.0);\n float tooth = (0.6 * tooth1 + 0.4 * tooth2) - 0.5;\n result *= 1.0 + tooth * prof.toothAmp * uCanvasGrain;\n\n // AW.W4.2 — relight the accumulated paint height with the movable uLightDir\n // source (diffuse + Blinn specular, in LINEAR before aces()). The canvas tooth\n // is the base relief term so the weave also catches the raking light.\n float canvasBase = tooth * prof.toothAmp * 0.5;\n result = relightImpasto(result, height, canvasBase);\n\n // AX.W13 — the visible ground. The bare-ground gaps (low accumulated stroke height)\n // multiply toward prof.groundFloor, so van-Gogh's sparse atomic dabs read as separable\n // marks over a darker underpainting (oil/oil-pastel keep groundFloor=1.0 → no-op). The\n // smoothstep keeps the impasto dabs (high height) at full value; only the open ground\n // between them darkens.\n result *= mix(prof.groundFloor, 1.0, smoothstep(0.0, 0.38, height));\n\n // Pigment saturation boost\n result = saturate3(result, prof.pigmentSat);\n\n return result;\n}\n\nvec3 mediumOil(vec3 col, vec2 p, float t) {\n // The oil medium is a thin body: fetch the oil profile (mode-dispatched), paint via\n // the shared stroke substrate. uStrokeMode: 0 oil (gestural), 1 knife, 3 brushwork.\n int mode = uStrokeMode;\n StrokeProfile prof = profileFor(MEDIUM_OIL, mode);\n return paintStrokeMedium(col, p, t, prof, mode);\n}\n\n// AX.W13 — the van-Gogh atomic-stroke medium is now a FIRST-CLASS body, NOT a\n// mediumOil passthrough (slice 8 F0). It composes its OWN vangogh StrokeProfile (the\n// comma/crescent shapeType, sparse high-contrast atomic placement with visible\n// inter-stroke gaps, the full Starry-Night energy-grade cascade as a PROFILE field,\n// and full-height impasto crowns) through the shared stroke substrate. The bridge forces\n// the ETF (tensor) orientation so the swirl-rows queue along the color field's tangent;\n// the within-stroke OKLCh broken color (paintOver) + the OKLab stroke OVER-composite\n// give pigment-true atom-level shimmer. No subject matter — the \"source image\" is the\n// generated nuclei field, so dabs trace its iso-bands (the Starry-Night swirl-rows).\nvec3 mediumVangogh(vec3 col, vec2 p, float t) {\n StrokeProfile prof = profileFor(MEDIUM_VANGOGH, 0);\n return paintStrokeMedium(col, p, t, prof, 0);\n}\n\n// AX.W13 — the oil-pastel medium (uMedium==6) is a DISTINCT stroke-deposition body,\n// split out of the dry-crayon tooth-multiply (mediumCrayon) (slice 8 F1). It DEPOSITS\n// broad smeared directional strokes via the same brush engine with a creamy soft\n// hardness, heavy pigment build-up where strokes overlap, and a chroma punch — the\n// stroke-deposition model that gives oil-pastel its depth and less-uniform read.\n// Shares the SUBSTRATE (the stroke cascade + tooth + relight) with oil/van-Gogh, NOT\n// the dispatch body of dry crayon. The bridge forces tensor orientation.\nvec3 mediumOilPastel(vec3 col, vec2 p, float t) {\n StrokeProfile prof = profileFor(MEDIUM_OILPASTEL, 0);\n return paintStrokeMedium(col, p, t, prof, 0);\n}", j = "\n", be = `#version 300 es
|
|
10
|
+
var ce = "#version 300 es\nin vec2 aPos;\nout vec2 vUv;\nvoid main() {\n vUv = aPos * 0.5 + 0.5;\n gl_Position = vec4(aPos, 0.0, 1.0);\n}", le = "// ── Palette LUT (W5 — OKLCh/OKLab interpolation) ──────────────────────────────\n// The endpoints stay CPU-baked to LINEAR sRGB (the Aras precompute pattern); only\n// the BETWEEN-endpoint interpolation runs in perceptual space. AX.W11 — the ramp\n// itself (the smoothstep ease + the OKLab-rectangular-vs-OKLCh-hue-arc dispatch on\n// uHuePath) is the shared samplePaletteRamp from procedural-color.glsl, the SAME\n// source the WebGPU twin splices; samplePalette here only selects the bracketing\n// stop pair + the raw inter-stop t and hands them to the shared ramp.\nvec3 samplePalette(float id) {\n id = clamp(id, 0.0, 1.0);\n float scaled = id * float(uStopCount - 1);\n int i0 = int(floor(scaled));\n int i1 = min(i0 + 1, uStopCount - 1);\n float t = fract(scaled);\n return samplePaletteRamp(uPalette[i0], uPalette[i1], t, uHuePath);\n}\n\n// ── Nuclei field ──────────────────────────────────────────────────────────\nvoid nucleiField(vec2 p, float t, out float paletteId, out float valueMod) {\n float accumBias = 0.0;\n float accumValue = 0.0;\n float accumW = 0.0;\n for (int i = 0; i < MAX_NUCLEI; i++) {\n if (i >= uNucleiCount) break;\n vec2 posI = uNucleiPos[i]\n + uNucleiDriftRadius[i] * vec2(\n cos(t * uNucleiDrift * K_NUCLEI + uNucleiDriftPhase[i]),\n sin(t * uNucleiDrift * K_NUCLEI + uNucleiDriftPhase[i] * 1.13)\n );\n vec2 diff = p - posI;\n // Anisotropic Gaussian: rotate diff into the nucleus's local frame\n // (major axis along uNucleiAngle), then scale the major-axis component by\n // 1/elongation so the squared distance describes an ellipse. Defaults\n // 1.0/0.0 reduce to the isotropic dot(diff, diff).\n float ca = cos(uNucleiAngle[i]);\n float sa = sin(uNucleiAngle[i]);\n vec2 local = vec2( ca * diff.x + sa * diff.y,\n -sa * diff.x + ca * diff.y);\n float along = local.x / max(uNucleiElong[i], 0.01);\n float across = local.y;\n float d2 = along * along + across * across;\n float r = max(uNucleiRadius[i], 0.01);\n float w = exp(-uSoftmaxBeta * d2 / (r * r));\n accumBias += w * uNucleiPaletteBias[i];\n accumValue += w * uNucleiValueBias[i];\n accumW += w;\n }\n paletteId = accumBias / max(accumW, 1e-4);\n valueMod = accumValue / max(accumW, 1e-4);\n\n // Palette drift — slow global paletteId breathe between adjacent stops. The\n // rate rides K_PAL (perceptible ~30–60s hue cycle at the default coefficient);\n // the amplitude lifts the authored coefficient into a 0.03..0.06 paletteId band\n // so the palette visibly travels rather than dithering within one stop.\n float palAmp = clamp(uPaletteDrift * 6.0, 0.0, 0.06);\n paletteId += palAmp * sin(t * uPaletteDrift * K_PAL);\n paletteId = clamp(paletteId, 0.0, 1.0);\n}\n", ue = "// ── Flow field ────────────────────────────────────────────────────────────\n// Structure-tensor prototype (body defined post-sampleBase in the mediums block).\n// Returns vec3(dir.x, dir.y, coherence) — the minor-eigenvector tangent + A.\nvec3 structureTensorField(vec2 p, float t, vec2 fallbackDir);\n\nvec2 flowField(vec2 p, float t) {\n vec2 dir = vec2(1.0, 0.0);\n if (uFlowPattern == 1) {\n // radial\n dir = normalize(p - uFlowFocal + 1e-4);\n } else if (uFlowPattern == 2) {\n // swirl — tangent to radial\n vec2 rad = normalize(p - uFlowFocal + 1e-4);\n dir = vec2(-rad.y, rad.x);\n } else if (uFlowPattern == 3) {\n // diagonal\n float a = radians(uFlowAngle);\n dir = vec2(cos(a), sin(a));\n } else if (uFlowPattern == 4) {\n // multi — curl-noise driven\n float n = fbm(p * 2.0 + t * 0.02);\n float a = n * 6.2831;\n dir = vec2(cos(a), sin(a));\n } else if (uFlowPattern == 5) {\n // tensor / ETF — the color field's OWN edge-tangent flow (AW.W4.1). The\n // diagonal angle seeds the smooth fallback the coherence-weighted blend\n // relaxes toward in low-structure zones. Returns directly (no curl/cursor\n // post-mix — the tensor field already carries the structure orientation;\n // the cursor warp still drives the underlying color field in domainWarp).\n float a = radians(uFlowAngle);\n vec2 fallback = vec2(cos(a), sin(a));\n return structureTensorField(p, t, fallback).xy;\n }\n // curl — perturb by noise. Radial gets much less curl so rays stay clean.\n if (uFlowCurl > 0.0) {\n float n = fbm(p * 3.0) - 0.5;\n float curlAmt = uFlowCurl;\n if (uFlowPattern == 1) curlAmt *= 0.25; // radial: preserve ray clarity\n if (uFlowPattern == 2) curlAmt *= 0.55; // swirl: allow moderate curl\n float a = atan(dir.y, dir.x) + n * 3.14159 * curlAmt;\n dir = vec2(cos(a), sin(a));\n }\n // cursor influence — swirl around the cursor position\n if (uCursorStrength > 0.001) {\n vec2 toCur = uCursor - p;\n float d = length(toCur);\n float r = max(uCursorRadius, 0.01);\n float w = exp(-(d * d) / (r * r * 0.5));\n // swirl tangent\n vec2 tangent = vec2(-toCur.y, toCur.x) / max(d, 1e-4);\n float a0 = atan(dir.y, dir.x);\n float a1 = atan(tangent.y, tangent.x);\n // blend angle\n float da = a1 - a0;\n da = atan(sin(da), cos(da)); // wrap to [-pi, pi]\n float a = a0 + da * w * uCursorStrength;\n dir = vec2(cos(a), sin(a));\n }\n // AW.W8.1 — velocity-reactive swirl-BURST: a fast flick (uCursorBurst, decaying\n // over ~1s) injects a transient flow bias along the pointer velocity, distinct from\n // the steady attraction above (the stateless swirl is SUPERSEDED by this form). The\n // burst is gated by the master tempo scalar on the CPU side (it decays to 0 under\n // PRM/pause), so this term cannot leak motion under reduced-motion.\n if (uCursorBurst > 0.001) {\n vec2 toCur = uCursor - p;\n float d = length(toCur);\n float r = max(uCursorRadius, 0.01);\n float w = exp(-(d * d) / (r * r * 0.7));\n // Bias the flow toward the velocity direction, scaled by the decaying burst.\n vec2 velDir = uCursorVelocity / max(length(uCursorVelocity), 1e-4);\n float a0 = atan(dir.y, dir.x);\n float a1 = atan(velDir.y, velDir.x);\n float da = atan(sin(a1 - a0), cos(a1 - a0));\n float a = a0 + da * w * uCursorBurst * 0.8;\n dir = vec2(cos(a), sin(a));\n }\n return dir;\n}\n", de = "// Khronos PBR-Neutral tonemap (hue + saturation preserving)\nvec3 aces(vec3 color) {\n const float startCompression = 0.8 - 0.04;\n const float desaturation = 0.15;\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return clamp(color, 0.0, 1.0);\n float d = 1.0 - startCompression;\n float newPeak = 1.0 - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n float g = 1.0 - 1.0 / (desaturation * (peak - newPeak) + 1.0);\n return clamp(mix(color, newPeak * vec3(1.0), g), 0.0, 1.0);\n}\n", fe = "// ── Curved swept brushstroke primitive ────────────────────────────────────\n// A stroke is a curved spine from A to B with quadratic bulge K (sideways offset\n// at midpoint). Width varies along length via a shape profile. Edge is ragged\n// (bristle-modulated), ends are rounded blobs, inside has streak modulation.\n//\n// For pixel p, we invert an approximate projection onto the curved spine:\n// 1) project p onto straight AB axis -> along0, cross0\n// 2) at parameter along0, spine offset = 4·K·along0·(1-along0) perpendicular\n// 3) cross = cross0 - spineOffset, refine along one iteration\n// Coverage blends paint atop col based on per-stroke color sampled from the\n// underlying base at spine midpoint — so overlapping strokes from different\n// palette regions meet at hard, ragged demarcations.\n\nstruct StrokeHit {\n float coverage; // 0..1\n vec3 color;\n float alongT; // 0..1 along spine, for internal modulation\n float crossN; // cross distance / current half-width, signed\n float edgeN; // distance to edge in half-widths (0 = at edge, 1 = at spine)\n};\n\nStrokeHit noHit() { return StrokeHit(0.0, vec3(0.0), 0.0, 0.0, 0.0); }\n\nvec2 rotateDir(vec2 dir, float angle) {\n float ca = cos(angle), sa = sin(angle);\n return vec2(dir.x * ca - dir.y * sa, dir.x * sa + dir.y * ca);\n}\n\nvec2 safeDir(vec2 dir) {\n float len = length(dir);\n return len > 1e-4 ? dir / len : vec2(1.0, 0.0);\n}\n\n// Shape profile along the stroke. type:\n// 0 tapered — thin-fat-thin (classic brush)\n// 1 load-drag — fat start, tapers to a point\n// 2 dab — ellipse-like, round center\n// 3 even — near-constant, slight end taper\n// 4 comma — van-Gogh atomic dab: ASYMMETRIC taper, fat near one end and\n// drawn to a fine point at the other (the divisionist crescent\n// mark). The width peak sits off-centre (~0.32) so the two ends\n// taper at DIFFERENT rates — a loaded round head + a dragged tail.\nfloat strokeShape(float t, int type) {\n t = clamp(t, 0.0, 1.0);\n if (type == 1) {\n // loaded at t=0, tapering\n return pow(1.0 - t, 0.55) * smoothstep(0.0, 0.08, t);\n } else if (type == 2) {\n // dab / blob\n float d = t - 0.5;\n return exp(-d * d * 12.0);\n } else if (type == 3) {\n // mostly even, slight end softening\n return smoothstep(0.0, 0.08, t) * smoothstep(1.0, 0.92, t) * 0.95 + 0.05;\n } else if (type == 4) {\n // comma / crescent — width peaks at ~0.32 then drags to a fine tail. The two\n // sides of the peak fall at different exponents (a fat round head, a long thin\n // tail), so the mark reads as a directional van-Gogh comma, not a symmetric oval.\n float peak = 0.32;\n float head = smoothstep(0.0, peak, t); // rounded loaded head\n float tail = pow(clamp((1.0 - t) / (1.0 - peak), 0.0, 1.0), 1.6); // dragged thin tail\n return clamp(min(head, tail) * 1.04, 0.0, 1.0);\n }\n // 0 tapered\n return smoothstep(0.0, 0.22, t) * smoothstep(1.0, 0.78, t);\n}\n\n// A single curved stroke.\n// a, b — endpoints\n// halfW — base half-width (world units)\n// bulge — signed perpendicular midpoint offset, in world units\n// shapeType — 0..3\n// bristleFreq — spatial frequency of edge raggedness\n// bristleAmp — 0..0.5 fraction of halfW chewed away at edge extrema\n// streakSeed — uniqueness seed for internal streaks\n// colAtMid — pre-sampled color at midpoint\nStrokeHit curvedStroke(vec2 p, vec2 a, vec2 b, float halfW,\n float bulge, int shapeType,\n float bristleFreq, float bristleAmp,\n float streakSeed, vec3 colAtMid) {\n vec2 ab = b - a;\n float L = length(ab);\n if (L < 1e-5) return noHit();\n vec2 tang = ab / L;\n vec2 norm = vec2(-tang.y, tang.x);\n\n vec2 rel = p - a;\n float along0 = dot(rel, tang) / L; // straight projection 0..1 along AB\n float cross0 = dot(rel, norm); // signed cross\n\n // Spine sideways offset due to bulge (parabolic)\n float bend = 4.0 * bulge * along0 * (1.0 - along0);\n float cross1 = cross0 - bend;\n\n // One refinement step: as the spine bends, the closest-point along shifts.\n // Spine tangent differs from straight tangent; first-order correction:\n float dBend = 4.0 * bulge * (1.0 - 2.0 * along0); // d(bend)/d(along)\n float along1 = along0 + (cross1 * dBend) / (L * (1.0 + dBend * dBend / (L * L)));\n\n // Bristle-ragged edge: half-width gets chewed by 1D noise along the spine\n float edgeNoise = fbm(vec2(along1 * bristleFreq, streakSeed * 7.3)) - 0.5;\n float edgeNoise2 = fbm(vec2(along1 * bristleFreq * 2.3, streakSeed * 3.1 + 17.0)) - 0.5;\n float edgeMod = 1.0 - bristleAmp * (0.6 + 0.4 * edgeNoise) * (0.5 + edgeNoise2);\n\n // Width profile along the stroke\n float shape = strokeShape(along1, shapeType);\n float halfWNow = halfW * shape * edgeMod;\n\n // Inside-segment coverage\n float cov = 0.0;\n if (along1 >= 0.0 && along1 <= 1.0 && halfWNow > 1e-6) {\n float cn = abs(cross1) / halfWNow;\n // fwidth-derived AA: half-width from the field's screen-space gradient so the\n // edge holds ~1px regardless of zoom/DPR (mirrors metaball.frag.ts:252-255).\n float aaC = max(fwidth(cn), 1e-6);\n cov = 1.0 - smoothstep(1.0 - aaC, 1.0 + aaC, cn);\n }\n\n // End-cap blobs (rounded tips, not perpendicular cuts)\n float capA = 0.0, capB = 0.0;\n {\n vec2 capCenterA = a + norm * (bulge * 0.0); // at a\n vec2 capCenterB = a + tang * L + norm * bend * 0.0 + norm * 0.0; // at b; bend is 0 at endpoints\n capCenterB = b;\n float endShapeA = strokeShape(0.02, shapeType);\n float endShapeB = strokeShape(0.98, shapeType);\n float rA = halfW * endShapeA * (0.9 + 0.2 * fbm(vec2(streakSeed * 13.0)));\n float rB = halfW * endShapeB * (0.9 + 0.2 * fbm(vec2(streakSeed * 19.0 + 5.0)));\n float dA = length(p - capCenterA);\n float dB = length(p - capCenterB);\n // fwidth-derived AA on the clean Euclidean cap distances (mirrors metaball.frag.ts:252-255).\n float aaA = max(fwidth(dA), 1e-6);\n float aaB = max(fwidth(dB), 1e-6);\n capA = 1.0 - smoothstep(rA - aaA, rA + aaA, dA);\n capB = 1.0 - smoothstep(rB - aaB, rB + aaB, dB);\n // Only apply caps if we're BEYOND the segment; otherwise the segment wins.\n capA *= (along1 < 0.05) ? 1.0 : 0.0;\n capB *= (along1 > 0.95) ? 1.0 : 0.0;\n }\n\n float coverage = max(cov, max(capA, capB));\n if (coverage < 0.002) return noHit();\n\n // Edge distance (for impasto later): 0 at edge, 1 at spine\n float edgeDist = halfWNow > 1e-6 ? clamp(1.0 - abs(cross1) / halfWNow, 0.0, 1.0) : 0.0;\n\n return StrokeHit(\n coverage,\n colAtMid,\n clamp(along1, 0.0, 1.0),\n halfWNow > 1e-6 ? cross1 / halfWNow : 0.0,\n edgeDist\n );\n}\n\n// The painterly STROKE mediums (those that deposit via paintStrokeLayers/paintOver):\n// oil (3), van-Gogh (5), oil-pastel (6). For these the stroke OVER-composite runs in\n// OKLab so overlapping complementaries mix through a chromatic path, not the linear-\n// RGB grey mud; the smooth/atmospheric pole never reaches paintOver so it pays nothing.\nbool isPainterlyStroke() {\n return uMedium == 3 || uMedium == 5 || uMedium == 6;\n}\n\n// OKLab OVER-composite: lerp L,a,b of the over-color toward the under-color (the\n// Ottosson matrices spliced from procedural-color.glsl.ts — no new color math). Two\n// complementary-hued strokes overlapping transition through OKLab, where the midpoint\n// holds chroma, instead of the linear mix() that desaturates toward grey (slice 8 F2).\nvec3 paintOverOklab(vec3 under, vec3 over, float alpha) {\n vec3 labU = linOklab(under);\n vec3 labO = linOklab(over);\n return max(oklabToLinearSrgb(mix(labU, labO, alpha)), vec3(0.0));\n}\n\n// Composite stroke over col with internal streaking + ACCUMULATE paint HEIGHT.\n// streakAmp — 0..0.2 how much internal streaks darken/lighten\n// impastoAmp — 0..1 paint-thickness contribution (the height the relight reads)\n// hardness — 0..1 how crisp the compositing transition is (1 = razor, 0 = creamy)\n//\n// AW.W4.2 — the fixed-RGB edge rim (the phantom upper-left light) is RETIRED. Each\n// stroke now deposits PAINT HEIGHT into the height accumulator (coverage x per-stroke\n// thickness, perturbed by the bristle/streak fbm for ridges/grooves); mediumOil\n// derives a normal from the accumulated height gradient (dFdx/dFdy) and relights it\n// once with the movable uLightDir source (relightImpasto), in linear before aces().\n//\n// AX.W13 — the internal streak now perturbs HUE + CHROMA in OKLCh (not value-only),\n// so a single stroke carries a small hue gradient (broken color at the ATOM level —\n// adjacent strokes shimmer like real impasto, not flat stamped swatches; slice 8 F5);\n// and the OVER-composite runs in OKLab on the painterly stroke mediums so overlapping\n// complementaries mix as pigment, not the linear-mix grey (slice 8 F2).\n// impastoFloor — the per-stroke height-crown floor: oil's 0.4+0.6*edgeN reads\n// floor=0.4 (the crown tapers to 40% at the stroke edge); the van-Gogh\n// profile passes floor=1.0 so each atomic dab catches a FULL-height\n// glint (scope item 1d). The crown magnitude is floor + (1-floor)*edgeN.\nvoid paintOver(inout vec3 col, inout float height, StrokeHit s,\n float streakFreq, float streakAmp,\n float impastoAmp, float hardness, float streakSeed,\n float impastoFloor) {\n if (s.coverage < 0.002) return;\n float strokeOpacity = clamp(uStrokeAmount, 0.0, 1.0);\n if (strokeOpacity <= 0.001) return;\n vec3 c = s.color;\n\n // Internal streaks — fbm along spine, modulated by cross position. Gives\n // the loaded-brush look: some bristles carry more pigment than others.\n float streakA = fbm(vec2(s.alongT * streakFreq, s.crossN * 2.7 + streakSeed));\n float streakB = fbm(vec2(s.alongT * streakFreq * 0.6 + streakSeed * 3.7, s.crossN * 4.1));\n float streak = 0.6 * (streakA - 0.5) + 0.4 * (streakB - 0.5);\n\n // ── WITHIN-stroke OKLCh broken color (AX.W13, slice 8 F5). The streak fBm perturbs\n // the stroke's HUE + CHROMA along alongT/crossN, seeded per-stroke, so a single\n // stroke reads a small hue gradient (the atom-level broken-color shimmer). Value is\n // carried by the same streak so the loaded-brush light/dark survives. Gated to the\n // painterly stroke mediums + uBrokenColor (the smooth pole keeps the cheap value-only\n // streak). A second decorrelated fBm drives the hue axis so hue ≠ a scaled value.\n float hueStreak = fbm(vec2(s.alongT * streakFreq * 0.45 + streakSeed * 5.3,\n s.crossN * 1.9 + streakSeed * 1.7)) - 0.5;\n if (isPainterlyStroke() && uBrokenColor > 0.001) {\n vec3 lch = oklabToOklch(linOklab(c));\n // ±~10° within-stroke hue swing + ±~9% chroma, scaled by uBrokenColor. Smaller\n // than the per-stroke cell jitter (brokenColorJitter) — this is the intra-stroke\n // gradient layered on top of the per-cell pigment patch.\n lch.z += hueStreak * (20.0 * PI / 180.0) * uBrokenColor;\n lch.y = max(lch.y * (1.0 + (streak) * 0.18 * uBrokenColor), 0.0);\n c = max(oklabToLinearSrgb(oklchToOklab(lch)), vec3(0.0));\n }\n // Value streak (the loaded-brush light/dark across the bristles) — kept for every\n // medium that reaches paintOver (the smooth pole never does). The along-spine value\n // modulation is the loaded-brush light/dark that gives each stroke its OWN directional\n // luminance band — the structure-tensor signal a low-contrast color field (a uniform-hue\n // oil field) has no other source for (the §4.2 anisotropy lift on the flat-palette case).\n c *= 1.0 + streak * streakAmp * 3.2;\n\n // Cross-stroke ridge/valley shading — a catch-light along the spine centre, darkening to\n // the stroke edges. This is the strongest DIRECTIONAL luminance cue: it carves a bright\n // ridge down the stroke's length and dark grooves between adjacent strokes, so a field of\n // parallel strokes reads as parallel light/dark bands (the high-A van-Gogh signature) even\n // where the underlying colour is flat. s.edgeN is 0 at the edge, 1 at the spine.\n float ridgeShade = smoothstep(0.0, 0.55, s.edgeN);\n c *= 1.0 + (ridgeShade - 0.5) * 0.30;\n\n float softLimit = mix(0.35, 0.98, hardness);\n float alpha = smoothstep(0.0, 1.0 - softLimit, s.coverage) * strokeOpacity;\n // OKLab OVER-composite on the painterly stroke mediums (overlap mixes as pigment,\n // not grey); the smooth pole never reaches paintOver, so it keeps the cheap path.\n col = isPainterlyStroke() ? paintOverOklab(col, c, alpha) : mix(col, c, alpha);\n\n // ── Accumulate paint HEIGHT (AW.W4.2). Thickness peaks at the stroke spine and\n // falls toward the impastoFloor at the edge (edgeN: 0=edge, 1=spine), perturbed by\n // the bristle streak so ridges/grooves form. The relight reads the gradient of this\n // field. The van-Gogh profile's floor=1.0 gives every atomic dab a full-height crown.\n float ridge = 0.7 + 0.3 * (streak + 0.5);\n float crown = impastoFloor + (1.0 - impastoFloor) * s.edgeN;\n height += s.coverage * impastoAmp * crown * ridge * alpha;\n}\n\n// AW.W4.2 — relight the accumulated paint height. Derive a normal from the height\n// gradient (dFdx/dFdy — derivatives are in-pattern; fwidth is already used for AA),\n// then apply diffuse + Blinn specular from the movable uLightDir/uLightColor source.\n// LINEAR-space lighting BEFORE aces() (the tonemap/OETF stay locked); thin strokes\n// inherit a low shininess, thick impasto raises it (high-height ridges catch a sharp\n// glint). canvasBase is the tooth height so the canvas weave also catches the light.\nvec3 relightImpasto(vec3 col, float height, float canvasBase) {\n float h = height + canvasBase;\n // Height-gradient normal. heightScale trades relief depth for surface flatness.\n float heightScale = 6.0;\n vec3 N = normalize(vec3(-dFdx(h) * 40.0, -dFdy(h) * 40.0, 1.0 / heightScale));\n vec3 L = normalize(uLightDir);\n vec3 V = vec3(0.0, 0.0, 1.0); // view straight on\n vec3 H = normalize(L + V);\n float diff = max(dot(N, L), 0.0);\n // Thick impasto → high shininess (sharp glint); thin paint → broad soft sheen.\n float shininess = mix(8.0, 64.0, clamp(height * 2.0, 0.0, 1.0));\n float spec = pow(max(dot(N, H), 0.0), shininess);\n // Modulate the lit terms by how much paint sits here (no relief on bare ground).\n float relief = clamp(h * 1.5, 0.0, 1.0);\n vec3 lit = col * (1.0 + uImpasto * relief * (diff - 0.5) * 0.5 * uLightColor);\n // The specular glint is gated to ACCUMULATED-thick paint (height²) — a per-fine-stroke\n // sharp glint on every thin fill dab read as bright isotropic SPECKLE that buried the\n // directional stroke bands (the §4.2 anisotropy / §4.3 slope sink on the low-contrast\n // oil field). Only where real impasto has built up does the raked glint fire, so the\n // highlight tracks the macro ridges, not the fine speckle.\n float specGate = clamp(height, 0.0, 1.0);\n lit += uImpasto * relief * spec * specGate * 0.5 * uLightColor;\n return lit;\n}\n\n// Best-of-9-neighbor placement: sample 3x3 surrounding cells and take the\n// stroke that covers this pixel most. Breaks the grid by per-cell jitter and\n// sparse density via noise thresholding.\n// energyGrade — the SBR energy-grade magnitude (0 = none, the oil/oil-pastel\n// baseline; 1 = the full van-Gogh Starry-Night cascade — long\n// confident strokes in the lights/coherent zones, short dabs in\n// the darks/flat zones). The van-Gogh profile carries 1.0 (the\n// energy grade is a PROFILE field, not a buried uMedium==5 branch).\nStrokeHit bestOil(vec2 p, float cellSize, float lenMul, float halfWMul,\n float jitterAmt, float density, int shapeType,\n float bristleAmp, vec2 flow, float t, float seed,\n float energyGrade) {\n vec2 cell = floor(p / cellSize);\n\n StrokeHit best = noHit();\n // 3x3 neighborhood\n for (int dy = -1; dy <= 1; dy++) {\n for (int dx = -1; dx <= 1; dx++) {\n vec2 cc = cell + vec2(float(dx), float(dy));\n vec2 hh = hash22(cc + seed) - 0.5;\n // Density gate — noise threshold; sparse placement.\n float gate = hash21(cc * 1.7 + seed * 0.3);\n if (gate > density) continue;\n\n vec2 center = (cc + 0.5 + hh * jitterAmt) * cellSize;\n\n // Per-stroke direction source — the AW.W4.1 strokeOrient switch:\n // uStrokeOrient==0 (flow) — the layer-provided hand-authored flowField.\n // uStrokeOrient==1 (tensor) — the structure-tensor minor eigenvector at the\n // cell center (the color field's edge-tangent),\n // so strokes hug the color zones (van Gogh).\n // coh carries the per-cell coherence A for the W4.3 energy grading (long\n // confident strokes where structure is coherent, stubby dabs in flat zones).\n vec2 f;\n float coh = 1.0;\n if (uStrokeOrient == 1) {\n vec3 tf = structureTensorField(center, t, safeDir(flow));\n f = safeDir(tf.xy);\n coh = tf.z;\n } else {\n f = safeDir(flow);\n }\n // Per-stroke deterministic local perturbation so alternate stroke layers stay\n // live. Tensor strokes get FAR less angular jitter (the field already orients them\n // — over-jittering the tensor strokes scatters their directions and the rendered\n // field reads isotropic, the §4.2 anisotropy floor). The flow-oriented (non-tensor)\n // strokes keep the full jitter (they have no per-cell orientation source).\n float jScale = (uStrokeOrient == 1) ? 0.15 : 1.0;\n float angJ = (hash21(cc + seed + 11.0) - 0.5) * 0.9 * jScale; // +/- 0.45/0.07 rad\n float curlScale = (uStrokeOrient == 1) ? 0.30 : 1.0;\n float localCurl = (fbm(center * (2.6 + seed * 0.11) + seed * 1.9) - 0.5) * 0.55 * uFlowCurl * curlScale;\n vec2 dir = rotateDir(f, angJ + localCurl);\n\n // AX.W13 — the SBR energy grade is a PROFILE field (energyGrade), not a buried\n // uMedium==5 branch. The van-Gogh profile passes energyGrade=1.0 (the full\n // Starry-Night cascade); oil/oil-pastel pass 0.0 (uniform length). The grade\n // modulates stroke length by local luminance (bright → long confident strokes,\n // dark → short dabs, the Kolmogorov/Batchelor congruence) AND by coherence\n // (coherent zones → long, flat → stubby), lerped in by energyGrade so a profile\n // can dial the cascade from off (0) to full (1).\n float energy = 1.0;\n if (energyGrade > 0.001) {\n float luma = clamp(dot(sampleBase(center, t), W_LUMA), 0.0, 1.0);\n float graded = mix(0.5, 1.5, luma) * mix(0.6, 1.0, coh);\n energy = mix(1.0, graded, energyGrade);\n }\n\n float lenV = cellSize * lenMul * (0.65 + 0.55 * hash21(cc + seed + 23.0)) * energy;\n float halfW = cellSize * halfWMul * (0.70 + 0.55 * hash21(cc + seed + 41.0));\n float bulge = (hash21(cc + seed + 53.0) - 0.5) * lenV * 0.35;\n\n vec2 a = center - dir * (lenV * 0.5);\n vec2 b = center + dir * (lenV * 0.5);\n\n vec3 colMid = brokenColorJitter(\n sampleBase(center, t),\n hash21(cc + seed + 89.0),\n hash21(cc * 2.3 + seed + 97.0),\n 1.0\n );\n\n StrokeHit h = curvedStroke(p, a, b, halfW, bulge, shapeType,\n 7.0, bristleAmp,\n hash21(cc + seed + 67.0), colMid);\n if (h.coverage > best.coverage) best = h;\n }\n }\n return best;\n}\n", pe = "// ── Van-Gogh — DEDICATED atomic-dab body (W-AUR-VANGOGH-REBUILD) ─────────────\n// REBUILT FROM FIRST PRINCIPLES. The prior path routed van-Gogh through the shared\n// oil paintStrokeMedium cascade — four DENSE layers of LONG-THIN tensor-oriented\n// strokes (lenMul up to 5.2, widMul 0.22) hugging a continuous coherent field. Packed\n// that tight, thin strokes that follow continuous iso-bands MERGE into smooth flowing\n// filaments — the \"marbled flow-bands\" read (a spirograph/fingerprint, not impasto),\n// AND the per-cell 8-tap structure tensor × 4 layers × 9 cells = ~324 sampleBase/pixel\n// made it run at ~4fps. Van Gogh's sky is NOT continuous flow — it is DISCRETE, SHORT,\n// LOADED comma dabs, separated by visible ground, queued into swirl ROWS.\n//\n// The rebuild is a purpose-built two-layer DAB pass, disjoint from the oil cascade:\n// • orientation from the analytic SWIRL flowField (van-Gogh skies ARE swirl rows) +\n// per-cell angular jitter — NOT the expensive per-cell tensor (the lag source, and\n// the marble source: a jittered discrete dab can NOT merge into a continuous\n// filament the way a tensor-locked thin stroke does).\n// • SHORT comma dabs (len/wid ≈ 2.6 : 1 — a loaded crescent mark, not a 10:1\n// filament), so each reads as a SEPARABLE atom.\n// • SPARSE placement with visible inter-dab ground (density ≈ 0.42), over a darkened\n// swirl underpainting (the Starry-Night visible ground the bright dabs read over).\n// • a single sampleBase per cell + OKLCh broken-color jitter (pigment shimmer);\n// full-height impasto crown per dab (each catches its own raked glint).\n// This is ~2 layers × 9 cells × ~1 sampleBase ≈ 20/pixel (a ~16× cost cut, ~60fps), and\n// jittered short dabs CANNOT marble.\n\n// One atomic comma dab — a CLEAN analytic crescent SDF (NOT the oil curvedStroke).\n// The oil curvedStroke's spine-projection + rounded end-caps + fwidth-AA + bristle\n// edge each leave a thin sub-pixel skirt, and a field of those skirts over open ground\n// abuts into a faint network of SEAM LINES. A van-Gogh dab needs none of that\n// machinery — it is a short oriented capsule (rounded line segment) whose half-width\n// tapers along its length (the loaded-head → dragged-tail comma). The capsule SDF is\n// derivative-free (smoothstep AA against the analytic distance), so no fwidth skirt, no\n// best-of-9 seam. Returns a StrokeHit (coverage/color/alongT/edgeN) for paintOver.\n// cellSize — dab cell pitch (UV units); lenMul/widMul — dab aspect off the cell;\n// density — placement gate (sparse → visible gaps); seed — layer decorrelation.\nStrokeHit vangoghDab(vec2 p, float cellSize, float lenMul, float widMul,\n float density, float jitterAmt, float angJitter,\n vec2 flow, float t, float seed) {\n vec2 cell = floor(p / cellSize);\n StrokeHit best = noHit();\n for (int dy = -1; dy <= 1; dy++) {\n for (int dx = -1; dx <= 1; dx++) {\n vec2 cc = cell + vec2(float(dx), float(dy));\n // Sparse density gate — leaves visible canvas ground between dabs (atomicity).\n if (hash21(cc * 1.7 + seed * 0.3) > density) continue;\n vec2 jit = (hash22(cc + seed) - 0.5) * jitterAmt;\n vec2 center = (cc + 0.5 + jit) * cellSize;\n\n // Orientation: the analytic swirl flow at the cell center + per-cell angular\n // jitter (so adjacent dabs FAN — the divisionist scatter that keeps the dabs from\n // locking into perfectly-concentric rows) + a flow-noise curl wobble.\n float ang = (hash21(cc + seed + 11.0) - 0.5) * angJitter;\n float curl = (fbm(center * 3.1 + seed * 1.9) - 0.5) * (0.18 + 0.3 * uFlowCurl);\n vec2 dir = rotateDir(safeDir(flow), ang + curl);\n\n // SHORT comma — len ≈ the cell pitch (a contained dab, not a tiling filament).\n float len = cellSize * lenMul * (0.82 + 0.30 * hash21(cc + seed + 23.0));\n float halfW = max(cellSize * widMul * (0.86 + 0.28 * hash21(cc + seed + 41.0)), 0.010);\n\n // Local dab frame: along = projection onto the dab axis (centred 0), perp = cross.\n vec2 rel = p - center;\n float along = dot(rel, dir);\n float perp = dot(rel, vec2(-dir.y, dir.x));\n // The comma TAPER: half-width peaks ~1/3 from the loaded head and drags to a fine\n // tail (the asymmetric crescent). u in [0,1] along the dab from head to tail.\n float halfLen = len * 0.5;\n float u = clamp((along + halfLen) / max(len, 1e-5), 0.0, 1.0);\n float head = smoothstep(0.0, 0.30, u); // rounded loaded head\n float tail = pow(clamp((1.0 - u) / 0.70, 0.0, 1.0), 1.3); // dragged thin tail\n float prof = clamp(min(head, tail) * 1.05, 0.0, 1.0);\n float wNow = halfW * prof;\n // A gentle comma CURVE — bow the spine sideways so the mark reads as a crescent.\n float bowAmt = (hash21(cc + seed + 53.0) - 0.5) * halfW * 1.4;\n float spine = bowAmt * sin(u * PI); // 0 at ends, max mid\n float d = abs(perp - spine);\n // Derivative-free AA: a fixed fraction of the dab width (no fwidth skirt). Coverage\n // is 1 in the dab body, smoothly 0 at the edge; outside the [head,tail] span wNow→0\n // so the dab self-terminates with no end-cap blob.\n float aa = max(halfW * 0.45, 0.002);\n float cov = (wNow > 1e-5) ? (1.0 - smoothstep(wNow - aa, wNow + aa, d)) : 0.0;\n if (cov < 0.004) continue;\n\n // One sampleBase per cell + OKLCh broken-color jitter (pigment patch shimmer). The\n // dab pigment is chroma-boosted (saturate3 1.22) AND value-lifted (×1.14) at the\n // SOURCE — the loaded brush mark deposits BRIGHTER + more saturated pigment than the\n // base field, so the loaded-mark pixels lift BOTH the §4.1 colourfulness AND the field\n // mean-luma. The higher mean raises the gap-fraction threshold (meanLum·0.6) so the\n // moderate-depth inter-dab ground falls below it (the gap-fraction atomicity read is\n // DECOUPLED from the ground floor depth — the ground can stay only moderately dark, so\n // the §4.3 slope is NOT over-steepened, while the bright dabs manufacture the gap). The\n // dark ground is untouched, so this lifts C + gap WITHOUT a band-conflicting deep ground.\n vec3 colMid = brokenColorJitter(\n saturate3(sampleBase(center, t), 1.22),\n hash21(cc + seed + 89.0),\n hash21(cc * 2.3 + seed + 97.0),\n 1.0\n );\n\n // edgeN: 1 at the spine, 0 at the edge (the impasto crown reads it).\n float edgeN = (wNow > 1e-5) ? clamp(1.0 - d / wNow, 0.0, 1.0) : 0.0;\n if (cov > best.coverage) {\n best = StrokeHit(cov, colMid, u, (wNow > 1e-5 ? (perp - spine) / wNow : 0.0), edgeN);\n }\n }\n }\n return best;\n}\n\nvec3 mediumVangogh(vec3 col, vec2 p, float t) {\n vec3 result = col;\n float height = 0.0;\n\n // The swirl flow basis (van-Gogh sky = swirl rows). Computed ONCE per pixel.\n vec2 flow = flowField(p, t);\n\n // Dab cell pitch in UV [0,1]. CHUNKY, SEPARABLE marks — the big layer is ~1/14 of\n // the frame so it reads as a distinct loaded brush dab (not a fine speckle, not a\n // screen-spanning filament). uStrokeScale (authored ~110) modulates the pitch\n // INVERSELY (higher = finer dabs) around the ~0.07 chunky default; clamped so the\n // dab never collapses to noise or balloons past one screen. uStrokeAnisotropy\n // stretches the comma aspect (longer, more directional marks).\n float pitch = clamp(7.0 / max(uStrokeScale, 20.0), 0.044, 0.12);\n // The dab LENGTH ≈ the cell pitch (lenAniso ~1.2-1.7) so a dab sits WITHIN its cell\n // and leaves visible ground around it — a longer dab (lenMul > 2) spans neighbour\n // cells and tiles the field into continuous coverage (no gaps, the gap-fraction floor\n // miss + the marble). Narrow width keeps it a directional crescent, not a wide shard.\n // lenAniso/widAniso — the comma aspect. The W-AUR-VANGOGH-CONFIG reconcile lengthened\n // the comma (1.25-1.75 → 1.5-2.0) and THINNED it (0.40-0.30 → 0.32-0.24): the rebuilt\n // dabs measured §4.2 structure-tensor anisotropy A=0.699, BELOW the reference band\n // floor 0.732 (the dabs read slightly too short-fat → locally isotropic, dragging mean\n // A down). A LONGER, THINNER comma hugs the swirl-flow tangent more strongly so the\n // rendered field reads coherent the way the tensor metric measures it (A lift), while\n // the thinner width LEAVES MORE inter-dab ground (the gap-fraction atomicity read is\n // preserved, not closed). The length stays ≈ the cell pitch so each dab remains a\n // CONTAINED separable mark, not a tiling filament.\n float lenAniso = mix(2.1, 2.7, uStrokeAnisotropy); // comma length / cell pitch (a contained dab)\n float widAniso = mix(0.23, 0.16, uStrokeAnisotropy); // comma width / cell pitch (a thin loaded crescent)\n\n // Layer 1 — the big swirl-row dabs: the loaded gestural marks, SPARSE so the dark\n // underpainting shows BETWEEN them (the atomicity read — visible inter-dab ground).\n // hardness 0.74 — the loaded brush deposits with a SOFT shoulder, so adjacent dabs\n // feather instead of razor-clipping into hard polygon shards. jitterAmt 0.85 fully\n // scatters the cell centres so the placement GRID never reads as a periodic seam.\n // angJitter EASED 0.55 → 0.38 (the reconcile A lift): a tighter angular spread keeps\n // adjacent dabs more flow-aligned (coherent) while the per-cell curl wobble still\n // breaks the perfectly-concentric-rows read (the dabs FAN gently, not lock to a grid).\n // angJitter eased 0.38 → 0.26 + hardness 0.74 → 0.84 (the §4.2 A lift): a tighter angular\n // spread keeps adjacent dabs strongly flow-aligned (the structure-tensor coherence) and a\n // sharper edge gives each dab a STRONGER directional gradient (a soft dab's faint edge\n // reads weakly anisotropic). The per-cell curl wobble still breaks the perfectly-\n // concentric-rows read, so the dabs FAN gently rather than locking to a grid.\n StrokeHit dBig = vangoghDab(p, pitch, lenAniso, widAniso,\n 0.30, 0.50, 0.08, flow, t, 1.3);\n // streakFreq raised 14 → 34 (the §4.3 slope fix): a high-frequency streak runs ALONG the\n // dab spine, injecting fine-scale luma energy that flattens the too-steep β WITHOUT\n // adding new isotropic marks (the along-spine streak stays directional, so the §4.2\n // anisotropy the long-thin dab carries is preserved — the band-conflict resolution).\n paintOver(result, height, dBig, 48.0, 0.34,\n uImpasto * 0.75 * uStrokeAmount, 0.84, 1.3, 1.0 /* full crown */);\n\n // Layer 2 — two-thirds-pitch accent dabs (the divisionist sparkle between the big\n // marks — denser placement but still contained dabs, so dark canvas survives between).\n // angJitter eased 0.5 → 0.34 (same A-lift reasoning — the accent dabs queue along the\n // flow rather than scattering isotropically); hardness 0.78 → 0.86 sharpens the gradient.\n StrokeHit dSml = vangoghDab(p + vec2(-5.1, 8.4), pitch * 0.62, lenAniso * 0.95,\n widAniso * 0.95, 0.36, 0.60, 0.20, flow, t, 4.1);\n paintOver(result, height, dSml, 42.0, 0.22,\n uImpasto * 0.55 * uStrokeAmount, 0.86, 4.1, 1.0);\n\n // Layer 3 — the FINE divisionist flecks (W-AUR-VANGOGH-CONFIG reconcile). The two-layer\n // field read as a few BIG cobalt dabs over a smooth empty teal ground (the side-by-side\n // against starry-night-crop.png: the painting is DENSE small varied flecks, not sparse\n // large marks). The flecks are LONG·THIN directional commas hugging the swirl tangent\n // (the A-preserving fleck — short fat flecks read isotropic and drag §4.2 down). Sparse\n // density 0.30 keeps the inter-fleck ground open (the gap-fraction atomicity read).\n // The flecks are FINE (≈0.42× pitch) directional commas, tightly flow-aligned (angJitter\n // 0.22) and SPARSE (0.30) — the divisionist sparkle between the loaded marks that keeps\n // the inter-dab ground open (atomicity) while adding the small-mark mid-band energy. Thin\n // + flow-aligned so the §4.2 anisotropy the long dabs carry survives the added small marks.\n StrokeHit dFleck = vangoghDab(p + vec2(8.7, -3.2), pitch * 0.42, lenAniso * 1.0,\n widAniso * 0.68, 0.30, 0.85, 0.22, flow, t, 7.7);\n paintOver(result, height, dFleck, 30.0, 0.16,\n uImpasto * 0.40 * uStrokeAmount, 0.80, 7.7, 1.0);\n\n // ── Flow-aligned GROUND swirl-GROOVING (W-AUR-VANGOGH-CONFIG reconcile) ──\n // The bare ground between the dabs was a SMOOTH low-frequency teal gradient — the §4.3\n // power-spectrum slope ran too STEEP (β≈−2.0: too much low-frequency nuclei-field energy\n // vs the high band). Van Gogh's actual sky has the swirl BRUSHWORK everywhere, so groove\n // the OPEN GROUND with a flow-aligned ripple. It is SUBTRACTIVE-biased (it only darkens,\n // never brightens the ground), so it DEEPENS the inter-dab valleys (MORE gap-fraction —\n // atomicity preserved/strengthened) while injecting the across-flow mid-band luma energy\n // that flattens β. Gated to the open ground (low height) via the (1-height) gate so it\n // never lifts/erodes the loaded dab bodies (the dab read is untouched). Across the swirl\n // FLOW axis so the grooves run WITH the sky's brushwork direction.\n // The ground swirl-combing — a FIXED-global-angle directional grain on the open ground.\n // A flow-FOLLOWING comb varies its direction with the swirl across the readback window,\n // so its blurred structure tensor averages toward isotropic (no §4.2 lift). A comb at one\n // GLOBAL angle (van-Gogh's dominant diagonal stroke grain) is COHERENT over the whole\n // window ⇒ every open-ground pixel reads the SAME direction (the §4.2 mean-anisotropy lift\n // the swirl comb could not reach). Two resolved bands (≈22 + ≈44 across the global axis ⇒\n // ~21px + ~11px at 464px, both in the §4.3 fit window) also feed the β flatten. Gated to\n // the open ground (low height) so the loaded dabs are untouched; SUBTRACTIVE-biased so the\n // inter-dab valleys deepen (gap-fraction preserved, not filled).\n vec2 gdir = normalize(vec2(0.82, 0.57)); // the dominant global stroke grain axis\n float gacross = dot(p, vec2(-gdir.y, gdir.x));\n float groundGate = 1.0 - smoothstep(0.05, 0.28, height);\n float groove = sin(gacross * 22.0) + 0.5 * sin(gacross * 44.0 + 1.3);\n result *= 1.0 - 0.16 * groundGate * (0.5 - 0.5 * groove);\n\n // Canvas tooth (fine linen weave — base relief the raking light catches).\n float tooth1 = vnoise(p * 220.0);\n float tooth2 = vnoise(p * 220.0 * vec2(0.6, 2.4) + 37.0);\n float tooth = (0.6 * tooth1 + 0.4 * tooth2) - 0.5;\n result *= 1.0 + tooth * 0.06 * uCanvasGrain;\n\n // Relight the accumulated impasto height (raking light catches each dab's crown —\n // the visible impasto ridge that makes a dab read as a RAISED loaded mark).\n float canvasBase = tooth * 0.06 * 0.5;\n result = relightImpasto(result, height, canvasBase);\n\n // The visible Starry-Night GROUND — the open canvas between dabs (low accumulated\n // height) darkens toward the deep underpainting, so the bright impasto dabs read as\n // SEPARABLE atomic marks over a darker field (the dab↔ground contrast the user's\n // \"reads as strokes\" bar needs, AND the painterly-statistics gap-fraction floor — the\n // dark inter-dab ground must register as a measurable fraction of the field). 0.30\n // floor over a WIDER smoothstep (0..0.40): deep enough that the open gaps read as the\n // dark Starry-Night sky between marks (clearing the 4% gap floor) while the gradual\n // ramp keeps the gaps reading as flowing underpainting, not the hard black ink LINES a\n // narrow near-black step (0.26 / 0.0..0.32) produced.\n // The smoothstep FLOOR starts at 0.10 (not 0): a dab's faint AA coverage TAIL deposits\n // a sliver of height, and where many tails align along the swirl flow those slivers\n // accumulate into a faint continuous height ridge that read as thin curved LINES in the\n // ground. Holding the ground full-dark until a real dab CORE (height > 0.10) lifts out\n // keeps the open field clean — only the loaded dab bodies emerge, the tails stay ground.\n result *= mix(0.115, 1.0, smoothstep(0.085, 0.31, height));\n\n // The van-Gogh chroma — a light OKLCh punch. EASED to 0.92 (off 1.04) in the\n // W-AUR-VANGOGH-CONFIG reconcile: the rebuilt discrete-dab register's per-dab OKLCh\n // broken-color jitter (the ±16° hue + ±chroma swing per cell) lifts the field's\n // colourfulness on its own, so the prior 1.04 punch on TOP overshot the §4.1\n // reference band (rendered C=100.5 vs the painting's measured 70.67 ± 15/+25 →\n // ceiling 95.67 — neon, not Starry Night's rich-but-not-garish blue/gold). The 0.92\n // demote pulls the rendered colourfulness back IN-band while the broken-color jitter\n // keeps the per-dab pigment variation (the discrete-stroke read is untouched — this\n // is a chroma scale, not a dab-geometry change). Band-anchored on the real painting\n // (proof:aurora-arresting), NOT a widened band.\n result = saturate3(result, 1.0);\n return result;\n}\n\n", me = "// ── Medium overlays ───────────────────────────────────────────────────────\n\n// A quick re-computation of base color for edge-mask sampling\nvec3 sampleBase(vec2 p, float t) {\n vec2 pw = domainWarp(p, t);\n float id; float vm;\n nucleiField(pw, t, id, vm);\n vec3 c = samplePalette(id);\n c *= 1.0 + uValueVariance * vm;\n return c;\n}\n\n// ── Structure-tensor / edge-tangent-flow (AW.W4.1) ─────────────────────────\n// The keystone of the painterly engine: derive stroke orientation from the COLOR\n// FIELD's OWN structure, not a hand-authored flow pattern. A 3x3 Sobel over\n// luma(sampleBase) yields the gradient (Gx,Gy); the 2x2 structure tensor\n// J = [[Gx², GxGy],[GxGy, Gy²]] eigen-decomposes closed-form into the MINOR\n// eigenvector (the edge-TANGENT — least color change, the stroke direction; the\n// MAJOR eigenvector is the gradient/edge-NORMAL and would make strokes cross the\n// bands) and the coherence A = (λ1-λ2)/(λ1+λ2). Low-coherence (flat) zones relax\n// toward the smooth fallbackDir by (1-A) so tensor noise never reads as jitter.\n// Single-pass small-tap WebGL2 form; the Gaussian-smoothed multi-tap + LIC smear\n// is the AW.W7 WebGPU multi-pass fold. Returns vec3(tangent.x, tangent.y, A).\nvec3 structureTensorField(vec2 p, float t, vec2 fallbackDir) {\n float e = 0.0035; // small-tap neighborhood (edge-mask scale)\n // 3x3 luma samples.\n float l00 = dot(sampleBase(p + vec2(-e, -e), t), W_LUMA);\n float l10 = dot(sampleBase(p + vec2( 0.0, -e), t), W_LUMA);\n float l20 = dot(sampleBase(p + vec2( e, -e), t), W_LUMA);\n float l01 = dot(sampleBase(p + vec2(-e, 0.0), t), W_LUMA);\n float l21 = dot(sampleBase(p + vec2( e, 0.0), t), W_LUMA);\n float l02 = dot(sampleBase(p + vec2(-e, e), t), W_LUMA);\n float l12 = dot(sampleBase(p + vec2( 0.0, e), t), W_LUMA);\n float l22 = dot(sampleBase(p + vec2( e, e), t), W_LUMA);\n // Sobel derivatives.\n float Gx = (l20 + 2.0 * l21 + l22) - (l00 + 2.0 * l01 + l02);\n float Gy = (l02 + 2.0 * l12 + l22) - (l00 + 2.0 * l10 + l20);\n // Structure tensor components.\n float Jxx = Gx * Gx;\n float Jyy = Gy * Gy;\n float Jxy = Gx * Gy;\n // Closed-form 2x2 eigenvalues: λ = 0.5(tr ± sqrt((Jxx-Jyy)² + 4Jxy²)).\n float tr = Jxx + Jyy;\n float disc = sqrt(max((Jxx - Jyy) * (Jxx - Jyy) + 4.0 * Jxy * Jxy, 0.0));\n float lambdaMaj = 0.5 * (tr + disc);\n float lambdaMin = 0.5 * (tr - disc);\n // The MAJOR eigenvector points along the gradient (the edge NORMAL); the MINOR\n // is its perpendicular — the edge TANGENT (the stroke direction). The principal\n // angle is θ = 0.5·atan2(2·Jxy, Jxx-Jyy); this form is robust at Jxy≈0 (where the\n // (λ-Jyy, Jxy) eigenvector formula collapses to a zero vector). The tangent is at\n // θ + 90°. Guard the fully-isotropic (no-gradient) degenerate case → fallback dir.\n vec2 tangent;\n if (disc < 1e-7) {\n tangent = fallbackDir;\n } else {\n float theta = 0.5 * atan(2.0 * Jxy, Jxx - Jyy); // major (gradient) angle\n tangent = vec2(-sin(theta), cos(theta)); // perpendicular = tangent\n }\n // Coherence A in [0,1] — high where one eigenvalue dominates (a strong edge),\n // ~0 in flat zones. Relax toward the smooth fallback by (1 - A).\n float A = (lambdaMaj - lambdaMin) / (lambdaMaj + lambdaMin + 1e-6);\n A = clamp(A, 0.0, 1.0);\n // Coherence-weighted blend: full tensor in coherent zones, smooth in flat ones.\n // Resolve the 180° sign ambiguity toward the fallback so the blend is continuous.\n if (dot(tangent, fallbackDir) < 0.0) tangent = -tangent;\n // The blend weight is a low-power curve (A^0.35) so even MODERATE-coherence zones queue\n // strongly along the tangent (a flowing van-Gogh band reads coherent the way the\n // structure-tensor metric measures it; a linear A under-orients the mid-band and the\n // rendered field reads too isotropic — the §4.2 anisotropy lift). The flat-zone (A≈0)\n // relax to the fallback survives (0^0.35=0), so tensor noise never reads as jitter.\n float blendW = pow(A, 0.28);\n vec2 dir = normalize(mix(fallbackDir, tangent, blendW) + 1e-6);\n return vec3(dir, A);\n}\n\nvec3 mediumWatercolor(vec3 col, vec2 p, float t) {\n // Wet-edge cauliflowers via luma-gradient magnitude\n float eps = 0.004;\n vec3 cx1 = sampleBase(p + vec2(eps, 0.0), t);\n vec3 cx2 = sampleBase(p - vec2(eps, 0.0), t);\n vec3 cy1 = sampleBase(p + vec2(0.0, eps), t);\n vec3 cy2 = sampleBase(p - vec2(0.0, eps), t);\n float gx = dot(cx1 - cx2, W_LUMA);\n float gy = dot(cy1 - cy2, W_LUMA);\n float edge = sqrt(gx * gx + gy * gy) / (2.0 * eps);\n float mask = smoothstep(0.0, 2.5, edge);\n col *= mix(1.0, 0.78, mask * uWetEdge);\n\n // Granulation — pigment settles in paper tooth\n float paper = 0.5 * vnoise(p * 160.0) + 0.5 * vnoise(p * 360.0);\n float pigLoad = 1.0 - dot(col, W_LUMA);\n col *= 1.0 - uGranulation * pigLoad * (paper - 0.5);\n\n // Wash banding — faint horizontal wet gradient\n float band = fbm(vec2(p.x * 1.5, p.y * 0.4));\n col *= 1.0 + 0.04 * (band - 0.5);\n return col;\n}\n\nvec3 mediumPastel(vec3 col, vec2 p, float t) {\n vec2 flow = flowField(p, t);\n vec2 perp = vec2(-flow.y, flow.x);\n float along = dot(p, flow) * uStrokeScale;\n float across = dot(p, perp) * uStrokeScale;\n across += 0.03 * (vnoise(p * 260.0) - 0.5);\n\n float aniso = mix(1.0, 0.18, uStrokeAnisotropy);\n float stroke = fbm(vec2(along * aniso, across));\n col *= mix(1.0, 0.82 + 0.32 * stroke, uStrokeAmount);\n\n // Pastel tooth — tiny high-frequency grain\n float tooth = vnoise(p * 800.0);\n col *= 1.0 - 0.08 * uStrokeAmount * (tooth - 0.5);\n return col;\n}\n", he = "// ── Medium id constants (mirror uniformBridge.ts MEDIUM_ID — the uMedium ladder) ──\n// The StrokeProfile selector (AX.W12 + AX.W13) dispatches on the medium id: oil,\n// van-Gogh, and oil-pastel each AUTHOR a first-class profile in profileFor.\n#define MEDIUM_OIL 3\n#define MEDIUM_CRAYON 4\n#define MEDIUM_VANGOGH 5\n#define MEDIUM_OILPASTEL 6\n\n// ── Crayon — DRY wax pigment on paper tooth (first-class medium, uMedium==4) ──\n// Crayon is not strokes. It's dry pigment crumbs dragged across paper tooth — the\n// DRY tooth-multiply model: anisotropic tooth noise multiplied into the base, a hard\n// SCUMBLE that lets the lower color show through the broken upper layer, and stable\n// OKLCh broken-color pigment patches. NO sheen, NO burnish film — that waxy gloss is\n// the OIL-PASTEL deposition's signature (mediumOilPastel), distinct from dry crayon\n// (AX.W13 slice 8 F1 — the split). Crayon shares the SUBSTRATE (the structure-tensor\n// orientation, the tooth noise, OKLCh brokenColorJitter), not the dispatch body.\nvec3 mediumCrayon(vec3 col, vec2 p, float t) {\n // Orient the deposition along the structure-tensor edge-tangent (the bridge forces\n // tensor for crayon, so read the tensor field directly).\n vec2 flow = structureTensorField(p, t, flowField(p, t)).xy;\n float ang = atan(flow.y, flow.x);\n float ca = cos(-ang), sa = sin(-ang);\n vec2 pr = vec2(p.x * ca - p.y * sa, p.x * sa + p.y * ca);\n\n float aniso = mix(0.45, 0.95, uStrokeAnisotropy);\n float scale = max(uStrokeScale * 1.6, 180.0);\n\n // ── Paper TOOTH height field — the relief the dry pigment rides. Anisotropic\n // (squished along flow, coarse cross-flow). Peaks = ridges, valleys = paper pits.\n float t1 = vnoise(vec2(pr.x * scale * aniso, pr.y * scale));\n float t2 = vnoise(vec2(pr.x * scale * aniso * 0.4, pr.y * scale * 0.4) + 11.0);\n float t3 = vnoise(vec2(pr.x * scale * aniso * 2.1, pr.y * scale * 2.1) + 23.0);\n float tooth = 0.55 * t1 + 0.30 * t2 + 0.15 * t3;\n\n // ── DRY TOOTH-MULTIPLY — the crayon multiplies the tooth relief into the base\n // color (dark in the pits, bright on the ridges). The pressure (uStrokeAmount) sets\n // how hard the multiply bites. This is the DRY model — no pigment build-up, no sheen.\n float pressure = clamp(uStrokeAmount, 0.0, 1.0);\n float bite = mix(0.18, 0.46, pressure); // multiply strength\n vec3 result = col * (1.0 - bite * (0.5 - tooth));\n\n // ── HARD SCUMBLE — a broken upper layer that lets the lower color show through the\n // gaps. A coarse mask gates a HARD (high-contrast) dragged pass so the dry crayon\n // reads as broken pigment crumbs, not a smooth wash. Drag follows the tensor flow.\n float scumbleMask = smoothstep(0.42, 0.78, vnoise(vec2(pr.x * scale * 0.55, pr.y * scale * 0.22) + 7.0));\n float scumbleCoverage = scumbleMask * pressure * 0.7; // hard broken upper layer\n vec3 paper = col * mix(0.80, 0.94, pressure); // the paper showing through\n result = mix(paper, result, scumbleCoverage);\n\n // ── Broken-color pigment: stable wax/pigment patches in OKLCh (W5), not flicker.\n vec2 pigmentCell = floor(pr * max(scale * 0.18, 32.0));\n float pigmentMask = smoothstep(0.28, 0.82, vnoise(pr * scale * 0.21 + 19.0));\n result = brokenColorJitter(\n result,\n hash21(pigmentCell + 17.0),\n hash21(pigmentCell * 2.1 + 31.0),\n 0.45 + 0.55 * pigmentMask\n );\n\n // Crayon is saturation-amplified (the wax chroma punch — but DRY, no sheen).\n result = saturate3(result, 1.08);\n\n return result;\n}\n\n// ── StrokeProfile — the oil-stroke parameter vector (AX.W12, slice 8 F6) ──────\n// The SBR \"stroke = parameter vector\" canon (facet 11): the per-mode if-ladder knobs\n// become struct FIELDS — logic-as-DATA, not an imperative branch. profileFor(medium,\n// mode) populates the profile for a (medium, mode) pair; paintStrokeLayers(profile) runs\n// the four-layer bestOil/paintOver cascade off it. A new medium (the W13 van-Gogh /\n// oil-pastel profiles) AUTHORS a profile entry — it never edits a monolith.\nstruct StrokeProfile {\n int shapeType; // 0 tapered, 1 load-drag, 2 dab, 3 even, 4 comma/crescent\n float bristleAmp; // edge raggedness 0..0.5\n float streakFreq; // internal-streak spatial frequency\n float streakAmp; // internal-streak amplitude\n float impastoAmp; // paint-thickness contribution (the relight reads the height)\n float hardness; // edge-compositing crispness 0..1\n float toothScale; // canvas-tooth (linen weave) spatial frequency\n float toothAmp; // canvas-tooth amplitude\n float pigmentSat; // pigment saturation boost (OKLCh chroma scale)\n float densityBig; // layer-1 (big gestural) placement density gate\n float densityMed; // layer-2 (medium body) placement density gate\n float densitySml; // layer-3 (small dabs) placement density gate\n float energyGrade; // AX.W13 — SBR energy-grade magnitude (0 off; 1 the van-Gogh\n // Starry-Night length cascade). The energy grade is a PROFILE\n // field, NOT a buried uMedium==5 bestOil branch (slice 8 F0).\n float impastoFloor;// AX.W13 — the per-stroke height-crown floor (0.4 oil falloff;\n // 1.0 van-Gogh FULL-height crown so each dab catches its glint).\n float densityFill; // AX.W13 — layer-4 fill-dab density. Oil/oil-pastel fill the\n // bald spots (0.95, full coverage); van-Gogh sets it LOW so the\n // sparse atomic dabs keep their visible inter-stroke ground gaps\n // (the atomicity read — a 0.95 fill would close every gap to a smear).\n float groundFloor; // AX.W13 — the bare-ground darken floor. The gaps between strokes\n // (low accumulated height) multiply toward this floor, so van-Gogh's\n // sparse atomic dabs read over a visibly darker underpainting (the\n // Starry-Night visible ground). Oil/oil-pastel keep 1.0 (no darken).\n};\n\n// The (medium, mode) -> StrokeProfile selector. The if-ladder's knobs are the profile's\n// fields; a new medium adds a CASE here (never an edit to a dispatch body). mode is the\n// uStrokeMode oil-stroke sub-mode (0 oil, 1 palette-knife, 3 brushwork). crayon\n// (uMedium==4) is a PEER tooth-multiply medium that never reaches the stroke cascade.\n// The painterly STROKE mediums are oil (MEDIUM_OIL), van-Gogh (MEDIUM_VANGOGH) and\n// oil-pastel (MEDIUM_OILPASTEL) — each AUTHORS its own profile entry below.\nStrokeProfile profileFor(int medium, int mode) {\n // The oil baseline (mode 0) — balanced modern-abstract/palette-knife hybrid.\n StrokeProfile prof = StrokeProfile(\n 0, // shapeType — tapered\n 0.25, // bristleAmp\n 9.0, // streakFreq\n 0.09, // streakAmp\n 0.9, // impastoAmp\n 0.80, // hardness\n 340.0, // toothScale — W-AUR-VANGOGH-CONFIG reconcile: FINER 240 → 340. Oil's §4.3 β sat\n // right AT the −1.45 band ceiling (±0.02 frame variance straddling\n // it, surfaced once the vangogh bands went green and the spec reached\n // the oil β assert). MEASURED on the live GPU: ADDING fine high-\n // frequency tooth energy steepens oil's power-spectrum slope (more\n // negative — coarsening it the other way pushed β SHALLOWER to\n // −1.33). A finer, stronger tooth moves β to a safe distance inside\n // the −5/3 band [−1.85, −1.45]. Oil-only (oil-pastel sets 280).\n 0.14, // toothAmp — raised 0.09 → 0.14 (same oil-β steepen: more fine-grain high band).\n 1.03, // pigmentSat\n 0.65, // densityBig\n 0.78, // densityMed\n 0.90, // densitySml\n 0.0, // energyGrade — oil is uniform-length (no Starry-Night cascade)\n 0.4, // impastoFloor — oil's 0.4+0.6·edgeN crown falloff\n 0.92, // densityFill — oil fills DENSELY with the directional low-relief fill so the\n // flat-colour regions between the macro strokes are TEXTURED with\n // flow-aligned fine strokes (the §4.2 anisotropy needs every pixel\n // to carry directional gradient; a flat untextured region reads as\n // an isotropic/degenerate tensor and drags mean A down). The fill\n // is now directional + low-streak, so dense coverage textures\n // WITHOUT the prior round-dab speckle.\n 1.0 // groundFloor — oil keeps the full base (no ground darken; fills everywhere)\n );\n\n // W-AUR-VANGOGH-REBUILD — the van-Gogh medium NO LONGER routes through this oil\n // StrokeProfile cascade. It is a DEDICATED atomic-dab body (mediumVangogh / vangoghDab\n // below) — the prior profile-driven cascade (four dense layers of long-thin\n // tensor-oriented strokes) merged into the \"marbled flow-bands\" read and ran at ~4fps.\n // profileFor now serves ONLY the oil + oil-pastel stroke mediums; the MEDIUM_VANGOGH\n // case is removed (no caller). MEDIUM_VANGOGH stays #define'd (the main() dispatch +\n // isPainterlyStroke still key off uMedium==5).\n\n // ── Oil-pastel — broad smeared directional strokes deposited via the brush engine\n // (slice 8 F1). Creamy soft edges (low hardness), heavy build-up, and a chroma punch.\n // Distinct from the dry-crayon tooth-multiply (mediumCrayon): oil-pastel LAYS strokes.\n if (medium == MEDIUM_OILPASTEL) {\n prof.shapeType = 0; // tapered directional smear — a round dab reads locally\n // isotropic (steep β / low A); the creamy oil-pastel mark\n // is a broad DIRECTIONAL smear, which carries the §4.2\n // coherence + adds the directional mid-band the §4.3 slope\n // needs (the round-dab profile rolled β off to −2.8)\n prof.bristleAmp = 0.10; // smooth creamy edges (waxy pastel, not bristle)\n prof.streakFreq = 18.0; // finer internal smear — adds the mid/high-band the smooth\n // round-dab profile lacked (the β-too-steep fix); the\n // directional along-spine streak flattens the §4.3 slope\n // without crossing the strokes\n prof.streakAmp = 0.20;\n prof.impastoAmp = 0.7; // build-up, but flatter than oil impasto\n prof.hardness = 0.42; // CREAMY — soft compositing, strokes blend on overlap\n prof.toothScale = 280.0;\n prof.toothAmp = 0.12; // the pastel tooth reads stronger\n prof.pigmentSat = 0.80; // the waxy chroma — eased off 1.16 so the rendered C clears\n // the §4.1 band ceiling with margin while the K-M subtractive\n // overlap path (paintOverOklab) keeps the chroma OFF the grey floor\n prof.hardness = 0.58; // creamy but the strokes still REGISTER — a too-soft blend\n // (0.42) smeared the marks into the smooth colour zones and\n // the field rolled off too steep (β≈−2.9, a near-gradient);\n // a crisper deposit keeps the mid/high-band the −5/3 slope needs\n prof.densityBig = 0.62; // broad directional coverage — but NOT over-dense: too many\n // overlapping creamy strokes point in slightly-varied\n // directions and the local §4.2 coherence DROPS (over-dense\n // measured A=0.57 < the 0.62-density A=0.63). The mid-density\n // flow-aligned deposit is the coherence sweet spot.\n prof.densityMed = 0.78;\n prof.densitySml = 0.90;\n prof.energyGrade = 0.80; // a strong Starry-Night length cascade — varies stroke length\n // by luma/coherence so the dab-size energy spreads across\n // scales (the −5/3 cascade the uniform-length 0.0 grade lacked,\n // the §4.3 β-too-steep fix). Not the full van-Gogh 1.0 (oil-\n // pastel keeps its creamy broad character).\n prof.impastoFloor = 0.55; // a softer crown than van-Gogh's full-height glint\n return prof;\n }\n\n // ── Oil sub-modes (mode dispatch on the oil medium).\n if (mode == 1) { // palette knife — razor edges, heavy impasto\n prof.shapeType = 3; // flat, even\n prof.bristleAmp = 0.12;\n prof.streakFreq = 4.0; prof.streakAmp = 0.05;\n prof.impastoAmp = 1.6;\n prof.hardness = 0.95;\n prof.toothAmp = 0.04;\n prof.densityBig = 0.80; prof.densityMed = 0.88; prof.densitySml = 0.70;\n } else if (mode == 3) { // thick brushwork — heavy bristle brush\n prof.shapeType = 0; // tapered\n prof.bristleAmp = 0.32;\n prof.streakFreq = 14.0; prof.streakAmp = 0.14;\n prof.impastoAmp = 1.2;\n prof.hardness = 0.85;\n prof.toothAmp = 0.07;\n }\n return prof;\n}\n\n// The single parameterized four-layer stroke cascade (AX.W12). The four hand-unrolled\n// bestOil/paintOver invocations collapse into ONE body driven by the profile + the\n// uniform-derived per-layer scale/anisotropy multipliers (which are mode-INVARIANT — the\n// per-layer offsets, seeds, and len/wid muls are fixed across modes, so they stay here as\n// the cascade's structure; only the profile's knobs differentiate the medium). The\n// mode passes through for the two mode-special-cased shapes (knife layer-3 dabs +\n// layer-4 fill shape), which are placement details of the cascade, not profile knobs.\nvoid paintStrokeLayers(inout vec3 col, inout float height, StrokeProfile prof,\n int mode, vec2 p, float t) {\n // Scales & multipliers from uniforms (mode-invariant cascade structure).\n float baseScale = max(uStrokeScale * 0.006, 0.008);\n // Three primary layers: big gestural, medium body, small dabs.\n // W-AUR-STUDIO D5 — the −5/3 radii respacing was MEASURED + REVERTED (recorded, not\n // silently struck). The φ-adjacent geometric candidate (2.4 / 1.45 / 0.87, a fixed\n // ≈1.66× step) moved oil-pastel β −2.534 → −2.413 — TOWARD the −5/3 band but NOT into\n // it (floor −1.85), so the keep-iff-into-band gate failed. The single-pass WebGL2 path\n // is the true limiter (HC-aurora §5): the oil-pastel β + the oil/oil-pastel anisotropy\n // residual is the named AY.W-AUR-T5 multi-pass anisotropic-Kuwahara candidate. The\n // hand-set 2.4 / 1.1 / 0.45 stays — it is van-Gogh's landed-band spacing.\n float sBig = baseScale * 2.4;\n float sMed = baseScale * 1.1;\n float sSml = baseScale * 0.45;\n\n // Strokes are elongated HARD (long·thin) so the rendered field reads strongly\n // directional — the §4.2 structure-tensor anisotropy lift. A short fat dab is locally\n // isotropic and drags the measured A down; a long thin stroke that hugs the tensor\n // tangent is what gives Starry Night its A≈0.83. The width muls are pulled tighter to\n // keep the long·thin aspect.\n float lenMulBig = mix(3.0, 5.2, uStrokeAnisotropy);\n float widMulBig = mix(0.42, 0.22, uStrokeAnisotropy);\n float lenMulMed = mix(2.8, 4.8, uStrokeAnisotropy);\n float widMulMed = mix(0.40, 0.21, uStrokeAnisotropy);\n float lenMulSml = mix(2.2, 3.6, uStrokeAnisotropy);\n float widMulSml = mix(0.36, 0.23, uStrokeAnisotropy);\n\n float jitterAmt = 0.75; // large jitter — no grid\n vec2 flow = flowField(p, t);\n\n // Layer 1 — big gestural strokes (sparse, shaping)\n StrokeHit hBig = bestOil(p, sBig, lenMulBig, widMulBig, jitterAmt * 0.55,\n prof.densityBig, prof.shapeType, prof.bristleAmp, flow, t, 1.3,\n prof.energyGrade);\n paintOver(col, height, hBig, prof.streakFreq * 0.7, prof.streakAmp,\n uImpasto * prof.impastoAmp * uStrokeAmount, prof.hardness, 1.3, prof.impastoFloor);\n\n // Layer 2 — medium body strokes\n StrokeHit hMed = bestOil(p + vec2(11.3, 3.7), sMed, lenMulMed, widMulMed,\n jitterAmt, prof.densityMed, prof.shapeType, prof.bristleAmp, flow, t, 2.7,\n prof.energyGrade);\n paintOver(col, height, hMed, prof.streakFreq, prof.streakAmp,\n uImpasto * prof.impastoAmp * uStrokeAmount, prof.hardness, 2.7, prof.impastoFloor);\n\n // Layer 3 — small strokes (more frequent, smaller). Even the knife layer-3 stays the\n // medium's DIRECTIONAL shape, not a round dab — the round-dab sparkle was a fine-scale\n // isotropic speckle that dragged the §4.2 anisotropy down + rolled the §4.3 slope shallow.\n int smlShape = prof.shapeType;\n StrokeHit hSml = bestOil(p + vec2(-5.1, 8.4), sSml, lenMulSml, widMulSml,\n jitterAmt * 0.9, prof.densitySml, smlShape,\n prof.bristleAmp * 0.85, flow, t, 4.1, prof.energyGrade);\n paintOver(col, height, hSml, prof.streakFreq * 1.4, prof.streakAmp * 0.6,\n uImpasto * prof.impastoAmp * 0.45 * uStrokeAmount, prof.hardness, 4.1, prof.impastoFloor);\n\n // Layer 4 — fill strokes (dense, fine) — cover bald spots. The density is\n // PROFILE-driven (prof.densityFill): oil/oil-pastel fill to full coverage; van-Gogh\n // keeps it sparse so the bare-ground gaps between its atomic dabs survive. The fill is\n // ELONGATED + flow-oriented (NOT a round dab) — a dense round-dab fill is locally\n // isotropic and was the dominant §4.2 anisotropy sink; an oriented fine stroke keeps the\n // fill directional so the whole field reads coherent.\n float sFill = baseScale * 0.22;\n float lenMulFill = mix(2.0, 3.2, uStrokeAnisotropy);\n float widMulFill = mix(0.34, 0.24, uStrokeAnisotropy);\n int fillShape = (mode == 1) ? 3 : prof.shapeType; // knife=even; others inherit the medium's directional shape\n StrokeHit hFill = bestOil(p + vec2(3.9, -6.2), sFill, lenMulFill, widMulFill,\n jitterAmt * 0.8, prof.densityFill, fillShape,\n prof.bristleAmp * 0.6, flow, t, 8.9, prof.energyGrade);\n // The fill is a low-relief, low-streak base coat — it covers bald spots WITHOUT adding\n // fine bright speckle (a high-impasto/high-streak fill caught a per-dab glint that read\n // as isotropic noise over the directional macro strokes — the §4.2/§4.3 sink). Its\n // positional jitter is tamed too so the fill strokes stay flow-aligned, not scattered.\n paintOver(col, height, hFill, prof.streakFreq * 1.2, prof.streakAmp * 0.35,\n uImpasto * prof.impastoAmp * 0.18 * uStrokeAmount, prof.hardness * 0.9, 8.9, prof.impastoFloor);\n\n // Optional crosshatch layer\n if (uStrokeLayers == 2) {\n vec2 flow2 = vec2(-flow.y, flow.x);\n StrokeHit hX = bestOil(p + vec2(7.3, -2.1), sMed, lenMulMed * 0.9, widMulMed,\n jitterAmt, prof.densityMed * 0.7, prof.shapeType, prof.bristleAmp, flow2, t, 6.5,\n prof.energyGrade);\n paintOver(col, height, hX, prof.streakFreq, prof.streakAmp * 0.85,\n uImpasto * prof.impastoAmp * 0.55 * uStrokeAmount, prof.hardness, 6.5, prof.impastoFloor);\n }\n}\n\n// The shared stroke-medium SUBSTRATE finish (AX.W12 + AX.W13): paint the four-layer\n// cascade off the profile, then canvas-tooth + relight + saturation. The three painterly\n// STROKE mediums (oil / van-Gogh / oil-pastel) each AUTHOR their own profile and call\n// this — the substrate is shared, the PROFILE (not a dispatch-body fork) differentiates\n// the medium (slice 8 F6). mode passes through for the cascade's mode-special-cased shapes.\nvec3 paintStrokeMedium(vec3 col, vec2 p, float t, StrokeProfile prof, int mode) {\n vec3 result = col;\n // AW.W4.2 — accumulated paint HEIGHT across the stroke layers. The relight reads\n // its gradient for the normal; the canvas tooth seeds the base relief.\n float height = 0.0;\n paintStrokeLayers(result, height, prof, mode, p, t);\n\n // Canvas tooth — linen weave\n float tooth1 = vnoise(p * prof.toothScale);\n float tooth2 = vnoise(p * prof.toothScale * vec2(0.6, 2.4) + 37.0);\n float tooth = (0.6 * tooth1 + 0.4 * tooth2) - 0.5;\n result *= 1.0 + tooth * prof.toothAmp * uCanvasGrain;\n\n // AW.W4.2 — relight the accumulated paint height with the movable uLightDir\n // source (diffuse + Blinn specular, in LINEAR before aces()). The canvas tooth\n // is the base relief term so the weave also catches the raking light.\n float canvasBase = tooth * prof.toothAmp * 0.5;\n result = relightImpasto(result, height, canvasBase);\n\n // AX.W13 — the visible ground. The bare-ground gaps (low accumulated stroke height)\n // multiply toward prof.groundFloor, so van-Gogh's sparse atomic dabs read as separable\n // marks over a darker underpainting (oil/oil-pastel keep groundFloor=1.0 → no-op). The\n // smoothstep keeps the impasto dabs (high height) at full value; only the open ground\n // between them darkens.\n result *= mix(prof.groundFloor, 1.0, smoothstep(0.0, 0.38, height));\n\n // Pigment saturation boost\n result = saturate3(result, prof.pigmentSat);\n\n return result;\n}\n\nvec3 mediumOil(vec3 col, vec2 p, float t) {\n // The oil medium is a thin body: fetch the oil profile (mode-dispatched), paint via\n // the shared stroke substrate. uStrokeMode: 0 oil (gestural), 1 knife, 3 brushwork.\n int mode = uStrokeMode;\n StrokeProfile prof = profileFor(MEDIUM_OIL, mode);\n return paintStrokeMedium(col, p, t, prof, mode);\n}\n\n" + pe + "// AX.W13 — the oil-pastel medium (uMedium==6) is a DISTINCT stroke-deposition body,\n// split out of the dry-crayon tooth-multiply (mediumCrayon) (slice 8 F1). It DEPOSITS\n// broad smeared directional strokes via the same brush engine with a creamy soft\n// hardness, heavy pigment build-up where strokes overlap, and a chroma punch — the\n// stroke-deposition model that gives oil-pastel its depth and less-uniform read.\n// Shares the SUBSTRATE (the stroke cascade + tooth + relight) with oil/van-Gogh, NOT\n// the dispatch body of dry crayon. The bridge forces tensor orientation.\nvec3 mediumOilPastel(vec3 col, vec2 p, float t) {\n StrokeProfile prof = profileFor(MEDIUM_OILPASTEL, 0);\n return paintStrokeMedium(col, p, t, prof, 0);\n}", A = "\n", ge = `#version 300 es
|
|
11
11
|
precision highp float;
|
|
12
12
|
|
|
13
13
|
in vec2 vUv;
|
|
@@ -142,7 +142,7 @@ float vnoise(vec2 p) {
|
|
|
142
142
|
// The rotated-octave FBM rotation constant — spliced from the shared chunk (AV.W2
|
|
143
143
|
// — the one FBM_ROT). The loop below stays aurora-local (2.02 lacunarity +
|
|
144
144
|
// uniform-driven octaves, per §3a — only the rotation constant converges).
|
|
145
|
-
${
|
|
145
|
+
${o}
|
|
146
146
|
|
|
147
147
|
float fbm(vec2 p) {
|
|
148
148
|
float v = 0.0;
|
|
@@ -157,15 +157,14 @@ float fbm(vec2 p) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// AX.W12 — the painterly-medium organic noise basis (Jarzynski PCG2D integer-bit hash
|
|
160
|
-
// + 2D simplex gradient noise), SPLICED from the shared procedural-color chunk
|
|
161
|
-
//
|
|
162
|
-
// drift between backends (proof:aurora-noise-hash-equivalence locks the twins to 1e-6).
|
|
160
|
+
// + 2D simplex gradient noise), SPLICED from the shared procedural-color chunk (the
|
|
161
|
+
// single hash source).
|
|
163
162
|
// The painterly mediums (mediumOil's tooth/granulation) opt into pcgHash2/gnoise for
|
|
164
163
|
// organic paper/pigment grain; the smooth/atmospheric pole KEEPS its cheap value-noise
|
|
165
164
|
// fbm above (the cost-tiering is preserved per AX.W12 §3a — this is an ADDITIVE basis,
|
|
166
165
|
// not a blanket upgrade). The aurora-local hash21/vnoise/fbm loop stays (legitimately
|
|
167
166
|
// divergent per the chunk's §3a).
|
|
168
|
-
${
|
|
167
|
+
${u}
|
|
169
168
|
|
|
170
169
|
// The sRGB OETF (linearToSrgb) — spliced from the shared procedural-color chunk
|
|
171
170
|
// (AV.W2 — the single OETF source; the AV.W1 local copy is deleted here). Aurora's
|
|
@@ -177,7 +176,7 @@ ${c}
|
|
|
177
176
|
// SAME shared chunk the goo-blob uses (zero new payload, 1e-6-verified). PI is
|
|
178
177
|
// defined first because the chunk's oklabToOklch folds the hue into [0, 2pi).
|
|
179
178
|
const float PI = 3.141592653589793;
|
|
180
|
-
${
|
|
179
|
+
${n}
|
|
181
180
|
|
|
182
181
|
// ── OKLCh palette ramp (W5 interp · AX.W11 single-sourced twin) ───────────────
|
|
183
182
|
// The muddy-midtone kill: distant-hue stops interpolated by a plain linear mix()
|
|
@@ -187,10 +186,9 @@ ${r}
|
|
|
187
186
|
//
|
|
188
187
|
// AX.W11 — the ramp (interpolateHueTurns + mixPaletteOklab + mixPaletteOklchArc +
|
|
189
188
|
// the smoothstep-eased samplePaletteRamp dispatcher) is SPLICED from the shared
|
|
190
|
-
// procedural-color chunk
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
${f}
|
|
189
|
+
// procedural-color chunk (the single ramp source). composition.glsl.ts's
|
|
190
|
+
// samplePalette calls samplePaletteRamp.
|
|
191
|
+
${i}
|
|
194
192
|
|
|
195
193
|
// Interleaved Gradient Noise (Jimenez) — a 1-LSB triangular dither applied in
|
|
196
194
|
// DISPLAY space AFTER the OETF, so 8-bit mid-tone banding on the soft gradient is
|
|
@@ -259,63 +257,14 @@ vec2 domainWarp(vec2 p, float t) {
|
|
|
259
257
|
return warped;
|
|
260
258
|
}
|
|
261
259
|
|
|
262
|
-
` +
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
let
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return a = s, a.configure({
|
|
271
|
-
device: n,
|
|
272
|
-
format: i,
|
|
273
|
-
alphaMode: t.alphaMode ?? "premultiplied"
|
|
274
|
-
}), o = r({
|
|
275
|
-
device: n,
|
|
276
|
-
context: a,
|
|
277
|
-
format: i
|
|
278
|
-
}), {
|
|
279
|
-
frame: o.frame,
|
|
280
|
-
shouldContinue: o.shouldContinue,
|
|
281
|
-
time: o.time,
|
|
282
|
-
teardown: () => {
|
|
283
|
-
o?.teardown?.(), a?.unconfigure(), a = null, o = null, c = null;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
let u = s({
|
|
288
|
-
canvas: e,
|
|
289
|
-
mode: t.mode,
|
|
290
|
-
respectReducedMotion: t.respectReducedMotion,
|
|
291
|
-
buildContext: l,
|
|
292
|
-
resize: () => o?.resize()
|
|
293
|
-
});
|
|
294
|
-
return {
|
|
295
|
-
arm: u.arm,
|
|
296
|
-
suspend: u.suspend,
|
|
297
|
-
resume: u.resume,
|
|
298
|
-
wake: u.wake,
|
|
299
|
-
renderAt: u.renderAt,
|
|
300
|
-
dispose: u.dispose,
|
|
301
|
-
get device() {
|
|
302
|
-
return c;
|
|
303
|
-
},
|
|
304
|
-
get reducedMotion() {
|
|
305
|
-
return u.reducedMotion;
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/components/custom/aurora/composables/glSetup.ts
|
|
311
|
-
var M = "[Aurora]", Se = /* @__PURE__ */ "uTime.uPalette.uStopCount.uNucleiCount.uNucleiPos.uNucleiRadius.uNucleiPaletteBias.uNucleiValueBias.uNucleiDriftRadius.uNucleiDriftPhase.uNucleiElong.uNucleiAngle.uSoftmaxBeta.uValueVariance.uWarpAmount.uWarpScale.uWarpDrift.uWarpMode.uNoiseOctaves.uMedium.uHuePath.uFlowPattern.uFlowFocal.uFlowAngle.uFlowCurl.uCursor.uCursorStrength.uCursorRadius.uCursorVelocity.uCursorBurst.uStrokeAmount.uStrokeScale.uStrokeAnisotropy.uStrokeLayers.uStrokeMode.uStrokeOrient.uLightDir.uLightColor.uWetEdge.uGranulation.uImpasto.uBrokenColor.uCanvasGrain.uNucleiDrift.uPaletteDrift.uBreathDepth.uBreathPeriod.uSaturation.uPaperGrain.uAlpha".split(".");
|
|
312
|
-
function Ce(e, t, n) {
|
|
313
|
-
let r = h(e, e.VERTEX_SHADER, t, M), i = h(e, e.FRAGMENT_SHADER, n, M), a = u(e, r, i, M);
|
|
314
|
-
e.useProgram(a);
|
|
315
|
-
let o = e.createVertexArray();
|
|
316
|
-
e.bindVertexArray(o);
|
|
317
|
-
let s = e.createBuffer();
|
|
318
|
-
e.bindBuffer(e.ARRAY_BUFFER, s), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
260
|
+
` + le + A + ue + A + "// ── Color utils (OKLCh — W5; the sRGB YIQ hueShift matrix is DELETED) ──────────\nconst vec3 W_LUMA = vec3(0.2126, 0.7152, 0.0722);\n\n// Linear sRGB → OKLab (the cbrt-LMS path; the goo-blob's srgbToOklab takes gamma,\n// here the color field is already linear so we skip the OETF inverse).\nvec3 linOklab(vec3 lin) {\n vec3 lms = LINEAR_SRGB_TO_LMS * lin;\n return LMS_TO_OKLAB * (sign(lms) * pow(abs(lms), vec3(1.0 / 3.0)));\n}\n\n// Broken color (W5) — hue + chroma jitter at fixed PERCEPTUAL lightness, in OKLCh.\n// Broken color is hue variation at constant VALUE, which only OKLCh makes true (the\n// prior YIQ-style sRGB rotation muddied value). This is the seam AW.W4's van-Gogh /\n// oil-pastel per-stroke pigment jitter consumes (the pigment-variation read).\nvec3 brokenColorJitter(vec3 c, float hueSeed, float valueSeed, float strength) {\n float amt = clamp(uBrokenColor * strength, 0.0, 1.0);\n if (amt <= 0.001) return c;\n vec3 lch = oklabToOklch(linOklab(c));\n // ±~16° hue swing + ±~12% chroma swing; L held so value reads constant.\n lch.z += (hueSeed - 0.5) * (32.0 * PI / 180.0) * amt;\n lch.y = max(lch.y * (1.0 + (valueSeed - 0.5) * 0.28 * amt), 0.0);\n return max(oklabToLinearSrgb(oklchToOklab(lch)), vec3(0.0));\n}\n\n// Saturation (W5) — chroma scale at fixed L/H in OKLCh (the perceptual saturation,\n// replacing the luma-mix sRGB form). amt=1 is identity; amt<1 desaturates toward\n// the achromatic axis with NO lightness shift (the muddy-luma-mix grey is gone).\nvec3 saturate3(vec3 c, float amt) {\n vec3 lch = oklabToOklch(linOklab(c));\n lch.y = max(lch.y * amt, 0.0);\n return max(oklabToLinearSrgb(oklchToOklab(lch)), vec3(0.0));\n}\n\n" + de + A + me + A + fe + A + he + A + "\n// ── Main ──────────────────────────────────────────────────────────────────\nvoid main() {\n // Normalized 0..1 coordinates for nuclei, domain warp, and medium sampling.\n vec2 uv = vUv;\n vec2 pN = uv;\n\n float t = uTime;\n\n // Warp in pN space\n vec2 p_warp = domainWarp(pN, t);\n\n // Composition\n float paletteId; float valueMod;\n nucleiField(p_warp, t, paletteId, valueMod);\n vec3 col = samplePalette(paletteId);\n col *= 1.0 + uValueVariance * valueMod;\n\n // Breath — slow global luminance wobble\n float breath = sin(t * 6.2831 / max(uBreathPeriod, 1.0));\n col *= 1.0 + uBreathDepth * breath * 0.5;\n\n // Medium dispatch (AX.W13 — each is a FIRST-CLASS body, no shared dispatch):\n // 1 pastel · 2 watercolor · 3 oil · 4 crayon (DRY tooth-multiply) ·\n // 5 van-Gogh (atomic comma/crescent dabs) · 6 oil-pastel (stroke deposition).\n // van-Gogh is no longer a mediumOil passthrough; oil-pastel and crayon no longer\n // share a body — they share the SUBSTRATE (the tooth/placement helpers), not the\n // dispatch body (slice 8 F0/F1).\n if (uMedium == 1) col = mediumPastel(col, pN, t);\n else if (uMedium == 2) col = mediumWatercolor(col, pN, t);\n else if (uMedium == 3) col = mediumOil(col, pN, t);\n else if (uMedium == 4) col = mediumCrayon(col, pN, t);\n else if (uMedium == 5) col = mediumVangogh(col, pN, t);\n else if (uMedium == 6) col = mediumOilPastel(col, pN, t);\n\n // Saturation trim\n col = saturate3(col, uSaturation);\n\n // Tonemap + film grain\n col = aces(col);\n float grain = hash21(gl_FragCoord.xy + t * 17.0);\n col += (grain - 0.5) * uPaperGrain;\n\n col = clamp(col * 0.985 + 0.008, 0.0, 1.0);\n\n // MANDATORY OETF — closes the seam (mirrors metaball.frag.ts:278). The whole\n // pipeline above (linear palette LUT, ACES tonemap, grain) runs in LINEAR; without\n // this transfer the aurora ships ~2.2× too dark (linear 0.5 → ~0.215, not ~0.735).\n col = linearToSrgb(col);\n\n // 1-LSB triangular IGN dither in DISPLAY space, AFTER the OETF — breaks 8-bit\n // mid-tone banding on the soft gradient. Texture-free (the canonical Jimenez IGN).\n col += (1.0 / 255.0) * (ign(gl_FragCoord.xy) - 0.5);\n\n // Premultiply operates on DISPLAY-space color (matches the blob: OETF, then premul).\n fragColor = vec4(col * uAlpha, uAlpha);\n}\n", j = "[Aurora]", M = /* @__PURE__ */ "uTime.uPalette.uStopCount.uNucleiCount.uNucleiPos.uNucleiRadius.uNucleiPaletteBias.uNucleiValueBias.uNucleiDriftRadius.uNucleiDriftPhase.uNucleiElong.uNucleiAngle.uSoftmaxBeta.uValueVariance.uWarpAmount.uWarpScale.uWarpDrift.uWarpMode.uNoiseOctaves.uMedium.uHuePath.uFlowPattern.uFlowFocal.uFlowAngle.uFlowCurl.uCursor.uCursorStrength.uCursorRadius.uCursorVelocity.uCursorBurst.uStrokeAmount.uStrokeScale.uStrokeAnisotropy.uStrokeLayers.uStrokeMode.uStrokeOrient.uLightDir.uLightColor.uWetEdge.uGranulation.uImpasto.uBrokenColor.uCanvasGrain.uNucleiDrift.uPaletteDrift.uBreathDepth.uBreathPeriod.uSaturation.uPaperGrain.uAlpha".split(".");
|
|
261
|
+
function N(e, t, n) {
|
|
262
|
+
let r = l(e, e.VERTEX_SHADER, t, j), i = l(e, e.FRAGMENT_SHADER, n, j), o = a(e, r, i, j);
|
|
263
|
+
e.useProgram(o);
|
|
264
|
+
let s = e.createVertexArray();
|
|
265
|
+
e.bindVertexArray(s);
|
|
266
|
+
let c = e.createBuffer();
|
|
267
|
+
e.bindBuffer(e.ARRAY_BUFFER, c), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
319
268
|
-1,
|
|
320
269
|
-1,
|
|
321
270
|
3,
|
|
@@ -323,86 +272,86 @@ function Ce(e, t, n) {
|
|
|
323
272
|
-1,
|
|
324
273
|
3
|
|
325
274
|
]), e.STATIC_DRAW);
|
|
326
|
-
let
|
|
327
|
-
e.enableVertexAttribArray(
|
|
328
|
-
let
|
|
329
|
-
for (let t of
|
|
275
|
+
let u = e.getAttribLocation(o, "aPos");
|
|
276
|
+
e.enableVertexAttribArray(u), e.vertexAttribPointer(u, 2, e.FLOAT, !1, 0, 0);
|
|
277
|
+
let d = {};
|
|
278
|
+
for (let t of M) d[t] = e.getUniformLocation(o, t);
|
|
330
279
|
return {
|
|
331
|
-
program:
|
|
280
|
+
program: o,
|
|
332
281
|
vs: r,
|
|
333
282
|
fs: i,
|
|
334
|
-
uniforms:
|
|
283
|
+
uniforms: d,
|
|
335
284
|
geometry: {
|
|
336
|
-
vao:
|
|
337
|
-
buf:
|
|
285
|
+
vao: s,
|
|
286
|
+
buf: c
|
|
338
287
|
}
|
|
339
288
|
};
|
|
340
289
|
}
|
|
341
290
|
//#endregion
|
|
342
291
|
//#region src/components/custom/aurora/composables/color.ts
|
|
343
|
-
function
|
|
292
|
+
function P(e, t = 8, n) {
|
|
344
293
|
let r = n ?? new Float32Array(t * 3), i = Math.min(e.length, t);
|
|
345
294
|
for (let t = 0; t < i; t++) {
|
|
346
|
-
let [n, i, a] =
|
|
295
|
+
let [n, i, a] = h(e[t]);
|
|
347
296
|
r[t * 3 + 0] = n, r[t * 3 + 1] = i, r[t * 3 + 2] = a;
|
|
348
297
|
}
|
|
349
298
|
for (let e = i; e < t; e++) r[e * 3 + 0] = 0, r[e * 3 + 1] = 0, r[e * 3 + 2] = 0;
|
|
350
299
|
return r;
|
|
351
300
|
}
|
|
352
|
-
function
|
|
301
|
+
function F(e) {
|
|
353
302
|
if (e.length === 0) return "transparent";
|
|
354
|
-
if (e.length === 1) return
|
|
303
|
+
if (e.length === 1) return v(e[0]);
|
|
355
304
|
let t = e.length;
|
|
356
305
|
return `linear-gradient(135deg, ${e.map((e, n) => {
|
|
357
306
|
let r = Math.round(n / (t - 1) * 100);
|
|
358
|
-
return `${
|
|
307
|
+
return `${v(e)} ${r}%`;
|
|
359
308
|
}).join(", ")})`;
|
|
360
309
|
}
|
|
361
|
-
function
|
|
362
|
-
let t = e.replace("#", ""), n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), [a, o, s] =
|
|
310
|
+
function I(e) {
|
|
311
|
+
let t = e.replace("#", ""), n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), [a, o, s] = se(n / 255, r / 255, i / 255), [c, l, u] = oe(a, o, s);
|
|
363
312
|
return {
|
|
364
313
|
L: c,
|
|
365
314
|
C: l,
|
|
366
315
|
h: u
|
|
367
316
|
};
|
|
368
317
|
}
|
|
369
|
-
var
|
|
370
|
-
function
|
|
371
|
-
let n = typeof e == "string" ?
|
|
372
|
-
|
|
373
|
-
let
|
|
318
|
+
var L = [.35, .95];
|
|
319
|
+
function R(e, t = {}) {
|
|
320
|
+
let n = typeof e == "string" ? y(e) : e, { stopCount: r = 4, harmony: i = "analogous", lightnessSpread: a = .32, chromaFalloff: o = .85, hueSpread: s = 28, lightnessEasing: c = "linear", chromaEasing: l = "bell", temperatureShift: u = 0 } = t, d = Math.max(2, Math.min(8, Math.round(r))), [f, p] = L, h = n.L - a / 2, _ = n.L + a / 2;
|
|
321
|
+
h < f && (_ += f - h, h = f), _ > p && (h -= _ - p, _ = p), h = Math.max(f, h), _ = Math.min(p, _);
|
|
322
|
+
let v = [];
|
|
374
323
|
for (let e = 0; e < d; e++) {
|
|
375
|
-
let t = d === 1 ? 0 : e / (d - 1), r =
|
|
376
|
-
if (l === "bell") f = a + (n.C - a) *
|
|
324
|
+
let t = d === 1 ? 0 : e / (d - 1), r = h + (_ - h) * z(t, c), a = n.C * o, f;
|
|
325
|
+
if (l === "bell") f = a + (n.C - a) * _e(t);
|
|
377
326
|
else {
|
|
378
|
-
let e = l === "sine" ?
|
|
327
|
+
let e = l === "sine" ? z(t, "sine") : t;
|
|
379
328
|
f = n.C - (n.C - a) * e;
|
|
380
329
|
}
|
|
381
|
-
let p =
|
|
382
|
-
u > 0 && (p =
|
|
330
|
+
let p = g(n.h, i, s, t);
|
|
331
|
+
u > 0 && (p = xe(p, t, u)), v.push(m({
|
|
383
332
|
L: r,
|
|
384
333
|
C: f,
|
|
385
334
|
h: p
|
|
386
335
|
}));
|
|
387
336
|
}
|
|
388
|
-
return
|
|
337
|
+
return v;
|
|
389
338
|
}
|
|
390
|
-
function
|
|
339
|
+
function z(e, t) {
|
|
391
340
|
return t === "sine" ? .5 - .5 * Math.cos(Math.PI * e) : e;
|
|
392
341
|
}
|
|
393
|
-
function
|
|
342
|
+
function _e(e) {
|
|
394
343
|
return Math.sin(Math.PI * e);
|
|
395
344
|
}
|
|
396
|
-
var
|
|
397
|
-
function
|
|
345
|
+
var ve = 70, ye = 250, be = 22;
|
|
346
|
+
function xe(e, t, n) {
|
|
398
347
|
let r = (t - .5) * 2;
|
|
399
348
|
if (r === 0 || n === 0) return e;
|
|
400
|
-
let i = (
|
|
401
|
-
return ((e + Math.sign(i) * Math.min(Math.abs(r) * n *
|
|
349
|
+
let i = (ae(e, r >= 0 ? ve : ye, 1, "shorter") - e + 540) % 360 - 180;
|
|
350
|
+
return ((e + Math.sign(i) * Math.min(Math.abs(r) * n * be, Math.abs(i))) % 360 + 360) % 360;
|
|
402
351
|
}
|
|
403
352
|
//#endregion
|
|
404
353
|
//#region src/components/custom/aurora/composables/uniformBridge.ts
|
|
405
|
-
var
|
|
354
|
+
var Se = {
|
|
406
355
|
smooth: 0,
|
|
407
356
|
pastel: 1,
|
|
408
357
|
watercolor: 2,
|
|
@@ -410,63 +359,47 @@ var je = {
|
|
|
410
359
|
crayon: 4,
|
|
411
360
|
vangogh: 5,
|
|
412
361
|
"oil-pastel": 6
|
|
413
|
-
},
|
|
362
|
+
}, Ce = {
|
|
414
363
|
shorter: 0,
|
|
415
364
|
longer: 1,
|
|
416
365
|
increasing: 2,
|
|
417
366
|
decreasing: 3
|
|
418
|
-
},
|
|
367
|
+
}, we = {
|
|
419
368
|
none: 0,
|
|
420
369
|
radial: 1,
|
|
421
370
|
swirl: 2,
|
|
422
371
|
diagonal: 3,
|
|
423
372
|
multi: 4,
|
|
424
373
|
tensor: 5
|
|
425
|
-
},
|
|
374
|
+
}, B = {
|
|
426
375
|
flow: 0,
|
|
427
376
|
tensor: 1
|
|
428
|
-
},
|
|
377
|
+
}, Te = {
|
|
429
378
|
fbm: 0,
|
|
430
379
|
cellular: 1,
|
|
431
380
|
hybrid: 2
|
|
432
|
-
},
|
|
381
|
+
}, Ee = {
|
|
433
382
|
oil: 0,
|
|
434
383
|
knife: 1,
|
|
435
384
|
chunky: 3
|
|
436
|
-
},
|
|
385
|
+
}, V = {
|
|
437
386
|
L: .985,
|
|
438
387
|
C: .0125,
|
|
439
388
|
h: 77.5
|
|
440
389
|
};
|
|
441
|
-
function
|
|
442
|
-
return e === void 0 ?
|
|
443
|
-
}
|
|
444
|
-
function V(e) {
|
|
445
|
-
return je[e.medium];
|
|
390
|
+
function De(e) {
|
|
391
|
+
return e === void 0 ? _(V.L, V.C, V.h) : Array.isArray(e) ? e : _(e.L, e.C, e.h);
|
|
446
392
|
}
|
|
447
|
-
function
|
|
448
|
-
return
|
|
393
|
+
function Oe(e) {
|
|
394
|
+
return Se[e.medium];
|
|
449
395
|
}
|
|
450
|
-
function
|
|
451
|
-
return
|
|
396
|
+
function ke(e) {
|
|
397
|
+
return Ee[e.strokeMode];
|
|
452
398
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
n.fill(0), r.fill(0), n[0] = t, n[1] = Math.min(e.palette.length, 8), n[2] = Math.min(e.nuclei.length, 6), n[3] = e.softmaxBeta, n[4] = e.valueVariance, n[5] = e.warpAmount, n[6] = e.warpScale, n[7] = e.warpDrift, n[8] = z[e.warpMode], n[9] = e.noiseOctaves, n[10] = V(e), n[11] = e.breathDepth, n[12] = e.breathPeriod, n[13] = e.saturation, n[14] = e.paperGrain, n[15] = e.alpha, n[16] = L[e.huePath ?? "shorter"];
|
|
456
|
-
let i = N(e.palette, 8);
|
|
457
|
-
for (let e = 0; e < 8; e++) r[e * 4 + 0] = i[e * 3 + 0], r[e * 4 + 1] = i[e * 3 + 1], r[e * 4 + 2] = i[e * 3 + 2];
|
|
458
|
-
let a = 32, o = Math.min(e.nuclei.length, 6);
|
|
459
|
-
for (let t = 0; t < o; t++) {
|
|
460
|
-
let n = e.nuclei[t];
|
|
461
|
-
r[a + t * 4 + 0] = n.x, r[a + t * 4 + 1] = 1 - n.y, r[a + t * 4 + 2] = n.radius, r[a + t * 4 + 3] = n.paletteBias;
|
|
462
|
-
}
|
|
463
|
-
a = 56;
|
|
464
|
-
for (let t = 0; t < o; t++) {
|
|
465
|
-
let n = e.nuclei[t];
|
|
466
|
-
r[a + t * 4 + 0] = n.valueBias, r[a + t * 4 + 1] = n.elongation ?? 1, r[a + t * 4 + 2] = -(n.angle ?? 0) * Math.PI / 180, r[a + t * 4 + 3] = n.driftRadius;
|
|
467
|
-
}
|
|
399
|
+
function H(e) {
|
|
400
|
+
return e.medium === "vangogh" || e.medium === "oil-pastel" || e.medium === "crayon" ? B.tensor : B[e.strokeOrient ?? "flow"];
|
|
468
401
|
}
|
|
469
|
-
function
|
|
402
|
+
function Ae(e, t, n, r) {
|
|
470
403
|
let i = (e) => 1 - e, a = {
|
|
471
404
|
palette: new Float32Array(24),
|
|
472
405
|
pos: new Float32Array(12),
|
|
@@ -479,7 +412,7 @@ function ze(e, t, n, r) {
|
|
|
479
412
|
angle: new Float32Array(6)
|
|
480
413
|
};
|
|
481
414
|
return function(o) {
|
|
482
|
-
e.useProgram(t),
|
|
415
|
+
e.useProgram(t), P(o.palette, 8, a.palette), e.uniform3fv(n.uPalette, a.palette), e.uniform1i(n.uStopCount, Math.min(o.palette.length, 8));
|
|
483
416
|
let s = Math.min(o.nuclei.length, 6);
|
|
484
417
|
e.uniform1i(n.uNucleiCount, s);
|
|
485
418
|
for (let e = 0; e < s; e++) {
|
|
@@ -487,13 +420,13 @@ function ze(e, t, n, r) {
|
|
|
487
420
|
a.pos[e * 2 + 0] = t.x, a.pos[e * 2 + 1] = i(t.y), a.rad[e] = t.radius, a.pb[e] = t.paletteBias, a.vb[e] = t.valueBias, a.dr[e] = t.driftRadius, a.dp[e] = t.driftPhase, a.elong[e] = t.elongation ?? 1, a.angle[e] = -(t.angle ?? 0) * Math.PI / 180;
|
|
488
421
|
}
|
|
489
422
|
for (let e = s; e < 6; e++) a.pos[e * 2 + 0] = 0, a.pos[e * 2 + 1] = 0, a.rad[e] = 0, a.pb[e] = 0, a.vb[e] = 0, a.dr[e] = 0, a.dp[e] = 0, a.elong[e] = 1, a.angle[e] = 0;
|
|
490
|
-
e.uniform2fv(n.uNucleiPos, a.pos), e.uniform1fv(n.uNucleiRadius, a.rad), e.uniform1fv(n.uNucleiPaletteBias, a.pb), e.uniform1fv(n.uNucleiValueBias, a.vb), e.uniform1fv(n.uNucleiDriftRadius, a.dr), e.uniform1fv(n.uNucleiDriftPhase, a.dp), e.uniform1fv(n.uNucleiElong, a.elong), e.uniform1fv(n.uNucleiAngle, a.angle), e.uniform1f(n.uSoftmaxBeta, o.softmaxBeta), e.uniform1f(n.uValueVariance, o.valueVariance), e.uniform1f(n.uWarpAmount, o.warpAmount), e.uniform1f(n.uWarpScale, o.warpScale), e.uniform1f(n.uWarpDrift, o.warpDrift), e.uniform1i(n.uWarpMode,
|
|
423
|
+
e.uniform2fv(n.uNucleiPos, a.pos), e.uniform1fv(n.uNucleiRadius, a.rad), e.uniform1fv(n.uNucleiPaletteBias, a.pb), e.uniform1fv(n.uNucleiValueBias, a.vb), e.uniform1fv(n.uNucleiDriftRadius, a.dr), e.uniform1fv(n.uNucleiDriftPhase, a.dp), e.uniform1fv(n.uNucleiElong, a.elong), e.uniform1fv(n.uNucleiAngle, a.angle), e.uniform1f(n.uSoftmaxBeta, o.softmaxBeta), e.uniform1f(n.uValueVariance, o.valueVariance), e.uniform1f(n.uWarpAmount, o.warpAmount), e.uniform1f(n.uWarpScale, o.warpScale), e.uniform1f(n.uWarpDrift, o.warpDrift), e.uniform1i(n.uWarpMode, Te[o.warpMode]), e.uniform1i(n.uNoiseOctaves, o.noiseOctaves), e.uniform1i(n.uMedium, Oe(o)), e.uniform1i(n.uHuePath, Ce[o.huePath ?? "shorter"]), e.uniform1i(n.uFlowPattern, we[o.flow.pattern]), e.uniform2f(n.uFlowFocal, o.flow.focalX, i(o.flow.focalY)), e.uniform1f(n.uFlowAngle, o.flow.angle), e.uniform1f(n.uFlowCurl, o.flow.curl), e.uniform2f(n.uCursor, r.x, i(r.y)), e.uniform1f(n.uCursorStrength, r.strength), e.uniform1f(n.uCursorRadius, r.radius), e.uniform2f(n.uCursorVelocity, r.velX, -r.velY), e.uniform1f(n.uCursorBurst, r.burst), e.uniform1f(n.uStrokeAmount, o.strokeAmount), e.uniform1f(n.uStrokeScale, o.strokeScale), e.uniform1f(n.uStrokeAnisotropy, o.strokeAnisotropy), e.uniform1i(n.uStrokeLayers, o.strokeLayers), e.uniform1i(n.uStrokeMode, ke(o)), e.uniform1i(n.uStrokeOrient, H(o));
|
|
491
424
|
{
|
|
492
425
|
let t = o.lightDir ?? [
|
|
493
426
|
-.5,
|
|
494
427
|
.6,
|
|
495
428
|
.62
|
|
496
|
-
], r =
|
|
429
|
+
], r = De(o.lightColor);
|
|
497
430
|
e.uniform3f(n.uLightDir, t[0], t[1], t[2]), e.uniform3f(n.uLightColor, r[0], r[1], r[2]);
|
|
498
431
|
}
|
|
499
432
|
e.uniform1f(n.uWetEdge, o.wetEdge), e.uniform1f(n.uGranulation, o.granulation), e.uniform1f(n.uImpasto, o.impasto), e.uniform1f(n.uBrokenColor, o.brokenColor), e.uniform1f(n.uCanvasGrain, o.canvasGrain), e.uniform1f(n.uNucleiDrift, o.nucleiDrift), e.uniform1f(n.uPaletteDrift, o.paletteDrift), e.uniform1f(n.uBreathDepth, o.breathDepth), e.uniform1f(n.uBreathPeriod, o.breathPeriod), e.uniform1f(n.uSaturation, o.saturation), e.uniform1f(n.uPaperGrain, o.paperGrain), e.uniform1f(n.uAlpha, o.alpha);
|
|
@@ -501,8 +434,8 @@ function ze(e, t, n, r) {
|
|
|
501
434
|
}
|
|
502
435
|
//#endregion
|
|
503
436
|
//#region src/components/custom/aurora/composables/cursorModel.ts
|
|
504
|
-
var
|
|
505
|
-
function
|
|
437
|
+
var U = .22, je = .18, Me = .992, Ne = .96, W = .3;
|
|
438
|
+
function Pe() {
|
|
506
439
|
return {
|
|
507
440
|
x: .5,
|
|
508
441
|
y: .5,
|
|
@@ -516,22 +449,22 @@ function Ue() {
|
|
|
516
449
|
burst: 0
|
|
517
450
|
};
|
|
518
451
|
}
|
|
519
|
-
function
|
|
452
|
+
function Fe(e, t = 1) {
|
|
520
453
|
let n = Math.max(0, Math.min(1, t));
|
|
521
|
-
e.x += (e.targetX - e.x) *
|
|
454
|
+
e.x += (e.targetX - e.x) * U, e.y += (e.targetY - e.y) * U, e.strength += (e.targetStrength - e.strength) * je, e.targetStrength *= Me, e.velX *= (1 - W) * n, e.velY *= (1 - W) * n, e.burst *= Ne * n;
|
|
522
455
|
}
|
|
523
|
-
function
|
|
456
|
+
function Ie(e, t, n) {
|
|
524
457
|
let r = .12, i = Math.max(-r, Math.min(r, t)), a = Math.max(-r, Math.min(r, n));
|
|
525
|
-
e.velX += (i - e.velX) *
|
|
458
|
+
e.velX += (i - e.velX) * W, e.velY += (a - e.velY) * W;
|
|
526
459
|
let o = Math.hypot(i, a);
|
|
527
460
|
e.burst = Math.min(1, e.burst + o * 4);
|
|
528
461
|
}
|
|
529
|
-
function
|
|
462
|
+
function Le(e) {
|
|
530
463
|
return e.targetStrength > .001 || e.strength > .001 || Math.abs(e.x - e.targetX) > .001 || Math.abs(e.y - e.targetY) > .001;
|
|
531
464
|
}
|
|
532
465
|
//#endregion
|
|
533
466
|
//#region src/components/custom/aurora/composables/frameLoop.ts
|
|
534
|
-
function
|
|
467
|
+
function Re(e) {
|
|
535
468
|
let { gl: t, prog: n, uniforms: r, cursor: i, getConfig: a, getReducedMotion: o } = e, s = (e) => 1 - e;
|
|
536
469
|
function c() {
|
|
537
470
|
return +!o();
|
|
@@ -546,379 +479,103 @@ function Ge(e) {
|
|
|
546
479
|
function u() {
|
|
547
480
|
if (o()) return !1;
|
|
548
481
|
let e = a();
|
|
549
|
-
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 || e.interactivity?.light && i.burst > .001 ? !0 :
|
|
482
|
+
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 || e.interactivity?.light && i.burst > .001 ? !0 : Le(i);
|
|
550
483
|
}
|
|
551
484
|
return {
|
|
552
485
|
frame: (e) => {
|
|
553
|
-
|
|
486
|
+
Fe(i, c()), l(e);
|
|
554
487
|
},
|
|
555
488
|
needsAnimation: u
|
|
556
489
|
};
|
|
557
490
|
}
|
|
558
|
-
var Ke = "\nstruct VSOut {\n @builtin(position) pos: vec4f,\n @location(0) uv: vec2f,\n};\n\n@vertex\nfn vs_main(@builtin(vertex_index) vi: u32) -> VSOut {\n // Full-screen triangle (matches the WebGL2 [-1,-1, 3,-1, -1,3] quad).\n var p = array<vec2f, 3>(vec2f(-1.0, -1.0), vec2f(3.0, -1.0), vec2f(-1.0, 3.0));\n var out: VSOut;\n let xy = p[vi];\n out.pos = vec4f(xy, 0.0, 1.0);\n out.uv = 0.5 * (xy + vec2f(1.0));\n return out;\n}", qe = `
|
|
559
|
-
const PI: f32 = 3.141592653589793;
|
|
560
|
-
const W_LUMA: vec3f = vec3f(0.2126, 0.7152, 0.0722);
|
|
561
|
-
const MAX_NUCLEI: u32 = 6u;
|
|
562
|
-
const MAX_STOPS: u32 = 8u;
|
|
563
|
-
|
|
564
|
-
// The uniform struct — ONLY constant-indexed scalars (safe in the uniform address
|
|
565
|
-
// space). The five count/enum fields are f32 (AX.W07 1a): the WebGPU write path packs
|
|
566
|
-
// them as floats and the shader i32-casts at each use, so WGSL never reads a float
|
|
567
|
-
// bit-pattern as a raw i32. The dynamically-indexed arrays moved OUT to struct Field
|
|
568
|
-
// below (AX.W07 1b).
|
|
569
|
-
struct Uniforms {
|
|
570
|
-
time: f32,
|
|
571
|
-
stopCount: f32,
|
|
572
|
-
nucleiCount: f32,
|
|
573
|
-
softmaxBeta: f32,
|
|
574
|
-
valueVariance: f32,
|
|
575
|
-
warpAmount: f32,
|
|
576
|
-
warpScale: f32,
|
|
577
|
-
warpDrift: f32,
|
|
578
|
-
warpMode: f32,
|
|
579
|
-
noiseOctaves: f32,
|
|
580
|
-
medium: f32,
|
|
581
|
-
breathDepth: f32,
|
|
582
|
-
breathPeriod: f32,
|
|
583
|
-
saturation: f32,
|
|
584
|
-
paperGrain: f32,
|
|
585
|
-
alpha: f32,
|
|
586
|
-
// AX.W11 — the huePath enum (f32-packed, i32()-cast in samplePalette) carries the
|
|
587
|
-
// shared ramp's OKLab-rectangular-vs-OKLCh-hue-arc dispatch into the WebGPU twin so
|
|
588
|
-
// a huePath:'increasing' rainbow config arcs identically to the WebGL2 oracle. The
|
|
589
|
-
// CPU pad keeps the buffer vec4-aligned (WGPU_UNIFORM_FLOATS rounds to 20).
|
|
590
|
-
huePath: f32,
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
// The dynamically-indexed arrays — bound var<storage, read> (AX.W07 1b). A runtime
|
|
594
|
-
// palette/nuclei index into a var<uniform> array<vec4f> returns [0,0,0,0] on Metal
|
|
595
|
-
// (MSL forbids dynamic indexing of constant); storage is always-legal. The vec4 stride
|
|
596
|
-
// is std140-identical to the uniform layout, so the move is byte-exact.
|
|
597
|
-
struct Field {
|
|
598
|
-
palette: array<vec4f, 8>, // .xyz = linear-sRGB stop
|
|
599
|
-
nucleiPos: array<vec4f, 6>, // .xy pos, .z radius, .w paletteBias
|
|
600
|
-
nucleiMod: array<vec4f, 6>, // .x valueBias, .y elong, .z angle, .w driftRadius
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
@group(0) @binding(0) var<uniform> U: Uniforms;
|
|
604
|
-
@group(0) @binding(1) var<storage, read> F: Field;
|
|
605
|
-
|
|
606
|
-
${g}
|
|
607
|
-
${n}
|
|
608
|
-
${i}
|
|
609
|
-
${l}
|
|
610
|
-
|
|
611
|
-
// AX.W12 — the painterly-medium organic noise basis (PCG2D integer-bit hash + 2D
|
|
612
|
-
// simplex gradient noise), SPLICED from the shared procedural-color chunk — the EXACT
|
|
613
|
-
// twin of the GLSL leaf aurora.frag.ts splices, so the hash can NEVER drift between
|
|
614
|
-
// backends (proof:aurora-noise-hash-equivalence locks the twins to 1e-6). The WebGPU
|
|
615
|
-
// single-pass fs_main below stays the smooth pole (it runs no medium body — the
|
|
616
|
-
// painterly mediums are the W7c/W14 multi-pass), so the leaf is single-sourced HERE for
|
|
617
|
-
// the twin-equivalence contract; the W14 painterly passes consume it.
|
|
618
|
-
${a}
|
|
619
|
-
|
|
620
|
-
fn hash21(p0: vec2f) -> f32 {
|
|
621
|
-
var p = fract(p0 * vec2f(123.34, 456.21));
|
|
622
|
-
p = p + dot(p, p + 45.32);
|
|
623
|
-
return fract(p.x * p.y);
|
|
624
|
-
}
|
|
625
|
-
fn vnoise(p: vec2f) -> f32 {
|
|
626
|
-
let i = floor(p);
|
|
627
|
-
let f = fract(p);
|
|
628
|
-
let u = f * f * (3.0 - 2.0 * f);
|
|
629
|
-
let a = hash21(i);
|
|
630
|
-
let b = hash21(i + vec2f(1.0, 0.0));
|
|
631
|
-
let c = hash21(i + vec2f(0.0, 1.0));
|
|
632
|
-
let d = hash21(i + vec2f(1.0, 1.0));
|
|
633
|
-
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
|
|
634
|
-
}
|
|
635
|
-
fn fbm(p0: vec2f) -> f32 {
|
|
636
|
-
var v = 0.0;
|
|
637
|
-
var a = 0.5;
|
|
638
|
-
var p = p0;
|
|
639
|
-
let octaves = i32(U.noiseOctaves); // AX.W07 1a — i32()-cast the f32-packed count.
|
|
640
|
-
for (var i = 0; i < 5; i = i + 1) {
|
|
641
|
-
if (i >= octaves) { break; }
|
|
642
|
-
v = v + a * vnoise(p);
|
|
643
|
-
p = FBM_ROT * p * 2.02;
|
|
644
|
-
a = a * 0.5;
|
|
645
|
-
}
|
|
646
|
-
return v;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
fn samplePalette(id: f32) -> vec3f {
|
|
650
|
-
// AX.W11 — splice the SHARED samplePaletteRamp (the smoothstep ease + the OKLab-
|
|
651
|
-
// rectangular-vs-OKLCh-hue-arc huePath dispatch), the EXACT twin the GLSL oracle
|
|
652
|
-
// splices. The body here only selects the bracketing stop pair + the raw inter-stop
|
|
653
|
-
// t (the W07 storage-Field dynamic index), then hands them to the shared ramp.
|
|
654
|
-
let n = i32(U.stopCount); // AX.W07 1a — i32()-cast the f32-packed count.
|
|
655
|
-
if (n <= 1) { return F.palette[0].xyz; }
|
|
656
|
-
let t = clamp(id, 0.0, 1.0) * f32(n - 1);
|
|
657
|
-
let i0 = i32(floor(t));
|
|
658
|
-
let i1 = min(i0 + 1, n - 1);
|
|
659
|
-
let f = t - f32(i0);
|
|
660
|
-
// AX.W07 1b — read the palette from the storage Field (dynamic i0/i1 index);
|
|
661
|
-
// AX.W11 — i32()-cast the f32-packed huePath enum (parity with the count casts).
|
|
662
|
-
return samplePaletteRamp(F.palette[i0].xyz, F.palette[i1].xyz, f, i32(U.huePath));
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
fn domainWarp(p: vec2f, t: f32) -> vec2f {
|
|
666
|
-
let drift = t * U.warpDrift * 5.0;
|
|
667
|
-
let q = vec2f(
|
|
668
|
-
fbm(p * U.warpScale + vec2f(drift, 0.0)),
|
|
669
|
-
fbm(p * U.warpScale + vec2f(5.2, 1.3 + drift))
|
|
670
|
-
);
|
|
671
|
-
let r = vec2f(
|
|
672
|
-
fbm(p * U.warpScale + 4.0 * q + vec2f(1.7, 9.2)),
|
|
673
|
-
fbm(p * U.warpScale + 4.0 * q + vec2f(8.3, 2.8))
|
|
674
|
-
);
|
|
675
|
-
return p + U.warpAmount * r;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
fn nucleiField(p: vec2f, t: f32) -> vec2f {
|
|
679
|
-
// Returns (paletteId, valueMod) — softmax over the nuclei (isotropic; the WebGPU
|
|
680
|
-
// twin keeps the parity-floor isotropic Gaussian).
|
|
681
|
-
var accumId = 0.0;
|
|
682
|
-
var accumVal = 0.0;
|
|
683
|
-
var w = 0.0;
|
|
684
|
-
let n = i32(U.nucleiCount); // AX.W07 1a — i32()-cast the f32-packed count.
|
|
685
|
-
for (var i = 0; i < 6; i = i + 1) {
|
|
686
|
-
if (i >= n) { break; }
|
|
687
|
-
// AX.W07 1b — read the nuclei from the storage Field (dynamic i index).
|
|
688
|
-
let pos = F.nucleiPos[i].xy;
|
|
689
|
-
let rad = max(F.nucleiPos[i].z, 0.01);
|
|
690
|
-
let d2 = dot(p - pos, p - pos);
|
|
691
|
-
let wi = exp((-U.softmaxBeta * d2) / (rad * rad));
|
|
692
|
-
accumId = accumId + wi * F.nucleiPos[i].w;
|
|
693
|
-
accumVal = accumVal + wi * F.nucleiMod[i].x;
|
|
694
|
-
w = w + wi;
|
|
695
|
-
}
|
|
696
|
-
if (w < 1e-4) { return vec2f(0.5, 0.0); }
|
|
697
|
-
return vec2f(accumId / w, accumVal / w);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// ACES (Narkowicz) — matches the GLSL tonemap.
|
|
701
|
-
fn aces(x: vec3f) -> vec3f {
|
|
702
|
-
let a = 2.51; let b = 0.03; let c = 2.43; let d = 0.59; let e = 0.14;
|
|
703
|
-
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), vec3f(0.0), vec3f(1.0));
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
@fragment
|
|
707
|
-
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
708
|
-
let t = U.time;
|
|
709
|
-
let pw = domainWarp(uv, t);
|
|
710
|
-
let nf = nucleiField(pw, t);
|
|
711
|
-
var col = samplePalette(nf.x);
|
|
712
|
-
col = col * (1.0 + U.valueVariance * nf.y);
|
|
713
|
-
|
|
714
|
-
// Breath.
|
|
715
|
-
let breath = sin(t * 6.2831 / max(U.breathPeriod, 1.0));
|
|
716
|
-
col = col * (1.0 + U.breathDepth * breath * 0.5);
|
|
717
|
-
|
|
718
|
-
// (The WebGPU smooth pole; the painterly mediums run the W7c multi-pass passes.)
|
|
719
|
-
col = aces(col);
|
|
720
|
-
col = linearToSrgb(col); // the mandatory OETF (linear → display).
|
|
721
|
-
return vec4f(col * U.alpha, U.alpha); // premultiply AFTER the OETF (parity).
|
|
722
|
-
}`, Je = Ke + "\n" + qe;
|
|
723
|
-
//#endregion
|
|
724
|
-
//#region src/components/custom/aurora/composables/gpuRuntime.ts
|
|
725
|
-
function Ye(e) {
|
|
726
|
-
let { canvas: t, getConfig: n, cursor: r, getReducedMotion: i, frozenOffset: a } = e;
|
|
727
|
-
return function({ device: e, context: o, format: s }) {
|
|
728
|
-
let c = e.createShaderModule({ code: Je }), l = e.createRenderPipeline({
|
|
729
|
-
layout: "auto",
|
|
730
|
-
vertex: {
|
|
731
|
-
module: c,
|
|
732
|
-
entryPoint: "vs_main"
|
|
733
|
-
},
|
|
734
|
-
fragment: {
|
|
735
|
-
module: c,
|
|
736
|
-
entryPoint: "fs_main",
|
|
737
|
-
targets: [{
|
|
738
|
-
format: s,
|
|
739
|
-
blend: {
|
|
740
|
-
color: {
|
|
741
|
-
srcFactor: "one",
|
|
742
|
-
dstFactor: "one-minus-src-alpha"
|
|
743
|
-
},
|
|
744
|
-
alpha: {
|
|
745
|
-
srcFactor: "one",
|
|
746
|
-
dstFactor: "one-minus-src-alpha"
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}]
|
|
750
|
-
},
|
|
751
|
-
primitive: { topology: "triangle-list" }
|
|
752
|
-
}), u = new Float32Array(20), f = e.createBuffer({
|
|
753
|
-
size: u.byteLength,
|
|
754
|
-
usage: 72
|
|
755
|
-
}), p = new Float32Array(Le), m = e.createBuffer({
|
|
756
|
-
size: p.byteLength,
|
|
757
|
-
usage: 136
|
|
758
|
-
}), h = e.createBindGroup({
|
|
759
|
-
layout: l.getBindGroupLayout(0),
|
|
760
|
-
entries: [{
|
|
761
|
-
binding: 0,
|
|
762
|
-
resource: { buffer: f }
|
|
763
|
-
}, {
|
|
764
|
-
binding: 1,
|
|
765
|
-
resource: { buffer: m }
|
|
766
|
-
}]
|
|
767
|
-
});
|
|
768
|
-
function g() {
|
|
769
|
-
return +!i();
|
|
770
|
-
}
|
|
771
|
-
function _() {
|
|
772
|
-
let e = d(), n = t.getBoundingClientRect(), r = t.parentElement?.getBoundingClientRect(), i = n.width || r?.width || 1, a = n.height || r?.height || 1, o = Math.max(1, Math.round(i * e)), s = Math.max(1, Math.round(a * e));
|
|
773
|
-
(t.width !== o || t.height !== s) && (t.width = o, t.height = s);
|
|
774
|
-
}
|
|
775
|
-
function v(t) {
|
|
776
|
-
W(r, g()), Re(n(), t, u, p), e.queue.writeBuffer(f, 0, u), e.queue.writeBuffer(m, 0, p);
|
|
777
|
-
let i = e.createCommandEncoder(), a = o.getCurrentTexture().createView(), s = i.beginRenderPass({ colorAttachments: [{
|
|
778
|
-
view: a,
|
|
779
|
-
clearValue: {
|
|
780
|
-
r: 0,
|
|
781
|
-
g: 0,
|
|
782
|
-
b: 0,
|
|
783
|
-
a: 0
|
|
784
|
-
},
|
|
785
|
-
loadOp: "clear",
|
|
786
|
-
storeOp: "store"
|
|
787
|
-
}] });
|
|
788
|
-
s.setPipeline(l), s.setBindGroup(0, h), s.draw(3), s.end(), e.queue.submit([i.finish()]);
|
|
789
|
-
}
|
|
790
|
-
function y() {
|
|
791
|
-
if (i()) return !1;
|
|
792
|
-
let e = n();
|
|
793
|
-
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 || e.interactivity?.light && r.burst > .001 ? !0 : G(r);
|
|
794
|
-
}
|
|
795
|
-
return {
|
|
796
|
-
frame: v,
|
|
797
|
-
shouldContinue: y,
|
|
798
|
-
resize: _,
|
|
799
|
-
time: (e) => i() ? a : e,
|
|
800
|
-
teardown: () => {
|
|
801
|
-
f.destroy(), m.destroy();
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
491
|
//#endregion
|
|
807
492
|
//#region src/components/custom/aurora/composables/runtime.ts
|
|
808
|
-
function
|
|
493
|
+
function ze(e) {
|
|
809
494
|
return e.mode === "capture" ? !0 : e.initStrategy === "eager";
|
|
810
495
|
}
|
|
811
|
-
function
|
|
496
|
+
function Be(e) {
|
|
812
497
|
return typeof e.preserveDrawingBuffer == "boolean" ? e.preserveDrawingBuffer : e.mode === "capture";
|
|
813
498
|
}
|
|
814
|
-
function
|
|
815
|
-
let
|
|
816
|
-
|
|
817
|
-
mode: n.mode === "capture" ? "capture" : "live",
|
|
818
|
-
alphaMode: "premultiplied",
|
|
819
|
-
setup: Ye({
|
|
820
|
-
canvas: e,
|
|
821
|
-
getConfig: () => i,
|
|
822
|
-
cursor: o,
|
|
823
|
-
getReducedMotion: () => c.reducedMotion,
|
|
824
|
-
frozenOffset: a
|
|
825
|
-
})
|
|
826
|
-
}) : p(e, {
|
|
827
|
-
mode: n.mode === "capture" ? "capture" : "live",
|
|
499
|
+
function G(e, n, r = {}) {
|
|
500
|
+
let i = Be(r), a = n, o = Pe(), c = null, l = s(e, {
|
|
501
|
+
mode: r.mode === "capture" ? "capture" : "live",
|
|
828
502
|
contextAttrs: {
|
|
829
503
|
antialias: !1,
|
|
830
504
|
alpha: !0,
|
|
831
505
|
premultipliedAlpha: !0,
|
|
832
|
-
preserveDrawingBuffer:
|
|
506
|
+
preserveDrawingBuffer: i
|
|
833
507
|
},
|
|
834
|
-
setup: (
|
|
835
|
-
let { program:
|
|
836
|
-
function
|
|
837
|
-
let
|
|
838
|
-
(e.width !==
|
|
508
|
+
setup: (n) => {
|
|
509
|
+
let { program: r, vs: i, fs: s, uniforms: u, geometry: d } = N(n, ce, ge);
|
|
510
|
+
function f() {
|
|
511
|
+
let i = t(), a = e.getBoundingClientRect(), o = e.parentElement?.getBoundingClientRect(), s = a.width || o?.width || 1, c = a.height || o?.height || 1, l = Math.max(1, Math.round(s * i)), u = Math.max(1, Math.round(c * i));
|
|
512
|
+
(e.width !== l || e.height !== u) && (e.width = l, e.height = u), n.viewport(0, 0, l, u), n.useProgram(r);
|
|
839
513
|
}
|
|
840
|
-
let
|
|
841
|
-
gl:
|
|
842
|
-
prog:
|
|
514
|
+
let p = Ae(n, r, u, o), m = Re({
|
|
515
|
+
gl: n,
|
|
516
|
+
prog: r,
|
|
843
517
|
uniforms: u,
|
|
844
518
|
cursor: o,
|
|
845
|
-
getConfig: () =>
|
|
846
|
-
getReducedMotion: () =>
|
|
519
|
+
getConfig: () => a,
|
|
520
|
+
getReducedMotion: () => l.reducedMotion
|
|
847
521
|
});
|
|
848
|
-
return
|
|
849
|
-
|
|
850
|
-
},
|
|
851
|
-
|
|
522
|
+
return n.clearColor(0, 0, 0, 0), n.disable(n.DEPTH_TEST), n.enable(n.BLEND), n.blendFunc(n.ONE, n.ONE_MINUS_SRC_ALPHA), c = (e) => {
|
|
523
|
+
a = e, p(e);
|
|
524
|
+
}, c(a), requestAnimationFrame(() => {
|
|
525
|
+
f(), requestAnimationFrame(f);
|
|
852
526
|
}), {
|
|
853
|
-
frame:
|
|
854
|
-
shouldContinue:
|
|
855
|
-
resize:
|
|
856
|
-
time: (e) =>
|
|
527
|
+
frame: m.frame,
|
|
528
|
+
shouldContinue: m.needsAnimation,
|
|
529
|
+
resize: f,
|
|
530
|
+
time: (e) => l.reducedMotion ? 3.7 : e,
|
|
857
531
|
teardown: () => {
|
|
858
|
-
|
|
532
|
+
n.deleteProgram(r), n.deleteShader(i), n.deleteShader(s), n.deleteBuffer(d.buf), n.deleteVertexArray(d.vao);
|
|
859
533
|
}
|
|
860
534
|
};
|
|
861
535
|
}
|
|
862
536
|
});
|
|
863
|
-
function
|
|
864
|
-
o.targetX = e, o.targetY = t, o.targetStrength = n,
|
|
537
|
+
function u(e, t, n = .8) {
|
|
538
|
+
o.targetX = e, o.targetY = t, o.targetStrength = n, l.wake();
|
|
865
539
|
}
|
|
866
|
-
function
|
|
867
|
-
|
|
540
|
+
function d(e, t) {
|
|
541
|
+
l.reducedMotion || (Ie(o, e, t), l.wake());
|
|
868
542
|
}
|
|
869
543
|
function f() {
|
|
870
|
-
o.targetStrength = 0,
|
|
544
|
+
o.targetStrength = 0, l.wake();
|
|
871
545
|
}
|
|
872
|
-
function
|
|
873
|
-
o.radius = e,
|
|
546
|
+
function p(e) {
|
|
547
|
+
o.radius = e, l.wake();
|
|
874
548
|
}
|
|
875
|
-
function
|
|
876
|
-
|
|
549
|
+
function m(e) {
|
|
550
|
+
l.wake();
|
|
877
551
|
}
|
|
878
|
-
return
|
|
879
|
-
arm: () =>
|
|
552
|
+
return r.mode !== "capture" && ze(r) && l.arm(), {
|
|
553
|
+
arm: () => l.arm(),
|
|
880
554
|
update: (e) => {
|
|
881
|
-
|
|
555
|
+
a = e, c?.(e), l.wake();
|
|
882
556
|
},
|
|
883
|
-
setCursor:
|
|
557
|
+
setCursor: u,
|
|
884
558
|
clearCursor: f,
|
|
885
|
-
setCursorRadius:
|
|
886
|
-
setReducedMotion:
|
|
887
|
-
injectCursorVelocity:
|
|
559
|
+
setCursorRadius: p,
|
|
560
|
+
setReducedMotion: m,
|
|
561
|
+
injectCursorVelocity: d,
|
|
888
562
|
get reducedMotion() {
|
|
889
|
-
return
|
|
563
|
+
return l.reducedMotion;
|
|
890
564
|
},
|
|
891
|
-
pause: (e = "manual") =>
|
|
892
|
-
resume: (e = "manual") =>
|
|
893
|
-
renderAt: (e) =>
|
|
894
|
-
dispose: () =>
|
|
565
|
+
pause: (e = "manual") => l.suspend(e),
|
|
566
|
+
resume: (e = "manual") => l.resume(e),
|
|
567
|
+
renderAt: (e) => l.renderAt(e),
|
|
568
|
+
dispose: () => l.dispose()
|
|
895
569
|
};
|
|
896
570
|
}
|
|
897
571
|
//#endregion
|
|
898
572
|
//#region src/components/custom/aurora/composables/configSource.ts
|
|
899
|
-
function
|
|
573
|
+
function K(e) {
|
|
900
574
|
return typeof e == "function" ? e : e && typeof e == "object" && "value" in e ? () => e.value : () => e;
|
|
901
575
|
}
|
|
902
576
|
//#endregion
|
|
903
|
-
//#region src/components/custom/aurora/constants/renderMode.ts
|
|
904
|
-
function J(e) {
|
|
905
|
-
if (e !== "auto") return e;
|
|
906
|
-
if (typeof navigator > "u" || typeof window > "u") return "webgl";
|
|
907
|
-
let t = typeof navigator.hardwareConcurrency == "number" && navigator.hardwareConcurrency <= 4, n = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, r = navigator.connection?.saveData === !0;
|
|
908
|
-
return t || n || r ? "css" : "webgl";
|
|
909
|
-
}
|
|
910
|
-
async function Qe(e) {
|
|
911
|
-
return J(e) === "css" ? {
|
|
912
|
-
substrate: "css",
|
|
913
|
-
device: null
|
|
914
|
-
} : {
|
|
915
|
-
substrate: "webgl",
|
|
916
|
-
device: null
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
//#endregion
|
|
920
577
|
//#region src/components/custom/aurora/composables/useAurora.ts
|
|
921
|
-
function
|
|
578
|
+
function Ve(e) {
|
|
922
579
|
if (typeof window > "u") return () => {};
|
|
923
580
|
if (typeof window.requestIdleCallback == "function") {
|
|
924
581
|
let t = window.requestIdleCallback(() => e(), { timeout: 2e3 });
|
|
@@ -935,8 +592,8 @@ function $e(e) {
|
|
|
935
592
|
r = !0, cancelAnimationFrame(t), n !== void 0 && clearTimeout(n);
|
|
936
593
|
};
|
|
937
594
|
}
|
|
938
|
-
function
|
|
939
|
-
let i =
|
|
595
|
+
function q(e, t, n = {}, r = {}) {
|
|
596
|
+
let i = K(t), a = r.renderMode === "css", o = null, s = null, c = null, l = null, u = null, d = null, f = null, p = !1, m = D(!1), h = n.mode === "capture" || n.initStrategy === "eager";
|
|
940
597
|
function g() {
|
|
941
598
|
f && o && o.setReducedMotion(f.matches);
|
|
942
599
|
}
|
|
@@ -957,7 +614,7 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
957
614
|
_(e);
|
|
958
615
|
return;
|
|
959
616
|
}
|
|
960
|
-
m.value = !0, f = window.matchMedia("(prefers-reduced-motion: reduce)"), f.addEventListener("change", g), s =
|
|
617
|
+
m.value = !0, f = window.matchMedia("(prefers-reduced-motion: reduce)"), f.addEventListener("change", g), s = k(i, (e) => o?.update(e), { deep: !0 }), i().interactivity?.scroll && e.value && (l = k(te({
|
|
961
618
|
target: e,
|
|
962
619
|
trackExit: !0
|
|
963
620
|
}), (e) => {
|
|
@@ -965,11 +622,11 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
965
622
|
}));
|
|
966
623
|
}
|
|
967
624
|
}
|
|
968
|
-
return
|
|
625
|
+
return T(() => {
|
|
969
626
|
let t = e.value;
|
|
970
627
|
if (!t || a) return;
|
|
971
628
|
try {
|
|
972
|
-
o =
|
|
629
|
+
o = G(t, i(), {
|
|
973
630
|
initStrategy: "deferred",
|
|
974
631
|
...n
|
|
975
632
|
});
|
|
@@ -981,25 +638,17 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
981
638
|
v();
|
|
982
639
|
return;
|
|
983
640
|
}
|
|
984
|
-
d =
|
|
641
|
+
d = ee(e, {
|
|
985
642
|
pause: () => o?.pause("off-screen"),
|
|
986
643
|
resume: () => o?.resume("off-screen")
|
|
987
644
|
}, { pauseWhenHidden: !1 });
|
|
988
645
|
let r = d.isIntersecting;
|
|
989
|
-
c =
|
|
990
|
-
!
|
|
991
|
-
u = null, r.value &&
|
|
992
|
-
p || (t === "webgpu" && a && o && e.value && (o.dispose(), o = K(e.value, i(), {
|
|
993
|
-
initStrategy: "deferred",
|
|
994
|
-
...n,
|
|
995
|
-
gpuDevice: a
|
|
996
|
-
})), r.value && v());
|
|
997
|
-
}).catch(() => {
|
|
998
|
-
r.value && v();
|
|
999
|
-
});
|
|
646
|
+
c = k(r, (e) => {
|
|
647
|
+
!e || p || u || (u = Ve(() => {
|
|
648
|
+
u = null, r.value && v();
|
|
1000
649
|
}));
|
|
1001
650
|
}, { immediate: !0 });
|
|
1002
|
-
}),
|
|
651
|
+
}), w(() => {
|
|
1003
652
|
u?.(), c?.(), s?.(), l?.(), d?.dispose(), f?.removeEventListener("change", g), o?.dispose(), o = null;
|
|
1004
653
|
}), {
|
|
1005
654
|
setCursor: (e, t, n) => o?.setCursor(e, t, n),
|
|
@@ -1009,25 +658,33 @@ function Y(e, t, n = {}, r = {}) {
|
|
|
1009
658
|
renderAt: (e) => o?.renderAt(e),
|
|
1010
659
|
pause: () => o?.pause(),
|
|
1011
660
|
resume: () => o?.resume(),
|
|
1012
|
-
isArmed:
|
|
661
|
+
isArmed: E(m)
|
|
1013
662
|
};
|
|
1014
663
|
}
|
|
1015
664
|
//#endregion
|
|
665
|
+
//#region src/components/custom/aurora/constants/renderMode.ts
|
|
666
|
+
function J(e) {
|
|
667
|
+
if (e !== "auto") return e;
|
|
668
|
+
if (typeof navigator > "u" || typeof window > "u") return "webgl";
|
|
669
|
+
let t = typeof navigator.hardwareConcurrency == "number" && navigator.hardwareConcurrency <= 4, n = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, r = navigator.connection?.saveData === !0;
|
|
670
|
+
return t || n || r ? "css" : "webgl";
|
|
671
|
+
}
|
|
672
|
+
//#endregion
|
|
1016
673
|
//#region src/components/custom/aurora/Aurora.vue
|
|
1017
|
-
var
|
|
674
|
+
var He = /* @__PURE__ */ e(/* @__PURE__ */ ne({
|
|
1018
675
|
__name: "Aurora",
|
|
1019
676
|
props: {
|
|
1020
|
-
config: { default: () =>
|
|
677
|
+
config: { default: () => p },
|
|
1021
678
|
runtimeOptions: {},
|
|
1022
679
|
onInitError: {},
|
|
1023
680
|
renderMode: { default: "auto" },
|
|
1024
681
|
opacityCeiling: { default: 1 }
|
|
1025
682
|
},
|
|
1026
683
|
setup(e, { expose: t }) {
|
|
1027
|
-
let n = e, r = J(n.renderMode), i =
|
|
684
|
+
let n = e, r = J(n.renderMode), i = b(() => Math.max(0, Math.min(1, n.opacityCeiling))), a = D(null), o = q(a, () => n.config, b(() => ({
|
|
1028
685
|
...n.runtimeOptions ?? {},
|
|
1029
686
|
...n.onInitError ? { onInitError: n.onInitError } : {}
|
|
1030
|
-
})).value, { renderMode: r }), s =
|
|
687
|
+
})).value, { renderMode: r }), s = b(() => F(n.config.palette));
|
|
1031
688
|
return t({
|
|
1032
689
|
config: n.config,
|
|
1033
690
|
canvasRef: a,
|
|
@@ -1039,25 +696,25 @@ var et = /* @__PURE__ */ e(/* @__PURE__ */ ae({
|
|
|
1039
696
|
pause: o.pause,
|
|
1040
697
|
resume: o.resume,
|
|
1041
698
|
isArmed: o.isArmed
|
|
1042
|
-
}), (e, t) => (
|
|
699
|
+
}), (e, t) => (ie(), x("div", {
|
|
1043
700
|
class: "aurora-root block h-full w-full overflow-hidden",
|
|
1044
|
-
style:
|
|
1045
|
-
}, [
|
|
701
|
+
style: C({ "--aurora-opacity-ceiling": i.value })
|
|
702
|
+
}, [S("div", {
|
|
1046
703
|
class: "aurora-placeholder h-full w-full",
|
|
1047
704
|
"aria-hidden": "true",
|
|
1048
|
-
style:
|
|
1049
|
-
}, null, 4),
|
|
705
|
+
style: C({ backgroundImage: s.value })
|
|
706
|
+
}, null, 4), S("canvas", {
|
|
1050
707
|
ref_key: "canvasRef",
|
|
1051
708
|
ref: a,
|
|
1052
709
|
"aria-hidden": "true",
|
|
1053
|
-
class:
|
|
710
|
+
class: re(["aurora-canvas block h-full w-full", { "aurora-canvas--armed": O(o).isArmed.value }])
|
|
1054
711
|
}, null, 2)], 4));
|
|
1055
712
|
}
|
|
1056
|
-
}), [["__scopeId", "data-v-
|
|
713
|
+
}), [["__scopeId", "data-v-b51a5fc3"]]);
|
|
1057
714
|
//#endregion
|
|
1058
715
|
//#region src/components/custom/aurora/composables/useCursorInteraction.ts
|
|
1059
|
-
function
|
|
1060
|
-
let r =
|
|
716
|
+
function Ue(e, t, n) {
|
|
717
|
+
let r = K(t), i = n.hitFraction ?? .35, a = null, o = null, s = null, c = null;
|
|
1061
718
|
function l(e, t) {
|
|
1062
719
|
let n = t.getBoundingClientRect();
|
|
1063
720
|
return {
|
|
@@ -1144,21 +801,21 @@ function tt(e, t, n) {
|
|
|
1144
801
|
}, a = n.getBoundingClientRect(), o = d((i.clientX - a.left) / Math.max(a.width, 1), (i.clientY - a.top) / Math.max(a.height, 1));
|
|
1145
802
|
o !== null && r().nuclei.length > 1 && (r().nuclei.splice(o, 1), t.preventDefault());
|
|
1146
803
|
}
|
|
1147
|
-
return
|
|
804
|
+
return T(() => {
|
|
1148
805
|
let t = e.value;
|
|
1149
806
|
t && (t.addEventListener("pointermove", h), t.addEventListener("pointerleave", g), t.addEventListener("pointerdown", _), t.addEventListener("pointerup", v), t.addEventListener("pointercancel", v), t.addEventListener("contextmenu", y));
|
|
1150
|
-
}),
|
|
807
|
+
}), w(() => {
|
|
1151
808
|
let t = e.value;
|
|
1152
809
|
t && (t.removeEventListener("pointermove", h), t.removeEventListener("pointerleave", g), t.removeEventListener("pointerdown", _), t.removeEventListener("pointerup", v), t.removeEventListener("pointercancel", v), t.removeEventListener("contextmenu", y));
|
|
1153
810
|
}), { isDragging: () => a };
|
|
1154
811
|
}
|
|
1155
812
|
//#endregion
|
|
1156
813
|
//#region src/components/custom/aurora/composables/atoms.ts
|
|
1157
|
-
var
|
|
1158
|
-
function
|
|
814
|
+
var Y = {};
|
|
815
|
+
function X(e, t, n) {
|
|
1159
816
|
return e + (t - e) * n;
|
|
1160
817
|
}
|
|
1161
|
-
var
|
|
818
|
+
var Z = {
|
|
1162
819
|
saturation: {
|
|
1163
820
|
calm: .85,
|
|
1164
821
|
vivid: 1.2
|
|
@@ -1175,7 +832,7 @@ var Q = {
|
|
|
1175
832
|
calm: .15,
|
|
1176
833
|
vivid: .5
|
|
1177
834
|
}
|
|
1178
|
-
},
|
|
835
|
+
}, We = {
|
|
1179
836
|
still: {
|
|
1180
837
|
nucleiDrift: 0,
|
|
1181
838
|
paletteDrift: 0,
|
|
@@ -1194,9 +851,9 @@ var Q = {
|
|
|
1194
851
|
warpDrift: .008,
|
|
1195
852
|
breathDepth: .05
|
|
1196
853
|
}
|
|
1197
|
-
},
|
|
1198
|
-
function
|
|
1199
|
-
let
|
|
854
|
+
}, Ge = .61803398875;
|
|
855
|
+
function Q(e, t = "composed") {
|
|
856
|
+
let n = Math.max(1, Math.min(6, Math.round(e))), i = [
|
|
1200
857
|
[.33, .33],
|
|
1201
858
|
[.67, .67],
|
|
1202
859
|
[.67, .33],
|
|
@@ -1204,42 +861,42 @@ function $(e, n = "composed") {
|
|
|
1204
861
|
[.5, .5],
|
|
1205
862
|
[.5, .33]
|
|
1206
863
|
], a = (e) => {
|
|
1207
|
-
switch (
|
|
864
|
+
switch (t) {
|
|
1208
865
|
case "scattered": {
|
|
1209
|
-
let
|
|
1210
|
-
return [
|
|
866
|
+
let t = e * Ge * Math.PI * 2, i = .12 + .3 * Math.sqrt((e + .5) / n);
|
|
867
|
+
return [r(.5 + i * Math.cos(t), .1, .9), r(.5 + i * Math.sin(t), .1, .9)];
|
|
1211
868
|
}
|
|
1212
869
|
case "centred": {
|
|
1213
|
-
if (
|
|
1214
|
-
let t = e /
|
|
1215
|
-
return [.5 +
|
|
870
|
+
if (n === 1) return [.5, .5];
|
|
871
|
+
let t = e / n * Math.PI * 2, r = .12;
|
|
872
|
+
return [.5 + r * Math.cos(t), .5 + r * Math.sin(t)];
|
|
1216
873
|
}
|
|
1217
874
|
default: return i[e % i.length];
|
|
1218
875
|
}
|
|
1219
876
|
};
|
|
1220
|
-
return Array.from({ length:
|
|
1221
|
-
let [
|
|
877
|
+
return Array.from({ length: n }, (e, t) => {
|
|
878
|
+
let [r, i] = a(t);
|
|
1222
879
|
return {
|
|
1223
|
-
x:
|
|
880
|
+
x: r,
|
|
1224
881
|
y: i,
|
|
1225
882
|
radius: .5,
|
|
1226
|
-
paletteBias:
|
|
883
|
+
paletteBias: n === 1 ? 0 : t / (n - 1),
|
|
1227
884
|
valueBias: (t % 2 == 0 ? 1 : -1) * .05,
|
|
1228
885
|
driftRadius: .045,
|
|
1229
886
|
driftPhase: t * 2.4 % (Math.PI * 2)
|
|
1230
887
|
};
|
|
1231
888
|
});
|
|
1232
889
|
}
|
|
1233
|
-
function
|
|
890
|
+
function Ke(e) {
|
|
1234
891
|
return e < .4 ? "fbm" : e < .75 ? "hybrid" : "cellular";
|
|
1235
892
|
}
|
|
1236
|
-
function
|
|
1237
|
-
let
|
|
1238
|
-
e.warpAmount =
|
|
893
|
+
function qe(e, t) {
|
|
894
|
+
let n = r(t, 0, 1);
|
|
895
|
+
e.warpAmount = r(X(.2, .6, n), 0, .6), e.warpScale = r(X(1, 2.6, n), .5, 3), e.warpMode = Ke(n), e.noiseOctaves = n < .5 ? 3 : n < .85 ? 4 : 5;
|
|
1239
896
|
}
|
|
1240
|
-
function
|
|
1241
|
-
let i =
|
|
1242
|
-
switch (
|
|
897
|
+
function Je(e, t, n) {
|
|
898
|
+
let i = r(n, 0, 1);
|
|
899
|
+
switch (t) {
|
|
1243
900
|
case "watercolor":
|
|
1244
901
|
e.wetEdge = i, e.granulation = i * .8;
|
|
1245
902
|
break;
|
|
@@ -1256,22 +913,56 @@ function ot(e, n, r) {
|
|
|
1256
913
|
break;
|
|
1257
914
|
}
|
|
1258
915
|
}
|
|
1259
|
-
function
|
|
916
|
+
function Ye(e = Y, t = p) {
|
|
1260
917
|
let n = {
|
|
1261
|
-
...
|
|
1262
|
-
palette:
|
|
1263
|
-
nuclei:
|
|
1264
|
-
flow: { ...
|
|
1265
|
-
},
|
|
1266
|
-
if (e.seed !== void 0 && (n.palette =
|
|
918
|
+
...t,
|
|
919
|
+
palette: t.palette.map((e) => ({ ...e })),
|
|
920
|
+
nuclei: t.nuclei.map((e) => ({ ...e })),
|
|
921
|
+
flow: { ...t.flow }
|
|
922
|
+
}, i = e.colorEnergy === void 0 ? void 0 : r(e.colorEnergy, 0, 1);
|
|
923
|
+
if (e.seed !== void 0 && (n.palette = R(e.seed, {
|
|
1267
924
|
harmony: e.harmony ?? "analogous",
|
|
1268
925
|
stopCount: 4,
|
|
1269
|
-
temperatureShift:
|
|
1270
|
-
})),
|
|
1271
|
-
let
|
|
1272
|
-
n.nucleiDrift = t
|
|
926
|
+
temperatureShift: i === void 0 ? 0 : X(Z.temperatureShift.calm, Z.temperatureShift.vivid, i)
|
|
927
|
+
})), i !== void 0 && (n.saturation = r(X(Z.saturation.calm, Z.saturation.vivid, i), .6, 1.3), n.valueVariance = r(X(Z.valueVariance.calm, Z.valueVariance.vivid, i), 0, .3), n.breathDepth = r(X(Z.breathDepth.calm, Z.breathDepth.vivid, i), 0, .15)), e.zones !== void 0 && (n.nuclei = Q(e.zones.count, e.zones.arrangement ?? "composed")), e.noise !== void 0 && qe(n, e.noise), e.medium !== void 0 && (n.medium = e.medium.kind, (e.medium.kind === "vangogh" || e.medium.kind === "oil-pastel") && (n.strokeOrient = "tensor"), e.medium.kind !== "smooth" && e.medium.amount !== void 0 && Je(n, e.medium.kind, e.medium.amount)), e.motion !== void 0) {
|
|
928
|
+
let t = We[e.motion];
|
|
929
|
+
n.nucleiDrift = r(t.nucleiDrift, 0, .05), n.paletteDrift = r(t.paletteDrift, 0, .04), n.warpDrift = r(t.warpDrift, 0, .015), n.breathDepth = r(e.motion === "still" ? 0 : Math.max(n.breathDepth, t.breathDepth), 0, .15);
|
|
1273
930
|
}
|
|
1274
931
|
return e.interactivity !== void 0 && (n.interactivity = { ...e.interactivity }), n;
|
|
1275
932
|
}
|
|
933
|
+
function $(e, t, n) {
|
|
934
|
+
return n === t ? 0 : r((e - t) / (n - t), 0, 1);
|
|
935
|
+
}
|
|
936
|
+
function Xe(e) {
|
|
937
|
+
return e.nucleiDrift + e.paletteDrift + e.warpDrift > .001 ? "drifting" : e.breathDepth > .001 ? "breathing" : "still";
|
|
938
|
+
}
|
|
939
|
+
function Ze(e, t) {
|
|
940
|
+
switch (t) {
|
|
941
|
+
case "watercolor": return r(e.wetEdge, 0, 1);
|
|
942
|
+
case "oil":
|
|
943
|
+
case "vangogh":
|
|
944
|
+
case "pastel":
|
|
945
|
+
case "oil-pastel":
|
|
946
|
+
case "crayon": return r(e.strokeAmount, 0, 1);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function Qe(e) {
|
|
950
|
+
let t = e.medium, n = t === "smooth" ? { kind: t } : {
|
|
951
|
+
kind: t,
|
|
952
|
+
amount: Ze(e, t)
|
|
953
|
+
};
|
|
954
|
+
return {
|
|
955
|
+
seed: e.palette.length > 0 ? v(e.palette[0]) : "#3a7bd5",
|
|
956
|
+
harmony: "analogous",
|
|
957
|
+
colorEnergy: $(e.saturation, Z.saturation.calm, Z.saturation.vivid),
|
|
958
|
+
zones: {
|
|
959
|
+
count: Math.max(1, Math.min(6, e.nuclei.length)),
|
|
960
|
+
arrangement: "composed"
|
|
961
|
+
},
|
|
962
|
+
noise: $(e.warpAmount, .2, .6),
|
|
963
|
+
medium: n,
|
|
964
|
+
motion: Xe(e)
|
|
965
|
+
};
|
|
966
|
+
}
|
|
1276
967
|
//#endregion
|
|
1277
|
-
export {
|
|
968
|
+
export { He as Aurora, Y as DEFAULT_ATOMS, p as DEFAULT_AURORA_CONFIG, d as MAX_NUCLEI, f as MAX_STOPS, Qe as configToAtoms, G as createAurora, y as cssToOklch, R as deriveAurora, P as flattenPalette, I as hexToOklchStop, Q as nucleiPrior, v as oklchStopToHex, h as oklchToLinear, F as paletteToCssGradient, Ye as resolveAtoms, J as resolveRenderMode, q as useAurora, Ue as useCursorInteraction };
|