@mkbabb/glass-ui 4.0.1 → 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/dist/{CardAction-CW7a0m8M.js → CardAction-8whJrLWt.js} +23 -8
- package/dist/{CommandShortcut-DvZNQ_HF.js → CommandShortcut-D3yxgHNn.js} +23 -12
- package/dist/{ConfiguratorRow-BR4l-ixA.js → ConfiguratorRow-CaP7U3ZA.js} +11 -11
- package/dist/ContextMenuContent-B3ZsheLV.js +90 -0
- package/dist/{ContextMenuSubContent-xol4sD2q.js → ContextMenuSubContent-DDRID3qC.js} +15 -15
- package/dist/{DataTable-CuKwF7wr.js → DataTable-Bc9kUtu_.js} +2 -2
- package/dist/{DialogContent-DcKK8k9i.js → DialogContent-6JtTB5x2.js} +8 -5
- package/dist/DialogFooter-9phqcRIS.js +80 -0
- package/dist/DialogScrollContent-TTuovQst.js +93 -0
- package/dist/HoverCardContent-Bel1gdLZ.js +88 -0
- package/dist/{IconChip-BTD-nay5.js → IconChip-DhbdGdFQ.js} +1 -1
- package/dist/{IconTooltip-Bl8gFZ8d.js → IconTooltip-B0zimd2H.js} +1 -1
- package/dist/Input-Cg9DF62r.js +57 -0
- package/dist/{Notification-VUwexFUf.js → Notification-CphK7AAm.js} +3 -3
- package/dist/NumberFieldContent-D8cXeyO4.js +140 -0
- package/dist/PagerDots-Cjx96la-.js +98 -0
- package/dist/{SelectScrollDownButton-CrA8F0iV.js → SelectScrollDownButton-DAKCBEdW.js} +62 -57
- package/dist/{SelectSeparator-DXswVdRz.js → SelectSeparator-C2UGOkXF.js} +1 -1
- package/dist/Separator-DQcwC2TR.js +44 -0
- package/dist/Switch-B8RscmRu.js +49 -0
- package/dist/{Toaster-Bw4xR8xV.js → Toaster-D9qIHjBI.js} +1 -1
- package/dist/{ToggleGroupItem-pEM9vIhs.js → ToggleGroupItem-BLtr3TJq.js} +2 -2
- package/dist/TooltipProvider-BJ_Y5EGX.js +109 -0
- package/dist/animated-digit.js +1 -1
- package/dist/api/index.d.ts +15 -32
- package/dist/api/types-extra.d.ts +31 -0
- package/dist/api.js +1 -1
- package/dist/aurora.js +579 -251
- package/dist/border-progress.js +49 -57
- package/dist/{button-DYCUa-tH.js → button-5dY1Dvhd.js} +13 -14
- package/dist/button.js +1 -1
- package/dist/canvas.js +2 -3
- package/dist/card.js +1 -1
- package/dist/carousel.js +20 -20
- package/dist/color-Cs0-oxYL.js +116 -0
- package/dist/color.js +2 -2
- package/dist/command.js +1 -1
- 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/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 +12 -0
- package/dist/components/custom/aurora/composables/uniformBridgeWGPU.d.ts +11 -2
- package/dist/components/custom/aurora/composables/wgpuSetup.d.ts +8 -0
- package/dist/components/custom/aurora/constants/presets.d.ts +18 -0
- package/dist/components/custom/aurora/constants/renderMode.d.ts +16 -8
- 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 -1
- package/dist/components/custom/border-progress/composables/spectrum-walk.d.ts +25 -0
- package/dist/components/custom/border-progress/composables/useBorderSpectrum.d.ts +14 -18
- package/dist/components/custom/border-progress/index.d.ts +1 -1
- 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/composables/concentricGLSetup.d.ts +7 -0
- package/dist/components/custom/concentric/composables/concentricWGPUSetup.d.ts +9 -0
- package/dist/components/custom/concentric/composables/ringField.d.ts +57 -16
- package/dist/components/custom/concentric/composables/uniformBridgeWGPU.d.ts +2 -1
- package/dist/components/custom/concentric/composables/useConcentric.d.ts +4 -4
- package/dist/components/custom/concentric/constants.d.ts +30 -6
- package/dist/components/custom/concentric/index.d.ts +2 -2
- package/dist/components/custom/concentric/shaders/concentric.glsl.d.ts +2 -2
- package/dist/components/custom/concentric/shaders/concentric.wgsl.d.ts +1 -1
- 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 +12 -0
- 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 +80 -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/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 +15 -11
- package/dist/components/custom/dot-flow-field/composables/flowField.d.ts +48 -6
- package/dist/components/custom/dot-flow-field/composables/uniformBridgeWGPU.d.ts +23 -8
- package/dist/components/custom/dot-flow-field/composables/useDotFlowField.d.ts +6 -5
- package/dist/components/custom/dot-flow-field/composables/useFlowParticles.d.ts +18 -5
- package/dist/components/custom/dot-flow-field/constants.d.ts +42 -21
- package/dist/components/custom/dot-flow-field/index.d.ts +2 -2
- package/dist/components/custom/dot-flow-field/shaders/flow-field.compute.wgsl.d.ts +1 -1
- package/dist/components/custom/dot-flow-field/shaders/flow-field.glsl.d.ts +4 -20
- package/dist/components/custom/dot-flow-field/shaders/flow-field.render.wgsl.d.ts +1 -1
- 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/EasingPicker.vue.d.ts +2 -2
- package/dist/components/custom/easing/composables/useEasingPicker.d.ts +5 -0
- package/dist/components/custom/expandable-container/ExpandableContainer.vue.d.ts +11 -0
- package/dist/components/custom/fourier-field/FourierField.vue.d.ts +40 -47
- 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 +40 -37
- package/dist/components/custom/fourier-field/constants.d.ts +61 -4
- 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/goo-blob/GooBlob.vue.d.ts +9 -1
- 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 -1
- 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/labeled-field/LabeledField.vue.d.ts +21 -2
- package/dist/components/custom/metric-stack/MetricRow.vue.d.ts +15 -0
- 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/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 +8 -6
- package/dist/components/custom/tabs/constants.d.ts +20 -2
- package/dist/components/custom/watercolor-dot/WatercolorDot.vue.d.ts +29 -16
- 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/useControlSize.d.ts +46 -0
- package/dist/components/ui/button/index.d.ts +1 -1
- package/dist/components/ui/card/Card.vue.d.ts +45 -0
- package/dist/components/ui/card/index.d.ts +1 -1
- package/dist/components/ui/carousel/CarouselNext.vue.d.ts +1 -1
- package/dist/components/ui/carousel/CarouselPrevious.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/dropdown-menu/DropdownMenuContent.vue.d.ts +4 -0
- package/dist/components/ui/hover-card/HoverCardContent.vue.d.ts +3 -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/select/SelectContent.vue.d.ts +3 -0
- package/dist/components/ui/switch/Switch.vue.d.ts +2 -0
- package/dist/components/ui/textarea/Textarea.vue.d.ts +3 -0
- 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/useVizChoreography.d.ts +123 -0
- package/dist/composables/glass/webgl/createCanvasLifecycle.d.ts +10 -0
- package/dist/composables/glass/webgl/shaders/flow.wgsl.d.ts +1 -0
- package/dist/composables/glass/webgpu/index.d.ts +1 -1
- package/dist/composables/glass/webgpu/useGpuSubstrate.d.ts +28 -7
- package/dist/composables/glass/webgpu/useWebGPUCanvas.d.ts +1 -0
- package/dist/composables/glass/webgpu/webgpuDevice.d.ts +42 -0
- package/dist/composables/motion/core/index.d.ts +3 -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 +31 -6
- 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.js +495 -221
- package/dist/configurator.js +2 -2
- package/dist/confirm-dialog.js +62 -47
- package/dist/constellation.js +635 -235
- package/dist/context-menu.js +2 -2
- package/dist/controls.js +1 -1
- 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 +602 -458
- package/dist/dot-flow-field.js +580 -290
- 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/{dropdown-menu-CofSZuk8.js → dropdown-menu-aJmV5SqE.js} +83 -79
- package/dist/dropdown-menu.js +1 -1
- package/dist/easing.js +188 -176
- package/dist/expandable-container.js +42 -20
- package/dist/fading-scroll.js +1 -1
- package/dist/flow.glsl-B2P7e0MT.js +4 -0
- package/dist/forms.js +62 -60
- package/dist/fourier-field.js +825 -178
- package/dist/fourier-math.js +1 -1
- package/dist/glass-ui.css +1 -1
- package/dist/glass-ui.js +145 -104
- package/dist/goo-blob.js +171 -1228
- package/dist/goo-dot-matrix.d.ts +1 -0
- package/dist/goo-dot-matrix.js +591 -0
- package/dist/handmark.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 +2 -0
- package/dist/instrument-chassis.js +1 -1
- package/dist/keyboard.js +1 -1
- package/dist/labeled-field.js +70 -60
- package/dist/metric-cell.js +1 -1
- package/dist/metric-stack.js +11 -2
- package/dist/motion-core.js +54 -32
- package/dist/motion-curves.js +11 -1
- package/dist/motion.js +46 -111
- 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/{presets-BW2b-fr1.js → presets-CvOUqtdY.js} +3 -3
- package/dist/{procedural-color.glsl-CIFsJhwI.js → procedural-color.wgsl-m7Zgv35j.js} +2 -2
- package/dist/progress.js +1 -1
- package/dist/pulse.js +1 -1
- package/dist/reactive.js +1 -1
- package/dist/{useCanvas2D-B8w_E3Rr.js → resolveCanvasColor-yPyIpJt9.js} +12 -2
- package/dist/scrollReader-DI1NWxUw.js +42 -0
- package/dist/scrolling-text.js +1 -1
- package/dist/search.js +160 -304
- 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-tZMg0E0w.js → sheet-B2flBfLH.js} +2 -2
- package/dist/sheet.js +1 -1
- package/dist/sidebar.js +216 -114
- package/dist/slider.js +1 -1
- package/dist/sortable-list.js +1 -1
- package/dist/spectrum-walk-BVzA7Biz.js +33 -0
- package/dist/{springPresets-CFQGQfdl.js → springPresets-Ce7OYCm9.js} +12 -6
- package/dist/styles/animations.css +13 -3
- package/dist/styles/cards.css +69 -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 +33 -11
- package/dist/styles/deferred.css +2 -0
- package/dist/styles/dock/cta-seat.css +87 -0
- package/dist/styles/dock/density.css +153 -0
- package/dist/styles/dock/layers.css +55 -7
- package/dist/styles/dock/morph-bridge.css +54 -18
- package/dist/styles/dock/morph.css +41 -33
- package/dist/styles/dock/overflow.css +12 -0
- package/dist/styles/dock/search.css +68 -0
- package/dist/styles/dock/shape.css +124 -0
- package/dist/styles/dock/shell.css +23 -5
- 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 +11 -1
- package/dist/styles/glass/accent-tone.css +66 -0
- package/dist/styles/glass/control-surfaces.css +167 -0
- package/dist/styles/glass/ladder.css +67 -17
- package/dist/styles/glass/rim.css +19 -9
- package/dist/styles/glass/surfaces.css +69 -148
- package/dist/styles/glass.css +10 -0
- package/dist/styles/index.css +15 -0
- package/dist/styles/scroll-chrome.css +123 -0
- package/dist/styles/scroll-driven.css +38 -0
- package/dist/styles/segmented-tabs.css +50 -14
- package/dist/styles/theme/bridges.css +22 -0
- package/dist/styles/theme/radius.css +18 -1
- package/dist/styles/tokens/color-radius.css +13 -3
- package/dist/styles/tokens/dark-arm.css +39 -6
- package/dist/styles/tokens/glass-deep.css +28 -3
- package/dist/styles/tokens/glass-fx.css +44 -1
- package/dist/styles/tokens/glass.css +91 -31
- package/dist/styles/tokens/light-dark.css +1 -1
- package/dist/styles/tokens/offsets.css +27 -0
- package/dist/styles/tokens/property-regs.css +133 -0
- package/dist/styles/tokens/scale-paper.css +73 -29
- package/dist/styles/tokens/scheme-motion.css +44 -6
- package/dist/styles/tokens/sizing-config.css +110 -0
- package/dist/styles/tokens/sizing.css +55 -104
- package/dist/styles/tokens.css +5 -0
- package/dist/styles/typography/semantic.css +18 -5
- package/dist/styles/utilities/a11y-overrides.css +20 -5
- package/dist/styles/utilities/base-misc.css +52 -0
- package/dist/styles/utilities/btn.css +14 -3
- package/dist/styles/utilities/components.css +31 -6
- package/dist/styles/utilities/metal.css +26 -0
- package/dist/switch.js +1 -1
- package/dist/tabs.js +8 -8
- package/dist/timeline.js +1 -1
- 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 +1 -1
- package/dist/uniformBridgeWGPU-CtAKl45L.js +1204 -0
- package/dist/{useAnimatedNumber-BfUq2bUM.js → useAnimatedNumber-CLrxicG9.js} +1 -1
- package/dist/{useConfiguratorState-DNlOh6c8.js → useConfiguratorState-4xblKfwd.js} +25 -24
- package/dist/useControlSize-SH1UmJCi.js +9 -0
- package/dist/useDockCtaReceive-DfFkmgL1.js +82 -0
- package/dist/{useDragMorph-DgxnsVJz.js → useDragMorph-BUgAC-zK.js} +4 -4
- package/dist/useFuzzySearch-DIhcYtcw.js +177 -0
- package/dist/useGpuSubstrate-4pTcp6mX.js +294 -0
- package/dist/{useLiquidPress-kfb4KX79.js → useLiquidPress-BooG97RY.js} +2 -2
- package/dist/usePointerVelocityField-QLsy3_kv.js +91 -0
- package/dist/useScrollChrome-D66AVP7C.js +258 -0
- package/dist/{useSpringMount-q1amq1SJ.js → useSpringMount-BWDnKIwh.js} +1 -1
- package/dist/useSpringPress-B1-Czp-V.js +36 -0
- package/dist/useViewTransition-CUI1nAgn.js +95 -0
- package/dist/{vendor-CKmzio-i.js → vendor-B2qOlYY3.js} +24 -11
- package/dist/virtual.d.ts +1 -0
- package/dist/virtual.js +225 -0
- package/dist/watercolor-dot.js +116 -73
- package/package.json +127 -7
- package/src/styles/animations.css +13 -3
- package/src/styles/cards.css +69 -0
- package/src/styles/completion-seal.css +131 -0
- package/src/styles/configurator.css +55 -0
- package/src/styles/critical-partition.mjs +33 -11
- package/src/styles/dock/cta-seat.css +87 -0
- package/src/styles/dock/density.css +153 -0
- package/src/styles/dock/layers.css +55 -7
- package/src/styles/dock/morph-bridge.css +54 -18
- package/src/styles/dock/morph.css +41 -33
- package/src/styles/dock/overflow.css +12 -0
- package/src/styles/dock/search.css +68 -0
- package/src/styles/dock/shape.css +124 -0
- package/src/styles/dock/shell.css +23 -5
- 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 +11 -1
- package/src/styles/glass/accent-tone.css +66 -0
- package/src/styles/glass/control-surfaces.css +167 -0
- package/src/styles/glass/ladder.css +67 -17
- package/src/styles/glass/rim.css +19 -9
- package/src/styles/glass/surfaces.css +69 -148
- package/src/styles/glass.css +10 -0
- package/src/styles/index.css +15 -0
- package/src/styles/scroll-chrome.css +123 -0
- package/src/styles/scroll-driven.css +38 -0
- package/src/styles/segmented-tabs.css +50 -14
- package/src/styles/theme/bridges.css +22 -0
- package/src/styles/theme/radius.css +18 -1
- package/src/styles/tokens/color-radius.css +13 -3
- package/src/styles/tokens/dark-arm.css +39 -6
- package/src/styles/tokens/glass-deep.css +28 -3
- package/src/styles/tokens/glass-fx.css +44 -1
- package/src/styles/tokens/glass.css +91 -31
- package/src/styles/tokens/light-dark.css +1 -1
- package/src/styles/tokens/offsets.css +27 -0
- package/src/styles/tokens/property-regs.css +133 -0
- package/src/styles/tokens/scale-paper.css +73 -29
- package/src/styles/tokens/scheme-motion.css +44 -6
- package/src/styles/tokens/sizing-config.css +110 -0
- package/src/styles/tokens/sizing.css +55 -104
- package/src/styles/tokens.css +5 -0
- package/src/styles/typography/semantic.css +18 -5
- package/src/styles/utilities/a11y-overrides.css +20 -5
- package/src/styles/utilities/base-misc.css +52 -0
- package/src/styles/utilities/btn.css +14 -3
- package/src/styles/utilities/components.css +31 -6
- package/src/styles/utilities/metal.css +26 -0
- package/dist/ContextMenuContent-uWnVxDab.js +0 -85
- package/dist/DialogFooter-BZNX5aVr.js +0 -165
- package/dist/HoverCardContent-b2uaAMRR.js +0 -83
- package/dist/Input-h9v5LeXf.js +0 -55
- package/dist/NumberFieldContent-Cq7EzX-U.js +0 -138
- package/dist/Separator-pKF0oA4M.js +0 -37
- package/dist/Switch-CwYNf8bo.js +0 -47
- package/dist/TooltipProvider-rzvnXz60.js +0 -104
- 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/createCanvasLifecycle-CHD5XrDW.js +0 -82
- package/dist/procedural-color.wgsl-CToRHugY.js +0 -224
- package/dist/resolveCanvasColor-CUyHr5Uu.js +0 -11
- package/dist/styles/dock/rail-extend.css +0 -397
- package/dist/usePointerVelocityField-JbRd5CrM.js +0 -137
- package/dist/useRAFLoop-UYa4zoiN.js +0 -109
- package/dist/useSpringPress-BsqPr7FJ.js +0 -34
- package/src/styles/dock/rail-extend.css +0 -397
- /package/dist/{FadingScroll-DI6hQhT9.js → FadingScroll-DLRbH5Xr.js} +0 -0
- /package/dist/{HoverPopover-CbqbNwgU.js → HoverPopover-BcIxvyqZ.js} +0 -0
- /package/dist/{InstrumentChassis-Bx0F_q5g.js → InstrumentChassis-CxsHSyMj.js} +0 -0
- /package/dist/{PaperBackdrop-Vf3tlpvd.js → PaperBackdrop-CqwjnfLv.js} +0 -0
- /package/dist/{Progress-DctG61iZ.js → Progress-CnqB7gLm.js} +0 -0
- /package/dist/{ScrollingText-yOpBzFYq.js → ScrollingText-CTZbA_cG.js} +0 -0
- /package/dist/{SelectGroup-DwwjicPY.js → SelectGroup-BFiod7X2.js} +0 -0
- /package/dist/{compile-CQEFRTmx.js → compile-nZ1xVYTp.js} +0 -0
- /package/dist/{constants-BPOqYJAm.js → constants--C2DkLW8.js} +0 -0
- /package/dist/{math-BINYmg5z.js → math-Eb0w3LqU.js} +0 -0
- /package/dist/{prng-Za0Rmgag.js → prng-B-d9eYX8.js} +0 -0
- /package/dist/{slider-DVb4HXU-.js → slider-2A0rPn79.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/{useInterval-CvK1mL92.js → useInterval-CNdua40W.js} +0 -0
- /package/dist/{useKeyboardShortcuts-BXWXOZ-9.js → useKeyboardShortcuts-BPRp33Im.js} +0 -0
- /package/dist/{useLiquidFlex-mZPMiNXh.js → useLiquidFlex-UmA6LMZu.js} +0 -0
- /package/dist/{useScrollProgress-D7bYU2RK.js → useScrollProgress-c3yxmH6a.js} +0 -0
- /package/dist/{useSortable-DHjtZSEd.js → useSortable-BVqlJRBR.js} +0 -0
- /package/dist/{useTextHighlight-CWEi25hf.js → useTextHighlight-NmBM5V_4.js} +0 -0
- /package/dist/{vReveal-Czsb7zQC.js → vReveal-D9k0jADx.js} +0 -0
- /package/dist/{vSpecular-CQFmLNzA.js → vSpecular-EX7loENl.js} +0 -0
|
@@ -0,0 +1,1204 @@
|
|
|
1
|
+
import { a as e, n as t, o as n, r, s as i, t as a } from "./procedural-color.wgsl-m7Zgv35j.js";
|
|
2
|
+
import { n as o, t as s } from "./prng-B-d9eYX8.js";
|
|
3
|
+
import { onUnmounted as c, readonly as l, ref as u, watch as d } from "vue";
|
|
4
|
+
import { SpringProgress as f } from "@mkbabb/keyframes.js";
|
|
5
|
+
//#region src/components/custom/goo-blob/types.ts
|
|
6
|
+
var p = {
|
|
7
|
+
geometry: {
|
|
8
|
+
canvasSize: 200,
|
|
9
|
+
bodyRadius: .22,
|
|
10
|
+
satelliteCount: 3,
|
|
11
|
+
satelliteRadius: .082,
|
|
12
|
+
orbitRadius: .17,
|
|
13
|
+
eccentricity: .05
|
|
14
|
+
},
|
|
15
|
+
satellites: {
|
|
16
|
+
mergeDuration: 1800,
|
|
17
|
+
absorbedDuration: [2e3, 4e3],
|
|
18
|
+
emergeDuration: 2200,
|
|
19
|
+
orbitDuration: [8e3, 14e3]
|
|
20
|
+
},
|
|
21
|
+
membrane: {
|
|
22
|
+
smoothK: .05,
|
|
23
|
+
merge: "circular",
|
|
24
|
+
noiseAmp: .038,
|
|
25
|
+
noiseFreq: 3.5,
|
|
26
|
+
noiseSpeed: .08,
|
|
27
|
+
warpAmp: .35,
|
|
28
|
+
pulseFreq: .3,
|
|
29
|
+
pulseAmp: .008
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
paletteStops: [
|
|
33
|
+
"#b5947f",
|
|
34
|
+
"#d4b27d",
|
|
35
|
+
"#dad6b1"
|
|
36
|
+
],
|
|
37
|
+
hueRange: 5,
|
|
38
|
+
satShift: 0,
|
|
39
|
+
brightnessShift: 0,
|
|
40
|
+
colorNoiseFreq: 2,
|
|
41
|
+
colorNoiseSpeed: .05
|
|
42
|
+
},
|
|
43
|
+
surface: {
|
|
44
|
+
lit: !0,
|
|
45
|
+
shadow: !0,
|
|
46
|
+
shadowSoftness: 16,
|
|
47
|
+
rimColor: "#8c694e",
|
|
48
|
+
lightDir: [
|
|
49
|
+
.4,
|
|
50
|
+
.7,
|
|
51
|
+
.6
|
|
52
|
+
],
|
|
53
|
+
specStrength: .16,
|
|
54
|
+
specShininess: 20,
|
|
55
|
+
rimPower: 2.5,
|
|
56
|
+
rimStrength: .32,
|
|
57
|
+
iridescence: .09,
|
|
58
|
+
iridHue: 85,
|
|
59
|
+
iridSpeed: .06,
|
|
60
|
+
sssScale: .1,
|
|
61
|
+
sssPower: 2,
|
|
62
|
+
coreGlow: .06
|
|
63
|
+
},
|
|
64
|
+
interaction: {
|
|
65
|
+
pointerAttraction: .35,
|
|
66
|
+
pointerStrength: .1,
|
|
67
|
+
stretch: .5,
|
|
68
|
+
clickImpulse: .5
|
|
69
|
+
},
|
|
70
|
+
variant: "meatball",
|
|
71
|
+
quality: "full",
|
|
72
|
+
tempo: 1
|
|
73
|
+
}, m = Symbol("blobConfig"), h = 1 / 1.6, g = {
|
|
74
|
+
idle: {
|
|
75
|
+
valence: 0,
|
|
76
|
+
arousal: .35
|
|
77
|
+
},
|
|
78
|
+
happy: {
|
|
79
|
+
valence: .8,
|
|
80
|
+
arousal: .6
|
|
81
|
+
},
|
|
82
|
+
curious: {
|
|
83
|
+
valence: .3,
|
|
84
|
+
arousal: .5
|
|
85
|
+
},
|
|
86
|
+
sleepy: {
|
|
87
|
+
valence: -.1,
|
|
88
|
+
arousal: .1
|
|
89
|
+
},
|
|
90
|
+
excited: {
|
|
91
|
+
valence: .7,
|
|
92
|
+
arousal: 1
|
|
93
|
+
}
|
|
94
|
+
}, _ = (e, t, n) => e + (t - e) * n;
|
|
95
|
+
function v({ valence: e, arousal: t }) {
|
|
96
|
+
return {
|
|
97
|
+
orbitSpeedScale: _(.4, 2.2, t),
|
|
98
|
+
wobbleScale: _(.5, 2, t),
|
|
99
|
+
pulseFreq: _(.15, 1.5, t),
|
|
100
|
+
pulseAmp: _(.008, .05, t),
|
|
101
|
+
noiseAmp: _(.015, .045, t),
|
|
102
|
+
hueRange: _(3, 25, t * .6 + (e * .5 + .5) * .4),
|
|
103
|
+
satShift: _(-.05, .1, e * .5 + .5),
|
|
104
|
+
brightnessShift: _(-.03, .08, e * .5 + .5),
|
|
105
|
+
smoothK: _(.85, 1.35, t),
|
|
106
|
+
pointerAttraction: _(-.2, .6, e * .5 + .5) * (.7 + .15 * t),
|
|
107
|
+
mergeRate: _(2, .3, t),
|
|
108
|
+
iridScale: _(.55, 1.35, t)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
var y = {
|
|
112
|
+
idle: v(g.idle),
|
|
113
|
+
happy: v(g.happy),
|
|
114
|
+
curious: v(g.curious),
|
|
115
|
+
sleepy: v(g.sleepy),
|
|
116
|
+
excited: v(g.excited)
|
|
117
|
+
}, b = {
|
|
118
|
+
idle: 1500,
|
|
119
|
+
happy: 1200,
|
|
120
|
+
curious: 800,
|
|
121
|
+
sleepy: 2500,
|
|
122
|
+
excited: 600
|
|
123
|
+
}, x = 6e3, S = .35, C = .85, w = .2, T = .015, E = .02, D = .01, O = .015, k = .75, A = 2e3, j = /* @__PURE__ */ "uResolution.uTime.uBaseColor.uPointer.uPointerActive.uPointerAttraction.uPointerStrength.uBodyRadius.uPulsePhase.uPulseAmp.uNoiseAmp.uNoiseFreq.uNoiseSpeed.uWarpAmp.uSmoothK.uMerge.uStage.uMaxReach.uLit.uRimColor.uLightDir.uSpecStrength.uSpecShininess.uRimPower.uRimStrength.uShadow.uShadowSoftness.uIridescence.uIridHue.uIridSpeed.uSssScale.uSssPower.uCoreGlow.uHueRange.uSatShift.uBrightnessShift.uColorNoiseFreq.uColorNoiseSpeed.uStopCount.uSatCount.uTrailCount.uVelocity.uStretch".split(".");
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/components/custom/goo-blob/composables/easing.ts
|
|
126
|
+
function M(e) {
|
|
127
|
+
return e < .5 ? 2 * e * e : 1 - 2 * (1 - e) * (1 - e);
|
|
128
|
+
}
|
|
129
|
+
function N(e) {
|
|
130
|
+
return e * e;
|
|
131
|
+
}
|
|
132
|
+
function P(e) {
|
|
133
|
+
return 1 - (1 - e) * (1 - e);
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/components/custom/goo-blob/composables/useBlobMood.ts
|
|
137
|
+
function F(e, t, n) {
|
|
138
|
+
let r = (e, t) => e + (t - e) * n;
|
|
139
|
+
return {
|
|
140
|
+
orbitSpeedScale: r(e.orbitSpeedScale, t.orbitSpeedScale),
|
|
141
|
+
wobbleScale: r(e.wobbleScale, t.wobbleScale),
|
|
142
|
+
pulseFreq: r(e.pulseFreq, t.pulseFreq),
|
|
143
|
+
pulseAmp: r(e.pulseAmp, t.pulseAmp),
|
|
144
|
+
noiseAmp: r(e.noiseAmp, t.noiseAmp),
|
|
145
|
+
hueRange: r(e.hueRange, t.hueRange),
|
|
146
|
+
satShift: r(e.satShift, t.satShift),
|
|
147
|
+
brightnessShift: r(e.brightnessShift, t.brightnessShift),
|
|
148
|
+
smoothK: r(e.smoothK, t.smoothK),
|
|
149
|
+
pointerAttraction: r(e.pointerAttraction, t.pointerAttraction),
|
|
150
|
+
mergeRate: r(e.mergeRate, t.mergeRate),
|
|
151
|
+
iridScale: r(e.iridScale, t.iridScale)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function I() {
|
|
155
|
+
let e = u("idle"), t = u({ ...y.idle }), n = { ...y.idle }, r = { ...y.idle }, i = 0, a = 0, o = !1, s = 0, c = !1, d = !1, f = 0;
|
|
156
|
+
function p(s, l = {}) {
|
|
157
|
+
(l.source ?? "manual") === "manual" && (c = !0), !(s === e.value && !o) && (e.value = s, n = { ...t.value }, r = y[s], a = b[s], i = 0, o = !0);
|
|
158
|
+
}
|
|
159
|
+
function m(e) {
|
|
160
|
+
f = e.idleMs;
|
|
161
|
+
let t = e.pointerActive && !d;
|
|
162
|
+
if (d = e.pointerActive, c && (e.clicked || t) && (c = !1), !c) {
|
|
163
|
+
if (e.clicked) {
|
|
164
|
+
s = 900, p("excited", { source: "auto" });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
s > 0 || (e.pointerActive ? p("curious", { source: "auto" }) : e.idleMs > 6e3 ? p("sleepy", { source: "auto" }) : p("idle", { source: "auto" }));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function h() {
|
|
171
|
+
return o || s > 0 || c && e.value !== "idle" ? !1 : !(!c && e.value !== "sleepy" && f < 6e3);
|
|
172
|
+
}
|
|
173
|
+
function g() {
|
|
174
|
+
return o || s > 0 || c || e.value === "sleepy" ? Infinity : Math.max(0, x - f);
|
|
175
|
+
}
|
|
176
|
+
function _(e) {
|
|
177
|
+
if (s > 0 && (s = Math.max(0, s - e)), !o) return;
|
|
178
|
+
i += e;
|
|
179
|
+
let c = Math.min(i / a, 1), l = M(c);
|
|
180
|
+
t.value = F(n, r, l), c >= 1 && (o = !1);
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
currentMood: l(e),
|
|
184
|
+
params: l(t),
|
|
185
|
+
setMood: p,
|
|
186
|
+
update: m,
|
|
187
|
+
tick: _,
|
|
188
|
+
isSettled: h,
|
|
189
|
+
nextAutoMoodMs: g
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/components/custom/goo-blob/composables/useBlobPointer.ts
|
|
194
|
+
function L(e) {
|
|
195
|
+
let t = u({
|
|
196
|
+
x: 0,
|
|
197
|
+
y: 0
|
|
198
|
+
}), n = u({
|
|
199
|
+
x: 0,
|
|
200
|
+
y: 0
|
|
201
|
+
}), r = u(!1), i = u(0), a = 0, o = 0, s = {
|
|
202
|
+
response: .18,
|
|
203
|
+
dampingFraction: 1
|
|
204
|
+
}, p = new f(s), m = new f(s), h = Array.from({ length: 15 }, () => ({
|
|
205
|
+
x: 0,
|
|
206
|
+
y: 0,
|
|
207
|
+
radius: 0
|
|
208
|
+
})), g = 0, _ = 0, v = 0, y = 0;
|
|
209
|
+
function b(t) {
|
|
210
|
+
let n = e.value;
|
|
211
|
+
if (!n) return;
|
|
212
|
+
let i = n.getBoundingClientRect();
|
|
213
|
+
a = (t.clientX - i.left) / i.width * 2 - 1, o = (t.clientY - i.top) / i.height * 2 - 1, r.value = !0;
|
|
214
|
+
}
|
|
215
|
+
function x() {
|
|
216
|
+
r.value = !1;
|
|
217
|
+
}
|
|
218
|
+
let C = null;
|
|
219
|
+
d(e, (e) => {
|
|
220
|
+
C &&= (C(), null), e && (e.addEventListener("pointermove", b), e.addEventListener("pointerleave", x), C = () => {
|
|
221
|
+
e.removeEventListener("pointermove", b), e.removeEventListener("pointerleave", x);
|
|
222
|
+
});
|
|
223
|
+
}, { immediate: !0 }), c(() => C?.());
|
|
224
|
+
function w(e = 16) {
|
|
225
|
+
let s = Math.min(e, 50), c = s / 1e3;
|
|
226
|
+
r.value ? k = 0 : k += Math.min(e, 50);
|
|
227
|
+
let l = r.value ? a : 0, u = r.value ? o : 0;
|
|
228
|
+
if (p.target = l, m.target = u, p.tickDt(s), m.tickDt(s), t.value = {
|
|
229
|
+
x: p.value,
|
|
230
|
+
y: m.value
|
|
231
|
+
}, n.value = {
|
|
232
|
+
x: p.velocity,
|
|
233
|
+
y: m.velocity
|
|
234
|
+
}, v !== 0 || y !== 0) {
|
|
235
|
+
let e = -324 * v - 2 * S * 18 * y;
|
|
236
|
+
y += e * c, v += y * c, v < -.9 && (v = -.9), Math.abs(v) < 1e-4 && Math.abs(y) < 1e-4 && (v = 0, y = 0);
|
|
237
|
+
}
|
|
238
|
+
i.value = v;
|
|
239
|
+
let d = Math.hypot(p.velocity, m.velocity);
|
|
240
|
+
r.value || d > .05 ? (g = (g + 1) % 15, h[g].x = p.value, h[g].y = m.value, _ = Math.min(_ + 1, 15)) : _ > 0 && (_ = Math.max(0, _ - 1));
|
|
241
|
+
}
|
|
242
|
+
function T(e) {
|
|
243
|
+
let t = [];
|
|
244
|
+
for (let n = 0; n < _; n++) {
|
|
245
|
+
let r = h[(g - n + 30) % 15];
|
|
246
|
+
t.push({
|
|
247
|
+
x: r.x,
|
|
248
|
+
y: r.y,
|
|
249
|
+
radius: e * (1 - n / 15)
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
sources: t,
|
|
254
|
+
count: _
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
let E = !1;
|
|
258
|
+
function D(e) {
|
|
259
|
+
y += e * 18, E = !0;
|
|
260
|
+
}
|
|
261
|
+
function O() {
|
|
262
|
+
let e = E;
|
|
263
|
+
return E = !1, e;
|
|
264
|
+
}
|
|
265
|
+
let k = 0;
|
|
266
|
+
function A() {
|
|
267
|
+
p.reset(0, 0), m.reset(0, 0), p.target = 0, m.target = 0, t.value = {
|
|
268
|
+
x: 0,
|
|
269
|
+
y: 0
|
|
270
|
+
}, n.value = {
|
|
271
|
+
x: 0,
|
|
272
|
+
y: 0
|
|
273
|
+
}, v = 0, y = 0, i.value = 0, _ = 0;
|
|
274
|
+
}
|
|
275
|
+
function j() {
|
|
276
|
+
return !(r.value || Math.hypot(p.velocity, m.velocity) > .001 || Math.abs(p.value) > .001 || Math.abs(m.value) > .001 || _ > 0 || v !== 0 || y !== 0);
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
pointer: l(t),
|
|
280
|
+
velocity: l(n),
|
|
281
|
+
active: l(r),
|
|
282
|
+
pulse: l(i),
|
|
283
|
+
idleMs: () => k,
|
|
284
|
+
tick: w,
|
|
285
|
+
trailSources: T,
|
|
286
|
+
click: D,
|
|
287
|
+
consumeClick: O,
|
|
288
|
+
rest: A,
|
|
289
|
+
isAtRest: j
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/components/custom/goo-blob/composables/useBlobSatellites.ts
|
|
294
|
+
function R(e, t, n) {
|
|
295
|
+
return t + e() * (n - t);
|
|
296
|
+
}
|
|
297
|
+
function z(e) {
|
|
298
|
+
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
299
|
+
}
|
|
300
|
+
function B(e, t, n) {
|
|
301
|
+
return e + (t - e) * n;
|
|
302
|
+
}
|
|
303
|
+
function V(e, t, n, r, i) {
|
|
304
|
+
let a = t / 4 * Math.PI * 2 + (e() - .5) * Math.PI, o = n * (C + e() * w), s = r * (.3 + e() * .7);
|
|
305
|
+
return {
|
|
306
|
+
phase: "orbiting",
|
|
307
|
+
phaseStart: i,
|
|
308
|
+
phaseDuration: 6e3 + e() * 1e4,
|
|
309
|
+
timeOrigin: i,
|
|
310
|
+
angularSpeed: .08 + e() * .16,
|
|
311
|
+
phaseOffset: a,
|
|
312
|
+
baseRadiusX: o * (1 - s),
|
|
313
|
+
baseRadiusY: o * (1 + s),
|
|
314
|
+
wobbleAmp1: T + e() * E,
|
|
315
|
+
wobbleFreq1: .08 + e() * .22,
|
|
316
|
+
wobbleAmp2: D + e() * O,
|
|
317
|
+
wobbleFreq2: .18 + e() * .32,
|
|
318
|
+
pertXAmp: .03 + e() * .05,
|
|
319
|
+
pertXFreq: .06 + e() * .18,
|
|
320
|
+
pertXPhase: e() * Math.PI * 2,
|
|
321
|
+
pertYAmp: .03 + e() * .05,
|
|
322
|
+
pertYFreq: .07 + e() * .17,
|
|
323
|
+
pertYPhase: e() * Math.PI * 2,
|
|
324
|
+
startX: 0,
|
|
325
|
+
startY: 0,
|
|
326
|
+
endX: 0,
|
|
327
|
+
endY: 0
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function H(e, t, n, r) {
|
|
331
|
+
e.phase = t, e.phaseStart = n, e.phaseDuration = r;
|
|
332
|
+
}
|
|
333
|
+
function U(e, t, n, r) {
|
|
334
|
+
let i = (t - e.timeOrigin) / 1e3, a = e.angularSpeed * n * i + e.phaseOffset, o = r * (e.wobbleAmp1 * Math.sin(e.wobbleFreq1 * i) + e.wobbleAmp2 * Math.sin(e.wobbleFreq2 * i + 1.3));
|
|
335
|
+
return {
|
|
336
|
+
x: (e.baseRadiusX + o) * Math.cos(a) + e.pertXAmp * Math.sin(e.pertXFreq * i + e.pertXPhase),
|
|
337
|
+
y: (e.baseRadiusY + o) * Math.sin(a) + e.pertYAmp * Math.cos(e.pertYFreq * i + e.pertYPhase)
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function W(e, t, n, r, i) {
|
|
341
|
+
e.timeOrigin = i, e.angularSpeed = .08 + t() * .16, e.phaseOffset = t() * Math.PI * 2;
|
|
342
|
+
let a = n * (C + t() * w), o = r * (.3 + t() * .7);
|
|
343
|
+
e.baseRadiusX = a * (1 - o), e.baseRadiusY = a * (1 + o), e.wobbleAmp1 = T + t() * E, e.wobbleFreq1 = .08 + t() * .22, e.wobbleAmp2 = D + t() * O, e.wobbleFreq2 = .18 + t() * .32, e.pertXAmp = .03 + t() * .05, e.pertXFreq = .06 + t() * .18, e.pertXPhase = t() * Math.PI * 2, e.pertYAmp = .03 + t() * .05, e.pertYFreq = .07 + t() * .17, e.pertYPhase = t() * Math.PI * 2;
|
|
344
|
+
}
|
|
345
|
+
function G(e, t) {
|
|
346
|
+
let n = o(s(t + "goo")), r = [], i = [], a = [], c = -Infinity, l = e.geometry.orbitRadius;
|
|
347
|
+
function u() {
|
|
348
|
+
let t = e.geometry.orbitRadius;
|
|
349
|
+
if (t !== l && l > 0) {
|
|
350
|
+
let e = t / l;
|
|
351
|
+
for (let t of r) t.baseRadiusX *= e, t.baseRadiusY *= e;
|
|
352
|
+
l = t;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function d(t) {
|
|
356
|
+
let o = e.geometry.satelliteCount;
|
|
357
|
+
for (; r.length < o;) r.push(V(n, r.length, e.geometry.orbitRadius, e.geometry.eccentricity, t)), i.push({
|
|
358
|
+
x: 0,
|
|
359
|
+
y: 0,
|
|
360
|
+
radius: e.geometry.satelliteRadius,
|
|
361
|
+
opacity: 0
|
|
362
|
+
}), a.push({
|
|
363
|
+
x: 0,
|
|
364
|
+
y: 0,
|
|
365
|
+
start: 0
|
|
366
|
+
});
|
|
367
|
+
r.length > o && (r.length = o, i.length = o, a.length = o);
|
|
368
|
+
}
|
|
369
|
+
function f(t, o) {
|
|
370
|
+
d(t), u();
|
|
371
|
+
let s = r.length, l = o.mergeRate, f = e.geometry.satelliteRadius, p = e.satellites.mergeDuration, m = e.satellites.emergeDuration, h = e.satellites.orbitDuration, g = e.satellites.absorbedDuration;
|
|
372
|
+
for (let u = 0; u < s; u++) {
|
|
373
|
+
let s = r[u], d = t - s.phaseStart, _ = z(s.phaseDuration > 0 ? d / s.phaseDuration : 1);
|
|
374
|
+
switch (s.phase) {
|
|
375
|
+
case "orbiting":
|
|
376
|
+
if (_ >= 1) if (t - c < 3e3 * l) s.phaseStart = t, s.phaseDuration = R(n, h[0], h[1]);
|
|
377
|
+
else {
|
|
378
|
+
let e = U(s, t, o.orbitSpeedScale, o.wobbleScale);
|
|
379
|
+
s.startX = e.x, s.startY = e.y;
|
|
380
|
+
let n = Math.hypot(e.x, e.y), r = n > .01 ? .08 / n : 0;
|
|
381
|
+
s.endX = e.x * r, s.endY = e.y * r, H(s, "merging", t, p), c = t;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
case "merging":
|
|
385
|
+
_ >= 1 && H(s, "absorbed", t, R(n, g[0], g[1]));
|
|
386
|
+
break;
|
|
387
|
+
case "absorbed":
|
|
388
|
+
if (_ >= 1) {
|
|
389
|
+
W(s, n, e.geometry.orbitRadius, e.geometry.eccentricity, t);
|
|
390
|
+
let r = U(s, t + 3e3, o.orbitSpeedScale, o.wobbleScale);
|
|
391
|
+
s.endX = r.x, s.endY = r.y;
|
|
392
|
+
let i = Math.hypot(r.x, r.y), a = i > .01 ? .08 / i : 0;
|
|
393
|
+
s.startX = r.x * a, s.startY = r.y * a, H(s, "emerging", t, m);
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
case "emerging":
|
|
397
|
+
if (_ >= 1) {
|
|
398
|
+
let e = a[u];
|
|
399
|
+
e.x = s.endX, e.y = s.endY, e.start = t, s.timeOrigin = t, s.phaseOffset = Math.atan2(s.endY, s.endX), H(s, "orbiting", t, R(n, h[0], h[1]));
|
|
400
|
+
}
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
let v, y, b, x;
|
|
404
|
+
switch (s.phase) {
|
|
405
|
+
case "orbiting": {
|
|
406
|
+
let e = U(s, t, o.orbitSpeedScale, o.wobbleScale), n = a[u], r = t - n.start;
|
|
407
|
+
if (n.start > 0 && r < 2e3) {
|
|
408
|
+
let t = z(r / A), i = t * t * (3 - 2 * t);
|
|
409
|
+
v = B(n.x, e.x, i), y = B(n.y, e.y, i);
|
|
410
|
+
} else v = e.x, y = e.y;
|
|
411
|
+
b = k, x = 1;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
case "merging": {
|
|
415
|
+
let e = N(z((t - s.phaseStart) / s.phaseDuration));
|
|
416
|
+
v = B(s.startX, s.endX, e), y = B(s.startY, s.endY, e);
|
|
417
|
+
let n = z((t - s.phaseStart) / s.phaseDuration);
|
|
418
|
+
b = n > .85 ? B(k, 0, (n - .85) / .15) : k, x = B(1, .65, e);
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
case "absorbed":
|
|
422
|
+
v = 0, y = 0, b = 0, x = .5;
|
|
423
|
+
break;
|
|
424
|
+
case "emerging": {
|
|
425
|
+
let e = P(z((t - s.phaseStart) / s.phaseDuration));
|
|
426
|
+
v = B(s.startX, s.endX, e), y = B(s.startY, s.endY, e);
|
|
427
|
+
let n = z((t - s.phaseStart) / s.phaseDuration);
|
|
428
|
+
b = n < .1 ? B(0, k, n / .1) : k, x = B(.65, 1, e);
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
let S = i[u];
|
|
433
|
+
S.x = v, S.y = y, S.radius = f * x, S.opacity = b;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function p() {
|
|
437
|
+
for (let e of r) e.phaseOffset += (n() - .5) * .6, e.pertXPhase += n() * Math.PI, e.pertYPhase += n() * Math.PI;
|
|
438
|
+
}
|
|
439
|
+
function m(e) {
|
|
440
|
+
n = o(s(e + "goo"));
|
|
441
|
+
}
|
|
442
|
+
function h() {
|
|
443
|
+
for (let e of r) if (e.phase !== "orbiting") return !1;
|
|
444
|
+
return !0;
|
|
445
|
+
}
|
|
446
|
+
function g(e) {
|
|
447
|
+
let t = Infinity;
|
|
448
|
+
for (let e of r) {
|
|
449
|
+
let n = e.phaseStart + e.phaseDuration;
|
|
450
|
+
n < t && (t = n);
|
|
451
|
+
}
|
|
452
|
+
return t === Infinity ? e + 3e4 : t;
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
sources: i,
|
|
456
|
+
tick: f,
|
|
457
|
+
nudge: p,
|
|
458
|
+
reseed: m,
|
|
459
|
+
isQuiescent: h,
|
|
460
|
+
nextEventMs: g
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region src/components/custom/goo-blob/shaders/sdf-body.glsl.ts
|
|
465
|
+
var K = "// --- SDF ---\n\nfloat sdCircle(vec2 p, vec2 center, float radius) {\n return length(p - center) - radius;\n}\n\n// AX.W15 — the VALUE+GRADIENT circle: returns vec3(d, dd/dx, dd/dy). The circle\n// gradient is the UNIT radial direction (p - center)/length(p - center) (the\n// eikonal property holds EXACTLY for a circle), guarded at the degenerate centre.\n// This is the keystone of the analytic-gradient smin: carrying the gradient\n// through the scene field DELETES the per-pixel 4-tap normal (4 full sceneDist\n// evals, each running 3-octave FBM + the sat/trail loops).\nvec3 sdgCircle(vec2 p, vec2 center, float radius) {\n vec2 d = p - center;\n float len = length(d);\n vec2 grad = len > 1e-6 ? d / len : vec2(0.0, 1.0);\n return vec3(len - radius, grad);\n}\n\n// IQ 2024 quadratic-polynomial smin, NORMALIZED so k is a blend band in distance\n// units. The k *= 4.0 pre-scale makes the h*h*k*0.25 poly's effective blend width\n// equal to k (the un-normalized form's width was 0.25*k).\nfloat sminQuadratic(float a, float b, float k) {\n k *= 4.0;\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - h * h * k * 0.25;\n}\n\n// IQ circular smin — a quarter-circle fillet at the seam (rounder than the\n// quadratic). The k *= 1.0/(1.0-sqrt(0.5)) factor normalizes k to the same\n// blend-band units so the merge axis swaps shape without re-tuning uSmoothK.\nfloat sminCircular(float a, float b, float k) {\n k *= 1.0 / (1.0 - sqrt(0.5));\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - k * 0.5 * (1.0 + h - sqrt(1.0 - h * (h - 2.0)));\n}\n\n// Config-gated merge dispatch — uMerge 0 = quadratic, 1 = circular.\nfloat smin(float a, float b, float k) {\n if (uMerge > 0.5) return sminCircular(a, b, k);\n return sminQuadratic(a, b, k);\n}\n\n// AX.W15 — the VALUE+GRADIENT smin. a/b are vec3(dist, grad.xy); the blended\n// gradient is mix(a.yz, b.yz, w) with the interpolation weight w the distance\n// blend uses (IQ's vec2-smin insight). This propagates the analytic gradient\n// through the merge so the surface normal reads the field gradient DIRECTLY — no\n// finite-difference tap. The blend weight matches each variant.\nvec3 sminQuadraticG(vec3 a, vec3 b, float k) {\n k *= 4.0;\n float h = max(k - abs(a.x - b.x), 0.0) / k;\n float m = h * h * k * 0.25;\n // h-weight that selects which surface dominates (0 → a, 1 → b).\n float w = (a.x < b.x) ? 0.5 * h * h : 1.0 - 0.5 * h * h;\n float dist = min(a.x, b.x) - m;\n vec2 grad = mix(a.yz, b.yz, w);\n return vec3(dist, grad);\n}\n\nvec3 sminCircularG(vec3 a, vec3 b, float k) {\n k *= 1.0 / (1.0 - sqrt(0.5));\n float h = max(k - abs(a.x - b.x), 0.0) / k;\n float m = k * 0.5 * (1.0 + h - sqrt(1.0 - h * (h - 2.0)));\n float w = (a.x < b.x) ? 0.5 * h : 1.0 - 0.5 * h;\n float dist = min(a.x, b.x) - m;\n vec2 grad = mix(a.yz, b.yz, w);\n return vec3(dist, grad);\n}\n\nvec3 sminG(vec3 a, vec3 b, float k) {\n if (uMerge > 0.5) return sminCircularG(a, b, k);\n return sminQuadraticG(a, b, k);\n}", q = "// --- Noise ---\n\nfloat hash21(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// IQ analytic-derivative gradient noise — value in .x, ANALYTIC gradient\n// (d/dx, d/dy) in .yz, from one eval. The quintic fade has a continuous 2nd\n// derivative so the gradient is smooth (a cubic smoothstep fade would crease it).\n// (Inigo Quilez, https://iquilezles.org/articles/gradientnoise/.)\nvec3 noised(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n\n // Quintic fade + its derivative.\n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n vec2 du = 30.0 * f * f * (f * (f - 2.0) + 1.0);\n\n // Per-corner gradient vectors from the hash (centred to [-1, 1]).\n vec2 ga = -1.0 + 2.0 * vec2(hash21(i + vec2(0.0, 0.0)), hash21(i + vec2(7.3, 0.0)));\n vec2 gb = -1.0 + 2.0 * vec2(hash21(i + vec2(1.0, 0.0)), hash21(i + vec2(8.3, 0.0)));\n vec2 gc = -1.0 + 2.0 * vec2(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(7.3, 1.0)));\n vec2 gd = -1.0 + 2.0 * vec2(hash21(i + vec2(1.0, 1.0)), hash21(i + vec2(8.3, 1.0)));\n\n float va = dot(ga, f - vec2(0.0, 0.0));\n float vb = dot(gb, f - vec2(1.0, 0.0));\n float vc = dot(gc, f - vec2(0.0, 1.0));\n float vd = dot(gd, f - vec2(1.0, 1.0));\n\n // Value, remapped to [0,1] so it drops in for the prior valueNoise.\n float n = va + u.x * (vb - va) + u.y * (vc - va) + u.x * u.y * (va - vb - vc + vd);\n float value = 0.5 + 0.5 * n;\n\n // Analytic gradient (chain rule through the bilinear blend + the fade).\n vec2 grad =\n ga + u.x * (gb - ga) + u.y * (gc - ga) + u.x * u.y * (ga - gb - gc + gd) +\n du * (vec2(u.y, u.x) * (va - vb - vc + vd) + vec2(vb, vc) - va);\n return vec3(value, 0.5 * grad);\n}\n\n// Rotated-octave FBM over the analytic gradient noise: a fixed ~0.5 rad 2x2\n// rotation between octaves breaks the axis-aligned banding. The rotation CONSTANT\n// is spliced from the shared chunk (AV.W2 — the one FBM_ROT); the loops below\n// stay blob-local (param octaves + the LIQUID lacunarity/persistence, per §3a).", J = 1.8, Y = .42, X = `float fbm(vec2 p, int octaves) {
|
|
466
|
+
float value = 0.0;
|
|
467
|
+
float amp = 0.5;
|
|
468
|
+
float freq = 1.0;
|
|
469
|
+
for (int i = 0; i < 4; i++) {
|
|
470
|
+
if (i >= octaves) break;
|
|
471
|
+
value += amp * noised(p * freq).x;
|
|
472
|
+
p = FBM_ROT * p;
|
|
473
|
+
freq *= ${J.toFixed(1)};
|
|
474
|
+
amp *= ${Y.toFixed(2)};
|
|
475
|
+
}
|
|
476
|
+
return value;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// AX.W15 — FBM with ANALYTIC GRADIENT. Returns vec3(value, ∂/∂x, ∂/∂y). The
|
|
480
|
+
// gradient accumulates noised()'s analytic gradient per octave, chain-ruled
|
|
481
|
+
// through the per-octave frequency scale AND the FBM_ROT rotation: octave i samples
|
|
482
|
+
// at R^i · (freq·p), so the gradient w.r.t. the ORIGINAL p picks up freq and
|
|
483
|
+
// the accumulated rotation transpose (R^T)^i. The keystone feed for the
|
|
484
|
+
// analytic surface normal — it DELETES the per-pixel 4-tap finite difference.
|
|
485
|
+
vec3 fbmG(vec2 p, int octaves) {
|
|
486
|
+
float value = 0.0;
|
|
487
|
+
vec2 grad = vec2(0.0);
|
|
488
|
+
float amp = 0.5;
|
|
489
|
+
float freq = 1.0;
|
|
490
|
+
// The accumulated octave rotation R^i — its transpose maps the i-th octave's
|
|
491
|
+
// local gradient back into the ORIGINAL p frame. Seeded at identity (octave 0).
|
|
492
|
+
mat2 rotAccum = mat2(1.0, 0.0, 0.0, 1.0);
|
|
493
|
+
vec2 pp = p;
|
|
494
|
+
for (int i = 0; i < 4; i++) {
|
|
495
|
+
if (i >= octaves) break;
|
|
496
|
+
vec3 n = noised(pp * freq);
|
|
497
|
+
value += amp * n.x;
|
|
498
|
+
// d(value)/dp = amp · freq · (R^i)^T · noised.yz (the rotated chain rule).
|
|
499
|
+
grad += amp * freq * (transpose(rotAccum) * n.yz);
|
|
500
|
+
pp = FBM_ROT * pp;
|
|
501
|
+
freq *= ${J.toFixed(1)};
|
|
502
|
+
amp *= ${Y.toFixed(2)};
|
|
503
|
+
rotAccum = FBM_ROT * rotAccum;
|
|
504
|
+
}
|
|
505
|
+
return vec3(value, grad);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// One domain-warp pass with the ANALYTIC GRADIENT carried (warp-Jacobian
|
|
509
|
+
// APPROXIMATION per the SOTA deepening [2]: the warp is low-frequency, so the
|
|
510
|
+
// gradient of the OUTER fbm dominates and the warp-offset Jacobian is dropped —
|
|
511
|
+
// the error is sub-perceptible and full autodiff is overfit for one blob).
|
|
512
|
+
vec3 fbmWarpedG(vec2 p, int octaves, float warpAmp) {
|
|
513
|
+
if (warpAmp <= 0.0) return fbmG(p, octaves);
|
|
514
|
+
vec2 q = vec2(fbm(p + vec2(0.0, 0.0), octaves), fbm(p + vec2(5.2, 1.3), octaves));
|
|
515
|
+
return fbmG(p + warpAmp * (q - 0.5), octaves);
|
|
516
|
+
}
|
|
517
|
+
`, ee = "// Edit #4's gamut step — hue-preserving inward chroma clamp. If the linear result\n// is out of [0,1], bisect chroma toward 0 (L + h fixed) until in gamut. Preserves\n// hue exactly (only C shrinks). 16 steps resolve C to < 2^-16 of its span.\nbool inGamut(vec3 lin) {\n return all(greaterThanEqual(lin, vec3(0.0))) && all(lessThanEqual(lin, vec3(1.0)));\n}\nvec3 gamutClampOklch(vec3 lch) {\n vec3 lin = oklabToLinearSrgb(oklchToOklab(lch));\n if (inGamut(lin)) return lch;\n float lo = 0.0;\n float hi = lch.y;\n for (int i = 0; i < 16; i++) {\n float mid = 0.5 * (lo + hi);\n vec3 test = vec3(lch.x, mid, lch.z);\n if (inGamut(oklabToLinearSrgb(oklchToOklab(test)))) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return vec3(lch.x, lo, lch.z);\n}", te = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\nuniform vec3 uBaseColor;\n\n// Multi-stop palette (W11.b) — 2-4 in-family OKLCh stops (uploaded GAMMA sRGB, like\n// uBaseColor). uStopCount <= 1 falls back to uBaseColor (the single-color default,\n// zero regression). MAX_BLOB_STOPS is a compile-time #define.\n#define MAX_BLOB_STOPS 4\nuniform int uStopCount;\nuniform vec3 uPalette[MAX_BLOB_STOPS];\n\n// Pointer\nuniform vec2 uPointer;\nuniform float uPointerActive;\nuniform float uPointerAttraction;\nuniform float uPointerStrength;\n\n// Main body\nuniform float uBodyRadius;\n\n// Pulsation\nuniform float uPulsePhase;\nuniform float uPulseAmp;\n\n// Surface noise\nuniform float uNoiseAmp;\nuniform float uNoiseFreq;\nuniform float uNoiseSpeed;\n\n// Gooey\nuniform float uSmoothK;\nuniform float uMerge; // 0 = quadratic smin, 1 = circular smin (rounder menisci)\n\n// BC.W-GOOBLOB-PLAIN — the STAGE-1 gate. 1.0 = the plain shadowless lightless\n// fill-only floor (variant=\"blob\"); 0.0 = the full lit pipeline (variant=\"meatball\" /\n// STAGE 2). The WebGL2 fallback transcribes the SAME stripped branch the WGSL primary\n// gates (research/viz/goo-blob.md §5 — the GLSL twin).\nuniform float uStage;\n\n// AX.W16 (arm 5) — the PRE-FBM bounding-discard radius (UV space). main() early-outs\n// to a transparent write for any fragment OUTSIDE this radius BEFORE the two 3-octave\n// FBM calls + the OKLCh round-trip. The renderer uploads it PADDED by every\n// outward-expanding term (body + eccentric orbit + sat radius + smin band + FBM edge\n// amplitude + click-pulse + a lean/squash safety pad) so it NEVER clips the wet\n// meniscus (IQ: inflate the bound to match any outward op).\nuniform float uMaxReach;\n\n// Membrane — domain-warp strength on the FBM edge displacement (0 = plain fbm).\nuniform float uWarpAmp;\n\n// Lit glass surface (W9.b) — gated behind uLit so the flat fill stays default.\nuniform float uLit; // 0 = flat fill (default), 1 = lit droplet\nuniform vec3 uRimColor; // Fresnel rim tint (GAMMA sRGB, via the /color leaf)\nuniform vec3 uLightDir; // normalized light direction (x, y, z)\nuniform float uSpecStrength; // Blinn-Phong specular weight\nuniform float uSpecShininess; // specular exponent (16-64, tight glint)\nuniform float uRimPower; // Fresnel/Schlick exponent (~2-3)\nuniform float uRimStrength; // Fresnel rim weight\n\n// BC.W-GOOBLOB-MEATBALL — the procedural 2D SDF soft-shadow march (T2, the GLSL twin of\n// the WGSL res.z/res.w lanes). uShadow gates the IQ rmshadows soft contact shadow that\n// FOLLOWS the irregular silhouette; uShadowSoftness is the penumbra hardness (4-48).\nuniform float uShadow; // 0 = no shadow, 1 = the soft contact shadow ON\nuniform float uShadowSoftness; // penumbra hardness (inverse light-source size, 4-48)\n\n// Iridescence + fake subsurface (W11.a) — translucent-gel read.\nuniform float uIridescence; // warm-pearl rim sheen weight (0 = off)\nuniform float uIridHue; // base hue (radians) the cosine palette biases toward (warm)\nuniform float uIridSpeed; // animated-thickness scroll for the iridescent t\nuniform float uSssScale; // fast-SSS back-light weight\nuniform float uSssPower; // fast-SSS exponent\nuniform float uCoreGlow; // thickness-driven inner-luminosity lift\n\n// Color perturbation (perceptually uniform — OKLCh L/C/h)\nuniform float uHueRange; // degrees of hue swing (converted to radians)\nuniform float uSatShift; // OKLCh chroma swing\nuniform float uBrightnessShift; // OKLCh lightness bias\nuniform float uColorNoiseFreq;\nuniform float uColorNoiseSpeed;\n\n// Satellites (max 4)\n#define MAX_SATS 4\nuniform int uSatCount;\nuniform vec2 uSatPos[MAX_SATS];\nuniform float uSatRadius[MAX_SATS];\nuniform float uSatOpacity[MAX_SATS];\n\n// Pointer trail (W10) — a decaying-radius pseudopod toward the cursor. uTrail is a\n// COMPILE-TIME-SIZED array (GLSL ES 3.00 forbids a uniform-sized array) with a\n// DYNAMIC break on uTrailCount, mirroring the satellite loop. Later samples paint\n// smaller metaballs (r *= 1 - i/N) so the trail tapers into a tail.\n#define TRAIL_N 15\nuniform int uTrailCount;\nuniform vec2 uTrailPos[TRAIL_N];\nuniform float uTrailRadius[TRAIL_N];\n\n// Velocity-driven volume-preserving squash-and-stretch (W10).\nuniform vec2 uVelocity; // smoothed pointer velocity (motion direction + speed)\nuniform float uStretch; // squash-stretch magnitude (0 = off)\n\nconst float PI = 3.141592653589793;\n", Z = "\n", ne = te + Z + q + Z + `${e}
|
|
518
|
+
|
|
519
|
+
` + X + Z + K + Z + `
|
|
520
|
+
// --- Color (Ottosson OKLab/OKLCh — value.js EXACT constants, transposed) ---
|
|
521
|
+
//
|
|
522
|
+
// The OETF (srgbToLinear/linearToSrgb) + the four Ottosson matrices + their space
|
|
523
|
+
// conversions are SPLICED from the shared chunk (AV.W2 —
|
|
524
|
+
// src/composables/glass/webgl/shaders/procedural-color.glsl.ts). They live there
|
|
525
|
+
// ONCE so the OETF can never diverge from aurora's; the line-for-line TS port
|
|
526
|
+
// (__tests__/metaball-color.glsl-port.ts) mirrors that chunk. The gamut-clamp
|
|
527
|
+
// below stays blob-local (aurora has no in-shader OKLCh path).
|
|
528
|
+
${n}
|
|
529
|
+
${i}
|
|
530
|
+
|
|
531
|
+
` + ee + Z + "\n// AX.W15 — de-synced breath. The body throb was a single sin(uPulsePhase) — a\n// mechanical pulse that re-syncs every cycle. Three DETUNED sines at IRRATIONAL\n// frequency ratios (1, 0.13/0.09 ≈ 1.444, 0.31) never re-phase, so the membrane\n// breathes like a living creature (an asymmetric slower-exhale calm band) rather\n// than a metronome. Normalized so the composite stays in ~[-1, 1].\nfloat breath(float phase) {\n return (sin(phase)\n + 0.5 * sin(phase * 1.4444 + 1.7)\n + 0.28 * sin(phase * 0.31 + 4.1)) / 1.78;\n}\n\n// AX.W15 — the composite SDF field WITH its ANALYTIC GRADIENT, returned as\n// vec3(dist, ∂d/∂x, ∂d/∂y). The domain-warped body membrane smin-merged with the\n// satellites + trail; the gradient propagates through sminG's mix(a.yz, b.yz, h)\n// so the surface normal reads the field gradient DIRECTLY (the 4-tap finite\n// difference is DELETED — its 4 full evals per lit pixel are gone).\n//\n// The ANISOTROPIC SQUASH (W10 volume-preserving stretch) is a linear map\n// bodyUv = D·R·uv (R rotates world→(motion-axis, perp); D = diag(1/sa, sa)). The\n// body field's gradient is computed in bodyUv space, so it MUST be transformed back\n// to uv space by M^T = R^T·D (the inverse-transpose handling the SOTA-deepening [2]\n// warns the 4-tap did implicitly by sampling in screen space).\nvec3 sceneDistG(vec2 uv) {\n // De-synced pulsing body radius.\n float bodyR = uBodyRadius + breath(uPulsePhase) * uPulseAmp;\n\n // Velocity-driven VOLUME-PRESERVING squash-and-stretch (W10), SATURATED (AX.W46\n // D5). sa is the stretch along motion, EXACTLY 1/sa perpendicular (area-preserving).\n // The basis (ax, perp) is captured so the gradient can be transformed back below.\n //\n // The W10 form sa = 1 + speed*uStretch rode an UNBOUNDED critically-damped spring\n // velocity (O(5-8)/s on a fast flick) -> sa ~ 1.78-2.25x elongation, a violent\n // taffy-pull. A tanh saturation sa = 1 + tanh(speed*k)*uStretch caps the elongation\n // at 1 + uStretch (~1.5x at the default stretch 0.5) no matter how fast the flick —\n // the fastest flick reads as a lively bounce, never a rubber-band snap (the standard\n // volume-preserving squash-and-stretch restraint). k = 1.6 keeps the tanh in its\n // near-linear regime for a slow drag (the gentle squash still reads) and saturates\n // only the fast flick.\n vec2 bodyUv = uv;\n vec2 ax = vec2(1.0, 0.0);\n vec2 perp = vec2(0.0, 1.0);\n float sa = 1.0;\n float speed = length(uVelocity);\n bool squashed = uStretch > 0.0 && speed > 1e-4;\n if (squashed) {\n ax = uVelocity / speed;\n perp = vec2(-ax.y, ax.x);\n sa = 1.0 + tanh(speed * 1.6) * uStretch;\n bodyUv = vec2(dot(uv, ax) / sa, dot(uv, perp) * sa);\n }\n\n // Domain-warped FBM displacement WITH its analytic gradient (the warp-Jacobian\n // approximation per [2]). disp = (noiseVal - 0.5) · uNoiseAmp; its gradient in\n // bodyUv space is uNoiseAmp · uNoiseFreq · fbmGrad (the uNoiseFreq chain factor\n // from the bodyUv·uNoiseFreq argument).\n vec3 fbmv = fbmWarpedG(bodyUv * uNoiseFreq + uTime * uNoiseSpeed, 3, uWarpAmp);\n float bodyDisplacement = (fbmv.x - 0.5) * uNoiseAmp;\n vec2 dispGradBody = uNoiseAmp * uNoiseFreq * fbmv.yz;\n\n // Body circle WITH gradient (in bodyUv space). The displaced radius subtracts\n // the displacement, so the body gradient is circleGrad - dispGrad (sign per\n // [2]: d = circleDist - displacement ⇒ grad = circleGrad - dispGrad).\n vec3 bodyG = sdgCircle(bodyUv, vec2(0.0), bodyR + bodyDisplacement);\n vec2 bodyGradBody = bodyG.yz - dispGradBody;\n\n // Transform the body gradient back to uv space: g_uv = R^T · D · g_body, i.e.\n // scale by D = diag(1/sa, sa) in the (ax, perp) frame then reconstruct in world.\n vec2 bodyGradUv;\n if (squashed) {\n vec2 scaled = vec2(bodyGradBody.x / sa, bodyGradBody.y * sa);\n bodyGradUv = scaled.x * ax + scaled.y * perp;\n } else {\n bodyGradUv = bodyGradBody;\n }\n vec3 d = vec3(bodyG.x, bodyGradUv);\n\n // Satellites — smin-merged into the body (uMerge selects quadratic/circular).\n for (int i = 0; i < MAX_SATS; i++) {\n if (i >= uSatCount) break;\n vec3 satG = sdgCircle(uv, uSatPos[i], uSatRadius[i]);\n satG.x += (1.0 - uSatOpacity[i]) * 0.3;\n d = sminG(d, satG, uSmoothK);\n }\n\n // Pointer trail — a decaying-radius pseudopod reaching toward the cursor,\n // smin-merged so it stretches an elastic limb and snaps back.\n for (int i = 0; i < TRAIL_N; i++) {\n if (i >= uTrailCount) break;\n vec3 trailG = sdgCircle(uv, uTrailPos[i], uTrailRadius[i]);\n d = sminG(d, trailG, uSmoothK);\n }\n return d;\n}\n\n// AX.W15 — the analytic surface normal. The field gradient grad2d arrives\n// DIRECTLY from sceneDistG (no 4-tap). The smin field is sub-unit (the CD family\n// |grad| ≤ 1) so the gradient is NOT unit-length — normalize() before the dome\n// lift (the unit contract is on the FINAL lifted normal N, not the raw field\n// gradient). The Z dome: 'interior' is the normalized depth inward from the rim\n// (-d/bodyR); z = sqrt(1 - (1 - interior)^2) is the unit half-sphere profile (flat\n// centre, steep rim). N tilts outward along the field gradient near the rim and\n// points at the viewer deep inside.\nvec3 surfaceNormalFromGrad(vec2 grad2d, float d, float bodyR) {\n vec2 g = normalize(grad2d + vec2(1e-6));\n float interior = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0);\n float z = sqrt(max(0.0, 1.0 - (1.0 - interior) * (1.0 - interior)));\n return normalize(vec3(g * (1.0 - z), z) + vec3(0.0, 0.0, 1e-6));\n}\n\n// BC.W-GOOBLOB-MEATBALL — the 2D SDF soft-shadow march (IQ rmshadows improved-penumbra,\n// research/viz/goo-blob.md §2.3, §5). The GLSL twin of the WGSL softShadow2D — a procedural\n// soft contact shadow FOLLOWING the irregular metaball silhouette (NOT a hard disc/box\n// shadow). Marches from ro along rd (the in-plane projection of uLightDir),\n// accumulating the closest miss via the Aaltonen penumbra (y = h*h/(2*ph) + d =\n// sqrt(h*h - y*y)) that kills the banding the naive res = min(res, h/(w*t)) shows. CHEAP:\n// 24 steps, re-uses the SAME sceneDistG().x field (NO separate field re-eval, NO FBO/\n// multi-pass — the procedural field needs none). w is the penumbra hardness (inverse\n// light-source size -> uShadowSoftness). Derivative-FREE. Returns 1.0 (lit) -> 0.0 (occluded).\nfloat softShadow2D(vec2 ro, vec2 rd, float mint, float maxt, float w) {\n float res = 1.0;\n float ph = 1e20;\n float t = mint;\n for (int i = 0; i < 24; i++) {\n if (t >= maxt) break;\n float h = sceneDistG(ro + rd * t).x;\n if (h < 0.001) return 0.0;\n float y = h * h / (2.0 * ph);\n float dd = sqrt(max(h * h - y * y, 0.0));\n res = min(res, dd / (w * max(0.001, t - y)));\n ph = h;\n t += h;\n }\n return clamp(res, 0.0, 1.0);\n}\n\n// W11.b — sample the multi-stop palette at t in [0,1], interpolating adjacent\n// stops in OKLab with a MIDPOINT CHROMA-BUMP (a linear OKLab mix of a vivid pair\n// dips chroma through grey; the bump lifts it back). Falls back to uBaseColor when\n// uStopCount <= 1. Returns an OKLCh stop [L, C, h(rad)].\nvec3 samplePaletteOklch(float t) {\n if (uStopCount <= 1) return oklabToOklch(srgbToOklab(uBaseColor));\n float n = float(uStopCount);\n float ft = clamp(t, 0.0, 1.0) * (n - 1.0);\n int i0 = int(floor(ft));\n int i1 = min(i0 + 1, uStopCount - 1);\n float f = ft - float(i0);\n // Fetch adjacent stops (uPalette is gamma sRGB) → OKLab.\n vec3 labA = srgbToOklab(uPalette[i0]);\n vec3 labB = srgbToOklab(uPalette[i1]);\n vec3 lab = mix(labA, labB, f);\n vec3 lch = oklabToOklch(lab);\n // Midpoint chroma-bump: a bell (peaks at f=0.5) lifts C off the grey midpoint.\n lch.y += 0.03 * sin(PI * f);\n return lch;\n}\n\nvoid main() {\n vec2 uv = vUv - 0.5;\n\n // AX.W16 (arm 5) — PRE-FBM bounding early-out. The oversized canvas (1.6x the\n // wrapper) runs the full fragment ALU — two 3-octave FBM evals + the OKLCh\n // round-trip + the lit/iridescence/SSS block — on a large transparent border\n // otherwise (~60% of the canvas is outside the droplet reach). Any fragment beyond\n // uMaxReach (the PADDED worst-case painted reach, uploaded so it never clips the\n // wet meniscus) writes transparent and returns BEFORE any of that work. This is a\n // transparent WRITE, NOT a GLSL discard: the pass is a pure premultiplied blend\n // with no depth, and discard disables the tiled-renderer fast path on mobile GPUs.\n // No fwidth is computed before the return, so there is no\n // derivative-in-non-uniform-control-flow hazard (the kept pixels compute their own\n // fwidth normally below). The pad covers the pointer-lean uv shift, so testing the\n // pre-deform uv is safe.\n if (dot(uv, uv) > uMaxReach * uMaxReach) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Pointer deformation — honor the SIGN of uPointerAttraction (W10): a positive\n // attraction leans the body IN toward the cursor, a negative shies it AWAY. The\n // signed influence flows straight into the UV shift (no hardcoded repulsion).\n //\n // AY.W-BLOB-CONFIG D2 — the SIGN was INVERTED in the rendered result. The\n // sample-shift sign here was uv -= dir*influence; the live readback (an attraction\n // sweep over a HELD pointer) measured the body shifting MORE toward the cursor as\n // attraction went MORE NEGATIVE (a=-1 -> +0.081, a=0 -> +0.063, a=+1 -> +0.042) —\n // exactly inverted: a shy-away -1 LUNGED at the cursor, a lean-in +1 pulled back.\n // pointerDir = uPointer - uv is the toward-pointer direction in SAMPLE space; to\n // MOVE the rendered body TOWARD the pointer the sample must shift ALONG pointerDir\n // (sample the field from where the pointer is), so the sign is uv += dir*influence.\n // A positive attraction now shifts the body toward the cursor (leans in), a negative\n // shifts it away (shies) — the sign the comment + the demo slider always promised,\n // now true in the render.\n //\n // AX.W46 D5 — the falloff radius NARROWS 0.65 → 0.5 (the calm-lean reconciliation).\n // The W15 REDRESS widened it to 0.65 to clear a synthetic floor; the live π-lane\n // read the result as a LUNGE. The drama lives in the STRENGTH (pointerStrength,\n // dropped to 0.18 in types.ts), NOT the falloff — the falloff's job is purely to keep\n // the lean COHERENT across the creature so the body, satellites and trail all tilt\n // toward the cursor as ONE. At 0.5 the body (sitting ≈0.2 uv from the cursor on a\n // hover-flick) is still well inside the cutoff, so the whole creature tilts as one —\n // a gentle, coherent \"it notices you\" lean rather than the body lunging a body-width.\n if (uPointerActive > 0.5) {\n vec2 pointerDir = uPointer - uv;\n float pointerDist = length(pointerDir);\n float influence = smoothstep(0.5, 0.0, pointerDist) * uPointerAttraction * uPointerStrength;\n uv += normalize(pointerDir + 1e-6) * influence;\n }\n\n // The de-synced pulsing body radius — also reused below for the inner-glow scale.\n float bodyR = uBodyRadius + breath(uPulsePhase) * uPulseAmp;\n\n // Composite domain-warped membrane field WITH its analytic gradient (AX.W15).\n vec3 scene = sceneDistG(uv);\n float d = scene.x;\n vec2 fieldGrad = scene.yz;\n\n // Edit #1 — fwidth-based anti-aliased edge: derive the smoothstep half-width\n // from the SDF screen-space gradient so the edge stays ~1px regardless of zoom.\n float aa = max(fwidth(d), 1e-6);\n float alpha = 1.0 - smoothstep(-aa, aa, d);\n\n if (alpha < 0.001) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Edit #4 — perceptually-uniform OKLCh variation. Gamma base → linear → OKLab\n // → OKLCh; perturb L/C/h; OKLCh → OKLab → linear; hue-preserving gamut clamp.\n // The base is the multi-stop palette sample (W11.b) — distributed across the\n // body/satellites by the color noise field — or uBaseColor when single-stop.\n float colorNoise = fbm(uv * uColorNoiseFreq + uTime * uColorNoiseSpeed, 3);\n vec3 oklch = samplePaletteOklch(colorNoise);\n\n oklch.z += (colorNoise - 0.5) * uHueRange * (PI / 180.0); // hue swing, radians\n oklch.y = max(oklch.y + (colorNoise - 0.5) * uSatShift, 0.0); // chroma swing\n oklch.x = clamp(oklch.x + uBrightnessShift, 0.0, 1.0); // lightness bias\n\n // ── BC.W-GOOBLOB-PLAIN — the STAGE-1 stripped floor (variant=blob). ──\n // The minimal verifiable floor: SDF + smin (the meatball field, already in\n // d/alpha above) + fwidth-AA (the crisp alpha) + warm-cream fill. NO surface\n // normal, NO Fresnel, NO lit glint, NO iridescence, NO fake-SSS, NO shadow —\n // deliberately FLAT. It returns BEFORE the STAGE-2 dressing, the GLSL twin of\n // the WGSL primary's uStage > 0.5 branch. The teaching contrast: the \"it\n // renders, it meatballs\" floor STAGE 2 layers the lit/shadow onto via the SAME\n // uStage/uLit uniforms.\n if (uStage > 0.5) {\n oklch = gamutClampOklch(oklch);\n vec3 lin1 = oklabToLinearSrgb(oklchToOklab(oklch));\n vec3 rgb1 = clamp(linearToSrgb(lin1), 0.0, 1.0);\n float ign1 = fract(52.9829189 * fract(dot(gl_FragCoord.xy, vec2(0.06711056, 0.00583715))));\n rgb1 = clamp(rgb1 + (ign1 - 0.5) / 255.0, 0.0, 1.0);\n fragColor = vec4(rgb1 * alpha, alpha);\n return;\n }\n\n // Surface normal — from the ANALYTIC field gradient (AX.W15: the 4-tap is\n // deleted). Computed ONCE here and reused by the iridescence (W11.a), the\n // fake-SSS (W11.a), and the lit glass block (W9.b).\n vec3 N = surfaceNormalFromGrad(fieldGrad, d, bodyR);\n vec3 V = vec3(0.0, 0.0, 1.0);\n float thickness = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0); // 0 at rim, ~1 deep in\n float fres = pow(1.0 - max(dot(N, V), 0.0), 2.5); // rim-weighted angle\n\n // ── W11.a iridescence — warm-biased IQ cosine palette driving OKLCh HUE ──\n //\n // A thin-film-like sheen on the RIM (fres-weighted), NOT the cold-blue default:\n // an IQ cosine palette (a + b*cos(2pi(c*t + d))) maps the Fresnel/edge angle +\n // the FBM color field + an animated thickness onto a HUE OFFSET biased to the\n // warm arc (uIridHue), with the chroma clamped to a warm-pearl band so the rim\n // reads cream/gold (congruent with the warm-cream-glass identity). Mixed into\n // OKLCh BEFORE the gamut clamp. Default LOW.\n if (uIridescence > 0.0) {\n float t = fres + 0.3 * colorNoise + uTime * uIridSpeed;\n // Cosine palette in HUE space, centred on the warm uIridHue (~0.18 turn of\n // warm sweep so the sheen shimmers gold→peach, never swinging to cold blue).\n float iridHue = uIridHue + 0.18 * PI * cos(2.0 * PI * t);\n float w = fres * uIridescence; // rim-weighted blend\n oklch.z = mix(oklch.z, iridHue, w);\n // Warm-pearl chroma cap: lift chroma toward a pale-pearl band, clamped.\n oklch.y = min(oklch.y + 0.04 * w, oklch.y + 0.08);\n oklch.x = min(oklch.x + 0.05 * w, 1.0); // a touch brighter at the sheen\n }\n\n // ── W11.a fake subsurface translucency — thickness inner-glow + back-light ──\n //\n // A bright translucent CORE fading to a light-leaking EDGE (the -d ramp) plus\n // the fast-SSS back-light (light wrapping through the thin rim). Both lift OKLCh\n // L and warm the hue, consuming the W9 normal. In OKLCh before the gamut clamp.\n if (uCoreGlow > 0.0 || uSssScale > 0.0) {\n // Beer-Lambert inner luminosity (AX.W15): a SATURATING 1 - exp(-k·thickness)\n // curve — a flat thick core with a fast warm rim falloff — NOT the linear\n // coreGlow·thickness ramp (which over-brightens deep interiors). k ≈ 3 reads\n // as glass depth.\n oklch.x = min(oklch.x + uCoreGlow * (1.0 - exp(-3.0 * thickness)), 1.0);\n // Fast-SSS back-light: light wrapping through the thin (low-thickness) rim.\n vec3 L = normalize(uLightDir + vec3(1e-6));\n float back = pow(clamp(dot(V, -(L + N * thickness)), 0.0, 1.0), uSssPower);\n float sss = back * uSssScale * (1.0 - thickness);\n oklch.x = min(oklch.x + sss, 1.0);\n // Warm the THIN leaking rim only (scale by 1 - thickness): the SSS hue-warm\n // shift rides the rim, not the core (AX.W15 — only the thin rim warms).\n oklch.z += sss * 0.1 * (1.0 - thickness);\n }\n\n // ── BC.W-GOOBLOB-MEATBALL — the soft contact shadow (T2, the GLSL twin). A procedural\n // soft shadow FOLLOWING the irregular silhouette: march from this fragment's uv\n // toward the in-plane projection of uLightDir; where the metaball field occludes the\n // light, DARKEN the OKLCh L — a soft grounded contact band under the dome\n // (PROCEDURAL, silhouette-following, unlike the static CSS gel-dome drop-shadow).\n // Rim-weighted (1 - thickness) so the lit interior stays bright. Gated uShadow > 0.5;\n // variant=blob (STAGE 1) ships shadowless via the uStage early-return above. ──\n if (uShadow > 0.5) {\n vec2 L2 = normalize(uLightDir.xy + vec2(1e-6));\n float sh = softShadow2D(uv, L2, max(aa, 0.004), bodyR * 1.5, max(uShadowSoftness, 4.0));\n // The contact band sits on the LOWER rim (the side AWAY from the light), gated by\n // the away-facing rim weight + a thin-rim Gaussian band (peak thickness ≈ 0.18) so\n // the deep-lit interior + the light-facing edge stay BRIGHT (the warm-cream body\n // mean + the proof:blob-warm-default floor hold). The 0.20 cap is a soft grounding.\n float away = clamp(-dot(normalize(fieldGrad + vec2(1e-6)), L2), 0.0, 1.0);\n float band = exp(-pow((thickness - 0.18) / 0.16, 2.0));\n float shadowDarken = (1.0 - sh) * away * band * 0.20;\n oklch.x = max(oklch.x - shadowDarken, 0.0);\n }\n\n oklch = gamutClampOklch(oklch);\n\n vec3 lin = oklabToLinearSrgb(oklchToOklab(oklch));\n\n // ── W9.b lit glass surface — Blinn-Phong glint + Fresnel rim, in LINEAR ──\n //\n // The lit terms enter lin in LINEAR space BEFORE the OETF (linearToSrgb)\n // and BEFORE the * alpha premultiply — a post-OETF apply double-gammas the\n // highlight and fringes the premultiplied edge (the named A5/A2 trap). The\n // prior flat inner-glow lift is SUBSUMED by the Fresnel rim (the curvature\n // read now comes from the surface normal, not a flat smoothstep). Gated behind\n // uLit so the flat fill stays the default (zero regression).\n if (uLit > 0.5) {\n // N, V, thickness are already computed in main() (reused by iridescence/SSS).\n vec3 L = normalize(uLightDir + vec3(1e-6)); // light direction\n vec3 H = normalize(L + V); // Blinn-Phong half-vector\n\n // Warm-cream specular glint — a near-white OKLCh TINT (L~0.97, C~0.03,\n // hue~85°) routed through the SAME spliced OKLCh matrices, NOT hardcoded\n // sRGB white (pure white reads cheap-CG). Linearized for the linear add.\n vec3 warmCream = oklabToLinearSrgb(oklchToOklab(vec3(0.97, 0.03, radians(85.0))));\n\n // ENERGY-CONSERVING Blinn-Phong (AX.W15 [9]): the (shininess+2)/8 factor\n // DECOUPLES shininess from strength (without it, raising shininess dims the\n // glint, so the two knobs fight). SPECULAR ANTIALIASING: the FBM membrane\n // makes the normal vary fast, so a tight glint (16-64) STROBES on small\n // dock-grid blobs. Widen the effective lobe where the normal varies\n // (Toksvig-style fwidth clamp) — drop shininess, NOT raise it. nVar reads\n // the screen-space normal derivative; a high-variance pixel softens the\n // exponent so the glint stays stable.\n float nVar = length(fwidth(N));\n float shininess = uSpecShininess / (1.0 + 24.0 * nVar);\n float energyNorm = (shininess + 2.0) / 8.0;\n float spec = pow(max(dot(N, H), 0.0), shininess) * uSpecStrength * energyNorm;\n\n // Fresnel/Schlick rim — fed uRimColor (the --foreground warm rim via the\n // /color leaf). FOREGROUND-AWARE MIN-CONTRAST GUARD (AX.W15 [10]):\n // a var(--primary) blob in dark mode resolves a rim near the BODY color, so\n // the rim washes out (no contrast). When the rim's luminance sits too close\n // to the body's, the guard CHROMA-REDUCES and L-LIFTS the rim stop (a\n // perceptual move, NOT a re-tint) so the curved rim always reads. Computed in\n // OKLCh so the lift is perceptual.\n vec3 rimOkl = oklabToOklch(srgbToOklab(uRimColor));\n float bodyL = oklch.x; // the post-perturb body lightness\n float dL = abs(rimOkl.x - bodyL);\n // If the rim is within 0.22 L of the body, push it AWAY (lift if the body is\n // dark, the dark-mode primary case; the chroma-reduce keeps it neutral-warm).\n float lack = clamp((0.22 - dL) / 0.22, 0.0, 1.0);\n rimOkl.x = clamp(mix(rimOkl.x, (bodyL < 0.5 ? 0.92 : 0.18), lack), 0.0, 1.0);\n rimOkl.y *= mix(1.0, 0.5, lack); // chroma-reduce toward a pale pearl\n vec3 rimLin = oklabToLinearSrgb(oklchToOklab(rimOkl));\n\n float rimFres = pow(1.0 - max(dot(N, V), 0.0), uRimPower);\n float rim = rimFres * uRimStrength * (1.0 - 0.6 * thickness);\n\n // Combine the two warm highlights and add in LINEAR. max(spec, rim*scale)\n // keeps the glint from stacking on the rim into a blown hotspot.\n //\n // AX.W46 D4 — CLAMP the linear highlight below unity before the add (the\n // belt-and-braces guard the re-derived specStrength makes rarely-binding but\n // never lets a worst-case normal blow to a hard white spot). The energy-\n // conserving Blinn-Phong CAN still spike on a grazing normal where the Toksvig\n // widen has not kicked in; capping the highlight magnitude at 0.85 (a contained\n // warm gleam, sub-unity) means the OETF clamp below can never crush a\n // pure-white pixel over the dome. The cap is on the highlight ALONE (not the\n // composited lin), so the body color underneath is untouched — it caps only\n // the additive catch-light's energy.\n vec3 highlight = max(warmCream * spec, rimLin * rim);\n highlight = min(highlight, vec3(0.85));\n lin += highlight;\n }\n\n vec3 rgb = clamp(linearToSrgb(lin), 0.0, 1.0); // MANDATORY OETF — closes the seam\n\n // IGN dither (AX.W15 [2][9]) — the low-chroma warm-cream dome BANDS on 8-bit\n // panels (visible Mach steps in the smooth L roll). Interleaved-gradient noise at\n // 1/255, applied AFTER linearToSrgb and BEFORE the *alpha premultiply (aurora\n // ships the same splice). A triangular ±0.5 LSB dither decorrelates the steps.\n float ign = fract(52.9829189 * fract(dot(gl_FragCoord.xy, vec2(0.06711056, 0.00583715))));\n rgb = clamp(rgb + (ign - 0.5) / 255.0, 0.0, 1.0);\n\n // Edit #8 — premultiply AFTER the OETF: straight-alpha gamma → premultiplied.\n fragColor = vec4(rgb * alpha, alpha);\n}";
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/components/custom/goo-blob/composables/uploadBlobUniforms.ts
|
|
534
|
+
function re(e, t, n, r, i, a, o, s, c) {
|
|
535
|
+
let { U: l, satPosLocs: u, satRadLocs: d, satOpLocs: f, trailPosLocs: p, trailRadLocs: m, paletteLocs: g } = r, { params: _, rgb: v, simTimeMs: y, timeSec: b, resolveColor: x, rimColor: S, paletteStops: C } = c, { geometry: w, membrane: T, color: E, surface: D, interaction: O } = a;
|
|
536
|
+
e.useProgram(t), e.bindVertexArray(n), e.uniform2f(l.uResolution, i.width, i.height), e.uniform1f(l.uTime, y / 1e3), e.uniform3f(l.uBaseColor, v[0], v[1], v[2]);
|
|
537
|
+
let k = C, A = Math.min(k.length, 4);
|
|
538
|
+
e.uniform1i(l.uStopCount, A);
|
|
539
|
+
for (let t = 0; t < 4; t++) {
|
|
540
|
+
let n = g[t] ?? null, r = k[t];
|
|
541
|
+
if (r) {
|
|
542
|
+
let t = x(r);
|
|
543
|
+
e.uniform3f(n, t[0], t[1], t[2]);
|
|
544
|
+
} else e.uniform3f(n, v[0], v[1], v[2]);
|
|
545
|
+
}
|
|
546
|
+
let j = o.pointer.value, M = O.pointerAttraction + _.pointerAttraction;
|
|
547
|
+
e.uniform2f(l.uPointer, j.x * .5 * h, j.y * .5 * h), e.uniform1f(l.uPointerActive, +!!o.active.value), e.uniform1f(l.uPointerAttraction, M), e.uniform1f(l.uPointerStrength, O.pointerStrength * h);
|
|
548
|
+
let N = Math.max(0, Math.min(1, M)), P = o.velocity.value;
|
|
549
|
+
e.uniform2f(l.uVelocity, P.x * .5 * h, P.y * .5 * h), e.uniform1f(l.uStretch, O.stretch);
|
|
550
|
+
let F = o.trailSources(w.satelliteRadius * .7 * N);
|
|
551
|
+
e.uniform1i(l.uTrailCount, F.count);
|
|
552
|
+
for (let t = 0; t < 15; t++) {
|
|
553
|
+
let n = p[t] ?? null, r = m[t] ?? null, i = F.sources[t];
|
|
554
|
+
i ? (e.uniform2f(n, i.x * .5 * h, i.y * .5 * h), e.uniform1f(r, i.radius * h)) : (e.uniform2f(n, 0, 0), e.uniform1f(r, 0));
|
|
555
|
+
}
|
|
556
|
+
e.uniform1f(l.uBodyRadius, w.bodyRadius * h), e.uniform1f(l.uPulsePhase, b * T.pulseFreq * _.pulseFreq * Math.PI * 2);
|
|
557
|
+
let I = o.pulse.value * O.clickImpulse;
|
|
558
|
+
e.uniform1f(l.uPulseAmp, (T.pulseAmp * _.pulseAmp / .015 + I) * h), e.uniform1f(l.uNoiseAmp, T.noiseAmp * _.noiseAmp / .025 * h), e.uniform1f(l.uNoiseFreq, T.noiseFreq), e.uniform1f(l.uNoiseSpeed, T.noiseSpeed), e.uniform1f(l.uWarpAmp, T.warpAmp);
|
|
559
|
+
let L = w.orbitRadius * 1.2 * (1 + w.eccentricity), R = T.smoothK * _.smoothK, z = Math.max(0, L - w.satelliteRadius - w.bodyRadius), B = R > 0 ? Math.min(1.25, 1 + z / R) : 1;
|
|
560
|
+
e.uniform1f(l.uSmoothK, R * B * h), e.uniform1f(l.uMerge, +(T.merge === "circular")), e.uniform1f(l.uStage, +(a.variant === "blob"));
|
|
561
|
+
let V = L + w.satelliteRadius, H = (Math.max(w.bodyRadius, V) + R * B + T.noiseAmp * _.noiseAmp / .025 + Math.abs(o.pulse.value) * O.clickImpulse) * h + .1;
|
|
562
|
+
e.uniform1f(l.uMaxReach, H), e.uniform1f(l.uHueRange, E.hueRange + _.hueRange), e.uniform1f(l.uSatShift, E.satShift + _.satShift), e.uniform1f(l.uBrightnessShift, E.brightnessShift + _.brightnessShift), e.uniform1f(l.uColorNoiseFreq, E.colorNoiseFreq), e.uniform1f(l.uColorNoiseSpeed, E.colorNoiseSpeed);
|
|
563
|
+
let U = a.variant !== "blob";
|
|
564
|
+
e.uniform1f(l.uLit, U && D.lit ? 1 : 0);
|
|
565
|
+
let W = x(S);
|
|
566
|
+
e.uniform3f(l.uRimColor, W[0], W[1], W[2]), e.uniform3f(l.uLightDir, D.lightDir[0], D.lightDir[1], D.lightDir[2]), e.uniform1f(l.uSpecStrength, D.specStrength), e.uniform1f(l.uSpecShininess, D.specShininess), e.uniform1f(l.uRimPower, D.rimPower), e.uniform1f(l.uRimStrength, D.rimStrength), e.uniform1f(l.uShadow, U && D.shadow ? 1 : 0), e.uniform1f(l.uShadowSoftness, D.shadowSoftness), e.uniform1f(l.uIridescence, D.iridescence * _.iridScale), e.uniform1f(l.uIridHue, D.iridHue * (Math.PI / 180)), e.uniform1f(l.uIridSpeed, D.iridSpeed), e.uniform1f(l.uSssScale, D.sssScale * _.iridScale), e.uniform1f(l.uSssPower, D.sssPower), e.uniform1f(l.uCoreGlow, D.coreGlow);
|
|
567
|
+
let G = s.sources;
|
|
568
|
+
e.uniform1i(l.uSatCount, G.length);
|
|
569
|
+
for (let t = 0; t < 4; t++) {
|
|
570
|
+
let n = u[t] ?? null, r = d[t] ?? null, i = f[t] ?? null, a = G[t];
|
|
571
|
+
a ? (e.uniform2f(n, a.x * h, a.y * h), e.uniform1f(r, a.radius * h), e.uniform1f(i, a.opacity)) : (e.uniform2f(n, 0, 0), e.uniform1f(r, 0), e.uniform1f(i, 0));
|
|
572
|
+
}
|
|
573
|
+
e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.drawArrays(e.TRIANGLES, 0, 6), e.bindVertexArray(null);
|
|
574
|
+
}
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/components/custom/goo-blob/shaders/metaball.wgsl.ts
|
|
577
|
+
var ie = `
|
|
578
|
+
const MAX_SATS: i32 = 4;
|
|
579
|
+
const TRAIL_N: i32 = 15;
|
|
580
|
+
const MAX_BLOB_STOPS: i32 = 4;
|
|
581
|
+
const PI: f32 = 3.141592653589793;
|
|
582
|
+
|
|
583
|
+
// ── Uniforms (the typed-struct source-of-truth — see uniformBridgeWGPU.ts) ──
|
|
584
|
+
// Scalars packed into vec4 lanes; per-satellite / per-trail / per-palette rows packed
|
|
585
|
+
// into a vec4 so the array stride is the natural 16 bytes (no std140 stride trap — the
|
|
586
|
+
// parity-blowout suspect the wave's §Triumvirate names).
|
|
587
|
+
struct Uniforms {
|
|
588
|
+
// s0: (uTime, uBodyRadius, uPulsePhase, uPulseAmp)
|
|
589
|
+
s0: vec4<f32>,
|
|
590
|
+
// s1: (uNoiseAmp, uNoiseFreq, uNoiseSpeed, uWarpAmp)
|
|
591
|
+
s1: vec4<f32>,
|
|
592
|
+
// s2: (uSmoothK, uMerge, uMaxReach, uLit)
|
|
593
|
+
s2: vec4<f32>,
|
|
594
|
+
// s3: (uSpecStrength, uSpecShininess, uRimPower, uRimStrength)
|
|
595
|
+
s3: vec4<f32>,
|
|
596
|
+
// s4: (uIridescence, uIridHue, uIridSpeed, uSssScale)
|
|
597
|
+
s4: vec4<f32>,
|
|
598
|
+
// s5: (uSssPower, uCoreGlow, uHueRange, uSatShift)
|
|
599
|
+
s5: vec4<f32>,
|
|
600
|
+
// s6: (uBrightnessShift, uColorNoiseFreq, uColorNoiseSpeed, uStretch)
|
|
601
|
+
s6: vec4<f32>,
|
|
602
|
+
// s7: (uPointerActive, uPointerAttraction, uPointerStrength, uStage)
|
|
603
|
+
// BC.W-GOOBLOB-PLAIN — uStage gates the STAGE-1 stripped floor: 1.0 = the plain
|
|
604
|
+
// shadowless lightless fill-only floor (variant="blob"); 0.0 = the full lit
|
|
605
|
+
// pipeline (variant="meatball" / STAGE 2). It rides the spare s7.w lane the typed-
|
|
606
|
+
// struct SoT (uniformBridgeWGPU.ts) reserved.
|
|
607
|
+
s7: vec4<f32>,
|
|
608
|
+
// ptr: (uPointer.x, uPointer.y, uVelocity.x, uVelocity.y)
|
|
609
|
+
ptr: vec4<f32>,
|
|
610
|
+
// base: (uBaseColor.rgb, _pad)
|
|
611
|
+
base: vec4<f32>,
|
|
612
|
+
// rim: (uRimColor.rgb, _pad)
|
|
613
|
+
rim: vec4<f32>,
|
|
614
|
+
// light: (uLightDir.xyz, _pad)
|
|
615
|
+
light: vec4<f32>,
|
|
616
|
+
// res: (uResolution.x, uResolution.y, uShadow, uShadowSoftness)
|
|
617
|
+
// BC.W-GOOBLOB-MEATBALL — the soft-shadow march rides the spare res.z/res.w lanes the
|
|
618
|
+
// typed-struct SoT (uniformBridgeWGPU.ts) reserved (the EXTEND, never a re-fork): res.z
|
|
619
|
+
// = uShadow (1.0 = the variant=meatball shadow ON), res.w = uShadowSoftness (the
|
|
620
|
+
// penumbra hardness, inverse light-source size → 4-48).
|
|
621
|
+
res: vec4<f32>,
|
|
622
|
+
// ints: (uStopCount, uSatCount, uTrailCount, _pad)
|
|
623
|
+
ints: vec4<i32>,
|
|
624
|
+
palette: array<vec4<f32>, 4>,
|
|
625
|
+
satPos: array<vec4<f32>, 4>, // (pos.x, pos.y, radius, opacity)
|
|
626
|
+
trailPos: array<vec4<f32>, 15>, // (pos.x, pos.y, radius, _pad)
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
@group(0) @binding(0) var<uniform> u: Uniforms;
|
|
630
|
+
|
|
631
|
+
// Noise + FBM (BC.W-CARVE6 → metaball-noise.wgsl) — spliced AFTER ${a}.
|
|
632
|
+
${a}
|
|
633
|
+
|
|
634
|
+
const FBM_LACUNARITY: f32 = 1.8;
|
|
635
|
+
const FBM_GAIN: f32 = 0.42;
|
|
636
|
+
|
|
637
|
+
// ── Noise (blob-LOCAL 3D-p3 hash + IQ analytic-derivative gradient noise) ──
|
|
638
|
+
fn hash21(p: vec2<f32>) -> f32 {
|
|
639
|
+
var p3 = fract(vec3<f32>(p.x, p.y, p.x) * 0.1031);
|
|
640
|
+
p3 = p3 + dot(p3, p3.yzx + 33.33);
|
|
641
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// IQ analytic-derivative gradient noise — value in .x, ANALYTIC gradient (d/dx, d/dy) in
|
|
645
|
+
// .yz, from one eval. The quintic fade has a continuous 2nd derivative.
|
|
646
|
+
fn noised(p: vec2<f32>) -> vec3<f32> {
|
|
647
|
+
let i = floor(p);
|
|
648
|
+
let f = fract(p);
|
|
649
|
+
let uu = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);
|
|
650
|
+
let du = 30.0 * f * f * (f * (f - 2.0) + 1.0);
|
|
651
|
+
|
|
652
|
+
let ga = -1.0 + 2.0 * vec2<f32>(hash21(i + vec2<f32>(0.0, 0.0)), hash21(i + vec2<f32>(7.3, 0.0)));
|
|
653
|
+
let gb = -1.0 + 2.0 * vec2<f32>(hash21(i + vec2<f32>(1.0, 0.0)), hash21(i + vec2<f32>(8.3, 0.0)));
|
|
654
|
+
let gc = -1.0 + 2.0 * vec2<f32>(hash21(i + vec2<f32>(0.0, 1.0)), hash21(i + vec2<f32>(7.3, 1.0)));
|
|
655
|
+
let gd = -1.0 + 2.0 * vec2<f32>(hash21(i + vec2<f32>(1.0, 1.0)), hash21(i + vec2<f32>(8.3, 1.0)));
|
|
656
|
+
|
|
657
|
+
let va = dot(ga, f - vec2<f32>(0.0, 0.0));
|
|
658
|
+
let vb = dot(gb, f - vec2<f32>(1.0, 0.0));
|
|
659
|
+
let vc = dot(gc, f - vec2<f32>(0.0, 1.0));
|
|
660
|
+
let vd = dot(gd, f - vec2<f32>(1.0, 1.0));
|
|
661
|
+
|
|
662
|
+
let n = va + uu.x * (vb - va) + uu.y * (vc - va) + uu.x * uu.y * (va - vb - vc + vd);
|
|
663
|
+
let value = 0.5 + 0.5 * n;
|
|
664
|
+
|
|
665
|
+
let grad =
|
|
666
|
+
ga + uu.x * (gb - ga) + uu.y * (gc - ga) + uu.x * uu.y * (ga - gb - gc + gd) +
|
|
667
|
+
du * (vec2<f32>(uu.y, uu.x) * (va - vb - vc + vd) + vec2<f32>(vb, vc) - va);
|
|
668
|
+
return vec3<f32>(value, 0.5 * grad);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
fn fbm(p0: vec2<f32>, octaves: i32) -> f32 {
|
|
672
|
+
var value = 0.0;
|
|
673
|
+
var amp = 0.5;
|
|
674
|
+
var freq = 1.0;
|
|
675
|
+
var p = p0;
|
|
676
|
+
for (var i = 0; i < 4; i = i + 1) {
|
|
677
|
+
if (i >= octaves) { break; }
|
|
678
|
+
value = value + amp * noised(p * freq).x;
|
|
679
|
+
p = FBM_ROT * p;
|
|
680
|
+
freq = freq * FBM_LACUNARITY;
|
|
681
|
+
amp = amp * FBM_GAIN;
|
|
682
|
+
}
|
|
683
|
+
return value;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// FBM with ANALYTIC GRADIENT — value in .x, ∂/∂x, ∂/∂y in .yz. The gradient accumulates
|
|
687
|
+
// noised()'s analytic gradient per octave, chain-ruled through the per-octave frequency
|
|
688
|
+
// scale AND the FBM_ROT rotation (the keystone feed for the analytic surface normal).
|
|
689
|
+
fn fbmG(p: vec2<f32>, octaves: i32) -> vec3<f32> {
|
|
690
|
+
var value = 0.0;
|
|
691
|
+
var grad = vec2<f32>(0.0, 0.0);
|
|
692
|
+
var amp = 0.5;
|
|
693
|
+
var freq = 1.0;
|
|
694
|
+
var rotAccum = mat2x2<f32>(1.0, 0.0, 0.0, 1.0);
|
|
695
|
+
var pp = p;
|
|
696
|
+
for (var i = 0; i < 4; i = i + 1) {
|
|
697
|
+
if (i >= octaves) { break; }
|
|
698
|
+
let n = noised(pp * freq);
|
|
699
|
+
value = value + amp * n.x;
|
|
700
|
+
grad = grad + amp * freq * (transpose(rotAccum) * n.yz);
|
|
701
|
+
pp = FBM_ROT * pp;
|
|
702
|
+
freq = freq * FBM_LACUNARITY;
|
|
703
|
+
amp = amp * FBM_GAIN;
|
|
704
|
+
rotAccum = FBM_ROT * rotAccum;
|
|
705
|
+
}
|
|
706
|
+
return vec3<f32>(value, grad);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// One domain-warp pass with the ANALYTIC GRADIENT carried (warp-Jacobian approximation).
|
|
710
|
+
fn fbmWarpedG(p: vec2<f32>, octaves: i32, warpAmp: f32) -> vec3<f32> {
|
|
711
|
+
if (warpAmp <= 0.0) { return fbmG(p, octaves); }
|
|
712
|
+
let q = vec2<f32>(fbm(p + vec2<f32>(0.0, 0.0), octaves),
|
|
713
|
+
fbm(p + vec2<f32>(5.2, 1.3), octaves));
|
|
714
|
+
return fbmG(p + warpAmp * (q - 0.5), octaves);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
// ── SDF body (value+gradient circle + the IQ normalized smin, value+gradient form) ──
|
|
719
|
+
fn sdgCircle(p: vec2<f32>, center: vec2<f32>, radius: f32) -> vec3<f32> {
|
|
720
|
+
let d = p - center;
|
|
721
|
+
let len = length(d);
|
|
722
|
+
var grad = vec2<f32>(0.0, 1.0);
|
|
723
|
+
if (len > 1e-6) { grad = d / len; }
|
|
724
|
+
return vec3<f32>(len - radius, grad);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
fn sminQuadraticG(a: vec3<f32>, b: vec3<f32>, k0: f32) -> vec3<f32> {
|
|
728
|
+
let k = k0 * 4.0;
|
|
729
|
+
let h = max(k - abs(a.x - b.x), 0.0) / k;
|
|
730
|
+
let m = h * h * k * 0.25;
|
|
731
|
+
var w = 1.0 - 0.5 * h * h;
|
|
732
|
+
if (a.x < b.x) { w = 0.5 * h * h; }
|
|
733
|
+
let dist = min(a.x, b.x) - m;
|
|
734
|
+
let grad = mix(a.yz, b.yz, w);
|
|
735
|
+
return vec3<f32>(dist, grad);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
fn sminCircularG(a: vec3<f32>, b: vec3<f32>, k0: f32) -> vec3<f32> {
|
|
739
|
+
let k = k0 * (1.0 / (1.0 - sqrt(0.5)));
|
|
740
|
+
let h = max(k - abs(a.x - b.x), 0.0) / k;
|
|
741
|
+
let m = k * 0.5 * (1.0 + h - sqrt(1.0 - h * (h - 2.0)));
|
|
742
|
+
var w = 1.0 - 0.5 * h;
|
|
743
|
+
if (a.x < b.x) { w = 0.5 * h; }
|
|
744
|
+
let dist = min(a.x, b.x) - m;
|
|
745
|
+
let grad = mix(a.yz, b.yz, w);
|
|
746
|
+
return vec3<f32>(dist, grad);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
fn sminG(a: vec3<f32>, b: vec3<f32>, k: f32) -> vec3<f32> {
|
|
750
|
+
if (u.s2.y > 0.5) { return sminCircularG(a, b, k); }
|
|
751
|
+
return sminQuadraticG(a, b, k);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
${t}
|
|
755
|
+
${r}
|
|
756
|
+
|
|
757
|
+
// OKLCh gamut clamp + palette sample + breath (BC.W-CARVE6 → metaball-palette.wgsl)
|
|
758
|
+
// — spliced AFTER ${r} (its matrix source).
|
|
759
|
+
|
|
760
|
+
// ── OKLCh gamut clamp (hue-preserving inward chroma clamp — blob-local) ──
|
|
761
|
+
fn inGamut(lin: vec3<f32>) -> bool {
|
|
762
|
+
return all(lin >= vec3<f32>(0.0)) && all(lin <= vec3<f32>(1.0));
|
|
763
|
+
}
|
|
764
|
+
fn gamutClampOklch(lch: vec3<f32>) -> vec3<f32> {
|
|
765
|
+
let lin = oklabToLinearSrgb(oklchToOklab(lch));
|
|
766
|
+
if (inGamut(lin)) { return lch; }
|
|
767
|
+
var lo = 0.0;
|
|
768
|
+
var hi = lch.y;
|
|
769
|
+
for (var i = 0; i < 16; i = i + 1) {
|
|
770
|
+
let mid = 0.5 * (lo + hi);
|
|
771
|
+
let test = vec3<f32>(lch.x, mid, lch.z);
|
|
772
|
+
if (inGamut(oklabToLinearSrgb(oklchToOklab(test)))) { lo = mid; } else { hi = mid; }
|
|
773
|
+
}
|
|
774
|
+
return vec3<f32>(lch.x, lo, lch.z);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// W11.b — sample the multi-stop palette at t, OKLab mix + midpoint chroma-bump. Returns
|
|
778
|
+
// an OKLCh stop [L, C, h(rad)]. Falls back to uBaseColor when uStopCount <= 1.
|
|
779
|
+
fn samplePaletteOklch(t: f32) -> vec3<f32> {
|
|
780
|
+
let uStopCount = u.ints.x;
|
|
781
|
+
if (uStopCount <= 1) { return oklabToOklch(srgbToOklab(u.base.rgb)); }
|
|
782
|
+
let n = f32(uStopCount);
|
|
783
|
+
let ft = clamp(t, 0.0, 1.0) * (n - 1.0);
|
|
784
|
+
let i0 = i32(floor(ft));
|
|
785
|
+
let i1 = min(i0 + 1, uStopCount - 1);
|
|
786
|
+
let f = ft - f32(i0);
|
|
787
|
+
let labA = srgbToOklab(u.palette[i0].rgb);
|
|
788
|
+
let labB = srgbToOklab(u.palette[i1].rgb);
|
|
789
|
+
let lab = mix(labA, labB, f);
|
|
790
|
+
var lch = oklabToOklch(lab);
|
|
791
|
+
lch.y = lch.y + 0.03 * sin(PI * f);
|
|
792
|
+
return lch;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// AX.W15 — de-synced breath (three DETUNED sines at irrational ratios).
|
|
796
|
+
fn breath(phase: f32) -> f32 {
|
|
797
|
+
return (sin(phase) + 0.5 * sin(phase * 1.4444 + 1.7) + 0.28 * sin(phase * 0.31 + 4.1)) / 1.78;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
// AX.W15 — the composite SDF field WITH its ANALYTIC GRADIENT vec3(dist, ∂/∂x, ∂/∂y).
|
|
802
|
+
fn sceneDistG(uv: vec2<f32>) -> vec3<f32> {
|
|
803
|
+
let uBodyRadius = u.s0.y;
|
|
804
|
+
let uPulsePhase = u.s0.z;
|
|
805
|
+
let uPulseAmp = u.s0.w;
|
|
806
|
+
let uNoiseAmp = u.s1.x;
|
|
807
|
+
let uNoiseFreq = u.s1.y;
|
|
808
|
+
let uNoiseSpeed = u.s1.z;
|
|
809
|
+
let uWarpAmp = u.s1.w;
|
|
810
|
+
let uSmoothK = u.s2.x;
|
|
811
|
+
let uTime = u.s0.x;
|
|
812
|
+
let uVelocity = u.ptr.zw;
|
|
813
|
+
let uStretch = u.s6.w;
|
|
814
|
+
let uSatCount = u.ints.y;
|
|
815
|
+
let uTrailCount = u.ints.z;
|
|
816
|
+
|
|
817
|
+
let bodyR = uBodyRadius + breath(uPulsePhase) * uPulseAmp;
|
|
818
|
+
|
|
819
|
+
// Velocity-driven VOLUME-PRESERVING squash-and-stretch (tanh-saturated).
|
|
820
|
+
var bodyUv = uv;
|
|
821
|
+
var ax = vec2<f32>(1.0, 0.0);
|
|
822
|
+
var perp = vec2<f32>(0.0, 1.0);
|
|
823
|
+
var sa = 1.0;
|
|
824
|
+
let speed = length(uVelocity);
|
|
825
|
+
let squashed = uStretch > 0.0 && speed > 1e-4;
|
|
826
|
+
if (squashed) {
|
|
827
|
+
ax = uVelocity / speed;
|
|
828
|
+
perp = vec2<f32>(-ax.y, ax.x);
|
|
829
|
+
sa = 1.0 + tanh(speed * 1.6) * uStretch;
|
|
830
|
+
bodyUv = vec2<f32>(dot(uv, ax) / sa, dot(uv, perp) * sa);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// Domain-warped FBM displacement WITH its analytic gradient.
|
|
834
|
+
let fbmv = fbmWarpedG(bodyUv * uNoiseFreq + uTime * uNoiseSpeed, 3, uWarpAmp);
|
|
835
|
+
let bodyDisplacement = (fbmv.x - 0.5) * uNoiseAmp;
|
|
836
|
+
let dispGradBody = uNoiseAmp * uNoiseFreq * fbmv.yz;
|
|
837
|
+
|
|
838
|
+
let bodyG = sdgCircle(bodyUv, vec2<f32>(0.0), bodyR + bodyDisplacement);
|
|
839
|
+
let bodyGradBody = bodyG.yz - dispGradBody;
|
|
840
|
+
|
|
841
|
+
var bodyGradUv: vec2<f32>;
|
|
842
|
+
if (squashed) {
|
|
843
|
+
let scaled = vec2<f32>(bodyGradBody.x / sa, bodyGradBody.y * sa);
|
|
844
|
+
bodyGradUv = scaled.x * ax + scaled.y * perp;
|
|
845
|
+
} else {
|
|
846
|
+
bodyGradUv = bodyGradBody;
|
|
847
|
+
}
|
|
848
|
+
var d = vec3<f32>(bodyG.x, bodyGradUv);
|
|
849
|
+
|
|
850
|
+
// Satellites — smin-merged into the body.
|
|
851
|
+
for (var i = 0; i < MAX_SATS; i = i + 1) {
|
|
852
|
+
if (i >= uSatCount) { break; }
|
|
853
|
+
let s = u.satPos[i];
|
|
854
|
+
var satG = sdgCircle(uv, s.xy, s.z);
|
|
855
|
+
satG.x = satG.x + (1.0 - s.w) * 0.3;
|
|
856
|
+
d = sminG(d, satG, uSmoothK);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// Pointer trail — a decaying-radius pseudopod.
|
|
860
|
+
for (var i = 0; i < TRAIL_N; i = i + 1) {
|
|
861
|
+
if (i >= uTrailCount) { break; }
|
|
862
|
+
let tp = u.trailPos[i];
|
|
863
|
+
let trailG = sdgCircle(uv, tp.xy, tp.z);
|
|
864
|
+
d = sminG(d, trailG, uSmoothK);
|
|
865
|
+
}
|
|
866
|
+
return d;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// AX.W15 — the analytic surface normal from the field gradient.
|
|
870
|
+
fn surfaceNormalFromGrad(grad2d: vec2<f32>, d: f32, bodyR: f32) -> vec3<f32> {
|
|
871
|
+
let g = normalize(grad2d + vec2<f32>(1e-6));
|
|
872
|
+
let interior = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0);
|
|
873
|
+
let z = sqrt(max(0.0, 1.0 - (1.0 - interior) * (1.0 - interior)));
|
|
874
|
+
return normalize(vec3<f32>(g * (1.0 - z), z) + vec3<f32>(0.0, 0.0, 1e-6));
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// ── BC.W-GOOBLOB-MEATBALL — the 2D SDF soft-shadow march (IQ rmshadows improved-penumbra,
|
|
878
|
+
// research/viz/goo-blob.md §2.3). A procedural soft contact shadow that FOLLOWS the
|
|
879
|
+
// irregular metaball silhouette (NOT a hard disc / box shadow). Marches a ray from ro
|
|
880
|
+
// along rd (the in-plane projection of uLightDir), accumulating the closest miss via
|
|
881
|
+
// the Aaltonen penumbra (y = h*h/(2*ph) + d = sqrt(h*h - y*y)) that kills the
|
|
882
|
+
// banding the naive res = min(res, h/(w*t)) shows. CHEAP: 24 steps, re-uses the SAME
|
|
883
|
+
// sceneDistG().x field (NO separate field re-eval, NO FBO/multi-pass — the procedural
|
|
884
|
+
// field needs none, §2.3). w is the penumbra hardness (inverse light-source size →
|
|
885
|
+
// uShadowSoftness). It is derivative-FREE (no fwidth/dpdx/dpdy), so it is fragment-safe
|
|
886
|
+
// here. Returns 1.0 (fully lit) → 0.0 (fully occluded). ──
|
|
887
|
+
fn softShadow2D(ro: vec2<f32>, rd: vec2<f32>, mint: f32, maxt: f32, w: f32) -> f32 {
|
|
888
|
+
var res = 1.0;
|
|
889
|
+
var ph = 1e20;
|
|
890
|
+
var t = mint;
|
|
891
|
+
for (var i = 0; i < 24; i = i + 1) {
|
|
892
|
+
if (t >= maxt) { break; }
|
|
893
|
+
let h = sceneDistG(ro + rd * t).x;
|
|
894
|
+
if (h < 0.001) { return 0.0; }
|
|
895
|
+
let y = h * h / (2.0 * ph);
|
|
896
|
+
let dd = sqrt(max(h * h - y * y, 0.0));
|
|
897
|
+
res = min(res, dd / (w * max(0.001, t - y)));
|
|
898
|
+
ph = h;
|
|
899
|
+
t = t + h;
|
|
900
|
+
}
|
|
901
|
+
return clamp(res, 0.0, 1.0);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// ── Full-screen triangle vertex stage (the pilot idiom — no vertex buffer) ──
|
|
905
|
+
struct VSOut {
|
|
906
|
+
@builtin(position) pos: vec4<f32>,
|
|
907
|
+
@location(0) uv: vec2<f32>,
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
@vertex
|
|
911
|
+
fn vs_main(@builtin(vertex_index) vi: u32) -> VSOut {
|
|
912
|
+
var p = vec2<f32>(-1.0, -1.0);
|
|
913
|
+
if (vi == 1u) { p = vec2<f32>(3.0, -1.0); }
|
|
914
|
+
else if (vi == 2u) { p = vec2<f32>(-1.0, 3.0); }
|
|
915
|
+
var out: VSOut;
|
|
916
|
+
out.pos = vec4<f32>(p, 0.0, 1.0);
|
|
917
|
+
// vUv = aPos * 0.5 + 0.5 (the metaball.vert convention).
|
|
918
|
+
out.uv = p * 0.5 + 0.5;
|
|
919
|
+
return out;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// ── Fragment stage (the main() transcription) ──
|
|
923
|
+
@fragment
|
|
924
|
+
fn fs_main(in: VSOut) -> @location(0) vec4<f32> {
|
|
925
|
+
let uTime = u.s0.x;
|
|
926
|
+
let uBodyRadius = u.s0.y;
|
|
927
|
+
let uPulsePhase = u.s0.z;
|
|
928
|
+
let uPulseAmp = u.s0.w;
|
|
929
|
+
let uMaxReach = u.s2.z;
|
|
930
|
+
let uLit = u.s2.w;
|
|
931
|
+
let uPointerActive = u.s7.x;
|
|
932
|
+
let uPointerAttraction = u.s7.y;
|
|
933
|
+
let uPointerStrength = u.s7.z;
|
|
934
|
+
// BC.W-GOOBLOB-PLAIN — the STAGE-1 gate (1.0 = the plain shadowless fill-only floor).
|
|
935
|
+
let uStage = u.s7.w;
|
|
936
|
+
let uPointer = u.ptr.xy;
|
|
937
|
+
let uHueRange = u.s5.z;
|
|
938
|
+
let uSatShift = u.s5.w;
|
|
939
|
+
let uBrightnessShift = u.s6.x;
|
|
940
|
+
let uColorNoiseFreq = u.s6.y;
|
|
941
|
+
let uColorNoiseSpeed = u.s6.z;
|
|
942
|
+
let uIridescence = u.s4.x;
|
|
943
|
+
let uIridHue = u.s4.y;
|
|
944
|
+
let uIridSpeed = u.s4.z;
|
|
945
|
+
let uSssScale = u.s4.w;
|
|
946
|
+
let uSssPower = u.s5.x;
|
|
947
|
+
let uCoreGlow = u.s5.y;
|
|
948
|
+
let uSpecStrength = u.s3.x;
|
|
949
|
+
let uSpecShininess = u.s3.y;
|
|
950
|
+
let uRimPower = u.s3.z;
|
|
951
|
+
let uRimStrength = u.s3.w;
|
|
952
|
+
let uLightDir = u.light.xyz;
|
|
953
|
+
let uRimColor = u.rim.rgb;
|
|
954
|
+
// BC.W-GOOBLOB-MEATBALL — the soft-shadow gate + penumbra hardness (res.z/res.w lanes).
|
|
955
|
+
let uShadow = u.res.z;
|
|
956
|
+
let uShadowSoftness = u.res.w;
|
|
957
|
+
|
|
958
|
+
var uv = in.uv - 0.5;
|
|
959
|
+
|
|
960
|
+
// PRE-FBM bounding early-out — transparent WRITE (not a discard).
|
|
961
|
+
if (dot(uv, uv) > uMaxReach * uMaxReach) {
|
|
962
|
+
return vec4<f32>(0.0);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
// Pointer deformation — sign per AY.W-BLOB-CONFIG D2.
|
|
966
|
+
if (uPointerActive > 0.5) {
|
|
967
|
+
let pointerDir = uPointer - uv;
|
|
968
|
+
let pointerDist = length(pointerDir);
|
|
969
|
+
let influence = smoothstep(0.5, 0.0, pointerDist) * uPointerAttraction * uPointerStrength;
|
|
970
|
+
uv = uv + normalize(pointerDir + vec2<f32>(1e-6)) * influence;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
let bodyR = uBodyRadius + breath(uPulsePhase) * uPulseAmp;
|
|
974
|
+
|
|
975
|
+
// Composite domain-warped membrane field WITH its analytic gradient.
|
|
976
|
+
let scene = sceneDistG(uv);
|
|
977
|
+
let d = scene.x;
|
|
978
|
+
let fieldGrad = scene.yz;
|
|
979
|
+
|
|
980
|
+
// ── fwidth SITE #1 (metaball.frag.ts line 266) — AA-edge half-width from the SDF
|
|
981
|
+
// screen-space gradient. The WGSL fragment-stage fwidth() transcription. ──
|
|
982
|
+
let aa = max(fwidth(d), 1e-6);
|
|
983
|
+
let alpha = 1.0 - smoothstep(-aa, aa, d);
|
|
984
|
+
|
|
985
|
+
// ── BC.W-GOOBLOB-MEATBALL — the WGSL uniformity STRUCTURAL fix (the meatball-armer).
|
|
986
|
+
// The Toksvig screen-space derivative (fwidth SITE #2) is hoisted HERE, into the SAME
|
|
987
|
+
// uniform control flow fwidth(d) above already arms in (top-level fs_main, before the
|
|
988
|
+
// per-fragment alpha < 0.001 early-return and the uLit/uShadow non-uniform branches).
|
|
989
|
+
// WGSL uniformity analysis rejects a fwidth() reached only through a return predicated
|
|
990
|
+
// on a per-fragment value (the alpha < 0.001 early-out) nested under further branches
|
|
991
|
+
// — exactly the BB residual that kept the normal-derivative inside the lit branch from
|
|
992
|
+
// compiling, so the WGSL primary never armed and GooBlob fell to the WebGL2 net. Nh is
|
|
993
|
+
// the uniform-flow surface normal computed for this derivative ONLY (byte-identical to
|
|
994
|
+
// the lit block's own N = surfaceNormalFromGrad(...) below — the SAME inputs, so
|
|
995
|
+
// nVar = length(fwidth(Nh)) IS the Toksvig clamp the lit block reads); the named lit-
|
|
996
|
+
// block N stays AFTER the uStage early-return (the STAGE-1 floor reaches no lit work).
|
|
997
|
+
// nVar is a pure uniform-flow value the lit block READS — no derivative in non-uniform
|
|
998
|
+
// flow; the math is byte-identical to the GLSL fallback's Toksvig clamp, only its
|
|
999
|
+
// EVALUATION POINT moved. The shadow march (T2) reuses d (the same sceneDistG().x).
|
|
1000
|
+
let Nh = surfaceNormalFromGrad(fieldGrad, d, bodyR);
|
|
1001
|
+
// ── fwidth SITE #2 (metaball.frag.ts line 364) — Toksvig normal-variance specular
|
|
1002
|
+
// clamp, the WGSL fragment-stage fwidth() of the surface normal. NOW in uniform
|
|
1003
|
+
// control flow (the structural fix), so the WGSL primary ARMS + paints the full lit
|
|
1004
|
+
// creature instead of falling to the stripped WebGL2 fallback. ──
|
|
1005
|
+
let nVar = length(fwidth(Nh));
|
|
1006
|
+
|
|
1007
|
+
if (alpha < 0.001) {
|
|
1008
|
+
return vec4<f32>(0.0);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// Edit #4 — perceptually-uniform OKLCh variation.
|
|
1012
|
+
let colorNoise = fbm(uv * uColorNoiseFreq + uTime * uColorNoiseSpeed, 3);
|
|
1013
|
+
var oklch = samplePaletteOklch(colorNoise);
|
|
1014
|
+
|
|
1015
|
+
oklch.z = oklch.z + (colorNoise - 0.5) * uHueRange * (PI / 180.0);
|
|
1016
|
+
oklch.y = max(oklch.y + (colorNoise - 0.5) * uSatShift, 0.0);
|
|
1017
|
+
oklch.x = clamp(oklch.x + uBrightnessShift, 0.0, 1.0);
|
|
1018
|
+
|
|
1019
|
+
// ── BC.W-GOOBLOB-PLAIN — the STAGE-1 stripped floor (variant=blob). ──
|
|
1020
|
+
// The minimal verifiable floor: SDF + smin (the meatball field, already in d/
|
|
1021
|
+
// alpha above) + fwidth-AA (the crisp alpha above) + warm-cream fill. NO surface
|
|
1022
|
+
// normal, NO Fresnel, NO lit glint, NO iridescence, NO fake-SSS, NO shadow —
|
|
1023
|
+
// deliberately FLAT. It returns BEFORE any of the STAGE-2 dressing is reached. The
|
|
1024
|
+
// STAGE-1 path simply never READS the hoisted Nh/nVar or the lit/shadow blocks; the
|
|
1025
|
+
// normal-derivative is now in UNIFORM control flow above (BC.W-GOOBLOB-MEATBALL — the
|
|
1026
|
+
// structural armer), so BOTH the STAGE-1 floor AND the STAGE-2 lit path arm on Metal
|
|
1027
|
+
// (the BB residual that kept STAGE 2 falling to the WebGL2 net is CLOSED). The
|
|
1028
|
+
// teaching contrast: this is the "it renders, it meatballs, it works on Safari"
|
|
1029
|
+
// floor STAGE 2 layers the lit/shadow onto via the SAME uniforms.
|
|
1030
|
+
if (uStage > 0.5) {
|
|
1031
|
+
let okl1 = gamutClampOklch(oklch);
|
|
1032
|
+
var lin1 = oklabToLinearSrgb(oklchToOklab(okl1));
|
|
1033
|
+
var rgb1 = clamp(linearToSrgb(lin1), vec3<f32>(0.0), vec3<f32>(1.0));
|
|
1034
|
+
let fc1 = in.pos.xy;
|
|
1035
|
+
let ign1 = fract(52.9829189 * fract(dot(fc1, vec2<f32>(0.06711056, 0.00583715))));
|
|
1036
|
+
rgb1 = clamp(rgb1 + (ign1 - 0.5) / 255.0, vec3<f32>(0.0), vec3<f32>(1.0));
|
|
1037
|
+
return vec4<f32>(rgb1 * alpha, alpha);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
// The named surface normal the lit/iridescence/SSS blocks read (byte-identical inputs to
|
|
1041
|
+
// the hoisted Nh above — the Toksvig nVar = length(fwidth(Nh)) IS this N's screen-space
|
|
1042
|
+
// variance). It sits AFTER the uStage early-return so the STAGE-1 floor reaches no lit work.
|
|
1043
|
+
let N = surfaceNormalFromGrad(fieldGrad, d, bodyR);
|
|
1044
|
+
let V = vec3<f32>(0.0, 0.0, 1.0);
|
|
1045
|
+
let thickness = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0);
|
|
1046
|
+
let fres = pow(1.0 - max(dot(N, V), 0.0), 2.5);
|
|
1047
|
+
|
|
1048
|
+
// ── W11.a iridescence — warm-biased IQ cosine palette driving OKLCh HUE ──
|
|
1049
|
+
if (uIridescence > 0.0) {
|
|
1050
|
+
let t = fres + 0.3 * colorNoise + uTime * uIridSpeed;
|
|
1051
|
+
let iridHue = uIridHue + 0.18 * PI * cos(2.0 * PI * t);
|
|
1052
|
+
let w = fres * uIridescence;
|
|
1053
|
+
oklch.z = mix(oklch.z, iridHue, w);
|
|
1054
|
+
oklch.y = min(oklch.y + 0.04 * w, oklch.y + 0.08);
|
|
1055
|
+
oklch.x = min(oklch.x + 0.05 * w, 1.0);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// ── W11.a fake subsurface translucency — thickness inner-glow + back-light ──
|
|
1059
|
+
if (uCoreGlow > 0.0 || uSssScale > 0.0) {
|
|
1060
|
+
oklch.x = min(oklch.x + uCoreGlow * (1.0 - exp(-3.0 * thickness)), 1.0);
|
|
1061
|
+
let L = normalize(uLightDir + vec3<f32>(1e-6));
|
|
1062
|
+
let back = pow(clamp(dot(V, -(L + N * thickness)), 0.0, 1.0), uSssPower);
|
|
1063
|
+
let sss = back * uSssScale * (1.0 - thickness);
|
|
1064
|
+
oklch.x = min(oklch.x + sss, 1.0);
|
|
1065
|
+
oklch.z = oklch.z + sss * 0.1 * (1.0 - thickness);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// ── BC.W-GOOBLOB-MEATBALL — the soft contact shadow (T2). A procedural soft shadow that
|
|
1069
|
+
// FOLLOWS the irregular silhouette: march from this fragment's uv toward the in-plane
|
|
1070
|
+
// projection of uLightDir; where the metaball field occludes the light (the body
|
|
1071
|
+
// shadows itself opposite the light, a satellite shadows the body across the neck), the
|
|
1072
|
+
// march returns < 1 and DARKENS the OKLCh L — a soft grounded contact band UNDER the
|
|
1073
|
+
// dome, congruent with (but PROCEDURAL, silhouette-following, unlike) the CSS gel-dome
|
|
1074
|
+
// drop-shadow. Concentrated on the AWAY-facing lower rim (an away-facing weight × a
|
|
1075
|
+
// thin-rim Gaussian band) so the deep-lit interior + the light-facing edge stay bright
|
|
1076
|
+
// and the grounded shadow reads at the lower silhouette edge — the warm-cream body mean
|
|
1077
|
+
// holds. Gated uShadow > 0.5; variant=blob (STAGE 1) ships shadowless. ──
|
|
1078
|
+
if (uShadow > 0.5) {
|
|
1079
|
+
let L2 = normalize(uLightDir.xy + vec2<f32>(1e-6));
|
|
1080
|
+
// w increases with the inverse light-source size → uShadowSoftness (a harder penumbra at a
|
|
1081
|
+
// higher value). Start the march just off the surface so a fragment never self-shadows
|
|
1082
|
+
// at t=0; cap the reach at the body span.
|
|
1083
|
+
let sh = softShadow2D(uv, L2, max(aa, 0.004), bodyR * 1.5, max(uShadowSoftness, 4.0));
|
|
1084
|
+
// The contact band sits on the LOWER rim (the side AWAY from the light) — gated by
|
|
1085
|
+
// dot(fieldGrad, L2) < 0 (the rim facing away from L2) AND the thin-rim weight
|
|
1086
|
+
// (a Gaussian band peaking at thickness ≈ 0.18 so the deep-lit interior + the
|
|
1087
|
+
// light-facing edge stay BRIGHT — the warm-cream body mean holds). The 0.20 cap keeps
|
|
1088
|
+
// it a soft GROUNDING whisper, never a gouge (the warm-cream identity + the
|
|
1089
|
+
// proof:blob-warm-default floor hold).
|
|
1090
|
+
let away = clamp(-dot(normalize(fieldGrad + vec2<f32>(1e-6)), L2), 0.0, 1.0);
|
|
1091
|
+
let band = exp(-pow((thickness - 0.18) / 0.16, 2.0));
|
|
1092
|
+
let shadowDarken = (1.0 - sh) * away * band * 0.20;
|
|
1093
|
+
oklch.x = max(oklch.x - shadowDarken, 0.0);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
oklch = gamutClampOklch(oklch);
|
|
1097
|
+
|
|
1098
|
+
var lin = oklabToLinearSrgb(oklchToOklab(oklch));
|
|
1099
|
+
|
|
1100
|
+
// ── W9.b lit glass surface — Blinn-Phong glint + Fresnel rim, in LINEAR ──
|
|
1101
|
+
if (uLit > 0.5) {
|
|
1102
|
+
let L = normalize(uLightDir + vec3<f32>(1e-6));
|
|
1103
|
+
let H = normalize(L + V);
|
|
1104
|
+
|
|
1105
|
+
let warmCream = oklabToLinearSrgb(oklchToOklab(vec3<f32>(0.97, 0.03, radians(85.0))));
|
|
1106
|
+
|
|
1107
|
+
// ── fwidth SITE #2 — Toksvig normal-variance specular clamp. nVar is the HOISTED
|
|
1108
|
+
// length(fwidth(N)) (BC.W-GOOBLOB-MEATBALL — computed once at the top of fs_main
|
|
1109
|
+
// in uniform control flow, so the WGSL primary ARMS on Metal). The math is
|
|
1110
|
+
// byte-identical to the GLSL fallback (length(fwidth(N))); only its evaluation
|
|
1111
|
+
// point moved out of this non-uniform if (uLit > 0.5) branch. ──
|
|
1112
|
+
let shininess = uSpecShininess / (1.0 + 24.0 * nVar);
|
|
1113
|
+
let energyNorm = (shininess + 2.0) / 8.0;
|
|
1114
|
+
let spec = pow(max(dot(N, H), 0.0), shininess) * uSpecStrength * energyNorm;
|
|
1115
|
+
|
|
1116
|
+
var rimOkl = oklabToOklch(srgbToOklab(uRimColor));
|
|
1117
|
+
let bodyL = oklch.x;
|
|
1118
|
+
let dL = abs(rimOkl.x - bodyL);
|
|
1119
|
+
let lack = clamp((0.22 - dL) / 0.22, 0.0, 1.0);
|
|
1120
|
+
// target is a WGSL RESERVED word (W3C WGSL 16.2) so a "var target" declaration is an
|
|
1121
|
+
// invalid identifier: the shader module fails to compile and the WGSL primary never
|
|
1122
|
+
// arms (the GooBlob reserved-keyword bug BC.W-WEBGPU-EVERYWHERE W7 catches). Renamed to
|
|
1123
|
+
// a valid identifier; the math + the value are byte-identical.
|
|
1124
|
+
var targetL = 0.18;
|
|
1125
|
+
if (bodyL < 0.5) { targetL = 0.92; }
|
|
1126
|
+
rimOkl.x = clamp(mix(rimOkl.x, targetL, lack), 0.0, 1.0);
|
|
1127
|
+
rimOkl.y = rimOkl.y * mix(1.0, 0.5, lack);
|
|
1128
|
+
let rimLin = oklabToLinearSrgb(oklchToOklab(rimOkl));
|
|
1129
|
+
|
|
1130
|
+
let rimFres = pow(1.0 - max(dot(N, V), 0.0), uRimPower);
|
|
1131
|
+
let rim = rimFres * uRimStrength * (1.0 - 0.6 * thickness);
|
|
1132
|
+
|
|
1133
|
+
var highlight = max(warmCream * spec, rimLin * rim);
|
|
1134
|
+
highlight = min(highlight, vec3<f32>(0.85));
|
|
1135
|
+
lin = lin + highlight;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
var rgb = clamp(linearToSrgb(lin), vec3<f32>(0.0), vec3<f32>(1.0));
|
|
1139
|
+
|
|
1140
|
+
// IGN dither — 1-LSB triangular dither in DISPLAY space, AFTER linearToSrgb.
|
|
1141
|
+
let fragCoord = in.pos.xy;
|
|
1142
|
+
let ign = fract(52.9829189 * fract(dot(fragCoord, vec2<f32>(0.06711056, 0.00583715))));
|
|
1143
|
+
rgb = clamp(rgb + (ign - 0.5) / 255.0, vec3<f32>(0.0), vec3<f32>(1.0));
|
|
1144
|
+
|
|
1145
|
+
// premultiply AFTER the OETF: straight-alpha gamma → premultiplied.
|
|
1146
|
+
return vec4<f32>(rgb * alpha, alpha);
|
|
1147
|
+
}
|
|
1148
|
+
`, Q = 592, $ = {
|
|
1149
|
+
s0: 0,
|
|
1150
|
+
s1: 4,
|
|
1151
|
+
s2: 8,
|
|
1152
|
+
s3: 12,
|
|
1153
|
+
s4: 16,
|
|
1154
|
+
s5: 20,
|
|
1155
|
+
s6: 24,
|
|
1156
|
+
s7: 28,
|
|
1157
|
+
ptr: 32,
|
|
1158
|
+
base: 36,
|
|
1159
|
+
rim: 40,
|
|
1160
|
+
light: 44,
|
|
1161
|
+
res: 48,
|
|
1162
|
+
ints: 52,
|
|
1163
|
+
palette: 56,
|
|
1164
|
+
satPos: 72,
|
|
1165
|
+
trailPos: 88
|
|
1166
|
+
};
|
|
1167
|
+
function ae() {
|
|
1168
|
+
let e = new ArrayBuffer(Q);
|
|
1169
|
+
return {
|
|
1170
|
+
buffer: e,
|
|
1171
|
+
f32: new Float32Array(e),
|
|
1172
|
+
i32: new Int32Array(e)
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function oe(e, t, n, r, i, a) {
|
|
1176
|
+
let { f32: o, i32: s } = e, { params: c, rgb: l, simTimeMs: u, timeSec: d, resolveColor: f, rimColor: p, paletteStops: m } = a, { geometry: g, membrane: _, color: v, surface: y, interaction: b } = n, x = r.pointer.value, S = b.pointerAttraction + c.pointerAttraction, C = Math.max(0, Math.min(1, S)), w = r.velocity.value, T = r.pulse.value * b.clickImpulse, E = (_.pulseAmp * c.pulseAmp / .015 + T) * h, D = d * _.pulseFreq * c.pulseFreq * Math.PI * 2, O = _.noiseAmp * c.noiseAmp / .025 * h, k = g.orbitRadius * 1.2 * (1 + g.eccentricity), A = _.smoothK * c.smoothK, j = Math.max(0, k - g.satelliteRadius - g.bodyRadius), M = A > 0 ? Math.min(1.25, 1 + j / A) : 1, N = A * M * h, P = k + g.satelliteRadius, F = (Math.max(g.bodyRadius, P) + A * M + _.noiseAmp * c.noiseAmp / .025 + Math.abs(r.pulse.value) * b.clickImpulse) * h + .1;
|
|
1177
|
+
o[$.s0 + 0] = u / 1e3, o[$.s0 + 1] = g.bodyRadius * h, o[$.s0 + 2] = D, o[$.s0 + 3] = E, o[$.s1 + 0] = O, o[$.s1 + 1] = _.noiseFreq, o[$.s1 + 2] = _.noiseSpeed, o[$.s1 + 3] = _.warpAmp;
|
|
1178
|
+
let I = n.variant !== "blob";
|
|
1179
|
+
o[$.s2 + 0] = N, o[$.s2 + 1] = +(_.merge === "circular"), o[$.s2 + 2] = F, o[$.s2 + 3] = I && y.lit ? 1 : 0, o[$.s3 + 0] = y.specStrength, o[$.s3 + 1] = y.specShininess, o[$.s3 + 2] = y.rimPower, o[$.s3 + 3] = y.rimStrength, o[$.s4 + 0] = y.iridescence * c.iridScale, o[$.s4 + 1] = y.iridHue * (Math.PI / 180), o[$.s4 + 2] = y.iridSpeed, o[$.s4 + 3] = y.sssScale * c.iridScale, o[$.s5 + 0] = y.sssPower, o[$.s5 + 1] = y.coreGlow, o[$.s5 + 2] = v.hueRange + c.hueRange, o[$.s5 + 3] = v.satShift + c.satShift, o[$.s6 + 0] = v.brightnessShift + c.brightnessShift, o[$.s6 + 1] = v.colorNoiseFreq, o[$.s6 + 2] = v.colorNoiseSpeed, o[$.s6 + 3] = b.stretch, o[$.s7 + 0] = +!!r.active.value, o[$.s7 + 1] = S, o[$.s7 + 2] = b.pointerStrength * h, o[$.s7 + 3] = +(n.variant === "blob"), o[$.ptr + 0] = x.x * .5 * h, o[$.ptr + 1] = x.y * .5 * h, o[$.ptr + 2] = w.x * .5 * h, o[$.ptr + 3] = w.y * .5 * h, o[$.base + 0] = l[0], o[$.base + 1] = l[1], o[$.base + 2] = l[2], o[$.base + 3] = 0;
|
|
1180
|
+
let L = f(p);
|
|
1181
|
+
o[$.rim + 0] = L[0], o[$.rim + 1] = L[1], o[$.rim + 2] = L[2], o[$.rim + 3] = 0, o[$.light + 0] = y.lightDir[0], o[$.light + 1] = y.lightDir[1], o[$.light + 2] = y.lightDir[2], o[$.light + 3] = 0, o[$.res + 0] = t.width, o[$.res + 1] = t.height, o[$.res + 2] = I && y.shadow ? 1 : 0, o[$.res + 3] = y.shadowSoftness;
|
|
1182
|
+
let R = m, z = Math.min(R.length, 4);
|
|
1183
|
+
for (let e = 0; e < 4; e++) {
|
|
1184
|
+
let t = $.palette + e * 4, n = R[e];
|
|
1185
|
+
if (n) {
|
|
1186
|
+
let e = f(n);
|
|
1187
|
+
o[t + 0] = e[0], o[t + 1] = e[1], o[t + 2] = e[2];
|
|
1188
|
+
} else o[t + 0] = l[0], o[t + 1] = l[1], o[t + 2] = l[2];
|
|
1189
|
+
o[t + 3] = 0;
|
|
1190
|
+
}
|
|
1191
|
+
let B = i.sources;
|
|
1192
|
+
for (let e = 0; e < 4; e++) {
|
|
1193
|
+
let t = $.satPos + e * 4, n = B[e];
|
|
1194
|
+
n ? (o[t + 0] = n.x * h, o[t + 1] = n.y * h, o[t + 2] = n.radius * h, o[t + 3] = n.opacity) : (o[t + 0] = 0, o[t + 1] = 0, o[t + 2] = 0, o[t + 3] = 0);
|
|
1195
|
+
}
|
|
1196
|
+
let V = r.trailSources(g.satelliteRadius * .7 * C);
|
|
1197
|
+
for (let e = 0; e < 15; e++) {
|
|
1198
|
+
let t = $.trailPos + e * 4, n = V.sources[e];
|
|
1199
|
+
n ? (o[t + 0] = n.x * .5 * h, o[t + 1] = n.y * .5 * h, o[t + 2] = n.radius * h) : (o[t + 0] = 0, o[t + 1] = 0, o[t + 2] = 0), o[t + 3] = 0;
|
|
1200
|
+
}
|
|
1201
|
+
return s[$.ints + 0] = z, s[$.ints + 1] = B.length, s[$.ints + 2] = V.count, s[$.ints + 3] = 0, e;
|
|
1202
|
+
}
|
|
1203
|
+
//#endregion
|
|
1204
|
+
export { re as a, L as c, p as d, m as f, ie as i, I as l, ae as n, ne as o, oe as r, G as s, Q as t, j as u };
|