@luma.gl/effects 9.2.6 → 9.3.0-alpha.11

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 (101) hide show
  1. package/dist/dist.dev.js +2734 -644
  2. package/dist/dist.min.js +10 -9
  3. package/dist/index.cjs +753 -302
  4. package/dist/index.cjs.map +3 -3
  5. package/dist/passes/postprocessing/fxaa/fxaa.d.ts +1 -0
  6. package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
  7. package/dist/passes/postprocessing/fxaa/fxaa.js +287 -0
  8. package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -1
  9. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +2 -2
  10. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  11. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +6 -7
  12. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
  13. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +2 -2
  14. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
  15. package/dist/passes/postprocessing/image-adjust-filters/denoise.js +32 -24
  16. package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
  17. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +2 -2
  18. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  19. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +26 -33
  20. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
  21. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +2 -2
  22. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
  23. package/dist/passes/postprocessing/image-adjust-filters/noise.js +10 -9
  24. package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
  25. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +2 -2
  26. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
  27. package/dist/passes/postprocessing/image-adjust-filters/sepia.js +12 -11
  28. package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
  29. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +2 -2
  30. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +10 -10
  31. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +2 -2
  32. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
  33. package/dist/passes/postprocessing/image-adjust-filters/vignette.js +11 -15
  34. package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
  35. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +3 -3
  36. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
  37. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +36 -18
  38. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -1
  39. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +3 -3
  40. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
  41. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +27 -18
  42. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -1
  43. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +3 -3
  44. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
  45. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +22 -13
  46. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -1
  47. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +2 -2
  48. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
  49. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +20 -18
  50. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -1
  51. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +2 -2
  52. package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +12 -12
  53. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +3 -3
  54. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
  55. package/dist/passes/postprocessing/image-fun-filters/edgework.js +85 -14
  56. package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -1
  57. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +2 -2
  58. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
  59. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +35 -23
  60. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -1
  61. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +2 -2
  62. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
  63. package/dist/passes/postprocessing/image-fun-filters/ink.js +26 -17
  64. package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -1
  65. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +2 -2
  66. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
  67. package/dist/passes/postprocessing/image-fun-filters/magnify.js +23 -13
  68. package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -1
  69. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +3 -3
  70. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
  71. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +28 -14
  72. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -1
  73. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +3 -3
  74. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
  75. package/dist/passes/postprocessing/image-warp-filters/swirl.js +21 -16
  76. package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -1
  77. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +1 -1
  78. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
  79. package/dist/passes/postprocessing/image-warp-filters/warp.js +9 -4
  80. package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -1
  81. package/package.json +4 -5
  82. package/src/passes/postprocessing/fxaa/fxaa.ts +288 -0
  83. package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +6 -7
  84. package/src/passes/postprocessing/image-adjust-filters/denoise.ts +34 -26
  85. package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +28 -35
  86. package/src/passes/postprocessing/image-adjust-filters/noise.ts +10 -9
  87. package/src/passes/postprocessing/image-adjust-filters/sepia.ts +12 -11
  88. package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +10 -10
  89. package/src/passes/postprocessing/image-adjust-filters/vignette.ts +11 -15
  90. package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +38 -20
  91. package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +27 -18
  92. package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +23 -14
  93. package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +20 -18
  94. package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +12 -12
  95. package/src/passes/postprocessing/image-fun-filters/edgework.ts +86 -15
  96. package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +39 -27
  97. package/src/passes/postprocessing/image-fun-filters/ink.ts +26 -17
  98. package/src/passes/postprocessing/image-fun-filters/magnify.ts +23 -13
  99. package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +28 -14
  100. package/src/passes/postprocessing/image-warp-filters/swirl.ts +21 -16
  101. package/src/passes/postprocessing/image-warp-filters/warp.ts +9 -4
@@ -19,8 +19,8 @@ export type MagnifyUniforms = MagnifyProps;
19
19
  */
