@nodetool-ai/gpu 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/blend/blendModes.d.ts +67 -0
- package/dist/blend/blendModes.d.ts.map +1 -0
- package/dist/blend/blendModes.js +80 -0
- package/dist/blend/blendModes.js.map +1 -0
- package/dist/blend/index.d.ts +10 -0
- package/dist/blend/index.d.ts.map +1 -0
- package/dist/blend/index.js +10 -0
- package/dist/blend/index.js.map +1 -0
- package/dist/blend/wgsl.d.ts +16 -0
- package/dist/blend/wgsl.d.ts.map +1 -0
- package/dist/blend/wgsl.js +85 -0
- package/dist/blend/wgsl.js.map +1 -0
- package/dist/compositor/compositor.d.ts +112 -0
- package/dist/compositor/compositor.d.ts.map +1 -0
- package/dist/compositor/compositor.js +353 -0
- package/dist/compositor/compositor.js.map +1 -0
- package/dist/compositor/headless.d.ts +47 -0
- package/dist/compositor/headless.d.ts.map +1 -0
- package/dist/compositor/headless.js +158 -0
- package/dist/compositor/headless.js.map +1 -0
- package/dist/compositor/index.d.ts +8 -0
- package/dist/compositor/index.d.ts.map +1 -0
- package/dist/compositor/index.js +8 -0
- package/dist/compositor/index.js.map +1 -0
- package/dist/compositor/shaders.d.ts +24 -0
- package/dist/compositor/shaders.d.ts.map +1 -0
- package/dist/compositor/shaders.js +241 -0
- package/dist/compositor/shaders.js.map +1 -0
- package/dist/compositor/transform.d.ts +49 -0
- package/dist/compositor/transform.d.ts.map +1 -0
- package/dist/compositor/transform.js +74 -0
- package/dist/compositor/transform.js.map +1 -0
- package/dist/context.d.ts +108 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +205 -0
- package/dist/context.js.map +1 -0
- package/dist/debug/premulValidator.d.ts +85 -0
- package/dist/debug/premulValidator.d.ts.map +1 -0
- package/dist/debug/premulValidator.js +239 -0
- package/dist/debug/premulValidator.js.map +1 -0
- package/dist/executor.d.ts +74 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +413 -0
- package/dist/executor.js.map +1 -0
- package/dist/fullscreenQuad.d.ts +11 -0
- package/dist/fullscreenQuad.d.ts.map +1 -0
- package/dist/fullscreenQuad.js +31 -0
- package/dist/fullscreenQuad.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +162 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +100 -0
- package/dist/module.js.map +1 -0
- package/dist/node.d.ts +38 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +140 -0
- package/dist/node.js.map +1 -0
- package/dist/pool.d.ts +30 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +33 -0
- package/dist/pool.js.map +1 -0
- package/dist/recipe.d.ts +148 -0
- package/dist/recipe.d.ts.map +1 -0
- package/dist/recipe.js +181 -0
- package/dist/recipe.js.map +1 -0
- package/dist/registry.d.ts +49 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +100 -0
- package/dist/registry.js.map +1 -0
- package/dist/shaders/_canary/passthrough/v1/module.d.ts +13 -0
- package/dist/shaders/_canary/passthrough/v1/module.d.ts.map +1 -0
- package/dist/shaders/_canary/passthrough/v1/module.js +71 -0
- package/dist/shaders/_canary/passthrough/v1/module.js.map +1 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.d.ts +16 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.d.ts.map +1 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.js +62 -0
- package/dist/shaders/alpha/premulToStraight/v1/module.js.map +1 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.d.ts +19 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.d.ts.map +1 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.js +61 -0
- package/dist/shaders/alpha/straightToPremul/v1/module.js.map +1 -0
- package/dist/shaders/color/brightnessContrast/v1/module.d.ts +17 -0
- package/dist/shaders/color/brightnessContrast/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/brightnessContrast/v1/module.js +84 -0
- package/dist/shaders/color/brightnessContrast/v1/module.js.map +1 -0
- package/dist/shaders/color/cdl/v1/module.d.ts +35 -0
- package/dist/shaders/color/cdl/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/cdl/v1/module.js +106 -0
- package/dist/shaders/color/cdl/v1/module.js.map +1 -0
- package/dist/shaders/color/channelMerge/v1/module.d.ts +22 -0
- package/dist/shaders/color/channelMerge/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/channelMerge/v1/module.js +101 -0
- package/dist/shaders/color/channelMerge/v1/module.js.map +1 -0
- package/dist/shaders/color/channelShuffle/v1/module.d.ts +29 -0
- package/dist/shaders/color/channelShuffle/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/channelShuffle/v1/module.js +94 -0
- package/dist/shaders/color/channelShuffle/v1/module.js.map +1 -0
- package/dist/shaders/color/channelSplit/v1/module.d.ts +18 -0
- package/dist/shaders/color/channelSplit/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/channelSplit/v1/module.js +90 -0
- package/dist/shaders/color/channelSplit/v1/module.js.map +1 -0
- package/dist/shaders/color/colorBalance/v1/module.d.ts +18 -0
- package/dist/shaders/color/colorBalance/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/colorBalance/v1/module.js +86 -0
- package/dist/shaders/color/colorBalance/v1/module.js.map +1 -0
- package/dist/shaders/color/cubeLut/v1/module.d.ts +14 -0
- package/dist/shaders/color/cubeLut/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/cubeLut/v1/module.js +78 -0
- package/dist/shaders/color/cubeLut/v1/module.js.map +1 -0
- package/dist/shaders/color/curves/v1/module.d.ts +31 -0
- package/dist/shaders/color/curves/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/curves/v1/module.js +102 -0
- package/dist/shaders/color/curves/v1/module.js.map +1 -0
- package/dist/shaders/color/exposure/v1/module.d.ts +15 -0
- package/dist/shaders/color/exposure/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/exposure/v1/module.js +78 -0
- package/dist/shaders/color/exposure/v1/module.js.map +1 -0
- package/dist/shaders/color/exposureTone/v1/module.d.ts +28 -0
- package/dist/shaders/color/exposureTone/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/exposureTone/v1/module.js +107 -0
- package/dist/shaders/color/exposureTone/v1/module.js.map +1 -0
- package/dist/shaders/color/filmLook/v1/module.d.ts +28 -0
- package/dist/shaders/color/filmLook/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/filmLook/v1/module.js +103 -0
- package/dist/shaders/color/filmLook/v1/module.js.map +1 -0
- package/dist/shaders/color/grade/v1/module.d.ts +35 -0
- package/dist/shaders/color/grade/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/grade/v1/module.js +182 -0
- package/dist/shaders/color/grade/v1/module.js.map +1 -0
- package/dist/shaders/color/grayscale/v1/module.d.ts +14 -0
- package/dist/shaders/color/grayscale/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/grayscale/v1/module.js +79 -0
- package/dist/shaders/color/grayscale/v1/module.js.map +1 -0
- package/dist/shaders/color/hsb/v1/module.d.ts +20 -0
- package/dist/shaders/color/hsb/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/hsb/v1/module.js +131 -0
- package/dist/shaders/color/hsb/v1/module.js.map +1 -0
- package/dist/shaders/color/hslAdjust/v1/module.d.ts +30 -0
- package/dist/shaders/color/hslAdjust/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/hslAdjust/v1/module.js +170 -0
- package/dist/shaders/color/hslAdjust/v1/module.js.map +1 -0
- package/dist/shaders/color/invert/v1/module.d.ts +15 -0
- package/dist/shaders/color/invert/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/invert/v1/module.js +85 -0
- package/dist/shaders/color/invert/v1/module.js.map +1 -0
- package/dist/shaders/color/levels/v1/module.d.ts +33 -0
- package/dist/shaders/color/levels/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/levels/v1/module.js +116 -0
- package/dist/shaders/color/levels/v1/module.js.map +1 -0
- package/dist/shaders/color/liftGammaGain/v1/module.d.ts +40 -0
- package/dist/shaders/color/liftGammaGain/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/liftGammaGain/v1/module.js +114 -0
- package/dist/shaders/color/liftGammaGain/v1/module.js.map +1 -0
- package/dist/shaders/color/posterize/v1/module.d.ts +16 -0
- package/dist/shaders/color/posterize/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/posterize/v1/module.js +80 -0
- package/dist/shaders/color/posterize/v1/module.js.map +1 -0
- package/dist/shaders/color/solarize/v1/module.d.ts +15 -0
- package/dist/shaders/color/solarize/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/solarize/v1/module.js +83 -0
- package/dist/shaders/color/solarize/v1/module.js.map +1 -0
- package/dist/shaders/color/splitToning/v1/module.d.ts +26 -0
- package/dist/shaders/color/splitToning/v1/module.d.ts.map +1 -0
- package/dist/shaders/color/splitToning/v1/module.js +95 -0
- package/dist/shaders/color/splitToning/v1/module.js.map +1 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.d.ts +23 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.js +110 -0
- package/dist/shaders/filters/blur/gaussian/v1/module.js.map +1 -0
- package/dist/shaders/filters/blur/separable/v1/module.d.ts +18 -0
- package/dist/shaders/filters/blur/separable/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/blur/separable/v1/module.js +64 -0
- package/dist/shaders/filters/blur/separable/v1/module.js.map +1 -0
- package/dist/shaders/filters/convolve3x3/v1/module.d.ts +23 -0
- package/dist/shaders/filters/convolve3x3/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/convolve3x3/v1/module.js +128 -0
- package/dist/shaders/filters/convolve3x3/v1/module.js.map +1 -0
- package/dist/shaders/filters/glow/v1/module.d.ts +26 -0
- package/dist/shaders/filters/glow/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/glow/v1/module.js +102 -0
- package/dist/shaders/filters/glow/v1/module.js.map +1 -0
- package/dist/shaders/filters/grain/v1/module.d.ts +38 -0
- package/dist/shaders/filters/grain/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/grain/v1/module.js +110 -0
- package/dist/shaders/filters/grain/v1/module.js.map +1 -0
- package/dist/shaders/filters/pixelate/v1/module.d.ts +14 -0
- package/dist/shaders/filters/pixelate/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/pixelate/v1/module.js +76 -0
- package/dist/shaders/filters/pixelate/v1/module.js.map +1 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.d.ts +17 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.js +93 -0
- package/dist/shaders/filters/sharpen/unsharpMask/v1/module.js.map +1 -0
- package/dist/shaders/filters/threshold/v1/module.d.ts +17 -0
- package/dist/shaders/filters/threshold/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/threshold/v1/module.js +71 -0
- package/dist/shaders/filters/threshold/v1/module.js.map +1 -0
- package/dist/shaders/filters/vignette/v1/module.d.ts +18 -0
- package/dist/shaders/filters/vignette/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/vignette/v1/module.js +78 -0
- package/dist/shaders/filters/vignette/v1/module.js.map +1 -0
- package/dist/shaders/filters/visualFx/v1/module.d.ts +24 -0
- package/dist/shaders/filters/visualFx/v1/module.d.ts.map +1 -0
- package/dist/shaders/filters/visualFx/v1/module.js +210 -0
- package/dist/shaders/filters/visualFx/v1/module.js.map +1 -0
- package/dist/shaders/index.d.ts +86 -0
- package/dist/shaders/index.d.ts.map +1 -0
- package/dist/shaders/index.js +161 -0
- package/dist/shaders/index.js.map +1 -0
- package/dist/shaders/keyer/chromaKey/v1/module.d.ts +25 -0
- package/dist/shaders/keyer/chromaKey/v1/module.d.ts.map +1 -0
- package/dist/shaders/keyer/chromaKey/v1/module.js +111 -0
- package/dist/shaders/keyer/chromaKey/v1/module.js.map +1 -0
- package/dist/shaders/keyer/lumaKey/v1/module.d.ts +22 -0
- package/dist/shaders/keyer/lumaKey/v1/module.d.ts.map +1 -0
- package/dist/shaders/keyer/lumaKey/v1/module.js +89 -0
- package/dist/shaders/keyer/lumaKey/v1/module.js.map +1 -0
- package/dist/shaders/mask/apply/v1/module.d.ts +16 -0
- package/dist/shaders/mask/apply/v1/module.d.ts.map +1 -0
- package/dist/shaders/mask/apply/v1/module.js +79 -0
- package/dist/shaders/mask/apply/v1/module.js.map +1 -0
- package/dist/shaders/mask/fromImage/v1/module.d.ts +18 -0
- package/dist/shaders/mask/fromImage/v1/module.d.ts.map +1 -0
- package/dist/shaders/mask/fromImage/v1/module.js +99 -0
- package/dist/shaders/mask/fromImage/v1/module.js.map +1 -0
- package/dist/shaders/mask/invert/v1/module.d.ts +12 -0
- package/dist/shaders/mask/invert/v1/module.d.ts.map +1 -0
- package/dist/shaders/mask/invert/v1/module.js +57 -0
- package/dist/shaders/mask/invert/v1/module.js.map +1 -0
- package/dist/shaders/mixer/add/v1/module.d.ts +17 -0
- package/dist/shaders/mixer/add/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/add/v1/module.js +73 -0
- package/dist/shaders/mixer/add/v1/module.js.map +1 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.d.ts +26 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.js +81 -0
- package/dist/shaders/mixer/colorOverlay/v1/module.js.map +1 -0
- package/dist/shaders/mixer/dropShadow/v1/module.d.ts +28 -0
- package/dist/shaders/mixer/dropShadow/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/dropShadow/v1/module.js +104 -0
- package/dist/shaders/mixer/dropShadow/v1/module.js.map +1 -0
- package/dist/shaders/mixer/outline/v1/module.d.ts +27 -0
- package/dist/shaders/mixer/outline/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/outline/v1/module.js +105 -0
- package/dist/shaders/mixer/outline/v1/module.js.map +1 -0
- package/dist/shaders/mixer/over/v1/module.d.ts +16 -0
- package/dist/shaders/mixer/over/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/over/v1/module.js +71 -0
- package/dist/shaders/mixer/over/v1/module.js.map +1 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.d.ts +26 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.d.ts.map +1 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.js +95 -0
- package/dist/shaders/mixer/shadowCompose/v1/module.js.map +1 -0
- package/dist/shaders/sources/angularGradient/v1/module.d.ts +18 -0
- package/dist/shaders/sources/angularGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/angularGradient/v1/module.js +67 -0
- package/dist/shaders/sources/angularGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/checkerboard/v1/module.d.ts +19 -0
- package/dist/shaders/sources/checkerboard/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/checkerboard/v1/module.js +70 -0
- package/dist/shaders/sources/checkerboard/v1/module.js.map +1 -0
- package/dist/shaders/sources/diamondGradient/v1/module.d.ts +18 -0
- package/dist/shaders/sources/diamondGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/diamondGradient/v1/module.js +61 -0
- package/dist/shaders/sources/diamondGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.d.ts +21 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.js +72 -0
- package/dist/shaders/sources/gaussianNoise/v1/module.js.map +1 -0
- package/dist/shaders/sources/linearGradient/v1/module.d.ts +21 -0
- package/dist/shaders/sources/linearGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/linearGradient/v1/module.js +72 -0
- package/dist/shaders/sources/linearGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/radialGradient/v1/module.d.ts +18 -0
- package/dist/shaders/sources/radialGradient/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/radialGradient/v1/module.js +60 -0
- package/dist/shaders/sources/radialGradient/v1/module.js.map +1 -0
- package/dist/shaders/sources/solid/v1/module.d.ts +17 -0
- package/dist/shaders/sources/solid/v1/module.d.ts.map +1 -0
- package/dist/shaders/sources/solid/v1/module.js +49 -0
- package/dist/shaders/sources/solid/v1/module.js.map +1 -0
- package/dist/shaders/transform/affine/v1/module.d.ts +36 -0
- package/dist/shaders/transform/affine/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/affine/v1/module.js +94 -0
- package/dist/shaders/transform/affine/v1/module.js.map +1 -0
- package/dist/shaders/transform/cornerPin/v1/module.d.ts +40 -0
- package/dist/shaders/transform/cornerPin/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/cornerPin/v1/module.js +109 -0
- package/dist/shaders/transform/cornerPin/v1/module.js.map +1 -0
- package/dist/shaders/transform/crop/v1/module.d.ts +26 -0
- package/dist/shaders/transform/crop/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/crop/v1/module.js +82 -0
- package/dist/shaders/transform/crop/v1/module.js.map +1 -0
- package/dist/shaders/transform/displace/v1/module.d.ts +23 -0
- package/dist/shaders/transform/displace/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/displace/v1/module.js +95 -0
- package/dist/shaders/transform/displace/v1/module.js.map +1 -0
- package/dist/shaders/transform/mirror/v1/module.d.ts +14 -0
- package/dist/shaders/transform/mirror/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/mirror/v1/module.js +73 -0
- package/dist/shaders/transform/mirror/v1/module.js.map +1 -0
- package/dist/shaders/transform/offset/v1/module.d.ts +21 -0
- package/dist/shaders/transform/offset/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/offset/v1/module.js +88 -0
- package/dist/shaders/transform/offset/v1/module.js.map +1 -0
- package/dist/shaders/transform/pad/v1/module.d.ts +26 -0
- package/dist/shaders/transform/pad/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/pad/v1/module.js +95 -0
- package/dist/shaders/transform/pad/v1/module.js.map +1 -0
- package/dist/shaders/transform/polarRemap/v1/module.d.ts +20 -0
- package/dist/shaders/transform/polarRemap/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/polarRemap/v1/module.js +95 -0
- package/dist/shaders/transform/polarRemap/v1/module.js.map +1 -0
- package/dist/shaders/transform/resize/v1/module.d.ts +20 -0
- package/dist/shaders/transform/resize/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/resize/v1/module.js +116 -0
- package/dist/shaders/transform/resize/v1/module.js.map +1 -0
- package/dist/shaders/transform/rotate90/v1/module.d.ts +25 -0
- package/dist/shaders/transform/rotate90/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/rotate90/v1/module.js +90 -0
- package/dist/shaders/transform/rotate90/v1/module.js.map +1 -0
- package/dist/shaders/transform/spherize/v1/module.d.ts +21 -0
- package/dist/shaders/transform/spherize/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/spherize/v1/module.js +94 -0
- package/dist/shaders/transform/spherize/v1/module.js.map +1 -0
- package/dist/shaders/transform/tile/v1/module.d.ts +22 -0
- package/dist/shaders/transform/tile/v1/module.d.ts.map +1 -0
- package/dist/shaders/transform/tile/v1/module.js +89 -0
- package/dist/shaders/transform/tile/v1/module.js.map +1 -0
- package/dist/shared/lumaWgsl.d.ts +14 -0
- package/dist/shared/lumaWgsl.d.ts.map +1 -0
- package/dist/shared/lumaWgsl.js +18 -0
- package/dist/shared/lumaWgsl.js.map +1 -0
- package/dist/shared/premulWgsl.d.ts +46 -0
- package/dist/shared/premulWgsl.d.ts.map +1 -0
- package/dist/shared/premulWgsl.js +90 -0
- package/dist/shared/premulWgsl.js.map +1 -0
- package/dist/texture.d.ts +54 -0
- package/dist/texture.d.ts.map +1 -0
- package/dist/texture.js +70 -0
- package/dist/texture.js.map +1 -0
- package/dist/types.d.ts +103 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/validate/wgslLinearity.d.ts +86 -0
- package/dist/validate/wgslLinearity.d.ts.map +1 -0
- package/dist/validate/wgslLinearity.js +298 -0
- package/dist/validate/wgslLinearity.js.map +1 -0
- package/dist/webgpu/index.d.ts +11 -0
- package/dist/webgpu/index.d.ts.map +1 -0
- package/dist/webgpu/index.js +11 -0
- package/dist/webgpu/index.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.affine@1` — apply an inverse 2D affine matrix to remap UV space.
|
|
3
|
+
*
|
|
4
|
+
* The params spell out a 2×3 inverse matrix: each output UV `(u, v)` maps to
|
|
5
|
+
* the source UV `(m00*u + m01*v + tx, m10*u + m11*v + ty)`. Authoring the
|
|
6
|
+
* **inverse** keeps the WGSL a single matrix-vector multiply — exactly the
|
|
7
|
+
* same pattern `compositor/transform.ts` uses for layer placement.
|
|
8
|
+
*
|
|
9
|
+
* Output dimensions are `host-specified`. Out-of-bounds samples
|
|
10
|
+
* (`u < 0 || u > 1 || v < 0 || v > 1`) return transparent black so a rotated
|
|
11
|
+
* or scaled source leaves cleanly transparent corners rather than smearing
|
|
12
|
+
* the edge color.
|
|
13
|
+
*
|
|
14
|
+
* For arbitrary rotation around the source center with scale, the host
|
|
15
|
+
* composes the inverse matrix on the CPU (`compositor/transform.ts`
|
|
16
|
+
* `layerTransformToInverseAffine` is the canonical helper); this module
|
|
17
|
+
* just consumes it.
|
|
18
|
+
*/
|
|
19
|
+
import tgpu from "typegpu";
|
|
20
|
+
import * as d from "typegpu/data";
|
|
21
|
+
import { defineModule } from "../../../../module.js";
|
|
22
|
+
export const AffineParams = d.struct({
|
|
23
|
+
m00: d.f32,
|
|
24
|
+
m01: d.f32,
|
|
25
|
+
tx: d.f32,
|
|
26
|
+
m10: d.f32,
|
|
27
|
+
m11: d.f32,
|
|
28
|
+
ty: d.f32
|
|
29
|
+
});
|
|
30
|
+
const layout = tgpu.bindGroupLayout({
|
|
31
|
+
params: { uniform: AffineParams },
|
|
32
|
+
source: { texture: "float" },
|
|
33
|
+
samp: { sampler: "filtering" }
|
|
34
|
+
});
|
|
35
|
+
const samplerDescriptor = {
|
|
36
|
+
magFilter: "linear",
|
|
37
|
+
minFilter: "linear",
|
|
38
|
+
addressModeU: "clamp-to-edge",
|
|
39
|
+
addressModeV: "clamp-to-edge"
|
|
40
|
+
};
|
|
41
|
+
export const transformAffineV1 = defineModule({
|
|
42
|
+
id: "transform.affine",
|
|
43
|
+
version: 1,
|
|
44
|
+
surface: "internal",
|
|
45
|
+
category: "transform",
|
|
46
|
+
linearity: "linear-in-rgb",
|
|
47
|
+
kind: "fragment",
|
|
48
|
+
params: AffineParams,
|
|
49
|
+
// Identity inverse affine = passthrough.
|
|
50
|
+
paramDefaults: { m00: 1, m01: 0, tx: 0, m10: 0, m11: 1, ty: 0 },
|
|
51
|
+
paramUi: {
|
|
52
|
+
m00: { label: "m00", notes: "inverse matrix row 0" },
|
|
53
|
+
m01: { label: "m01", notes: "inverse matrix row 0" },
|
|
54
|
+
tx: { label: "tx", notes: "inverse translation X" },
|
|
55
|
+
m10: { label: "m10", notes: "inverse matrix row 1" },
|
|
56
|
+
m11: { label: "m11", notes: "inverse matrix row 1" },
|
|
57
|
+
ty: { label: "ty", notes: "inverse translation Y" }
|
|
58
|
+
},
|
|
59
|
+
layout,
|
|
60
|
+
samplers: { samp: samplerDescriptor },
|
|
61
|
+
wgsl: /* wgsl */ `
|
|
62
|
+
@fragment
|
|
63
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
64
|
+
let p = layout.$.params;
|
|
65
|
+
let s = vec2f(
|
|
66
|
+
p.m00 * uv.x + p.m01 * uv.y + p.tx,
|
|
67
|
+
p.m10 * uv.x + p.m11 * uv.y + p.ty
|
|
68
|
+
);
|
|
69
|
+
// Sample unconditionally (WGSL requires textureSample in uniform control
|
|
70
|
+
// flow) and select transparent black for out-of-bounds taps. The clamp-to-
|
|
71
|
+
// edge sampler makes the discarded out-of-bounds read harmless.
|
|
72
|
+
let oob = s.x < 0.0 || s.x > 1.0 || s.y < 0.0 || s.y > 1.0;
|
|
73
|
+
let col = textureSample(layout.$.source, layout.$.samp, s);
|
|
74
|
+
return select(col, vec4f(0.0), oob);
|
|
75
|
+
}
|
|
76
|
+
`,
|
|
77
|
+
io: {
|
|
78
|
+
inputs: {
|
|
79
|
+
source: {
|
|
80
|
+
colorSpace: "linear",
|
|
81
|
+
alpha: "premultiplied",
|
|
82
|
+
bindingKinds: ["texture_2d"]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
output: {
|
|
86
|
+
colorSpace: "linear",
|
|
87
|
+
alpha: "premultiplied",
|
|
88
|
+
format: "rgba8unorm",
|
|
89
|
+
dimensions: "host-specified"
|
|
90
|
+
},
|
|
91
|
+
rod: "explicit"
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/transform/affine/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,EAAE,EAAE,CAAC,CAAC,GAAG;IACT,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,EAA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IAAI,EAAE,KAAK,EAAE,uBAAuB,EAAE;KACpD;IACD,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;CAelB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,gBAAgB;SAC7B;QACD,GAAG,EAAE,UAAU;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.cornerPin@1` — perspective warp via an inverse 3×3 homography.
|
|
3
|
+
*
|
|
4
|
+
* Each output UV `(x, y)` is mapped to source UV by
|
|
5
|
+
* `(u, v, w) = H · (x, y, 1)` and then `(u/w, v/w)`. The eight free
|
|
6
|
+
* coefficients of `H` (with `h22 = 1`) are exposed as params; the host
|
|
7
|
+
* computes them from a four-corner correspondence using the standard
|
|
8
|
+
* homography formula and passes the matrix down. Authoring the **inverse**
|
|
9
|
+
* keeps the WGSL a single multiply + divide rather than a per-pixel
|
|
10
|
+
* inverse-bilinear solve.
|
|
11
|
+
*
|
|
12
|
+
* Out-of-bounds samples return transparent black so the warped source leaves
|
|
13
|
+
* the surrounding area transparent rather than smearing the edge color.
|
|
14
|
+
* Output dimensions are `same-as:source` — pinning happens inside the
|
|
15
|
+
* source's canvas. For perspective warps onto a different canvas size, run
|
|
16
|
+
* `transform.resize` upstream or `transform.affine` for non-perspective
|
|
17
|
+
* cases.
|
|
18
|
+
*/
|
|
19
|
+
import * as d from "typegpu/data";
|
|
20
|
+
export declare const CornerPinParams: d.WgslStruct<{
|
|
21
|
+
h00: d.F32;
|
|
22
|
+
h01: d.F32;
|
|
23
|
+
h02: d.F32;
|
|
24
|
+
h10: d.F32;
|
|
25
|
+
h11: d.F32;
|
|
26
|
+
h12: d.F32;
|
|
27
|
+
h20: d.F32;
|
|
28
|
+
h21: d.F32;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const transformCornerPinV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
31
|
+
h00: d.F32;
|
|
32
|
+
h01: d.F32;
|
|
33
|
+
h02: d.F32;
|
|
34
|
+
h10: d.F32;
|
|
35
|
+
h11: d.F32;
|
|
36
|
+
h12: d.F32;
|
|
37
|
+
h20: d.F32;
|
|
38
|
+
h21: d.F32;
|
|
39
|
+
}>>;
|
|
40
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/transform/cornerPin/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,eAAe;;;;;;;;;EAS1B,CAAC;AAeH,eAAO,MAAM,oBAAoB;;;;;;;;;GAiE/B,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.cornerPin@1` — perspective warp via an inverse 3×3 homography.
|
|
3
|
+
*
|
|
4
|
+
* Each output UV `(x, y)` is mapped to source UV by
|
|
5
|
+
* `(u, v, w) = H · (x, y, 1)` and then `(u/w, v/w)`. The eight free
|
|
6
|
+
* coefficients of `H` (with `h22 = 1`) are exposed as params; the host
|
|
7
|
+
* computes them from a four-corner correspondence using the standard
|
|
8
|
+
* homography formula and passes the matrix down. Authoring the **inverse**
|
|
9
|
+
* keeps the WGSL a single multiply + divide rather than a per-pixel
|
|
10
|
+
* inverse-bilinear solve.
|
|
11
|
+
*
|
|
12
|
+
* Out-of-bounds samples return transparent black so the warped source leaves
|
|
13
|
+
* the surrounding area transparent rather than smearing the edge color.
|
|
14
|
+
* Output dimensions are `same-as:source` — pinning happens inside the
|
|
15
|
+
* source's canvas. For perspective warps onto a different canvas size, run
|
|
16
|
+
* `transform.resize` upstream or `transform.affine` for non-perspective
|
|
17
|
+
* cases.
|
|
18
|
+
*/
|
|
19
|
+
import tgpu from "typegpu";
|
|
20
|
+
import * as d from "typegpu/data";
|
|
21
|
+
import { defineModule } from "../../../../module.js";
|
|
22
|
+
export const CornerPinParams = d.struct({
|
|
23
|
+
h00: d.f32,
|
|
24
|
+
h01: d.f32,
|
|
25
|
+
h02: d.f32,
|
|
26
|
+
h10: d.f32,
|
|
27
|
+
h11: d.f32,
|
|
28
|
+
h12: d.f32,
|
|
29
|
+
h20: d.f32,
|
|
30
|
+
h21: d.f32
|
|
31
|
+
});
|
|
32
|
+
const layout = tgpu.bindGroupLayout({
|
|
33
|
+
params: { uniform: CornerPinParams },
|
|
34
|
+
source: { texture: "float" },
|
|
35
|
+
samp: { sampler: "filtering" }
|
|
36
|
+
});
|
|
37
|
+
const samplerDescriptor = {
|
|
38
|
+
magFilter: "linear",
|
|
39
|
+
minFilter: "linear",
|
|
40
|
+
addressModeU: "clamp-to-edge",
|
|
41
|
+
addressModeV: "clamp-to-edge"
|
|
42
|
+
};
|
|
43
|
+
export const transformCornerPinV1 = defineModule({
|
|
44
|
+
id: "transform.cornerPin",
|
|
45
|
+
version: 1,
|
|
46
|
+
surface: "internal",
|
|
47
|
+
category: "transform",
|
|
48
|
+
linearity: "linear-in-rgb",
|
|
49
|
+
kind: "fragment",
|
|
50
|
+
params: CornerPinParams,
|
|
51
|
+
// Identity homography: H = I (h22 = 1 implicit).
|
|
52
|
+
paramDefaults: {
|
|
53
|
+
h00: 1,
|
|
54
|
+
h01: 0,
|
|
55
|
+
h02: 0,
|
|
56
|
+
h10: 0,
|
|
57
|
+
h11: 1,
|
|
58
|
+
h12: 0,
|
|
59
|
+
h20: 0,
|
|
60
|
+
h21: 0
|
|
61
|
+
},
|
|
62
|
+
paramUi: {
|
|
63
|
+
h00: { label: "H00" },
|
|
64
|
+
h01: { label: "H01" },
|
|
65
|
+
h02: { label: "H02" },
|
|
66
|
+
h10: { label: "H10" },
|
|
67
|
+
h11: { label: "H11" },
|
|
68
|
+
h12: { label: "H12" },
|
|
69
|
+
h20: { label: "H20" },
|
|
70
|
+
h21: { label: "H21" }
|
|
71
|
+
},
|
|
72
|
+
layout,
|
|
73
|
+
samplers: { samp: samplerDescriptor },
|
|
74
|
+
wgsl: /* wgsl */ `
|
|
75
|
+
@fragment
|
|
76
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
77
|
+
let p = layout.$.params;
|
|
78
|
+
let w = p.h20 * uv.x + p.h21 * uv.y + 1.0;
|
|
79
|
+
let degenerate = abs(w) < 1e-6;
|
|
80
|
+
// Guard the perspective divide so u/v stay finite even at the singularity;
|
|
81
|
+
// those pixels are discarded by the select below anyway.
|
|
82
|
+
let wSafe = select(w, 1.0, degenerate);
|
|
83
|
+
let u = (p.h00 * uv.x + p.h01 * uv.y + p.h02) / wSafe;
|
|
84
|
+
let v = (p.h10 * uv.x + p.h11 * uv.y + p.h12) / wSafe;
|
|
85
|
+
// Sample unconditionally (textureSample must run in uniform control flow);
|
|
86
|
+
// select transparent black at the singularity or outside the source.
|
|
87
|
+
let oob = degenerate || u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0;
|
|
88
|
+
let col = textureSample(layout.$.source, layout.$.samp, vec2f(u, v));
|
|
89
|
+
return select(col, vec4f(0.0), oob);
|
|
90
|
+
}
|
|
91
|
+
`,
|
|
92
|
+
io: {
|
|
93
|
+
inputs: {
|
|
94
|
+
source: {
|
|
95
|
+
colorSpace: "linear",
|
|
96
|
+
alpha: "premultiplied",
|
|
97
|
+
bindingKinds: ["texture_2d"]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
output: {
|
|
101
|
+
colorSpace: "linear",
|
|
102
|
+
alpha: "premultiplied",
|
|
103
|
+
format: "rgba8unorm",
|
|
104
|
+
dimensions: "same-as:source"
|
|
105
|
+
},
|
|
106
|
+
rod: "explicit"
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/transform/cornerPin/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,GAAG,EAAE,CAAC,CAAC,GAAG;CACX,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;IACpC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAyB;IAC9C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;IAC/C,EAAE,EAAE,qBAAqB;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 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.crop@1` — sample a sub-rectangle of the source defined in
|
|
3
|
+
* normalized UV space.
|
|
4
|
+
*
|
|
5
|
+
* `(originX, originY, width, height)` are all in `[0, 1]` with top-left
|
|
6
|
+
* origin. Output dimensions are `derived` from the requested crop —
|
|
7
|
+
* the host allocates a target sized `(source.width * width, source.height * height)`
|
|
8
|
+
* (integer-rounded) and the module samples the corresponding region.
|
|
9
|
+
*
|
|
10
|
+
* Out-of-source samples (when the crop extends beyond `[0, 1]`) return
|
|
11
|
+
* transparent black so a crop is a *crop*, not a stretch.
|
|
12
|
+
*/
|
|
13
|
+
import * as d from "typegpu/data";
|
|
14
|
+
export declare const CropParams: d.WgslStruct<{
|
|
15
|
+
originX: d.F32;
|
|
16
|
+
originY: d.F32;
|
|
17
|
+
width: d.F32;
|
|
18
|
+
height: d.F32;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const transformCropV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
21
|
+
originX: d.F32;
|
|
22
|
+
originY: d.F32;
|
|
23
|
+
width: d.F32;
|
|
24
|
+
height: d.F32;
|
|
25
|
+
}>>;
|
|
26
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/transform/crop/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,UAAU;;;;;EAKrB,CAAC;AAeH,eAAO,MAAM,eAAe;;;;;GAgD1B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.crop@1` — sample a sub-rectangle of the source defined in
|
|
3
|
+
* normalized UV space.
|
|
4
|
+
*
|
|
5
|
+
* `(originX, originY, width, height)` are all in `[0, 1]` with top-left
|
|
6
|
+
* origin. Output dimensions are `derived` from the requested crop —
|
|
7
|
+
* the host allocates a target sized `(source.width * width, source.height * height)`
|
|
8
|
+
* (integer-rounded) and the module samples the corresponding region.
|
|
9
|
+
*
|
|
10
|
+
* Out-of-source samples (when the crop extends beyond `[0, 1]`) return
|
|
11
|
+
* transparent black so a crop is a *crop*, not a stretch.
|
|
12
|
+
*/
|
|
13
|
+
import tgpu from "typegpu";
|
|
14
|
+
import * as d from "typegpu/data";
|
|
15
|
+
import { defineModule } from "../../../../module.js";
|
|
16
|
+
export const CropParams = d.struct({
|
|
17
|
+
originX: d.f32,
|
|
18
|
+
originY: d.f32,
|
|
19
|
+
width: d.f32,
|
|
20
|
+
height: d.f32
|
|
21
|
+
});
|
|
22
|
+
const layout = tgpu.bindGroupLayout({
|
|
23
|
+
params: { uniform: CropParams },
|
|
24
|
+
source: { texture: "float" },
|
|
25
|
+
samp: { sampler: "filtering" }
|
|
26
|
+
});
|
|
27
|
+
const samplerDescriptor = {
|
|
28
|
+
magFilter: "linear",
|
|
29
|
+
minFilter: "linear",
|
|
30
|
+
addressModeU: "clamp-to-edge",
|
|
31
|
+
addressModeV: "clamp-to-edge"
|
|
32
|
+
};
|
|
33
|
+
export const transformCropV1 = defineModule({
|
|
34
|
+
id: "transform.crop",
|
|
35
|
+
version: 1,
|
|
36
|
+
surface: "internal",
|
|
37
|
+
category: "transform",
|
|
38
|
+
linearity: "linear-in-rgb",
|
|
39
|
+
kind: "fragment",
|
|
40
|
+
params: CropParams,
|
|
41
|
+
paramDefaults: { originX: 0, originY: 0, width: 1, height: 1 },
|
|
42
|
+
paramUi: {
|
|
43
|
+
originX: { min: 0, max: 1, step: 0.01, label: "Origin X" },
|
|
44
|
+
originY: { min: 0, max: 1, step: 0.01, label: "Origin Y" },
|
|
45
|
+
width: { min: 0.01, max: 1, step: 0.01, label: "Width" },
|
|
46
|
+
height: { min: 0.01, max: 1, step: 0.01, label: "Height" }
|
|
47
|
+
},
|
|
48
|
+
layout,
|
|
49
|
+
samplers: { samp: samplerDescriptor },
|
|
50
|
+
wgsl: /* wgsl */ `
|
|
51
|
+
@fragment
|
|
52
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
53
|
+
let p = layout.$.params;
|
|
54
|
+
let sampleUv = vec2f(
|
|
55
|
+
p.originX + uv.x * p.width,
|
|
56
|
+
p.originY + uv.y * p.height
|
|
57
|
+
);
|
|
58
|
+
// Sample unconditionally (textureSample must run in uniform control flow);
|
|
59
|
+
// select transparent black for taps outside the crop region.
|
|
60
|
+
let oob = sampleUv.x < 0.0 || sampleUv.x > 1.0 || sampleUv.y < 0.0 || sampleUv.y > 1.0;
|
|
61
|
+
let col = textureSample(layout.$.source, layout.$.samp, sampleUv);
|
|
62
|
+
return select(col, vec4f(0.0), oob);
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
io: {
|
|
66
|
+
inputs: {
|
|
67
|
+
source: {
|
|
68
|
+
colorSpace: "linear",
|
|
69
|
+
alpha: "premultiplied",
|
|
70
|
+
bindingKinds: ["texture_2d"]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
output: {
|
|
74
|
+
colorSpace: "linear",
|
|
75
|
+
alpha: "premultiplied",
|
|
76
|
+
format: "rgba8unorm",
|
|
77
|
+
dimensions: "derived"
|
|
78
|
+
},
|
|
79
|
+
rod: "explicit"
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/transform/crop/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,O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ACxD,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;KAC3D;IACD,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;;;;;;;;;CAclB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,SAAS;SACtB;QACD,GAAG,EAAE,UAAU;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.displace@1` — per-pixel UV offset driven by a displacement map.
|
|
3
|
+
*
|
|
4
|
+
* Each output pixel reads `(dx, dy)` from the displacement texture's R+G
|
|
5
|
+
* channels (centered: `0.5` is no offset, `0` and `1` are the extremes), scales
|
|
6
|
+
* by `(amountX, amountY)`, and samples the source at `uv + offset`. Used for
|
|
7
|
+
* heat-haze, water ripples, glass, and as the "warp by noise" building block
|
|
8
|
+
* when paired with `sources.noise` (Phase 3 Batch 1+).
|
|
9
|
+
*
|
|
10
|
+
* Output dimensions stay `same-as:source`. Out-of-range samples (after the
|
|
11
|
+
* offset pushes UV outside `[0, 1]`) return transparent black so a strong
|
|
12
|
+
* displacement leaves clean transparency instead of smearing edge color.
|
|
13
|
+
*/
|
|
14
|
+
import * as d from "typegpu/data";
|
|
15
|
+
export declare const DisplaceParams: d.WgslStruct<{
|
|
16
|
+
amountX: d.F32;
|
|
17
|
+
amountY: d.F32;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const transformDisplaceV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
20
|
+
amountX: d.F32;
|
|
21
|
+
amountY: d.F32;
|
|
22
|
+
}>>;
|
|
23
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/transform/displace/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,cAAc;;;EAGzB,CAAC;AAgBH,eAAO,MAAM,mBAAmB;;;GA6D9B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.displace@1` — per-pixel UV offset driven by a displacement map.
|
|
3
|
+
*
|
|
4
|
+
* Each output pixel reads `(dx, dy)` from the displacement texture's R+G
|
|
5
|
+
* channels (centered: `0.5` is no offset, `0` and `1` are the extremes), scales
|
|
6
|
+
* by `(amountX, amountY)`, and samples the source at `uv + offset`. Used for
|
|
7
|
+
* heat-haze, water ripples, glass, and as the "warp by noise" building block
|
|
8
|
+
* when paired with `sources.noise` (Phase 3 Batch 1+).
|
|
9
|
+
*
|
|
10
|
+
* Output dimensions stay `same-as:source`. Out-of-range samples (after the
|
|
11
|
+
* offset pushes UV outside `[0, 1]`) return transparent black so a strong
|
|
12
|
+
* displacement leaves clean transparency instead of smearing edge color.
|
|
13
|
+
*/
|
|
14
|
+
import tgpu from "typegpu";
|
|
15
|
+
import * as d from "typegpu/data";
|
|
16
|
+
import { defineModule } from "../../../../module.js";
|
|
17
|
+
export const DisplaceParams = d.struct({
|
|
18
|
+
amountX: d.f32,
|
|
19
|
+
amountY: d.f32
|
|
20
|
+
});
|
|
21
|
+
const layout = tgpu.bindGroupLayout({
|
|
22
|
+
params: { uniform: DisplaceParams },
|
|
23
|
+
source: { texture: "float" },
|
|
24
|
+
displacement: { texture: "float" },
|
|
25
|
+
samp: { sampler: "filtering" }
|
|
26
|
+
});
|
|
27
|
+
const samplerDescriptor = {
|
|
28
|
+
magFilter: "linear",
|
|
29
|
+
minFilter: "linear",
|
|
30
|
+
addressModeU: "clamp-to-edge",
|
|
31
|
+
addressModeV: "clamp-to-edge"
|
|
32
|
+
};
|
|
33
|
+
export const transformDisplaceV1 = defineModule({
|
|
34
|
+
id: "transform.displace",
|
|
35
|
+
version: 1,
|
|
36
|
+
surface: "internal",
|
|
37
|
+
category: "transform",
|
|
38
|
+
linearity: "linear-in-rgb",
|
|
39
|
+
kind: "fragment",
|
|
40
|
+
params: DisplaceParams,
|
|
41
|
+
paramDefaults: { amountX: 0.05, amountY: 0.05 },
|
|
42
|
+
paramUi: {
|
|
43
|
+
amountX: { min: -1, max: 1, step: 0.005, label: "Amount X", notes: "× UV" },
|
|
44
|
+
amountY: { min: -1, max: 1, step: 0.005, label: "Amount Y", notes: "× UV" }
|
|
45
|
+
},
|
|
46
|
+
layout,
|
|
47
|
+
samplers: { samp: samplerDescriptor },
|
|
48
|
+
wgsl: /* wgsl */ `
|
|
49
|
+
@fragment
|
|
50
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
51
|
+
let p = layout.$.params;
|
|
52
|
+
// The displacement map is premultiplied like everything in the pool, but its
|
|
53
|
+
// R/G are a straight signed control signal (0.5 = no offset). Un-premultiply
|
|
54
|
+
// to recover the true control values — otherwise a translucent displacement
|
|
55
|
+
// texel biases the offset. Fully transparent texels carry no signal at all
|
|
56
|
+
// (rgb = 0, so the divide would recover 0 → full negative offset);
|
|
57
|
+
// substitute the neutral 0.5 so uncovered map regions leave pixels in place.
|
|
58
|
+
let dispP = textureSample(layout.$.displacement, layout.$.samp, uv);
|
|
59
|
+
let disp = select(
|
|
60
|
+
vec3f(0.5),
|
|
61
|
+
dispP.rgb / max(dispP.a, 1.0 / 255.0),
|
|
62
|
+
dispP.a > 0.0
|
|
63
|
+
);
|
|
64
|
+
let offset = vec2f((disp.r - 0.5) * 2.0 * p.amountX, (disp.g - 0.5) * 2.0 * p.amountY);
|
|
65
|
+
let s = uv + offset;
|
|
66
|
+
// Sample unconditionally (textureSample must run in uniform control flow);
|
|
67
|
+
// select transparent black where the offset pushes UV outside the source.
|
|
68
|
+
let oob = s.x < 0.0 || s.x > 1.0 || s.y < 0.0 || s.y > 1.0;
|
|
69
|
+
let col = textureSample(layout.$.source, layout.$.samp, s);
|
|
70
|
+
return select(col, vec4f(0.0), oob);
|
|
71
|
+
}
|
|
72
|
+
`,
|
|
73
|
+
io: {
|
|
74
|
+
inputs: {
|
|
75
|
+
source: {
|
|
76
|
+
colorSpace: "linear",
|
|
77
|
+
alpha: "premultiplied",
|
|
78
|
+
bindingKinds: ["texture_2d"]
|
|
79
|
+
},
|
|
80
|
+
displacement: {
|
|
81
|
+
colorSpace: "linear",
|
|
82
|
+
alpha: "premultiplied",
|
|
83
|
+
bindingKinds: ["texture_2d"]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
output: {
|
|
87
|
+
colorSpace: "linear",
|
|
88
|
+
alpha: "premultiplied",
|
|
89
|
+
format: "rgba8unorm",
|
|
90
|
+
dimensions: "same-as:source"
|
|
91
|
+
},
|
|
92
|
+
rod: "same-as:source"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/transform/displace/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,GAAG;IACd,OAAO,EAAE,CAAC,CAAC,GAAG;C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EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;YACD,YAAY,EAAE;gBACZ,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,gBAAgB;SAC7B;QACD,GAAG,EAAE,gBAAgB;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.mirror@1` — flip horizontally, vertically, or both.
|
|
3
|
+
*
|
|
4
|
+
* `axes` packs the two flags into a single param: `1` → horizontal, `2` →
|
|
5
|
+
* vertical, `3` → both. Output dimensions are `same-as:source`.
|
|
6
|
+
*/
|
|
7
|
+
import * as d from "typegpu/data";
|
|
8
|
+
export declare const MirrorParams: d.WgslStruct<{
|
|
9
|
+
axes: d.F32;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const transformMirrorV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
12
|
+
axes: d.F32;
|
|
13
|
+
}>>;
|
|
14
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/transform/mirror/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,YAAY;;EAEvB,CAAC;AAeH,eAAO,MAAM,iBAAiB;;GAgD5B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.mirror@1` — flip horizontally, vertically, or both.
|
|
3
|
+
*
|
|
4
|
+
* `axes` packs the two flags into a single param: `1` → horizontal, `2` →
|
|
5
|
+
* vertical, `3` → both. Output dimensions are `same-as:source`.
|
|
6
|
+
*/
|
|
7
|
+
import tgpu from "typegpu";
|
|
8
|
+
import * as d from "typegpu/data";
|
|
9
|
+
import { defineModule } from "../../../../module.js";
|
|
10
|
+
export const MirrorParams = d.struct({
|
|
11
|
+
axes: d.f32
|
|
12
|
+
});
|
|
13
|
+
const layout = tgpu.bindGroupLayout({
|
|
14
|
+
params: { uniform: MirrorParams },
|
|
15
|
+
source: { texture: "float" },
|
|
16
|
+
samp: { sampler: "filtering" }
|
|
17
|
+
});
|
|
18
|
+
const samplerDescriptor = {
|
|
19
|
+
magFilter: "linear",
|
|
20
|
+
minFilter: "linear",
|
|
21
|
+
addressModeU: "clamp-to-edge",
|
|
22
|
+
addressModeV: "clamp-to-edge"
|
|
23
|
+
};
|
|
24
|
+
export const transformMirrorV1 = defineModule({
|
|
25
|
+
id: "transform.mirror",
|
|
26
|
+
version: 1,
|
|
27
|
+
surface: "internal",
|
|
28
|
+
category: "transform",
|
|
29
|
+
linearity: "linear-in-rgb",
|
|
30
|
+
kind: "fragment",
|
|
31
|
+
params: MirrorParams,
|
|
32
|
+
paramDefaults: { axes: 1 },
|
|
33
|
+
paramUi: {
|
|
34
|
+
axes: {
|
|
35
|
+
min: 0,
|
|
36
|
+
max: 3,
|
|
37
|
+
step: 1,
|
|
38
|
+
label: "Axes",
|
|
39
|
+
notes: "0 none / 1 H / 2 V / 3 both"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
layout,
|
|
43
|
+
samplers: { samp: samplerDescriptor },
|
|
44
|
+
wgsl: /* wgsl */ `
|
|
45
|
+
@fragment
|
|
46
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
47
|
+
let axes = i32(round(layout.$.params.axes));
|
|
48
|
+
let flipH = (axes & 1) != 0;
|
|
49
|
+
let flipV = (axes & 2) != 0;
|
|
50
|
+
var u = uv;
|
|
51
|
+
if (flipH) { u.x = 1.0 - u.x; }
|
|
52
|
+
if (flipV) { u.y = 1.0 - u.y; }
|
|
53
|
+
return textureSample(layout.$.source, layout.$.samp, u);
|
|
54
|
+
}
|
|
55
|
+
`,
|
|
56
|
+
io: {
|
|
57
|
+
inputs: {
|
|
58
|
+
source: {
|
|
59
|
+
colorSpace: "linear",
|
|
60
|
+
alpha: "premultiplied",
|
|
61
|
+
bindingKinds: ["texture_2d"]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
output: {
|
|
65
|
+
colorSpace: "linear",
|
|
66
|
+
alpha: "premultiplied",
|
|
67
|
+
format: "rgba8unorm",
|
|
68
|
+
dimensions: "same-as:source"
|
|
69
|
+
},
|
|
70
|
+
rod: "same-as:source"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../src/shaders/transform/mirror/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,GAAG;CACZ,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;IAClC,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;IACjC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAyB;IAC9C,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;IAC5C,EAAE,EAAE,kBAAkB;IACtB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;IAC1B,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,6BAA6B;SACrC;KACF;IACD,MAAM;IACN,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACrC,IAAI,EAAE,UAAU,CAAC;;;;;;;;;;;CAWlB;IACC,EAAE,EAAE;QACF,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,CAAC,YAAY,CAAC;aAC7B;SACF;QACD,MAAM,EAAE;YACN,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,gBAAgB;SAC7B;QACD,GAAG,EAAE,gBAAgB;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transform.offset@1` — translate the source by a normalized UV offset,
|
|
3
|
+
* with the address mode controlled by `wrap` (`0` clamp-to-edge,
|
|
4
|
+
* `1` repeat, `2` mirror-repeat).
|
|
5
|
+
*
|
|
6
|
+
* `dx`/`dy` are in normalized UV units (`0..1`). Output dimensions are
|
|
7
|
+
* `same-as:source`; for `wrap = 0`, regions outside the original sample
|
|
8
|
+
* area return the edge color (so they don't introduce transparent pixels).
|
|
9
|
+
*/
|
|
10
|
+
import * as d from "typegpu/data";
|
|
11
|
+
export declare const OffsetParams: d.WgslStruct<{
|
|
12
|
+
dx: d.F32;
|
|
13
|
+
dy: d.F32;
|
|
14
|
+
wrap: d.F32;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const transformOffsetV1: import("../../../../module.js").ShaderModule<d.WgslStruct<{
|
|
17
|
+
dx: d.F32;
|
|
18
|
+
dy: d.F32;
|
|
19
|
+
wrap: d.F32;
|
|
20
|
+
}>>;
|
|
21
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/shaders/transform/offset/v1/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,YAAY;;;;EAIvB,CAAC;AAiBH,eAAO,MAAM,iBAAiB;;;;GAwD5B,CAAC"}
|