shaders 2.5.94 → 2.5.95

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 (233) hide show
  1. package/dist/core/{Blur-DTyNQt1R.js → Blur-CC8fo0C5.js} +28 -3
  2. package/dist/core/{ChannelBlur-CCaPXjka.js → ChannelBlur-CN_Zyiur.js} +37 -2
  3. package/dist/core/{Crescent-DPxGWdPH.js → Crescent-BkRt-XWy.js} +1 -1
  4. package/dist/core/{Cross-CDyzf8TT.js → Cross-kkY7feuC.js} +1 -1
  5. package/dist/core/{Crystal-DSuN8TNY.js → Crystal-xVyUhVD-.js} +1 -1
  6. package/dist/core/CursorRipples-Cgm7N0Bp.js +289 -0
  7. package/dist/core/CursorTrail-CCRbdwHJ.js +263 -0
  8. package/dist/core/{Ellipse-BNmzdnpK.js → Ellipse-CXxGqTYI.js} +1 -1
  9. package/dist/core/{Emboss-nrduRrVs.js → Emboss-ClQV27Mt.js} +1 -1
  10. package/dist/core/{Flower-B4xPp0Qa.js → Flower-MAwlZEv8.js} +1 -1
  11. package/dist/core/{Glass-CRfTkmRy.js → Glass-gQCmJlsQ.js} +46 -8
  12. package/dist/core/{Glow-CKWIRcBt.js → Glow-DvN-WnB4.js} +32 -2
  13. package/dist/core/GridDistortion-DtaRNrTZ.js +278 -0
  14. package/dist/core/Liquify-cE5dxrfh.js +351 -0
  15. package/dist/core/{Neon-CUKnkAK8.js → Neon-Dg8UfC7P.js} +1 -1
  16. package/dist/core/{Polygon-C1y6Nyh4.js → Polygon-DRCs3CYs.js} +1 -1
  17. package/dist/core/{ProgressiveBlur-BcHBSVDo.js → ProgressiveBlur-Dm530r0z.js} +59 -2
  18. package/dist/core/{Ring-Chj1tp_P.js → Ring-QApyKPzE.js} +1 -1
  19. package/dist/core/{RoundedRect-BEj6tE1e.js → RoundedRect-Ca9af9xe.js} +1 -1
  20. package/dist/core/{Shatter-CZMOHj60.js → Shatter-BssZTRYJ.js} +154 -66
  21. package/dist/core/{Star-fPw1j10r.js → Star-DiXwnPGP.js} +1 -1
  22. package/dist/core/{TiltShift-BysRsV8v.js → TiltShift-BqKaU3TM.js} +60 -2
  23. package/dist/core/{Trapezoid-Cr61vRvN.js → Trapezoid-BX_hmeZJ.js} +1 -1
  24. package/dist/core/{Vesica-AXTA8DJU.js → Vesica-DU0f85NG.js} +1 -1
  25. package/dist/core/{VideoTexture-BobyGZGr.js → VideoTexture-DJrkry82.js} +1 -1
  26. package/dist/core/{WebcamTexture-BXj7sqND.js → WebcamTexture-Cf8J7JB1.js} +1 -1
  27. package/dist/core/computeBlur-B0KA4n89.js +141 -0
  28. package/dist/core/effects/glass.d.ts +1 -1
  29. package/dist/core/effects/glass.d.ts.map +1 -1
  30. package/dist/core/index.js +172 -121
  31. package/dist/core/registry.js +102 -101
  32. package/dist/core/renderer.d.ts +14 -0
  33. package/dist/core/renderer.d.ts.map +1 -1
  34. package/dist/core/shaderRegistry-DriE1ikS.js +244 -0
  35. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  36. package/dist/core/shaders/Blur/index.js +2 -1
  37. package/dist/core/shaders/BrightnessContrast/index.js +1 -1
  38. package/dist/core/shaders/Bulge/index.js +1 -1
  39. package/dist/core/shaders/CRTScreen/index.js +1 -1
  40. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  41. package/dist/core/shaders/ChannelBlur/index.js +2 -1
  42. package/dist/core/shaders/Checkerboard/index.js +1 -1
  43. package/dist/core/shaders/ChromaFlow/index.js +1 -1
  44. package/dist/core/shaders/ChromaticAberration/index.js +1 -1
  45. package/dist/core/shaders/Circle/index.js +1 -1
  46. package/dist/core/shaders/ConcentricSpin/index.js +1 -1
  47. package/dist/core/shaders/ConicGradient/index.js +1 -1
  48. package/dist/core/shaders/ContourLines/index.js +1 -1
  49. package/dist/core/shaders/Crescent/index.js +2 -2
  50. package/dist/core/shaders/Cross/index.js +2 -2
  51. package/dist/core/shaders/Crystal/index.js +2 -2
  52. package/dist/core/shaders/CursorRipples/index.d.ts.map +1 -1
  53. package/dist/core/shaders/CursorRipples/index.js +1 -1
  54. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  55. package/dist/core/shaders/CursorTrail/index.js +1 -1
  56. package/dist/core/shaders/DOMTexture/index.js +1 -1
  57. package/dist/core/shaders/DiamondGradient/index.js +1 -1
  58. package/dist/core/shaders/DiffuseBlur/index.js +1 -1
  59. package/dist/core/shaders/Dither/index.js +1 -1
  60. package/dist/core/shaders/DotGrid/index.js +1 -1
  61. package/dist/core/shaders/DropShadow/index.js +1 -1
  62. package/dist/core/shaders/Duotone/index.js +1 -1
  63. package/dist/core/shaders/Ellipse/index.js +2 -2
  64. package/dist/core/shaders/Emboss/index.js +2 -2
  65. package/dist/core/shaders/FallingLines/index.js +1 -1
  66. package/dist/core/shaders/FilmGrain/index.js +1 -1
  67. package/dist/core/shaders/FloatingParticles/index.js +1 -1
  68. package/dist/core/shaders/FlowField/index.js +1 -1
  69. package/dist/core/shaders/Flower/index.js +2 -2
  70. package/dist/core/shaders/FlowingGradient/index.js +1 -1
  71. package/dist/core/shaders/Form3D/index.js +1 -1
  72. package/dist/core/shaders/Glass/index.d.ts.map +1 -1
  73. package/dist/core/shaders/Glass/index.js +3 -2
  74. package/dist/core/shaders/GlassTiles/index.js +1 -1
  75. package/dist/core/shaders/Glitch/index.js +1 -1
  76. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  77. package/dist/core/shaders/Glow/index.js +2 -1
  78. package/dist/core/shaders/Godrays/index.js +1 -1
  79. package/dist/core/shaders/Grayscale/index.js +1 -1
  80. package/dist/core/shaders/Grid/index.js +1 -1
  81. package/dist/core/shaders/GridDistortion/index.d.ts.map +1 -1
  82. package/dist/core/shaders/GridDistortion/index.js +1 -1
  83. package/dist/core/shaders/Group/index.js +1 -1
  84. package/dist/core/shaders/Halftone/index.js +1 -1
  85. package/dist/core/shaders/HexGrid/index.js +1 -1
  86. package/dist/core/shaders/HueShift/index.js +1 -1
  87. package/dist/core/shaders/ImageTexture/index.js +1 -1
  88. package/dist/core/shaders/Invert/index.js +1 -1
  89. package/dist/core/shaders/Kaleidoscope/index.js +1 -1
  90. package/dist/core/shaders/LensFlare/index.js +1 -1
  91. package/dist/core/shaders/LinearBlur/index.js +1 -1
  92. package/dist/core/shaders/LinearGradient/index.js +1 -1
  93. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  94. package/dist/core/shaders/Liquify/index.js +1 -1
  95. package/dist/core/shaders/Mirror/index.js +1 -1
  96. package/dist/core/shaders/MultiPointGradient/index.js +1 -1
  97. package/dist/core/shaders/Neon/index.js +2 -2
  98. package/dist/core/shaders/Paper/index.js +1 -1
  99. package/dist/core/shaders/Perspective/index.js +1 -1
  100. package/dist/core/shaders/Pixelate/index.js +1 -1
  101. package/dist/core/shaders/Plasma/index.js +1 -1
  102. package/dist/core/shaders/PolarCoordinates/index.js +1 -1
  103. package/dist/core/shaders/Polygon/index.js +2 -2
  104. package/dist/core/shaders/Posterize/index.js +1 -1
  105. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  106. package/dist/core/shaders/ProgressiveBlur/index.js +2 -1
  107. package/dist/core/shaders/RadialGradient/index.js +1 -1
  108. package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
  109. package/dist/core/shaders/Ring/index.js +2 -2
  110. package/dist/core/shaders/Ripples/index.js +1 -1
  111. package/dist/core/shaders/RoundedRect/index.js +2 -2
  112. package/dist/core/shaders/Saturation/index.js +1 -1
  113. package/dist/core/shaders/Sharpness/index.js +1 -1
  114. package/dist/core/shaders/Shatter/index.d.ts.map +1 -1
  115. package/dist/core/shaders/Shatter/index.js +1 -1
  116. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  117. package/dist/core/shaders/SineWave/index.js +1 -1
  118. package/dist/core/shaders/Solarize/index.js +1 -1
  119. package/dist/core/shaders/SolidColor/index.js +1 -1
  120. package/dist/core/shaders/Spherize/index.js +1 -1
  121. package/dist/core/shaders/Spiral/index.js +1 -1
  122. package/dist/core/shaders/Star/index.js +2 -2
  123. package/dist/core/shaders/Strands/index.js +1 -1
  124. package/dist/core/shaders/Stretch/index.js +1 -1
  125. package/dist/core/shaders/Stripes/index.js +1 -1
  126. package/dist/core/shaders/StudioBackground/index.js +1 -1
  127. package/dist/core/shaders/Swirl/index.js +1 -1
  128. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  129. package/dist/core/shaders/TiltShift/index.js +2 -1
  130. package/dist/core/shaders/Tint/index.js +1 -1
  131. package/dist/core/shaders/Trapezoid/index.js +2 -2
  132. package/dist/core/shaders/Tritone/index.js +1 -1
  133. package/dist/core/shaders/Truchet/index.js +1 -1
  134. package/dist/core/shaders/Twirl/index.js +1 -1
  135. package/dist/core/shaders/Vesica/index.js +2 -2
  136. package/dist/core/shaders/Vibrance/index.js +1 -1
  137. package/dist/core/shaders/VideoTexture/index.js +2 -2
  138. package/dist/core/shaders/Vignette/index.js +1 -1
  139. package/dist/core/shaders/Voronoi/index.js +1 -1
  140. package/dist/core/shaders/WaveDistortion/index.js +1 -1
  141. package/dist/core/shaders/Weave/index.js +1 -1
  142. package/dist/core/shaders/WebcamTexture/index.js +2 -2
  143. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  144. package/dist/core/types.d.ts +29 -0
  145. package/dist/core/types.d.ts.map +1 -1
  146. package/dist/core/utilities/computeBlur.d.ts +50 -0
  147. package/dist/core/utilities/computeBlur.d.ts.map +1 -0
  148. package/dist/js/createShader.js +1 -1
  149. package/dist/react/Shader.js +1 -1
  150. package/dist/registry.js +2 -2
  151. package/dist/solid/engine/Shader.js +1 -1
  152. package/dist/svelte/index.js +1 -1
  153. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  154. package/package.json +1 -1
  155. package/dist/core/CursorRipples-Bo-3LZoC.js +0 -186
  156. package/dist/core/CursorTrail-C-0lpOV1.js +0 -160
  157. package/dist/core/GridDistortion-DXM5MgSc.js +0 -183
  158. package/dist/core/Liquify-CqcAWBwZ.js +0 -228
  159. package/dist/core/shaderRegistry-BzOzMO4V.js +0 -244
  160. /package/dist/core/{BrightnessContrast-BoR9bi58.js → BrightnessContrast-CJTOpQCn.js} +0 -0
  161. /package/dist/core/{Bulge-DN2R75Hp.js → Bulge-Chpbxxzj.js} +0 -0
  162. /package/dist/core/{CRTScreen-DolQEkb1.js → CRTScreen-CTwXU-NX.js} +0 -0
  163. /package/dist/core/{Checkerboard-_IUtUrDv.js → Checkerboard-ucave4-a.js} +0 -0
  164. /package/dist/core/{ChromaFlow-Cq6hDVjX.js → ChromaFlow-BZXyVHtK.js} +0 -0
  165. /package/dist/core/{ChromaticAberration-G8_bwQtD.js → ChromaticAberration-DsMj-vBw.js} +0 -0
  166. /package/dist/core/{Circle--0oHzoCi.js → Circle-QgCuVo44.js} +0 -0
  167. /package/dist/core/{ConcentricSpin-BzxzMieZ.js → ConcentricSpin-Crfxti93.js} +0 -0
  168. /package/dist/core/{ConicGradient-BXXizzIs.js → ConicGradient-CQAPYlQg.js} +0 -0
  169. /package/dist/core/{ContourLines-C0XSJEkE.js → ContourLines-KTHC32hd.js} +0 -0
  170. /package/dist/core/{DOMTexture-Dw3Qakny.js → DOMTexture-D-RkeyMs.js} +0 -0
  171. /package/dist/core/{DiamondGradient-TsOxHjg_.js → DiamondGradient-BC3ugP8a.js} +0 -0
  172. /package/dist/core/{DiffuseBlur-BqIV4JLM.js → DiffuseBlur-eyM1v3ad.js} +0 -0
  173. /package/dist/core/{Dither-D_YF6z03.js → Dither-CDfDotR6.js} +0 -0
  174. /package/dist/core/{DotGrid-CiDt4NmI.js → DotGrid-T9YbgC3V.js} +0 -0
  175. /package/dist/core/{DropShadow-BRoXryDA.js → DropShadow-jMhnYPXZ.js} +0 -0
  176. /package/dist/core/{Duotone-CGHcHB9f.js → Duotone-Bl02WcA2.js} +0 -0
  177. /package/dist/core/{FallingLines-vdw8KxhV.js → FallingLines-CArEXajJ.js} +0 -0
  178. /package/dist/core/{FilmGrain-BqQeKO6Z.js → FilmGrain-Ph73aoC_.js} +0 -0
  179. /package/dist/core/{FloatingParticles-DR5cv6Eh.js → FloatingParticles-BtwGRl_d.js} +0 -0
  180. /package/dist/core/{FlowField-DpP32B1X.js → FlowField-RyqiRxyI.js} +0 -0
  181. /package/dist/core/{FlowingGradient-lSouJxmq.js → FlowingGradient-C0Zoyfd6.js} +0 -0
  182. /package/dist/core/{Form3D-DQD-0zrd.js → Form3D-rKpxb9t3.js} +0 -0
  183. /package/dist/core/{GlassTiles-B7aAvcTQ.js → GlassTiles-k1C4a4u8.js} +0 -0
  184. /package/dist/core/{Glitch-CgmgjLea.js → Glitch-DzPMkBu4.js} +0 -0
  185. /package/dist/core/{Godrays-o-3Im6H1.js → Godrays-DAYmq-BP.js} +0 -0
  186. /package/dist/core/{Grayscale-Bip62olI.js → Grayscale-lYKBBkGY.js} +0 -0
  187. /package/dist/core/{Grid-hwQnF_hs.js → Grid-BJ-nxN3i.js} +0 -0
  188. /package/dist/core/{Group-BexPm4Fb.js → Group-DpozigtX.js} +0 -0
  189. /package/dist/core/{Halftone-onLYU4dF.js → Halftone-BVL2oy37.js} +0 -0
  190. /package/dist/core/{HexGrid-BkqEEgfh.js → HexGrid-D-EmQ4kI.js} +0 -0
  191. /package/dist/core/{HueShift-BldS-av9.js → HueShift-D9K0ynaS.js} +0 -0
  192. /package/dist/core/{ImageTexture-DLCjc5cM.js → ImageTexture-CArkZMfh.js} +0 -0
  193. /package/dist/core/{Invert-C2LI5GXr.js → Invert-DCnwo_Xq.js} +0 -0
  194. /package/dist/core/{Kaleidoscope-CxWjs5jx.js → Kaleidoscope-BytHro3k.js} +0 -0
  195. /package/dist/core/{LensFlare-BNO7tCXH.js → LensFlare-B0vv4x97.js} +0 -0
  196. /package/dist/core/{LinearBlur-Ds6rm8u-.js → LinearBlur-BFewxPjV.js} +0 -0
  197. /package/dist/core/{LinearGradient-BZjDhnZp.js → LinearGradient-BKUf_u7r.js} +0 -0
  198. /package/dist/core/{Mirror-5W3sul9v.js → Mirror-DIle92J8.js} +0 -0
  199. /package/dist/core/{MultiPointGradient-lpUGnrLq.js → MultiPointGradient-DDwac_mm.js} +0 -0
  200. /package/dist/core/{Paper-14yYPnWW.js → Paper-bMSMCeYK.js} +0 -0
  201. /package/dist/core/{Perspective-POVbIGPc.js → Perspective-BmfvQV6W.js} +0 -0
  202. /package/dist/core/{Pixelate-CxUxBDeN.js → Pixelate-Dl26r6IT.js} +0 -0
  203. /package/dist/core/{Plasma-DM9TU0VN.js → Plasma-CJWS1TvX.js} +0 -0
  204. /package/dist/core/{PolarCoordinates-t4Wa00gQ.js → PolarCoordinates-lq6K4WBm.js} +0 -0
  205. /package/dist/core/{Posterize-Dk4DE8Ee.js → Posterize-BjH7Zscm.js} +0 -0
  206. /package/dist/core/{RadialGradient-CSXQIa5L.js → RadialGradient-DiGFPgrn.js} +0 -0
  207. /package/dist/core/{RectangularCoordinates-YaZ_uRXb.js → RectangularCoordinates-COkNDxi0.js} +0 -0
  208. /package/dist/core/{Ripples-wJx2FwJY.js → Ripples-C8Q17Hvz.js} +0 -0
  209. /package/dist/core/{Saturation-B500nPZH.js → Saturation-CgDaiq6n.js} +0 -0
  210. /package/dist/core/{Sharpness-NqY4_gKZ.js → Sharpness-CRXT0D30.js} +0 -0
  211. /package/dist/core/{SimplexNoise-2-J7EbY9.js → SimplexNoise-KfTCAfpL.js} +0 -0
  212. /package/dist/core/{SineWave-OWJVWsI1.js → SineWave-Ckeap_YM.js} +0 -0
  213. /package/dist/core/{Solarize-CEhQxL9Z.js → Solarize-DhtQYYpW.js} +0 -0
  214. /package/dist/core/{SolidColor-Dlzm61ZG.js → SolidColor-6yUkGybH.js} +0 -0
  215. /package/dist/core/{Spherize-CXf4_Mkm.js → Spherize-8LXrGGG_.js} +0 -0
  216. /package/dist/core/{Spiral-CSXNX92f.js → Spiral-Bs7uZrBr.js} +0 -0
  217. /package/dist/core/{Strands-BPVy1zbt.js → Strands-DsAAVemq.js} +0 -0
  218. /package/dist/core/{Stretch-CFAjfvny.js → Stretch-D7P2R5lV.js} +0 -0
  219. /package/dist/core/{Stripes-BSGzno-I.js → Stripes-DF8agIiJ.js} +0 -0
  220. /package/dist/core/{StudioBackground-81AihXcZ.js → StudioBackground-BFeNfwEu.js} +0 -0
  221. /package/dist/core/{Swirl-D_ZvZtDS.js → Swirl-BwezrSAA.js} +0 -0
  222. /package/dist/core/{Tint-C6xN-Qot.js → Tint-BdXlqlzz.js} +0 -0
  223. /package/dist/core/{Tritone-Dk8GcpYo.js → Tritone-BlJ7cchN.js} +0 -0
  224. /package/dist/core/{Truchet-BFd2XYD3.js → Truchet-Bnn0fwbF.js} +0 -0
  225. /package/dist/core/{Twirl-CA0r8U7e.js → Twirl-C5ijhqz1.js} +0 -0
  226. /package/dist/core/{Vibrance-Dq1jBFJb.js → Vibrance-dqIV6GBe.js} +0 -0
  227. /package/dist/core/{Vignette-DB8x78Up.js → Vignette-DB1wO1dm.js} +0 -0
  228. /package/dist/core/{Voronoi-ALXxxHBo.js → Voronoi-C3WIJFWc.js} +0 -0
  229. /package/dist/core/{WaveDistortion-CHb75HO3.js → WaveDistortion-BKma8-Ju.js} +0 -0
  230. /package/dist/core/{Weave-j4CrCig4.js → Weave-xuu_vQ5e.js} +0 -0
  231. /package/dist/core/{ZoomBlur-Cl75kL8E.js → ZoomBlur-UcS2iFT2.js} +0 -0
  232. /package/dist/core/{browser-DIoaEnIX.js → browser-ClWxLlIB.js} +0 -0
  233. /package/dist/core/{sdf-Bux00UoZ.js → sdf-DyC2H_qS.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { l as transformPosition } from "./transformations-B5lM6fYX.js";
2
- import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-Bux00UoZ.js";
2
+ import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-DyC2H_qS.js";
3
3
  import { Fn, abs, clamp, convertToTexture, cos, float, max, screenUV, sin, smoothstep, sqrt, vec2, vec3, vec4, viewportSize } from "three/tsl";
4
4
  var _INV_LIGHT_LEN = 1 / Math.sqrt(1.49);
5
5
  var _LZN = .7 * _INV_LIGHT_LEN;
@@ -1,6 +1,6 @@
1
1
  import { a as transformColor, l as transformPosition, o as transformColorSpace, t as colorSpaceOptions } from "./transformations-B5lM6fYX.js";
2
2
  import { t as mixColors } from "./colorMixing-BPpDnR5I.js";
3
- import { s as flowerSdf } from "./sdf-Bux00UoZ.js";
3
+ import { s as flowerSdf } from "./sdf-DyC2H_qS.js";
4
4
  import { cos, float, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
5
5
  var transformStrokePosition = (value) => {
6
6
  return {
@@ -1,6 +1,7 @@
1
1
  import { a as transformColor, l as transformPosition } from "./transformations-B5lM6fYX.js";
2
- import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-Bux00UoZ.js";
3
- import { Fn, clamp, convertToTexture, dot, exp2, float, max, mix, pow, screenUV, smoothstep, sqrt, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
2
+ import { t as createGaussianBlurCompute } from "./computeBlur-B0KA4n89.js";
3
+ import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-DyC2H_qS.js";
4
+ import { Fn, clamp, convertToTexture, dot, exp2, float, max, mix, pow, screenUV, smoothstep, sqrt, texture, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
4
5
  var GOLDEN_ANGLE = 2.3999632297286535;
5
6
  var BLUR_SAMPLE_COUNT = 9;
6
7
  const BLUR_DISK = [];
@@ -10,7 +11,7 @@ for (let i = 0; i < BLUR_SAMPLE_COUNT; i++) {
10
11
  BLUR_DISK.push([Math.cos(angle) * r, Math.sin(angle) * r]);
11
12
  }
12
13
  var INV_HLEN_GLASS = 1 / Math.sqrt(5);
13
- function applyGlassEffect(childTexture, sdfSampler, uniforms, onBeforeRender) {
14
+ function applyGlassEffect(childTexture, sdfSampler, uniforms, onBeforeRender, blurredTexture) {
14
15
  const lx = uniform(0);
15
16
  const ly = uniform(0);
16
17
  const updateLightAngle = () => {
@@ -48,7 +49,21 @@ function applyGlassEffect(childTexture, sdfSampler, uniforms, onBeforeRender) {
48
49
  const blurEnabled = typeof uniforms.blur.uniform.value === "number" ? uniforms.blur.uniform.value > 0 : true;
49
50
  const aberrationEnabled = typeof uniforms.aberration.uniform.value === "number" ? uniforms.aberration.uniform.value > 0 : true;
50
51
  let blurred;
51
- if (!blurEnabled && !aberrationEnabled) blurred = childTexture.sample(lensUV);
52
+ if (blurredTexture && blurEnabled) {
53
+ const blurTex = texture(blurredTexture);
54
+ if (!aberrationEnabled) blurred = blurTex.sample(lensUV);
55
+ else {
56
+ const chrScale = uniforms.aberration.uniform.mul(float(.06));
57
+ const chrOffX = offsetX.mul(chrScale);
58
+ const chrOffY = offsetY.mul(chrScale);
59
+ const rUV = lensUV.add(vec2(chrOffX, chrOffY));
60
+ const bUV = lensUV.sub(vec2(chrOffX, chrOffY));
61
+ const rSample = blurTex.sample(rUV);
62
+ const gSample = blurTex.sample(lensUV);
63
+ const bSample = blurTex.sample(bUV);
64
+ blurred = vec4(rSample.r, gSample.g, bSample.b, gSample.a);
65
+ }
66
+ } else if (!blurEnabled && !aberrationEnabled) blurred = childTexture.sample(lensUV);
52
67
  else if (!blurEnabled && aberrationEnabled) {
53
68
  const chrScale = uniforms.aberration.uniform.mul(float(.06));
54
69
  const chrOffX = offsetX.mul(chrScale);
@@ -368,12 +383,35 @@ const componentDefinition = {
368
383
  description: "Active SDF shape type — triggers recompile when shape is switched. When empty, derived from shape JSON at mount time."
369
384
  }
370
385
  },
371
- fragmentNode: ({ uniforms, childNode, onCleanup, onBeforeRender }) => {
372
- if (!childNode) return vec4(0);
386
+ computeNode: ({ uniforms, childNode, onCleanup, dimensions, renderer }) => {
387
+ if (!childNode) return null;
388
+ const blurValue = uniforms.blur.uniform.value;
389
+ if (typeof blurValue === "number" && blurValue <= 0) return null;
373
390
  const childTexture = convertToTexture(childNode);
374
391
  onCleanup(() => {
375
392
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
376
393
  });
394
+ const dpr = renderer?.getPixelRatio?.() ?? 1;
395
+ const { computeNodes, outputTexture, updateRadius } = createGaussianBlurCompute(childTexture, Math.round(dimensions.width * dpr), Math.round(dimensions.height * dpr), onCleanup);
396
+ return {
397
+ outputs: {
398
+ childTexture,
399
+ blurredTexture: outputTexture
400
+ },
401
+ getComputeNodes: () => {
402
+ const currentBlur = uniforms.blur.uniform.value;
403
+ updateRadius(currentBlur * 2);
404
+ return computeNodes;
405
+ }
406
+ };
407
+ },
408
+ fragmentNode: ({ uniforms, childNode, onCleanup, onBeforeRender, computeOutputs }) => {
409
+ if (!childNode) return vec4(0);
410
+ const childTexture = computeOutputs?.childTexture ?? convertToTexture(childNode);
411
+ if (!computeOutputs) onCleanup(() => {
412
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
413
+ });
414
+ const blurredTexture = computeOutputs?.blurredTexture;
377
415
  const shapeSdfUrl = uniforms.shapeSdfUrl.uniform.value;
378
416
  const initialConfig = (() => {
379
417
  const val = uniforms.shape.uniform.value;
@@ -389,8 +427,8 @@ const componentDefinition = {
389
427
  };
390
428
  }
391
429
  })();
392
- if (shapeSdfUrl) return applyGlassEffect(childTexture, createSvgSdfSampler(shapeSdfUrl, onBeforeRender, onCleanup), uniforms, onBeforeRender);
393
- else return applyGlassEffect(childTexture, createAnalyticSdfSampler(uniforms.shapeType.uniform.value || initialConfig.type || "circleSDF", initialConfig, uniforms.shape, onBeforeRender), uniforms, onBeforeRender);
430
+ if (shapeSdfUrl) return applyGlassEffect(childTexture, createSvgSdfSampler(shapeSdfUrl, onBeforeRender, onCleanup), uniforms, onBeforeRender, blurredTexture);
431
+ else return applyGlassEffect(childTexture, createAnalyticSdfSampler(uniforms.shapeType.uniform.value || initialConfig.type || "circleSDF", initialConfig, uniforms.shape, onBeforeRender), uniforms, onBeforeRender, blurredTexture);
394
432
  }
395
433
  };
396
434
  var Glass_default = componentDefinition;
@@ -1,5 +1,6 @@
1
1
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
2
- import { Fn, convertToTexture, dot, float, max, screenUV, vec2, vec3, vec4, viewportSize } from "three/tsl";
2
+ import { t as createGaussianBlurCompute } from "./computeBlur-B0KA4n89.js";
3
+ import { Fn, convertToTexture, dot, float, max, screenUV, texture, vec2, vec3, vec4, viewportSize } from "three/tsl";
3
4
  const componentDefinition = {
4
5
  name: "Glow",
5
6
  category: "Stylize",
@@ -44,8 +45,37 @@ const componentDefinition = {
44
45
  }
45
46
  }
46
47
  },
47
- fragmentNode: ({ uniforms, childNode, onCleanup }) => {
48
+ computeNode: ({ childNode, onCleanup, dimensions, renderer, uniforms }) => {
49
+ if (!childNode) return null;
50
+ const childTexture = convertToTexture(childNode);
51
+ onCleanup(() => {
52
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
53
+ });
54
+ const dpr = renderer?.getPixelRatio?.() ?? 1;
55
+ const { computeNodes, outputTexture, updateRadius } = createGaussianBlurCompute(childTexture, Math.round(dimensions.width * dpr), Math.round(dimensions.height * dpr), onCleanup);
56
+ return {
57
+ outputs: {
58
+ childTexture,
59
+ blurredTexture: outputTexture
60
+ },
61
+ getComputeNodes: () => {
62
+ const size = uniforms.size.uniform.value;
63
+ updateRadius(size);
64
+ return computeNodes;
65
+ }
66
+ };
67
+ },
68
+ fragmentNode: ({ uniforms, childNode, onCleanup, computeOutputs }) => {
48
69
  if (!childNode) return vec4(0, 0, 0, 0);
70
+ if (computeOutputs?.blurredTexture) {
71
+ const originalColor$1 = computeOutputs.childTexture.sample(screenUV);
72
+ const blurredColor = texture(computeOutputs.blurredTexture).sample(screenUV);
73
+ const luminance = dot(originalColor$1.rgb, vec3(.299, .587, .114));
74
+ const brightnessMask = max(float(0), luminance.sub(uniforms.threshold.uniform));
75
+ const intensity$1 = uniforms.intensity.uniform;
76
+ const glow = blurredColor.mul(brightnessMask).mul(intensity$1);
77
+ return unpremultiplyAlpha(vec4(originalColor$1.rgb.add(glow.rgb), max(originalColor$1.a, glow.a)));
78
+ }
49
79
  const childTexture = convertToTexture(childNode);
50
80
  onCleanup(() => {
51
81
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
@@ -0,0 +1,278 @@
1
+ import { t as applyEdgeHandling } from "./edges-CfGcQniB.js";
2
+ import { c as transformEdges } from "./transformations-B5lM6fYX.js";
3
+ import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
4
+ import { StorageTexture } from "three/webgpu";
5
+ import { DataTexture, FloatType, LinearFilter as LinearFilter$1, RGFormat } from "three";
6
+ import { Fn, If, attributeArray, convertToTexture, float, instanceIndex, screenUV, storageTexture, texture, textureStore, uint, uniform, uvec2, vec2, vec4, viewportSize } from "three/tsl";
7
+ var DEFAULT_GRID_SIZE = 20;
8
+ var displacementStateCache = /* @__PURE__ */ new WeakMap();
9
+ var getOrCreateDisplacementState = (uniforms) => {
10
+ let state = displacementStateCache.get(uniforms);
11
+ const gridSize = uniforms?.gridSize?.uniform?.value ? Math.max(8, Math.min(128, Math.floor(uniforms.gridSize.uniform.value))) : DEFAULT_GRID_SIZE;
12
+ if (state && state.gridSize !== gridSize) {
13
+ state.dataTexture.dispose();
14
+ state = void 0;
15
+ displacementStateCache.delete(uniforms);
16
+ }
17
+ if (!state) {
18
+ const data = new Float32Array(gridSize * gridSize * 2);
19
+ const dataTexture = new DataTexture(data, gridSize, gridSize, RGFormat, FloatType);
20
+ dataTexture.magFilter = LinearFilter$1;
21
+ dataTexture.minFilter = LinearFilter$1;
22
+ dataTexture.needsUpdate = true;
23
+ state = {
24
+ dataTexture,
25
+ data,
26
+ tslNode: texture(dataTexture),
27
+ gridSize
28
+ };
29
+ displacementStateCache.set(uniforms, state);
30
+ }
31
+ return state;
32
+ };
33
+ const componentDefinition = {
34
+ name: "GridDistortion",
35
+ category: "Interactive",
36
+ description: "Interactive grid distortion controlled by mouse position",
37
+ requiresRTT: true,
38
+ requiresChild: true,
39
+ props: {
40
+ intensity: {
41
+ default: 1,
42
+ description: "Strength of the distortion effect",
43
+ ui: {
44
+ type: "range",
45
+ min: 0,
46
+ max: 5,
47
+ step: .1,
48
+ label: "Intensity",
49
+ group: "Effect"
50
+ }
51
+ },
52
+ decay: {
53
+ default: 3,
54
+ description: "Rate of distortion decay (higher = faster)",
55
+ ui: {
56
+ type: "range",
57
+ min: 0,
58
+ max: 10,
59
+ step: .1,
60
+ label: "Decay",
61
+ group: "Effect"
62
+ }
63
+ },
64
+ radius: {
65
+ default: 1,
66
+ description: "Radius of the distortion effect",
67
+ ui: {
68
+ type: "range",
69
+ min: 0,
70
+ max: 3,
71
+ step: .1,
72
+ label: "Radius",
73
+ group: "Effect"
74
+ }
75
+ },
76
+ gridSize: {
77
+ default: 20,
78
+ description: "Resolution of the distortion grid (higher = more detailed)",
79
+ ui: {
80
+ type: ["range", "map"],
81
+ min: 8,
82
+ max: 128,
83
+ step: 1,
84
+ label: "Grid Size",
85
+ group: "Effect"
86
+ }
87
+ },
88
+ edges: {
89
+ default: "stretch",
90
+ description: "How to handle edges when distortion pushes content out of bounds",
91
+ transform: transformEdges,
92
+ compileTime: true,
93
+ ui: {
94
+ type: "select",
95
+ options: [
96
+ {
97
+ label: "Stretch",
98
+ value: "stretch"
99
+ },
100
+ {
101
+ label: "Transparent",
102
+ value: "transparent"
103
+ },
104
+ {
105
+ label: "Mirror",
106
+ value: "mirror"
107
+ },
108
+ {
109
+ label: "Wrap",
110
+ value: "wrap"
111
+ }
112
+ ],
113
+ label: "Edges",
114
+ group: "Effect"
115
+ }
116
+ }
117
+ },
118
+ computeNode: ({ uniforms, onCleanup, dimensions }) => {
119
+ const GRID_SIZE = uniforms?.gridSize?.uniform?.value ? Math.max(8, Math.min(128, Math.floor(uniforms.gridSize.uniform.value))) : DEFAULT_GRID_SIZE;
120
+ const buffer = attributeArray(GRID_SIZE * GRID_SIZE, "vec4");
121
+ const dispTex = new StorageTexture(GRID_SIZE, GRID_SIZE);
122
+ dispTex.type = FloatType;
123
+ const dispTexNode = storageTexture(dispTex);
124
+ onCleanup(() => {
125
+ dispTex.dispose();
126
+ });
127
+ const cursorXU = uniform(.5);
128
+ const cursorYU = uniform(.5);
129
+ const mouseVelXU = uniform(0);
130
+ const mouseVelYU = uniform(0);
131
+ const dtU = uniform(.016);
132
+ const decayU = uniform(3);
133
+ const intensityU = uniform(1);
134
+ const radiusU = uniform(.05);
135
+ const aspectU = uniform(1);
136
+ const gs = uint(GRID_SIZE);
137
+ const updatePass = Fn(() => {
138
+ const idx = instanceIndex;
139
+ const j = idx.mod(gs);
140
+ const i = idx.div(gs);
141
+ const cell = buffer.element(idx);
142
+ const dx = cell.x.mul(float(1).sub(decayU.mul(dtU))).toVar();
143
+ const dy = cell.y.mul(float(1).sub(decayU.mul(dtU))).toVar();
144
+ const cellX = j.toFloat().add(float(.5)).div(float(GRID_SIZE));
145
+ const cellY = i.toFloat().add(float(.5)).div(float(GRID_SIZE));
146
+ const ddx = aspectU.greaterThanEqual(float(1)).select(cellX.sub(cursorXU).mul(aspectU), cellX.sub(cursorXU));
147
+ const ddy = aspectU.greaterThanEqual(float(1)).select(cellY.sub(cursorYU), cellY.sub(cursorYU).div(aspectU));
148
+ const distSq = ddx.mul(ddx).add(ddy.mul(ddy));
149
+ const radius2 = radiusU.mul(float(2));
150
+ If(distSq.lessThan(radius2.mul(radius2)).and(mouseVelXU.abs().add(mouseVelYU.abs()).greaterThan(float(.01))), () => {
151
+ const influence = distSq.negate().div(radiusU.mul(radiusU)).exp();
152
+ dx.assign(dx.add(mouseVelXU.mul(influence).mul(intensityU).mul(dtU).mul(float(.5))));
153
+ dy.assign(dy.add(mouseVelYU.mul(influence).mul(intensityU).mul(dtU).mul(float(.5))));
154
+ });
155
+ dx.assign(dx.clamp(float(-1), float(1)));
156
+ dy.assign(dy.clamp(float(-1), float(1)));
157
+ buffer.element(idx).assign(vec4(dx, dy, float(0), float(0)));
158
+ })().compute(GRID_SIZE * GRID_SIZE, [256]);
159
+ const outputPass = Fn(() => {
160
+ const idx = instanceIndex;
161
+ const j = idx.mod(gs);
162
+ const i = idx.div(gs);
163
+ const cell = buffer.element(idx);
164
+ textureStore(dispTexNode, uvec2(j, i), vec4(cell.x, cell.y, float(0), float(1))).toWriteOnly();
165
+ })().compute(GRID_SIZE * GRID_SIZE, [256]);
166
+ let prevX = .5;
167
+ let prevY = .5;
168
+ let lastTime = Date.now();
169
+ let lastActiveTime = Date.now();
170
+ let smoothVelX = 0;
171
+ let smoothVelY = 0;
172
+ return {
173
+ outputs: {
174
+ displacement: dispTex,
175
+ gridSize: GRID_SIZE
176
+ },
177
+ getComputeNodes: (params) => {
178
+ const currentTime = Date.now();
179
+ const dt = Math.min((currentTime - lastTime) / 1e3, .016);
180
+ lastTime = currentTime;
181
+ const aspect = dimensions.width / Math.max(dimensions.height, 1);
182
+ const velX = dt > 0 ? (params.pointer.x - prevX) / dt : 0;
183
+ const velY = dt > 0 ? (params.pointer.y - prevY) / dt : 0;
184
+ smoothVelX = smoothVelX * .85 + velX * .15;
185
+ smoothVelY = smoothVelY * .85 + velY * .15;
186
+ prevX = params.pointer.x;
187
+ prevY = params.pointer.y;
188
+ if (Math.abs(velX) + Math.abs(velY) > .01) lastActiveTime = currentTime;
189
+ const decayVal = uniforms.decay.uniform.value;
190
+ const settleTime = decayVal > 0 ? Math.min(3e4, Math.log(1e-4) / Math.log(Math.max(1e-6, 1 - decayVal * .016)) * 16.67) : 3e4;
191
+ if (currentTime - lastActiveTime > settleTime) return null;
192
+ cursorXU.value = params.pointer.x;
193
+ cursorYU.value = params.pointer.y;
194
+ mouseVelXU.value = smoothVelX;
195
+ mouseVelYU.value = smoothVelY;
196
+ dtU.value = dt;
197
+ decayU.value = uniforms.decay.uniform.value;
198
+ intensityU.value = uniforms.intensity.uniform.value;
199
+ radiusU.value = uniforms.radius.uniform.value * .05;
200
+ aspectU.value = aspect;
201
+ return [updatePass, outputPass];
202
+ }
203
+ };
204
+ },
205
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions, computeOutputs }) => {
206
+ let displacementField;
207
+ let GRID_SIZE;
208
+ if (computeOutputs?.displacement) {
209
+ displacementField = texture(computeOutputs.displacement);
210
+ GRID_SIZE = computeOutputs.gridSize;
211
+ } else {
212
+ const state = getOrCreateDisplacementState(uniforms);
213
+ displacementField = state.tslNode;
214
+ GRID_SIZE = state.gridSize;
215
+ const { dataTexture: displacementTexture, data: displacementData } = state;
216
+ const mouseVelX = uniform(0);
217
+ const mouseVelY = uniform(0);
218
+ let prevX = .5, prevY = .5, lastTime = Date.now();
219
+ onBeforeRender(({ pointer }) => {
220
+ const currentTime = Date.now();
221
+ const dt = Math.min((currentTime - lastTime) / 1e3, .016);
222
+ lastTime = currentTime;
223
+ const aspect$1 = Math.max(1, dimensions.width) / Math.max(1, dimensions.height);
224
+ const velX = dt > 0 ? (pointer.x - prevX) / dt : 0;
225
+ const velY = dt > 0 ? (pointer.y - prevY) / dt : 0;
226
+ mouseVelX.value = mouseVelX.value * .85 + velX * .15;
227
+ mouseVelY.value = mouseVelY.value * .85 + velY * .15;
228
+ const decay = uniforms.decay.uniform.value;
229
+ const intensity = uniforms.intensity.uniform.value;
230
+ const radius = uniforms.radius.uniform.value * .05;
231
+ for (let i = 0; i < GRID_SIZE; i++) for (let j = 0; j < GRID_SIZE; j++) {
232
+ const idx = (i * GRID_SIZE + j) * 2;
233
+ displacementData[idx] *= 1 - decay * dt;
234
+ displacementData[idx + 1] *= 1 - decay * dt;
235
+ const cellX = (j + .5) / GRID_SIZE;
236
+ const cellY = (i + .5) / GRID_SIZE;
237
+ const dx = aspect$1 >= 1 ? (cellX - pointer.x) * aspect$1 : cellX - pointer.x;
238
+ const dy = aspect$1 >= 1 ? cellY - pointer.y : (cellY - pointer.y) / aspect$1;
239
+ const dist = Math.sqrt(dx * dx + dy * dy);
240
+ if (dist < radius * 2 && Math.abs(velX) + Math.abs(velY) > .01) {
241
+ const influence = Math.exp(-dist * dist / (radius * radius));
242
+ displacementData[idx] += mouseVelX.value * influence * intensity * dt * .5;
243
+ displacementData[idx + 1] += mouseVelY.value * influence * intensity * dt * .5;
244
+ }
245
+ displacementData[idx] = Math.max(-1, Math.min(1, displacementData[idx]));
246
+ displacementData[idx + 1] = Math.max(-1, Math.min(1, displacementData[idx + 1]));
247
+ }
248
+ displacementTexture.needsUpdate = true;
249
+ prevX = pointer.x;
250
+ prevY = pointer.y;
251
+ });
252
+ onCleanup(() => {
253
+ displacementTexture.dispose();
254
+ displacementStateCache.delete(uniforms);
255
+ });
256
+ }
257
+ if (!childNode) return vec4(0, 0, 0, 0);
258
+ const childTexture = convertToTexture(childNode);
259
+ onCleanup(() => {
260
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
261
+ });
262
+ const aspect = viewportSize.x.div(viewportSize.y);
263
+ const gridSizeUniform = uniforms.gridSize.uniform;
264
+ const isWide = aspect.greaterThan(float(1));
265
+ const cellsX = isWide.select(gridSizeUniform, gridSizeUniform.mul(aspect)).max(float(1));
266
+ const cellsY = isWide.select(gridSizeUniform.div(aspect), gridSizeUniform).max(float(1));
267
+ const cellIndexX = screenUV.x.mul(cellsX).floor();
268
+ const cellIndexY = screenUV.y.mul(cellsY).floor();
269
+ const gridCellUV = vec2(cellIndexX.add(.5).div(cellsX), cellIndexY.add(.5).div(cellsY));
270
+ const displacement = displacementField.sample(gridCellUV).xy;
271
+ const maxDisplacement = float(.1);
272
+ const clampedDisplacement = displacement.clamp(vec2(maxDisplacement.negate(), maxDisplacement.negate()), vec2(maxDisplacement, maxDisplacement));
273
+ const distortedUV = screenUV.sub(clampedDisplacement);
274
+ return unpremultiplyAlpha(applyEdgeHandling(distortedUV, childTexture.sample(distortedUV), childTexture, uniforms.edges.uniform.value));
275
+ }
276
+ };
277
+ var GridDistortion_default = componentDefinition;
278
+ export { componentDefinition as n, GridDistortion_default as t };