@mkbabb/glass-ui 4.0.0 → 4.1.0
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/README.md +3 -1
- package/dist/CardAction-8whJrLWt.js +268 -0
- package/dist/{CommandShortcut-DdtWXxOK.js → CommandShortcut-D3yxgHNn.js} +25 -14
- package/dist/ConfiguratorRow-CaP7U3ZA.js +143 -0
- package/dist/ContextMenuContent-B3ZsheLV.js +90 -0
- package/dist/{ContextMenuSubContent-B0Vs6atR.js → ContextMenuSubContent-DDRID3qC.js} +28 -33
- package/dist/{DataTable-C464Zbqd.js → DataTable-Bc9kUtu_.js} +4 -4
- package/dist/{DialogContent-DDE6pQBU.js → DialogContent-6JtTB5x2.js} +11 -8
- package/dist/DialogFooter-9phqcRIS.js +80 -0
- package/dist/DialogScrollContent-TTuovQst.js +93 -0
- package/dist/{FadingScroll-DwNnvKMs.js → FadingScroll-DLRbH5Xr.js} +1 -1
- package/dist/HoverCardContent-Bel1gdLZ.js +88 -0
- package/dist/{HoverPopover-Dpzwvc4t.js → HoverPopover-BcIxvyqZ.js} +2 -2
- package/dist/{IconChip-BDw1j5mu.js → IconChip-DhbdGdFQ.js} +2 -1
- package/dist/{IconTooltip-DSjasZIt.js → IconTooltip-B0zimd2H.js} +1 -1
- package/dist/Input-Cg9DF62r.js +57 -0
- package/dist/{MetricBadge-BpC0R_Ec.js → MetricBadge-RHdBP72w.js} +1 -1
- package/dist/Notification-CphK7AAm.js +43 -0
- package/dist/NumberFieldContent-D8cXeyO4.js +140 -0
- package/dist/PagerDots-Cjx96la-.js +98 -0
- package/dist/{PopoverContent-BTorlp--.js → PopoverContent-DL7E6vJP.js} +4 -4
- package/dist/{Progress-hAT4gqGH.js → Progress-CnqB7gLm.js} +4 -4
- package/dist/{ScrollingText-CUVFTWk2.js → ScrollingText-CTZbA_cG.js} +2 -2
- package/dist/{SelectScrollDownButton-C1jb3b3K.js → SelectScrollDownButton-DAKCBEdW.js} +65 -61
- package/dist/{SelectSeparator-DK2y1Bun.js → SelectSeparator-C2UGOkXF.js} +1 -1
- package/dist/Separator-DQcwC2TR.js +44 -0
- package/dist/Switch-B8RscmRu.js +49 -0
- package/dist/Toaster-D9qIHjBI.js +274 -0
- package/dist/ToggleGroupItem-BLtr3TJq.js +170 -0
- package/dist/TooltipProvider-BJ_Y5EGX.js +109 -0
- package/dist/animated-digit.js +2 -2
- package/dist/api/index.d.ts +21 -33
- package/dist/api/types-extra.d.ts +37 -0
- package/dist/api.js +1 -1
- package/dist/aurora.js +1231 -260
- package/dist/badge.js +1 -1
- package/dist/border-progress.d.ts +1 -0
- package/dist/border-progress.js +98 -0
- package/dist/button-5dY1Dvhd.js +125 -0
- package/dist/button.js +1 -1
- package/dist/canvas.js +2 -3
- package/dist/card.js +2 -2
- package/dist/carousel.js +93 -110
- package/dist/collapsible.js +1 -1
- package/dist/color-Cs0-oxYL.js +116 -0
- package/dist/color.js +2 -2
- package/dist/command.js +1 -1
- package/dist/compile-nZ1xVYTp.js +19 -0
- package/dist/completion-seal.d.ts +1 -0
- package/dist/completion-seal.js +89 -0
- package/dist/components/custom/aurora/Aurora.vue.d.ts +10 -5
- package/dist/components/custom/aurora/composables/atoms-fields.d.ts +39 -0
- package/dist/components/custom/aurora/composables/auroraFallbackGround.d.ts +108 -0
- package/dist/components/custom/aurora/composables/color.d.ts +13 -0
- package/dist/components/custom/aurora/composables/frameLoop.d.ts +9 -0
- package/dist/components/custom/aurora/composables/runtime.d.ts +31 -0
- package/dist/components/custom/aurora/composables/uniformBridge.d.ts +5 -1
- package/dist/components/custom/aurora/composables/uniformBridgeWGPU.d.ts +60 -0
- package/dist/components/custom/aurora/composables/wgpuSetup.d.ts +37 -0
- package/dist/components/custom/aurora/constants/budget.d.ts +21 -0
- package/dist/components/custom/aurora/constants/presets.d.ts +20 -2
- package/dist/components/custom/aurora/constants/renderMode.d.ts +77 -18
- package/dist/components/custom/aurora/constants/shaders/aurora-mediums.wgsl.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/aurora.wgsl.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/oil-modes.glsl.d.ts +1 -0
- package/dist/components/custom/aurora/constants/shaders/procedural-color.wgsl.d.ts +4 -0
- package/dist/components/custom/aurora/index.d.ts +2 -1
- package/dist/components/custom/border-progress/BorderProgress.vue.d.ts +46 -0
- package/dist/components/custom/border-progress/composables/spectrum-walk.d.ts +25 -0
- package/dist/components/custom/border-progress/composables/useBorderSpectrum.d.ts +18 -0
- package/dist/components/custom/border-progress/constants.d.ts +59 -0
- package/dist/components/custom/border-progress/index.d.ts +4 -0
- package/dist/components/custom/completion-seal/CompletionSeal.vue.d.ts +21 -0
- package/dist/components/custom/completion-seal/composables/useCompletionSeal.d.ts +37 -0
- package/dist/components/custom/completion-seal/constants.d.ts +46 -0
- package/dist/components/custom/completion-seal/index.d.ts +4 -0
- package/dist/components/custom/concentric/Concentric.vue.d.ts +39 -0
- package/dist/components/custom/concentric/composables/concentricGLSetup.d.ts +18 -0
- package/dist/components/custom/concentric/composables/concentricWGPUSetup.d.ts +22 -0
- package/dist/components/custom/concentric/composables/ringField.d.ts +85 -0
- package/dist/components/custom/concentric/composables/uniformBridgeWGPU.d.ts +14 -0
- package/dist/components/custom/concentric/composables/useConcentric.d.ts +35 -0
- package/dist/components/custom/concentric/constants.d.ts +67 -0
- package/dist/components/custom/concentric/index.d.ts +5 -0
- package/dist/components/custom/concentric/shaders/concentric.glsl.d.ts +4 -0
- package/dist/components/custom/concentric/shaders/concentric.wgsl.d.ts +1 -0
- package/dist/components/custom/confirm-dialog/ConfirmDialog.vue.d.ts +3 -3
- package/dist/components/custom/constellation/Constellation.vue.d.ts +5 -4
- package/dist/components/custom/constellation/composables/constellationGLSetup.d.ts +10 -0
- package/dist/components/custom/constellation/composables/constellationWGPUSetup.d.ts +19 -0
- package/dist/components/custom/constellation/composables/uniformBridgeWGPU.d.ts +66 -0
- package/dist/components/custom/constellation/composables/useConstellation.d.ts +3 -10
- package/dist/components/custom/constellation/constants.d.ts +33 -0
- package/dist/components/custom/constellation/constellationField.d.ts +31 -1
- package/dist/components/custom/constellation/constellationInteraction.d.ts +23 -14
- package/dist/components/custom/constellation/constellationRender.d.ts +25 -0
- package/dist/components/custom/constellation/constellationTypes.d.ts +38 -0
- package/dist/components/custom/constellation/constellationWell.d.ts +15 -0
- package/dist/components/custom/constellation/index.d.ts +5 -5
- package/dist/components/custom/constellation/shaders/constellation-lines.glsl.d.ts +2 -0
- package/dist/components/custom/constellation/shaders/constellation-lines.wgsl.d.ts +1 -0
- package/dist/components/custom/constellation/shaders/constellation-points.glsl.d.ts +2 -0
- package/dist/components/custom/constellation/shaders/constellation-points.wgsl.d.ts +1 -0
- package/dist/components/custom/deck/DeckPager.vue.d.ts +29 -0
- package/dist/components/custom/deck/composables/useDeck.d.ts +27 -0
- package/dist/components/custom/deck/composables/useDeckKeyboard.d.ts +25 -0
- package/dist/components/custom/deck/composables/useDeckSpring.d.ts +22 -0
- package/dist/components/custom/deck/constants.d.ts +14 -0
- package/dist/components/custom/deck/index.d.ts +8 -0
- package/dist/components/custom/dock/DockIconButton.vue.d.ts +25 -4
- package/dist/components/custom/dock/DockLayerGroup.vue.d.ts +10 -2
- package/dist/components/custom/dock/DockStack.vue.d.ts +65 -0
- package/dist/components/custom/dock/GlassDock.vue.d.ts +4 -2
- package/dist/components/custom/dock/composables/dockMorphMeasure.d.ts +155 -0
- package/dist/components/custom/dock/composables/index.d.ts +2 -0
- package/dist/components/custom/dock/composables/useDockSearch.d.ts +85 -0
- package/dist/components/custom/dock/composables/useDockShellProps.d.ts +11 -0
- package/dist/components/custom/dock/composables/useLayerTransition.d.ts +13 -0
- package/dist/components/custom/dock/constants.d.ts +18 -14
- package/dist/components/custom/dock/index.d.ts +5 -2
- package/dist/components/custom/dot-flow-field/DotFlowField.vue.d.ts +42 -0
- package/dist/components/custom/dot-flow-field/composables/flowField.d.ts +83 -0
- package/dist/components/custom/dot-flow-field/composables/uniformBridgeWGPU.d.ts +39 -0
- package/dist/components/custom/dot-flow-field/composables/useDotFlowField.d.ts +35 -0
- package/dist/components/custom/dot-flow-field/composables/useFlowParticles.d.ts +31 -0
- package/dist/components/custom/dot-flow-field/constants.d.ts +69 -0
- package/dist/components/custom/dot-flow-field/index.d.ts +5 -0
- package/dist/components/custom/dot-flow-field/shaders/flow-field.compute.wgsl.d.ts +1 -0
- package/dist/components/custom/dot-flow-field/shaders/flow-field.glsl.d.ts +4 -0
- package/dist/components/custom/dot-flow-field/shaders/flow-field.render.wgsl.d.ts +1 -0
- package/dist/components/custom/dot-matrix/DotMatrix.vue.d.ts +43 -0
- package/dist/components/custom/dot-matrix/composables/dotMatrixField.d.ts +89 -0
- package/dist/components/custom/dot-matrix/composables/uniformBridgeWGPU.d.ts +52 -0
- package/dist/components/custom/dot-matrix/composables/useDotMatrix.d.ts +34 -0
- package/dist/components/custom/dot-matrix/composables/useDotSphere.d.ts +27 -0
- package/dist/components/custom/dot-matrix/constants.d.ts +58 -0
- package/dist/components/custom/dot-matrix/index.d.ts +5 -0
- package/dist/components/custom/dot-matrix/shaders/dot-matrix.glsl.d.ts +4 -0
- package/dist/components/custom/dot-matrix/shaders/dot-matrix.wgsl.d.ts +1 -0
- package/dist/components/custom/easing/EasingConfigurator.vue.d.ts +33 -0
- package/dist/components/custom/easing/EasingPicker.vue.d.ts +49 -0
- package/dist/components/custom/easing/composables/useEasingPicker.d.ts +80 -0
- package/dist/components/custom/easing/constants.d.ts +28 -0
- package/dist/components/custom/easing/index.d.ts +3 -0
- package/dist/components/custom/expandable-container/ExpandableContainer.vue.d.ts +11 -0
- package/dist/components/custom/fourier-field/FourierField.vue.d.ts +43 -40
- package/dist/components/custom/fourier-field/composables/fourierFieldGLSetup.d.ts +15 -0
- package/dist/components/custom/fourier-field/composables/fourierFieldWGPUSetup.d.ts +20 -0
- package/dist/components/custom/fourier-field/composables/uniformBridgeWGPU.d.ts +41 -0
- package/dist/components/custom/fourier-field/composables/useFourierField.d.ts +42 -0
- package/dist/components/custom/fourier-field/constants.d.ts +64 -0
- package/dist/components/custom/fourier-field/index.d.ts +23 -18
- package/dist/components/custom/fourier-field/shaders/fourier-field.compute.wgsl.d.ts +1 -0
- package/dist/components/custom/fourier-field/shaders/fourier-field.glsl.d.ts +4 -0
- package/dist/components/custom/fourier-field/shaders/fourier-field.render.wgsl.d.ts +1 -0
- package/dist/components/custom/glass-panel/GlassPanel.vue.d.ts +1 -1
- package/dist/components/custom/goo-blob/GooBlob.vue.d.ts +13 -3
- package/dist/components/custom/goo-blob/composables/uniformBridgeWGPU.d.ts +24 -0
- package/dist/components/custom/goo-blob/composables/useMetaballRenderer.d.ts +18 -11
- package/dist/components/custom/goo-blob/composables/wgpuSetup.d.ts +23 -0
- package/dist/components/custom/goo-blob/constants.d.ts +1 -1
- package/dist/components/custom/goo-blob/index.d.ts +1 -1
- package/dist/components/custom/goo-blob/shaders/metaball-noise.wgsl.d.ts +1 -0
- package/dist/components/custom/goo-blob/shaders/metaball-palette.wgsl.d.ts +1 -0
- package/dist/components/custom/goo-blob/shaders/metaball-uniforms.glsl.d.ts +1 -1
- package/dist/components/custom/goo-blob/shaders/metaball.wgsl.d.ts +1 -0
- package/dist/components/custom/goo-blob/types.d.ts +36 -0
- package/dist/components/custom/goo-dot-matrix/GooDotMatrix.vue.d.ts +49 -0
- package/dist/components/custom/goo-dot-matrix/composables/gooDotLattice.d.ts +24 -0
- package/dist/components/custom/goo-dot-matrix/composables/gooDotSetup.d.ts +50 -0
- package/dist/components/custom/goo-dot-matrix/composables/uniformBridgeWGPU.d.ts +35 -0
- package/dist/components/custom/goo-dot-matrix/composables/useGooDotMatrix.d.ts +31 -0
- package/dist/components/custom/goo-dot-matrix/constants.d.ts +76 -0
- package/dist/components/custom/goo-dot-matrix/index.d.ts +5 -0
- package/dist/components/custom/goo-dot-matrix/shaders/goo-dot.frag.d.ts +11 -0
- package/dist/components/custom/goo-dot-matrix/shaders/goo-dot.wgsl.d.ts +3 -0
- package/dist/components/custom/handmark/HandMark.vue.d.ts +1 -1
- package/dist/components/custom/icon-chip/types.d.ts +11 -1
- package/dist/components/custom/instrument-chassis/InstrumentChassis.vue.d.ts +3 -1
- package/dist/components/custom/labeled-field/LabeledField.vue.d.ts +21 -2
- package/dist/components/custom/metric-stack/MetricRow.vue.d.ts +15 -0
- package/dist/components/custom/metric-stack/MetricStack.vue.d.ts +1 -1
- package/dist/components/custom/pager-dots/PagerDots.vue.d.ts +9 -0
- package/dist/components/custom/pager-dots/index.d.ts +2 -0
- package/dist/components/custom/pager-dots/pagerWindow.d.ts +9 -0
- package/dist/components/custom/paper-grid/PaperGrid.vue.d.ts +42 -0
- package/dist/components/custom/paper-grid/composables/paperGrid.d.ts +90 -0
- package/dist/components/custom/paper-grid/composables/paperGridGLSetup.d.ts +16 -0
- package/dist/components/custom/paper-grid/composables/paperGridWGPUSetup.d.ts +19 -0
- package/dist/components/custom/paper-grid/composables/uniformBridgeWGPU.d.ts +16 -0
- package/dist/components/custom/paper-grid/composables/usePaperGrid.d.ts +31 -0
- package/dist/components/custom/paper-grid/constants.d.ts +57 -0
- package/dist/components/custom/paper-grid/index.d.ts +5 -0
- package/dist/components/custom/paper-grid/shaders/paper-grid.glsl.d.ts +4 -0
- package/dist/components/custom/paper-grid/shaders/paper-grid.wgsl.d.ts +1 -0
- package/dist/components/custom/search/FuzzySearch.vue.d.ts +8 -2
- package/dist/components/custom/search/SearchBar.vue.d.ts +8 -0
- package/dist/components/custom/search/index.d.ts +2 -0
- package/dist/components/custom/search/searchVariants.d.ts +19 -0
- package/dist/components/custom/selectable-chip/SelectableChip.vue.d.ts +50 -0
- package/dist/components/custom/selectable-chip/index.d.ts +2 -0
- package/dist/components/custom/selectable-chip/selectableChipVariants.d.ts +23 -0
- package/dist/components/custom/spa-view/SpaView.vue.d.ts +50 -0
- package/dist/components/custom/spa-view/index.d.ts +2 -0
- package/dist/components/custom/split-chars/SplitChars.vue.d.ts +39 -0
- package/dist/components/custom/split-chars/index.d.ts +1 -0
- package/dist/components/custom/tabs/SegmentedTabs.vue.d.ts +12 -0
- package/dist/components/custom/tabs/composables/useTabDragMorph.d.ts +42 -0
- package/dist/components/custom/tabs/constants.d.ts +20 -2
- package/dist/components/custom/watercolor-dot/WatercolorDot.vue.d.ts +30 -17
- package/dist/components/custom/watercolor-dot/useWatercolorBlob.d.ts +10 -5
- package/dist/components/ui/_shared/index.d.ts +2 -0
- package/dist/components/ui/_shared/menuItemVariants.d.ts +1 -1
- package/dist/components/ui/_shared/useControlSize.d.ts +46 -0
- package/dist/components/ui/badge/index.d.ts +1 -1
- package/dist/components/ui/button/Button.vue.d.ts +5 -2
- package/dist/components/ui/button/index.d.ts +2 -2
- package/dist/components/ui/card/Card.vue.d.ts +79 -4
- package/dist/components/ui/card/CardHeader.vue.d.ts +42 -16
- package/dist/components/ui/card/ScrollCard.vue.d.ts +33 -0
- package/dist/components/ui/card/ScrollCardHeader.vue.d.ts +17 -0
- package/dist/components/ui/card/index.d.ts +3 -1
- package/dist/components/ui/carousel/CarouselNext.vue.d.ts +2 -2
- package/dist/components/ui/carousel/CarouselPrevious.vue.d.ts +2 -2
- package/dist/components/ui/carousel/GlassCarouselPager.vue.d.ts +2 -2
- package/dist/components/ui/command/Command.vue.d.ts +1 -1
- package/dist/components/ui/command/CommandDialog.vue.d.ts +9 -3
- package/dist/components/ui/command/CommandList.vue.d.ts +3 -0
- package/dist/components/ui/context-menu/ContextMenuContent.vue.d.ts +5 -1
- package/dist/components/ui/drawer/Drawer.vue.d.ts +46 -33
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts +7 -8
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +2 -2
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +1 -1
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +2 -2
- package/dist/components/ui/drawer/composables/drawerSnapContext.d.ts +26 -0
- package/dist/components/ui/drawer/composables/useDrawerSnap.d.ts +17 -0
- package/dist/components/ui/drawer/constants.d.ts +45 -0
- package/dist/components/ui/drawer/index.d.ts +23 -15
- package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +4 -0
- package/dist/components/ui/focus-scope/FocusScope.vue.d.ts +20 -0
- package/dist/components/ui/focus-scope/index.d.ts +2 -0
- package/dist/components/ui/hover-card/HoverCardContent.vue.d.ts +3 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/input/Input.vue.d.ts +3 -0
- package/dist/components/ui/number-field/NumberFieldInput.vue.d.ts +6 -1
- package/dist/components/ui/progress/ProgressDefault.vue.d.ts +3 -2
- package/dist/components/ui/select/SelectContent.vue.d.ts +4 -1
- package/dist/components/ui/sheet/index.d.ts +1 -1
- package/dist/components/ui/switch/Switch.vue.d.ts +2 -0
- package/dist/components/ui/tags-input/TagsInput.vue.d.ts +2 -2
- package/dist/components/ui/textarea/Textarea.vue.d.ts +3 -0
- package/dist/components/ui/toast/Toast.vue.d.ts +5 -2
- package/dist/components/ui/toast/use-toast.d.ts +14 -0
- package/dist/components/ui/toggle/Toggle.vue.d.ts +1 -1
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +3 -0
- package/dist/composables/color/index.d.ts +2 -0
- package/dist/composables/color/useAccentTone.d.ts +34 -0
- package/dist/composables/glass/canvas2d/useCanvas2D.d.ts +13 -6
- package/dist/composables/glass/index.d.ts +5 -2
- package/dist/composables/glass/useSpecularPointer.d.ts +33 -0
- package/dist/composables/glass/useSpecularTracking.d.ts +20 -0
- package/dist/composables/glass/useVizChoreography.d.ts +123 -0
- package/dist/composables/glass/vSpecular.d.ts +2 -0
- package/dist/composables/glass/webgl/createCanvasLifecycle.d.ts +10 -0
- package/dist/composables/glass/webgl/shaders/flow.glsl.d.ts +1 -0
- package/dist/composables/glass/webgl/shaders/flow.wgsl.d.ts +1 -0
- package/dist/composables/glass/webgl/useWebGLCanvas.d.ts +16 -0
- package/dist/composables/glass/webgpu/index.d.ts +2 -0
- package/dist/composables/glass/webgpu/useGpuSubstrate.d.ts +75 -0
- package/dist/composables/glass/webgpu/useWebGPUCanvas.d.ts +85 -0
- package/dist/composables/glass/webgpu/webgpuDevice.d.ts +42 -0
- package/dist/composables/motion/core/index.d.ts +4 -0
- package/dist/composables/motion/index.d.ts +4 -0
- package/dist/composables/motion/scrollReader.d.ts +25 -0
- package/dist/composables/motion/springPresets.d.ts +20 -1
- package/dist/composables/motion/useCharStagger.d.ts +44 -0
- package/dist/composables/motion/useDockCtaReceive.d.ts +84 -0
- package/dist/composables/motion/useDragMorph.d.ts +77 -0
- package/dist/composables/motion/useLiquidFlex.d.ts +11 -0
- package/dist/composables/motion/useLiquidPress.d.ts +71 -0
- package/dist/composables/motion/useLiquidReveal.d.ts +51 -0
- package/dist/composables/motion/useNumericTransition.d.ts +3 -3
- package/dist/composables/motion/usePointerVelocityField.d.ts +98 -0
- package/dist/composables/motion/useScrollChrome.d.ts +58 -0
- package/dist/composables/motion/useScrollTrigger.d.ts +67 -0
- package/dist/composables/motion/useSpringPress.d.ts +5 -5
- package/dist/composables/motion/useStaggerReveal.d.ts +24 -0
- package/dist/composables/sidebar/index.d.ts +4 -1
- package/dist/composables/sidebar/types.d.ts +68 -3
- package/dist/composables/sidebar/useClickDelegate.d.ts +4 -0
- package/dist/composables/sidebar/useLazyLoader.d.ts +5 -0
- package/dist/composables/sidebar/useScrollTo.d.ts +5 -0
- package/dist/composables/virtual/index.d.ts +4 -0
- package/dist/composables/virtual/useVirtualSectionWindow.d.ts +72 -0
- package/dist/composables/virtual/useWindowedStore.d.ts +43 -0
- package/dist/composables/virtual/virtualSectionLayout.d.ts +103 -0
- package/dist/concentric.d.ts +1 -0
- package/dist/concentric.js +836 -0
- package/dist/configurator.js +3 -2
- package/dist/confirm-dialog.js +62 -49
- package/dist/constellation.js +635 -235
- package/dist/context-menu.js +3 -3
- package/dist/controls.js +2 -2
- package/dist/createCanvasLifecycle-Gh45Ce-p.js +93 -0
- package/dist/dark.js +1 -1
- package/dist/data-table.js +1 -1
- package/dist/deck.d.ts +1 -0
- package/dist/deck.js +105 -0
- package/dist/dialog.js +4 -3
- package/dist/dock.js +819 -568
- package/dist/{dockContext-Bu1Avy-a.js → dockContext-BNfyPLe9.js} +1 -1
- package/dist/dom.js +5 -5
- package/dist/dot-flow-field.d.ts +1 -0
- package/dist/dot-flow-field.js +894 -0
- package/dist/dot-matrix.d.ts +1 -0
- package/dist/dot-matrix.js +630 -0
- package/dist/dotMatrixField-D_x9_1qq.js +48 -0
- package/dist/drawer.d.ts +1 -0
- package/dist/drawer.js +380 -0
- package/dist/{dropdown-menu-BJ7E9js_.js → dropdown-menu-aJmV5SqE.js} +82 -79
- package/dist/dropdown-menu.js +1 -1
- package/dist/easing.d.ts +1 -0
- package/dist/easing.js +475 -0
- package/dist/expandable-container.js +46 -21
- package/dist/fading-scroll.js +1 -1
- package/dist/flow.glsl-B2P7e0MT.js +4 -0
- package/dist/focus-scope.d.ts +1 -0
- package/dist/focus-scope.js +23 -0
- package/dist/forms.js +65 -63
- package/dist/fourier-field.js +831 -172
- package/dist/fourier-math.js +1 -1
- package/dist/glass-panel.js +2 -2
- package/dist/glass-ui.css +1 -1
- package/dist/glass-ui.js +187 -338
- package/dist/goo-blob.js +241 -692
- package/dist/goo-dot-matrix.d.ts +1 -0
- package/dist/goo-dot-matrix.js +591 -0
- package/dist/handmark.js +2 -2
- package/dist/header-ribbon.js +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/hover-popover.js +1 -1
- package/dist/icon-chip.js +1 -1
- package/dist/icon-tooltip.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/instrument-chassis.js +1 -1
- package/dist/keyboard.js +1 -1
- package/dist/label.js +1 -1
- package/dist/labeled-field.js +70 -60
- package/dist/metric-badge.js +1 -1
- package/dist/metric-cell.js +1 -1
- package/dist/metric-stack.js +14 -9
- package/dist/motion-core.js +58 -36
- package/dist/motion-curves.js +11 -1
- package/dist/motion.js +90 -53
- package/dist/notification.js +1 -1
- package/dist/number-field.js +1 -1
- package/dist/pager-dots.js +2 -91
- package/dist/paper-backdrop.js +1 -1
- package/dist/paper-grid.d.ts +1 -0
- package/dist/paper-grid.js +788 -0
- package/dist/popover.js +1 -1
- package/dist/{presets-BW2b-fr1.js → presets-CvOUqtdY.js} +3 -3
- package/dist/{compile-EXXzEr1q.js → procedural-color.wgsl-m7Zgv35j.js} +2 -156
- package/dist/progress.js +1 -1
- package/dist/pulse.js +2 -2
- package/dist/reactive.js +1 -1
- package/dist/resolveCanvasColor-yPyIpJt9.js +93 -0
- package/dist/scrollReader-DI1NWxUw.js +42 -0
- package/dist/scrolling-text.js +1 -1
- package/dist/search.js +162 -308
- package/dist/select.js +3 -3
- package/dist/selectable-chip.d.ts +1 -0
- package/dist/selectable-chip.js +65 -0
- package/dist/separator.js +1 -1
- package/dist/{sheet-CquRYOAw.js → sheet-B2flBfLH.js} +5 -5
- package/dist/sheet.js +1 -1
- package/dist/sidebar.js +216 -114
- package/dist/{slider-DQ95MET2.js → slider-2A0rPn79.js} +3 -3
- package/dist/slider.js +1 -1
- package/dist/sortable-list.js +2 -2
- package/dist/spa-view.d.ts +1 -0
- package/dist/spa-view.js +46 -0
- package/dist/spectrum-walk-BVzA7Biz.js +33 -0
- package/dist/{springPresets-WXaLbu8u.js → springPresets-Ce7OYCm9.js} +12 -6
- package/dist/styles/animations.css +46 -12
- package/dist/styles/border-progress.css +109 -0
- package/dist/styles/cards.css +145 -0
- package/dist/styles/completion-seal.css +131 -0
- package/dist/styles/components.css +2 -3
- package/dist/styles/configurator.css +55 -0
- package/dist/styles/critical-partition.mjs +162 -0
- package/dist/styles/critical.css +12 -0
- package/dist/styles/deferred.css +33 -0
- package/dist/styles/dock/cta-seat.css +87 -0
- package/dist/styles/dock/density.css +198 -0
- package/dist/styles/dock/layers.css +101 -29
- package/dist/styles/dock/morph-bridge.css +54 -18
- package/dist/styles/dock/morph.css +132 -7
- package/dist/styles/dock/overflow.css +28 -2
- package/dist/styles/dock/search.css +68 -0
- package/dist/styles/dock/shape.css +124 -0
- package/dist/styles/dock/shell.css +77 -21
- package/dist/styles/dock/stack-rail.css +264 -0
- package/dist/styles/dock-controls/dark-mode-toggle.css +17 -4
- package/dist/styles/dock-controls/icon-button.css +14 -0
- package/dist/styles/dock.css +43 -1
- package/dist/styles/drawer.css +81 -35
- package/dist/styles/glass/accent-tone.css +66 -0
- package/dist/styles/glass/control-surfaces.css +167 -0
- package/dist/styles/glass/deep.css +44 -0
- package/dist/styles/glass/ladder.css +147 -41
- package/dist/styles/glass/material.css +78 -15
- package/dist/styles/glass/reveal.css +136 -0
- package/dist/styles/glass/rim.css +110 -0
- package/dist/styles/glass/surfaces.css +148 -129
- package/dist/styles/glass-refract.css +96 -44
- package/dist/styles/glass-specular-track.css +7 -0
- package/dist/styles/glass.css +13 -0
- package/dist/styles/hover-popover.css +7 -6
- package/dist/styles/icon-chip.css +77 -15
- package/dist/styles/index.css +36 -9
- package/dist/styles/instrument-chassis.css +66 -3
- package/dist/styles/scroll-choreography.css +300 -0
- package/dist/styles/scroll-chrome.css +123 -0
- package/dist/styles/scroll-driven.css +38 -0
- package/dist/styles/segmented-tabs.css +81 -14
- package/dist/styles/theme/bridges.css +33 -0
- package/dist/styles/theme/literals.css +11 -2
- package/dist/styles/theme/radius.css +24 -2
- package/dist/styles/tokens/color-radius.css +13 -3
- package/dist/styles/tokens/dark-arm.css +137 -32
- package/dist/styles/tokens/glass-deep.css +100 -0
- package/dist/styles/tokens/glass-fx.css +376 -0
- package/dist/styles/tokens/glass.css +131 -351
- package/dist/styles/tokens/light-dark.css +16 -3
- package/dist/styles/tokens/offsets.css +143 -0
- package/dist/styles/tokens/on-glass-fg.css +39 -0
- package/dist/styles/tokens/property-regs.css +260 -0
- package/dist/styles/tokens/scale-paper.css +168 -96
- package/dist/styles/tokens/scheme-motion.css +114 -38
- package/dist/styles/tokens/scroll-tokens.css +123 -0
- package/dist/styles/tokens/sizing-config.css +110 -0
- package/{src/styles/tokens/offsets-sizing.css → dist/styles/tokens/sizing.css} +92 -204
- package/dist/styles/tokens.css +14 -3
- package/dist/styles/typography/semantic.css +26 -13
- package/dist/styles/typography/utilities.css +22 -7
- package/dist/styles/utilities/a11y-overrides.css +20 -5
- package/dist/styles/utilities/animate.css +27 -24
- package/dist/styles/utilities/base-misc.css +307 -0
- package/dist/styles/utilities/base.css +47 -261
- package/dist/styles/utilities/btn.css +17 -4
- package/dist/styles/utilities/components.css +31 -6
- package/dist/styles/utilities/metal.css +215 -0
- package/dist/styles/utilities.css +14 -7
- package/dist/switch.js +1 -1
- package/dist/tabs.js +220 -107
- package/dist/timeline.js +2 -2
- package/dist/toast.js +1 -1
- package/dist/toggle-chip.js +10 -10
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/typewriter.js +2 -2
- package/dist/uniformBridgeWGPU-CtAKl45L.js +1204 -0
- package/dist/{useAnimatedNumber-C_3wZLx4.js → useAnimatedNumber-CLrxicG9.js} +1 -1
- package/dist/useConfiguratorState-4xblKfwd.js +162 -0
- package/dist/useControlSize-SH1UmJCi.js +9 -0
- package/dist/useDockCtaReceive-DfFkmgL1.js +82 -0
- package/dist/useDragMorph-BUgAC-zK.js +102 -0
- package/dist/useFuzzySearch-DIhcYtcw.js +177 -0
- package/dist/useGpuSubstrate-4pTcp6mX.js +294 -0
- package/dist/useLiquidPress-BooG97RY.js +39 -0
- package/dist/usePointerVelocityField-QLsy3_kv.js +91 -0
- package/dist/useScrollChrome-D66AVP7C.js +258 -0
- package/dist/useSpring-C0jyvEJB.js +40 -0
- package/dist/useSpringMount-BWDnKIwh.js +71 -0
- package/dist/useSpringPress-B1-Czp-V.js +36 -0
- package/dist/{useTouchGate-28Tk2-t2.js → useTouchGate-CBZTD4SD.js} +1 -1
- package/dist/useViewTransition-CUI1nAgn.js +95 -0
- package/dist/vSpecular-EX7loENl.js +68 -0
- package/dist/vendor-B2qOlYY3.js +239 -0
- package/dist/virtual.d.ts +1 -0
- package/dist/virtual.js +225 -0
- package/dist/watercolor-dot.js +117 -74
- package/package.json +252 -28
- package/src/styles/animations.css +46 -12
- package/src/styles/border-progress.css +109 -0
- package/src/styles/cards.css +145 -0
- package/src/styles/completion-seal.css +131 -0
- package/src/styles/configurator.css +55 -0
- package/src/styles/critical-partition.mjs +162 -0
- package/src/styles/dock/cta-seat.css +87 -0
- package/src/styles/dock/density.css +198 -0
- package/src/styles/dock/layers.css +101 -29
- package/src/styles/dock/morph-bridge.css +54 -18
- package/src/styles/dock/morph.css +132 -7
- package/src/styles/dock/overflow.css +28 -2
- package/src/styles/dock/search.css +68 -0
- package/src/styles/dock/shape.css +124 -0
- package/src/styles/dock/shell.css +77 -21
- package/src/styles/dock/stack-rail.css +264 -0
- package/src/styles/dock-controls/dark-mode-toggle.css +17 -4
- package/src/styles/dock-controls/icon-button.css +14 -0
- package/src/styles/dock.css +43 -1
- package/src/styles/drawer.css +81 -35
- package/src/styles/glass/accent-tone.css +66 -0
- package/src/styles/glass/control-surfaces.css +167 -0
- package/src/styles/glass/deep.css +44 -0
- package/src/styles/glass/ladder.css +147 -41
- package/src/styles/glass/material.css +78 -15
- package/src/styles/glass/reveal.css +136 -0
- package/src/styles/glass/rim.css +110 -0
- package/src/styles/glass/surfaces.css +148 -129
- package/src/styles/glass-refract.css +96 -44
- package/src/styles/glass-specular-track.css +7 -0
- package/src/styles/glass.css +13 -0
- package/src/styles/hover-popover.css +7 -6
- package/src/styles/icon-chip.css +77 -15
- package/src/styles/index.css +27 -0
- package/src/styles/instrument-chassis.css +66 -3
- package/src/styles/scroll-choreography.css +300 -0
- package/src/styles/scroll-chrome.css +123 -0
- package/src/styles/scroll-driven.css +38 -0
- package/src/styles/segmented-tabs.css +81 -14
- package/src/styles/theme/bridges.css +33 -0
- package/src/styles/theme/literals.css +11 -2
- package/src/styles/theme/radius.css +24 -2
- package/src/styles/tokens/color-radius.css +13 -3
- package/src/styles/tokens/dark-arm.css +137 -32
- package/src/styles/tokens/glass-deep.css +100 -0
- package/src/styles/tokens/glass-fx.css +376 -0
- package/src/styles/tokens/glass.css +131 -351
- package/src/styles/tokens/light-dark.css +16 -3
- package/src/styles/tokens/offsets.css +143 -0
- package/src/styles/tokens/on-glass-fg.css +39 -0
- package/src/styles/tokens/property-regs.css +260 -0
- package/src/styles/tokens/scale-paper.css +168 -96
- package/src/styles/tokens/scheme-motion.css +114 -38
- package/src/styles/tokens/scroll-tokens.css +123 -0
- package/src/styles/tokens/sizing-config.css +110 -0
- package/{dist/styles/tokens/offsets-sizing.css → src/styles/tokens/sizing.css} +92 -204
- package/src/styles/tokens.css +14 -3
- package/src/styles/typography/semantic.css +26 -13
- package/src/styles/typography/utilities.css +22 -7
- package/src/styles/utilities/a11y-overrides.css +20 -5
- package/src/styles/utilities/animate.css +27 -24
- package/src/styles/utilities/base-misc.css +307 -0
- package/src/styles/utilities/base.css +47 -261
- package/src/styles/utilities/btn.css +17 -4
- package/src/styles/utilities/components.css +31 -6
- package/src/styles/utilities/metal.css +215 -0
- package/src/styles/utilities.css +14 -7
- package/dist/CardAction-XH4YBVEK.js +0 -158
- package/dist/ContextMenuContent-ON3x7cuk.js +0 -85
- package/dist/DialogFooter-8eZbdmPc.js +0 -165
- package/dist/HoverCardContent-DkMaQzH5.js +0 -83
- package/dist/Input-DVG_J0ne.js +0 -55
- package/dist/Notification-DKjKsQq8.js +0 -100
- package/dist/NumberFieldContent-1VtwDSgf.js +0 -145
- package/dist/Separator-BArl4OaB.js +0 -37
- package/dist/Switch-Dr--uLGH.js +0 -47
- package/dist/Toaster-Bm_HQSpc.js +0 -263
- package/dist/ToggleGroupItem-Dzk9hWsF.js +0 -157
- package/dist/TooltipProvider-B3MkB_8P.js +0 -104
- package/dist/button-BNDWhAZb.js +0 -81
- package/dist/check-njhk-vfu.js +0 -7
- package/dist/chevron-down-DKkxb4VV.js +0 -7
- package/dist/chevron-right-CPXbqQQz.js +0 -7
- package/dist/chevron-up-n_24SqI-.js +0 -7
- package/dist/color-DweYl7pE.js +0 -86
- package/dist/components/custom/constellation/composables/useConstellationPointer.d.ts +0 -35
- package/dist/components/custom/constellation/constellationDraw.d.ts +0 -30
- package/dist/components/custom/dock/DockRail.vue.d.ts +0 -89
- package/dist/createLucideIcon-DydS2qgk.js +0 -43
- package/dist/minimize-2-BV31Ob_h.js +0 -38
- package/dist/resolveCanvasColor-BBiYfp8g.js +0 -11
- package/dist/search-BSGrf2Sk.js +0 -12
- package/dist/styles/dock/rail-extend.css +0 -397
- package/dist/useCanvas2D-ClrQuZtp.js +0 -96
- package/dist/useConfiguratorState-kiIlun8I.js +0 -303
- package/dist/useRAFLoop-CdwJ7284.js +0 -109
- package/dist/useSpecularTracking-Bo5su68i.js +0 -32
- package/dist/useSpringMount-CvopqiFr.js +0 -108
- package/dist/useViewTransition-COsPjQVZ.js +0 -47
- package/dist/x-BUwTKe50.js +0 -10
- package/src/styles/dock/rail-extend.css +0 -397
- /package/dist/{CollapsibleContent-C_s6fG7r.js → CollapsibleContent-68dEXIAl.js} +0 -0
- /package/dist/{InstrumentChassis-UUJX0-mW.js → InstrumentChassis-CxsHSyMj.js} +0 -0
- /package/dist/{Label-Ck9SWEKM.js → Label-C2ejNWeC.js} +0 -0
- /package/dist/{ModalOverlay-CkPRRgl_.js → ModalOverlay-D1VrWyoi.js} +0 -0
- /package/dist/{PaperBackdrop-nBKe0vkB.js → PaperBackdrop-CqwjnfLv.js} +0 -0
- /package/dist/{SelectGroup-Dcczq44n.js → SelectGroup-BFiod7X2.js} +0 -0
- /package/dist/{_plugin-vue_export-helper-CBt_VvXa.js → _plugin-vue_export-helper-C1je1s0u.js} +0 -0
- /package/dist/{badge-UILT_3pZ.js → badge-D9XWW4GT.js} +0 -0
- /package/dist/{constants-BPOqYJAm.js → constants--C2DkLW8.js} +0 -0
- /package/dist/{createContext-B2RaZ-b8.js → createContext-CpBNTRMI.js} +0 -0
- /package/dist/{math-DeuJwLFx.js → math-Eb0w3LqU.js} +0 -0
- /package/dist/{menuItemVariants-DWRQXBxJ.js → menuItemVariants-D8VNHq22.js} +0 -0
- /package/dist/{prng-Cg22zv8g.js → prng-B-d9eYX8.js} +0 -0
- /package/dist/{useGlobalDark-C28t0VWJ.js → useGlobalDark-CmjB9E32.js} +0 -0
- /package/dist/{useIntersectionPause-Bj4sPkMh.js → useIntersectionPause-Dbozzjgm.js} +0 -0
- /package/dist/{useKeyboardShortcuts-BXWXOZ-9.js → useKeyboardShortcuts-BPRp33Im.js} +0 -0
- /package/dist/{useLiquidFlex-C12hXwOZ.js → useLiquidFlex-UmA6LMZu.js} +0 -0
- /package/dist/{useResizeObserver-V6nq5gJb.js → useResizeObserver-Bpoi7tRE.js} +0 -0
- /package/dist/{useResolveTokenColor-NUG2zYAW.js → useResolveTokenColor-vAylyR0x.js} +0 -0
- /package/dist/{useScrollProgress-D7bYU2RK.js → useScrollProgress-c3yxmH6a.js} +0 -0
- /package/dist/{useSurfaceAxis-CMnF2zHb.js → useSurfaceAxis-g0NloYEF.js} +0 -0
- /package/dist/{useTimer-B_PAasDL.js → useTimer-BHJOKr35.js} +0 -0
- /package/dist/{useUserInvalidAria-CDfJuakL.js → useUserInvalidAria-y5namzeE.js} +0 -0
- /package/dist/{useViewportReady-CvBcCYDf.js → useViewportReady-anbac3m6.js} +0 -0
package/dist/aurora.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { t as e } from "./_plugin-vue_export-helper-
|
|
2
|
-
import {
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-C1je1s0u.js";
|
|
2
|
+
import { t } from "./usePointerVelocityField-QLsy3_kv.js";
|
|
3
|
+
import { a as n, c as r, i, l as a, n as o, o as s, r as c, s as l, t as u } from "./procedural-color.wgsl-m7Zgv35j.js";
|
|
4
|
+
import { t as d } from "./flow.glsl-B2P7e0MT.js";
|
|
5
|
+
import { i as f, n as p, r as m, t as h } from "./useGpuSubstrate-4pTcp6mX.js";
|
|
6
|
+
import { n as g, t as _ } from "./compile-nZ1xVYTp.js";
|
|
7
|
+
import { i as v, n as y, r as ee, t as b } from "./presets-CvOUqtdY.js";
|
|
8
|
+
import { a as te, c as x, i as ne, l as S, o as C, t as w } from "./color-Cs0-oxYL.js";
|
|
9
|
+
import { t as re } from "./useIntersectionPause-Dbozzjgm.js";
|
|
10
|
+
import { t as ie } from "./useScrollProgress-c3yxmH6a.js";
|
|
11
|
+
import { computed as T, createElementBlock as ae, createElementVNode as oe, defineComponent as se, normalizeClass as ce, normalizeStyle as le, onBeforeUnmount as ue, onMounted as de, openBlock as fe, readonly as pe, ref as E, unref as D, watch as O } from "vue";
|
|
12
|
+
import { interpolateHue as me, rawOklabToOklch as he, srgbToOKLab as ge } from "@mkbabb/value.js";
|
|
9
13
|
//#region src/components/custom/aurora/constants/shaders/aurora.vert.ts
|
|
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}", j = "\n", ge = `#version 300 es
|
|
14
|
+
var _e = "#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}", ve = "// ── 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", ye = "// ── 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", be = "// 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", xe = "// ── 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", Se = "// ── 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", Ce = "StrokeProfile 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", we = "// ── 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", Te = "// ── 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.\n" + Ce + "\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 stays the oil/oil-pastel stroke-cascade ceiling. BB.W-AUR-KUWAHARA DECIDED the\n // booking: the SOFT anisotropic-Kuwahara finish ships as the OPT-IN mediumKuwahara() body\n // (uMedium==7) the consumer selects — NOT a re-tune of these oil/oil-pastel knobs. 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#define MEDIUM_KUWAHARA 7\n\n// ── Kuwahara — the anisotropic generalized Kuwahara painterly finish (uMedium==7,\n// BB.W-AUR-KUWAHARA) ───────────────────────────────────────────────────────────────\n// The SOTA edge-preserving painterly smoothing: the generalized/anisotropic Kuwahara\n// of Kyprianidis 2010, the SOFT polynomial-weighted variant (NOT the pre-2010 hard\n// argmin, which BANDS the flat field into an 8-spoke pinwheel — the §4.2 anti-regression).\n// Aurora is a PROCEDURAL field (no input texture), so the operator runs over the\n// sampleBase() color field directly: an elliptical kernel oriented along the structure\n// tensor (elongated along the edge-tangent, narrowed across by the anisotropy), divided\n// into 8 overlapping sectors via smooth weights; each sector accumulates a weighted mean\n// + variance, and the output is the variance-weighted blend of the sector means\n// (1/(1+var^q) — the low-variance sectors dominate, the SOFT criterion). The result is\n// flat painterly oil-paint patches with crisp colour-zone boundaries — the §4.3 −5/3\n// cascade carried by the multi-scale patch structure, the §4.2 anisotropy carried by the\n// ellipse hugging the tensor. Single-pass small-radius WebGL2 form: 4 rings × 8 angular\n// taps = 32 procedural neighbourhood samples (cost-bounded; the offscreen-park / PRM\n// freeze the substrate owns is untouched — a parked frame attaches zero of these taps).\nvec3 mediumKuwahara(vec3 col, vec2 p, float t) {\n // Orient the kernel along the structure-tensor edge-tangent + read the coherence A.\n vec3 stf = structureTensorField(p, t, flowField(p, t));\n vec2 tangent = stf.xy;\n float A = stf.z;\n // The ellipse axes: major along the tangent, minor across. Anisotropy squeezes the\n // minor axis (coherent zones → long-thin patch along the colour band; flat zones →\n // near-circular so the operator degrades gracefully to the isotropic Kuwahara). The\n // base radius rides uStrokeScale so the painterly patch size tracks the studio knob.\n float radius = clamp(0.010 + uStrokeScale * 0.00018, 0.006, 0.024);\n float aniso = mix(1.0, 0.34, clamp(A, 0.0, 1.0)); // minor/major axis ratio\n vec2 ax = tangent; // major-axis unit vector (edge-tangent)\n vec2 ay = vec2(-tangent.y, tangent.x); // minor-axis unit vector (edge-normal)\n\n // 8 sectors, soft polynomial weights. Each sector i centers on angle i·45°; a sample's\n // sector weight is a smooth gaussian-of-angular-distance so sectors OVERLAP (no hard\n // argmin → no pinwheel banding). The center sample seeds all sectors equally.\n const int SECTORS = 8;\n vec3 m[8]; // per-sector weighted colour sum\n vec3 s[8]; // per-sector weighted colour² sum (for variance)\n float w[8]; // per-sector weight sum\n for (int i = 0; i < SECTORS; i++) { m[i] = vec3(0.0); s[i] = vec3(0.0); w[i] = 0.0; }\n\n // 4 rings × 8 angular taps over the elliptical disc. Each tap: sample the procedural\n // field, then deposit into the sectors by the soft angular weight × the radial falloff.\n const int RINGS = 4;\n const int TAPS = 8;\n for (int r = 1; r <= RINGS; r++) {\n float rr = float(r) / float(RINGS); // 0.25 .. 1.0\n float radial = 1.0 - 0.6 * rr; // inner taps weigh more (gaussian-ish)\n for (int a = 0; a < TAPS; a++) {\n float ang = 6.2831853 * float(a) / float(TAPS);\n // Elliptical offset: major axis full radius, minor axis squeezed by aniso.\n vec2 dirE = ax * cos(ang) + ay * (sin(ang) * aniso);\n vec2 off = dirE * (radius * rr);\n vec3 c = sampleBase(p + off, t);\n // The sample's angular bin (its sector) — soft, so it spills into neighbours.\n for (int k = 0; k < SECTORS; k++) {\n float sectorAng = 6.2831853 * float(k) / float(SECTORS);\n // Smallest signed angular distance to the sector center.\n float d = ang - sectorAng;\n d = atan(sin(d), cos(d)); // wrap to [-π, π]\n float sw = exp(-d * d * 2.2) * radial; // gaussian angular weight × radial\n m[k] += c * sw;\n s[k] += c * c * sw;\n w[k] += sw;\n }\n }\n }\n\n // Per-sector mean + scalar luma-variance, then the SOFT variance-weighted blend.\n vec3 accum = vec3(0.0);\n float accumW = 0.0;\n for (int k = 0; k < SECTORS; k++) {\n float wk = max(w[k], 1e-4);\n vec3 mean = m[k] / wk;\n vec3 var3 = max(s[k] / wk - mean * mean, vec3(0.0));\n float variance = dot(var3, W_LUMA); // perceptual scalar variance\n // SOFT criterion: low-variance sectors (flat, inside a colour zone) dominate; a\n // high-variance sector (straddling an edge) is suppressed. q controls the sharpness;\n // a finite q (not argmin) keeps the blend continuous → no pinwheel spoke.\n float sectorW = 1.0 / (1.0 + pow(variance * 320.0, 4.0));\n accum += mean * sectorW;\n accumW += sectorW;\n }\n vec3 result = accum / max(accumW, 1e-4);\n\n // The center sample anchors the result in near-flat zones (where every sector reads the\n // same colour) so the operator is a no-op there — the smoothing only BITES at edges.\n vec3 center = sampleBase(p, t);\n result = mix(center, result, clamp(0.35 + 0.65 * A, 0.0, 1.0));\n\n // A faint canvas tooth + pigment-saturation lift so the flattened patches read as\n // oil-paint, not a posterized blur (the painterly identity the smoothing alone lacks).\n float tooth = vnoise(p * 300.0) - 0.5;\n result *= 1.0 + tooth * 0.06 * uCanvasGrain;\n result = saturate3(result, 1.04);\n\n // Blend toward the incoming col by uStrokeAmount so the studio amount knob controls\n // the finish strength (uStrokeAmount=0 → the raw field passes through; default → full).\n return mix(col, result, clamp(uStrokeAmount, 0.0, 1.0));\n}\n\n" + Se + "// 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}", k = "\n", Ee = `#version 300 es
|
|
11
15
|
precision highp float;
|
|
12
16
|
|
|
13
17
|
in vec2 vUv;
|
|
@@ -42,7 +46,7 @@ uniform float uValueVariance;
|
|
|
42
46
|
uniform float uWarpAmount;
|
|
43
47
|
uniform float uWarpScale;
|
|
44
48
|
uniform float uWarpDrift;
|
|
45
|
-
uniform int uWarpMode; // 0=fbm 1=cellular 2=hybrid
|
|
49
|
+
uniform int uWarpMode; // 0=fbm 1=cellular 2=hybrid 3=curl (BB.B1 — opt-in Bridson flow warp)
|
|
46
50
|
uniform int uNoiseOctaves;
|
|
47
51
|
|
|
48
52
|
// Medium
|
|
@@ -142,7 +146,7 @@ float vnoise(vec2 p) {
|
|
|
142
146
|
// The rotated-octave FBM rotation constant — spliced from the shared chunk (AV.W2
|
|
143
147
|
// — the one FBM_ROT). The loop below stays aurora-local (2.02 lacunarity +
|
|
144
148
|
// uniform-driven octaves, per §3a — only the rotation constant converges).
|
|
145
|
-
${
|
|
149
|
+
${n}
|
|
146
150
|
|
|
147
151
|
float fbm(vec2 p) {
|
|
148
152
|
float v = 0.0;
|
|
@@ -156,6 +160,19 @@ float fbm(vec2 p) {
|
|
|
156
160
|
return v;
|
|
157
161
|
}
|
|
158
162
|
|
|
163
|
+
// BB.B1 — the shared curl-noise flow chunk (curlFBM), spliced from the single source
|
|
164
|
+
// procedural surfaces share (the AV.W2 shared-chunk precedent, applied to FLOW). The
|
|
165
|
+
// chunk owns ONLY the basis-agnostic curl operator; the host owns the noise basis —
|
|
166
|
+
// aurora wraps its OWN fbm as the scalar potential (so curl rides the same 2.02-
|
|
167
|
+
// lacunarity loop the rest of the warp uses). The curl operator is consumed ONLY on
|
|
168
|
+
// the OPT-IN warpMode == "curl" branch (uWarpMode == 3) — the default warp paths are
|
|
169
|
+
// byte-untouched (no curl call), so every existing aurora gate stays byte-equivalent.
|
|
170
|
+
${d}
|
|
171
|
+
|
|
172
|
+
// The scalar fbm potential ψ for curlFBM — aurora's own fbm. The splice above
|
|
173
|
+
// forward-declares potentialFBM; this defines it (ES 3.00 allows the prototype).
|
|
174
|
+
float potentialFBM(vec2 p) { return fbm(p); }
|
|
175
|
+
|
|
159
176
|
// AX.W12 — the painterly-medium organic noise basis (Jarzynski PCG2D integer-bit hash
|
|
160
177
|
// + 2D simplex gradient noise), SPLICED from the shared procedural-color chunk (the
|
|
161
178
|
// single hash source).
|
|
@@ -164,19 +181,19 @@ float fbm(vec2 p) {
|
|
|
164
181
|
// fbm above (the cost-tiering is preserved per AX.W12 §3a — this is an ADDITIVE basis,
|
|
165
182
|
// not a blanket upgrade). The aurora-local hash21/vnoise/fbm loop stays (legitimately
|
|
166
183
|
// divergent per the chunk's §3a).
|
|
167
|
-
${
|
|
184
|
+
${a}
|
|
168
185
|
|
|
169
186
|
// The sRGB OETF (linearToSrgb) — spliced from the shared procedural-color chunk
|
|
170
187
|
// (AV.W2 — the single OETF source; the AV.W1 local copy is deleted here). Aurora's
|
|
171
188
|
// linear pipeline closes the seam with this transfer before fragColor (the
|
|
172
189
|
// proof:aurora-space-gamma seam).
|
|
173
|
-
${
|
|
190
|
+
${s}
|
|
174
191
|
|
|
175
192
|
// W5 — the four Ottosson OKLab/OKLCh matrices + their space fns, spliced from the
|
|
176
193
|
// SAME shared chunk the goo-blob uses (zero new payload, 1e-6-verified). PI is
|
|
177
194
|
// defined first because the chunk's oklabToOklch folds the hue into [0, 2pi).
|
|
178
195
|
const float PI = 3.141592653589793;
|
|
179
|
-
${
|
|
196
|
+
${l}
|
|
180
197
|
|
|
181
198
|
// ── OKLCh palette ramp (W5 interp · AX.W11 single-sourced twin) ───────────────
|
|
182
199
|
// The muddy-midtone kill: distant-hue stops interpolated by a plain linear mix()
|
|
@@ -188,7 +205,7 @@ ${n}
|
|
|
188
205
|
// the smoothstep-eased samplePaletteRamp dispatcher) is SPLICED from the shared
|
|
189
206
|
// procedural-color chunk (the single ramp source). composition.glsl.ts's
|
|
190
207
|
// samplePalette calls samplePaletteRamp.
|
|
191
|
-
${
|
|
208
|
+
${r}
|
|
192
209
|
|
|
193
210
|
// Interleaved Gradient Noise (Jimenez) — a 1-LSB triangular dither applied in
|
|
194
211
|
// DISPLAY space AFTER the OETF, so 8-bit mid-tone banding on the soft gradient is
|
|
@@ -232,6 +249,13 @@ vec2 domainWarp(vec2 p, float t) {
|
|
|
232
249
|
float c1 = cellular(p * uWarpScale * 1.2);
|
|
233
250
|
float c2 = cellular(p * uWarpScale * 1.2 + vec2(11.0, 7.0));
|
|
234
251
|
warp = mix(r, vec2(c1, c2), 0.5);
|
|
252
|
+
} else if (uWarpMode == 3) {
|
|
253
|
+
// BB.B1 — curl (Bridson flow warp). The divergence-free curl of an fbm potential
|
|
254
|
+
// advects the field along a source-free swirl — folds + stretches like fluid
|
|
255
|
+
// advection, never the source-y bulge a raw fbm gradient produces. The potential
|
|
256
|
+
// scrolls on the same warp-drift clock; curlFBM is the shared chunk's operator.
|
|
257
|
+
vec2 fp = p * uWarpScale + vec2(t * uWarpDrift * K_WARP);
|
|
258
|
+
warp = curlFBM(fp);
|
|
235
259
|
}
|
|
236
260
|
vec2 warped = p + uWarpAmount * warp;
|
|
237
261
|
|
|
@@ -257,14 +281,31 @@ vec2 domainWarp(vec2 p, float t) {
|
|
|
257
281
|
return warped;
|
|
258
282
|
}
|
|
259
283
|
|
|
260
|
-
` +
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
let
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
284
|
+
` + ve + k + ye + k + "// ── 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" + be + k + we + k + xe + k + Te + k + "\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 // 7 kuwahara (anisotropic-Kuwahara edge-preserving painterly finish — BB.W-AUR-KUWAHARA).\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). Kuwahara is OPT-IN (default-off — no preset selects\n // it unless a config explicitly sets medium:\"kuwahara\"); the smooth default + the\n // van-Gogh HERO + the existing painterly bodies are byte-unchanged by its addition.\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 else if (uMedium == 7) col = mediumKuwahara(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";
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/components/custom/aurora/constants/renderMode.ts
|
|
287
|
+
function A() {
|
|
288
|
+
let e;
|
|
289
|
+
try {
|
|
290
|
+
e = p();
|
|
291
|
+
} catch {
|
|
292
|
+
return !1;
|
|
293
|
+
}
|
|
294
|
+
return e === null ? !1 : e.includes("swiftshader") || e.includes("llvmpipe") || e.includes("software") || e.includes("basic render") || e.includes("microsoft basic");
|
|
295
|
+
}
|
|
296
|
+
function j(e, t = {}) {
|
|
297
|
+
return e !== "css" && !t.forceWebGLUnderSoftwareRaster && A() ? "css" : e === "auto" ? "webgl" : e;
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/components/custom/aurora/composables/glSetup.ts
|
|
301
|
+
var M = "[Aurora]", De = /* @__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(".");
|
|
302
|
+
function Oe(e, t, n) {
|
|
303
|
+
let r = _(e, e.VERTEX_SHADER, t, M), i = _(e, e.FRAGMENT_SHADER, n, M), a = g(e, r, i, M);
|
|
304
|
+
e.useProgram(a);
|
|
305
|
+
let o = e.createVertexArray();
|
|
306
|
+
e.bindVertexArray(o);
|
|
307
|
+
let s = e.createBuffer();
|
|
308
|
+
e.bindBuffer(e.ARRAY_BUFFER, s), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
268
309
|
-1,
|
|
269
310
|
-1,
|
|
270
311
|
3,
|
|
@@ -272,134 +313,158 @@ function P(e, t, n) {
|
|
|
272
313
|
-1,
|
|
273
314
|
3
|
|
274
315
|
]), e.STATIC_DRAW);
|
|
275
|
-
let
|
|
276
|
-
e.enableVertexAttribArray(
|
|
277
|
-
let
|
|
278
|
-
for (let t of
|
|
316
|
+
let c = e.getAttribLocation(a, "aPos");
|
|
317
|
+
e.enableVertexAttribArray(c), e.vertexAttribPointer(c, 2, e.FLOAT, !1, 0, 0);
|
|
318
|
+
let l = {};
|
|
319
|
+
for (let t of De) l[t] = e.getUniformLocation(a, t);
|
|
279
320
|
return {
|
|
280
|
-
program:
|
|
321
|
+
program: a,
|
|
281
322
|
vs: r,
|
|
282
323
|
fs: i,
|
|
283
|
-
uniforms:
|
|
324
|
+
uniforms: l,
|
|
284
325
|
geometry: {
|
|
285
|
-
vao:
|
|
286
|
-
buf:
|
|
326
|
+
vao: o,
|
|
327
|
+
buf: s
|
|
287
328
|
}
|
|
288
329
|
};
|
|
289
330
|
}
|
|
290
331
|
//#endregion
|
|
291
332
|
//#region src/components/custom/aurora/composables/color.ts
|
|
292
|
-
function
|
|
333
|
+
function N(e, t = 8, n) {
|
|
293
334
|
let r = n ?? new Float32Array(t * 3), i = Math.min(e.length, t);
|
|
294
335
|
for (let t = 0; t < i; t++) {
|
|
295
|
-
let [n, i, a] =
|
|
336
|
+
let [n, i, a] = x(e[t]);
|
|
296
337
|
r[t * 3 + 0] = n, r[t * 3 + 1] = i, r[t * 3 + 2] = a;
|
|
297
338
|
}
|
|
298
339
|
for (let e = i; e < t; e++) r[e * 3 + 0] = 0, r[e * 3 + 1] = 0, r[e * 3 + 2] = 0;
|
|
299
340
|
return r;
|
|
300
341
|
}
|
|
301
|
-
function
|
|
342
|
+
function P(e) {
|
|
302
343
|
if (e.length === 0) return "transparent";
|
|
303
|
-
if (e.length === 1) return
|
|
344
|
+
if (e.length === 1) return C(e[0]);
|
|
304
345
|
let t = e.length;
|
|
305
346
|
return `linear-gradient(135deg, ${e.map((e, n) => {
|
|
306
347
|
let r = Math.round(n / (t - 1) * 100);
|
|
307
|
-
return `${
|
|
348
|
+
return `${C(e)} ${r}%`;
|
|
308
349
|
}).join(", ")})`;
|
|
309
350
|
}
|
|
310
|
-
function
|
|
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] =
|
|
351
|
+
function ke(e) {
|
|
352
|
+
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] = ge(n / 255, r / 255, i / 255), [c, l, u] = he(a, o, s);
|
|
312
353
|
return {
|
|
313
354
|
L: c,
|
|
314
355
|
C: l,
|
|
315
356
|
h: u
|
|
316
357
|
};
|
|
317
358
|
}
|
|
318
|
-
var
|
|
319
|
-
function
|
|
320
|
-
let n = typeof e == "string" ?
|
|
321
|
-
|
|
322
|
-
let
|
|
323
|
-
for (let e = 0; e <
|
|
324
|
-
let t =
|
|
325
|
-
if (l === "bell")
|
|
359
|
+
var Ae = [.35, .95];
|
|
360
|
+
function F(e, t = {}) {
|
|
361
|
+
let n = typeof e == "string" ? w(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, avoidHues: d } = t, f = Math.max(2, Math.min(8, Math.round(r))), [p, m] = Ae, h = n.L - a / 2, g = n.L + a / 2;
|
|
362
|
+
h < p && (g += p - h, h = p), g > m && (h -= g - m, g = m), h = Math.max(p, h), g = Math.min(m, g);
|
|
363
|
+
let _ = [];
|
|
364
|
+
for (let e = 0; e < f; e++) {
|
|
365
|
+
let t = f === 1 ? 0 : e / (f - 1), r = h + (g - h) * I(t, c), a = n.C * o, p;
|
|
366
|
+
if (l === "bell") p = a + (n.C - a) * je(t);
|
|
326
367
|
else {
|
|
327
|
-
let e = l === "sine" ?
|
|
328
|
-
|
|
368
|
+
let e = l === "sine" ? I(t, "sine") : t;
|
|
369
|
+
p = n.C - (n.C - a) * e;
|
|
329
370
|
}
|
|
330
|
-
let
|
|
331
|
-
u > 0 && (
|
|
371
|
+
let m = ne(n.h, i, s, t);
|
|
372
|
+
u > 0 && (m = Fe(m, t, u)), d && d.length > 0 && (m = Le(m, d)), _.push(te({
|
|
332
373
|
L: r,
|
|
333
|
-
C:
|
|
334
|
-
h:
|
|
374
|
+
C: p,
|
|
375
|
+
h: m
|
|
335
376
|
}));
|
|
336
377
|
}
|
|
337
|
-
return
|
|
378
|
+
return _;
|
|
338
379
|
}
|
|
339
|
-
function
|
|
380
|
+
function I(e, t) {
|
|
340
381
|
return t === "sine" ? .5 - .5 * Math.cos(Math.PI * e) : e;
|
|
341
382
|
}
|
|
342
|
-
function
|
|
383
|
+
function je(e) {
|
|
343
384
|
return Math.sin(Math.PI * e);
|
|
344
385
|
}
|
|
345
|
-
var
|
|
346
|
-
function
|
|
386
|
+
var Me = 70, Ne = 250, Pe = 22;
|
|
387
|
+
function Fe(e, t, n) {
|
|
347
388
|
let r = (t - .5) * 2;
|
|
348
389
|
if (r === 0 || n === 0) return e;
|
|
349
|
-
let i = (
|
|
350
|
-
return ((e + Math.sign(i) * Math.min(Math.abs(r) * n *
|
|
390
|
+
let i = (me(e, r >= 0 ? Me : Ne, 1, "shorter") - e + 540) % 360 - 180;
|
|
391
|
+
return ((e + Math.sign(i) * Math.min(Math.abs(r) * n * Pe, Math.abs(i))) % 360 + 360) % 360;
|
|
392
|
+
}
|
|
393
|
+
var L = (e) => (e % 360 + 360) % 360;
|
|
394
|
+
function Ie(e, t, n) {
|
|
395
|
+
let r = L(e), i = L(t), a = L(n);
|
|
396
|
+
return i <= a ? r >= i && r <= a : r >= i || r <= a;
|
|
397
|
+
}
|
|
398
|
+
function R(e, t) {
|
|
399
|
+
let n = Math.abs(L(e) - L(t)) % 360;
|
|
400
|
+
return n > 180 ? 360 - n : n;
|
|
401
|
+
}
|
|
402
|
+
function Le(e, t) {
|
|
403
|
+
let n = .5, r = L(e);
|
|
404
|
+
for (let e = 0; e < t.length + 2; e++) {
|
|
405
|
+
let e = !1;
|
|
406
|
+
for (let [i, a] of t) {
|
|
407
|
+
if (!Ie(r, i, a)) continue;
|
|
408
|
+
let t = L(i - n), o = L(a + n);
|
|
409
|
+
r = R(r, t) <= R(r, o) ? t : o, e = !0;
|
|
410
|
+
}
|
|
411
|
+
if (!e) return r;
|
|
412
|
+
}
|
|
413
|
+
return r;
|
|
351
414
|
}
|
|
352
415
|
//#endregion
|
|
353
416
|
//#region src/components/custom/aurora/composables/uniformBridge.ts
|
|
354
|
-
var
|
|
417
|
+
var z = {
|
|
355
418
|
smooth: 0,
|
|
356
419
|
pastel: 1,
|
|
357
420
|
watercolor: 2,
|
|
358
421
|
oil: 3,
|
|
359
422
|
crayon: 4,
|
|
360
423
|
vangogh: 5,
|
|
361
|
-
"oil-pastel": 6
|
|
362
|
-
|
|
424
|
+
"oil-pastel": 6,
|
|
425
|
+
kuwahara: 7
|
|
426
|
+
}, B = {
|
|
363
427
|
shorter: 0,
|
|
364
428
|
longer: 1,
|
|
365
429
|
increasing: 2,
|
|
366
430
|
decreasing: 3
|
|
367
|
-
},
|
|
431
|
+
}, Re = {
|
|
368
432
|
none: 0,
|
|
369
433
|
radial: 1,
|
|
370
434
|
swirl: 2,
|
|
371
435
|
diagonal: 3,
|
|
372
436
|
multi: 4,
|
|
373
437
|
tensor: 5
|
|
374
|
-
},
|
|
438
|
+
}, V = {
|
|
375
439
|
flow: 0,
|
|
376
440
|
tensor: 1
|
|
377
|
-
},
|
|
441
|
+
}, H = {
|
|
378
442
|
fbm: 0,
|
|
379
443
|
cellular: 1,
|
|
380
|
-
hybrid: 2
|
|
381
|
-
|
|
444
|
+
hybrid: 2,
|
|
445
|
+
curl: 3
|
|
446
|
+
}, ze = {
|
|
382
447
|
oil: 0,
|
|
383
448
|
knife: 1,
|
|
384
449
|
chunky: 3
|
|
385
|
-
},
|
|
450
|
+
}, U = {
|
|
386
451
|
L: .985,
|
|
387
452
|
C: .0125,
|
|
388
453
|
h: 77.5
|
|
389
454
|
};
|
|
390
|
-
function
|
|
391
|
-
return e === void 0 ?
|
|
455
|
+
function Be(e) {
|
|
456
|
+
return e === void 0 ? S(U.L, U.C, U.h) : Array.isArray(e) ? e : S(e.L, e.C, e.h);
|
|
392
457
|
}
|
|
393
|
-
function
|
|
394
|
-
return
|
|
458
|
+
function Ve(e) {
|
|
459
|
+
return z[e.medium];
|
|
395
460
|
}
|
|
396
|
-
function
|
|
397
|
-
return
|
|
461
|
+
function He(e) {
|
|
462
|
+
return ze[e.strokeMode];
|
|
398
463
|
}
|
|
399
|
-
function
|
|
400
|
-
return e.medium === "vangogh" || e.medium === "oil-pastel" || e.medium === "crayon" ?
|
|
464
|
+
function Ue(e) {
|
|
465
|
+
return e.medium === "vangogh" || e.medium === "oil-pastel" || e.medium === "crayon" || e.medium === "kuwahara" ? V.tensor : V[e.strokeOrient ?? "flow"];
|
|
401
466
|
}
|
|
402
|
-
function
|
|
467
|
+
function We(e, t, n, r) {
|
|
403
468
|
let i = (e) => 1 - e, a = {
|
|
404
469
|
palette: new Float32Array(24),
|
|
405
470
|
pos: new Float32Array(12),
|
|
@@ -412,7 +477,7 @@ function Me(e, t, n, r) {
|
|
|
412
477
|
angle: new Float32Array(6)
|
|
413
478
|
};
|
|
414
479
|
return function(o) {
|
|
415
|
-
e.useProgram(t),
|
|
480
|
+
e.useProgram(t), N(o.palette, 8, a.palette), e.uniform3fv(n.uPalette, a.palette), e.uniform1i(n.uStopCount, Math.min(o.palette.length, 8));
|
|
416
481
|
let s = Math.min(o.nuclei.length, 6);
|
|
417
482
|
e.uniform1i(n.uNucleiCount, s);
|
|
418
483
|
for (let e = 0; e < s; e++) {
|
|
@@ -420,13 +485,13 @@ function Me(e, t, n, r) {
|
|
|
420
485
|
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;
|
|
421
486
|
}
|
|
422
487
|
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;
|
|
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,
|
|
488
|
+
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, H[o.warpMode]), e.uniform1i(n.uNoiseOctaves, o.noiseOctaves), e.uniform1i(n.uMedium, Ve(o)), e.uniform1i(n.uHuePath, B[o.huePath ?? "shorter"]), e.uniform1i(n.uFlowPattern, Re[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, He(o)), e.uniform1i(n.uStrokeOrient, Ue(o));
|
|
424
489
|
{
|
|
425
490
|
let t = o.lightDir ?? [
|
|
426
491
|
-.5,
|
|
427
492
|
.6,
|
|
428
493
|
.62
|
|
429
|
-
], r =
|
|
494
|
+
], r = Be(o.lightColor);
|
|
430
495
|
e.uniform3f(n.uLightDir, t[0], t[1], t[2]), e.uniform3f(n.uLightColor, r[0], r[1], r[2]);
|
|
431
496
|
}
|
|
432
497
|
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);
|
|
@@ -434,8 +499,8 @@ function Me(e, t, n, r) {
|
|
|
434
499
|
}
|
|
435
500
|
//#endregion
|
|
436
501
|
//#region src/components/custom/aurora/composables/cursorModel.ts
|
|
437
|
-
var
|
|
438
|
-
function
|
|
502
|
+
var W = .22, Ge = .18, Ke = .992, qe = .96, G = .3;
|
|
503
|
+
function Je() {
|
|
439
504
|
return {
|
|
440
505
|
x: .5,
|
|
441
506
|
y: .5,
|
|
@@ -449,55 +514,800 @@ function Ie() {
|
|
|
449
514
|
burst: 0
|
|
450
515
|
};
|
|
451
516
|
}
|
|
452
|
-
function
|
|
517
|
+
function K(e, t = 1) {
|
|
453
518
|
let n = Math.max(0, Math.min(1, t));
|
|
454
|
-
e.x += (e.targetX - e.x) *
|
|
519
|
+
e.x += (e.targetX - e.x) * W, e.y += (e.targetY - e.y) * W, e.strength += (e.targetStrength - e.strength) * Ge, e.targetStrength *= Ke, e.velX *= (1 - G) * n, e.velY *= (1 - G) * n, e.burst *= qe * n;
|
|
455
520
|
}
|
|
456
|
-
function
|
|
521
|
+
function Ye(e, t, n) {
|
|
457
522
|
let r = .12, i = Math.max(-r, Math.min(r, t)), a = Math.max(-r, Math.min(r, n));
|
|
458
|
-
e.velX += (i - e.velX) *
|
|
523
|
+
e.velX += (i - e.velX) * G, e.velY += (a - e.velY) * G;
|
|
459
524
|
let o = Math.hypot(i, a);
|
|
460
525
|
e.burst = Math.min(1, e.burst + o * 4);
|
|
461
526
|
}
|
|
462
|
-
function
|
|
527
|
+
function q(e) {
|
|
463
528
|
return e.targetStrength > .001 || e.strength > .001 || Math.abs(e.x - e.targetX) > .001 || Math.abs(e.y - e.targetY) > .001;
|
|
464
529
|
}
|
|
465
530
|
//#endregion
|
|
466
531
|
//#region src/components/custom/aurora/composables/frameLoop.ts
|
|
467
|
-
function
|
|
468
|
-
let { gl: t, prog: n, uniforms: r, cursor: i, getConfig: a, getReducedMotion: o } = e,
|
|
469
|
-
function
|
|
532
|
+
function Xe(e) {
|
|
533
|
+
let { gl: t, prog: n, uniforms: r, cursor: i, getConfig: a, getReducedMotion: o, pointerField: s } = e, c = (e) => 1 - e, l = null;
|
|
534
|
+
function u() {
|
|
470
535
|
return +!o();
|
|
471
536
|
}
|
|
472
|
-
function
|
|
473
|
-
if (t.useProgram(n), t.uniform2f(r.uCursor, i.x,
|
|
474
|
-
let n =
|
|
475
|
-
o = o * (1 - d) +
|
|
537
|
+
function d(e) {
|
|
538
|
+
if (t.useProgram(n), t.uniform2f(r.uCursor, i.x, c(i.y)), t.uniform1f(r.uCursorStrength, i.strength), t.uniform1f(r.uCursorRadius, i.radius), t.uniform2f(r.uCursorVelocity, i.velX, -i.velY), t.uniform1f(r.uCursorBurst, i.burst), t.uniform1f(r.uTime, e), a().interactivity?.light) {
|
|
539
|
+
let n = u(), a = e * .25, o = Math.cos(a) * .5, s = Math.sin(a) * .5, c = (i.x - .5) * 2, l = (.5 - i.y) * 2, d = i.strength * n;
|
|
540
|
+
o = o * (1 - d) + c * d, s = s * (1 - d) + l * d, t.uniform3f(r.uLightDir, o * n + (1 - n) * -.5, s * n + (1 - n) * .6, .62);
|
|
476
541
|
}
|
|
477
542
|
t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLES, 0, 3);
|
|
478
543
|
}
|
|
479
|
-
function
|
|
544
|
+
function f() {
|
|
480
545
|
if (o()) return !1;
|
|
481
546
|
let e = a();
|
|
482
|
-
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 || e.interactivity?.light && i.burst > .001 ? !0 :
|
|
547
|
+
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 || e.interactivity?.light && i.burst > .001 ? !0 : q(i);
|
|
483
548
|
}
|
|
484
549
|
return {
|
|
485
550
|
frame: (e) => {
|
|
486
|
-
|
|
551
|
+
let t = l === null ? 0 : Math.max(0, (e - l) * 1e3);
|
|
552
|
+
l = e, s.tick(u() === 0 ? 0 : t);
|
|
553
|
+
let n = s.acceleration.value, r = s.velocity.value, a = -(n.x * r.x + n.y * r.y);
|
|
554
|
+
a > 0 && u() > 0 && (i.burst = Math.min(1, i.burst + a * 6)), K(i, u()), d(e);
|
|
487
555
|
},
|
|
488
|
-
needsAnimation:
|
|
556
|
+
needsAnimation: f
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/components/custom/aurora/constants/shaders/aurora.wgsl.ts
|
|
561
|
+
var Ze = `
|
|
562
|
+
const MAX_NUCLEI: i32 = 6;
|
|
563
|
+
const MAX_STOPS: i32 = 8;
|
|
564
|
+
const PI: f32 = 3.141592653589793;
|
|
565
|
+
|
|
566
|
+
// ── Uniforms (the typed-struct source-of-truth — see aurora.wgsl.uniforms.ts) ──
|
|
567
|
+
// Scalars are packed into vec4 lanes to keep the std140/WGSL 16-byte struct alignment
|
|
568
|
+
// trivial. nuc0[i] = (pos.x, pos.y, radius, paletteBias); nuc1[i] = (valueBias,
|
|
569
|
+
// driftRadius, driftPhase, elong); nuc2[i] = (angle, _, _, _). palette[i].rgb is the
|
|
570
|
+
// CPU-baked linear-sRGB stop.
|
|
571
|
+
struct Uniforms {
|
|
572
|
+
// scalars0: (uTime, uSoftmaxBeta, uValueVariance, uWarpAmount)
|
|
573
|
+
scalars0: vec4<f32>,
|
|
574
|
+
// scalars1: (uWarpScale, uWarpDrift, uSaturation, uPaperGrain)
|
|
575
|
+
scalars1: vec4<f32>,
|
|
576
|
+
// scalars2: (uAlpha, uNucleiDrift, uPaletteDrift, uBreathDepth)
|
|
577
|
+
scalars2: vec4<f32>,
|
|
578
|
+
// scalars3: (uBreathPeriod, uCursorStrength, uCursorRadius, _pad)
|
|
579
|
+
scalars3: vec4<f32>,
|
|
580
|
+
// cursor: (uCursor.x, uCursor.y, _pad, _pad)
|
|
581
|
+
cursor: vec4<f32>,
|
|
582
|
+
// ints: (uStopCount, uNucleiCount, uWarpMode, uNoiseOctaves)
|
|
583
|
+
ints0: vec4<i32>,
|
|
584
|
+
// ints1: (uMedium, uHuePath, _, _)
|
|
585
|
+
ints1: vec4<i32>,
|
|
586
|
+
palette: array<vec4<f32>, 8>,
|
|
587
|
+
nuc0: array<vec4<f32>, 6>,
|
|
588
|
+
nuc1: array<vec4<f32>, 6>,
|
|
589
|
+
nuc2: array<vec4<f32>, 6>,
|
|
590
|
+
// BC.W-VIZ-AURORA (T4) — the painterly-medium scalar lanes. APPENDED after the
|
|
591
|
+
// arrays so EVERY existing offset (and the smooth-default parity capture) is
|
|
592
|
+
// byte-identical (these lanes are written 0 on a smooth config). scalars4:
|
|
593
|
+
// (uStrokeAmount, uStrokeScale, uStrokeAnisotropy, uCanvasGrain). scalars5:
|
|
594
|
+
// (uWetEdge, uGranulation, uBrokenColor, uKuwaharaQ). kuwahara: (uKuwaharaRadius,
|
|
595
|
+
// uKuwaharaSectors, _, _) — the Kuwahara radius/sectors/q in lockstep with
|
|
596
|
+
// packAuroraWGPUUniforms (the typed-struct discipline).
|
|
597
|
+
scalars4: vec4<f32>,
|
|
598
|
+
scalars5: vec4<f32>,
|
|
599
|
+
kuwahara: vec4<f32>,
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
@group(0) @binding(0) var<uniform> u: Uniforms;
|
|
603
|
+
|
|
604
|
+
// ── Authoring-scale → rad/sec lifts (byte-identical to aurora.frag.ts) ──
|
|
605
|
+
const K_NUCLEI: f32 = 14.0;
|
|
606
|
+
const K_PAL: f32 = 24.0;
|
|
607
|
+
const K_WARP: f32 = 5.0;
|
|
608
|
+
|
|
609
|
+
// ── Noise (aurora-local hash21/vnoise/fbm — legitimately divergent per AV.W2 §3a) ──
|
|
610
|
+
fn hash21(p0: vec2<f32>) -> f32 {
|
|
611
|
+
var p = fract(p0 * vec2<f32>(123.34, 456.21));
|
|
612
|
+
p = p + dot(p, p + 45.32);
|
|
613
|
+
return fract(p.x * p.y);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
fn hash22(p0: vec2<f32>) -> vec2<f32> {
|
|
617
|
+
let p = vec2<f32>(dot(p0, vec2<f32>(127.1, 311.7)),
|
|
618
|
+
dot(p0, vec2<f32>(269.5, 183.3)));
|
|
619
|
+
return fract(sin(p) * 43758.5453);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
fn vnoise(p: vec2<f32>) -> f32 {
|
|
623
|
+
let i = floor(p);
|
|
624
|
+
let f = fract(p);
|
|
625
|
+
let uu = f * f * (3.0 - 2.0 * f);
|
|
626
|
+
let a = hash21(i);
|
|
627
|
+
let b = hash21(i + vec2<f32>(1.0, 0.0));
|
|
628
|
+
let c = hash21(i + vec2<f32>(0.0, 1.0));
|
|
629
|
+
let d = hash21(i + vec2<f32>(1.0, 1.0));
|
|
630
|
+
return mix(mix(a, b, uu.x), mix(c, d, uu.x), uu.y);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
${u}
|
|
634
|
+
|
|
635
|
+
fn fbm(p0: vec2<f32>) -> f32 {
|
|
636
|
+
var v = 0.0;
|
|
637
|
+
var a = 0.5;
|
|
638
|
+
var p = p0;
|
|
639
|
+
let octaves = u.ints0.w;
|
|
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
|
+
${o}
|
|
650
|
+
${c}
|
|
651
|
+
${i}
|
|
652
|
+
|
|
653
|
+
// Interleaved Gradient Noise (Jimenez) — display-space 1-LSB dither.
|
|
654
|
+
fn ign(p: vec2<f32>) -> f32 {
|
|
655
|
+
return fract(52.9829189 * fract(dot(p, vec2<f32>(0.06711056, 0.00583715))));
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// Cellular / Worley f1.
|
|
659
|
+
fn cellular(p: vec2<f32>) -> f32 {
|
|
660
|
+
let i = floor(p);
|
|
661
|
+
let f = fract(p);
|
|
662
|
+
var m = 1e9;
|
|
663
|
+
for (var y = -1; y <= 1; y = y + 1) {
|
|
664
|
+
for (var x = -1; x <= 1; x = x + 1) {
|
|
665
|
+
let g = vec2<f32>(f32(x), f32(y));
|
|
666
|
+
let o = hash22(i + g);
|
|
667
|
+
let r = g + o - f;
|
|
668
|
+
m = min(m, dot(r, r));
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return sqrt(m);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// ── Warp (Quilez double warp + the three warp modes + the cursor swirl) ──
|
|
675
|
+
fn domainWarp(p: vec2<f32>, t: f32) -> vec2<f32> {
|
|
676
|
+
let warpScale = u.scalars1.x;
|
|
677
|
+
let warpDrift = u.scalars1.y;
|
|
678
|
+
let warpAmount = u.scalars0.w;
|
|
679
|
+
let warpMode = u.ints0.z;
|
|
680
|
+
let cursorStrength = u.scalars3.y;
|
|
681
|
+
let cursorRadius = u.scalars3.z;
|
|
682
|
+
let cursor = u.cursor.xy;
|
|
683
|
+
|
|
684
|
+
let q = vec2<f32>(fbm(p * warpScale + vec2<f32>(0.0, 0.0) + t * warpDrift * K_WARP),
|
|
685
|
+
fbm(p * warpScale + vec2<f32>(5.2, 1.3) + t * warpDrift * K_WARP));
|
|
686
|
+
let r = vec2<f32>(fbm(p * warpScale + 4.0 * q + vec2<f32>(1.7, 9.2)),
|
|
687
|
+
fbm(p * warpScale + 4.0 * q + vec2<f32>(8.3, 2.8)));
|
|
688
|
+
|
|
689
|
+
var warp = r;
|
|
690
|
+
if (warpMode == 1) {
|
|
691
|
+
// cellular — chunky territories
|
|
692
|
+
let c1 = cellular(p * warpScale * 1.5 + vec2<f32>(t * warpDrift * K_WARP * 2.0, 0.0));
|
|
693
|
+
let c2 = cellular(p * warpScale * 1.5 + vec2<f32>(11.0, 7.0 + t * warpDrift * K_WARP * 2.0));
|
|
694
|
+
warp = vec2<f32>(c1, c2);
|
|
695
|
+
} else if (warpMode == 2) {
|
|
696
|
+
// hybrid — fbm + cellular averaged
|
|
697
|
+
let c1 = cellular(p * warpScale * 1.2);
|
|
698
|
+
let c2 = cellular(p * warpScale * 1.2 + vec2<f32>(11.0, 7.0));
|
|
699
|
+
warp = mix(r, vec2<f32>(c1, c2), 0.5);
|
|
700
|
+
}
|
|
701
|
+
var warped = p + warpAmount * warp;
|
|
702
|
+
|
|
703
|
+
// Cursor swirl — rotate p around the cursor with radial falloff.
|
|
704
|
+
if (cursorStrength > 0.001) {
|
|
705
|
+
let toP = p - cursor;
|
|
706
|
+
let d = length(toP);
|
|
707
|
+
let rr = max(cursorRadius, 0.01);
|
|
708
|
+
let w = exp(-(d * d) / (rr * rr * 0.45));
|
|
709
|
+
let ang = w * cursorStrength * 2.1;
|
|
710
|
+
let ca = cos(ang);
|
|
711
|
+
let sa = sin(ang);
|
|
712
|
+
var rotated = vec2<f32>(ca * toP.x - sa * toP.y, sa * toP.x + ca * toP.y) + cursor;
|
|
713
|
+
let pinch = w * cursorStrength * 0.08;
|
|
714
|
+
rotated = mix(rotated, cursor, pinch);
|
|
715
|
+
warped = mix(warped, rotated + warpAmount * warp * 0.7, w * cursorStrength);
|
|
716
|
+
}
|
|
717
|
+
return warped;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// ── Palette LUT ──
|
|
721
|
+
fn samplePalette(id0: f32) -> vec3<f32> {
|
|
722
|
+
let id = clamp(id0, 0.0, 1.0);
|
|
723
|
+
let stopCount = u.ints0.x;
|
|
724
|
+
let scaled = id * f32(stopCount - 1);
|
|
725
|
+
let i0 = i32(floor(scaled));
|
|
726
|
+
let i1 = min(i0 + 1, stopCount - 1);
|
|
727
|
+
let t = fract(scaled);
|
|
728
|
+
return samplePaletteRamp(u.palette[i0].rgb, u.palette[i1].rgb, t, u.ints1.y);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// ── Nuclei field (anisotropic Gaussian softmax + drift + palette drift) ──
|
|
732
|
+
struct NucleiResult { paletteId: f32, valueMod: f32 };
|
|
733
|
+
|
|
734
|
+
fn nucleiField(p: vec2<f32>, t: f32) -> NucleiResult {
|
|
735
|
+
let nucleiCount = u.ints0.y;
|
|
736
|
+
let nucleiDrift = u.scalars2.y;
|
|
737
|
+
let paletteDrift = u.scalars2.z;
|
|
738
|
+
let softmaxBeta = u.scalars0.y;
|
|
739
|
+
|
|
740
|
+
var accumBias = 0.0;
|
|
741
|
+
var accumValue = 0.0;
|
|
742
|
+
var accumW = 0.0;
|
|
743
|
+
for (var i = 0; i < MAX_NUCLEI; i = i + 1) {
|
|
744
|
+
if (i >= nucleiCount) { break; }
|
|
745
|
+
let n0 = u.nuc0[i]; // pos.x, pos.y, radius, paletteBias
|
|
746
|
+
let n1 = u.nuc1[i]; // valueBias, driftRadius, driftPhase, elong
|
|
747
|
+
let angle = u.nuc2[i].x;
|
|
748
|
+
let driftRadius = n1.y;
|
|
749
|
+
let driftPhase = n1.z;
|
|
750
|
+
let posI = n0.xy + driftRadius * vec2<f32>(
|
|
751
|
+
cos(t * nucleiDrift * K_NUCLEI + driftPhase),
|
|
752
|
+
sin(t * nucleiDrift * K_NUCLEI + driftPhase * 1.13)
|
|
753
|
+
);
|
|
754
|
+
let diff = p - posI;
|
|
755
|
+
let ca = cos(angle);
|
|
756
|
+
let sa = sin(angle);
|
|
757
|
+
let local = vec2<f32>(ca * diff.x + sa * diff.y, -sa * diff.x + ca * diff.y);
|
|
758
|
+
let along = local.x / max(n1.w, 0.01);
|
|
759
|
+
let across = local.y;
|
|
760
|
+
let d2 = along * along + across * across;
|
|
761
|
+
let r = max(n0.z, 0.01);
|
|
762
|
+
let w = exp(-softmaxBeta * d2 / (r * r));
|
|
763
|
+
accumBias = accumBias + w * n0.w;
|
|
764
|
+
accumValue = accumValue + w * n1.x;
|
|
765
|
+
accumW = accumW + w;
|
|
766
|
+
}
|
|
767
|
+
var paletteId = accumBias / max(accumW, 1e-4);
|
|
768
|
+
let valueMod = accumValue / max(accumW, 1e-4);
|
|
769
|
+
|
|
770
|
+
let palAmp = clamp(paletteDrift * 6.0, 0.0, 0.06);
|
|
771
|
+
paletteId = paletteId + palAmp * sin(t * paletteDrift * K_PAL);
|
|
772
|
+
paletteId = clamp(paletteId, 0.0, 1.0);
|
|
773
|
+
return NucleiResult(paletteId, valueMod);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// ── Color utils (OKLCh saturation) ──
|
|
777
|
+
fn linOklab(lin: vec3<f32>) -> vec3<f32> {
|
|
778
|
+
let lms = LINEAR_SRGB_TO_LMS * lin;
|
|
779
|
+
return LMS_TO_OKLAB * cbrt3(lms);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
fn saturate3(c: vec3<f32>, amt: f32) -> vec3<f32> {
|
|
783
|
+
var lch = oklabToOklch(linOklab(c));
|
|
784
|
+
lch.y = max(lch.y * amt, 0.0);
|
|
785
|
+
return max(oklabToLinearSrgb(oklchToOklab(lch)), vec3<f32>(0.0));
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// ── PBR-Neutral tonemap (named aces() in the GLSL — the tonemap slot) ──
|
|
789
|
+
fn aces(color0: vec3<f32>) -> vec3<f32> {
|
|
790
|
+
let startCompression = 0.8 - 0.04;
|
|
791
|
+
let desaturation = 0.15;
|
|
792
|
+
var color = color0;
|
|
793
|
+
let x = min(color.r, min(color.g, color.b));
|
|
794
|
+
var offset = 0.04;
|
|
795
|
+
if (x < 0.08) { offset = x - 6.25 * x * x; }
|
|
796
|
+
color = color - offset;
|
|
797
|
+
let peak = max(color.r, max(color.g, color.b));
|
|
798
|
+
if (peak < startCompression) { return clamp(color, vec3<f32>(0.0), vec3<f32>(1.0)); }
|
|
799
|
+
let d = 1.0 - startCompression;
|
|
800
|
+
let newPeak = 1.0 - d * d / (peak + d - startCompression);
|
|
801
|
+
color = color * (newPeak / peak);
|
|
802
|
+
let g = 1.0 - 1.0 / (desaturation * (peak - newPeak) + 1.0);
|
|
803
|
+
return clamp(mix(color, newPeak * vec3<f32>(1.0), g), vec3<f32>(0.0), vec3<f32>(1.0));
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// ── BC.W-VIZ-AURORA (T4) — the painterly-medium bodies (the keystone WGSL port) ──
|
|
807
|
+
// Spliced HERE, after every helper the mediums consume is defined (domainWarp,
|
|
808
|
+
// nucleiField, samplePalette, linOklab, saturate3, oklabToOklch/oklchToOklab,
|
|
809
|
+
// hash21/vnoise/fbm) and before the vertex/fragment stages. applyMedium(col,p,t)
|
|
810
|
+
// is the dispatch the fragment stage calls.
|
|
811
|
+
|
|
812
|
+
// ── Painterly luma + medium scalar accessors ───────────────────────────────
|
|
813
|
+
const W_LUMA: vec3<f32> = vec3<f32>(0.2126, 0.7152, 0.0722);
|
|
814
|
+
|
|
815
|
+
fn mStrokeAmount() -> f32 { return u.scalars4.x; }
|
|
816
|
+
fn mStrokeScale() -> f32 { return u.scalars4.y; }
|
|
817
|
+
fn mStrokeAnisotropy() -> f32 { return u.scalars4.z; }
|
|
818
|
+
fn mCanvasGrain() -> f32 { return u.scalars4.w; }
|
|
819
|
+
fn mWetEdge() -> f32 { return u.scalars5.x; }
|
|
820
|
+
fn mGranulation() -> f32 { return u.scalars5.y; }
|
|
821
|
+
fn mBrokenColor() -> f32 { return u.scalars5.z; }
|
|
822
|
+
fn mKuwaharaQ() -> f32 { return u.scalars5.w; }
|
|
823
|
+
fn mKuwaharaRadius() -> f32 { return u.kuwahara.x; }
|
|
824
|
+
|
|
825
|
+
// ── Base color re-sample (the edge-mask operator the mediums Sobel/sector-sample) ──
|
|
826
|
+
// The WGSL twin of mediums.glsl.ts sampleBase: warp -> nuclei field -> palette -> value.
|
|
827
|
+
fn sampleBase(p: vec2<f32>, t: f32) -> vec3<f32> {
|
|
828
|
+
let pw = domainWarp(p, t);
|
|
829
|
+
let nf = nucleiField(pw, t);
|
|
830
|
+
var c = samplePalette(nf.paletteId);
|
|
831
|
+
c = c * (1.0 + u.scalars0.z * nf.valueMod);
|
|
832
|
+
return c;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// ── Broken color (hue + chroma jitter at constant OKLCh L) ──────────────────
|
|
836
|
+
fn brokenColorJitter(c: vec3<f32>, hueSeed: f32, valueSeed: f32, strength: f32) -> vec3<f32> {
|
|
837
|
+
let amt = clamp(mBrokenColor() * strength, 0.0, 1.0);
|
|
838
|
+
if (amt <= 0.001) { return c; }
|
|
839
|
+
var lch = oklabToOklch(linOklab(c));
|
|
840
|
+
lch.z = lch.z + (hueSeed - 0.5) * (32.0 * PI / 180.0) * amt;
|
|
841
|
+
lch.y = max(lch.y * (1.0 + (valueSeed - 0.5) * 0.28 * amt), 0.0);
|
|
842
|
+
return max(oklabToLinearSrgb(oklchToOklab(lch)), vec3<f32>(0.0));
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// ── Structure-tensor / edge-tangent-flow (AW.W4.1; the WGSL twin) ───────────
|
|
846
|
+
// Returns vec3(tangent.x, tangent.y, A) — the minor-eigenvector edge-tangent + coherence.
|
|
847
|
+
fn structureTensorField(p: vec2<f32>, t: f32, fallbackDir: vec2<f32>) -> vec3<f32> {
|
|
848
|
+
let e = 0.0035;
|
|
849
|
+
let l00 = dot(sampleBase(p + vec2<f32>(-e, -e), t), W_LUMA);
|
|
850
|
+
let l10 = dot(sampleBase(p + vec2<f32>(0.0, -e), t), W_LUMA);
|
|
851
|
+
let l20 = dot(sampleBase(p + vec2<f32>( e, -e), t), W_LUMA);
|
|
852
|
+
let l01 = dot(sampleBase(p + vec2<f32>(-e, 0.0), t), W_LUMA);
|
|
853
|
+
let l21 = dot(sampleBase(p + vec2<f32>( e, 0.0), t), W_LUMA);
|
|
854
|
+
let l02 = dot(sampleBase(p + vec2<f32>(-e, e), t), W_LUMA);
|
|
855
|
+
let l12 = dot(sampleBase(p + vec2<f32>(0.0, e), t), W_LUMA);
|
|
856
|
+
let l22 = dot(sampleBase(p + vec2<f32>( e, e), t), W_LUMA);
|
|
857
|
+
let Gx = (l20 + 2.0 * l21 + l22) - (l00 + 2.0 * l01 + l02);
|
|
858
|
+
let Gy = (l02 + 2.0 * l12 + l22) - (l00 + 2.0 * l10 + l20);
|
|
859
|
+
let Jxx = Gx * Gx;
|
|
860
|
+
let Jyy = Gy * Gy;
|
|
861
|
+
let Jxy = Gx * Gy;
|
|
862
|
+
let tr = Jxx + Jyy;
|
|
863
|
+
let disc = sqrt(max((Jxx - Jyy) * (Jxx - Jyy) + 4.0 * Jxy * Jxy, 0.0));
|
|
864
|
+
let lambdaMaj = 0.5 * (tr + disc);
|
|
865
|
+
let lambdaMin = 0.5 * (tr - disc);
|
|
866
|
+
var tangent: vec2<f32>;
|
|
867
|
+
if (disc < 1e-7) {
|
|
868
|
+
tangent = fallbackDir;
|
|
869
|
+
} else {
|
|
870
|
+
let theta = 0.5 * atan2(2.0 * Jxy, Jxx - Jyy);
|
|
871
|
+
tangent = vec2<f32>(-sin(theta), cos(theta));
|
|
872
|
+
}
|
|
873
|
+
var A = (lambdaMaj - lambdaMin) / (lambdaMaj + lambdaMin + 1e-6);
|
|
874
|
+
A = clamp(A, 0.0, 1.0);
|
|
875
|
+
if (dot(tangent, fallbackDir) < 0.0) { tangent = -tangent; }
|
|
876
|
+
let blendW = pow(A, 0.28);
|
|
877
|
+
let dir = normalize(mix(fallbackDir, tangent, blendW) + vec2<f32>(1e-6, 1e-6));
|
|
878
|
+
return vec3<f32>(dir, A);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// ── Flow field (the WGSL twin — the simple flow seed the medium fallback dirs use) ──
|
|
882
|
+
fn flowField(p: vec2<f32>, t: f32) -> vec2<f32> {
|
|
883
|
+
// Curl-noise-driven swirl (the medium-default dir; the full radial/swirl/diagonal
|
|
884
|
+
// dispatch rides uniforms the WGSL struct does not carry — the procedural mediums
|
|
885
|
+
// use this multi/curl seed as the fallback the structure tensor relaxes toward).
|
|
886
|
+
let n = fbm(p * 2.0 + vec2<f32>(t * 0.02, t * 0.02));
|
|
887
|
+
let a = n * 6.2831853;
|
|
888
|
+
var dir = vec2<f32>(cos(a), sin(a));
|
|
889
|
+
// Cursor swirl bias (matches the GLSL flow cursor term — the steady attraction).
|
|
890
|
+
let cursorStrength = u.scalars3.y;
|
|
891
|
+
let cursorRadius = u.scalars3.z;
|
|
892
|
+
let cursor = u.cursor.xy;
|
|
893
|
+
if (cursorStrength > 0.001) {
|
|
894
|
+
let toCur = cursor - p;
|
|
895
|
+
let d = length(toCur);
|
|
896
|
+
let r = max(cursorRadius, 0.01);
|
|
897
|
+
let w = exp(-(d * d) / (r * r * 0.5));
|
|
898
|
+
let tangent = vec2<f32>(-toCur.y, toCur.x) / max(d, 1e-4);
|
|
899
|
+
let a0 = atan2(dir.y, dir.x);
|
|
900
|
+
let a1 = atan2(tangent.y, tangent.x);
|
|
901
|
+
var da = a1 - a0;
|
|
902
|
+
da = atan2(sin(da), cos(da));
|
|
903
|
+
let aa = a0 + da * w * cursorStrength;
|
|
904
|
+
dir = vec2<f32>(cos(aa), sin(aa));
|
|
905
|
+
}
|
|
906
|
+
return dir;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// ── Watercolor — wet-edge cauliflowers + granulation + wash banding ─────────
|
|
910
|
+
fn mediumWatercolor(col0: vec3<f32>, p: vec2<f32>, t: f32) -> vec3<f32> {
|
|
911
|
+
var col = col0;
|
|
912
|
+
let eps = 0.004;
|
|
913
|
+
let cx1 = sampleBase(p + vec2<f32>(eps, 0.0), t);
|
|
914
|
+
let cx2 = sampleBase(p - vec2<f32>(eps, 0.0), t);
|
|
915
|
+
let cy1 = sampleBase(p + vec2<f32>(0.0, eps), t);
|
|
916
|
+
let cy2 = sampleBase(p - vec2<f32>(0.0, eps), t);
|
|
917
|
+
let gx = dot(cx1 - cx2, W_LUMA);
|
|
918
|
+
let gy = dot(cy1 - cy2, W_LUMA);
|
|
919
|
+
let edge = sqrt(gx * gx + gy * gy) / (2.0 * eps);
|
|
920
|
+
let mask = smoothstep(0.0, 2.5, edge);
|
|
921
|
+
col = col * mix(1.0, 0.78, mask * mWetEdge());
|
|
922
|
+
|
|
923
|
+
let paper = 0.5 * vnoise(p * 160.0) + 0.5 * vnoise(p * 360.0);
|
|
924
|
+
let pigLoad = 1.0 - dot(col, W_LUMA);
|
|
925
|
+
col = col * (1.0 - mGranulation() * pigLoad * (paper - 0.5));
|
|
926
|
+
|
|
927
|
+
let band = fbm(vec2<f32>(p.x * 1.5, p.y * 0.4));
|
|
928
|
+
col = col * (1.0 + 0.04 * (band - 0.5));
|
|
929
|
+
return col;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// ── Pastel — anisotropic stroke noise along the flow + tooth grain ──────────
|
|
933
|
+
fn mediumPastel(col0: vec3<f32>, p: vec2<f32>, t: f32) -> vec3<f32> {
|
|
934
|
+
var col = col0;
|
|
935
|
+
let flow = flowField(p, t);
|
|
936
|
+
let perp = vec2<f32>(-flow.y, flow.x);
|
|
937
|
+
let strokeScale = mStrokeScale();
|
|
938
|
+
let along = dot(p, flow) * strokeScale;
|
|
939
|
+
var across = dot(p, perp) * strokeScale;
|
|
940
|
+
across = across + 0.03 * (vnoise(p * 260.0) - 0.5);
|
|
941
|
+
|
|
942
|
+
let aniso = mix(1.0, 0.18, mStrokeAnisotropy());
|
|
943
|
+
let stroke = fbm(vec2<f32>(along * aniso, across));
|
|
944
|
+
col = col * mix(1.0, 0.82 + 0.32 * stroke, mStrokeAmount());
|
|
945
|
+
|
|
946
|
+
let tooth = vnoise(p * 800.0);
|
|
947
|
+
col = col * (1.0 - 0.08 * mStrokeAmount() * (tooth - 0.5));
|
|
948
|
+
return col;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// ── Crayon — DRY wax pigment on paper tooth (the tooth-multiply + scumble) ──
|
|
952
|
+
fn mediumCrayon(col0: vec3<f32>, p: vec2<f32>, t: f32) -> vec3<f32> {
|
|
953
|
+
let flow = structureTensorField(p, t, flowField(p, t)).xy;
|
|
954
|
+
let ang = atan2(flow.y, flow.x);
|
|
955
|
+
let ca = cos(-ang);
|
|
956
|
+
let sa = sin(-ang);
|
|
957
|
+
let pr = vec2<f32>(p.x * ca - p.y * sa, p.x * sa + p.y * ca);
|
|
958
|
+
|
|
959
|
+
let aniso = mix(0.45, 0.95, mStrokeAnisotropy());
|
|
960
|
+
let scale = max(mStrokeScale() * 1.6, 180.0);
|
|
961
|
+
|
|
962
|
+
let t1 = vnoise(vec2<f32>(pr.x * scale * aniso, pr.y * scale));
|
|
963
|
+
let t2 = vnoise(vec2<f32>(pr.x * scale * aniso * 0.4, pr.y * scale * 0.4) + vec2<f32>(11.0, 11.0));
|
|
964
|
+
let t3 = vnoise(vec2<f32>(pr.x * scale * aniso * 2.1, pr.y * scale * 2.1) + vec2<f32>(23.0, 23.0));
|
|
965
|
+
let tooth = 0.55 * t1 + 0.30 * t2 + 0.15 * t3;
|
|
966
|
+
|
|
967
|
+
let pressure = clamp(mStrokeAmount(), 0.0, 1.0);
|
|
968
|
+
let bite = mix(0.18, 0.46, pressure);
|
|
969
|
+
var result = col0 * (1.0 - bite * (0.5 - tooth));
|
|
970
|
+
|
|
971
|
+
let scumbleMask = smoothstep(0.42, 0.78, vnoise(vec2<f32>(pr.x * scale * 0.55, pr.y * scale * 0.22) + vec2<f32>(7.0, 7.0)));
|
|
972
|
+
let scumbleCoverage = scumbleMask * pressure * 0.7;
|
|
973
|
+
let paper = col0 * mix(0.80, 0.94, pressure);
|
|
974
|
+
result = mix(paper, result, scumbleCoverage);
|
|
975
|
+
|
|
976
|
+
let pigmentCell = floor(pr * max(scale * 0.18, 32.0));
|
|
977
|
+
let pigmentMask = smoothstep(0.28, 0.82, vnoise(pr * scale * 0.21 + vec2<f32>(19.0, 19.0)));
|
|
978
|
+
result = brokenColorJitter(
|
|
979
|
+
result,
|
|
980
|
+
hash21(pigmentCell + vec2<f32>(17.0, 17.0)),
|
|
981
|
+
hash21(pigmentCell * 2.1 + vec2<f32>(31.0, 31.0)),
|
|
982
|
+
0.45 + 0.55 * pigmentMask
|
|
983
|
+
);
|
|
984
|
+
|
|
985
|
+
result = saturate3(result, 1.08);
|
|
986
|
+
return result;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
// ── Kuwahara — the SOFT anisotropic generalized Kuwahara painterly finish ────
|
|
990
|
+
// THE KEYSTONE (Kyprianidis 2010). Aurora is a PROCEDURAL field (no input texture) so the
|
|
991
|
+
// operator runs over sampleBase directly: an elliptical kernel oriented along the structure
|
|
992
|
+
// tensor (elongated along the edge-tangent, narrowed across by the anisotropy), 8 OVERLAPPING
|
|
993
|
+
// sectors via SMOOTH gaussian-angular weights, blended by 1/(1+var^q) (the SOFT criterion →
|
|
994
|
+
// no 8-spoke pinwheel by construction). 4 rings × 8 angular taps = 32 procedural samples.
|
|
995
|
+
fn mediumKuwahara(col0: vec3<f32>, p: vec2<f32>, t: f32) -> vec3<f32> {
|
|
996
|
+
let stf = structureTensorField(p, t, flowField(p, t));
|
|
997
|
+
let tangent = stf.xy;
|
|
998
|
+
let A = stf.z;
|
|
999
|
+
// The studio knob drives the patch radius; clamp into the procedural patch band.
|
|
1000
|
+
let radius = clamp(mKuwaharaRadius() + mStrokeScale() * 0.00018, 0.006, 0.024);
|
|
1001
|
+
let aniso = mix(1.0, 0.34, clamp(A, 0.0, 1.0));
|
|
1002
|
+
let ax = tangent;
|
|
1003
|
+
let ay = vec2<f32>(-tangent.y, tangent.x);
|
|
1004
|
+
|
|
1005
|
+
// Per-sector weighted sums (8 sectors). WGSL has no runtime-indexed local arrays of
|
|
1006
|
+
// vectors as cleanly as GLSL, so unroll the sector accumulators explicitly.
|
|
1007
|
+
var mSum: array<vec3<f32>, 8>;
|
|
1008
|
+
var sSum: array<vec3<f32>, 8>;
|
|
1009
|
+
var wSum: array<f32, 8>;
|
|
1010
|
+
for (var i = 0; i < 8; i = i + 1) {
|
|
1011
|
+
mSum[i] = vec3<f32>(0.0);
|
|
1012
|
+
sSum[i] = vec3<f32>(0.0);
|
|
1013
|
+
wSum[i] = 0.0;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
let RINGS = 4;
|
|
1017
|
+
let TAPS = 8;
|
|
1018
|
+
for (var r = 1; r <= RINGS; r = r + 1) {
|
|
1019
|
+
let rr = f32(r) / f32(RINGS);
|
|
1020
|
+
let radial = 1.0 - 0.6 * rr;
|
|
1021
|
+
for (var a = 0; a < TAPS; a = a + 1) {
|
|
1022
|
+
let ang = 6.2831853 * f32(a) / f32(TAPS);
|
|
1023
|
+
let dirE = ax * cos(ang) + ay * (sin(ang) * aniso);
|
|
1024
|
+
let off = dirE * (radius * rr);
|
|
1025
|
+
let c = sampleBase(p + off, t);
|
|
1026
|
+
for (var k = 0; k < 8; k = k + 1) {
|
|
1027
|
+
let sectorAng = 6.2831853 * f32(k) / 8.0;
|
|
1028
|
+
var d = ang - sectorAng;
|
|
1029
|
+
d = atan2(sin(d), cos(d));
|
|
1030
|
+
let sw = exp(-d * d * 2.2) * radial;
|
|
1031
|
+
mSum[k] = mSum[k] + c * sw;
|
|
1032
|
+
sSum[k] = sSum[k] + c * c * sw;
|
|
1033
|
+
wSum[k] = wSum[k] + sw;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
let q = max(mKuwaharaQ(), 1.0);
|
|
1039
|
+
var accum = vec3<f32>(0.0);
|
|
1040
|
+
var accumW = 0.0;
|
|
1041
|
+
for (var k = 0; k < 8; k = k + 1) {
|
|
1042
|
+
let wk = max(wSum[k], 1e-4);
|
|
1043
|
+
let mean = mSum[k] / wk;
|
|
1044
|
+
let var3 = max(sSum[k] / wk - mean * mean, vec3<f32>(0.0));
|
|
1045
|
+
let variance = dot(var3, W_LUMA);
|
|
1046
|
+
let sectorW = 1.0 / (1.0 + pow(variance * 320.0, q));
|
|
1047
|
+
accum = accum + mean * sectorW;
|
|
1048
|
+
accumW = accumW + sectorW;
|
|
1049
|
+
}
|
|
1050
|
+
var result = accum / max(accumW, 1e-4);
|
|
1051
|
+
|
|
1052
|
+
// Anchor in near-flat zones so the smoothing only bites at edges.
|
|
1053
|
+
let center = sampleBase(p, t);
|
|
1054
|
+
result = mix(center, result, clamp(0.35 + 0.65 * A, 0.0, 1.0));
|
|
1055
|
+
|
|
1056
|
+
// Faint canvas tooth + pigment-saturation so the flattened patches read as oil paint.
|
|
1057
|
+
let tooth = vnoise(p * 300.0) - 0.5;
|
|
1058
|
+
result = result * (1.0 + tooth * 0.06 * mCanvasGrain());
|
|
1059
|
+
result = saturate3(result, 1.04);
|
|
1060
|
+
|
|
1061
|
+
return mix(col0, result, clamp(mStrokeAmount(), 0.0, 1.0));
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// ── Medium dispatch (the WGSL twin of the GLSL main() if-ladder) ────────────
|
|
1065
|
+
// uMedium: 0 smooth · 1 pastel · 2 watercolor · 3 oil · 4 crayon · 5 vangogh ·
|
|
1066
|
+
// 6 oil-pastel · 7 kuwahara. The cheap peer mediums (pastel/watercolor/crayon) +
|
|
1067
|
+
// kuwahara port their own bodies; the oil/vangogh/oil-pastel STROKE cascade renders
|
|
1068
|
+
// the anisotropic-Kuwahara PAINTERLY finish here (a real oil-paint read, never the
|
|
1069
|
+
// smooth core — the "NO FALLBACKS on Safari" mandate; the full per-dab Starry-Night
|
|
1070
|
+
// stroke WGSL is the booked W-AURORA-WGPU-MEDIUMS-STROKES tail).
|
|
1071
|
+
fn applyMedium(col: vec3<f32>, p: vec2<f32>, t: f32) -> vec3<f32> {
|
|
1072
|
+
let medium = u.ints1.x;
|
|
1073
|
+
if (medium == 1) { return mediumPastel(col, p, t); }
|
|
1074
|
+
if (medium == 2) { return mediumWatercolor(col, p, t); }
|
|
1075
|
+
if (medium == 4) { return mediumCrayon(col, p, t); }
|
|
1076
|
+
// oil(3) / vangogh(5) / oil-pastel(6) / kuwahara(7) all render the painterly
|
|
1077
|
+
// anisotropic-Kuwahara finish on the WGSL primary (the WebGL2 fallback carries the
|
|
1078
|
+
// full per-dab stroke cascade for oil/vangogh/oil-pastel).
|
|
1079
|
+
if (medium == 3 || medium == 5 || medium == 6 || medium == 7) {
|
|
1080
|
+
return mediumKuwahara(col, p, t);
|
|
1081
|
+
}
|
|
1082
|
+
return col;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
// ── Full-screen triangle vertex stage (the pilot idiom — no vertex buffer) ──
|
|
1087
|
+
struct VSOut {
|
|
1088
|
+
@builtin(position) pos: vec4<f32>,
|
|
1089
|
+
@location(0) uv: vec2<f32>,
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
@vertex
|
|
1093
|
+
fn vs_main(@builtin(vertex_index) vi: u32) -> VSOut {
|
|
1094
|
+
// NDC corners of the covering triangle (-1,-1), (3,-1), (-1,3).
|
|
1095
|
+
var p = vec2<f32>(-1.0, -1.0);
|
|
1096
|
+
if (vi == 1u) { p = vec2<f32>(3.0, -1.0); }
|
|
1097
|
+
else if (vi == 2u) { p = vec2<f32>(-1.0, 3.0); }
|
|
1098
|
+
var out: VSOut;
|
|
1099
|
+
out.pos = vec4<f32>(p, 0.0, 1.0);
|
|
1100
|
+
// vUv = aPos * 0.5 + 0.5 (the aurora.vert convention).
|
|
1101
|
+
out.uv = p * 0.5 + 0.5;
|
|
1102
|
+
return out;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// ── Fragment stage (the main() transcription) ──
|
|
1106
|
+
@fragment
|
|
1107
|
+
fn fs_main(in: VSOut) -> @location(0) vec4<f32> {
|
|
1108
|
+
let t = u.scalars0.x;
|
|
1109
|
+
let valueVariance = u.scalars0.z;
|
|
1110
|
+
let breathDepth = u.scalars2.w;
|
|
1111
|
+
let breathPeriod = u.scalars3.x;
|
|
1112
|
+
let saturation = u.scalars1.z;
|
|
1113
|
+
let paperGrain = u.scalars1.w;
|
|
1114
|
+
let alpha = u.scalars2.x;
|
|
1115
|
+
|
|
1116
|
+
let uv = in.uv;
|
|
1117
|
+
let pN = uv;
|
|
1118
|
+
|
|
1119
|
+
let p_warp = domainWarp(pN, t);
|
|
1120
|
+
|
|
1121
|
+
let nf = nucleiField(p_warp, t);
|
|
1122
|
+
var col = samplePalette(nf.paletteId);
|
|
1123
|
+
col = col * (1.0 + valueVariance * nf.valueMod);
|
|
1124
|
+
|
|
1125
|
+
// Breath — slow global luminance wobble.
|
|
1126
|
+
let breath = sin(t * 6.2831 / max(breathPeriod, 1.0));
|
|
1127
|
+
col = col * (1.0 + breathDepth * breath * 0.5);
|
|
1128
|
+
|
|
1129
|
+
// BC.W-VIZ-AURORA (T4) — the painterly-medium dispatch. uMedium 0 (smooth) is a
|
|
1130
|
+
// no-op pass-through so the DEFAULT smooth config is byte-identical to the prior
|
|
1131
|
+
// WGSL primary (the parity capture); uMedium 1-7 render the ported painterly
|
|
1132
|
+
// bodies (pastel/watercolor/crayon/kuwahara) or the anisotropic-Kuwahara finish
|
|
1133
|
+
// (oil/vangogh/oil-pastel) — never a silent smooth degrade on Safari 26.
|
|
1134
|
+
col = applyMedium(col, pN, t);
|
|
1135
|
+
|
|
1136
|
+
// Saturation trim.
|
|
1137
|
+
col = saturate3(col, saturation);
|
|
1138
|
+
|
|
1139
|
+
// Tonemap + film grain.
|
|
1140
|
+
col = aces(col);
|
|
1141
|
+
// gl_FragCoord.xy → the device-pixel position (the WGSL @builtin(position)).
|
|
1142
|
+
let fragCoord = in.pos.xy;
|
|
1143
|
+
let grain = hash21(fragCoord + t * 17.0);
|
|
1144
|
+
col = col + (grain - 0.5) * paperGrain;
|
|
1145
|
+
|
|
1146
|
+
col = clamp(col * 0.985 + 0.008, vec3<f32>(0.0), vec3<f32>(1.0));
|
|
1147
|
+
|
|
1148
|
+
// MANDATORY OETF — closes the seam (the whole pipeline above runs in LINEAR).
|
|
1149
|
+
col = linearToSrgb(col);
|
|
1150
|
+
|
|
1151
|
+
// 1-LSB triangular IGN dither in DISPLAY space, AFTER the OETF.
|
|
1152
|
+
col = col + (1.0 / 255.0) * (ign(fragCoord) - 0.5);
|
|
1153
|
+
|
|
1154
|
+
// Premultiply on DISPLAY-space color (matches the WebGL2 path: OETF, then premul).
|
|
1155
|
+
return vec4<f32>(col * alpha, alpha);
|
|
1156
|
+
}
|
|
1157
|
+
`, J = {
|
|
1158
|
+
scalars0: 0,
|
|
1159
|
+
scalars1: 4,
|
|
1160
|
+
scalars2: 8,
|
|
1161
|
+
scalars3: 12,
|
|
1162
|
+
cursor: 16,
|
|
1163
|
+
ints0: 20,
|
|
1164
|
+
ints1: 24,
|
|
1165
|
+
palette: 28,
|
|
1166
|
+
nuc0: 60,
|
|
1167
|
+
nuc1: 84,
|
|
1168
|
+
nuc2: 108,
|
|
1169
|
+
scalars4: 132,
|
|
1170
|
+
scalars5: 136,
|
|
1171
|
+
kuwahara: 140
|
|
1172
|
+
}, Qe = .01, $e = 8, et = 4, Y = (e) => 1 - e;
|
|
1173
|
+
function tt() {
|
|
1174
|
+
let e = /* @__PURE__ */ new ArrayBuffer(576);
|
|
1175
|
+
return {
|
|
1176
|
+
buffer: e,
|
|
1177
|
+
f32: new Float32Array(e),
|
|
1178
|
+
i32: new Int32Array(e),
|
|
1179
|
+
paletteScratch: new Float32Array(24)
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
function nt(e, t, n, r) {
|
|
1183
|
+
let { f32: i, i32: a, paletteScratch: o } = e;
|
|
1184
|
+
i[J.scalars0 + 0] = r, i[J.scalars0 + 1] = t.softmaxBeta, i[J.scalars0 + 2] = t.valueVariance, i[J.scalars0 + 3] = t.warpAmount, i[J.scalars1 + 0] = t.warpScale, i[J.scalars1 + 1] = t.warpDrift, i[J.scalars1 + 2] = t.saturation, i[J.scalars1 + 3] = t.paperGrain, i[J.scalars2 + 0] = t.alpha, i[J.scalars2 + 1] = t.nucleiDrift, i[J.scalars2 + 2] = t.paletteDrift, i[J.scalars2 + 3] = t.breathDepth, i[J.scalars3 + 0] = t.breathPeriod, i[J.scalars3 + 1] = n.strength, i[J.scalars3 + 2] = n.radius, i[J.scalars3 + 3] = 0, i[J.cursor + 0] = n.x, i[J.cursor + 1] = Y(n.y), i[J.cursor + 2] = 0, i[J.cursor + 3] = 0, a[J.ints0 + 0] = Math.min(t.palette.length, 8);
|
|
1185
|
+
let s = Math.min(t.nuclei.length, 6);
|
|
1186
|
+
a[J.ints0 + 1] = s, a[J.ints0 + 2] = H[t.warpMode], a[J.ints0 + 3] = t.noiseOctaves, a[J.ints1 + 0] = z[t.medium], a[J.ints1 + 1] = B[t.huePath ?? "shorter"], a[J.ints1 + 2] = 0, a[J.ints1 + 3] = 0, N(t.palette, 8, o);
|
|
1187
|
+
for (let e = 0; e < 8; e++) {
|
|
1188
|
+
let t = J.palette + e * 4;
|
|
1189
|
+
i[t + 0] = o[e * 3 + 0], i[t + 1] = o[e * 3 + 1], i[t + 2] = o[e * 3 + 2], i[t + 3] = 0;
|
|
1190
|
+
}
|
|
1191
|
+
for (let e = 0; e < 6; e++) {
|
|
1192
|
+
let n = J.nuc0 + e * 4, r = J.nuc1 + e * 4, a = J.nuc2 + e * 4;
|
|
1193
|
+
if (e < s) {
|
|
1194
|
+
let o = t.nuclei[e];
|
|
1195
|
+
i[n + 0] = o.x, i[n + 1] = Y(o.y), i[n + 2] = o.radius, i[n + 3] = o.paletteBias, i[r + 0] = o.valueBias, i[r + 1] = o.driftRadius, i[r + 2] = o.driftPhase, i[r + 3] = o.elongation ?? 1, i[a + 0] = -(o.angle ?? 0) * Math.PI / 180, i[a + 1] = 0, i[a + 2] = 0, i[a + 3] = 0;
|
|
1196
|
+
} else i[n + 0] = 0, i[n + 1] = 0, i[n + 2] = 0, i[n + 3] = 0, i[r + 0] = 0, i[r + 1] = 0, i[r + 2] = 0, i[r + 3] = 1, i[a + 0] = 0, i[a + 1] = 0, i[a + 2] = 0, i[a + 3] = 0;
|
|
1197
|
+
}
|
|
1198
|
+
return i[J.scalars4 + 0] = t.strokeAmount, i[J.scalars4 + 1] = t.strokeScale, i[J.scalars4 + 2] = t.strokeAnisotropy, i[J.scalars4 + 3] = t.canvasGrain, i[J.scalars5 + 0] = t.wetEdge, i[J.scalars5 + 1] = t.granulation, i[J.scalars5 + 2] = t.brokenColor, i[J.scalars5 + 3] = t.kuwaharaQ ?? et, i[J.kuwahara + 0] = t.kuwaharaRadius ?? Qe, i[J.kuwahara + 1] = $e, i[J.kuwahara + 2] = 0, i[J.kuwahara + 3] = 0, e;
|
|
1199
|
+
}
|
|
1200
|
+
//#endregion
|
|
1201
|
+
//#region src/components/custom/aurora/composables/wgpuSetup.ts
|
|
1202
|
+
var rt = 64, it = 8, at = 2;
|
|
1203
|
+
function ot(e) {
|
|
1204
|
+
let { canvas: t, cursor: n, getConfig: r, getReducedMotion: i, pointerField: a } = e, o = null;
|
|
1205
|
+
return function(e, s, c) {
|
|
1206
|
+
let l = e.createShaderModule({
|
|
1207
|
+
label: "[Aurora] aurora.wgsl",
|
|
1208
|
+
code: Ze
|
|
1209
|
+
}), u = e.createBuffer({
|
|
1210
|
+
label: "[Aurora] uniforms",
|
|
1211
|
+
size: 576,
|
|
1212
|
+
usage: rt | it
|
|
1213
|
+
}), d = e.createBindGroupLayout({
|
|
1214
|
+
label: "[Aurora] bind-group-0",
|
|
1215
|
+
entries: [{
|
|
1216
|
+
binding: 0,
|
|
1217
|
+
visibility: at,
|
|
1218
|
+
buffer: { type: "uniform" }
|
|
1219
|
+
}]
|
|
1220
|
+
}), p = e.createRenderPipeline({
|
|
1221
|
+
label: "[Aurora] pipeline",
|
|
1222
|
+
layout: e.createPipelineLayout({ bindGroupLayouts: [d] }),
|
|
1223
|
+
vertex: {
|
|
1224
|
+
module: l,
|
|
1225
|
+
entryPoint: "vs_main"
|
|
1226
|
+
},
|
|
1227
|
+
fragment: {
|
|
1228
|
+
module: l,
|
|
1229
|
+
entryPoint: "fs_main",
|
|
1230
|
+
targets: [{
|
|
1231
|
+
format: c,
|
|
1232
|
+
blend: {
|
|
1233
|
+
color: {
|
|
1234
|
+
srcFactor: "one",
|
|
1235
|
+
dstFactor: "one-minus-src-alpha",
|
|
1236
|
+
operation: "add"
|
|
1237
|
+
},
|
|
1238
|
+
alpha: {
|
|
1239
|
+
srcFactor: "one",
|
|
1240
|
+
dstFactor: "one-minus-src-alpha",
|
|
1241
|
+
operation: "add"
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}]
|
|
1245
|
+
},
|
|
1246
|
+
primitive: { topology: "triangle-list" }
|
|
1247
|
+
}), m = e.createBindGroup({
|
|
1248
|
+
label: "[Aurora] bind-group",
|
|
1249
|
+
layout: d,
|
|
1250
|
+
entries: [{
|
|
1251
|
+
binding: 0,
|
|
1252
|
+
resource: { buffer: u }
|
|
1253
|
+
}]
|
|
1254
|
+
}), h = tt();
|
|
1255
|
+
function g() {
|
|
1256
|
+
let e = f(), 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));
|
|
1257
|
+
(t.width !== o || t.height !== s) && (t.width = o, t.height = s);
|
|
1258
|
+
}
|
|
1259
|
+
function _(t) {
|
|
1260
|
+
let c = +!i(), l = o === null ? 0 : Math.max(0, (t - o) * 1e3);
|
|
1261
|
+
o = t, a.tick(c === 0 ? 0 : l);
|
|
1262
|
+
let d = a.acceleration.value, f = a.velocity.value, g = -(d.x * f.x + d.y * f.y);
|
|
1263
|
+
g > 0 && c > 0 && (n.burst = Math.min(1, n.burst + g * 6)), K(n, c), nt(h, r(), n, t), e.queue.writeBuffer(u, 0, h.buffer);
|
|
1264
|
+
let _ = s.getCurrentTexture().createView(), v = e.createCommandEncoder({ label: "[Aurora] frame" }), y = v.beginRenderPass({ colorAttachments: [{
|
|
1265
|
+
view: _,
|
|
1266
|
+
clearValue: {
|
|
1267
|
+
r: 0,
|
|
1268
|
+
g: 0,
|
|
1269
|
+
b: 0,
|
|
1270
|
+
a: 0
|
|
1271
|
+
},
|
|
1272
|
+
loadOp: "clear",
|
|
1273
|
+
storeOp: "store"
|
|
1274
|
+
}] });
|
|
1275
|
+
y.setPipeline(p), y.setBindGroup(0, m), y.draw(3, 1, 0, 0), y.end(), e.queue.submit([v.finish()]);
|
|
1276
|
+
}
|
|
1277
|
+
function v() {
|
|
1278
|
+
if (i()) return !1;
|
|
1279
|
+
let e = r();
|
|
1280
|
+
return e.nucleiDrift !== 0 || e.paletteDrift !== 0 || e.breathDepth !== 0 || e.warpDrift !== 0 || e.interactivity?.light && n.burst > .001 ? !0 : q(n);
|
|
1281
|
+
}
|
|
1282
|
+
return {
|
|
1283
|
+
frame: _,
|
|
1284
|
+
shouldContinue: v,
|
|
1285
|
+
resize: g,
|
|
1286
|
+
time: (e) => i() ? 3.7 : e,
|
|
1287
|
+
teardown: () => {
|
|
1288
|
+
u.destroy();
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
489
1291
|
};
|
|
490
1292
|
}
|
|
491
1293
|
//#endregion
|
|
492
1294
|
//#region src/components/custom/aurora/composables/runtime.ts
|
|
493
|
-
function
|
|
1295
|
+
function st(e) {
|
|
494
1296
|
return e.mode === "capture" ? !0 : e.initStrategy === "eager";
|
|
495
1297
|
}
|
|
496
|
-
function
|
|
1298
|
+
function ct(e) {
|
|
497
1299
|
return typeof e.preserveDrawingBuffer == "boolean" ? e.preserveDrawingBuffer : e.mode === "capture";
|
|
498
1300
|
}
|
|
499
|
-
function
|
|
500
|
-
let i =
|
|
1301
|
+
function X(e, n, r = {}) {
|
|
1302
|
+
let i = ct(r), a = !r.forceWebGLUnderSoftwareRaster && A(), o = n, s = Je(), c = t(), l = null, u = a ? {
|
|
1303
|
+
arm: () => {},
|
|
1304
|
+
suspend: () => {},
|
|
1305
|
+
resume: () => {},
|
|
1306
|
+
wake: () => {},
|
|
1307
|
+
renderAt: () => {},
|
|
1308
|
+
dispose: () => {},
|
|
1309
|
+
reducedMotion: !1
|
|
1310
|
+
} : h(e, {
|
|
501
1311
|
mode: r.mode === "capture" ? "capture" : "live",
|
|
502
1312
|
contextAttrs: {
|
|
503
1313
|
antialias: !1,
|
|
@@ -505,77 +1315,94 @@ function W(e, n, r = {}) {
|
|
|
505
1315
|
premultipliedAlpha: !0,
|
|
506
1316
|
preserveDrawingBuffer: i
|
|
507
1317
|
},
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1318
|
+
setupWGPU: ot({
|
|
1319
|
+
canvas: e,
|
|
1320
|
+
cursor: s,
|
|
1321
|
+
getConfig: () => o,
|
|
1322
|
+
getReducedMotion: () => u.reducedMotion,
|
|
1323
|
+
pointerField: c
|
|
1324
|
+
}),
|
|
1325
|
+
setupGL: (t) => {
|
|
1326
|
+
let { program: n, vs: r, fs: i, uniforms: a, geometry: d } = Oe(t, _e, Ee);
|
|
1327
|
+
function p() {
|
|
1328
|
+
let r = f(), i = e.getBoundingClientRect(), a = e.parentElement?.getBoundingClientRect(), o = i.width || a?.width || 1, s = i.height || a?.height || 1, c = Math.max(1, Math.round(o * r)), l = Math.max(1, Math.round(s * r));
|
|
1329
|
+
(e.width !== c || e.height !== l) && (e.width = c, e.height = l), t.viewport(0, 0, c, l), t.useProgram(n);
|
|
513
1330
|
}
|
|
514
|
-
let
|
|
515
|
-
gl:
|
|
516
|
-
prog:
|
|
517
|
-
uniforms:
|
|
518
|
-
cursor:
|
|
519
|
-
getConfig: () =>
|
|
520
|
-
getReducedMotion: () =>
|
|
1331
|
+
let m = We(t, n, a, s), h = Xe({
|
|
1332
|
+
gl: t,
|
|
1333
|
+
prog: n,
|
|
1334
|
+
uniforms: a,
|
|
1335
|
+
cursor: s,
|
|
1336
|
+
getConfig: () => o,
|
|
1337
|
+
getReducedMotion: () => u.reducedMotion,
|
|
1338
|
+
pointerField: c
|
|
521
1339
|
});
|
|
522
|
-
return
|
|
523
|
-
|
|
524
|
-
},
|
|
525
|
-
|
|
1340
|
+
return t.clearColor(0, 0, 0, 0), t.disable(t.DEPTH_TEST), t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA), l = (e) => {
|
|
1341
|
+
o = e, m(e);
|
|
1342
|
+
}, l(o), requestAnimationFrame(() => {
|
|
1343
|
+
p(), requestAnimationFrame(p);
|
|
526
1344
|
}), {
|
|
527
|
-
frame:
|
|
528
|
-
shouldContinue:
|
|
529
|
-
resize:
|
|
530
|
-
time: (e) =>
|
|
1345
|
+
frame: h.frame,
|
|
1346
|
+
shouldContinue: h.needsAnimation,
|
|
1347
|
+
resize: p,
|
|
1348
|
+
time: (e) => u.reducedMotion ? 3.7 : e,
|
|
531
1349
|
teardown: () => {
|
|
532
|
-
|
|
1350
|
+
t.deleteProgram(n), t.deleteShader(r), t.deleteShader(i), t.deleteBuffer(d.buf), t.deleteVertexArray(d.vao);
|
|
533
1351
|
}
|
|
534
1352
|
};
|
|
535
1353
|
}
|
|
536
1354
|
});
|
|
537
|
-
function
|
|
538
|
-
|
|
1355
|
+
function d(e, t, n = .8) {
|
|
1356
|
+
s.targetX = e, s.targetY = t, s.targetStrength = n, c.setPointer(e, t), u.wake();
|
|
539
1357
|
}
|
|
540
|
-
function
|
|
541
|
-
|
|
1358
|
+
function p(e, t) {
|
|
1359
|
+
u.reducedMotion || (Ye(s, e, t), u.wake());
|
|
542
1360
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
1361
|
+
function m() {
|
|
1362
|
+
s.targetStrength = 0, u.wake();
|
|
1363
|
+
}
|
|
1364
|
+
function g(e) {
|
|
1365
|
+
s.radius = e, u.wake();
|
|
1366
|
+
}
|
|
1367
|
+
function _(e) {
|
|
1368
|
+
u.wake();
|
|
545
1369
|
}
|
|
546
|
-
function
|
|
547
|
-
|
|
1370
|
+
function v() {
|
|
1371
|
+
u.armAsync ? u.armAsync().catch((e) => {
|
|
1372
|
+
r.onInitError?.(e instanceof Error ? e : Error(String(e)));
|
|
1373
|
+
}) : u.arm();
|
|
548
1374
|
}
|
|
549
|
-
function
|
|
550
|
-
|
|
1375
|
+
function y() {
|
|
1376
|
+
return u.armAsync ? u.armAsync() : (u.arm(), Promise.resolve());
|
|
551
1377
|
}
|
|
552
|
-
return r.mode !== "capture" &&
|
|
553
|
-
arm: () =>
|
|
1378
|
+
return r.mode !== "capture" && st(r) && v(), {
|
|
1379
|
+
arm: () => v(),
|
|
1380
|
+
armAsync: () => y(),
|
|
554
1381
|
update: (e) => {
|
|
555
|
-
|
|
1382
|
+
o = e, l?.(e), u.wake();
|
|
556
1383
|
},
|
|
557
|
-
setCursor:
|
|
558
|
-
clearCursor:
|
|
559
|
-
setCursorRadius:
|
|
560
|
-
setReducedMotion:
|
|
561
|
-
injectCursorVelocity:
|
|
1384
|
+
setCursor: d,
|
|
1385
|
+
clearCursor: m,
|
|
1386
|
+
setCursorRadius: g,
|
|
1387
|
+
setReducedMotion: _,
|
|
1388
|
+
injectCursorVelocity: p,
|
|
562
1389
|
get reducedMotion() {
|
|
563
|
-
return
|
|
1390
|
+
return u.reducedMotion;
|
|
564
1391
|
},
|
|
565
|
-
pause: (e = "manual") =>
|
|
566
|
-
resume: (e = "manual") =>
|
|
567
|
-
renderAt: (e) =>
|
|
568
|
-
dispose: () =>
|
|
1392
|
+
pause: (e = "manual") => u.suspend(e),
|
|
1393
|
+
resume: (e = "manual") => u.resume(e),
|
|
1394
|
+
renderAt: (e) => u.renderAt(e),
|
|
1395
|
+
dispose: () => u.dispose()
|
|
569
1396
|
};
|
|
570
1397
|
}
|
|
571
1398
|
//#endregion
|
|
572
1399
|
//#region src/components/custom/aurora/composables/configSource.ts
|
|
573
|
-
function
|
|
1400
|
+
function lt(e) {
|
|
574
1401
|
return typeof e == "function" ? e : e && typeof e == "object" && "value" in e ? () => e.value : () => e;
|
|
575
1402
|
}
|
|
576
1403
|
//#endregion
|
|
577
1404
|
//#region src/components/custom/aurora/composables/useAurora.ts
|
|
578
|
-
function
|
|
1405
|
+
function ut(e) {
|
|
579
1406
|
if (typeof window > "u") return () => {};
|
|
580
1407
|
if (typeof window.requestIdleCallback == "function") {
|
|
581
1408
|
let t = window.requestIdleCallback(() => e(), { timeout: 2e3 });
|
|
@@ -592,8 +1419,8 @@ function Ue(e) {
|
|
|
592
1419
|
r = !0, cancelAnimationFrame(t), n !== void 0 && clearTimeout(n);
|
|
593
1420
|
};
|
|
594
1421
|
}
|
|
595
|
-
function
|
|
596
|
-
let i =
|
|
1422
|
+
function dt(e, t, n = {}, r = {}) {
|
|
1423
|
+
let i = lt(t), a = r.renderMode === "css", o = null, s = null, c = null, l = null, u = null, d = null, f = null, p = !1, m = E(!1), h = n.mode === "capture" || n.initStrategy === "eager";
|
|
597
1424
|
function g() {
|
|
598
1425
|
f && o && o.setReducedMotion(f.matches);
|
|
599
1426
|
}
|
|
@@ -614,7 +1441,7 @@ function K(e, t, n = {}, r = {}) {
|
|
|
614
1441
|
_(e);
|
|
615
1442
|
return;
|
|
616
1443
|
}
|
|
617
|
-
m.value = !0, f = window.matchMedia("(prefers-reduced-motion: reduce)"), f.addEventListener("change", g), s =
|
|
1444
|
+
m.value = !0, f = window.matchMedia("(prefers-reduced-motion: reduce)"), f.addEventListener("change", g), s = O(i, (e) => o?.update(e), { deep: !0 }), i().interactivity?.scroll && e.value && (l = O(ie({
|
|
618
1445
|
target: e,
|
|
619
1446
|
trackExit: !0
|
|
620
1447
|
}), (e) => {
|
|
@@ -622,11 +1449,11 @@ function K(e, t, n = {}, r = {}) {
|
|
|
622
1449
|
}));
|
|
623
1450
|
}
|
|
624
1451
|
}
|
|
625
|
-
return
|
|
1452
|
+
return de(() => {
|
|
626
1453
|
let t = e.value;
|
|
627
1454
|
if (!t || a) return;
|
|
628
1455
|
try {
|
|
629
|
-
o =
|
|
1456
|
+
o = X(t, i(), {
|
|
630
1457
|
initStrategy: "deferred",
|
|
631
1458
|
...n
|
|
632
1459
|
});
|
|
@@ -638,17 +1465,17 @@ function K(e, t, n = {}, r = {}) {
|
|
|
638
1465
|
v();
|
|
639
1466
|
return;
|
|
640
1467
|
}
|
|
641
|
-
d =
|
|
1468
|
+
d = re(e, {
|
|
642
1469
|
pause: () => o?.pause("off-screen"),
|
|
643
1470
|
resume: () => o?.resume("off-screen")
|
|
644
1471
|
}, { pauseWhenHidden: !1 });
|
|
645
1472
|
let r = d.isIntersecting;
|
|
646
|
-
c =
|
|
647
|
-
!e || p || u || (u =
|
|
1473
|
+
c = O(r, (e) => {
|
|
1474
|
+
!e || p || u || (u = ut(() => {
|
|
648
1475
|
u = null, r.value && v();
|
|
649
1476
|
}));
|
|
650
1477
|
}, { immediate: !0 });
|
|
651
|
-
}),
|
|
1478
|
+
}), ue(() => {
|
|
652
1479
|
u?.(), c?.(), s?.(), l?.(), d?.dispose(), f?.removeEventListener("change", g), o?.dispose(), o = null;
|
|
653
1480
|
}), {
|
|
654
1481
|
setCursor: (e, t, n) => o?.setCursor(e, t, n),
|
|
@@ -658,48 +1485,184 @@ function K(e, t, n = {}, r = {}) {
|
|
|
658
1485
|
renderAt: (e) => o?.renderAt(e),
|
|
659
1486
|
pause: () => o?.pause(),
|
|
660
1487
|
resume: () => o?.resume(),
|
|
661
|
-
isArmed:
|
|
1488
|
+
isArmed: pe(m)
|
|
662
1489
|
};
|
|
663
1490
|
}
|
|
664
1491
|
//#endregion
|
|
665
|
-
//#region src/components/custom/aurora/
|
|
666
|
-
function
|
|
667
|
-
|
|
668
|
-
|
|
1492
|
+
//#region src/components/custom/aurora/composables/auroraFallbackGround.ts
|
|
1493
|
+
function Z(e) {
|
|
1494
|
+
let t = Math.max(0, Math.min(1, e));
|
|
1495
|
+
return t <= .0031308 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - .055;
|
|
1496
|
+
}
|
|
1497
|
+
function ft([e, t, n]) {
|
|
1498
|
+
let r = .76, i = Math.min(e, Math.min(t, n)), a = i < .08 ? i - 6.25 * i * i : .04, o = e - a, s = t - a, c = n - a, l = Math.max(o, Math.max(s, c)), u = (e) => Math.max(0, Math.min(1, e));
|
|
1499
|
+
if (l < r) return [
|
|
1500
|
+
u(o),
|
|
1501
|
+
u(s),
|
|
1502
|
+
u(c)
|
|
1503
|
+
];
|
|
1504
|
+
let d = 1 - r, f = 1 - d * d / (l + d - r), p = f / l;
|
|
1505
|
+
o *= p, s *= p, c *= p;
|
|
1506
|
+
let m = 1 - 1 / (.15 * (l - f) + 1);
|
|
1507
|
+
return [
|
|
1508
|
+
u(o + (f - o) * m),
|
|
1509
|
+
u(s + (f - s) * m),
|
|
1510
|
+
u(c + (f - c) * m)
|
|
1511
|
+
];
|
|
1512
|
+
}
|
|
1513
|
+
function pt([e, t, n]) {
|
|
1514
|
+
return .2126 * e + .7152 * t + .0722 * n;
|
|
1515
|
+
}
|
|
1516
|
+
function mt(e, t) {
|
|
1517
|
+
let n = e.length;
|
|
1518
|
+
if (n === 0) return [
|
|
1519
|
+
0,
|
|
1520
|
+
0,
|
|
1521
|
+
0
|
|
1522
|
+
];
|
|
1523
|
+
if (n === 1) return e[0];
|
|
1524
|
+
let r = Math.max(0, Math.min(1, t)) * (n - 1), i = Math.floor(r), a = Math.min(i + 1, n - 1), o = r - i, s = e[i], c = e[a];
|
|
1525
|
+
return [
|
|
1526
|
+
s[0] + (c[0] - s[0]) * o,
|
|
1527
|
+
s[1] + (c[1] - s[1]) * o,
|
|
1528
|
+
s[2] + (c[2] - s[2]) * o
|
|
1529
|
+
];
|
|
1530
|
+
}
|
|
1531
|
+
function ht(e, t, n, r) {
|
|
1532
|
+
let i = 0, a = 0, o = 0;
|
|
1533
|
+
for (let s of e) {
|
|
1534
|
+
let e = n - s.x, c = r - s.y, l = (s.angle ?? 0) * Math.PI / 180, u = Math.cos(l), d = Math.sin(l), f = u * e + d * c, p = -d * e + u * c, m = f / Math.max(s.elongation ?? 1, .01), h = p, g = m * m + h * h, _ = Math.max(s.radius, .01), v = Math.exp(-t * g / (_ * _));
|
|
1535
|
+
i += v * s.paletteBias, a += v * s.valueBias, o += v;
|
|
1536
|
+
}
|
|
1537
|
+
let s = Math.max(o, 1e-4);
|
|
1538
|
+
return {
|
|
1539
|
+
paletteId: Math.max(0, Math.min(1, i / s)),
|
|
1540
|
+
valueMod: a / s
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
function gt(e, t, n) {
|
|
1544
|
+
let r = e.palette.map((e) => x(e)), { paletteId: i, valueMod: a } = ht(e.nuclei, e.softmaxBeta, t, n), o = mt(r, i), s = 1 + e.valueVariance * a, c = [
|
|
1545
|
+
o[0] * s,
|
|
1546
|
+
o[1] * s,
|
|
1547
|
+
o[2] * s
|
|
1548
|
+
];
|
|
1549
|
+
return c = ft(c), c = [
|
|
1550
|
+
Math.max(0, Math.min(1, c[0] * .985 + .008)),
|
|
1551
|
+
Math.max(0, Math.min(1, c[1] * .985 + .008)),
|
|
1552
|
+
Math.max(0, Math.min(1, c[2] * .985 + .008))
|
|
1553
|
+
], [
|
|
1554
|
+
Z(c[0]),
|
|
1555
|
+
Z(c[1]),
|
|
1556
|
+
Z(c[2])
|
|
1557
|
+
];
|
|
1558
|
+
}
|
|
1559
|
+
function _t([e, t, n]) {
|
|
1560
|
+
let r = (e) => Math.round(Math.max(0, Math.min(1, e)) * 255);
|
|
1561
|
+
return `rgb(${r(e)}, ${r(t)}, ${r(n)})`;
|
|
1562
|
+
}
|
|
1563
|
+
function vt(e) {
|
|
1564
|
+
return pt(e.map((e) => {
|
|
1565
|
+
let t = Math.max(0, Math.min(1, e));
|
|
1566
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
1567
|
+
}));
|
|
1568
|
+
}
|
|
1569
|
+
function yt(e, t = {}) {
|
|
1570
|
+
let n = Math.max(2, Math.min(16, Math.round(t.grid ?? 8))), r = [], i = 0, a = [
|
|
1571
|
+
0,
|
|
1572
|
+
0,
|
|
1573
|
+
0,
|
|
1574
|
+
0
|
|
1575
|
+
], o = [
|
|
1576
|
+
0,
|
|
1577
|
+
0,
|
|
1578
|
+
0,
|
|
1579
|
+
0
|
|
1580
|
+
];
|
|
1581
|
+
for (let t = 0; t < n; t++) for (let s = 0; s < n; s++) {
|
|
1582
|
+
let c = (s + .5) / n, l = (t + .5) / n, u = gt(e, c, l);
|
|
1583
|
+
r.push({
|
|
1584
|
+
x: c,
|
|
1585
|
+
y: l,
|
|
1586
|
+
color: u
|
|
1587
|
+
});
|
|
1588
|
+
let d = vt(u);
|
|
1589
|
+
i += d;
|
|
1590
|
+
let f = (l < .5 ? 0 : 2) + (c < .5 ? 0 : 1);
|
|
1591
|
+
a[f] += d, o[f] += 1;
|
|
1592
|
+
}
|
|
1593
|
+
let s = i / r.length, c = [
|
|
1594
|
+
a[0] / Math.max(1, o[0]),
|
|
1595
|
+
a[1] / Math.max(1, o[1]),
|
|
1596
|
+
a[2] / Math.max(1, o[2]),
|
|
1597
|
+
a[3] / Math.max(1, o[3])
|
|
1598
|
+
], l = [
|
|
1599
|
+
0,
|
|
1600
|
+
0,
|
|
1601
|
+
0
|
|
1602
|
+
];
|
|
1603
|
+
for (let e of r) l[0] += e.color[0], l[1] += e.color[1], l[2] += e.color[2];
|
|
1604
|
+
l[0] /= r.length, l[1] /= r.length, l[2] /= r.length;
|
|
1605
|
+
let u = bt(r, n);
|
|
1606
|
+
if (u) return {
|
|
1607
|
+
backgroundImage: `url("${u}")`,
|
|
1608
|
+
backgroundColor: _t(l),
|
|
1609
|
+
metrics: {
|
|
1610
|
+
mean: s,
|
|
1611
|
+
quadrants: c
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
let d = 100 / n * 1.4;
|
|
1615
|
+
return {
|
|
1616
|
+
backgroundImage: r.map((e) => {
|
|
1617
|
+
let t = (e.x * 100).toFixed(2), n = (e.y * 100).toFixed(2), r = (e) => Math.round(Math.max(0, Math.min(1, e)) * 255), [i, a, o] = e.color, s = `rgba(${r(i)}, ${r(a)}, ${r(o)}, 0.7)`, c = `rgba(${r(i)}, ${r(a)}, ${r(o)}, 0)`;
|
|
1618
|
+
return `radial-gradient(circle ${d.toFixed(2)}% at ${t}% ${n}%, ${s} 0%, ${c} 100%)`;
|
|
1619
|
+
}).join(", "),
|
|
1620
|
+
backgroundColor: _t(l),
|
|
1621
|
+
metrics: {
|
|
1622
|
+
mean: s,
|
|
1623
|
+
quadrants: c
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
function bt(e, t) {
|
|
1628
|
+
if (typeof document > "u") return null;
|
|
1629
|
+
let n;
|
|
669
1630
|
try {
|
|
670
|
-
|
|
671
|
-
let t = e.getExtension("WEBGL_debug_renderer_info");
|
|
672
|
-
if (!t) return !1;
|
|
673
|
-
let n = String(e.getParameter(t.UNMASKED_RENDERER_WEBGL) ?? "").toLowerCase();
|
|
674
|
-
return n.includes("swiftshader") || n.includes("llvmpipe") || n.includes("software") || n.includes("basic render") || n.includes("microsoft basic");
|
|
1631
|
+
n = document.createElement("canvas");
|
|
675
1632
|
} catch {
|
|
676
|
-
return
|
|
677
|
-
}
|
|
678
|
-
|
|
1633
|
+
return null;
|
|
1634
|
+
}
|
|
1635
|
+
n.width = t, n.height = t;
|
|
1636
|
+
let r = n.getContext("2d");
|
|
1637
|
+
if (!r) return null;
|
|
1638
|
+
let i = r.createImageData(t, t);
|
|
1639
|
+
for (let n of e) {
|
|
1640
|
+
let e = Math.min(t - 1, Math.floor(n.x * t)), r = (Math.min(t - 1, Math.floor(n.y * t)) * t + e) * 4, a = (e) => Math.round(Math.max(0, Math.min(1, e)) * 255);
|
|
1641
|
+
i.data[r] = a(n.color[0]), i.data[r + 1] = a(n.color[1]), i.data[r + 2] = a(n.color[2]), i.data[r + 3] = 255;
|
|
1642
|
+
}
|
|
1643
|
+
r.putImageData(i, 0, 0);
|
|
1644
|
+
try {
|
|
1645
|
+
return n.toDataURL("image/png");
|
|
1646
|
+
} catch {
|
|
1647
|
+
return null;
|
|
679
1648
|
}
|
|
680
|
-
}
|
|
681
|
-
function q(e) {
|
|
682
|
-
if (e !== "auto") return e;
|
|
683
|
-
if (typeof navigator > "u" || typeof window > "u") return "webgl";
|
|
684
|
-
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;
|
|
685
|
-
return t || n || r || We() ? "css" : "webgl";
|
|
686
1649
|
}
|
|
687
1650
|
//#endregion
|
|
688
|
-
//#region src/components/custom/aurora/Aurora.vue
|
|
689
|
-
var
|
|
1651
|
+
//#region src/components/custom/aurora/Aurora.vue?vue&type=script&setup=true&lang.ts
|
|
1652
|
+
var xt = ["data-aurora-substrate"], St = /* @__PURE__ */ e(/* @__PURE__ */ se({
|
|
690
1653
|
__name: "Aurora",
|
|
691
1654
|
props: {
|
|
692
|
-
config: { default: () =>
|
|
1655
|
+
config: { default: () => b },
|
|
693
1656
|
runtimeOptions: {},
|
|
694
1657
|
onInitError: {},
|
|
695
1658
|
renderMode: { default: "auto" },
|
|
696
1659
|
opacityCeiling: { default: 1 }
|
|
697
1660
|
},
|
|
698
1661
|
setup(e, { expose: t }) {
|
|
699
|
-
let n = e, r =
|
|
1662
|
+
let n = e, r = j(n.renderMode, { forceWebGLUnderSoftwareRaster: n.runtimeOptions?.forceWebGLUnderSoftwareRaster ?? !1 }), i = T(() => Math.max(0, Math.min(1, n.opacityCeiling))), a = E(null), o = dt(a, () => n.config, T(() => ({
|
|
700
1663
|
...n.runtimeOptions ?? {},
|
|
701
1664
|
...n.onInitError ? { onInitError: n.onInitError } : {}
|
|
702
|
-
})).value, { renderMode: r }), s =
|
|
1665
|
+
})).value, { renderMode: r }), s = T(() => r === "css"), c = T(() => yt(n.config)), l = T(() => s.value ? c.value.backgroundImage : P(n.config.palette)), u = T(() => s.value ? c.value.backgroundColor : "transparent");
|
|
703
1666
|
return t({
|
|
704
1667
|
config: n.config,
|
|
705
1668
|
canvasRef: a,
|
|
@@ -711,25 +1674,29 @@ var Ge = /* @__PURE__ */ e(/* @__PURE__ */ ne({
|
|
|
711
1674
|
pause: o.pause,
|
|
712
1675
|
resume: o.resume,
|
|
713
1676
|
isArmed: o.isArmed
|
|
714
|
-
}), (e, t) => (
|
|
1677
|
+
}), (e, t) => (fe(), ae("div", {
|
|
715
1678
|
class: "aurora-root block h-full w-full overflow-hidden",
|
|
716
|
-
|
|
717
|
-
|
|
1679
|
+
"data-aurora-substrate": D(r),
|
|
1680
|
+
style: le({ "--aurora-opacity-ceiling": i.value })
|
|
1681
|
+
}, [oe("div", {
|
|
718
1682
|
class: "aurora-placeholder h-full w-full",
|
|
719
1683
|
"aria-hidden": "true",
|
|
720
|
-
style:
|
|
721
|
-
|
|
1684
|
+
style: le({
|
|
1685
|
+
backgroundImage: l.value,
|
|
1686
|
+
backgroundColor: u.value
|
|
1687
|
+
})
|
|
1688
|
+
}, null, 4), oe("canvas", {
|
|
722
1689
|
ref_key: "canvasRef",
|
|
723
1690
|
ref: a,
|
|
724
1691
|
"aria-hidden": "true",
|
|
725
|
-
class:
|
|
726
|
-
}, null, 2)],
|
|
1692
|
+
class: ce(["aurora-canvas block h-full w-full", { "aurora-canvas--armed": D(o).isArmed.value }])
|
|
1693
|
+
}, null, 2)], 12, xt));
|
|
727
1694
|
}
|
|
728
|
-
}), [["__scopeId", "data-v-
|
|
1695
|
+
}), [["__scopeId", "data-v-3eae1d97"]]);
|
|
729
1696
|
//#endregion
|
|
730
1697
|
//#region src/components/custom/aurora/composables/useCursorInteraction.ts
|
|
731
|
-
function
|
|
732
|
-
let r =
|
|
1698
|
+
function Ct(e, t, n) {
|
|
1699
|
+
let r = lt(t), i = n.hitFraction ?? .35, a = null, o = null, s = null, c = null;
|
|
733
1700
|
function l(e, t) {
|
|
734
1701
|
let n = t.getBoundingClientRect();
|
|
735
1702
|
return {
|
|
@@ -816,21 +1783,20 @@ function Ke(e, t, n) {
|
|
|
816
1783
|
}, a = n.getBoundingClientRect(), o = d((i.clientX - a.left) / Math.max(a.width, 1), (i.clientY - a.top) / Math.max(a.height, 1));
|
|
817
1784
|
o !== null && r().nuclei.length > 1 && (r().nuclei.splice(o, 1), t.preventDefault());
|
|
818
1785
|
}
|
|
819
|
-
return
|
|
1786
|
+
return de(() => {
|
|
820
1787
|
let t = e.value;
|
|
821
1788
|
t && (t.addEventListener("pointermove", h), t.addEventListener("pointerleave", g), t.addEventListener("pointerdown", _), t.addEventListener("pointerup", v), t.addEventListener("pointercancel", v), t.addEventListener("contextmenu", y));
|
|
822
|
-
}),
|
|
1789
|
+
}), ue(() => {
|
|
823
1790
|
let t = e.value;
|
|
824
1791
|
t && (t.removeEventListener("pointermove", h), t.removeEventListener("pointerleave", g), t.removeEventListener("pointerdown", _), t.removeEventListener("pointerup", v), t.removeEventListener("pointercancel", v), t.removeEventListener("contextmenu", y));
|
|
825
1792
|
}), { isDragging: () => a };
|
|
826
1793
|
}
|
|
827
1794
|
//#endregion
|
|
828
|
-
//#region src/components/custom/aurora/composables/atoms.ts
|
|
829
|
-
|
|
830
|
-
function Y(e, t, n) {
|
|
1795
|
+
//#region src/components/custom/aurora/composables/atoms-fields.ts
|
|
1796
|
+
function Q(e, t, n) {
|
|
831
1797
|
return e + (t - e) * n;
|
|
832
1798
|
}
|
|
833
|
-
var
|
|
1799
|
+
var $ = {
|
|
834
1800
|
saturation: {
|
|
835
1801
|
calm: .85,
|
|
836
1802
|
vivid: 1.2
|
|
@@ -847,7 +1813,7 @@ var X = {
|
|
|
847
1813
|
calm: .15,
|
|
848
1814
|
vivid: .5
|
|
849
1815
|
}
|
|
850
|
-
},
|
|
1816
|
+
}, wt = {
|
|
851
1817
|
still: {
|
|
852
1818
|
nucleiDrift: 0,
|
|
853
1819
|
paletteDrift: 0,
|
|
@@ -866,34 +1832,74 @@ var X = {
|
|
|
866
1832
|
warpDrift: .008,
|
|
867
1833
|
breathDepth: .05
|
|
868
1834
|
}
|
|
869
|
-
}
|
|
870
|
-
function
|
|
871
|
-
let
|
|
1835
|
+
};
|
|
1836
|
+
function Tt(e, t, n) {
|
|
1837
|
+
let r = m(n, 0, 1);
|
|
1838
|
+
switch (t) {
|
|
1839
|
+
case "watercolor":
|
|
1840
|
+
e.wetEdge = r, e.granulation = r * .8;
|
|
1841
|
+
break;
|
|
1842
|
+
case "pastel":
|
|
1843
|
+
e.strokeAmount = r, e.canvasGrain = r * .05;
|
|
1844
|
+
break;
|
|
1845
|
+
case "oil":
|
|
1846
|
+
case "vangogh":
|
|
1847
|
+
e.strokeAmount = r, e.impasto = r, e.canvasGrain = r * .06;
|
|
1848
|
+
break;
|
|
1849
|
+
case "oil-pastel":
|
|
1850
|
+
case "crayon":
|
|
1851
|
+
case "kuwahara":
|
|
1852
|
+
e.strokeAmount = r, e.canvasGrain = r * .05;
|
|
1853
|
+
break;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
function Et(e, t) {
|
|
1857
|
+
switch (t) {
|
|
1858
|
+
case "watercolor": return m(e.wetEdge, 0, 1);
|
|
1859
|
+
case "oil":
|
|
1860
|
+
case "vangogh":
|
|
1861
|
+
case "pastel":
|
|
1862
|
+
case "oil-pastel":
|
|
1863
|
+
case "crayon":
|
|
1864
|
+
case "kuwahara": return m(e.strokeAmount, 0, 1);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
function Dt(e) {
|
|
1868
|
+
return e.nucleiDrift + e.paletteDrift + e.warpDrift > .001 ? "drifting" : e.breathDepth > .001 ? "breathing" : "still";
|
|
1869
|
+
}
|
|
1870
|
+
function Ot(e, t, n) {
|
|
1871
|
+
return n === t ? 0 : m((e - t) / (n - t), 0, 1);
|
|
1872
|
+
}
|
|
1873
|
+
//#endregion
|
|
1874
|
+
//#region src/components/custom/aurora/composables/atoms.ts
|
|
1875
|
+
var kt = {}, At = .61803398875;
|
|
1876
|
+
function jt(e, t = "composed") {
|
|
1877
|
+
let n = Math.max(1, Math.min(6, Math.round(e))), r = [
|
|
872
1878
|
[.33, .33],
|
|
873
1879
|
[.67, .67],
|
|
874
1880
|
[.67, .33],
|
|
875
1881
|
[.33, .67],
|
|
876
1882
|
[.5, .5],
|
|
877
1883
|
[.5, .33]
|
|
878
|
-
],
|
|
1884
|
+
], i = (e) => {
|
|
879
1885
|
switch (t) {
|
|
880
1886
|
case "scattered": {
|
|
881
|
-
let t = e *
|
|
882
|
-
return [
|
|
1887
|
+
let t = e * At * Math.PI * 2, r = .12 + .3 * Math.sqrt((e + .5) / n);
|
|
1888
|
+
return [m(.5 + r * Math.cos(t), .1, .9), m(.5 + r * Math.sin(t), .1, .9)];
|
|
883
1889
|
}
|
|
884
1890
|
case "centred": {
|
|
885
1891
|
if (n === 1) return [.5, .5];
|
|
886
1892
|
let t = e / n * Math.PI * 2, r = .12;
|
|
887
1893
|
return [.5 + r * Math.cos(t), .5 + r * Math.sin(t)];
|
|
888
1894
|
}
|
|
889
|
-
default: return
|
|
1895
|
+
default: return r[e % r.length];
|
|
890
1896
|
}
|
|
891
1897
|
};
|
|
892
1898
|
return Array.from({ length: n }, (e, t) => {
|
|
893
|
-
let [r,
|
|
1899
|
+
let [r, a] = i(t);
|
|
894
1900
|
return {
|
|
895
1901
|
x: r,
|
|
896
|
-
y:
|
|
1902
|
+
y: a,
|
|
897
1903
|
radius: .5,
|
|
898
1904
|
paletteBias: n === 1 ? 0 : t / (n - 1),
|
|
899
1905
|
valueBias: (t % 2 == 0 ? 1 : -1) * .05,
|
|
@@ -902,82 +1908,47 @@ function Z(e, t = "composed") {
|
|
|
902
1908
|
};
|
|
903
1909
|
});
|
|
904
1910
|
}
|
|
905
|
-
function
|
|
1911
|
+
function Mt(e) {
|
|
906
1912
|
return e < .4 ? "fbm" : e < .75 ? "hybrid" : "cellular";
|
|
907
1913
|
}
|
|
908
|
-
function
|
|
909
|
-
let n =
|
|
910
|
-
e.warpAmount =
|
|
911
|
-
}
|
|
912
|
-
function Q(e, t, n) {
|
|
913
|
-
let i = r(n, 0, 1);
|
|
914
|
-
switch (t) {
|
|
915
|
-
case "watercolor":
|
|
916
|
-
e.wetEdge = i, e.granulation = i * .8;
|
|
917
|
-
break;
|
|
918
|
-
case "pastel":
|
|
919
|
-
e.strokeAmount = i, e.canvasGrain = i * .05;
|
|
920
|
-
break;
|
|
921
|
-
case "oil":
|
|
922
|
-
case "vangogh":
|
|
923
|
-
e.strokeAmount = i, e.impasto = i, e.canvasGrain = i * .06;
|
|
924
|
-
break;
|
|
925
|
-
case "oil-pastel":
|
|
926
|
-
case "crayon":
|
|
927
|
-
e.strokeAmount = i, e.canvasGrain = i * .05;
|
|
928
|
-
break;
|
|
929
|
-
}
|
|
1914
|
+
function Nt(e, t) {
|
|
1915
|
+
let n = m(t, 0, 1);
|
|
1916
|
+
e.warpAmount = m(Q(.2, .6, n), 0, .6), e.warpScale = m(Q(1, 2.6, n), .5, 3), e.warpMode = Mt(n), e.noiseOctaves = n < .5 ? 3 : n < .85 ? 4 : 5;
|
|
930
1917
|
}
|
|
931
|
-
function
|
|
1918
|
+
function Pt(e = kt, t = b) {
|
|
932
1919
|
let n = {
|
|
933
1920
|
...t,
|
|
934
1921
|
palette: t.palette.map((e) => ({ ...e })),
|
|
935
1922
|
nuclei: t.nuclei.map((e) => ({ ...e })),
|
|
936
1923
|
flow: { ...t.flow }
|
|
937
|
-
},
|
|
938
|
-
if (e.seed !== void 0 && (n.palette =
|
|
1924
|
+
}, r = e.colorEnergy === void 0 ? void 0 : m(e.colorEnergy, 0, 1);
|
|
1925
|
+
if (e.seed !== void 0 && (n.palette = F(e.seed, {
|
|
939
1926
|
harmony: e.harmony ?? "analogous",
|
|
940
1927
|
stopCount: 4,
|
|
941
|
-
temperatureShift:
|
|
942
|
-
})),
|
|
943
|
-
let t =
|
|
944
|
-
n.nucleiDrift =
|
|
1928
|
+
temperatureShift: r === void 0 ? 0 : Q($.temperatureShift.calm, $.temperatureShift.vivid, r)
|
|
1929
|
+
})), r !== void 0 && (n.saturation = m(Q($.saturation.calm, $.saturation.vivid, r), .6, 1.3), n.valueVariance = m(Q($.valueVariance.calm, $.valueVariance.vivid, r), 0, .3), n.breathDepth = m(Q($.breathDepth.calm, $.breathDepth.vivid, r), 0, .15)), e.zones !== void 0 && (n.nuclei = jt(e.zones.count, e.zones.arrangement ?? "composed")), e.noise !== void 0 && Nt(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 && Tt(n, e.medium.kind, e.medium.amount)), e.motion !== void 0) {
|
|
1930
|
+
let t = wt[e.motion];
|
|
1931
|
+
n.nucleiDrift = m(t.nucleiDrift, 0, .05), n.paletteDrift = m(t.paletteDrift, 0, .04), n.warpDrift = m(t.warpDrift, 0, .015), n.breathDepth = m(e.motion === "still" ? 0 : Math.max(n.breathDepth, t.breathDepth), 0, .15);
|
|
945
1932
|
}
|
|
946
1933
|
return e.interactivity !== void 0 && (n.interactivity = { ...e.interactivity }), n;
|
|
947
1934
|
}
|
|
948
|
-
function
|
|
949
|
-
return n === t ? 0 : r((e - t) / (n - t), 0, 1);
|
|
950
|
-
}
|
|
951
|
-
function Qe(e) {
|
|
952
|
-
return e.nucleiDrift + e.paletteDrift + e.warpDrift > .001 ? "drifting" : e.breathDepth > .001 ? "breathing" : "still";
|
|
953
|
-
}
|
|
954
|
-
function $e(e, t) {
|
|
955
|
-
switch (t) {
|
|
956
|
-
case "watercolor": return r(e.wetEdge, 0, 1);
|
|
957
|
-
case "oil":
|
|
958
|
-
case "vangogh":
|
|
959
|
-
case "pastel":
|
|
960
|
-
case "oil-pastel":
|
|
961
|
-
case "crayon": return r(e.strokeAmount, 0, 1);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
function et(e) {
|
|
1935
|
+
function Ft(e) {
|
|
965
1936
|
let t = e.medium, n = t === "smooth" ? { kind: t } : {
|
|
966
1937
|
kind: t,
|
|
967
|
-
amount:
|
|
1938
|
+
amount: Et(e, t)
|
|
968
1939
|
};
|
|
969
1940
|
return {
|
|
970
|
-
seed: e.palette.length > 0 ?
|
|
1941
|
+
seed: e.palette.length > 0 ? C(e.palette[0]) : "#3a7bd5",
|
|
971
1942
|
harmony: "analogous",
|
|
972
|
-
colorEnergy:
|
|
1943
|
+
colorEnergy: Ot(e.saturation, $.saturation.calm, $.saturation.vivid),
|
|
973
1944
|
zones: {
|
|
974
1945
|
count: Math.max(1, Math.min(6, e.nuclei.length)),
|
|
975
1946
|
arrangement: "composed"
|
|
976
1947
|
},
|
|
977
|
-
noise:
|
|
1948
|
+
noise: Ot(e.warpAmount, .2, .6),
|
|
978
1949
|
medium: n,
|
|
979
|
-
motion:
|
|
1950
|
+
motion: Dt(e)
|
|
980
1951
|
};
|
|
981
1952
|
}
|
|
982
1953
|
//#endregion
|
|
983
|
-
export {
|
|
1954
|
+
export { St as Aurora, kt as DEFAULT_ATOMS, b as DEFAULT_AURORA_CONFIG, y as MAX_NUCLEI, ee as MAX_STOPS, v as PAPER_WASH_GROUND, yt as auroraFallbackGround, Ft as configToAtoms, X as createAurora, w as cssToOklch, F as deriveAurora, N as flattenPalette, ke as hexToOklchStop, A as isSoftwareWebGLRenderer, ht as nucleiFieldStatic, jt as nucleiPrior, C as oklchStopToHex, x as oklchToLinear, P as paletteToCssGradient, pt as relativeLuminance, Pt as resolveAtoms, j as resolveRenderMode, gt as sampleAuroraField, dt as useAurora, Ct as useCursorInteraction };
|