@luma.gl/effects 9.3.0-alpha.2 → 9.3.0-alpha.6

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.
Files changed (98) hide show
  1. package/dist/dist.dev.js +1265 -362
  2. package/dist/dist.min.js +10 -9
  3. package/dist/index.cjs +419 -258
  4. package/dist/index.cjs.map +2 -2
  5. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +1 -1
  6. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  7. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +5 -4
  8. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
  9. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +1 -1
  10. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
  11. package/dist/passes/postprocessing/image-adjust-filters/denoise.js +29 -21
  12. package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
  13. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +1 -1
  14. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  15. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +26 -32
  16. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
  17. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +1 -1
  18. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
  19. package/dist/passes/postprocessing/image-adjust-filters/noise.js +8 -7
  20. package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
  21. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +1 -1
  22. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
  23. package/dist/passes/postprocessing/image-adjust-filters/sepia.js +10 -9
  24. package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
  25. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +1 -1
  26. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
  27. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +9 -8
  28. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
  29. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +1 -1
  30. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
  31. package/dist/passes/postprocessing/image-adjust-filters/vignette.js +9 -13
  32. package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
  33. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +2 -2
  34. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
  35. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +34 -16
  36. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -1
  37. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +2 -2
  38. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
  39. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +21 -12
  40. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -1
  41. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +2 -2
  42. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
  43. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +20 -11
  44. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -1
  45. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +1 -1
  46. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
  47. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +18 -16
  48. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -1
  49. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +1 -1
  50. package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +11 -11
  51. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +2 -2
  52. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
  53. package/dist/passes/postprocessing/image-fun-filters/edgework.js +83 -12
  54. package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -1
  55. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +1 -1
  56. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
  57. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +33 -21
  58. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -1
  59. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +1 -1
  60. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
  61. package/dist/passes/postprocessing/image-fun-filters/ink.js +24 -15
  62. package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -1
  63. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +1 -1
  64. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
  65. package/dist/passes/postprocessing/image-fun-filters/magnify.js +16 -11
  66. package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -1
  67. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +2 -2
  68. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
  69. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +24 -10
  70. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -1
  71. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +2 -2
  72. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
  73. package/dist/passes/postprocessing/image-warp-filters/swirl.js +18 -13
  74. package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -1
  75. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +1 -1
  76. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
  77. package/dist/passes/postprocessing/image-warp-filters/warp.js +9 -4
  78. package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -1
  79. package/package.json +2 -2
  80. package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +5 -4
  81. package/src/passes/postprocessing/image-adjust-filters/denoise.ts +31 -23
  82. package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +28 -34
  83. package/src/passes/postprocessing/image-adjust-filters/noise.ts +8 -7
  84. package/src/passes/postprocessing/image-adjust-filters/sepia.ts +10 -9
  85. package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +9 -8
  86. package/src/passes/postprocessing/image-adjust-filters/vignette.ts +9 -13
  87. package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +36 -18
  88. package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +21 -12
  89. package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +21 -12
  90. package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +18 -16
  91. package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +11 -11
  92. package/src/passes/postprocessing/image-fun-filters/edgework.ts +84 -13
  93. package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +36 -24
  94. package/src/passes/postprocessing/image-fun-filters/ink.ts +24 -15
  95. package/src/passes/postprocessing/image-fun-filters/magnify.ts +16 -11
  96. package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +24 -10
  97. package/src/passes/postprocessing/image-warp-filters/swirl.ts +18 -13
  98. package/src/passes/postprocessing/image-warp-filters/warp.ts +9 -4
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts", "../src/passes/postprocessing/image-adjust-filters/denoise.ts", "../src/passes/postprocessing/image-adjust-filters/huesaturation.ts", "../src/passes/postprocessing/image-adjust-filters/noise.ts", "../src/passes/postprocessing/image-adjust-filters/sepia.ts", "../src/passes/postprocessing/image-adjust-filters/vibrance.ts", "../src/passes/postprocessing/image-adjust-filters/vignette.ts", "../src/passes/postprocessing/image-blur-filters/tiltshift.ts", "../src/passes/postprocessing/image-blur-filters/triangleblur.ts", "../src/passes/postprocessing/image-blur-filters/zoomblur.ts", "../src/passes/postprocessing/image-fun-filters/colorhalftone.ts", "../src/passes/postprocessing/image-fun-filters/dotscreen.ts", "../src/passes/postprocessing/image-fun-filters/edgework.ts", "../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts", "../src/passes/postprocessing/image-fun-filters/ink.ts", "../src/passes/postprocessing/image-fun-filters/magnify.ts", "../src/passes/postprocessing/image-warp-filters/warp.ts", "../src/passes/postprocessing/image-warp-filters/bulgepinch.ts", "../src/passes/postprocessing/image-warp-filters/swirl.ts", "../src/passes/postprocessing/fxaa/fxaa.ts"],
4
- "sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// POST PROCESSING / SHADER PASS MODULES\n\n// glfx image adjustment shader modules\nexport type {\n BrightnessContrastProps,\n BrightnessContrastUniforms\n} from './passes/postprocessing/image-adjust-filters/brightnesscontrast';\nexport {brightnessContrast} from './passes/postprocessing/image-adjust-filters/brightnesscontrast';\nexport type {\n DenoiseProps,\n DenoiseUniforms\n} from './passes/postprocessing/image-adjust-filters/denoise';\nexport {denoise} from './passes/postprocessing/image-adjust-filters/denoise';\nexport type {\n HueSaturationProps,\n HueSaturationUniforms\n} from './passes/postprocessing/image-adjust-filters/huesaturation';\nexport {hueSaturation} from './passes/postprocessing/image-adjust-filters/huesaturation';\nexport type {NoiseProps, NoiseUniforms} from './passes/postprocessing/image-adjust-filters/noise';\nexport {noise} from './passes/postprocessing/image-adjust-filters/noise';\nexport type {SepiaProps, SepiaUniforms} from './passes/postprocessing/image-adjust-filters/sepia';\nexport {sepia} from './passes/postprocessing/image-adjust-filters/sepia';\nexport type {\n VibranceProps,\n VibranceUniforms\n} from './passes/postprocessing/image-adjust-filters/vibrance';\nexport {vibrance} from './passes/postprocessing/image-adjust-filters/vibrance';\nexport type {\n VignetteProps,\n VignetteUniforms\n} from './passes/postprocessing/image-adjust-filters/vignette';\nexport {vignette} from './passes/postprocessing/image-adjust-filters/vignette';\n\n// glfx BLUR shader modules\nexport type {\n TiltShiftProps,\n TiltShiftUniforms\n} from './passes/postprocessing/image-blur-filters/tiltshift';\nexport {tiltShift} from './passes/postprocessing/image-blur-filters/tiltshift';\nexport type {\n TriangleBlurProps,\n TriangleBlurUniforms\n} from './passes/postprocessing/image-blur-filters/triangleblur';\nexport {triangleBlur} from './passes/postprocessing/image-blur-filters/triangleblur';\nexport type {\n ZoomBlurProps,\n ZoomBlurUniforms\n} from './passes/postprocessing/image-blur-filters/zoomblur';\nexport {zoomBlur} from './passes/postprocessing/image-blur-filters/zoomblur';\n\n// glfx FUN shader modules\nexport type {\n ColorHalftoneProps,\n ColorHalftoneUniforms\n} from './passes/postprocessing/image-fun-filters/colorhalftone';\nexport {colorHalftone} from './passes/postprocessing/image-fun-filters/colorhalftone';\nexport type {\n DotScreenProps,\n DotScreenUniforms\n} from './passes/postprocessing/image-fun-filters/dotscreen';\nexport {dotScreen} from './passes/postprocessing/image-fun-filters/dotscreen';\nexport type {\n EdgeWorkProps,\n EdgeWorkUniforms\n} from './passes/postprocessing/image-fun-filters/edgework';\nexport {edgeWork} from './passes/postprocessing/image-fun-filters/edgework';\nexport type {\n HexagonalPixelateProps,\n HexagonalPixelateUniforms\n} from './passes/postprocessing/image-fun-filters/hexagonalpixelate';\nexport {hexagonalPixelate} from './passes/postprocessing/image-fun-filters/hexagonalpixelate';\nexport type {InkProps, InkUniforms} from './passes/postprocessing/image-fun-filters/ink';\nexport {ink} from './passes/postprocessing/image-fun-filters/ink';\nexport type {\n MagnifyProps,\n MagnifyUniforms\n} from './passes/postprocessing/image-fun-filters/magnify';\nexport {magnify} from './passes/postprocessing/image-fun-filters/magnify';\n\n// glfx WARP shader modules\nexport type {\n BulgePinchProps,\n BulgePinchUniforms\n} from './passes/postprocessing/image-warp-filters/bulgepinch';\nexport {bulgePinch} from './passes/postprocessing/image-warp-filters/bulgepinch';\nexport type {SwirlProps, SwirlUniforms} from './passes/postprocessing/image-warp-filters/swirl';\nexport {swirl} from './passes/postprocessing/image-warp-filters/swirl';\n\n// Postprocessing modules\n// export type {FXAAProps, FXAAUniforms} from './passes/postprocessing/fxaa/fxaa';\nexport {fxaa} from './passes/postprocessing/fxaa/fxaa';\n\n// experimental modules\nexport type {WarpProps, WarpUniforms} from './passes/postprocessing/image-warp-filters/warp';\nexport {warp as _warp} from './passes/postprocessing/image-warp-filters/warp';\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct brightnessContrastUniforms {\n brightness: f32,\n contrast: f32\n};\n\n// Binding 0:1 is reserved for shader passes\n@group(0) @binding(1) var<uniform> brightnessContrast : brightnessContrastUniforms;\n\nfn brightnessContrast_filterColor_ext(color: vec4f, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4f {\n color.rgb += brightnessContrast.brightness;\n if (brightnessContrast.contrast > 0.0) {\n color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;\n } else {\n color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;\n }\n return vec4f(1.0, 0.0, 0.0, 1.0);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform brightnessContrastUniforms {\n float brightness;\n float contrast;\n} brightnessContrast;\n\nvec4 brightnessContrast_filterColor(vec4 color) {\n color.rgb += brightnessContrast.brightness;\n if (brightnessContrast.contrast > 0.0) {\n color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;\n } else {\n color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;\n }\n return color;\n}\n\nvec4 brightnessContrast_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return brightnessContrast_filterColor(color);\n}\n`;\n\nexport type BrightnessContrastProps = {\n brightness?: number;\n contrast?: number;\n};\n\nexport type BrightnessContrastUniforms = BrightnessContrastProps;\n\n/**\n * Brightness / Contrast -\n * Provides additive brightness and multiplicative contrast control.\n * @param brightness -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)\n * @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\nexport const brightnessContrast = {\n name: 'brightnessContrast',\n source,\n fs,\n\n props: {} as BrightnessContrastProps,\n uniformTypes: {\n brightness: 'f32',\n contrast: 'f32'\n },\n defaultUniforms: {\n brightness: 0,\n contrast: 0\n },\n propTypes: {\n brightness: {format: 'f32', value: 0, min: -1, max: 1},\n contrast: {format: 'f32', value: 0, min: -1, max: 1}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<BrightnessContrastProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\n// Do a 9x9 bilateral box filter\nconst source = /* wgsl */ `\\\n\nstruct denoiseUniforms {\n strength: f32\n};\n\n@group(0), @binding(1) var<uniform> denoise: denoiseUniforms;\n\nfn denoise_sampleColor(source: sampler2D, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {\n\tlet adjustedExponent: f32 = 3. + 200. * pow(1. - denoise.strength, 4.);\n\tlet center: vec4<f32> = sample_texture(BUFFER_source, texCoord);\n\tvar color: vec4<f32> = vec4<f32>(0.);\n\tvar total: f32 = 0.;\n\n\tfor (var x: f32 = -4.; x <= 4.; x = x + (1.)) {\n\n\t\tfor (var y: f32 = -4.; y <= 4.; y = y + (1.)) {\n\t\t\tlet offsetColor: vec4<f32> = sample_texture(BUFFER_source, texCoord + vec2<f32>(x, y) / texSize);\n\t\t\tvar weight: f32 = 1. - abs(dot(offsetColor.rgb - center.rgb, vec3<f32>(0.25)));\n\t\t\tweight = pow(weight, adjustedExponent);\n\t\t\tcolor = color + (offsetColor * weight);\n\t\t\ttotal = total + (weight);\n\t\t}\n\n\t}\n\n\treturn color / total;\n} \n`;\n\nconst fs = /* glsl */ `\\\nuniform dedenoiseUniforms {\n float strength;\n} denoise;\n\nvec4 dedenoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n float adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);\n\n vec4 center = texture(source, texCoord);\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (float x = -4.0; x <= 4.0; x += 1.0) {\n for (float y = -4.0; y <= 4.0; y += 1.0) {\n vec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);\n float weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));\n weight = pow(weight, adjustedExponent);\n color += offsetColor * weight;\n total += weight;\n }\n }\n\n return color / total;\n}\n`;\n\n/**\n * Denoise -\n * Smooths over grainy noise in dark images using an 9x9 box filter\n * weighted by color intensity, similar to a bilateral filter.\n */\nexport type DenoiseProps = {\n /**\n * The exponent of the color intensity difference, should be greater\n * than zero. A value of zero just gives an 9x9 box blur and high values\n * give the original image, but ideal values are usually around 10-20.\n */\n strength?: number;\n};\n\nexport type DenoiseUniforms = DenoiseProps;\n\n/**\n * Denoise -\n * Smooths over grainy noise in dark images using an 9x9 box filter\n * weighted by color intensity, similar to a bilateral filter.\n */\nexport const denoise = {\n props: {} as DenoiseProps,\n uniforms: {} as DenoiseUniforms,\n\n name: 'denoise',\n uniformTypes: {\n strength: 'f32'\n },\n propTypes: {\n strength: {format: 'f32', value: 0.5, min: 0, max: 1}\n // strength: {..., adjust: (strength: number): number => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing\n },\n\n source,\n fs,\n\n passes: [{sampler: true}, {sampler: true}]\n} as const satisfies ShaderPass<DenoiseProps, DenoiseUniforms>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\n\nstruct hueSaturationUniforms {\n hue: f32,\n saturation: f32,\n};\n\n@group(0), @binding(1) var<uniform> hueSaturation: hueSaturationUniforms;\n\nfn hueSaturation_filterColor(color: vec4<f32>) -> vec4<f32> {\n\tlet angle: f32 = hueSaturation.hue * 3.1415927;\n\tlet s: f32 = sin(angle);\n\tlet c: f32 = cos(angle);\n\tlet weights: vec3<f32> = (vec3<f32>(2. * c, -sqrt(3.) * s - c, sqrt(3.) * s - c) + 1.) / 3.;\n\tlet len: f32 = length(color.rgb);\n\tvar colorrgb = color.rgb;\n\tcolorrgb = vec3<f32>(dot(color.rgb, weights.xyz), dot(color.rgb, weights.zxy), dot(color.rgb, weights.yzx));\n\tcolor.r = colorrgb.x;\n\tcolor.g = colorrgb.y;\n\tcolor.b = colorrgb.z;\n\tlet average: f32 = (color.r + color.g + color.b) / 3.;\n\tif (hueSaturation.saturation > 0.) {\n\t\tvar colorrgb = color.rgb;\n\tcolorrgb = color.rgb + ((average - color.rgb) * (1. - 1. / (1.001 - hueSaturation.saturation)));\n\tcolor.r = colorrgb.x;\n\tcolor.g = colorrgb.y;\n\tcolor.b = colorrgb.z;\n\t} else { \n\t\tvar colorrgb = color.rgb;\n\tcolorrgb = color.rgb + ((average - color.rgb) * -hueSaturation.saturation);\n\tcolor.r = colorrgb.x;\n\tcolor.g = colorrgb.y;\n\tcolor.b = colorrgb.z;\n\t}\n\treturn color;\n} \n\nfn hueSaturation_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {\n\treturn hueSaturation_filterColor(color);\n} \n`;\n\nconst fs = /* glsl */ `\\\nuniform hueSaturationUniforms {\n float hue;\n float saturation;\n} hueSaturation;\n\nvec4 hueSaturation_filterColor(vec4 color) {\n // hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]\n float angle = hueSaturation.hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(color.rgb);\n color.rgb = vec3(\n dot(color.rgb, weights.xyz),\n dot(color.rgb, weights.zxy),\n dot(color.rgb, weights.yzx)\n );\n\n // saturation adjustment\n float average = (color.r + color.g + color.b) / 3.0;\n if (hueSaturation.saturation > 0.0) {\n color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n } else {\n color.rgb += (average - color.rgb) * (-hueSaturation.saturation);\n }\n\n return color;\n}\n\nvec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return hueSaturation_filterColor(color);\n}\n`;\n\n/**\n * Hue / Saturation\n */\nexport type HueSaturationProps = {\n /** -1 to 1 (-1 is 180 degree rotation in the negative direction, 0 is no change,\n * and 1 is 180 degree rotation in the positive direction) */\n hue?: number;\n /** -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) */\n saturation?: number;\n};\n\nexport type HueSaturationUniforms = HueSaturationProps;\n\n/**\n * Hue / Saturation\n * Provides rotational hue and multiplicative saturation control. RGB color space\n * can be imagined as a cube where the axes are the red, green, and blue color\n * values. Hue changing works by rotating the color vector around the grayscale\n * line, which is the straight line from black (0, 0, 0) to white (1, 1, 1).\n * Saturation is implemented by scaling all color channel values either toward\n * or away from the average color channel value.\n */\nexport const hueSaturation = {\n props: {} as HueSaturationProps,\n\n name: 'hueSaturation',\n source,\n fs,\n\n uniformTypes: {\n hue: 'f32',\n saturation: 'f32'\n },\n propTypes: {\n hue: {value: 0, min: -1, max: 1},\n saturation: {value: 0, min: -1, max: 1}\n },\n passes: [{filter: true}]\n} as const satisfies ShaderPass<HueSaturationProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct noiseUniforms {\n amount: f32\n};\n\n@group(0) @binding(1) var<uniform> noise: noiseUniforms;\n\nfn rand(co: vec2f) -> f32 {\n\treturn fract(sin(dot(co.xy, vec2f(12.9898, 78.233))) * 43758.547);\n} \n\nfn noise_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n\tlet diff: f32 = (rand(texCoord) - 0.5) * noise.amount;\n\tcolor.r = color.r + (diff);\n\tcolor.g = color.g + (diff);\n\tcolor.b = color.b + (diff);\n\treturn color;\n} \n`;\n\nconst fs = /* glsl */ `\\\nuniform noiseUniforms {\n float amount;\n} noise;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvec4 noise_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float diff = (rand(texCoord) - 0.5) * noise.amount;\n color.r += diff;\n color.g += diff;\n color.b += diff;\n return color;\n}\n`;\n\n/**\n * Noise - Adds black and white noise to the image.\n */\nexport type NoiseProps = {\n /** 0 to 1 (0 for no effect, 1 for maximum noise) */\n amount?: number;\n};\n\nexport type NoiseUniforms = NoiseProps;\n\n/**\n * Noise\n * Adds black and white noise to the image.\n */\nexport const noise = {\n name: 'noise',\n fs,\n source,\n\n props: {} as NoiseProps,\n uniforms: {} as NoiseUniforms,\n uniformTypes: {\n amount: 'f32'\n },\n propTypes: {\n amount: {value: 0.5, min: 0, max: 1}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<NoiseProps, NoiseProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct sepiaUniforms {\n amount: f32\n};\n\n@group(0) @binding(1) var<uniform> sepia: sepiaUniforms;\n\nfn sepia_filterColor(color: vec4f) -> vec4f {\n let r: f32 = color.r;\n let g: f32 = color.g;\n let b: f32 = color.b;\n\n color.r =\n min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\n color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\n color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\n\n return color;\n}\n\nvec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return sepia_filterColor(color);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform sepiaUniforms {\n float amount;\n} sepia;\n\nvec4 sepia_filterColor(vec4 color) {\n float r = color.r;\n float g = color.g;\n float b = color.b;\n\n color.r =\n min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\n color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\n color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\n\n return color;\n}\n\nvec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return sepia_filterColor(color);\n}\n`;\n\nexport type SepiaProps = {\n amount?: number;\n};\n\nexport type SepiaUniforms = SepiaProps;\n\n/**\n * @filter Sepia\n * @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.\n * @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)\n */\nexport const sepia = {\n props: {} as SepiaProps,\n uniforms: {} as SepiaUniforms,\n\n name: 'sepia',\n uniformTypes: {\n amount: 'f32'\n },\n propTypes: {\n amount: {value: 0.5, min: 0, max: 1}\n },\n fs,\n source,\n passes: [{filter: true}]\n} as const satisfies ShaderPass<SepiaProps, SepiaProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct vibranceUniforms {\n amount: f32\n};\n\n@group(0) @binding(1) var<uniform> vibrance: vibranceUniforms;\n\nfn vibrance_filterColor(vec4f color) -> vec4f {\n let average: f32 = (color.r + color.g + color.b) / 3.0;\n let mx: f32 = max(color.r, max(color.g, color.b));\n let amt: f32 = (mx - average) * (-vibrance.amount * 3.0);\n color.rgb = mix(color.rgb, vec3(mx), amt);\n return color;\n}\n\nvec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return vibrance_filterColor(color);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform vibranceUniforms {\n float amount;\n} vibrance;\n\nvec4 vibrance_filterColor(vec4 color) {\n float average = (color.r + color.g + color.b) / 3.0;\n float mx = max(color.r, max(color.g, color.b));\n float amt = (mx - average) * (-vibrance.amount * 3.0);\n color.rgb = mix(color.rgb, vec3(mx), amt);\n return color;\n}\n\nvec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return vibrance_filterColor(color);\n}\n`;\n\n/**\n * Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified.\n */\nexport type VibranceProps = {\n /** -1 to 1 (-1 is minimum vibrance, 0 is no change, and 1 is maximum vibrance) */\n amount?: number;\n};\n\nexport type VibranceUniforms = VibranceProps;\n\n/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */\nexport const vibrance = {\n props: {} as VibranceProps,\n uniforms: {} as VibranceUniforms,\n name: 'vibrance',\n uniformTypes: {\n amount: 'f32'\n },\n propTypes: {\n amount: {value: 0, min: -1, max: 1}\n },\n source,\n fs,\n passes: [{filter: true}]\n} as const satisfies ShaderPass<VibranceProps, VibranceProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct vignetteUniforms {\n radius: f32,\n amount: f32\n};\n\n@group(0) @binding(1) var<uniform> vignette: vignetteUniforms;\n\nfn vibrance_filterColor(color: vec4f) -> vec4f {\n let average: f32 = (color.r + color.g + color.b) / 3.0;\n let mx: f32 = max(color.r, max(color.g, color.b));\n let amt: f32 = (mx - average) * (-vibrance.amount * 3.0);\n color.rgb = mix(color.rgb, vec3f(mx), amt);\n return color;\n}\n\nfn vignette_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) ->vec4f {\n let dist: f32 = distance(texCoord, vec2f(0.5, 0.5));\n let ratio: f32 = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));\n return color.rgba * ratio + (1.0 - ratio)*vec4f(0.0, 0.0, 0.0, 1.0);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform vignetteUniforms {\n float radius;\n float amount;\n} vignette;\n\nvec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float dist = distance(texCoord, vec2(0.5, 0.5));\n float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));\n return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);\n}\n`;\n\n/**\n * Vignette - Adds a simulated lens edge darkening effect.\n */\nexport type VignetteProps = {\n /** 0 to 1 (0 for center of frame, 1 for edge of frame) */\n radius?: number;\n /** 0 to 1 (0 for no effect, 1 for maximum lens darkening) */\n amount?: number;\n};\n\nexport type VignetteUniforms = VignetteProps;\n\n/**\n * Vignette -\n * Adds a simulated lens edge darkening effect.\n */\nexport const vignette = {\n props: {} as VignetteProps,\n uniforms: {} as VignetteUniforms,\n\n name: 'vignette',\n source,\n fs,\n\n uniformTypes: {\n radius: 'f32',\n amount: 'f32'\n },\n defaultUniforms: {\n radius: 0.5,\n amount: 0.5\n },\n propTypes: {\n radius: {value: 0.5, min: 0, max: 1},\n amount: {value: 0.5, min: 0, max: 1}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<VignetteProps, VignetteProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nuniform tiltShiftUniforms {\n blurRadius: f32,\n gradientRadius: f32,\n start: vec2f,\n end: vec2f,\n invert: u32,\n};\n\n@group(0) @binding(1) var<uniform> tiltShift: tiltShiftUniforms;\n\nfn tiltShift_getDelta(vec2 texSize) -> vec2f {\n vec2 vector = normalize((tiltShift.end - tiltShift.start) * texSize);\n return tiltShift.invert ? vec2(-vector.y, vector.x) : vector;\n}\n\nfn tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n vec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));\n float radius = smoothstep(0.0, 1.0,\n abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform tiltShiftUniforms {\n float blurRadius;\n float gradientRadius;\n vec2 start;\n vec2 end;\n bool invert;\n} tiltShift;\n\nvec2 tiltShift_getDelta(vec2 texSize) {\n vec2 vector = normalize((tiltShift.end - tiltShift.start) * texSize);\n return tiltShift.invert ? vec2(-vector.y, vector.x) : vector;\n}\n\nvec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n vec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));\n float radius = smoothstep(0.0, 1.0,\n abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n`;\n\n/**\n * Tilt Shift\n * Simulates the shallow depth of field normally encountered in close-up photography\n */\nexport type TiltShiftProps = {\n /** The x,y coordinate of the start of the line segment. */\n start?: [number, number];\n /** The xm y coordinate of the end of the line segment. */\n end?: [number, number];\n /** The maximum radius of the pyramid blur. */\n blurRadius?: number;\n /** The distance from the line at which the maximum blur radius is reached. */\n gradientRadius?: number;\n /** @deprecated internal shaderpass use */\n invert?: number;\n};\n\nexport type TiltShiftUniforms = TiltShiftProps;\n\n/**\n * Tilt Shift\n * Simulates the shallow depth of field normally encountered in close-up\n * photography, which makes the scene seem much smaller than it actually\n * is. This filter assumes the scene is relatively planar, in which case\n * the part of the scene that is completely in focus can be described by\n * a line (the intersection of the focal plane and the scene). An example\n * of a planar scene might be looking at a road from above at a downward\n * angle. The image is then blurred with a blur radius that starts at zero\n * on the line and increases further from the line.\n */\nexport const tiltShift = {\n name: 'tiltShift',\n dependencies: [random],\n source,\n fs,\n\n props: {} as TiltShiftProps,\n uniforms: {} as TiltShiftUniforms,\n uniformTypes: {\n blurRadius: 'f32',\n gradientRadius: 'f32',\n start: 'vec2<f32>',\n end: 'vec2<f32>',\n invert: 'i32'\n },\n propTypes: {\n blurRadius: {value: 15, min: 0, max: 50},\n gradientRadius: {value: 200, min: 0, max: 400},\n start: {value: [0, 0]},\n end: {value: [1, 1]},\n invert: {value: 0, private: true}\n },\n\n passes: [\n {sampler: true, uniforms: {invert: 0}},\n {sampler: true, uniforms: {invert: 1}}\n ]\n} as const satisfies ShaderPass<TiltShiftProps, TiltShiftProps>;\n\n/*\nfunction tiltShift(startX, startY, endX, endY, blurRadius, gradientRadius) {\n var dx = endX - startX;\n var dy = endY - startY;\n var d = Math.sqrt(dx * dx + dy * dy);\n simpleShader.call(this, gl.tiltShift, {\n blurRadius: blurRadius,\n gradientRadius: gradientRadius,\n start: [startX, startY],\n end: [endX, endY],\n delta: [dx / d, dy / d],\n texSize: [this.width, this.height]\n });\n simpleShader.call(this, gl.tiltShift, {\n blurRadius: blurRadius,\n gradientRadius: gradientRadius,\n start: [startX, startY],\n end: [endX, endY],\n delta: [-dy / d, dx / d],\n texSize: [this.width, this.height]\n });\n\n return this;\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nuniform triangleBlurUniforms {\n radius: f32,\n delta: vec2f,\n}\n\n@group(0) @binding(1) var<uniform> triangleBlur: triangleBlurUniforms;\n\nvec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n offsetColor.rgb *= offsetColor.a;\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n\n /* switch back from pre-multiplied alpha */\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform triangleBlurUniforms {\n float radius;\n vec2 delta;\n} triangleBlur;\n\nvec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n offsetColor.rgb *= offsetColor.a;\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n\n /* switch back from pre-multiplied alpha */\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n`;\n\n/**\n * @filter Triangle Blur\n * @description This is the most basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\nexport type TriangleBlurProps = {\n /** The radius of the pyramid convolved with the image. */\n radius?: number;\n /** @deprecated internal property */\n delta?: [number, number];\n};\n\nexport type TriangleBlurUniforms = TriangleBlurProps;\n\n/**\n * @filter Triangle Blur\n * @description This is the most basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\nexport const triangleBlur = {\n name: 'triangleBlur',\n dependencies: [random],\n source,\n fs,\n\n props: {} as TriangleBlurProps,\n uniforms: {} as TriangleBlurUniforms,\n uniformTypes: {\n radius: 'f32',\n delta: 'vec2<f32>'\n },\n propTypes: {\n radius: {value: 20, min: 0, softMax: 100},\n delta: {value: [1, 0], private: true}\n },\n\n passes: [\n {sampler: true, uniforms: {delta: [1, 0]}},\n {sampler: true, uniforms: {delta: [0, 1]}}\n ]\n} as const satisfies ShaderPass<TriangleBlurProps, TriangleBlurProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\nuniform zoomBlurUniforms {\n center: vec2f,\n strength: f32,\n};\n\n@group(0) @binding(1) var<uniform> zoomBlur : zoomBlurUniforms;\n\n\nfn zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\nuniform zoomBlurUniforms {\n vec2 center;\n float strength;\n} zoomBlur;\n\nvec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n`;\n\n/**\n * Zoom Blur - Blurs the image away from a certain point, which looks like radial motion blur.\n */\nexport type ZoomBlurProps = {\n /** - The x, y coordinate of the blur origin. */\n center?: [number, number];\n /** - The strength of the blur. Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 creates a highly blurred image. */\n strength?: number;\n};\n\nexport type ZoomBlurUniforms = ZoomBlurProps;\n\n/**\n * Zoom Blur\n * Blurs the image away from a certain point, which looks like radial motion blur.\n */\nexport const zoomBlur = {\n name: 'zoomBlur',\n dependencies: [random],\n source,\n fs,\n\n props: {} as ZoomBlurProps,\n uniforms: {} as ZoomBlurUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n strength: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n strength: {value: 0.3, min: 0, softMax: 1}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<ZoomBlurProps, ZoomBlurProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct colorHalftoneUniforms {\n center: vec2f,\n angle: f32,\n size: f32.\n};\n\n@group(0) @binding(1) var<uniform> colorHalftone: colorHalftoneUniforms;\n\nfn pattern(angle: f32, scale: f32, texSize: vec2f, texCoord: vec2f) -> f32 {\n let s: f32 = sin(angle), c = cos(angle);\n let tex: vec2f = texCoord * texSize - colorHalftone.center * texSize;\n let point: vec2f = vec2(\n\t c * tex.x - s * tex.y,\n\t s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nfn colorHalftone_filterColor_ext(vec4f color, vec2f texSize, vec2f texCoord) -> vec4f {\n let scale: f32 = 3.1514 / colorHalftone.size;\n let cmy: vec3f = 1.0 - color.rgb;\n let k: f32 = min(cmy.x, min(cmy.y, cmy.z));\n\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\t cmy * 10.0 - 3.0 + vec3(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n\t pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n\t 0.0,\n\t 1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n`;\n\n// TODO pass texCoord to angle\nconst fs = /* glsl */ `\\\nuniform colorHalftoneUniforms {\n vec2 center;\n float angle;\n float size;\n} colorHalftone;\n\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - colorHalftone.center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float scale = 3.1514 / colorHalftone.size;\n vec3 cmy = 1.0 - color.rgb;\n float k = min(cmy.x, min(cmy.y, cmy.z));\n\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\t cmy * 10.0 - 3.0 + vec3(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n\t pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n\t 0.0,\n\t 1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n`;\n\n/**\n * Color Halftone -\n * Simulates a CMYK halftone rendering of the image by multiplying pixel values\n * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,\n * and black.\n */\nexport type ColorHalftoneProps = {\n /** The x,y coordinate of the pattern origin. */\n center?: [number, number];\n /** The rotation of the pattern in radians. */\n angle?: number;\n /** The diameter of a dot in pixels. */\n size?: number;\n};\n\nexport type ColorHalftoneUniforms = ColorHalftoneProps;\n\n/**\n * Color Halftone -\n * Simulates a CMYK halftone rendering of the image by multiplying pixel values\n * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,\n * and black.\n */\nexport const colorHalftone = {\n name: 'colorHalftone',\n source,\n fs,\n\n props: {} as ColorHalftoneProps,\n uniforms: {} as ColorHalftoneUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n angle: 'f32',\n size: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},\n size: {value: 4, min: 1, softMin: 3, softMax: 20}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<ColorHalftoneProps, ColorHalftoneProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nuniform dotScreenUniforms {\n center: vec2f,\n angle: f32,\n size: f32,\n};\n\n@group(0) @binding(1) dotScreen: dotScreenUniforms;\n\nfn pattern(texSize: vec2f, texCoord: vec2f) -> f32 {\n let scale: f32 = 3.1415 / dotScreen.size;\n\n let s: f32 = sin(dotScreen.angle), c = cos(dotScreen.angle);\n tex: vec2f = texCoord * texSize - dotScreen.center * texSize;\n point = vec2f( \n c: * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nfn dotScreen_filterColor_ext(vec4 color, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let average: f32 = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform dotScreenUniforms {\n vec2 center;\n float angle;\n float size;\n} dotScreen;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / dotScreen.size;\n\n float s = sin(dotScreen.angle), c = cos(dotScreen.angle);\n vec2 tex = texCoord * texSize - dotScreen.center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float average = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n`;\n\n/**\n * Dot Screen -\n * Simulates a black and white halftone rendering of the image by multiplying\n * pixel values with a rotated 2D sine wave pattern.\n */\nexport type DotScreenProps = {\n /** The x, y coordinate of the pattern origin. */\n center?: [number, number];\n /** The rotation of the pattern in radians. */\n angle?: number;\n /** The diameter of a dot in pixels. */\n size?: number;\n};\n\nexport type DotScreenUniforms = DotScreenProps;\n\n/**\n * Dot Screen -\n * Simulates a black and white halftone rendering of the image by multiplying\n * pixel values with a rotated 2D sine wave pattern.\n */\nexport const dotScreen = {\n name: 'dotScreen',\n source,\n fs,\n\n props: {} as DotScreenProps,\n uniforms: {} as DotScreenUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n angle: 'f32',\n size: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},\n size: {value: 3, min: 1, softMin: 3, softMax: 20}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<DotScreenProps, DotScreenProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct edgeWorkUniforms {\n radius: f32,\n int mode: uint32,\n};\n\n@group(0) @binding(1) var<uniform> edgeWork: edgeWorkUniforms;\n\nfn edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) -> vec4f {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform edgeWorkUniforms {\n float radius;\n int mode;\n} edgeWork;\n\nvec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n\nvec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n switch (edgeWork.mode) {\n case 0: \n return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));\n case 1: \n default:\n return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));\n }\n}\n`;\n\n/**\n * Edge Work -\n * Picks out different frequencies in the image by subtracting two\n * copies of the image blurred with different radii.\n */\nexport type EdgeWorkProps = {\n /** radius The radius of the effect in pixels. */\n radius?: number;\n /** @deprecated xy or RGB */\n mode?: 0 | 1;\n};\n\nexport type EdgeWorkUniforms = EdgeWorkProps;\n\n/**\n * Edge Work -\n * Picks out different frequencies in the image by subtracting two\n * copies of the image blurred with different radii.\n */\nexport const edgeWork = {\n name: 'edgeWork',\n dependencies: [random],\n source,\n fs,\n\n props: {} as EdgeWorkProps,\n uniforms: {} as EdgeWorkProps,\n uniformTypes: {\n radius: 'f32',\n mode: 'i32'\n },\n propTypes: {\n radius: {value: 2, min: 1, softMax: 50},\n mode: {value: 0, private: true}\n },\n\n passes: [\n {\n sampler: true,\n uniforms: {mode: 0}\n },\n {\n sampler: true,\n uniforms: {mode: 1}\n }\n ]\n} as const satisfies ShaderPass<EdgeWorkProps, EdgeWorkProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct hexagonalPixelateUniforms {\n center: vec2f,\n scale: f32,\n};\n\n@group(0) @binding(1) var<uniform> hexagonalPixelate: hexagonalPixelateUniforms;\n\nfn hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return texture(source, choice + hexagonalPixelate.center);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform hexagonalPixelateUniforms {\n vec2 center;\n float scale;\n} hexagonalPixelate;\n\nvec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return texture(source, choice + hexagonalPixelate.center);\n}\n`;\n\n/**\n * Hexagonal Pixelate\n * Renders the image using a pattern of hexagonal tiles.\n * Tile colors are nearest-neighbor sampled from the centers of the tiles.\n */\nexport type HexagonalPixelateProps = {\n /** The [x, y] coordinates of the pattern center. */\n center?: [number, number];\n /** The width of an individual tile, in pixels. */\n scale?: number;\n};\n\nexport type HexagonalPixelateUniforms = HexagonalPixelateProps;\n\n/**\n * Hexagonal Pixelate\n * Renders the image using a pattern of hexagonal tiles. Tile colors\n * are nearest-neighbor sampled from the centers of the tiles.\n */\nexport const hexagonalPixelate = {\n name: 'hexagonalPixelate',\n source,\n fs,\n\n props: {} as HexagonalPixelateProps,\n uniforms: {} as HexagonalPixelateUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n scale: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5], hint: 'screenspace'},\n scale: {value: 10, min: 1, softMin: 5, softMax: 50}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<HexagonalPixelateProps, HexagonalPixelateProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nuniform inkUniforms {\n strength: f32,\n};\n\n@group(0) @binding(1) var<uniform> ink: inkUniforms;\n\nfn ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 dx = vec2(1.0 / texSize.x, 0.0);\n vec2 dy = vec2(0.0, 1.0 / texSize.y);\n vec4 color = texture(source, texCoord);\n float bigTotal = 0.0;\n float smallTotal = 0.0;\n vec3 bigAverage = vec3(0.0);\n vec3 smallAverage = vec3(0.0);\n for (float x = -2.0; x <= 2.0; x += 1.0) {\n for (float y = -2.0; y <= 2.0; y += 1.0) {\n vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform inkUniforms {\n float strength;\n} ink;\n\nvec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 dx = vec2(1.0 / texSize.x, 0.0);\n vec2 dy = vec2(0.0, 1.0 / texSize.y);\n vec4 color = texture(source, texCoord);\n float bigTotal = 0.0;\n float smallTotal = 0.0;\n vec3 bigAverage = vec3(0.0);\n vec3 smallAverage = vec3(0.0);\n for (float x = -2.0; x <= 2.0; x += 1.0) {\n for (float y = -2.0; y <= 2.0; y += 1.0) {\n vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n`;\n\n/**\n * Ink -\n * Simulates outlining the image in ink by darkening edges stronger than a\n * certain threshold. The edge detection value is the difference of two\n * copies of the image, each blurred using a blur of a different radius.\n */\nexport type InkProps = {\n /** The multiplicative scale of the ink edges.\n * Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 adds lots of black edges.\n * Negative strength values will create white ink edges instead of black ones.\n */\n strength?: number;\n};\n\nexport type InkUniforms = InkProps;\n\n/**\n * Ink -\n * Simulates outlining the image in ink by darkening edges stronger than a\n * certain threshold. The edge detection value is the difference of two\n * copies of the image, each blurred using a blur of a different radius.\n */\nexport const ink = {\n name: 'ink',\n source,\n fs,\n\n props: {} as InkProps,\n uniforms: {} as InkUniforms,\n uniformTypes: {\n strength: 'f32'\n },\n propTypes: {\n strength: {value: 0.25, min: 0, softMax: 1}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<InkProps, InkProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nuniform magnifyUniforms {\n screenXY: vec2f;\n radiusPixels: f32;\n zoom: f32;\n borderWidthPixels: f32;\n borderColor: vec4f;\n};\n\n@group(0) @binding(1) var<uniform> magnify: magnifyUniforms;\n\nfn magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\n float dist = distance(texCoord * texSize, pos * texSize);\n if (dist < magnify.radiusPixels) {\n return texture(source, (texCoord - pos) / magnify.zoom + pos);\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return texture(source, texCoord);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform magnifyUniforms {\n vec2 screenXY;\n float radiusPixels;\n float zoom;\n float borderWidthPixels;\n vec4 borderColor;\n} magnify;\n\nvec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\n float dist = distance(texCoord * texSize, pos * texSize);\n if (dist < magnify.radiusPixels) {\n return texture(source, (texCoord - pos) / magnify.zoom + pos);\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return texture(source, texCoord);\n}\n`;\n\n/**\n * Magnify - display a circle with magnify effect applied to surrounding the pixels given position\n */\nexport type MagnifyProps = {\n /** x, y position in screen coords, both x and y is normalized and in range `[0, 1]`. `[0, 0]` is the up left corner, `[1, 1]` is the bottom right corner. Default value is `[0, 0]`. */\n screenXY?: [number, number];\n /** effect radius in pixels. Default value is `100`. */\n radiusPixels?: number;\n /** magnify level. Default value is `2`. */\n zoom?: number;\n /** border width of the effect circle, will not show border if value <= 0.0. Default value is `0`. */\n borderWidthPixels?: number;\n /** border color of the effect circle. Default value is `[255, 255, 255, 255]`. */\n borderColor?: [number, number, number, number];\n};\n\nexport type MagnifyUniforms = MagnifyProps;\n\n/**\n * Magnify - display a circle with magnify effect applied to surrounding the pixels given position\n */\nexport const magnify = {\n name: 'magnify',\n source,\n fs,\n\n uniformTypes: {\n screenXY: 'vec2<f32>',\n radiusPixels: 'f32',\n zoom: 'f32',\n borderWidthPixels: 'f32',\n borderColor: 'vec4<f32>'\n },\n propTypes: {\n // range 0 to 1\n screenXY: {value: [0, 0]},\n radiusPixels: 200,\n zoom: 2.0,\n borderWidthPixels: 0.0,\n borderColor: {value: [255, 255, 255, 255]}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<MagnifyProps, MagnifyProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nvec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {\n vec4 color = texture(source, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\\\nvec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {\n vec4 color = texture(source, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n return color;\n}\n`;\n\nexport type WarpProps = {};\n\nexport type WarpUniforms = WarpProps;\n\nexport const warp = {\n name: 'warp',\n source,\n fs,\n\n passes: []\n} as const satisfies ShaderPass<WarpProps, WarpProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {warp} from './warp';\n\nconst source = /* wgsl */ `\\\nuniform bulgePinchUniforms {\n radius: f32,\n strength: f32,\n center: vec2f,\n};\n\n@group(0) @binding(1) var<uniform> bulgePinch: bulgePinchUniforms;\n\nfn bulgePinch_warp(vec2 coord, vec2 texCenter) -> vec2f {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < bulgePinch.radius) {\n float percent = distance / bulgePinch.radius;\n if (bulgePinch.strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nfn bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, bulgePinch.center * texSize);\n return warp_sampleColor(source, texSize, coord);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform bulgePinchUniforms {\n float radius;\n float strength;\n vec2 center;\n} bulgePinch;\n\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < bulgePinch.radius) {\n float percent = distance / bulgePinch.radius;\n if (bulgePinch.strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, bulgePinch.center * texSize);\n\n return warp_sampleColor(source, texSize, coord);\n}\n`;\n\n/** Bulges or pinches the image in a circle. */\nexport type BulgePinchProps = {\n /** The [x, y] coordinates of the center of the circle of effect. */\n center?: [number, number];\n /** The radius of the circle of effect. */\n radius?: number;\n /** strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge) */\n strength?: number;\n};\n\nexport type BulgePinchUniforms = BulgePinchProps;\n\n/**\n * Bulge / Pinch -\n * Bulges or pinches the image in a circle.\n */\nexport const bulgePinch = {\n name: 'bulgePinch',\n dependencies: [warp],\n source,\n fs,\n\n props: {} as BulgePinchProps,\n uniforms: {} as BulgePinchUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n radius: 'f32',\n strength: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n radius: {value: 200, min: 1, softMax: 600},\n strength: {value: 0.5, min: -1, max: 1}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<BulgePinchProps, BulgePinchProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {warp} from './warp';\n\nconst source = /* wgsl */ `\\\nuniform swirlUniforms {\n radius: f32,\n angle: f32,\n center: vec2f,\n};\n\n@group(0) @binding(1) swirl: swirlUniforms;\n\nfn swirl_warp(vec2 coord, vec2 texCenter) -> vec2f {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < swirl.radius) {\n float percent = (swirl.radius - distance) / swirl.radius;\n float theta = percent * percent * swirl.angle;\n float s = sin(theta);\n float c = cos(theta);\n coord = vec2(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nfn swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {\n vec2 coord = texCoord * texSize;\n coord = swirl_warp(coord, swirl.center * texSize);\n return warp_sampleColor(source, texSize, coord);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform swirlUniforms {\n float radius;\n float angle;\n vec2 center;\n} swirl;\n\nvec2 swirl_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < swirl.radius) {\n float percent = (swirl.radius - distance) / swirl.radius;\n float theta = percent * percent * swirl.angle;\n float s = sin(theta);\n float c = cos(theta);\n coord = vec2(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = swirl_warp(coord, swirl.center * texSize);\n\n return warp_sampleColor(source, texSize, coord);\n}\n`;\n\n/**\n * Warps a circular region of the image in a swirl.\n */\nexport type SwirlProps = {\n /** [x, y] coordinates of the center of the circle of effect. default: [0.5, 0.5] */\n center?: [number, number];\n /** The radius of the circular region. */\n radius?: number;\n /** The angle in radians that the pixels in the center of the circular region will be rotated by. */\n angle?: number;\n};\n\nexport type SwirlUniforms = SwirlProps;\n\n/**\n * Warps a circular region of the image in a swirl.\n */\nexport const swirl = {\n name: 'swirl',\n dependencies: [warp],\n source,\n fs,\n\n props: {} as SwirlProps,\n uniforms: {} as SwirlProps,\n uniformTypes: {\n center: 'vec2<f32>',\n radius: 'f32',\n angle: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n radius: {value: 200, min: 1, softMax: 600},\n angle: {value: 3, softMin: -25, softMax: 25}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<SwirlProps, SwirlProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\n/**\n * ORIGINAL LICENCE\n * @license\n * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of NVIDIA CORPORATION nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// LUMA.GL\n// WebGL version from cesium.js, used under Apached 2.0 License\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// with the following modifications:\n// - fxaa_sampleColor to integrate with luma.gl\n// - Return color value with alpha to avoid another tap\n// - Calculate luminance in FxaaLuma\n\n// COMMENTS FROM CESIUM VERSION\n// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n//\n// Steps used to integrate into Cesium:\n// * The following defines are set:\n// #define FXAA_PC 1\n// #define FXAA_WEBGL_1 1\n// #define FXAA_GREEN_AS_LUMA 1\n// #define FXAA_EARLY_EXIT 1\n// #define FXAA_GLSL_120 1\n// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.\n// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace\n// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.\n// * There are no implicit conversions from ivec* to vec* so replace:\n// #define FxaaInt2 ivec2\n// with\n// #define FxaaInt2 vec2\n// * The texture2DLod function is only available in vertex shaders so replace:\n// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n// with\n// #define FxaaTexTop(t, p) texture2D(t, p)\n// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.\n// * The following parameters to FxaaPixelShader_ are unused and can be removed:\n// fxaaConsolePosPos\n// fxaaConsoleRcpFrameOpt\n// fxaaConsoleRcpFrameOpt2\n// fxaaConsole360RcpFrameOpt2\n// fxaaConsoleEdgeSharpness\n// fxaaConsoleEdgeThreshold\n// fxaaConsoleEdgeThresholdMi\n// fxaaConsole360ConstDir\n//\n// Choose the quality preset.\n// This needs to be compiled into the shader as it effects code.\n// Best option to include multiple presets is to\n// in each shader define the preset, then include this file.\n//\n// OPTIONS\n// -----------------------------------------------------------------------\n// 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n// 39 - no dither, very expensive\n//\n// NOTES\n// -----------------------------------------------------------------------\n// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n// 13 = about same speed as FXAA 3.9 and better than 12\n// 23 = closest to FXAA 3.9 visually and performance wise\n// _ = the lowest digit is directly related to performance\n// _ = the highest digit is directly related to style\n//\n\nconst fs = /* glsl */ `\n#define FXAA_QUALITY_PRESET 29\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture(t, p)\n#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))\n\nFxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n\nFxaaFloat4 FxaaPixelShader_(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaTexTop(tex, posM);\n}\n\nvec4 fxaa_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n const float fxaa_QualitySubpix = 0.5;\n const float fxaa_QualityEdgeThreshold = 0.125;\n const float fxaa_QualityEdgeThresholdMin = 0.0833;\n\n return FxaaPixelShader_(\n texCoord,\n source,\n vec2(1.0) / texSize,\n fxaa_QualitySubpix,\n fxaa_QualityEdgeThreshold,\n fxaa_QualityEdgeThresholdMin\n );\n}\n`;\n\nexport type FXAAProps = {};\nexport type FXAAUniforms = {};\n\n/**\n * FXAA - Fast Approximate Anti-aliasing.\n */\nexport const fxaa = {\n name: 'fxaa',\n propTypes: {},\n fs,\n passes: [{sampler: true}],\n getUniforms: props => props\n} as const satisfies ShaderPass<FXAAProps, FXAAUniforms, {}>;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,IAAM;;EAAoB;;;;;;;;;;;;;;;;;;;AAoB1B,IAAM;;EAAgB;;;;;;;;;;;;;;;;;;;;AAkCf,IAAM,qBAAqB;EAChC,MAAM;EACN;EACA;EAEA,OAAO,CAAA;EACP,cAAc;IACZ,YAAY;IACZ,UAAU;;EAEZ,iBAAiB;IACf,YAAY;IACZ,UAAU;;EAEZ,WAAW;IACT,YAAY,EAAC,QAAQ,OAAO,OAAO,GAAG,KAAK,IAAI,KAAK,EAAC;IACrD,UAAU,EAAC,QAAQ,OAAO,OAAO,GAAG,KAAK,IAAI,KAAK,EAAC;;EAGrD,QAAQ,CAAC,EAAC,QAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4kBf,IAAM,OAAO;EAClB,MAAM;EACN,WAAW,CAAA;EACX,IAAAA;EACA,QAAQ,CAAC,EAAC,SAAS,KAAI,CAAC;EACxB,aAAa,WAAS;;",
4
+ "sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// POST PROCESSING / SHADER PASS MODULES\n\n// glfx image adjustment shader modules\nexport type {\n BrightnessContrastProps,\n BrightnessContrastUniforms\n} from './passes/postprocessing/image-adjust-filters/brightnesscontrast';\nexport {brightnessContrast} from './passes/postprocessing/image-adjust-filters/brightnesscontrast';\nexport type {\n DenoiseProps,\n DenoiseUniforms\n} from './passes/postprocessing/image-adjust-filters/denoise';\nexport {denoise} from './passes/postprocessing/image-adjust-filters/denoise';\nexport type {\n HueSaturationProps,\n HueSaturationUniforms\n} from './passes/postprocessing/image-adjust-filters/huesaturation';\nexport {hueSaturation} from './passes/postprocessing/image-adjust-filters/huesaturation';\nexport type {NoiseProps, NoiseUniforms} from './passes/postprocessing/image-adjust-filters/noise';\nexport {noise} from './passes/postprocessing/image-adjust-filters/noise';\nexport type {SepiaProps, SepiaUniforms} from './passes/postprocessing/image-adjust-filters/sepia';\nexport {sepia} from './passes/postprocessing/image-adjust-filters/sepia';\nexport type {\n VibranceProps,\n VibranceUniforms\n} from './passes/postprocessing/image-adjust-filters/vibrance';\nexport {vibrance} from './passes/postprocessing/image-adjust-filters/vibrance';\nexport type {\n VignetteProps,\n VignetteUniforms\n} from './passes/postprocessing/image-adjust-filters/vignette';\nexport {vignette} from './passes/postprocessing/image-adjust-filters/vignette';\n\n// glfx BLUR shader modules\nexport type {\n TiltShiftProps,\n TiltShiftUniforms\n} from './passes/postprocessing/image-blur-filters/tiltshift';\nexport {tiltShift} from './passes/postprocessing/image-blur-filters/tiltshift';\nexport type {\n TriangleBlurProps,\n TriangleBlurUniforms\n} from './passes/postprocessing/image-blur-filters/triangleblur';\nexport {triangleBlur} from './passes/postprocessing/image-blur-filters/triangleblur';\nexport type {\n ZoomBlurProps,\n ZoomBlurUniforms\n} from './passes/postprocessing/image-blur-filters/zoomblur';\nexport {zoomBlur} from './passes/postprocessing/image-blur-filters/zoomblur';\n\n// glfx FUN shader modules\nexport type {\n ColorHalftoneProps,\n ColorHalftoneUniforms\n} from './passes/postprocessing/image-fun-filters/colorhalftone';\nexport {colorHalftone} from './passes/postprocessing/image-fun-filters/colorhalftone';\nexport type {\n DotScreenProps,\n DotScreenUniforms\n} from './passes/postprocessing/image-fun-filters/dotscreen';\nexport {dotScreen} from './passes/postprocessing/image-fun-filters/dotscreen';\nexport type {\n EdgeWorkProps,\n EdgeWorkUniforms\n} from './passes/postprocessing/image-fun-filters/edgework';\nexport {edgeWork} from './passes/postprocessing/image-fun-filters/edgework';\nexport type {\n HexagonalPixelateProps,\n HexagonalPixelateUniforms\n} from './passes/postprocessing/image-fun-filters/hexagonalpixelate';\nexport {hexagonalPixelate} from './passes/postprocessing/image-fun-filters/hexagonalpixelate';\nexport type {InkProps, InkUniforms} from './passes/postprocessing/image-fun-filters/ink';\nexport {ink} from './passes/postprocessing/image-fun-filters/ink';\nexport type {\n MagnifyProps,\n MagnifyUniforms\n} from './passes/postprocessing/image-fun-filters/magnify';\nexport {magnify} from './passes/postprocessing/image-fun-filters/magnify';\n\n// glfx WARP shader modules\nexport type {\n BulgePinchProps,\n BulgePinchUniforms\n} from './passes/postprocessing/image-warp-filters/bulgepinch';\nexport {bulgePinch} from './passes/postprocessing/image-warp-filters/bulgepinch';\nexport type {SwirlProps, SwirlUniforms} from './passes/postprocessing/image-warp-filters/swirl';\nexport {swirl} from './passes/postprocessing/image-warp-filters/swirl';\n\n// Postprocessing modules\n// export type {FXAAProps, FXAAUniforms} from './passes/postprocessing/fxaa/fxaa';\nexport {fxaa} from './passes/postprocessing/fxaa/fxaa';\n\n// experimental modules\nexport type {WarpProps, WarpUniforms} from './passes/postprocessing/image-warp-filters/warp';\nexport {warp as _warp} from './passes/postprocessing/image-warp-filters/warp';\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct brightnessContrastUniforms {\n brightness: f32,\n contrast: f32\n};\n\n// Binding 0:1 is reserved for shader passes\n@group(0) @binding(1) var<uniform> brightnessContrast : brightnessContrastUniforms;\n\nfn brightnessContrast_filterColor_ext(color: vec4f, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4f {\n var result = color;\n result.rgb += vec3f(brightnessContrast.brightness);\n if (brightnessContrast.contrast > 0.0) {\n result.rgb = (result.rgb - vec3f(0.5)) / (1.0 - brightnessContrast.contrast) + vec3f(0.5);\n } else {\n result.rgb = (result.rgb - vec3f(0.5)) * (1.0 + brightnessContrast.contrast) + vec3f(0.5);\n }\n return result;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform brightnessContrastUniforms {\n float brightness;\n float contrast;\n} brightnessContrast;\n\nvec4 brightnessContrast_filterColor(vec4 color) {\n color.rgb += brightnessContrast.brightness;\n if (brightnessContrast.contrast > 0.0) {\n color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;\n } else {\n color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;\n }\n return color;\n}\n\nvec4 brightnessContrast_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return brightnessContrast_filterColor(color);\n}\n`;\n\nexport type BrightnessContrastProps = {\n brightness?: number;\n contrast?: number;\n};\n\nexport type BrightnessContrastUniforms = BrightnessContrastProps;\n\n/**\n * Brightness / Contrast -\n * Provides additive brightness and multiplicative contrast control.\n * @param brightness -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)\n * @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\nexport const brightnessContrast = {\n name: 'brightnessContrast',\n source,\n fs,\n\n props: {} as BrightnessContrastProps,\n uniformTypes: {\n brightness: 'f32',\n contrast: 'f32'\n },\n defaultUniforms: {\n brightness: 0,\n contrast: 0\n },\n propTypes: {\n brightness: {format: 'f32', value: 0, min: -1, max: 1},\n contrast: {format: 'f32', value: 0, min: -1, max: 1}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<BrightnessContrastProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\n// Do a 9x9 bilateral box filter\nconst source = /* wgsl */ `\\\nstruct denoiseUniforms {\n strength: f32,\n};\n\n@group(0) @binding(1) var<uniform> denoise: denoiseUniforms;\n\nfn denoise_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let adjustedExponent = 3.0 + 200.0 * pow(1.0 - denoise.strength, 4.0);\n let center = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var color = vec4f(0.0);\n var total = 0.0;\n\n for (var x = -4.0; x <= 4.0; x += 1.0) {\n for (var y = -4.0; y <= 4.0; y += 1.0) {\n let offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + vec2f(x, y) / texSize\n );\n let weight = pow(\n 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3f(0.25))),\n adjustedExponent\n );\n color += offsetColor * weight;\n total += weight;\n }\n }\n\n return color / total;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform dedenoiseUniforms {\n float strength;\n} denoise;\n\nvec4 dedenoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n float adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);\n\n vec4 center = texture(source, texCoord);\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (float x = -4.0; x <= 4.0; x += 1.0) {\n for (float y = -4.0; y <= 4.0; y += 1.0) {\n vec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);\n float weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));\n weight = pow(weight, adjustedExponent);\n color += offsetColor * weight;\n total += weight;\n }\n }\n\n return color / total;\n}\n`;\n\n/**\n * Denoise -\n * Smooths over grainy noise in dark images using an 9x9 box filter\n * weighted by color intensity, similar to a bilateral filter.\n */\nexport type DenoiseProps = {\n /**\n * The exponent of the color intensity difference, should be greater\n * than zero. A value of zero just gives an 9x9 box blur and high values\n * give the original image, but ideal values are usually around 10-20.\n */\n strength?: number;\n};\n\nexport type DenoiseUniforms = DenoiseProps;\n\n/**\n * Denoise -\n * Smooths over grainy noise in dark images using an 9x9 box filter\n * weighted by color intensity, similar to a bilateral filter.\n */\nexport const denoise = {\n props: {} as DenoiseProps,\n uniforms: {} as DenoiseUniforms,\n\n name: 'denoise',\n uniformTypes: {\n strength: 'f32'\n },\n propTypes: {\n strength: {format: 'f32', value: 0.5, min: 0, max: 1}\n // strength: {..., adjust: (strength: number): number => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing\n },\n\n source,\n fs,\n\n passes: [{sampler: true}, {sampler: true}]\n} as const satisfies ShaderPass<DenoiseProps, DenoiseUniforms>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct hueSaturationUniforms {\n hue: f32,\n saturation: f32,\n};\n\n@group(0) @binding(1) var<uniform> hueSaturation: hueSaturationUniforms;\n\nfn hueSaturation_filterColor(color: vec4f) -> vec4f {\n let angle = hueSaturation.hue * 3.14159265;\n let s = sin(angle);\n let c = cos(angle);\n let weights = (vec3f(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + vec3f(1.0)) / 3.0;\n\n var result = color;\n result.rgb = vec3f(\n dot(result.rgb, weights.xyz),\n dot(result.rgb, weights.zxy),\n dot(result.rgb, weights.yzx)\n );\n\n let average = (result.r + result.g + result.b) / 3.0;\n if (hueSaturation.saturation > 0.0) {\n result.rgb += (vec3f(average) - result.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n } else {\n result.rgb += (vec3f(average) - result.rgb) * (-hueSaturation.saturation);\n }\n\n return result;\n}\n\nfn hueSaturation_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n return hueSaturation_filterColor(color);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform hueSaturationUniforms {\n float hue;\n float saturation;\n} hueSaturation;\n\nvec4 hueSaturation_filterColor(vec4 color) {\n // hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]\n float angle = hueSaturation.hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(color.rgb);\n color.rgb = vec3(\n dot(color.rgb, weights.xyz),\n dot(color.rgb, weights.zxy),\n dot(color.rgb, weights.yzx)\n );\n\n // saturation adjustment\n float average = (color.r + color.g + color.b) / 3.0;\n if (hueSaturation.saturation > 0.0) {\n color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n } else {\n color.rgb += (average - color.rgb) * (-hueSaturation.saturation);\n }\n\n return color;\n}\n\nvec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return hueSaturation_filterColor(color);\n}\n`;\n\n/**\n * Hue / Saturation\n */\nexport type HueSaturationProps = {\n /** -1 to 1 (-1 is 180 degree rotation in the negative direction, 0 is no change,\n * and 1 is 180 degree rotation in the positive direction) */\n hue?: number;\n /** -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) */\n saturation?: number;\n};\n\nexport type HueSaturationUniforms = HueSaturationProps;\n\n/**\n * Hue / Saturation\n * Provides rotational hue and multiplicative saturation control. RGB color space\n * can be imagined as a cube where the axes are the red, green, and blue color\n * values. Hue changing works by rotating the color vector around the grayscale\n * line, which is the straight line from black (0, 0, 0) to white (1, 1, 1).\n * Saturation is implemented by scaling all color channel values either toward\n * or away from the average color channel value.\n */\nexport const hueSaturation = {\n props: {} as HueSaturationProps,\n\n name: 'hueSaturation',\n source,\n fs,\n\n uniformTypes: {\n hue: 'f32',\n saturation: 'f32'\n },\n propTypes: {\n hue: {value: 0, min: -1, max: 1},\n saturation: {value: 0, min: -1, max: 1}\n },\n passes: [{filter: true}]\n} as const satisfies ShaderPass<HueSaturationProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct noiseUniforms {\n amount: f32,\n};\n\n@group(0) @binding(1) var<uniform> noise: noiseUniforms;\n\nfn rand(co: vec2f) -> f32 {\n\treturn fract(sin(dot(co.xy, vec2f(12.9898, 78.233))) * 43758.547);\n} \n\nfn noise_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let diff = (rand(texCoord) - 0.5) * noise.amount;\n var result = color;\n result.r += diff;\n result.g += diff;\n result.b += diff;\n return result;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform noiseUniforms {\n float amount;\n} noise;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvec4 noise_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float diff = (rand(texCoord) - 0.5) * noise.amount;\n color.r += diff;\n color.g += diff;\n color.b += diff;\n return color;\n}\n`;\n\n/**\n * Noise - Adds black and white noise to the image.\n */\nexport type NoiseProps = {\n /** 0 to 1 (0 for no effect, 1 for maximum noise) */\n amount?: number;\n};\n\nexport type NoiseUniforms = NoiseProps;\n\n/**\n * Noise\n * Adds black and white noise to the image.\n */\nexport const noise = {\n name: 'noise',\n fs,\n source,\n\n props: {} as NoiseProps,\n uniforms: {} as NoiseUniforms,\n uniformTypes: {\n amount: 'f32'\n },\n propTypes: {\n amount: {value: 0.5, min: 0, max: 1}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<NoiseProps, NoiseProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct sepiaUniforms {\n amount: f32,\n};\n\n@group(0) @binding(1) var<uniform> sepia: sepiaUniforms;\n\nfn sepia_filterColor(color: vec4f) -> vec4f {\n let r = color.r;\n let g = color.g;\n let b = color.b;\n\n var result = color;\n result.r =\n min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\n result.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\n result.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\n\n return result;\n}\n\nfn sepia_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n return sepia_filterColor(color);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform sepiaUniforms {\n float amount;\n} sepia;\n\nvec4 sepia_filterColor(vec4 color) {\n float r = color.r;\n float g = color.g;\n float b = color.b;\n\n color.r =\n min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\n color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\n color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\n\n return color;\n}\n\nvec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return sepia_filterColor(color);\n}\n`;\n\nexport type SepiaProps = {\n amount?: number;\n};\n\nexport type SepiaUniforms = SepiaProps;\n\n/**\n * @filter Sepia\n * @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.\n * @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)\n */\nexport const sepia = {\n props: {} as SepiaProps,\n uniforms: {} as SepiaUniforms,\n\n name: 'sepia',\n uniformTypes: {\n amount: 'f32'\n },\n propTypes: {\n amount: {value: 0.5, min: 0, max: 1}\n },\n fs,\n source,\n passes: [{filter: true}]\n} as const satisfies ShaderPass<SepiaProps, SepiaProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct vibranceUniforms {\n amount: f32,\n};\n\n@group(0) @binding(1) var<uniform> vibrance: vibranceUniforms;\n\nfn vibrance_filterColor(color: vec4f) -> vec4f {\n let average = (color.r + color.g + color.b) / 3.0;\n let mx = max(color.r, max(color.g, color.b));\n let amt = (mx - average) * (-vibrance.amount * 3.0);\n var result = color;\n result.rgb = mix(result.rgb, vec3f(mx), amt);\n return result;\n}\n\nfn vibrance_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n return vibrance_filterColor(color);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform vibranceUniforms {\n float amount;\n} vibrance;\n\nvec4 vibrance_filterColor(vec4 color) {\n float average = (color.r + color.g + color.b) / 3.0;\n float mx = max(color.r, max(color.g, color.b));\n float amt = (mx - average) * (-vibrance.amount * 3.0);\n color.rgb = mix(color.rgb, vec3(mx), amt);\n return color;\n}\n\nvec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return vibrance_filterColor(color);\n}\n`;\n\n/**\n * Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified.\n */\nexport type VibranceProps = {\n /** -1 to 1 (-1 is minimum vibrance, 0 is no change, and 1 is maximum vibrance) */\n amount?: number;\n};\n\nexport type VibranceUniforms = VibranceProps;\n\n/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */\nexport const vibrance = {\n props: {} as VibranceProps,\n uniforms: {} as VibranceUniforms,\n name: 'vibrance',\n uniformTypes: {\n amount: 'f32'\n },\n propTypes: {\n amount: {value: 0, min: -1, max: 1}\n },\n source,\n fs,\n passes: [{filter: true}]\n} as const satisfies ShaderPass<VibranceProps, VibranceProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct vignetteUniforms {\n radius: f32,\n amount: f32,\n};\n\n@group(0) @binding(1) var<uniform> vignette: vignetteUniforms;\n\nfn vignette_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let dist = distance(texCoord, vec2f(0.5, 0.5));\n let ratio = smoothstep(\n 0.8,\n vignette.radius * 0.799,\n dist * (vignette.amount + vignette.radius)\n );\n return color * ratio + vec4f(0.0, 0.0, 0.0, 1.0) * (1.0 - ratio);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform vignetteUniforms {\n float radius;\n float amount;\n} vignette;\n\nvec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float dist = distance(texCoord, vec2(0.5, 0.5));\n float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));\n return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);\n}\n`;\n\n/**\n * Vignette - Adds a simulated lens edge darkening effect.\n */\nexport type VignetteProps = {\n /** 0 to 1 (0 for center of frame, 1 for edge of frame) */\n radius?: number;\n /** 0 to 1 (0 for no effect, 1 for maximum lens darkening) */\n amount?: number;\n};\n\nexport type VignetteUniforms = VignetteProps;\n\n/**\n * Vignette -\n * Adds a simulated lens edge darkening effect.\n */\nexport const vignette = {\n props: {} as VignetteProps,\n uniforms: {} as VignetteUniforms,\n\n name: 'vignette',\n source,\n fs,\n\n uniformTypes: {\n radius: 'f32',\n amount: 'f32'\n },\n defaultUniforms: {\n radius: 0.5,\n amount: 0.5\n },\n propTypes: {\n radius: {value: 0.5, min: 0, max: 1},\n amount: {value: 0.5, min: 0, max: 1}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<VignetteProps, VignetteProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct tiltShiftUniforms {\n blurRadius: f32,\n gradientRadius: f32,\n start: vec2f,\n end: vec2f,\n invert: u32,\n};\n\n@group(0) @binding(1) var<uniform> tiltShift: tiltShiftUniforms;\n\nfn tiltShift_getDelta(texSize: vec2f) -> vec2f {\n let vector = normalize((tiltShift.end - tiltShift.start) * texSize);\n return select(vector, vec2f(-vector.y, vector.x), tiltShift.invert != 0u);\n}\n\nfn tiltShift_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var color = vec4f(0.0);\n var total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n let normal = normalize(\n vec2f(\n (tiltShift.start.y - tiltShift.end.y) * texSize.y,\n (tiltShift.end.x - tiltShift.start.x) * texSize.x\n )\n );\n let radius =\n smoothstep(\n 0.0,\n 1.0,\n abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius\n ) * tiltShift.blurRadius;\n\n for (var t = -30.0; t <= 30.0; t += 1.0) {\n let percent = (t + offset - 0.5) / 30.0;\n let weight = 1.0 - abs(percent);\n let offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius\n );\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color /= total;\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform tiltShiftUniforms {\n float blurRadius;\n float gradientRadius;\n vec2 start;\n vec2 end;\n bool invert;\n} tiltShift;\n\nvec2 tiltShift_getDelta(vec2 texSize) {\n vec2 vector = normalize((tiltShift.end - tiltShift.start) * texSize);\n return tiltShift.invert ? vec2(-vector.y, vector.x) : vector;\n}\n\nvec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n vec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));\n float radius = smoothstep(0.0, 1.0,\n abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n`;\n\n/**\n * Tilt Shift\n * Simulates the shallow depth of field normally encountered in close-up photography\n */\nexport type TiltShiftProps = {\n /** The x,y coordinate of the start of the line segment. */\n start?: [number, number];\n /** The xm y coordinate of the end of the line segment. */\n end?: [number, number];\n /** The maximum radius of the pyramid blur. */\n blurRadius?: number;\n /** The distance from the line at which the maximum blur radius is reached. */\n gradientRadius?: number;\n /** @deprecated internal shaderpass use */\n invert?: number;\n};\n\nexport type TiltShiftUniforms = TiltShiftProps;\n\n/**\n * Tilt Shift\n * Simulates the shallow depth of field normally encountered in close-up\n * photography, which makes the scene seem much smaller than it actually\n * is. This filter assumes the scene is relatively planar, in which case\n * the part of the scene that is completely in focus can be described by\n * a line (the intersection of the focal plane and the scene). An example\n * of a planar scene might be looking at a road from above at a downward\n * angle. The image is then blurred with a blur radius that starts at zero\n * on the line and increases further from the line.\n */\nexport const tiltShift = {\n name: 'tiltShift',\n dependencies: [random],\n source,\n fs,\n\n props: {} as TiltShiftProps,\n uniforms: {} as TiltShiftUniforms,\n uniformTypes: {\n blurRadius: 'f32',\n gradientRadius: 'f32',\n start: 'vec2<f32>',\n end: 'vec2<f32>',\n invert: 'i32'\n },\n propTypes: {\n blurRadius: {value: 15, min: 0, max: 50},\n gradientRadius: {value: 200, min: 0, max: 400},\n start: {value: [0, 0]},\n end: {value: [1, 1]},\n invert: {value: 0, private: true}\n },\n\n passes: [\n {sampler: true, uniforms: {invert: 0}},\n {sampler: true, uniforms: {invert: 1}}\n ]\n} as const satisfies ShaderPass<TiltShiftProps, TiltShiftProps>;\n\n/*\nfunction tiltShift(startX, startY, endX, endY, blurRadius, gradientRadius) {\n var dx = endX - startX;\n var dy = endY - startY;\n var d = Math.sqrt(dx * dx + dy * dy);\n simpleShader.call(this, gl.tiltShift, {\n blurRadius: blurRadius,\n gradientRadius: gradientRadius,\n start: [startX, startY],\n end: [endX, endY],\n delta: [dx / d, dy / d],\n texSize: [this.width, this.height]\n });\n simpleShader.call(this, gl.tiltShift, {\n blurRadius: blurRadius,\n gradientRadius: gradientRadius,\n start: [startX, startY],\n end: [endX, endY],\n delta: [-dy / d, dx / d],\n texSize: [this.width, this.height]\n });\n\n return this;\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct triangleBlurUniforms {\n radius: f32,\n delta: vec2f,\n};\n\n@group(0) @binding(1) var<uniform> triangleBlur: triangleBlurUniforms;\n\nfn triangleBlur_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;\n\n var color = vec4f(0.0);\n var total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n for (var t = -30.0; t <= 30.0; t += 1.0) {\n let percent = (t + offset - 0.5) / 30.0;\n let weight = 1.0 - abs(percent);\n var offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + adjustedDelta * percent\n );\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n offsetColor.rgb *= offsetColor.a;\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color /= total;\n\n /* switch back from pre-multiplied alpha */\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform triangleBlurUniforms {\n float radius;\n vec2 delta;\n} triangleBlur;\n\nvec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n offsetColor.rgb *= offsetColor.a;\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n\n /* switch back from pre-multiplied alpha */\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n`;\n\n/**\n * @filter Triangle Blur\n * @description This is the most basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\nexport type TriangleBlurProps = {\n /** The radius of the pyramid convolved with the image. */\n radius?: number;\n /** @deprecated internal property */\n delta?: [number, number];\n};\n\nexport type TriangleBlurUniforms = TriangleBlurProps;\n\n/**\n * @filter Triangle Blur\n * @description This is the most basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\nexport const triangleBlur = {\n name: 'triangleBlur',\n dependencies: [random],\n source,\n fs,\n\n props: {} as TriangleBlurProps,\n uniforms: {} as TriangleBlurUniforms,\n uniformTypes: {\n radius: 'f32',\n delta: 'vec2<f32>'\n },\n propTypes: {\n radius: {value: 20, min: 0, softMax: 100},\n delta: {value: [1, 0], private: true}\n },\n\n passes: [\n {sampler: true, uniforms: {delta: [1, 0]}},\n {sampler: true, uniforms: {delta: [0, 1]}}\n ]\n} as const satisfies ShaderPass<TriangleBlurProps, TriangleBlurProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\nstruct zoomBlurUniforms {\n center: vec2f,\n strength: f32,\n};\n\n@group(0) @binding(1) var<uniform> zoomBlur : zoomBlurUniforms;\n\n\nfn zoomBlur_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var color = vec4f(0.0);\n var total = 0.0;\n let toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n for (var t = 0.0; t <= 40.0; t += 1.0) {\n let percent = (t + offset) / 40.0;\n let weight = 4.0 * (percent - percent * percent);\n let offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + toCenter * percent * zoomBlur.strength / texSize\n );\n color += offsetColor * weight;\n total += weight;\n }\n\n color /= total;\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\nuniform zoomBlurUniforms {\n vec2 center;\n float strength;\n} zoomBlur;\n\nvec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n return color;\n}\n`;\n\n/**\n * Zoom Blur - Blurs the image away from a certain point, which looks like radial motion blur.\n */\nexport type ZoomBlurProps = {\n /** - The x, y coordinate of the blur origin. */\n center?: [number, number];\n /** - The strength of the blur. Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 creates a highly blurred image. */\n strength?: number;\n};\n\nexport type ZoomBlurUniforms = ZoomBlurProps;\n\n/**\n * Zoom Blur\n * Blurs the image away from a certain point, which looks like radial motion blur.\n */\nexport const zoomBlur = {\n name: 'zoomBlur',\n dependencies: [random],\n source,\n fs,\n\n props: {} as ZoomBlurProps,\n uniforms: {} as ZoomBlurUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n strength: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n strength: {value: 0.3, min: 0, softMax: 1}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<ZoomBlurProps, ZoomBlurProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct colorHalftoneUniforms {\n center: vec2f,\n angle: f32,\n size: f32,\n};\n\n@group(0) @binding(1) var<uniform> colorHalftone: colorHalftoneUniforms;\n\nfn pattern(angle: f32, scale: f32, texSize: vec2f, texCoord: vec2f) -> f32 {\n let s = sin(angle);\n let c = cos(angle);\n let tex = texCoord * texSize - colorHalftone.center * texSize;\n let point = vec2f(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nfn colorHalftone_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let scale = 3.1514 / colorHalftone.size;\n var cmy = vec3f(1.0) - color.rgb;\n var k = min(cmy.x, min(cmy.y, cmy.z));\n let safeDenominator = max(1.0 - k, 0.00001);\n\n cmy = (cmy - vec3f(k)) / safeDenominator;\n cmy = clamp(\n cmy * 10.0 - vec3f(3.0) + vec3f(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n vec3f(0.0),\n vec3f(1.0)\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4f(vec3f(1.0) - cmy - vec3f(k), color.a);\n}\n`;\n\n// TODO pass texCoord to angle\nconst fs = /* glsl */ `\\\nuniform colorHalftoneUniforms {\n vec2 center;\n float angle;\n float size;\n} colorHalftone;\n\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - colorHalftone.center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float scale = 3.1514 / colorHalftone.size;\n vec3 cmy = 1.0 - color.rgb;\n float k = min(cmy.x, min(cmy.y, cmy.z));\n\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\t cmy * 10.0 - 3.0 + vec3(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n\t pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n\t 0.0,\n\t 1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n`;\n\n/**\n * Color Halftone -\n * Simulates a CMYK halftone rendering of the image by multiplying pixel values\n * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,\n * and black.\n */\nexport type ColorHalftoneProps = {\n /** The x,y coordinate of the pattern origin. */\n center?: [number, number];\n /** The rotation of the pattern in radians. */\n angle?: number;\n /** The diameter of a dot in pixels. */\n size?: number;\n};\n\nexport type ColorHalftoneUniforms = ColorHalftoneProps;\n\n/**\n * Color Halftone -\n * Simulates a CMYK halftone rendering of the image by multiplying pixel values\n * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,\n * and black.\n */\nexport const colorHalftone = {\n name: 'colorHalftone',\n source,\n fs,\n\n props: {} as ColorHalftoneProps,\n uniforms: {} as ColorHalftoneUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n angle: 'f32',\n size: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},\n size: {value: 4, min: 1, softMin: 3, softMax: 20}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<ColorHalftoneProps, ColorHalftoneProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct dotScreenUniforms {\n center: vec2f,\n angle: f32,\n size: f32,\n};\n\n@group(0) @binding(1) var<uniform> dotScreen: dotScreenUniforms;\n\nfn pattern(texSize: vec2f, texCoord: vec2f) -> f32 {\n let scale = 3.1415 / dotScreen.size;\n let s = sin(dotScreen.angle);\n let c = cos(dotScreen.angle);\n let tex = texCoord * texSize - dotScreen.center * texSize;\n let point = vec2f(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nfn dotScreen_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let average = (color.r + color.g + color.b) / 3.0;\n return vec4f(vec3f(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform dotScreenUniforms {\n vec2 center;\n float angle;\n float size;\n} dotScreen;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / dotScreen.size;\n\n float s = sin(dotScreen.angle), c = cos(dotScreen.angle);\n vec2 tex = texCoord * texSize - dotScreen.center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float average = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n`;\n\n/**\n * Dot Screen -\n * Simulates a black and white halftone rendering of the image by multiplying\n * pixel values with a rotated 2D sine wave pattern.\n */\nexport type DotScreenProps = {\n /** The x, y coordinate of the pattern origin. */\n center?: [number, number];\n /** The rotation of the pattern in radians. */\n angle?: number;\n /** The diameter of a dot in pixels. */\n size?: number;\n};\n\nexport type DotScreenUniforms = DotScreenProps;\n\n/**\n * Dot Screen -\n * Simulates a black and white halftone rendering of the image by multiplying\n * pixel values with a rotated 2D sine wave pattern.\n */\nexport const dotScreen = {\n name: 'dotScreen',\n source,\n fs,\n\n props: {} as DotScreenProps,\n uniforms: {} as DotScreenUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n angle: 'f32',\n size: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},\n size: {value: 3, min: 1, softMin: 3, softMax: 20}\n },\n\n passes: [{filter: true}]\n} as const satisfies ShaderPass<DotScreenProps, DotScreenProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {random} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct edgeWorkUniforms {\n radius: f32,\n mode: u32,\n};\n\n@group(0) @binding(1) var<uniform> edgeWork: edgeWorkUniforms;\n\nfn edgeWork_sampleColorRGB(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f,\n delta: vec2f\n) -> vec4f {\n let relativeDelta = edgeWork.radius * delta / texSize;\n\n var color = vec2f(0.0);\n var total = vec2f(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n for (var t = -30.0; t <= 30.0; t += 1.0) {\n let percent = (t + offset - 0.5) / 30.0;\n var weight = 1.0 - abs(percent);\n let sampleColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + relativeDelta * percent\n ).rgb;\n let average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4f(color / total, 0.0, 1.0);\n}\n\nfn edgeWork_sampleColorXY(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f,\n delta: vec2f\n) -> vec4f {\n let relativeDelta = edgeWork.radius * delta / texSize;\n\n var color = vec2f(0.0);\n var total = vec2f(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n for (var t = -30.0; t <= 30.0; t += 1.0) {\n let percent = (t + offset - 0.5) / 30.0;\n var weight = 1.0 - abs(percent);\n let sampleColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + relativeDelta * percent\n ).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n\n let c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4f(c, c, c, 1.0);\n}\n\nfn edgeWork_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n if (edgeWork.mode == 0u) {\n return edgeWork_sampleColorRGB(\n sourceTexture,\n sourceTextureSampler,\n texSize,\n texCoord,\n vec2f(1.0, 0.0)\n );\n }\n\n return edgeWork_sampleColorXY(\n sourceTexture,\n sourceTextureSampler,\n texSize,\n texCoord,\n vec2f(0.0, 1.0)\n );\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform edgeWorkUniforms {\n float radius;\n int mode;\n} edgeWork;\n\nvec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n\nvec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n switch (edgeWork.mode) {\n case 0: \n return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));\n case 1: \n default:\n return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));\n }\n}\n`;\n\n/**\n * Edge Work -\n * Picks out different frequencies in the image by subtracting two\n * copies of the image blurred with different radii.\n */\nexport type EdgeWorkProps = {\n /** radius The radius of the effect in pixels. */\n radius?: number;\n /** @deprecated xy or RGB */\n mode?: 0 | 1;\n};\n\nexport type EdgeWorkUniforms = EdgeWorkProps;\n\n/**\n * Edge Work -\n * Picks out different frequencies in the image by subtracting two\n * copies of the image blurred with different radii.\n */\nexport const edgeWork = {\n name: 'edgeWork',\n dependencies: [random],\n source,\n fs,\n\n props: {} as EdgeWorkProps,\n uniforms: {} as EdgeWorkProps,\n uniformTypes: {\n radius: 'f32',\n mode: 'i32'\n },\n propTypes: {\n radius: {value: 2, min: 1, softMax: 50},\n mode: {value: 0, private: true}\n },\n\n passes: [\n {\n sampler: true,\n uniforms: {mode: 0}\n },\n {\n sampler: true,\n uniforms: {mode: 1}\n }\n ]\n} as const satisfies ShaderPass<EdgeWorkProps, EdgeWorkProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct hexagonalPixelateUniforms {\n center: vec2f,\n scale: f32,\n};\n\n@group(0) @binding(1) var<uniform> hexagonalPixelate: hexagonalPixelateUniforms;\n\nfn hexagonalPixelate_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n var a = vec2f(0.0);\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2f(floor(tex.x), floor(tex.y));\n } else {\n a = vec2f(ceil(tex.x), ceil(tex.y));\n }\n let b = vec2f(ceil(tex.x), floor(tex.y));\n let c = vec2f(floor(tex.x), ceil(tex.y));\n\n let texBarycentric = vec3f(tex.x, tex.y, 1.0 - tex.x - tex.y);\n let aBarycentric = vec3f(a.x, a.y, 1.0 - a.x - a.y);\n let bBarycentric = vec3f(b.x, b.y, 1.0 - b.x - b.y);\n let cBarycentric = vec3f(c.x, c.y, 1.0 - c.x - c.y);\n\n let aLength = length(texBarycentric - aBarycentric);\n let bLength = length(texBarycentric - bBarycentric);\n let cLength = length(texBarycentric - cBarycentric);\n\n var choice = vec2f(0.0);\n if (aLength < bLength) {\n if (aLength < cLength) {\n choice = a;\n } else {\n choice = c;\n }\n } else {\n if (bLength < cLength) {\n choice = b;\n } else {\n choice = c;\n }\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return textureSample(sourceTexture, sourceTextureSampler, choice + hexagonalPixelate.center);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform hexagonalPixelateUniforms {\n vec2 center;\n float scale;\n} hexagonalPixelate;\n\nvec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return texture(source, choice + hexagonalPixelate.center);\n}\n`;\n\n/**\n * Hexagonal Pixelate\n * Renders the image using a pattern of hexagonal tiles.\n * Tile colors are nearest-neighbor sampled from the centers of the tiles.\n */\nexport type HexagonalPixelateProps = {\n /** The [x, y] coordinates of the pattern center. */\n center?: [number, number];\n /** The width of an individual tile, in pixels. */\n scale?: number;\n};\n\nexport type HexagonalPixelateUniforms = HexagonalPixelateProps;\n\n/**\n * Hexagonal Pixelate\n * Renders the image using a pattern of hexagonal tiles. Tile colors\n * are nearest-neighbor sampled from the centers of the tiles.\n */\nexport const hexagonalPixelate = {\n name: 'hexagonalPixelate',\n source,\n fs,\n\n props: {} as HexagonalPixelateProps,\n uniforms: {} as HexagonalPixelateUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n scale: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5], hint: 'screenspace'},\n scale: {value: 10, min: 1, softMin: 5, softMax: 50}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<HexagonalPixelateProps, HexagonalPixelateProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct inkUniforms {\n strength: f32,\n};\n\n@group(0) @binding(1) var<uniform> ink: inkUniforms;\n\nfn ink_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let dx = vec2f(1.0 / texSize.x, 0.0);\n let dy = vec2f(0.0, 1.0 / texSize.y);\n let color = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var bigTotal = 0.0;\n var smallTotal = 0.0;\n var bigAverage = vec3f(0.0);\n var smallAverage = vec3f(0.0);\n for (var x = -2.0; x <= 2.0; x += 1.0) {\n for (var y = -2.0; y <= 2.0; y += 1.0) {\n let offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + dx * x + dy * y\n ).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n let edge = max(vec3f(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n let power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4f(color.rgb - vec3f(dot(edge, edge) * power * 100000.0), color.a);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform inkUniforms {\n float strength;\n} ink;\n\nvec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 dx = vec2(1.0 / texSize.x, 0.0);\n vec2 dy = vec2(0.0, 1.0 / texSize.y);\n vec4 color = texture(source, texCoord);\n float bigTotal = 0.0;\n float smallTotal = 0.0;\n vec3 bigAverage = vec3(0.0);\n vec3 smallAverage = vec3(0.0);\n for (float x = -2.0; x <= 2.0; x += 1.0) {\n for (float y = -2.0; y <= 2.0; y += 1.0) {\n vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n`;\n\n/**\n * Ink -\n * Simulates outlining the image in ink by darkening edges stronger than a\n * certain threshold. The edge detection value is the difference of two\n * copies of the image, each blurred using a blur of a different radius.\n */\nexport type InkProps = {\n /** The multiplicative scale of the ink edges.\n * Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 adds lots of black edges.\n * Negative strength values will create white ink edges instead of black ones.\n */\n strength?: number;\n};\n\nexport type InkUniforms = InkProps;\n\n/**\n * Ink -\n * Simulates outlining the image in ink by darkening edges stronger than a\n * certain threshold. The edge detection value is the difference of two\n * copies of the image, each blurred using a blur of a different radius.\n */\nexport const ink = {\n name: 'ink',\n source,\n fs,\n\n props: {} as InkProps,\n uniforms: {} as InkUniforms,\n uniformTypes: {\n strength: 'f32'\n },\n propTypes: {\n strength: {value: 0.25, min: 0, softMax: 1}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<InkProps, InkProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nstruct magnifyUniforms {\n screenXY: vec2f,\n radiusPixels: f32,\n zoom: f32,\n borderWidthPixels: f32,\n borderColor: vec4f,\n};\n\n@group(0) @binding(1) var<uniform> magnify: magnifyUniforms;\n\nfn magnify_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let pos = vec2f(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\n let dist = distance(texCoord * texSize, pos * texSize);\n if (dist < magnify.radiusPixels) {\n return textureSample(sourceTexture, sourceTextureSampler, (texCoord - pos) / magnify.zoom + pos);\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return textureSample(sourceTexture, sourceTextureSampler, texCoord);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform magnifyUniforms {\n vec2 screenXY;\n float radiusPixels;\n float zoom;\n float borderWidthPixels;\n vec4 borderColor;\n} magnify;\n\nvec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\n float dist = distance(texCoord * texSize, pos * texSize);\n if (dist < magnify.radiusPixels) {\n return texture(source, (texCoord - pos) / magnify.zoom + pos);\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return texture(source, texCoord);\n}\n`;\n\n/**\n * Magnify - display a circle with magnify effect applied to surrounding the pixels given position\n */\nexport type MagnifyProps = {\n /** x, y position in screen coords, both x and y is normalized and in range `[0, 1]`. `[0, 0]` is the up left corner, `[1, 1]` is the bottom right corner. Default value is `[0, 0]`. */\n screenXY?: [number, number];\n /** effect radius in pixels. Default value is `100`. */\n radiusPixels?: number;\n /** magnify level. Default value is `2`. */\n zoom?: number;\n /** border width of the effect circle, will not show border if value <= 0.0. Default value is `0`. */\n borderWidthPixels?: number;\n /** border color of the effect circle. Default value is `[255, 255, 255, 255]`. */\n borderColor?: [number, number, number, number];\n};\n\nexport type MagnifyUniforms = MagnifyProps;\n\n/**\n * Magnify - display a circle with magnify effect applied to surrounding the pixels given position\n */\nexport const magnify = {\n name: 'magnify',\n source,\n fs,\n\n uniformTypes: {\n screenXY: 'vec2<f32>',\n radiusPixels: 'f32',\n zoom: 'f32',\n borderWidthPixels: 'f32',\n borderColor: 'vec4<f32>'\n },\n propTypes: {\n // range 0 to 1\n screenXY: {value: [0, 0]},\n radiusPixels: 200,\n zoom: 2.0,\n borderWidthPixels: 0.0,\n borderColor: {value: [255, 255, 255, 255]}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<MagnifyProps, MagnifyProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\nconst source = /* wgsl */ `\\\nfn warp_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n coord: vec2f\n) -> vec4f {\n var color = textureSample(sourceTexture, sourceTextureSampler, coord / texSize);\n let clampedCoord = clamp(coord, vec2f(0.0), texSize);\n if (any(coord != clampedCoord)) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n return color;\n}\n`;\n\nconst fs = /* glsl */ `\\\nvec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {\n vec4 color = texture(source, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n return color;\n}\n`;\n\nexport type WarpProps = {};\n\nexport type WarpUniforms = WarpProps;\n\nexport const warp = {\n name: 'warp',\n source,\n fs,\n\n passes: []\n} as const satisfies ShaderPass<WarpProps, WarpProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {warp} from './warp';\n\nconst source = /* wgsl */ `\\\nstruct bulgePinchUniforms {\n radius: f32,\n strength: f32,\n center: vec2f,\n};\n\n@group(0) @binding(1) var<uniform> bulgePinch: bulgePinchUniforms;\n\nfn bulgePinch_warp(coordIn: vec2f, texCenter: vec2f) -> vec2f {\n var coord = coordIn - texCenter;\n let distance = length(coord);\n if (distance < bulgePinch.radius) {\n let percent = distance / bulgePinch.radius;\n let safeDistance = max(distance, 0.00001);\n if (bulgePinch.strength > 0.0) {\n coord *= mix(\n 1.0,\n smoothstep(0.0, bulgePinch.radius / safeDistance, percent),\n bulgePinch.strength * 0.75\n );\n } else {\n coord *= mix(\n 1.0,\n pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / safeDistance,\n 1.0 - percent\n );\n }\n }\n coord += texCenter;\n return coord;\n}\n\nfn bulgePinch_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, bulgePinch.center * texSize);\n return warp_sampleColor(sourceTexture, sourceTextureSampler, texSize, coord);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform bulgePinchUniforms {\n float radius;\n float strength;\n vec2 center;\n} bulgePinch;\n\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < bulgePinch.radius) {\n float percent = distance / bulgePinch.radius;\n if (bulgePinch.strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, bulgePinch.center * texSize);\n\n return warp_sampleColor(source, texSize, coord);\n}\n`;\n\n/** Bulges or pinches the image in a circle. */\nexport type BulgePinchProps = {\n /** The [x, y] coordinates of the center of the circle of effect. */\n center?: [number, number];\n /** The radius of the circle of effect. */\n radius?: number;\n /** strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge) */\n strength?: number;\n};\n\nexport type BulgePinchUniforms = BulgePinchProps;\n\n/**\n * Bulge / Pinch -\n * Bulges or pinches the image in a circle.\n */\nexport const bulgePinch = {\n name: 'bulgePinch',\n dependencies: [warp],\n source,\n fs,\n\n props: {} as BulgePinchProps,\n uniforms: {} as BulgePinchUniforms,\n uniformTypes: {\n center: 'vec2<f32>',\n radius: 'f32',\n strength: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n radius: {value: 200, min: 1, softMax: 600},\n strength: {value: 0.5, min: -1, max: 1}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<BulgePinchProps, BulgePinchProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\nimport {warp} from './warp';\n\nconst source = /* wgsl */ `\\\nstruct swirlUniforms {\n radius: f32,\n angle: f32,\n center: vec2f,\n};\n\n@group(0) @binding(1) var<uniform> swirl: swirlUniforms;\n\nfn swirl_warp(coordIn: vec2f, texCenter: vec2f) -> vec2f {\n var coord = coordIn - texCenter;\n let distance = length(coord);\n if (distance < swirl.radius) {\n let percent = (swirl.radius - distance) / swirl.radius;\n let theta = percent * percent * swirl.angle;\n let s = sin(theta);\n let c = cos(theta);\n coord = vec2f(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nfn swirl_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var coord = texCoord * texSize;\n coord = swirl_warp(coord, swirl.center * texSize);\n return warp_sampleColor(sourceTexture, sourceTextureSampler, texSize, coord);\n}\n`;\n\nconst fs = /* glsl */ `\\\nuniform swirlUniforms {\n float radius;\n float angle;\n vec2 center;\n} swirl;\n\nvec2 swirl_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < swirl.radius) {\n float percent = (swirl.radius - distance) / swirl.radius;\n float theta = percent * percent * swirl.angle;\n float s = sin(theta);\n float c = cos(theta);\n coord = vec2(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = swirl_warp(coord, swirl.center * texSize);\n\n return warp_sampleColor(source, texSize, coord);\n}\n`;\n\n/**\n * Warps a circular region of the image in a swirl.\n */\nexport type SwirlProps = {\n /** [x, y] coordinates of the center of the circle of effect. default: [0.5, 0.5] */\n center?: [number, number];\n /** The radius of the circular region. */\n radius?: number;\n /** The angle in radians that the pixels in the center of the circular region will be rotated by. */\n angle?: number;\n};\n\nexport type SwirlUniforms = SwirlProps;\n\n/**\n * Warps a circular region of the image in a swirl.\n */\nexport const swirl = {\n name: 'swirl',\n dependencies: [warp],\n source,\n fs,\n\n props: {} as SwirlProps,\n uniforms: {} as SwirlProps,\n uniformTypes: {\n center: 'vec2<f32>',\n radius: 'f32',\n angle: 'f32'\n },\n propTypes: {\n center: {value: [0.5, 0.5]},\n radius: {value: 200, min: 1, softMax: 600},\n angle: {value: 3, softMin: -25, softMax: 25}\n },\n\n passes: [{sampler: true}]\n} as const satisfies ShaderPass<SwirlProps, SwirlProps>;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderPass} from '@luma.gl/shadertools';\n\n/**\n * ORIGINAL LICENCE\n * @license\n * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of NVIDIA CORPORATION nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// LUMA.GL\n// WebGL version from cesium.js, used under Apached 2.0 License\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// with the following modifications:\n// - fxaa_sampleColor to integrate with luma.gl\n// - Return color value with alpha to avoid another tap\n// - Calculate luminance in FxaaLuma\n\n// COMMENTS FROM CESIUM VERSION\n// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n//\n// Steps used to integrate into Cesium:\n// * The following defines are set:\n// #define FXAA_PC 1\n// #define FXAA_WEBGL_1 1\n// #define FXAA_GREEN_AS_LUMA 1\n// #define FXAA_EARLY_EXIT 1\n// #define FXAA_GLSL_120 1\n// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.\n// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace\n// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.\n// * There are no implicit conversions from ivec* to vec* so replace:\n// #define FxaaInt2 ivec2\n// with\n// #define FxaaInt2 vec2\n// * The texture2DLod function is only available in vertex shaders so replace:\n// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n// with\n// #define FxaaTexTop(t, p) texture2D(t, p)\n// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.\n// * The following parameters to FxaaPixelShader_ are unused and can be removed:\n// fxaaConsolePosPos\n// fxaaConsoleRcpFrameOpt\n// fxaaConsoleRcpFrameOpt2\n// fxaaConsole360RcpFrameOpt2\n// fxaaConsoleEdgeSharpness\n// fxaaConsoleEdgeThreshold\n// fxaaConsoleEdgeThresholdMi\n// fxaaConsole360ConstDir\n//\n// Choose the quality preset.\n// This needs to be compiled into the shader as it effects code.\n// Best option to include multiple presets is to\n// in each shader define the preset, then include this file.\n//\n// OPTIONS\n// -----------------------------------------------------------------------\n// 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n// 39 - no dither, very expensive\n//\n// NOTES\n// -----------------------------------------------------------------------\n// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n// 13 = about same speed as FXAA 3.9 and better than 12\n// 23 = closest to FXAA 3.9 visually and performance wise\n// _ = the lowest digit is directly related to performance\n// _ = the highest digit is directly related to style\n//\n\nconst fs = /* glsl */ `\n#define FXAA_QUALITY_PRESET 29\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture(t, p)\n#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))\n\nFxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n\nFxaaFloat4 FxaaPixelShader_(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaTexTop(tex, posM);\n}\n\nvec4 fxaa_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n const float fxaa_QualitySubpix = 0.5;\n const float fxaa_QualityEdgeThreshold = 0.125;\n const float fxaa_QualityEdgeThresholdMin = 0.0833;\n\n return FxaaPixelShader_(\n texCoord,\n source,\n vec2(1.0) / texSize,\n fxaa_QualitySubpix,\n fxaa_QualityEdgeThreshold,\n fxaa_QualityEdgeThresholdMin\n );\n}\n`;\n\nexport type FXAAProps = {};\nexport type FXAAUniforms = {};\n\n/**\n * FXAA - Fast Approximate Anti-aliasing.\n */\nexport const fxaa = {\n name: 'fxaa',\n propTypes: {},\n fs,\n passes: [{sampler: true}],\n getUniforms: props => props\n} as const satisfies ShaderPass<FXAAProps, FXAAUniforms, {}>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,IAAM;;EAAoB;;;;;;;;;;;;;;;;;;;;AAqB1B,IAAM;;EAAgB;;;;;;;;;;;;;;;;;;;;AAkCf,IAAM,qBAAqB;EAChC,MAAM;EACN;EACA;EAEA,OAAO,CAAA;EACP,cAAc;IACZ,YAAY;IACZ,UAAU;;EAEZ,iBAAiB;IACf,YAAY;IACZ,UAAU;;EAEZ,WAAW;IACT,YAAY,EAAC,QAAQ,OAAO,OAAO,GAAG,KAAK,IAAI,KAAK,EAAC;IACrD,UAAU,EAAC,QAAQ,OAAO,OAAO,GAAG,KAAK,IAAI,KAAK,EAAC;;EAGrD,QAAQ,CAAC,EAAC,QAAQ,KAAI,CAAC;;;;ACzEzB,IAAMA;;EAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsC1B,IAAMC;;EAAgB;;;;;;;;;;;;;;;;;;;;;;;;AA8Cf,IAAM,UAAU;EACrB,OAAO,CAAA;EACP,UAAU,CAAA;EAEV,MAAM;EACN,cAAc;IACZ,UAAU;;EAEZ,WAAW;IACT,UAAU,EAAC,QAAQ,OAAO,OAAO,KAAK,KAAK,GAAG,KAAK,EAAC;;;EAItD,QAAAD;EACA,IAAAC;EAEA,QAAQ,CAAC,EAAC,SAAS,KAAI,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xB,aAAa,WAAS;;",
6
6
  "names": ["source", "fs", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "import_shadertools", "source", "fs", "import_shadertools", "source", "fs", "source", "fs", "source", "fs", "import_shadertools", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "source", "fs", "fs"]
