shaders 2.5.93 → 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 (237) hide show
  1. package/dist/core/{Blob-56vuq_qL.js → Blob-CuRSRXmA.js} +22 -7
  2. package/dist/core/{Blur-DTyNQt1R.js → Blur-CC8fo0C5.js} +28 -3
  3. package/dist/core/{ChannelBlur-CCaPXjka.js → ChannelBlur-CN_Zyiur.js} +37 -2
  4. package/dist/core/{Crescent-DPxGWdPH.js → Crescent-BkRt-XWy.js} +1 -1
  5. package/dist/core/{Cross-CDyzf8TT.js → Cross-kkY7feuC.js} +1 -1
  6. package/dist/core/{Crystal-DSuN8TNY.js → Crystal-xVyUhVD-.js} +1 -1
  7. package/dist/core/CursorRipples-Cgm7N0Bp.js +289 -0
  8. package/dist/core/CursorTrail-CCRbdwHJ.js +263 -0
  9. package/dist/core/{Ellipse-BNmzdnpK.js → Ellipse-CXxGqTYI.js} +1 -1
  10. package/dist/core/{Emboss-nrduRrVs.js → Emboss-ClQV27Mt.js} +1 -1
  11. package/dist/core/{Flower-B4xPp0Qa.js → Flower-MAwlZEv8.js} +1 -1
  12. package/dist/core/{Glass-CR9981-Z.js → Glass-gQCmJlsQ.js} +55 -11
  13. package/dist/core/{Glow-CKWIRcBt.js → Glow-DvN-WnB4.js} +32 -2
  14. package/dist/core/GridDistortion-DtaRNrTZ.js +278 -0
  15. package/dist/core/Liquify-cE5dxrfh.js +351 -0
  16. package/dist/core/{Neon-CUKnkAK8.js → Neon-Dg8UfC7P.js} +1 -1
  17. package/dist/core/{Polygon-C1y6Nyh4.js → Polygon-DRCs3CYs.js} +1 -1
  18. package/dist/core/{ProgressiveBlur-BcHBSVDo.js → ProgressiveBlur-Dm530r0z.js} +59 -2
  19. package/dist/core/{Ring-Chj1tp_P.js → Ring-QApyKPzE.js} +1 -1
  20. package/dist/core/{RoundedRect-BEj6tE1e.js → RoundedRect-Ca9af9xe.js} +1 -1
  21. package/dist/core/{Shatter-CZMOHj60.js → Shatter-BssZTRYJ.js} +154 -66
  22. package/dist/core/{Star-fPw1j10r.js → Star-DiXwnPGP.js} +1 -1
  23. package/dist/core/{TiltShift-BysRsV8v.js → TiltShift-BqKaU3TM.js} +60 -2
  24. package/dist/core/{Trapezoid-Cr61vRvN.js → Trapezoid-BX_hmeZJ.js} +1 -1
  25. package/dist/core/{Vesica-AXTA8DJU.js → Vesica-DU0f85NG.js} +1 -1
  26. package/dist/core/{VideoTexture-BobyGZGr.js → VideoTexture-DJrkry82.js} +1 -1
  27. package/dist/core/{WaveDistortion-BVT1KuLK.js → WaveDistortion-BKma8-Ju.js} +18 -5
  28. package/dist/core/{WebcamTexture-BXj7sqND.js → WebcamTexture-Cf8J7JB1.js} +1 -1
  29. package/dist/core/computeBlur-B0KA4n89.js +141 -0
  30. package/dist/core/effects/glass.d.ts +1 -1
  31. package/dist/core/effects/glass.d.ts.map +1 -1
  32. package/dist/core/index.js +173 -122
  33. package/dist/core/registry.js +103 -102
  34. package/dist/core/renderer.d.ts +14 -0
  35. package/dist/core/renderer.d.ts.map +1 -1
  36. package/dist/core/shaderRegistry-DriE1ikS.js +244 -0
  37. package/dist/core/shaders/Blob/index.d.ts.map +1 -1
  38. package/dist/core/shaders/Blob/index.js +1 -1
  39. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  40. package/dist/core/shaders/Blur/index.js +2 -1
  41. package/dist/core/shaders/BrightnessContrast/index.js +1 -1
  42. package/dist/core/shaders/Bulge/index.js +1 -1
  43. package/dist/core/shaders/CRTScreen/index.js +1 -1
  44. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  45. package/dist/core/shaders/ChannelBlur/index.js +2 -1
  46. package/dist/core/shaders/Checkerboard/index.js +1 -1
  47. package/dist/core/shaders/ChromaFlow/index.js +1 -1
  48. package/dist/core/shaders/ChromaticAberration/index.js +1 -1
  49. package/dist/core/shaders/Circle/index.js +1 -1
  50. package/dist/core/shaders/ConcentricSpin/index.js +1 -1
  51. package/dist/core/shaders/ConicGradient/index.js +1 -1
  52. package/dist/core/shaders/ContourLines/index.js +1 -1
  53. package/dist/core/shaders/Crescent/index.js +2 -2
  54. package/dist/core/shaders/Cross/index.js +2 -2
  55. package/dist/core/shaders/Crystal/index.js +2 -2
  56. package/dist/core/shaders/CursorRipples/index.d.ts.map +1 -1
  57. package/dist/core/shaders/CursorRipples/index.js +1 -1
  58. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  59. package/dist/core/shaders/CursorTrail/index.js +1 -1
  60. package/dist/core/shaders/DOMTexture/index.js +1 -1
  61. package/dist/core/shaders/DiamondGradient/index.js +1 -1
  62. package/dist/core/shaders/DiffuseBlur/index.js +1 -1
  63. package/dist/core/shaders/Dither/index.js +1 -1
  64. package/dist/core/shaders/DotGrid/index.js +1 -1
  65. package/dist/core/shaders/DropShadow/index.js +1 -1
  66. package/dist/core/shaders/Duotone/index.js +1 -1
  67. package/dist/core/shaders/Ellipse/index.js +2 -2
  68. package/dist/core/shaders/Emboss/index.js +2 -2
  69. package/dist/core/shaders/FallingLines/index.js +1 -1
  70. package/dist/core/shaders/FilmGrain/index.js +1 -1
  71. package/dist/core/shaders/FloatingParticles/index.js +1 -1
  72. package/dist/core/shaders/FlowField/index.js +1 -1
  73. package/dist/core/shaders/Flower/index.js +2 -2
  74. package/dist/core/shaders/FlowingGradient/index.js +1 -1
  75. package/dist/core/shaders/Form3D/index.js +1 -1
  76. package/dist/core/shaders/Glass/index.d.ts.map +1 -1
  77. package/dist/core/shaders/Glass/index.js +3 -2
  78. package/dist/core/shaders/GlassTiles/index.js +1 -1
  79. package/dist/core/shaders/Glitch/index.js +1 -1
  80. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  81. package/dist/core/shaders/Glow/index.js +2 -1
  82. package/dist/core/shaders/Godrays/index.js +1 -1
  83. package/dist/core/shaders/Grayscale/index.js +1 -1
  84. package/dist/core/shaders/Grid/index.js +1 -1
  85. package/dist/core/shaders/GridDistortion/index.d.ts.map +1 -1
  86. package/dist/core/shaders/GridDistortion/index.js +1 -1
  87. package/dist/core/shaders/Group/index.js +1 -1
  88. package/dist/core/shaders/Halftone/index.js +1 -1
  89. package/dist/core/shaders/HexGrid/index.js +1 -1
  90. package/dist/core/shaders/HueShift/index.js +1 -1
  91. package/dist/core/shaders/ImageTexture/index.js +1 -1
  92. package/dist/core/shaders/Invert/index.js +1 -1
  93. package/dist/core/shaders/Kaleidoscope/index.js +1 -1
  94. package/dist/core/shaders/LensFlare/index.js +1 -1
  95. package/dist/core/shaders/LinearBlur/index.js +1 -1
  96. package/dist/core/shaders/LinearGradient/index.js +1 -1
  97. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  98. package/dist/core/shaders/Liquify/index.js +1 -1
  99. package/dist/core/shaders/Mirror/index.js +1 -1
  100. package/dist/core/shaders/MultiPointGradient/index.js +1 -1
  101. package/dist/core/shaders/Neon/index.js +2 -2
  102. package/dist/core/shaders/Paper/index.js +1 -1
  103. package/dist/core/shaders/Perspective/index.js +1 -1
  104. package/dist/core/shaders/Pixelate/index.js +1 -1
  105. package/dist/core/shaders/Plasma/index.js +1 -1
  106. package/dist/core/shaders/PolarCoordinates/index.js +1 -1
  107. package/dist/core/shaders/Polygon/index.js +2 -2
  108. package/dist/core/shaders/Posterize/index.js +1 -1
  109. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  110. package/dist/core/shaders/ProgressiveBlur/index.js +2 -1
  111. package/dist/core/shaders/RadialGradient/index.js +1 -1
  112. package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
  113. package/dist/core/shaders/Ring/index.js +2 -2
  114. package/dist/core/shaders/Ripples/index.js +1 -1
  115. package/dist/core/shaders/RoundedRect/index.js +2 -2
  116. package/dist/core/shaders/Saturation/index.js +1 -1
  117. package/dist/core/shaders/Sharpness/index.js +1 -1
  118. package/dist/core/shaders/Shatter/index.d.ts.map +1 -1
  119. package/dist/core/shaders/Shatter/index.js +1 -1
  120. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  121. package/dist/core/shaders/SineWave/index.js +1 -1
  122. package/dist/core/shaders/Solarize/index.js +1 -1
  123. package/dist/core/shaders/SolidColor/index.js +1 -1
  124. package/dist/core/shaders/Spherize/index.js +1 -1
  125. package/dist/core/shaders/Spiral/index.js +1 -1
  126. package/dist/core/shaders/Star/index.js +2 -2
  127. package/dist/core/shaders/Strands/index.js +1 -1
  128. package/dist/core/shaders/Stretch/index.js +1 -1
  129. package/dist/core/shaders/Stripes/index.js +1 -1
  130. package/dist/core/shaders/StudioBackground/index.js +1 -1
  131. package/dist/core/shaders/Swirl/index.js +1 -1
  132. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  133. package/dist/core/shaders/TiltShift/index.js +2 -1
  134. package/dist/core/shaders/Tint/index.js +1 -1
  135. package/dist/core/shaders/Trapezoid/index.js +2 -2
  136. package/dist/core/shaders/Tritone/index.js +1 -1
  137. package/dist/core/shaders/Truchet/index.js +1 -1
  138. package/dist/core/shaders/Twirl/index.js +1 -1
  139. package/dist/core/shaders/Vesica/index.js +2 -2
  140. package/dist/core/shaders/Vibrance/index.js +1 -1
  141. package/dist/core/shaders/VideoTexture/index.js +2 -2
  142. package/dist/core/shaders/Vignette/index.js +1 -1
  143. package/dist/core/shaders/Voronoi/index.js +1 -1
  144. package/dist/core/shaders/WaveDistortion/index.d.ts.map +1 -1
  145. package/dist/core/shaders/WaveDistortion/index.js +1 -1
  146. package/dist/core/shaders/Weave/index.js +1 -1
  147. package/dist/core/shaders/WebcamTexture/index.js +2 -2
  148. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  149. package/dist/core/types.d.ts +29 -0
  150. package/dist/core/types.d.ts.map +1 -1
  151. package/dist/core/utilities/computeBlur.d.ts +50 -0
  152. package/dist/core/utilities/computeBlur.d.ts.map +1 -0
  153. package/dist/js/createShader.js +1 -1
  154. package/dist/react/Shader.js +1 -1
  155. package/dist/registry.js +2 -2
  156. package/dist/solid/engine/Shader.js +1 -1
  157. package/dist/svelte/index.js +1 -1
  158. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  159. package/package.json +1 -1
  160. package/dist/core/CursorRipples-n_xEDr10.js +0 -179
  161. package/dist/core/CursorTrail-C-0lpOV1.js +0 -160
  162. package/dist/core/GridDistortion-DXM5MgSc.js +0 -183
  163. package/dist/core/Liquify-CqcAWBwZ.js +0 -228
  164. package/dist/core/shaderRegistry-BZ6QG12o.js +0 -244
  165. /package/dist/core/{BrightnessContrast-BoR9bi58.js → BrightnessContrast-CJTOpQCn.js} +0 -0
  166. /package/dist/core/{Bulge-DN2R75Hp.js → Bulge-Chpbxxzj.js} +0 -0
  167. /package/dist/core/{CRTScreen-DolQEkb1.js → CRTScreen-CTwXU-NX.js} +0 -0
  168. /package/dist/core/{Checkerboard-_IUtUrDv.js → Checkerboard-ucave4-a.js} +0 -0
  169. /package/dist/core/{ChromaFlow-Cq6hDVjX.js → ChromaFlow-BZXyVHtK.js} +0 -0
  170. /package/dist/core/{ChromaticAberration-G8_bwQtD.js → ChromaticAberration-DsMj-vBw.js} +0 -0
  171. /package/dist/core/{Circle--0oHzoCi.js → Circle-QgCuVo44.js} +0 -0
  172. /package/dist/core/{ConcentricSpin-BzxzMieZ.js → ConcentricSpin-Crfxti93.js} +0 -0
  173. /package/dist/core/{ConicGradient-BXXizzIs.js → ConicGradient-CQAPYlQg.js} +0 -0
  174. /package/dist/core/{ContourLines-C0XSJEkE.js → ContourLines-KTHC32hd.js} +0 -0
  175. /package/dist/core/{DOMTexture-Dw3Qakny.js → DOMTexture-D-RkeyMs.js} +0 -0
  176. /package/dist/core/{DiamondGradient-TsOxHjg_.js → DiamondGradient-BC3ugP8a.js} +0 -0
  177. /package/dist/core/{DiffuseBlur-BqIV4JLM.js → DiffuseBlur-eyM1v3ad.js} +0 -0
  178. /package/dist/core/{Dither-D_YF6z03.js → Dither-CDfDotR6.js} +0 -0
  179. /package/dist/core/{DotGrid-CiDt4NmI.js → DotGrid-T9YbgC3V.js} +0 -0
  180. /package/dist/core/{DropShadow-BRoXryDA.js → DropShadow-jMhnYPXZ.js} +0 -0
  181. /package/dist/core/{Duotone-CGHcHB9f.js → Duotone-Bl02WcA2.js} +0 -0
  182. /package/dist/core/{FallingLines-vdw8KxhV.js → FallingLines-CArEXajJ.js} +0 -0
  183. /package/dist/core/{FilmGrain-BqQeKO6Z.js → FilmGrain-Ph73aoC_.js} +0 -0
  184. /package/dist/core/{FloatingParticles-DR5cv6Eh.js → FloatingParticles-BtwGRl_d.js} +0 -0
  185. /package/dist/core/{FlowField-DpP32B1X.js → FlowField-RyqiRxyI.js} +0 -0
  186. /package/dist/core/{FlowingGradient-lSouJxmq.js → FlowingGradient-C0Zoyfd6.js} +0 -0
  187. /package/dist/core/{Form3D-DQD-0zrd.js → Form3D-rKpxb9t3.js} +0 -0
  188. /package/dist/core/{GlassTiles-B7aAvcTQ.js → GlassTiles-k1C4a4u8.js} +0 -0
  189. /package/dist/core/{Glitch-CgmgjLea.js → Glitch-DzPMkBu4.js} +0 -0
  190. /package/dist/core/{Godrays-o-3Im6H1.js → Godrays-DAYmq-BP.js} +0 -0
  191. /package/dist/core/{Grayscale-Bip62olI.js → Grayscale-lYKBBkGY.js} +0 -0
  192. /package/dist/core/{Grid-hwQnF_hs.js → Grid-BJ-nxN3i.js} +0 -0
  193. /package/dist/core/{Group-BexPm4Fb.js → Group-DpozigtX.js} +0 -0
  194. /package/dist/core/{Halftone-onLYU4dF.js → Halftone-BVL2oy37.js} +0 -0
  195. /package/dist/core/{HexGrid-BkqEEgfh.js → HexGrid-D-EmQ4kI.js} +0 -0
  196. /package/dist/core/{HueShift-BldS-av9.js → HueShift-D9K0ynaS.js} +0 -0
  197. /package/dist/core/{ImageTexture-DLCjc5cM.js → ImageTexture-CArkZMfh.js} +0 -0
  198. /package/dist/core/{Invert-C2LI5GXr.js → Invert-DCnwo_Xq.js} +0 -0
  199. /package/dist/core/{Kaleidoscope-CxWjs5jx.js → Kaleidoscope-BytHro3k.js} +0 -0
  200. /package/dist/core/{LensFlare-BNO7tCXH.js → LensFlare-B0vv4x97.js} +0 -0
  201. /package/dist/core/{LinearBlur-Ds6rm8u-.js → LinearBlur-BFewxPjV.js} +0 -0
  202. /package/dist/core/{LinearGradient-BZjDhnZp.js → LinearGradient-BKUf_u7r.js} +0 -0
  203. /package/dist/core/{Mirror-5W3sul9v.js → Mirror-DIle92J8.js} +0 -0
  204. /package/dist/core/{MultiPointGradient-lpUGnrLq.js → MultiPointGradient-DDwac_mm.js} +0 -0
  205. /package/dist/core/{Paper-14yYPnWW.js → Paper-bMSMCeYK.js} +0 -0
  206. /package/dist/core/{Perspective-POVbIGPc.js → Perspective-BmfvQV6W.js} +0 -0
  207. /package/dist/core/{Pixelate-CxUxBDeN.js → Pixelate-Dl26r6IT.js} +0 -0
  208. /package/dist/core/{Plasma-DM9TU0VN.js → Plasma-CJWS1TvX.js} +0 -0
  209. /package/dist/core/{PolarCoordinates-t4Wa00gQ.js → PolarCoordinates-lq6K4WBm.js} +0 -0
  210. /package/dist/core/{Posterize-Dk4DE8Ee.js → Posterize-BjH7Zscm.js} +0 -0
  211. /package/dist/core/{RadialGradient-CSXQIa5L.js → RadialGradient-DiGFPgrn.js} +0 -0
  212. /package/dist/core/{RectangularCoordinates-YaZ_uRXb.js → RectangularCoordinates-COkNDxi0.js} +0 -0
  213. /package/dist/core/{Ripples-wJx2FwJY.js → Ripples-C8Q17Hvz.js} +0 -0
  214. /package/dist/core/{Saturation-B500nPZH.js → Saturation-CgDaiq6n.js} +0 -0
  215. /package/dist/core/{Sharpness-NqY4_gKZ.js → Sharpness-CRXT0D30.js} +0 -0
  216. /package/dist/core/{SimplexNoise-2-J7EbY9.js → SimplexNoise-KfTCAfpL.js} +0 -0
  217. /package/dist/core/{SineWave-OWJVWsI1.js → SineWave-Ckeap_YM.js} +0 -0
  218. /package/dist/core/{Solarize-CEhQxL9Z.js → Solarize-DhtQYYpW.js} +0 -0
  219. /package/dist/core/{SolidColor-Dlzm61ZG.js → SolidColor-6yUkGybH.js} +0 -0
  220. /package/dist/core/{Spherize-CXf4_Mkm.js → Spherize-8LXrGGG_.js} +0 -0
  221. /package/dist/core/{Spiral-CSXNX92f.js → Spiral-Bs7uZrBr.js} +0 -0
  222. /package/dist/core/{Strands-BPVy1zbt.js → Strands-DsAAVemq.js} +0 -0
  223. /package/dist/core/{Stretch-CFAjfvny.js → Stretch-D7P2R5lV.js} +0 -0
  224. /package/dist/core/{Stripes-BSGzno-I.js → Stripes-DF8agIiJ.js} +0 -0
  225. /package/dist/core/{StudioBackground-81AihXcZ.js → StudioBackground-BFeNfwEu.js} +0 -0
  226. /package/dist/core/{Swirl-D_ZvZtDS.js → Swirl-BwezrSAA.js} +0 -0
  227. /package/dist/core/{Tint-C6xN-Qot.js → Tint-BdXlqlzz.js} +0 -0
  228. /package/dist/core/{Tritone-Dk8GcpYo.js → Tritone-BlJ7cchN.js} +0 -0
  229. /package/dist/core/{Truchet-BFd2XYD3.js → Truchet-Bnn0fwbF.js} +0 -0
  230. /package/dist/core/{Twirl-CA0r8U7e.js → Twirl-C5ijhqz1.js} +0 -0
  231. /package/dist/core/{Vibrance-Dq1jBFJb.js → Vibrance-dqIV6GBe.js} +0 -0
  232. /package/dist/core/{Vignette-DB8x78Up.js → Vignette-DB1wO1dm.js} +0 -0
  233. /package/dist/core/{Voronoi-ALXxxHBo.js → Voronoi-C3WIJFWc.js} +0 -0
  234. /package/dist/core/{Weave-j4CrCig4.js → Weave-xuu_vQ5e.js} +0 -0
  235. /package/dist/core/{ZoomBlur-Cl75kL8E.js → ZoomBlur-UcS2iFT2.js} +0 -0
  236. /package/dist/core/{browser-DIoaEnIX.js → browser-ClWxLlIB.js} +0 -0
  237. /package/dist/core/{sdf-Bux00UoZ.js → sdf-DyC2H_qS.js} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { l as transformPosition, r as transformAngle } from "./transformations-B5lM6fYX.js";