20
20
  export declare const magnify: {
21
21
  readonly name: "magnify";
22
- readonly source: "uniform 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";
23
- readonly fs: "uniform 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";
22
+ readonly source: "struct magnifyUniforms {\n screenXY: vec2f,\n radiusPixels: f32,\n zoom: f32,\n borderWidthPixels: f32,\n borderColor: vec4f,\n};\n\n@group(0) @binding(auto) 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 textureSampleLevel(\n sourceTexture,\n sourceTextureSampler,\n (texCoord - pos) / magnify.zoom + pos,\n 0.0\n );\n }\n\n if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\n return magnify.borderColor;\n }\n return textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0);\n}\n";
23
+ readonly fs: "layout(std140) uniform 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";
24
24
  readonly uniformTypes: {
25
25
  readonly screenXY: "vec2<f32>";
26
26
  readonly radiusPixels: "f32";
@@ -1 +1 @@
1
- {"version":3,"file":"magnify.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/magnify.ts"],"names":[],"mappings":"AAsDA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,wLAAwL;IACxL,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAsBuC,CAAC"}
1
+ {"version":3,"file":"magnify.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/magnify.ts"],"names":[],"mappings":"AAgEA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,wLAAwL;IACxL,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAsBuC,CAAC"}
@@ -2,31 +2,41 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
  const source = /* wgsl */ `\
5
- uniform magnifyUniforms {
6
- screenXY: vec2f;
7
- radiusPixels: f32;
8
- zoom: f32;
9
- borderWidthPixels: f32;
10
- borderColor: vec4f;
5
+ struct magnifyUniforms {
6
+ screenXY: vec2f,
7
+ radiusPixels: f32,
8
+ zoom: f32,
9
+ borderWidthPixels: f32,
10
+ borderColor: vec4f,
11
11
  };
12
12
 
13
- @group(0) @binding(1) var<uniform> magnify: magnifyUniforms;
13
+ @group(0) @binding(auto) var<uniform> magnify: magnifyUniforms;
14
14
 
15
- fn magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {
16
- vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);
17
- float dist = distance(texCoord * texSize, pos * texSize);
15
+ fn magnify_sampleColor(
16
+ sourceTexture: texture_2d<f32>,
17
+ sourceTextureSampler: sampler,
18
+ texSize: vec2f,
19
+ texCoord: vec2f
20
+ ) -> vec4f {
21
+ let pos = vec2f(magnify.screenXY.x, 1.0 - magnify.screenXY.y);
22
+ let dist = distance(texCoord * texSize, pos * texSize);
18
23
  if (dist < magnify.radiusPixels) {
19
- return texture(source, (texCoord - pos) / magnify.zoom + pos);
24
+ return textureSampleLevel(
25
+ sourceTexture,
26
+ sourceTextureSampler,
27
+ (texCoord - pos) / magnify.zoom + pos,
28
+ 0.0
29
+ );
20
30
  }
21
31
 
22
32
  if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {
23
33
  return magnify.borderColor;
24
34
  }
25
- return texture(source, texCoord);
35
+ return textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0);
26
36
  }
27
37
  `;
28
38
  const fs = /* glsl */ `\
29
- uniform magnifyUniforms {
39
+ layout(std140) uniform magnifyUniforms {
30
40
  vec2 screenXY;
31
41
  float radiusPixels;
32
42
  float zoom;
@@ -1 +1 @@
1
- {"version":3,"file":"magnify.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/magnify.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAuBzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBrB,CAAC;AAoBF;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,SAAS;IACf,MAAM;IACN,EAAE;IAEF,YAAY,EAAE;QACZ,QAAQ,EAAE,WAAW;QACrB,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,KAAK;QACX,iBAAiB,EAAE,KAAK;QACxB,WAAW,EAAE,WAAW;KACzB;IACD,SAAS,EAAE;QACT,eAAe;QACf,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC;QACzB,YAAY,EAAE,GAAG;QACjB,IAAI,EAAE,GAAG;QACT,iBAAiB,EAAE,GAAG;QACtB,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;KAC3C;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACgC,CAAC"}
1
+ {"version":3,"file":"magnify.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/magnify.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBrB,CAAC;AAoBF;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,SAAS;IACf,MAAM;IACN,EAAE;IAEF,YAAY,EAAE;QACZ,QAAQ,EAAE,WAAW;QACrB,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,KAAK;QACX,iBAAiB,EAAE,KAAK;QACxB,WAAW,EAAE,WAAW;KACzB;IACD,SAAS,EAAE;QACT,eAAe;QACf,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC;QACzB,YAAY,EAAE,GAAG;QACjB,IAAI,EAAE,GAAG;QACT,iBAAiB,EAAE,GAAG;QACtB,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;KAC3C;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACgC,CAAC"}
@@ -16,12 +16,12 @@ export declare const bulgePinch: {
16
16
  readonly name: "bulgePinch";
17
17
  readonly dependencies: [{
18
18
  readonly name: "warp";
19
- readonly source: "vec4 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";
19
+ readonly source: "fn 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";
20
20
  readonly fs: "vec4 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";
21
21
  readonly passes: [];
22
22
  }];
23
- readonly source: "uniform 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";
24
- readonly fs: "uniform 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";
23
+ readonly source: "struct bulgePinchUniforms {\n center: vec2f,\n radius: f32,\n strength: f32,\n};\n\n@group(0) @binding(auto) 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";
24
+ readonly fs: "layout(std140) uniform bulgePinchUniforms {\n vec2 center;\n float radius;\n float strength;\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";
25
25
  readonly props: BulgePinchProps;
26
26
  readonly uniforms: BulgePinchUniforms;
27
27
  readonly uniformTypes: {
@@ -1 +1 @@
1
- {"version":3,"file":"bulgepinch.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/bulgepinch.ts"],"names":[],"mappings":"AAoEA,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;oBAMR,eAAe;uBACZ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;CAa6B,CAAC"}
1
+ {"version":3,"file":"bulgepinch.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/bulgepinch.ts"],"names":[],"mappings":"AAkFA,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;oBAMR,eAAe;uBACZ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;CAa6B,CAAC"}
@@ -3,40 +3,54 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  import { warp } from "./warp.js";
5
5
  const source = /* wgsl */ `\