7
7
  }
@@ -11,7 +11,7 @@ export type BrightnessContrastUniforms = BrightnessContrastProps;
11
11
  */
12
12
  export declare const brightnessContrast: {
13
13
  readonly name: "brightnessContrast";
14
- readonly source: "struct brightnessContrastUniforms {\n brightness: f32,\n contrast: f32\n};\n\n// Binding 0:1 is reserved for shader passes\n@group(0) @binding(1) var<uniform> brightnessContrast : brightnessContrastUniforms;\n\nfn brightnessContrast_filterColor_ext(color: vec4f, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4f {\n color.rgb += brightnessContrast.brightness;\n if (brightnessContrast.contrast > 0.0) {\n color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;\n } else {\n color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;\n }\n return vec4f(1.0, 0.0, 0.0, 1.0);\n}\n";
14
+ readonly source: "struct brightnessContrastUniforms {\n brightness: f32,\n contrast: f32\n};\n\n// Binding 0:1 is reserved for shader passes\n@group(0) @binding(1) var<uniform> brightnessContrast : brightnessContrastUniforms;\n\nfn brightnessContrast_filterColor_ext(color: vec4f, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4f {\n var result = color;\n result.rgb += vec3f(brightnessContrast.brightness);\n if (brightnessContrast.contrast > 0.0) {\n result.rgb = (result.rgb - vec3f(0.5)) / (1.0 - brightnessContrast.contrast) + vec3f(0.5);\n } else {\n result.rgb = (result.rgb - vec3f(0.5)) * (1.0 + brightnessContrast.contrast) + vec3f(0.5);\n }\n return result;\n}\n";
15
15
  readonly fs: "uniform brightnessContrastUniforms {\n float brightness;\n float contrast;\n} brightnessContrast;\n\nvec4 brightnessContrast_filterColor(vec4 color) {\n color.rgb += brightnessContrast.brightness;\n if (brightnessContrast.contrast > 0.0) {\n color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;\n } else {\n color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;\n }\n return color;\n}\n\nvec4 brightnessContrast_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return brightnessContrast_filterColor(color);\n}\n";
16
16
  readonly props: BrightnessContrastProps;
17
17
  readonly uniformTypes: {
@@ -1 +1 @@
1
- {"version":3,"file":"brightnesscontrast.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts"],"names":[],"mappings":"AA+CA,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;oBAKhB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;CAekB,CAAC"}
1
+ {"version":3,"file":"brightnesscontrast.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;oBAKhB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;CAekB,CAAC"}
@@ -11,13 +11,14 @@ struct brightnessContrastUniforms {
11
11
  @group(0) @binding(1) var<uniform> brightnessContrast : brightnessContrastUniforms;
12
12
 
13
13
  fn brightnessContrast_filterColor_ext(color: vec4f, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4f {
14
- color.rgb += brightnessContrast.brightness;
14
+ var result = color;
15
+ result.rgb += vec3f(brightnessContrast.brightness);
15
16
  if (brightnessContrast.contrast > 0.0) {
16
- color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
17
+ result.rgb = (result.rgb - vec3f(0.5)) / (1.0 - brightnessContrast.contrast) + vec3f(0.5);
17
18
  } else {
18
- color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
19
+ result.rgb = (result.rgb - vec3f(0.5)) * (1.0 + brightnessContrast.contrast) + vec3f(0.5);
19
20
  }
20
- return vec4f(1.0, 0.0, 0.0, 1.0);
21
+ return result;
21
22
  }
22
23
  `;
23
24
  const fs = /* glsl */ `\
@@ -1 +1 @@
1
- {"version":3,"file":"brightnesscontrast.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;CAkBzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;CAmBrB,CAAC;AASF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,oBAAoB;IAC1B,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAA6B;IACpC,YAAY,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;KAChB;IACD,eAAe,EAAE;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,UAAU,EAAE,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;QACtD,QAAQ,EAAE,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;KACrD;IAED,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;CAC8B,CAAC"}
1
+ {"version":3,"file":"brightnesscontrast.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;CAmBzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;CAmBrB,CAAC;AASF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,oBAAoB;IAC1B,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAA6B;IACpC,YAAY,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;KAChB;IACD,eAAe,EAAE;QACf,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,UAAU,EAAE,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;QACtD,QAAQ,EAAE,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;KACrD;IAED,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;CAC8B,CAAC"}
@@ -32,7 +32,7 @@ export declare const denoise: {
32
32
  readonly max: 1;
33
33
  };
34
34
  };
35
- readonly source: "\nstruct denoiseUniforms {\n strength: f32\n};\n\n@group(0), @binding(1) var<uniform> denoise: denoiseUniforms;\n\nfn denoise_sampleColor(source: sampler2D, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {\n\tlet adjustedExponent: f32 = 3. + 200. * pow(1. - denoise.strength, 4.);\n\tlet center: vec4<f32> = sample_texture(BUFFER_source, texCoord);\n\tvar color: vec4<f32> = vec4<f32>(0.);\n\tvar total: f32 = 0.;\n\n\tfor (var x: f32 = -4.; x <= 4.; x = x + (1.)) {\n\n\t\tfor (var y: f32 = -4.; y <= 4.; y = y + (1.)) {\n\t\t\tlet offsetColor: vec4<f32> = sample_texture(BUFFER_source, texCoord + vec2<f32>(x, y) / texSize);\n\t\t\tvar weight: f32 = 1. - abs(dot(offsetColor.rgb - center.rgb, vec3<f32>(0.25)));\n\t\t\tweight = pow(weight, adjustedExponent);\n\t\t\tcolor = color + (offsetColor * weight);\n\t\t\ttotal = total + (weight);\n\t\t}\n\n\t}\n\n\treturn color / total;\n} \n";
35
+ readonly source: "struct denoiseUniforms {\n strength: f32,\n};\n\n@group(0) @binding(1) var<uniform> denoise: denoiseUniforms;\n\nfn denoise_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let adjustedExponent = 3.0 + 200.0 * pow(1.0 - denoise.strength, 4.0);\n let center = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var color = vec4f(0.0);\n var total = 0.0;\n\n for (var x = -4.0; x <= 4.0; x += 1.0) {\n for (var y = -4.0; y <= 4.0; y += 1.0) {\n let offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + vec2f(x, y) / texSize\n );\n let weight = pow(\n 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3f(0.25))),\n adjustedExponent\n );\n color += offsetColor * weight;\n total += weight;\n }\n }\n\n return color / total;\n}\n";
36
36
  readonly fs: "uniform dedenoiseUniforms {\n float strength;\n} denoise;\n\nvec4 dedenoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n float adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);\n\n vec4 center = texture(source, texCoord);\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (float x = -4.0; x <= 4.0; x += 1.0) {\n for (float y = -4.0; y <= 4.0; y += 1.0) {\n vec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);\n float weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));\n weight = pow(weight, adjustedExponent);\n color += offsetColor * weight;\n total += weight;\n }\n }\n\n return color / total;\n}\n";
37
37
  readonly passes: [{
38
38
  readonly sampler: true;
@@ -1 +1 @@
1
- {"version":3,"file":"denoise.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/denoise.ts"],"names":[],"mappings":"AA8DA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,OAAO;oBACL,YAAY;uBACT,eAAe;;;;;;;;;;;;;;;;;;;;CAe6B,CAAC"}
1
+ {"version":3,"file":"denoise.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/denoise.ts"],"names":[],"mappings":"AAsEA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,OAAO;oBACL,YAAY;uBACT,eAAe;;;;;;;;;;;;;;;;;;;;CAe6B,CAAC"}