2
2
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
3
- import { Fn, convertToTexture, cos, float, max, radians, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
3
+ import { n as createVariableGaussianBlurCompute } from "./computeBlur-B0KA4n89.js";
4
+ import { Fn, If, convertToTexture, cos, float, instanceIndex, max, radians, screenUV, sin, smoothstep, texture, textureStore, uint, uniform, uvec2, vec2, vec4, viewportSize } from "three/tsl";
4
5
  const componentDefinition = {
5
6
  name: "ProgressiveBlur",
6
7
  category: "Blurs",
@@ -59,8 +60,64 @@ const componentDefinition = {
59
60
  }
60
61
  }
61
62
  },
62
- fragmentNode: ({ uniforms, childNode, onCleanup }) => {
63
+ computeNode: ({ childNode, onCleanup, dimensions, renderer, uniforms }) => {
64
+ if (!childNode) return null;
65
+ const childTexture = convertToTexture(childNode);
66
+ onCleanup(() => {
67
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
68
+ });
69
+ const dpr = renderer?.getPixelRatio?.() ?? 1;
70
+ const texWidth = Math.round(dimensions.width * dpr);
71
+ const texHeight = Math.round(dimensions.height * dpr);
72
+ const { computeNodes: blurNodes, outputTexture, blurMapWriteNode } = createVariableGaussianBlurCompute(childTexture, texWidth, texHeight, onCleanup);
73
+ const angleU = uniform(0);
74
+ const centerXU = uniform(0);
75
+ const centerYU = uniform(.5);
76
+ const falloffU = uniform(1);
77
+ const maxRadiusU = uniform(18);
78
+ const aspectU = uniform(1);
79
+ const w = uint(texWidth);
80
+ const h = uint(texHeight);
81
+ const fillBlurMap = Fn(() => {
82
+ const idx = instanceIndex;
83
+ const x = idx.mod(w);
84
+ const y = idx.div(w);
85
+ If(y.lessThan(h), () => {
86
+ const u = x.toFloat().add(float(.5)).div(float(texWidth));
87
+ const v = y.toFloat().add(float(.5)).div(float(texHeight));
88
+ const angleRad = angleU.mul(float(Math.PI / 180));
89
+ const cosA = angleRad.cos();
90
+ const sinA = angleRad.sin();
91
+ const direction = vec2(cosA.div(aspectU), sinA);
92
+ const centerPos = vec2(centerXU, float(1).sub(centerYU));
93
+ const centeredUV = vec2(u, v).sub(centerPos);
94
+ const directionalDist = max(float(0), centeredUV.dot(direction));
95
+ const radius = smoothstep(float(0), falloffU, directionalDist).mul(maxRadiusU);
96
+ textureStore(blurMapWriteNode, uvec2(x, y), vec4(radius, float(0), float(0), float(1))).toWriteOnly();
97
+ });
98
+ })().compute(texWidth * texHeight, [256]);
99
+ return {
100
+ outputs: {
101
+ childTexture,
102
+ blurredTexture: outputTexture
103
+ },
104
+ getComputeNodes: () => {
105
+ angleU.value = uniforms.angle.uniform.value;
106
+ centerXU.value = uniforms.center.uniform.value?.x ?? uniforms.center.uniform.x?.value ?? 0;
107
+ centerYU.value = uniforms.center.uniform.value?.y ?? uniforms.center.uniform.y?.value ?? .5;
108
+ falloffU.value = uniforms.falloff.uniform.value;
109
+ aspectU.value = dimensions.width / dimensions.height;
110
+ maxRadiusU.value = uniforms.intensity.uniform.value * .36;
111
+ return [fillBlurMap, ...blurNodes];
112
+ }
113
+ };
114
+ },
115
+ fragmentNode: ({ uniforms, childNode, onCleanup, computeOutputs }) => {
63
116
  if (!childNode) return vec4(0, 0, 0, 0);
117
+ if (computeOutputs?.blurredTexture) {
118
+ const sharp = computeOutputs.childTexture.sample(screenUV);
119
+ return unpremultiplyAlpha(vec4(texture(computeOutputs.blurredTexture).sample(screenUV).rgb, sharp.a));
120
+ }
64
121
  const childTexture = convertToTexture(childNode);
65
122
  onCleanup(() => {
66
123
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
@@ -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 { l as ringSdf } from "./sdf-Bux00UoZ.js";
3
+ import { l as ringSdf } from "./sdf-DyC2H_qS.js";
4
4
  import { float, screenUV, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
5
5
  var transformStrokePosition = (value) => {
6
6
  return {
@@ -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 { u as roundedRectSdf } from "./sdf-Bux00UoZ.js";
3
+ import { u as roundedRectSdf } 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,12 +1,15 @@
1
1
  import { t as applyEdgeHandling } from "./edges-CfGcQniB.js";
2
2
  import { c as transformEdges } from "./transformations-B5lM6fYX.js";
3
3
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
4
- import { DataTexture, FloatType, LinearFilter, NearestFilter, RGBAFormat } from "three";
5
- import { convertToTexture, float, screenUV, smoothstep, texture, vec2, vec4 } from "three/tsl";
4
+ import { StorageTexture } from "three/webgpu";
5
+ import { DataTexture, FloatType, LinearFilter as LinearFilter$1, NearestFilter, RGBAFormat } from "three";
6
+ import { Fn, If, convertToTexture, float, instanceIndex, int, screenUV, smoothstep, storageTexture, texture, textureStore, uint, uniformArray, uvec2, vec2, vec4 } from "three/tsl";
6
7
  var seededRandom = (seed) => {
7
8
  const x = Math.sin(seed) * 1e4;
8
9
  return x - Math.floor(x);
9
10
  };
11
+ var SHARD_COUNT = 16;
12
+ var VORONOI_SIZE = 1024;
10
13
  const componentDefinition = {
11
14
  name: "Shatter",
12
15
  category: "Interactive",
@@ -140,23 +143,148 @@ const componentDefinition = {
140
143
  }
141
144
  }
142
145
  },
143
- fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions }) => {
144
- const SHARD_COUNT = 16;
146
+ computeNode: ({ uniforms, onCleanup }) => {
147
+ const cellPositions = uniformArray(new Array(SHARD_COUNT * 2).fill(0), "float");
148
+ const voronoiTex = new StorageTexture(VORONOI_SIZE, VORONOI_SIZE);
149
+ voronoiTex.type = FloatType;
150
+ voronoiTex.magFilter = NearestFilter;
151
+ voronoiTex.minFilter = NearestFilter;
152
+ voronoiTex.generateMipmaps = false;
153
+ const voronoiTexNode = storageTexture(voronoiTex);
154
+ onCleanup(() => {
155
+ voronoiTex.dispose();
156
+ });
157
+ const vs = uint(VORONOI_SIZE);
158
+ const invVS = float(1 / VORONOI_SIZE);
159
+ const voronoiKernel = Fn(() => {
160
+ const idx = instanceIndex;
161
+ const x = idx.mod(vs);
162
+ const y = idx.div(vs);
163
+ If(y.lessThan(vs), () => {
164
+ const u = x.toFloat().add(float(.5)).mul(invVS);
165
+ const v = y.toFloat().add(float(.5)).mul(invVS);
166
+ const d1 = float(99999).toVar();
167
+ const d2 = float(99999).toVar();
168
+ const idx1 = float(0).toVar();
169
+ const idx2 = float(0).toVar();
170
+ for (let i = 0; i < SHARD_COUNT; i++) {
171
+ const cellX = cellPositions.element(int(i * 2));
172
+ const cellY = cellPositions.element(int(i * 2 + 1));
173
+ const ddx = u.sub(cellX);
174
+ const ddy = v.sub(cellY);
175
+ const distSq = ddx.mul(ddx).add(ddy.mul(ddy));
176
+ If(distSq.lessThan(d1), () => {
177
+ d2.assign(d1);
178
+ idx2.assign(idx1);
179
+ d1.assign(distSq);
180
+ idx1.assign(float(i));
181
+ }).Else(() => {
182
+ If(distSq.lessThan(d2), () => {
183
+ d2.assign(distSq);
184
+ idx2.assign(float(i));
185
+ });
186
+ });
187
+ }
188
+ textureStore(voronoiTexNode, uvec2(x, y), vec4(idx1, idx2, float(0), float(0))).toWriteOnly();
189
+ });
190
+ })().compute(VORONOI_SIZE * VORONOI_SIZE, [256]);
191
+ let currentSeed = uniforms.seed.uniform.value;
192
+ let needsDispatch = true;
193
+ const generateCells = (seed) => {
194
+ const positions = new Array(SHARD_COUNT * 2);
195
+ for (let i = 0; i < SHARD_COUNT; i++) {
196
+ positions[i * 2] = seededRandom(seed + i * 2);
197
+ positions[i * 2 + 1] = seededRandom(seed + i * 2 + 1);
198
+ }
199
+ cellPositions.array = positions;
200
+ };
201
+ generateCells(currentSeed);
202
+ return {
203
+ outputs: { voronoiTexture: voronoiTex },
204
+ getComputeNodes: () => {
205
+ const newSeed = uniforms.seed.uniform.value;
206
+ if (newSeed !== currentSeed) {
207
+ currentSeed = newSeed;
208
+ generateCells(currentSeed);
209
+ needsDispatch = true;
210
+ }
211
+ if (needsDispatch) {
212
+ needsDispatch = false;
213
+ return [voronoiKernel];
214
+ }
215
+ return null;
216
+ }
217
+ };
218
+ },
219
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions, computeOutputs }) => {
145
220
  const FRICTION = 1;
146
221
  const cellData = new Float32Array(SHARD_COUNT * 4);
147
222
  const cellTexture = new DataTexture(cellData, 4, 4, RGBAFormat, FloatType);
148
- cellTexture.magFilter = LinearFilter;
149
- cellTexture.minFilter = LinearFilter;
223
+ cellTexture.magFilter = LinearFilter$1;
224
+ cellTexture.minFilter = LinearFilter$1;
150
225
  const displacementData = new Float32Array(SHARD_COUNT * 4);
151
226
  const displacementTexture = new DataTexture(displacementData, 4, 4, RGBAFormat, FloatType);
152
- displacementTexture.magFilter = LinearFilter;
153
- displacementTexture.minFilter = LinearFilter;
154
- const VORONOI_SIZE = 1024;
155
- const voronoiData = new Float32Array(VORONOI_SIZE * VORONOI_SIZE * 4);
156
- const voronoiTexture = new DataTexture(voronoiData, VORONOI_SIZE, VORONOI_SIZE, RGBAFormat, FloatType);
157
- voronoiTexture.magFilter = NearestFilter;
158
- voronoiTexture.minFilter = NearestFilter;
159
- const generateCells = (seed) => {
227
+ displacementTexture.magFilter = LinearFilter$1;
228
+ displacementTexture.minFilter = LinearFilter$1;
229
+ let voronoiField;
230
+ if (computeOutputs?.voronoiTexture) voronoiField = texture(computeOutputs.voronoiTexture);
231
+ else {
232
+ const voronoiData = new Float32Array(VORONOI_SIZE * VORONOI_SIZE * 4);
233
+ const voronoiTexture = new DataTexture(voronoiData, VORONOI_SIZE, VORONOI_SIZE, RGBAFormat, FloatType);
234
+ voronoiTexture.magFilter = NearestFilter;
235
+ voronoiTexture.minFilter = NearestFilter;
236
+ voronoiField = texture(voronoiTexture);
237
+ const generateVoronoi = () => {
238
+ for (let y = 0; y < VORONOI_SIZE; y++) for (let x = 0; x < VORONOI_SIZE; x++) {
239
+ const u = (x + .5) / VORONOI_SIZE;
240
+ const v = (y + .5) / VORONOI_SIZE;
241
+ let d1 = Infinity, d2 = Infinity, i1 = 0, i2 = 0;
242
+ for (let i = 0; i < SHARD_COUNT; i++) {
243
+ const dx = u - cellData[i * 4];
244
+ const dy = v - cellData[i * 4 + 1];
245
+ const distSq = dx * dx + dy * dy;
246
+ if (distSq < d1) {
247
+ d2 = d1;
248
+ i2 = i1;
249
+ d1 = distSq;
250
+ i1 = i;
251
+ } else if (distSq < d2) {
252
+ d2 = distSq;
253
+ i2 = i;
254
+ }
255
+ }
256
+ const offset = (y * VORONOI_SIZE + x) * 4;
257
+ voronoiData[offset] = i1;
258
+ voronoiData[offset + 1] = i2;
259
+ }
260
+ voronoiTexture.needsUpdate = true;
261
+ };
262
+ let currentSeed = uniforms.seed.uniform.value;
263
+ const generateCells = (seed) => {
264
+ for (let i = 0; i < SHARD_COUNT; i++) {
265
+ cellData[i * 4] = seededRandom(seed + i * 2);
266
+ cellData[i * 4 + 1] = seededRandom(seed + i * 2 + 1);
267
+ cellData[i * 4 + 2] = seededRandom(seed + i * 3);
268
+ cellData[i * 4 + 3] = seededRandom(seed + i * 3 + 1);
269
+ }
270
+ cellTexture.needsUpdate = true;
271
+ };
272
+ generateCells(currentSeed);
273
+ generateVoronoi();
274
+ onBeforeRender(() => {
275
+ const newSeed = uniforms.seed.uniform.value;
276
+ if (newSeed !== currentSeed) {
277
+ currentSeed = newSeed;
278
+ generateCells(currentSeed);
279
+ generateVoronoi();
280
+ displacementData.fill(0);
281
+ }
282
+ });
283
+ onCleanup(() => {
284
+ voronoiTexture.dispose();
285
+ });
286
+ }
287
+ const generateCellsFull = (seed) => {
160
288
  for (let i = 0; i < SHARD_COUNT; i++) {
161
289
  cellData[i * 4] = seededRandom(seed + i * 2);
162
290
  cellData[i * 4 + 1] = seededRandom(seed + i * 2 + 1);
@@ -165,60 +293,25 @@ const componentDefinition = {
165
293
  }
166
294
  cellTexture.needsUpdate = true;
167
295
  };
168
- const generateVoronoi = () => {
169
- for (let y = 0; y < VORONOI_SIZE; y++) for (let x = 0; x < VORONOI_SIZE; x++) {
170
- const u = (x + .5) / VORONOI_SIZE;
171
- const v = (y + .5) / VORONOI_SIZE;
172
- let d1 = Infinity;
173
- let d2 = Infinity;
174
- let idx1 = 0;
175
- let idx2 = 0;
176
- for (let i = 0; i < SHARD_COUNT; i++) {
177
- const dx = u - cellData[i * 4];
178
- const dy = v - cellData[i * 4 + 1];
179
- const distSq = dx * dx + dy * dy;
180
- if (distSq < d1) {
181
- d2 = d1;
182
- idx2 = idx1;
183
- d1 = distSq;
184
- idx1 = i;
185
- } else if (distSq < d2) {
186
- d2 = distSq;
187
- idx2 = i;
188
- }
189
- }
190
- const offset = (y * VORONOI_SIZE + x) * 4;
191
- voronoiData[offset] = idx1;
192
- voronoiData[offset + 1] = idx2;
193
- voronoiData[offset + 2] = 0;
194
- voronoiData[offset + 3] = 0;
195
- }
196
- voronoiTexture.needsUpdate = true;
197
- };
198
- let currentSeed = uniforms.seed.uniform.value;
199
- generateCells(currentSeed);
200
- generateVoronoi();
296
+ let currentSeedForDisp = uniforms.seed.uniform.value;
297
+ generateCellsFull(currentSeedForDisp);
201
298
  displacementData.fill(0);
202
299
  displacementTexture.needsUpdate = true;
203
- let prevX = .5;
204
- let prevY = .5;
205
- let lastTime = Date.now();
300
+ let prevX = .5, prevY = .5, lastTime = Date.now();
206
301
  onBeforeRender(({ pointer }) => {
207
302
  const currentTime = Date.now();
208
303
  const dt = Math.min((currentTime - lastTime) / 1e3, .016);
209
304
  lastTime = currentTime;
210
305
  const aspect = dimensions.width / dimensions.height;
211
306
  const newSeed = uniforms.seed.uniform.value;
212
- if (newSeed !== currentSeed) {
213
- currentSeed = newSeed;
214
- generateCells(currentSeed);
215
- generateVoronoi();
307
+ if (newSeed !== currentSeedForDisp) {
308
+ currentSeedForDisp = newSeed;
309
+ generateCellsFull(currentSeedForDisp);
216
310
  displacementData.fill(0);
217
311
  }
218
312
  const intensity = uniforms.intensity.uniform.value;
219
313
  const radius = uniforms.radius.uniform.value;
220
314
  const decay = uniforms.decay.uniform.value;
221
- const friction = FRICTION;
222
315
  let velX = dt > 0 ? (pointer.x - prevX) / dt : 0;
223
316
  let velY = dt > 0 ? (pointer.y - prevY) / dt : 0;
224
317
  let speed = Math.sqrt(velX * velX + velY * velY);
@@ -243,8 +336,7 @@ const componentDefinition = {
243
336
  const decayFactor = Math.exp(-dt / decayTime);
244
337
  currentDx *= decayFactor;
245
338
  currentDy *= decayFactor;
246
- let velocityDx = 0;
247
- let velocityDy = 0;
339
+ let velocityDx = 0, velocityDy = 0;
248
340
  if (dist < radius && speed > .01) {
249
341
  const influence = Math.max(0, 1 - dist / radius);
250
342
  const influenceCurve = influence * influence;
@@ -255,7 +347,7 @@ const componentDefinition = {
255
347
  velocityDx += randomDirX * jitterForce;
256
348
  velocityDy += randomDirY * jitterForce;
257
349
  }
258
- const lerpFactor = Math.min(1, friction * dt);
350
+ const lerpFactor = Math.min(1, FRICTION * dt);
259
351
  displacementData[i * 4] = currentDx + velocityDx * lerpFactor;
260
352
  displacementData[i * 4 + 1] = currentDy + velocityDy * lerpFactor;
261
353
  displacementData[i * 4 + 2] = 0;
@@ -268,7 +360,6 @@ const componentDefinition = {
268
360
  onCleanup(() => {
269
361
  cellTexture.dispose();
270
362
  displacementTexture.dispose();
271
- voronoiTexture.dispose();
272
363
  });
273
364
  if (!childNode) return vec4(0, 0, 0, 0);
274
365
  const childTexture = convertToTexture(childNode);
@@ -277,7 +368,7 @@ const componentDefinition = {
277
368
  });
278
369
  const cellField = texture(cellTexture);
279
370
  const dispField = texture(displacementTexture);
280
- const voronoiSample = texture(voronoiTexture).sample(screenUV);
371
+ const voronoiSample = voronoiField.sample(screenUV);
281
372
  const nearestIdx = voronoiSample.r;
282
373
  const secondIdx = voronoiSample.g;
283
374
  const nearestUV = vec2(nearestIdx.mod(float(4)).add(.5).div(4), nearestIdx.div(float(4)).floor().add(.5).div(4));
@@ -304,12 +395,9 @@ const componentDefinition = {
304
395
  const rUV = displacedUV.add(rOffset.mul(crackIntensity));
305
396
  const gUV = displacedUV.add(gOffset.mul(crackIntensity));
306
397
  const bUV = displacedUV.add(bOffset.mul(crackIntensity));
307
- const rSample = childTexture.sample(rUV);
308
- const gSample = childTexture.sample(gUV);
309
- const bSample = childTexture.sample(bUV);
310
- const rFinal = applyEdgeHandling(rUV, rSample, childTexture, uniforms.edges.uniform.value);
311
- const gFinal = applyEdgeHandling(gUV, gSample, childTexture, uniforms.edges.uniform.value);
312
- const bFinal = applyEdgeHandling(bUV, bSample, childTexture, uniforms.edges.uniform.value);
398
+ const rFinal = applyEdgeHandling(rUV, childTexture.sample(rUV), childTexture, uniforms.edges.uniform.value);
399
+ const gFinal = applyEdgeHandling(gUV, childTexture.sample(gUV), childTexture, uniforms.edges.uniform.value);
400
+ const bFinal = applyEdgeHandling(bUV, childTexture.sample(bUV), childTexture, uniforms.edges.uniform.value);
313
401
  const refractedColor = vec4(rFinal.r, gFinal.g, bFinal.b, gFinal.a);
314
402
  const normalColor = applyEdgeHandling(displacedUV, childTexture.sample(displacedUV), childTexture, uniforms.edges.uniform.value);
315
403
  let shadedRGB = normalColor.rgb.mul(float(1).sub(crackIntensity)).add(refractedColor.rgb.mul(crackIntensity));
@@ -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 { d as starSdf } from "./sdf-Bux00UoZ.js";
3
+ import { d as starSdf } 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 { l as transformPosition, r as transformAngle } from "./transformations-B5lM6fYX.js";
2
2
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
3
- import { Fn, abs, convertToTexture, cos, dot, float, mix, radians, screenUV, sin, smoothstep, vec2, vec4, viewportSize } from "three/tsl";
3
+ import { n as createVariableGaussianBlurCompute } from "./computeBlur-B0KA4n89.js";
4
+ import { Fn, If, abs, convertToTexture, cos, dot, float, instanceIndex, mix, radians, screenUV, sin, smoothstep, texture, textureStore, uint, uniform, uvec2, vec2, vec4, viewportSize } from "three/tsl";
4
5
  const componentDefinition = {
5
6
  name: "TiltShift",
6
7
  category: "Blurs",
@@ -71,8 +72,65 @@ const componentDefinition = {
71
72
  }
72
73
  }
73
74
  },
74
- fragmentNode: ({ uniforms, childNode, onCleanup }) => {
75
+ computeNode: ({ childNode, onCleanup, dimensions, renderer, uniforms }) => {
76
+ if (!childNode) return null;
77
+ const childTexture = convertToTexture(childNode);
78
+ onCleanup(() => {
79
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
80
+ });
81
+ const dpr = renderer?.getPixelRatio?.() ?? 1;
82
+ const texWidth = Math.round(dimensions.width * dpr);
83
+ const texHeight = Math.round(dimensions.height * dpr);
84
+ const { computeNodes: blurNodes, outputTexture, blurMapWriteNode } = createVariableGaussianBlurCompute(childTexture, texWidth, texHeight, onCleanup);
85
+ const angleU = uniform(0);
86
+ const centerXU = uniform(.5);
87
+ const centerYU = uniform(.5);
88
+ const focusWidthU = uniform(.15);
89
+ const falloffU = uniform(.3);
90
+ const maxRadiusU = uniform(18);
91
+ const aspectU = uniform(1);
92
+ const w = uint(texWidth);
93
+ const h = uint(texHeight);
94
+ const fillBlurMap = Fn(() => {
95
+ const idx = instanceIndex;
96
+ const x = idx.mod(w);
97
+ const y = idx.div(w);
98
+ If(y.lessThan(h), () => {
99
+ const u = x.toFloat().add(float(.5)).div(float(texWidth));
100
+ const v = y.toFloat().add(float(.5)).div(float(texHeight));
101
+ const angleRad = angleU.mul(float(Math.PI / 180));
102
+ const cosA = angleRad.cos();
103
+ const perpVector = vec2(angleRad.sin().negate(), cosA);
104
+ const centerPos = vec2(centerXU, float(1).sub(centerYU));
105
+ const centeredUV = vec2(u, v).sub(centerPos);
106
+ const distFromLine = abs(dot(vec2(centeredUV.x.mul(aspectU), centeredUV.y), perpVector));
107
+ const radius = smoothstep(focusWidthU, focusWidthU.add(falloffU), distFromLine).mul(maxRadiusU);
108
+ textureStore(blurMapWriteNode, uvec2(x, y), vec4(radius, float(0), float(0), float(1))).toWriteOnly();
109
+ });
110
+ })().compute(texWidth * texHeight, [256]);
111
+ return {
112
+ outputs: {
113
+ childTexture,
114
+ blurredTexture: outputTexture
115
+ },
116
+ getComputeNodes: () => {
117
+ angleU.value = uniforms.angle.uniform.value;
118
+ centerXU.value = uniforms.center.uniform.value?.x ?? uniforms.center.uniform.x?.value ?? .5;
119
+ centerYU.value = uniforms.center.uniform.value?.y ?? uniforms.center.uniform.y?.value ?? .5;
120
+ focusWidthU.value = uniforms.width.uniform.value * .5;
121
+ falloffU.value = uniforms.falloff.uniform.value;
122
+ aspectU.value = dimensions.width / dimensions.height;
123
+ maxRadiusU.value = uniforms.intensity.uniform.value * .36;
124
+ return [fillBlurMap, ...blurNodes];
125
+ }
126
+ };
127
+ },
128
+ fragmentNode: ({ uniforms, childNode, onCleanup, computeOutputs }) => {
75
129
  if (!childNode) return vec4(0, 0, 0, 0);
130
+ if (computeOutputs?.blurredTexture) {
131
+ const sharp = computeOutputs.childTexture.sample(screenUV);
132
+ return unpremultiplyAlpha(vec4(texture(computeOutputs.blurredTexture).sample(screenUV).rgb, sharp.a));
133
+ }
76
134
  const childTexture = convertToTexture(childNode);
77
135
  onCleanup(() => {
78
136
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
@@ -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 { f as trapezoidSdf } from "./sdf-Bux00UoZ.js";
3
+ import { f as trapezoidSdf } 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,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 { p as vesicaSdf } from "./sdf-Bux00UoZ.js";
3
+ import { p as vesicaSdf } 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,4 +1,4 @@
1
- import { t as needsVideoCanvasWorkaround } from "./browser-DIoaEnIX.js";
1
+ import { t as needsVideoCanvasWorkaround } from "./browser-ClWxLlIB.js";
2
2
  import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
3
3
  import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {
@@ -2,7 +2,7 @@ import { t as applyEdgeHandling } from "./edges-CfGcQniB.js";
2
2
  import { c as transformEdges } from "./transformations-B5lM6fYX.js";
3
3
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
4
4
  import { t as createAnimatedTime } from "./time-DUqSFWvT.js";
5
- import { PI, abs, convertToTexture, cos, float, fract, screenUV, sin, step, vec2, vec4, viewportSize } from "three/tsl";
5
+ import { PI, abs, convertToTexture, cos, float, fract, screenUV, sin, step, uniform, vec2, vec4, viewportSize } from "three/tsl";
6
6
  const componentDefinition = {
7
7
  name: "WaveDistortion",
8
8
  category: "Distortions",
@@ -130,14 +130,27 @@ const componentDefinition = {
130
130
  }
131
131
  },
132
132
  fragmentNode: (params) => {
133
- const { uniforms, childNode, onCleanup } = params;
133
+ const { uniforms, childNode, onCleanup, onBeforeRender } = params;
134
134
  if (!childNode) return vec4(0, 0, 0, 0);
135
135
  const uvCoord = screenUV;
136
136
  const aspect = viewportSize.x.div(viewportSize.y);
137
137
  const t = createAnimatedTime(params, uniforms.speed).mul(.5);
138
- const angleRad = uniforms.angle.uniform.mul(PI).div(180);
139
- const cosAngle = cos(angleRad);
140
- const sinAngle = sin(angleRad);
138
+ let cosAngle, sinAngle;
139
+ if (uniforms.angle.uniform.isUniformNode) {
140
+ const precomputedCos = uniform(1);
141
+ const precomputedSin = uniform(0);
142
+ onBeforeRender(() => {
143
+ const rad = uniforms.angle.uniform.value * Math.PI / 180;
144
+ precomputedCos.value = Math.cos(rad);
145
+ precomputedSin.value = Math.sin(rad);
146
+ });
147
+ cosAngle = precomputedCos;
148
+ sinAngle = precomputedSin;
149
+ } else {
150
+ const angleRad = uniforms.angle.uniform.mul(PI).div(180);
151
+ cosAngle = cos(angleRad);
152
+ sinAngle = sin(angleRad);
153
+ }
141
154
  const centeredUV = uvCoord.sub(vec2(.5, .5));
142
155
  const aspectCorrectedUV = vec2(centeredUV.x.mul(aspect), centeredUV.y);
143
156
  const phase = vec2(aspectCorrectedUV.x.mul(cosAngle).sub(aspectCorrectedUV.y.mul(sinAngle)), aspectCorrectedUV.x.mul(sinAngle).add(aspectCorrectedUV.y.mul(cosAngle))).y.add(.5).mul(uniforms.frequency.uniform).mul(PI.mul(2)).add(t);
@@ -1,4 +1,4 @@
1
- import { t as needsVideoCanvasWorkaround } from "./browser-DIoaEnIX.js";
1
+ import { t as needsVideoCanvasWorkaround } from "./browser-ClWxLlIB.js";
2
2
  import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
3
3
  import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
4
4
  const componentDefinition = {