6
- uniform bulgePinchUniforms {
6
+ struct bulgePinchUniforms {
7
+ center: vec2f,
7
8
  radius: f32,
8
9
  strength: f32,
9
- center: vec2f,
10
10
  };
11
11
 
12
- @group(0) @binding(1) var<uniform> bulgePinch: bulgePinchUniforms;
12
+ @group(0) @binding(auto) var<uniform> bulgePinch: bulgePinchUniforms;
13
13
 
14
- fn bulgePinch_warp(vec2 coord, vec2 texCenter) -> vec2f {
15
- coord -= texCenter;
16
- float distance = length(coord);
14
+ fn bulgePinch_warp(coordIn: vec2f, texCenter: vec2f) -> vec2f {
15
+ var coord = coordIn - texCenter;
16
+ let distance = length(coord);
17
17
  if (distance < bulgePinch.radius) {
18
- float percent = distance / bulgePinch.radius;
18
+ let percent = distance / bulgePinch.radius;
19
+ let safeDistance = max(distance, 0.00001);
19
20
  if (bulgePinch.strength > 0.0) {
20
- coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);
21
+ coord *= mix(
22
+ 1.0,
23
+ smoothstep(0.0, bulgePinch.radius / safeDistance, percent),
24
+ bulgePinch.strength * 0.75
25
+ );
21
26
  } else {
22
- coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);
27
+ coord *= mix(
28
+ 1.0,
29
+ pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / safeDistance,
30
+ 1.0 - percent
31
+ );
23
32
  }
24
33
  }
25
34
  coord += texCenter;
26
35
  return coord;
27
36
  }
28
37
 
29
- fn bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {
30
- vec2 coord = texCoord * texSize;
38
+ fn bulgePinch_sampleColor(
39
+ sourceTexture: texture_2d<f32>,
40
+ sourceTextureSampler: sampler,
41
+ texSize: vec2f,
42
+ texCoord: vec2f
43
+ ) -> vec4f {
44
+ var coord = texCoord * texSize;
31
45
  coord = bulgePinch_warp(coord, bulgePinch.center * texSize);
32
- return warp_sampleColor(source, texSize, coord);
46
+ return warp_sampleColor(sourceTexture, sourceTextureSampler, texSize, coord);
33
47
  }
34
48
  `;
35
49
  const fs = /* glsl */ `\
36
- uniform bulgePinchUniforms {
50
+ layout(std140) uniform bulgePinchUniforms {
51
+ vec2 center;
37
52
  float radius;
38
53
  float strength;
39
- vec2 center;
40
54
  } bulgePinch;
41
55
 
42
56
  vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
@@ -1 +1 @@
1
- {"version":3,"file":"bulgepinch.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/bulgepinch.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,IAAI,EAAC,kBAAe;AAE5B,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BrB,CAAC;AAcF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,CAAC,IAAI,CAAC;IACpB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAqB;IAC5B,QAAQ,EAAE,EAAwB;IAClC,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC;QAC3B,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC;QAC1C,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;KACxC;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACsC,CAAC"}
1
+ {"version":3,"file":"bulgepinch.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/bulgepinch.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,IAAI,EAAC,kBAAe;AAE5B,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BrB,CAAC;AAcF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,CAAC,IAAI,CAAC;IACpB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAqB;IAC5B,QAAQ,EAAE,EAAwB;IAClC,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC;QAC3B,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC;QAC1C,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;KACxC;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACsC,CAAC"}
@@ -17,12 +17,12 @@ export declare const swirl: {
17
17
  readonly name: "swirl";
18
18
  readonly dependencies: [{
19
19
  readonly name: "warp";
20
- readonly source: "vec4 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";
20
+ readonly source: "fn 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";
21
21
  readonly fs: "vec4 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";
22
22
  readonly passes: [];
23
23
  }];
24
- readonly source: "uniform 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";
25
- readonly fs: "uniform 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";
24
+ readonly source: "struct swirlUniforms {\n center: vec2f,\n radius: f32,\n angle: f32,\n};\n\n@group(0) @binding(auto) 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";
25
+ readonly fs: "layout(std140) uniform swirlUniforms {\n vec2 center;\n float radius;\n float angle;\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";
26
26
  readonly props: SwirlProps;
27
27
  readonly uniforms: SwirlProps;
28
28
  readonly uniformTypes: {
@@ -1 +1 @@
1
- {"version":3,"file":"swirl.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/swirl.ts"],"names":[],"mappings":"AAwEA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,oFAAoF;IACpF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;oBAMH,UAAU;uBACP,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CAa2B,CAAC"}
1
+ {"version":3,"file":"swirl.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/swirl.ts"],"names":[],"mappings":"AA6EA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,oFAAoF;IACpF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;oBAMH,UAAU;uBACP,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CAa2B,CAAC"}
@@ -3,23 +3,23 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  import { warp } from "./warp.js";
5
5
  const source = /* wgsl */ `\
6
- uniform swirlUniforms {
6
+ struct swirlUniforms {
7
+ center: vec2f,
7
8
  radius: f32,
8
9
  angle: f32,
9
- center: vec2f,
10
10
  };
11
11
 
12
- @group(0) @binding(1) swirl: swirlUniforms;
12
+ @group(0) @binding(auto) var<uniform> swirl: swirlUniforms;
13
13
 
14
- fn swirl_warp(vec2 coord, vec2 texCenter) -> vec2f {
15
- coord -= texCenter;
16
- float distance = length(coord);
14
+ fn swirl_warp(coordIn: vec2f, texCenter: vec2f) -> vec2f {
15
+ var coord = coordIn - texCenter;
16
+ let distance = length(coord);
17
17
  if (distance < swirl.radius) {
18
- float percent = (swirl.radius - distance) / swirl.radius;
19
- float theta = percent * percent * swirl.angle;
20
- float s = sin(theta);
21
- float c = cos(theta);
22
- coord = vec2(
18
+ let percent = (swirl.radius - distance) / swirl.radius;
19
+ let theta = percent * percent * swirl.angle;
20
+ let s = sin(theta);
21
+ let c = cos(theta);
22
+ coord = vec2f(
23
23
  coord.x * c - coord.y * s,
24
24
  coord.x * s + coord.y * c
25
25
  );
@@ -28,17 +28,22 @@ fn swirl_warp(vec2 coord, vec2 texCenter) -> vec2f {
28
28
  return coord;
29
29
  }
30
30
 
31
- fn swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {
32
- vec2 coord = texCoord * texSize;
31
+ fn swirl_sampleColor(
32
+ sourceTexture: texture_2d<f32>,
33
+ sourceTextureSampler: sampler,
34
+ texSize: vec2f,
35
+ texCoord: vec2f
36
+ ) -> vec4f {
37
+ var coord = texCoord * texSize;
33
38
  coord = swirl_warp(coord, swirl.center * texSize);
34
- return warp_sampleColor(source, texSize, coord);
39
+ return warp_sampleColor(sourceTexture, sourceTextureSampler, texSize, coord);
35
40
  }
36
41
  `;
37
42
  const fs = /* glsl */ `\
38
- uniform swirlUniforms {
43
+ layout(std140) uniform swirlUniforms {
44
+ vec2 center;
39
45
  float radius;
40
46
  float angle;
41
- vec2 center;
42
47
  } swirl;
43
48
 
44
49
  vec2 swirl_warp(vec2 coord, vec2 texCenter) {
@@ -1 +1 @@
1
- {"version":3,"file":"swirl.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/swirl.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,IAAI,EAAC,kBAAe;AAE5B,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrB,CAAC;AAgBF;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,CAAC,IAAI,CAAC;IACpB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAgB;IACvB,QAAQ,EAAE,EAAgB;IAC1B,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;KACb;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC;QAC3B,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC;QAC1C,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAC;KAC7C;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CAC4B,CAAC"}
1
+ {"version":3,"file":"swirl.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/swirl.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,IAAI,EAAC,kBAAe;AAE5B,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrB,CAAC;AAgBF;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,CAAC,IAAI,CAAC;IACpB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAgB;IACvB,QAAQ,EAAE,EAAgB;IAC1B,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;KACb;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC;QAC3B,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC;QAC1C,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAC;KAC7C;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CAC4B,CAAC"}
@@ -2,7 +2,7 @@ export type WarpProps = {};
2
2
  export type WarpUniforms = WarpProps;
3
3
  export declare const warp: {
4
4
  readonly name: "warp";
5
- readonly source: "vec4 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";
5
+ readonly source: "fn 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";
6
6
  readonly fs: "vec4 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";
7
7
  readonly passes: [];
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"warp.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/warp.ts"],"names":[],"mappings":"AA8BA,MAAM,MAAM,SAAS,GAAG,EAAE,CAAC;AAE3B,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,IAAI;;;;;CAMoC,CAAC"}
1
+ {"version":3,"file":"warp.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/warp.ts"],"names":[],"mappings":"AAmCA,MAAM,MAAM,SAAS,GAAG,EAAE,CAAC;AAE3B,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,IAAI;;;;;CAMoC,CAAC"}
@@ -2,10 +2,15 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
  const source = /* wgsl */ `\
5
- vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {
6
- vec4 color = texture(source, coord / texSize);
7
- vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
8
- if (coord != clampedCoord) {
5
+ fn warp_sampleColor(
6
+ sourceTexture: texture_2d<f32>,
7
+ sourceTextureSampler: sampler,
8
+ texSize: vec2f,
9
+ coord: vec2f
10
+ ) -> vec4f {
11
+ var color = textureSample(sourceTexture, sourceTextureSampler, coord / texSize);
12
+ let clampedCoord = clamp(coord, vec2f(0.0), texSize);
13
+ if (any(coord != clampedCoord)) {
9
14
  /* fade to transparent if we are outside the image */
10
15
  color.a *= max(0.0, 1.0 - length(coord - clampedCoord));
11
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"warp.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/warp.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;CAUzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;CAUrB,CAAC;AAMF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM;IACN,EAAE;IAEF,MAAM,EAAE,EAAE;CACyC,CAAC"}
1
+ {"version":3,"file":"warp.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/warp.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;CAezB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;CAUrB,CAAC;AAMF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM;IACN,EAAE;IAEF,MAAM,EAAE,EAAE;CACyC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/effects",
3
- "version": "9.2.6",
3
+ "version": "9.3.0-alpha.11",
4
4
  "description": "Post-processing effects for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,12 +46,11 @@
46
46
  "prepublishOnly": "npm run build-minified-bundle && npm run build-dev-bundle"
47
47
  },
48
48
  "peerDependencies": {
49
- "@luma.gl/shadertools": "~9.2.0"
49
+ "@luma.gl/shadertools": "9.3.0-alpha.6"
50
50
  },
51
51
  "dependencies": {
52
52
  "@math.gl/core": "^4.1.0",
53
- "@math.gl/types": "^4.1.0",
54
- "wgsl_reflect": "^1.0.1"
53
+ "@math.gl/types": "^4.1.0"
55
54
  },
56
- "gitHead": "9c7a3adc09c7b23800df3f916762445ebc1fa924"
55
+ "gitHead": "06f489c5d0681bdf7bb0956ca37ce5ad56b85084"
57
56
  }