shaders 2.5.109 → 2.5.111

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 (267) hide show
  1. package/dist/core/{Aurora-BPHeGEZ_.js → Aurora-KcUDr49P.js} +21 -14
  2. package/dist/core/{Blur-Cxx3ZuHi.js → Blur-DG7lJKPo.js} +29 -13
  3. package/dist/core/{Bulge-Chpbxxzj.js → Bulge-6gRUYqZS.js} +1 -1
  4. package/dist/core/{ChannelBlur-Cth0biwG.js → ChannelBlur-BhcCkwcO.js} +7 -3
  5. package/dist/core/{ConcentricSpin-Crfxti93.js → ConcentricSpin-Fegtvhl6.js} +1 -1
  6. package/dist/core/{ContourLines-KTHC32hd.js → ContourLines-tDBvQOvb.js} +8 -7
  7. package/dist/core/{CursorRipples-D-cfjHY5.js → CursorRipples-BqtHgpEq.js} +1 -1
  8. package/dist/core/{CursorTrail-R4IBB4eu.js → CursorTrail-CgRMXbTG.js} +5 -5
  9. package/dist/core/{DiffuseBlur-eyM1v3ad.js → DiffuseBlur-B-Vki4ab.js} +1 -1
  10. package/dist/core/{DropShadow-jMhnYPXZ.js → DropShadow-B7FzTp4H.js} +14 -8
  11. package/dist/core/{Duotone-Bl02WcA2.js → Duotone-CqQ0NMxS.js} +4 -11
  12. package/dist/core/{FloatingParticles-BtwGRl_d.js → FloatingParticles-DpYA0_TE.js} +6 -2
  13. package/dist/core/{FlowField-RyqiRxyI.js → FlowField-CTWyjeXm.js} +1 -1
  14. package/dist/core/FlutedGlass-B4FlyBOn.js +320 -0
  15. package/dist/core/{Form3D-DaPbLGUi.js → Form3D-CqmOXXGj.js} +14 -2
  16. package/dist/core/{Glass-TRSXbuE6.js → Glass-BCOkQbvW.js} +7 -3
  17. package/dist/core/{Glow-8bKkyehK.js → Glow-CsTZA75y.js} +68 -55
  18. package/dist/core/{GridDistortion-CpSiGEGV.js → GridDistortion-CVpebl48.js} +5 -5
  19. package/dist/core/{HueShift-BtGVMu7q.js → HueShift-C1RxETwN.js} +2 -0
  20. package/dist/core/{ImageTexture-CrX_9-f0.js → ImageTexture-DXhgMEOT.js} +30 -17
  21. package/dist/core/{Kaleidoscope-CFWtKisp.js → Kaleidoscope-B0_OCrob.js} +1 -1
  22. package/dist/core/{Liquify-D9YIfbfB.js → Liquify-ZMAyGUIb.js} +6 -6
  23. package/dist/core/{Mirror-B7XmfGdw.js → Mirror-Gb0fugtF.js} +1 -1
  24. package/dist/core/{Perspective-BN_OpTZq.js → Perspective-SBZzprC5.js} +1 -1
  25. package/dist/core/{PolarCoordinates-CMYCFT4S.js → PolarCoordinates-Ckvb1eG0.js} +1 -1
  26. package/dist/core/{ProgressiveBlur-B_z0pZ1V.js → ProgressiveBlur-CNacb2Qx.js} +33 -20
  27. package/dist/core/{RectangularCoordinates-8Sa2GaDy.js → RectangularCoordinates-r0fTwVuL.js} +1 -1
  28. package/dist/core/{Saturation-CB19kOXg.js → Saturation-n-aXJS81.js} +2 -0
  29. package/dist/core/{Sharpness-CQOboeqy.js → Sharpness-7tm7b-Bu.js} +2 -0
  30. package/dist/core/{Shatter-SHNbU2KC.js → Shatter-CC3EFcP9.js} +29 -25
  31. package/dist/core/{SimplexNoise-BcSgytjc.js → SimplexNoise-0-rfeziU.js} +14 -2
  32. package/dist/core/{Stretch--GV6hbru.js → Stretch-CJUUU-I1.js} +1 -1
  33. package/dist/core/Swirl-WqPvBF7u.js +105 -0
  34. package/dist/core/{TiltShift-GqDjHvmk.js → TiltShift-CYb6OQoU.js} +47 -21
  35. package/dist/core/{Tint-DaTx2HII.js → Tint-C-bJpwd0.js} +11 -6
  36. package/dist/core/{Tritone-C9Yx69Tw.js → Tritone-LX-qUAGy.js} +4 -11
  37. package/dist/core/{Twirl-v8pLqUTN.js → Twirl-CgRyZdT1.js} +1 -1
  38. package/dist/core/{VideoTexture-SWLe5c3m.js → VideoTexture-Cr1f0IOE.js} +31 -18
  39. package/dist/core/{WaveDistortion-BGdgj3Iz.js → WaveDistortion-iyTUI1lj.js} +1 -1
  40. package/dist/core/{WebcamTexture-cXPyEumA.js → WebcamTexture-BQJpZvC5.js} +31 -18
  41. package/dist/core/computeBlur-DCRhuYEi.js +209 -0
  42. package/dist/core/{edges-CfGcQniB.js → edges-CX_lJB9R.js} +13 -1
  43. package/dist/core/index.js +88 -121
  44. package/dist/core/registry.js +88 -87
  45. package/dist/core/renderer.d.ts.map +1 -1
  46. package/dist/core/shaderRegistry-SmtG2mTo.js +254 -0
  47. package/dist/core/shaderRegistry.d.ts.map +1 -1
  48. package/dist/core/shaders/Aurora/index.d.ts.map +1 -1
  49. package/dist/core/shaders/Aurora/index.js +1 -1
  50. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  51. package/dist/core/shaders/Blur/index.js +2 -2
  52. package/dist/core/shaders/Bulge/index.js +2 -2
  53. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  54. package/dist/core/shaders/ChannelBlur/index.js +2 -2
  55. package/dist/core/shaders/ConcentricSpin/index.js +2 -2
  56. package/dist/core/shaders/ContourLines/index.d.ts.map +1 -1
  57. package/dist/core/shaders/ContourLines/index.js +1 -1
  58. package/dist/core/shaders/CursorRipples/index.js +2 -2
  59. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  60. package/dist/core/shaders/CursorTrail/index.js +1 -1
  61. package/dist/core/shaders/DiffuseBlur/index.js +2 -2
  62. package/dist/core/shaders/DropShadow/index.d.ts.map +1 -1
  63. package/dist/core/shaders/DropShadow/index.js +1 -1
  64. package/dist/core/shaders/Duotone/index.d.ts.map +1 -1
  65. package/dist/core/shaders/Duotone/index.js +1 -2
  66. package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
  67. package/dist/core/shaders/FloatingParticles/index.js +1 -1
  68. package/dist/core/shaders/FlowField/index.js +2 -2
  69. package/dist/core/shaders/FlutedGlass/index.d.ts +97 -0
  70. package/dist/core/shaders/FlutedGlass/index.d.ts.map +1 -0
  71. package/dist/core/shaders/FlutedGlass/index.js +6 -0
  72. package/dist/core/shaders/Fog/index.js +1 -1
  73. package/dist/core/shaders/Form3D/index.d.ts.map +1 -1
  74. package/dist/core/shaders/Form3D/index.js +1 -1
  75. package/dist/core/shaders/Glass/index.d.ts.map +1 -1
  76. package/dist/core/shaders/Glass/index.js +2 -2
  77. package/dist/core/shaders/GlassTiles/index.js +1 -1
  78. package/dist/core/shaders/Glitch/index.js +1 -1
  79. package/dist/core/shaders/Glow/index.d.ts +2 -2
  80. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  81. package/dist/core/shaders/Glow/index.js +2 -2
  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 +2 -2
  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.d.ts.map +1 -1
  91. package/dist/core/shaders/HueShift/index.js +1 -1
  92. package/dist/core/shaders/ImageTexture/index.d.ts.map +1 -1
  93. package/dist/core/shaders/ImageTexture/index.js +1 -1
  94. package/dist/core/shaders/Invert/index.js +1 -1
  95. package/dist/core/shaders/Kaleidoscope/index.js +2 -2
  96. package/dist/core/shaders/LensFlare/index.js +1 -1
  97. package/dist/core/shaders/LinearBlur/index.js +1 -1
  98. package/dist/core/shaders/LinearGradient/index.js +1 -1
  99. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  100. package/dist/core/shaders/Liquify/index.js +2 -2
  101. package/dist/core/shaders/Mirror/index.js +2 -2
  102. package/dist/core/shaders/MultiPointGradient/index.js +1 -1
  103. package/dist/core/shaders/Neon/index.js +1 -1
  104. package/dist/core/shaders/Paper/index.js +1 -1
  105. package/dist/core/shaders/Perspective/index.js +2 -2
  106. package/dist/core/shaders/Pixelate/index.js +1 -1
  107. package/dist/core/shaders/Plasma/index.js +1 -1
  108. package/dist/core/shaders/PolarCoordinates/index.js +2 -2
  109. package/dist/core/shaders/Polygon/index.js +1 -1
  110. package/dist/core/shaders/Posterize/index.js +1 -1
  111. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  112. package/dist/core/shaders/ProgressiveBlur/index.js +2 -2
  113. package/dist/core/shaders/RadialGradient/index.js +1 -1
  114. package/dist/core/shaders/RectangularCoordinates/index.js +2 -2
  115. package/dist/core/shaders/Ring/index.js +1 -1
  116. package/dist/core/shaders/Ripples/index.js +1 -1
  117. package/dist/core/shaders/RoundedRect/index.js +1 -1
  118. package/dist/core/shaders/Saturation/index.d.ts.map +1 -1
  119. package/dist/core/shaders/Saturation/index.js +1 -1
  120. package/dist/core/shaders/Sharpness/index.d.ts.map +1 -1
  121. package/dist/core/shaders/Sharpness/index.js +1 -1
  122. package/dist/core/shaders/Shatter/index.d.ts.map +1 -1
  123. package/dist/core/shaders/Shatter/index.js +2 -2
  124. package/dist/core/shaders/SimplexNoise/index.d.ts +7 -0
  125. package/dist/core/shaders/SimplexNoise/index.d.ts.map +1 -1
  126. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  127. package/dist/core/shaders/SineWave/index.js +1 -1
  128. package/dist/core/shaders/Smoke/index.js +1 -1
  129. package/dist/core/shaders/SmokeFill/index.js +1 -1
  130. package/dist/core/shaders/Solarize/index.js +1 -1
  131. package/dist/core/shaders/SolidColor/index.js +1 -1
  132. package/dist/core/shaders/Spherize/index.js +1 -1
  133. package/dist/core/shaders/Spiral/index.js +1 -1
  134. package/dist/core/shaders/Star/index.js +1 -1
  135. package/dist/core/shaders/Strands/index.js +1 -1
  136. package/dist/core/shaders/Stretch/index.js +2 -2
  137. package/dist/core/shaders/Stripes/index.js +1 -1
  138. package/dist/core/shaders/StudioBackground/index.js +1 -1
  139. package/dist/core/shaders/Swirl/index.d.ts.map +1 -1
  140. package/dist/core/shaders/Swirl/index.js +1 -1
  141. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  142. package/dist/core/shaders/TiltShift/index.js +2 -2
  143. package/dist/core/shaders/Tint/index.d.ts.map +1 -1
  144. package/dist/core/shaders/Tint/index.js +1 -1
  145. package/dist/core/shaders/Trapezoid/index.js +1 -1
  146. package/dist/core/shaders/Tritone/index.d.ts.map +1 -1
  147. package/dist/core/shaders/Tritone/index.js +1 -2
  148. package/dist/core/shaders/Truchet/index.js +1 -1
  149. package/dist/core/shaders/Twirl/index.js +2 -2
  150. package/dist/core/shaders/VHS/index.js +1 -1
  151. package/dist/core/shaders/Vesica/index.js +1 -1
  152. package/dist/core/shaders/Vibrance/index.js +1 -1
  153. package/dist/core/shaders/VideoTexture/index.d.ts.map +1 -1
  154. package/dist/core/shaders/VideoTexture/index.js +2 -2
  155. package/dist/core/shaders/Vignette/index.js +1 -1
  156. package/dist/core/shaders/Voronoi/index.js +1 -1
  157. package/dist/core/shaders/WaveDistortion/index.js +2 -2
  158. package/dist/core/shaders/Weave/index.js +1 -1
  159. package/dist/core/shaders/WebcamTexture/index.d.ts.map +1 -1
  160. package/dist/core/shaders/WebcamTexture/index.js +2 -2
  161. package/dist/core/shaders/ZoomBlur/index.js +1 -1
  162. package/dist/core/utilities/computeBlur.d.ts +29 -31
  163. package/dist/core/utilities/computeBlur.d.ts.map +1 -1
  164. package/dist/js/createShader.d.ts.map +1 -1
  165. package/dist/js/createShader.js +3 -2
  166. package/dist/js/createSharedDevice.d.ts +36 -0
  167. package/dist/js/createSharedDevice.d.ts.map +1 -0
  168. package/dist/js/createSharedDevice.js +15 -0
  169. package/dist/js/index.d.ts +1 -0
  170. package/dist/js/index.d.ts.map +1 -1
  171. package/dist/js/index.js +2 -1
  172. package/dist/js/types.d.ts +10 -0
  173. package/dist/js/types.d.ts.map +1 -1
  174. package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
  175. package/dist/js/utils/generatePresetCode.js +21 -1
  176. package/dist/react/FlutedGlass.js +223 -0
  177. package/dist/react/Preview.js +1 -0
  178. package/dist/react/Shader.js +1 -1
  179. package/dist/react/components/FlutedGlass.d.ts +41 -0
  180. package/dist/react/components/FlutedGlass.d.ts.map +1 -0
  181. package/dist/react/engine/Preview.d.ts.map +1 -1
  182. package/dist/react/index.d.ts +1 -0
  183. package/dist/react/index.d.ts.map +1 -1
  184. package/dist/react/index.js +2 -1
  185. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  186. package/dist/react/utils/generatePresetCode.js +21 -1
  187. package/dist/registry.js +628 -83
  188. package/dist/solid/components/FlutedGlass.d.ts +38 -0
  189. package/dist/solid/components/FlutedGlass.d.ts.map +1 -0
  190. package/dist/solid/components/FlutedGlass.js +228 -0
  191. package/dist/solid/engine/Preview.d.ts.map +1 -1
  192. package/dist/solid/engine/Preview.js +76 -74
  193. package/dist/solid/engine/Shader.js +1 -1
  194. package/dist/solid/index.d.ts +1 -0
  195. package/dist/solid/index.d.ts.map +1 -1
  196. package/dist/solid/index.js +146 -144
  197. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  198. package/dist/solid/utils/generatePresetCode.js +21 -1
  199. package/dist/svelte/components/FlutedGlass.svelte.d.ts +28 -0
  200. package/dist/svelte/{generatePresetCode-DR_OAIL7.js → generatePresetCode-DAEzZxbM.js} +21 -1
  201. package/dist/svelte/index.d.ts +1 -0
  202. package/dist/svelte/index.js +769 -569
  203. package/dist/svelte/source/components/FlutedGlass.svelte +334 -0
  204. package/dist/svelte/source/engine/Preview.svelte +2 -0
  205. package/dist/svelte/source/index.js +1 -0
  206. package/dist/svelte/utils/generatePresetCode.js +1 -1
  207. package/dist/vue/FlutedGlass.js +3 -0
  208. package/dist/vue/FlutedGlass.vue_vue_type_script_setup_true_lang.js +226 -0
  209. package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +2 -0
  210. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  211. package/dist/vue/SimplexNoise.vue_vue_type_script_setup_true_lang.js +1 -0
  212. package/dist/vue/components/FlutedGlass.vue.d.ts +63 -0
  213. package/dist/vue/components/FlutedGlass.vue.d.ts.map +1 -0
  214. package/dist/vue/index.d.ts +1 -0
  215. package/dist/vue/index.d.ts.map +1 -1
  216. package/dist/vue/index.js +2 -1
  217. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  218. package/dist/vue/utils/generatePresetCode.js +21 -1
  219. package/package.json +9 -1
  220. package/dist/core/Swirl-By5FadQK.js +0 -103
  221. package/dist/core/computeBlur-DeXZ99YL.js +0 -150
  222. package/dist/core/shaderRegistry-fwljIrjT.js +0 -252
  223. /package/dist/core/{Fog-BeKcPcTq.js → Fog-CIdU2Wn-.js} +0 -0
  224. /package/dist/core/{GlassTiles-Dgh6nOaE.js → GlassTiles-CMx4NyO-.js} +0 -0
  225. /package/dist/core/{Glitch-BsbzLahF.js → Glitch-BdygvJKe.js} +0 -0
  226. /package/dist/core/{Godrays-D1LINbut.js → Godrays-w3ruw4NO.js} +0 -0
  227. /package/dist/core/{Grayscale-Ri-695Uh.js → Grayscale-ChaVI3AW.js} +0 -0
  228. /package/dist/core/{Grid-BYSsAIEv.js → Grid-CKbLS5tU.js} +0 -0
  229. /package/dist/core/{Group-CkhjTW59.js → Group-BqVJ4S7i.js} +0 -0
  230. /package/dist/core/{Halftone-BUCDTTAU.js → Halftone-BGQeBAgG.js} +0 -0
  231. /package/dist/core/{HexGrid-BUiDrehv.js → HexGrid-BFrnZEZT.js} +0 -0
  232. /package/dist/core/{Invert-azYrcDMi.js → Invert-D3tc2UGp.js} +0 -0
  233. /package/dist/core/{LensFlare-ttrXgfea.js → LensFlare-B8x1fOKu.js} +0 -0
  234. /package/dist/core/{LinearBlur-By2aD8OO.js → LinearBlur-CshzmjfO.js} +0 -0
  235. /package/dist/core/{LinearGradient-CM02z32l.js → LinearGradient-Bzwquw_Q.js} +0 -0
  236. /package/dist/core/{MultiPointGradient-8zGSIM4U.js → MultiPointGradient-D0QQwizn.js} +0 -0
  237. /package/dist/core/{Neon-CMmGJzPy.js → Neon-eN4HlILk.js} +0 -0
  238. /package/dist/core/{Paper-B08rxNys.js → Paper-BmeUPAFe.js} +0 -0
  239. /package/dist/core/{Pixelate-dxPAFCRu.js → Pixelate-DqZcUKFK.js} +0 -0
  240. /package/dist/core/{Plasma-DGCw0cd7.js → Plasma-COq8mAw2.js} +0 -0
  241. /package/dist/core/{Polygon-CsCOt5YE.js → Polygon-BP5eKEiz.js} +0 -0
  242. /package/dist/core/{Posterize-Blv9pzPT.js → Posterize-CxYemXTn.js} +0 -0
  243. /package/dist/core/{RadialGradient-De0gtdh3.js → RadialGradient-SASVv2vb.js} +0 -0
  244. /package/dist/core/{Ring-kHH-DIDQ.js → Ring-CdJlzjRV.js} +0 -0
  245. /package/dist/core/{Ripples-Bf6Zwg6X.js → Ripples-BRZPZszq.js} +0 -0
  246. /package/dist/core/{RoundedRect-B0sWh2BN.js → RoundedRect-lzzi_1J7.js} +0 -0
  247. /package/dist/core/{SineWave-VTNDSK_g.js → SineWave--i6bSrad.js} +0 -0
  248. /package/dist/core/{Smoke-9MJIAKq7.js → Smoke-BgPHDWDR.js} +0 -0
  249. /package/dist/core/{SmokeFill-qV2iRIts.js → SmokeFill-Dtctgt2S.js} +0 -0
  250. /package/dist/core/{Solarize-CWDgSBiv.js → Solarize-gNMmd47z.js} +0 -0
  251. /package/dist/core/{SolidColor-DhMdM3bE.js → SolidColor-D9ikFFu3.js} +0 -0
  252. /package/dist/core/{Spherize-BZxwopX8.js → Spherize-ZBorEEOU.js} +0 -0
  253. /package/dist/core/{Spiral-gpkw37l1.js → Spiral-sg-i02xw.js} +0 -0
  254. /package/dist/core/{Star-WJAOZ5P5.js → Star-BcqCHzHG.js} +0 -0
  255. /package/dist/core/{Strands-DOthZNHt.js → Strands-XLpth60o.js} +0 -0
  256. /package/dist/core/{Stripes-CFCXw1_N.js → Stripes-DEOXYnmy.js} +0 -0
  257. /package/dist/core/{StudioBackground-DJr-cxOL.js → StudioBackground-B5dpTR_X.js} +0 -0
  258. /package/dist/core/{Trapezoid-Co0sIA73.js → Trapezoid-BvTEGdW_.js} +0 -0
  259. /package/dist/core/{Truchet-CkFSkniR.js → Truchet-DE4lgYRb.js} +0 -0
  260. /package/dist/core/{VHS-mKd1QBBj.js → VHS-DbNjgUEX.js} +0 -0
  261. /package/dist/core/{Vesica-CxP7UD0a.js → Vesica-DqJMyqmy.js} +0 -0
  262. /package/dist/core/{Vibrance-WR5yQv_9.js → Vibrance-IDvmP1Xw.js} +0 -0
  263. /package/dist/core/{Vignette-hAIKTi35.js → Vignette-CA12P9VO.js} +0 -0
  264. /package/dist/core/{Voronoi-DOGmwUSK.js → Voronoi-DXeJ3xOf.js} +0 -0
  265. /package/dist/core/{Weave-CIP_EUPa.js → Weave-Bn2CfeE4.js} +0 -0
  266. /package/dist/core/{ZoomBlur-BuIVpHGG.js → ZoomBlur-DOzP_sOK.js} +0 -0
  267. /package/dist/core/{browser-D8zonASQ.js → browser-CsOpQ0L_.js} +0 -0
@@ -0,0 +1,320 @@
1
+ import { n as applyEdgeToUV } from "./edges-CX_lJB9R.js";
2
+ import { a as transformColor, c as transformEdges } from "./transformations-B5lM6fYX.js";
3
+ import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
4
+ import { t as createAnimatedTime } from "./time-DUqSFWvT.js";
5
+ import { PI, abs, convertToTexture, cos, exp2, float, fract, mix, pow, screenUV, sign, sin, sqrt, step, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
6
+ const componentDefinition = {
7
+ name: "FlutedGlass",
8
+ category: "Distortions",
9
+ description: "Full-screen fluted glass effect — refracts content through repeating cylindrical bars",
10
+ requiresRTT: true,
11
+ requiresChild: true,
12
+ props: {
13
+ shape: {
14
+ default: "bars",
15
+ description: "Cross-section shape of each flute",
16
+ compileTime: true,
17
+ transform: (value) => {
18
+ return {
19
+ "bars": 0,
20
+ "rounded": 1,
21
+ "waves": 2
22
+ }[value] ?? 0;
23
+ },
24
+ ui: {
25
+ type: "select",
26
+ options: [
27
+ {
28
+ label: "Bars",
29
+ value: "bars"
30
+ },
31
+ {
32
+ label: "Rounded",
33
+ value: "rounded"
34
+ },
35
+ {
36
+ label: "Waves",
37
+ value: "waves"
38
+ }
39
+ ],
40
+ label: "Shape",
41
+ group: "Effect"
42
+ }
43
+ },
44
+ angle: {
45
+ default: 0,
46
+ description: "Direction of the flutes in degrees (0 = vertical bars)",
47
+ ui: {
48
+ type: ["range", "map"],
49
+ min: 0,
50
+ max: 360,
51
+ step: 1,
52
+ label: "Angle",
53
+ group: "Effect"
54
+ }
55
+ },
56
+ frequency: {
57
+ default: 10,
58
+ description: "Number of flutes across the longest viewport axis",
59
+ ui: {
60
+ type: ["range", "map"],
61
+ min: 1,
62
+ max: 20,
63
+ step: 1,
64
+ label: "Frequency",
65
+ group: "Effect"
66
+ }
67
+ },
68
+ softness: {
69
+ default: .5,
70
+ description: "How smoothly distortion fades from each flute centre to its edge (0 = flat middle / sharp seams, 1 = gentle curve)",
71
+ ui: {
72
+ type: ["range", "map"],
73
+ min: 0,
74
+ max: 1,
75
+ step: .01,
76
+ label: "Softness",
77
+ group: "Effect"
78
+ }
79
+ },
80
+ waveAmplitude: {
81
+ default: .06,
82
+ description: "How far each flute sways horizontally as it travels (Waves shape only)",
83
+ ui: {
84
+ type: ["range", "map"],
85
+ min: 0,
86
+ max: .5,
87
+ step: .01,
88
+ label: "Wave Amplitude",
89
+ group: "Effect",
90
+ condition: { shape: "waves" }
91
+ }
92
+ },
93
+ waveFrequency: {
94
+ default: 1.5,
95
+ description: "How many sways fit along each flute (Waves shape only)",
96
+ ui: {
97
+ type: ["range", "map"],
98
+ min: .1,
99
+ max: 10,
100
+ step: .1,
101
+ label: "Wave Frequency",
102
+ group: "Effect",
103
+ condition: { shape: "waves" }
104
+ }
105
+ },
106
+ speed: {
107
+ default: 0,
108
+ description: "Animation speed — drifts the flute pattern over time and flows wave perturbations",
109
+ ui: {
110
+ type: "range",
111
+ min: -1,
112
+ max: 1,
113
+ step: .05,
114
+ label: "Speed",
115
+ group: "Animation"
116
+ }
117
+ },
118
+ refraction: {
119
+ default: 1.5,
120
+ description: "How aggressively each flute bends content beneath it",
121
+ ui: {
122
+ type: ["range", "map"],
123
+ min: 0,
124
+ max: 4,
125
+ step: .01,
126
+ label: "Refraction",
127
+ group: "Effect"
128
+ }
129
+ },
130
+ aberration: {
131
+ default: .2,
132
+ description: "Chromatic aberration — splits RGB along the refraction direction at flute seams",
133
+ compileTimeWhen: (prev, next) => prev > 0 !== next > 0,
134
+ ui: {
135
+ type: ["range", "map"],
136
+ min: 0,
137
+ max: 1,
138
+ step: .01,
139
+ label: "Aberration",
140
+ group: "Effect"
141
+ }
142
+ },
143
+ lightAngle: {
144
+ default: 30,
145
+ description: "Direction the light source is coming from (0 = head-on, 90 = grazing)",
146
+ ui: {
147
+ type: "range",
148
+ min: -90,
149
+ max: 90,
150
+ step: 1,
151
+ label: "Light Angle",
152
+ group: "Highlight"
153
+ }
154
+ },
155
+ highlight: {
156
+ default: .2,
157
+ description: "Strength of the specular reflection on each flute",
158
+ ui: {
159
+ type: ["range", "map"],
160
+ min: 0,
161
+ max: 2,
162
+ step: .01,
163
+ label: "Highlight",
164
+ group: "Highlight"
165
+ }
166
+ },
167
+ highlightSoftness: {
168
+ default: .3,
169
+ description: "Spread of the specular peak (0 = pin-tight, 1 = broad sheen)",
170
+ ui: {
171
+ type: ["range", "map"],
172
+ min: 0,
173
+ max: 1,
174
+ step: .01,
175
+ label: "Highlight Softness",
176
+ group: "Highlight"
177
+ }
178
+ },
179
+ highlightColor: {
180
+ default: "#ffffff",
181
+ transform: transformColor,
182
+ description: "Color of the specular highlight",
183
+ ui: {
184
+ type: "color",
185
+ label: "Highlight Color",
186
+ group: "Highlight"
187
+ }
188
+ },
189
+ edges: {
190
+ default: "mirror",
191
+ description: "How to handle edges when distortion samples beyond the canvas",
192
+ transform: transformEdges,
193
+ compileTime: true,
194
+ ui: {
195
+ type: "select",
196
+ options: [
197
+ {
198
+ label: "Stretch",
199
+ value: "stretch"
200
+ },
201
+ {
202
+ label: "Transparent",
203
+ value: "transparent"
204
+ },
205
+ {
206
+ label: "Mirror",
207
+ value: "mirror"
208
+ },
209
+ {
210
+ label: "Wrap",
211
+ value: "wrap"
212
+ }
213
+ ],
214
+ label: "Edges",
215
+ group: "Effect"
216
+ }
217
+ }
218
+ },
219
+ fragmentNode: (params) => {
220
+ const { uniforms, childNode, onCleanup, onBeforeRender } = params;
221
+ if (!childNode) return vec4(0);
222
+ const childTexture = convertToTexture(childNode);
223
+ onCleanup(() => {
224
+ if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
225
+ });
226
+ const uvCoord = screenUV;
227
+ const aspect = viewportSize.x.div(viewportSize.y);
228
+ const t = createAnimatedTime(params, uniforms.speed).negate();
229
+ let cosA, sinA;
230
+ if (uniforms.angle.uniform.isUniformNode) {
231
+ const cu = uniform(1);
232
+ const su = uniform(0);
233
+ const updateAngle = () => {
234
+ const r = uniforms.angle.uniform.value * Math.PI / 180;
235
+ cu.value = Math.cos(r);
236
+ su.value = Math.sin(r);
237
+ };
238
+ updateAngle();
239
+ onBeforeRender(updateAngle);
240
+ cosA = cu;
241
+ sinA = su;
242
+ } else {
243
+ const r = uniforms.angle.uniform.mul(PI).div(180);
244
+ cosA = cos(r);
245
+ sinA = sin(r);
246
+ }
247
+ const hx = uniform(0);
248
+ const hy = uniform(1);
249
+ const updateLight = () => {
250
+ const half = uniforms.lightAngle.uniform.value * Math.PI / 360;
251
+ hx.value = Math.sin(half);
252
+ hy.value = Math.cos(half);
253
+ };
254
+ updateLight();
255
+ onBeforeRender(updateLight);
256
+ const centered = uvCoord.sub(vec2(.5, .5));
257
+ const aspCorr = vec2(centered.x.mul(aspect), centered.y);
258
+ const u = aspCorr.x.mul(cosA).add(aspCorr.y.mul(sinA));
259
+ const v = aspCorr.x.mul(sinA).negate().add(aspCorr.y.mul(cosA));
260
+ const shapeId = uniforms.shape.uniform.value;
261
+ const cellPos = fract((shapeId === 2 ? u.add(sin(v.mul(uniforms.waveFrequency.uniform).mul(PI.mul(2)).add(t.mul(2))).mul(uniforms.waveAmplitude.uniform)) : u).mul(uniforms.frequency.uniform).add(t)).sub(.5).mul(2);
262
+ const softness = uniforms.softness.uniform;
263
+ const absCell = abs(cellPos).max(float(1e-4));
264
+ let slope;
265
+ switch (shapeId) {
266
+ case 0: {
267
+ const exp$1 = mix(float(16), float(4), softness);
268
+ slope = sign(cellPos).mul(pow(absCell, exp$1));
269
+ break;
270
+ }
271
+ default: {
272
+ const exp$1 = mix(float(8), float(3), softness);
273
+ slope = sign(cellPos).mul(pow(absCell, exp$1));
274
+ }
275
+ }
276
+ const halfCell = float(.5).div(uniforms.frequency.uniform.max(float(.001)));
277
+ const refrU = slope.mul(uniforms.refraction.uniform).mul(halfCell).negate();
278
+ const refrOffsetX = refrU.mul(cosA).div(aspect);
279
+ const refrOffsetY = refrU.mul(sinA);
280
+ const refractedUV = vec2(uvCoord.x.add(refrOffsetX), uvCoord.y.add(refrOffsetY));
281
+ const aberrationEnabled = typeof uniforms.aberration.uniform.value === "number" ? uniforms.aberration.uniform.value > 0 : true;
282
+ const chrU = refrU.mul(uniforms.aberration.uniform).mul(.5);
283
+ const chrOffX = chrU.mul(cosA).div(aspect);
284
+ const chrOffY = chrU.mul(sinA);
285
+ const edgeMode = uniforms.edges.uniform.value;
286
+ const sampleAt = (uv$1) => {
287
+ if (edgeMode === 1) {
288
+ const inX = step(float(0), uv$1.x).mul(step(uv$1.x, float(1)));
289
+ const inY = step(float(0), uv$1.y).mul(step(uv$1.y, float(1)));
290
+ return childTexture.sample(uv$1).mul(inX.mul(inY));
291
+ }
292
+ return childTexture.sample(applyEdgeToUV(uv$1, edgeMode));
293
+ };
294
+ let sampled;
295
+ if (!aberrationEnabled) sampled = sampleAt(refractedUV);
296
+ else {
297
+ const rUV = vec2(refractedUV.x.add(chrOffX), refractedUV.y.add(chrOffY));
298
+ const bUV = vec2(refractedUV.x.sub(chrOffX), refractedUV.y.sub(chrOffY));
299
+ const rS = sampleAt(rUV);
300
+ const gS = sampleAt(refractedUV);
301
+ const bS = sampleAt(bUV);
302
+ sampled = vec4(rS.r, gS.g, bS.b, gS.a);
303
+ }
304
+ const straight = unpremultiplyAlpha(sampled);
305
+ const baseRgb = vec3(straight.r, straight.g, straight.b);
306
+ const slopeSq = slope.mul(slope).min(float(1));
307
+ const nz = sqrt(float(1).sub(slopeSq));
308
+ const nDotH = slope.mul(hx).add(nz.mul(hy)).max(float(0));
309
+ const shininess = exp2(float(8).sub(uniforms.highlightSoftness.uniform.mul(float(7))));
310
+ const fresnel = pow(float(1).sub(nz), float(5));
311
+ const fresnelMix = float(.04).add(float(.96).mul(fresnel));
312
+ const spec = pow(nDotH, shininess).mul(fresnelMix).mul(uniforms.highlight.uniform);
313
+ const hlCol = uniforms.highlightColor.uniform;
314
+ const specA = spec.mul(straight.a);
315
+ const lit = vec3(baseRgb.x.add(hlCol.x.mul(specA)), baseRgb.y.add(hlCol.y.mul(specA)), baseRgb.z.add(hlCol.z.mul(specA)));
316
+ return vec4(lit.x, lit.y, lit.z, straight.a);
317
+ }
318
+ };
319
+ var FlutedGlass_default = componentDefinition;
320
+ export { componentDefinition as n, FlutedGlass_default as t };
@@ -338,12 +338,24 @@ const componentDefinition = {
338
338
  });
339
339
  const t = createAnimatedTime(params, uniforms.speed);
340
340
  const shapeType = uniforms.shape3dType.uniform.value;
341
+ let _parseCacheKey = null;
342
+ let _parseCacheVal = {};
341
343
  const parse = (raw) => {
344
+ let key;
342
345
  try {
343
- return JSON.parse(typeof raw === "string" ? raw : JSON.stringify(raw));
346
+ key = typeof raw === "string" ? raw : JSON.stringify(raw);
344
347
  } catch {
345
- return {};
348
+ key = null;
346
349
  }
350
+ if (key !== null && key === _parseCacheKey) return _parseCacheVal;
351
+ try {
352
+ _parseCacheVal = JSON.parse(key ?? (typeof raw === "string" ? raw : "{}"));
353
+ _parseCacheKey = key;
354
+ } catch {
355
+ _parseCacheVal = {};
356
+ _parseCacheKey = null;
357
+ }
358
+ return _parseCacheVal;
347
359
  };
348
360
  const cfg0 = parse(uniforms.shape3d.uniform.value);
349
361
  const DEG = Math.PI / 180;
@@ -1,5 +1,5 @@
1
1
  import { a as transformColor, l as transformPosition } from "./transformations-B5lM6fYX.js";
2
- import { t as createGaussianBlurCompute } from "./computeBlur-DeXZ99YL.js";
2
+ import { r as createGaussianBlurCompute } from "./computeBlur-DCRhuYEi.js";
3
3
  import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-DyC2H_qS.js";
4
4
  import { Fn, If, clamp, convertToTexture, dot, exp2, float, max, mix, pow, screenUV, smoothstep, sqrt, texture, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
5
5
  var GOLDEN_ANGLE = 2.3999632297286535;
@@ -391,7 +391,7 @@ const componentDefinition = {
391
391
  description: "Active SDF shape type — triggers recompile when shape is switched. When empty, derived from shape JSON at mount time."
392
392
  }
393
393
  },
394
- computeNode: ({ uniforms, childNode, onCleanup, dimensions, renderer }) => {
394
+ computeNode: ({ uniforms, childNode, onCleanup, dimensions, renderer, onResize }) => {
395
395
  if (!childNode) return null;
396
396
  const blurValue = uniforms.blur.uniform.value;
397
397
  if (typeof blurValue === "number" && blurValue <= 0) return null;
@@ -400,7 +400,11 @@ const componentDefinition = {
400
400
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
401
401
  });
402
402
  const dpr = renderer?.getPixelRatio?.() ?? 1;
403
- const { computeNodes, outputTexture, updateRadius } = createGaussianBlurCompute(childTexture, Math.round(dimensions.width * dpr), Math.round(dimensions.height * dpr), onCleanup, .5);
403
+ const blur = createGaussianBlurCompute(childTexture, Math.round(dimensions.width * dpr), Math.round(dimensions.height * dpr), onCleanup);
404
+ const { computeNodes, outputTexture, updateRadius } = blur;
405
+ onResize(({ width, height }) => {
406
+ blur.setInputDimensions(Math.round(width * dpr), Math.round(height * dpr));
407
+ });
404
408
  return {
405
409
  outputs: {
406
410
  childTexture,
@@ -1,6 +1,8 @@
1
1
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
2
- import { n as createVariableGaussianBlurCompute, t as createGaussianBlurCompute } from "./computeBlur-DeXZ99YL.js";
3
- import { Fn, If, clamp, convertToTexture, dot, float, instanceIndex, int, max, mix, pow, screenUV, texture, textureLoad, textureStore, uint, uvec2, vec2, vec3, vec4, viewportSize } from "three/tsl";
2
+ import { i as createVariableGaussianBlurCompute, n as DEFAULT_COMPUTE_WIDTH, t as DEFAULT_COMPUTE_HEIGHT } from "./computeBlur-DCRhuYEi.js";
3
+ import { StorageTexture } from "three/webgpu";
4
+ import { FloatType } from "three";
5
+ import { Fn, If, clamp, convertToTexture, dot, float, instanceIndex, int, max, mix, pow, screenUV, storageTexture, texture, textureLoad, textureStore, uint, uniform, uvec2, vec2, vec3, vec4, viewportSize } from "three/tsl";
4
6
  const componentDefinition = {
5
7
  name: "Glow",
6
8
  category: "Stylize",
@@ -14,8 +16,8 @@ const componentDefinition = {
14
16
  ui: {
15
17
  type: ["range", "map"],
16
18
  min: 0,
17
- max: 10,
18
- step: .1,
19
+ max: 50,
20
+ step: .5,
19
21
  label: "Intensity",
20
22
  group: "Effect"
21
23
  }
@@ -27,26 +29,28 @@ const componentDefinition = {
27
29
  type: ["range", "map"],
28
30
  min: 0,
29
31
  max: 1,
30
- step: .1,
32
+ step: .05,
31
33
  label: "Threshold",
32
34
  group: "Effect"
33
35
  }
34
36
  },
35
37
  size: {
36
- default: 10,
37
- description: "Size/spread of the glow effect",
38
+ default: 25,
39
+ description: "Glow spread in pixels (clean up to ~72px, mild banding above)",
40
+ compileTimeWhen: (prev, next) => prev === 0 !== (next === 0),
38
41
  ui: {
39
42
  type: ["range", "map"],
40
- min: 1,
41
- max: 20,
42
- step: .1,
43
+ min: 0,
44
+ max: 100,
45
+ step: 1,
43
46
  label: "Glow Size",
44
47
  group: "Effect"
45
48
  }
46
49
  }
47
50
  },
48
- computeNode: ({ childNode, onCleanup, dimensions, renderer, uniforms }) => {
51
+ computeNode: ({ childNode, onCleanup, dimensions, renderer, uniforms, onResize }) => {
49
52
  if (!childNode) return null;
53
+ if (uniforms.size.uniform.value === 0) return null;
50
54
  const childTexture = convertToTexture(childNode);
51
55
  onCleanup(() => {
52
56
  if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
@@ -54,63 +58,72 @@ const componentDefinition = {
54
58
  const dpr = renderer?.getPixelRatio?.() ?? 1;
55
59
  const texWidth = Math.round(dimensions.width * dpr);
56
60
  const texHeight = Math.round(dimensions.height * dpr);
61
+ const computeWidth = DEFAULT_COMPUTE_WIDTH;
62
+ const computeHeight = 640;
63
+ const brightTex = new StorageTexture(computeWidth, computeHeight);
64
+ brightTex.type = FloatType;
65
+ const brightWriteNode = storageTexture(brightTex);
66
+ const brightReadNode = storageTexture(brightTex).toReadOnly();
67
+ onCleanup(() => {
68
+ brightTex.dispose();
69
+ });
70
+ const { computeNodes: blurNodes, outputTexture: blurredTex, blurMapWriteNode } = createVariableGaussianBlurCompute(brightReadNode, computeWidth, computeHeight, onCleanup);
71
+ const inputWidthU = uniform(texWidth);
72
+ const inputHeightU = uniform(texHeight);
73
+ const cw = uint(computeWidth);
74
+ const ch = uint(computeHeight);
57
75
  const sizeMapInfo = uniforms.size.mapComputeInfo;
58
- if (sizeMapInfo) {
59
- const { computeNodes: blurNodes, outputTexture: outputTexture$1, blurMapWriteNode } = createVariableGaussianBlurCompute(childTexture, texWidth, texHeight, onCleanup);
60
- const w = uint(texWidth);
61
- const h = uint(texHeight);
62
- const { sourceTexture, channel, inputMin, inputMax, outputMin, outputMax, curve } = sizeMapInfo;
63
- const fillBlurMap = Fn(() => {
64
- const idx = instanceIndex;
65
- const x = idx.mod(w);
66
- const y = idx.div(w);
67
- If(y.lessThan(h), () => {
68
- const sample = textureLoad(sourceTexture, uvec2(x, y), int(0));
76
+ const extractAndFill = Fn(() => {
77
+ const idx = instanceIndex;
78
+ const cx = idx.mod(cw);
79
+ const cy = idx.div(cw);
80
+ If(cy.lessThan(ch), () => {
81
+ const u = cx.toFloat().add(float(.5)).div(float(computeWidth));
82
+ const v = cy.toFloat().add(float(.5)).div(float(computeHeight));
83
+ const srcX = u.mul(inputWidthU).round().toInt().clamp(int(0), int(inputWidthU.sub(1))).toUint();
84
+ const srcY = v.mul(inputHeightU).round().toInt().clamp(int(0), int(inputHeightU.sub(1))).toUint();
85
+ const sample = textureLoad(childTexture, uvec2(srcX, srcY), int(0));
86
+ const lum = dot(sample.rgb, vec3(.2126, .7152, .0722));
87
+ const mask = max(float(0), lum.sub(uniforms.threshold.uniform));
88
+ textureStore(brightWriteNode, uvec2(cx, cy), vec4(sample.rgb.mul(mask), sample.a)).toWriteOnly();
89
+ let radius;
90
+ if (sizeMapInfo) {
91
+ const { sourceTexture, channel, inputMin, inputMax, outputMin, outputMax, curve } = sizeMapInfo;
92
+ const mapSample = textureLoad(sourceTexture, uvec2(srcX, srcY), int(0));
69
93
  let raw;
70
- if (channel === "alpha") raw = sample.a;
71
- else if (channel === "alphaInverted") raw = sample.a.oneMinus();
72
- else if (channel === "luminanceInverted") raw = dot(sample.rgb, vec3(.2126, .7152, .0722)).oneMinus();
73
- else raw = dot(sample.rgb, vec3(.2126, .7152, .0722));
94
+ if (channel === "alpha") raw = mapSample.a;
95
+ else if (channel === "alphaInverted") raw = mapSample.a.oneMinus();
96
+ else if (channel === "luminanceInverted") raw = dot(mapSample.rgb, vec3(.2126, .7152, .0722)).oneMinus();
97
+ else raw = dot(mapSample.rgb, vec3(.2126, .7152, .0722));
74
98
  const inputRange = inputMax.sub(inputMin).max(float(1e-4));
75
- const radius = mix(outputMin, outputMax, pow(clamp(raw.sub(inputMin).div(inputRange), float(0), float(1)), pow(float(2), curve.negate().mul(float(2)))));
76
- textureStore(blurMapWriteNode, uvec2(x, y), vec4(radius, float(0), float(0), float(1))).toWriteOnly();
77
- });
78
- })().compute(texWidth * texHeight, [256]);
79
- return {
80
- outputs: {
81
- childTexture,
82
- blurredTexture: outputTexture$1
83
- },
84
- getComputeNodes: () => [fillBlurMap, ...blurNodes]
85
- };
86
- }
87
- const { computeNodes, outputTexture, updateRadius } = createGaussianBlurCompute(childTexture, texWidth, texHeight, onCleanup);
99
+ radius = mix(outputMin, outputMax, pow(clamp(raw.sub(inputMin).div(inputRange), float(0), float(1)), pow(float(2), curve.negate().mul(float(2)))));
100
+ } else radius = uniforms.size.uniform;
101
+ textureStore(blurMapWriteNode, uvec2(cx, cy), vec4(radius, float(0), float(0), float(1))).toWriteOnly();
102
+ });
103
+ })().compute(computeWidth * computeHeight, [256]);
104
+ onResize(({ width, height }) => {
105
+ const newW = Math.round(width * dpr);
106
+ const newH = Math.round(height * dpr);
107
+ inputWidthU.value = newW;
108
+ inputHeightU.value = newH;
109
+ });
88
110
  return {
89
111
  outputs: {
90
112
  childTexture,
91
- blurredTexture: outputTexture
113
+ blurredTexture: blurredTex
92
114
  },
93
- getComputeNodes: () => {
94
- const sizeEntry = uniforms.size;
95
- const size = sizeEntry.getCpuValue?.() ?? (typeof sizeEntry.uniform.value === "number" ? sizeEntry.uniform.value : null);
96
- if (size !== null) updateRadius(size);
97
- return computeNodes;
98
- }
115
+ getComputeNodes: () => [extractAndFill, ...blurNodes]
99
116
  };
100
117
  },
101
118
  fragmentNode: ({ uniforms, childNode, onCleanup, computeOutputs }) => {
102
119
  if (!childNode) return vec4(0, 0, 0, 0);
120
+ if (uniforms.size.uniform.value === 0) return childNode;
103
121
  if (computeOutputs?.blurredTexture) {
104
- const originalColor$1 = computeOutputs.childTexture.sample(screenUV);
105
- const blurredColor = texture(computeOutputs.blurredTexture).sample(screenUV);
106
- const luminance = dot(originalColor$1.rgb, vec3(.299, .587, .114));
107
- const brightnessMask = max(float(0), luminance.sub(uniforms.threshold.uniform));
108
- const intensity$1 = uniforms.intensity.uniform;
109
- const glow = blurredColor.mul(brightnessMask).mul(intensity$1);
110
- const finalColor = originalColor$1.rgb.add(glow.rgb);
111
- const finalAlpha = max(originalColor$1.a, glow.a);
122
+ const original = computeOutputs.childTexture.sample(screenUV);
123
+ const bloom = texture(computeOutputs.blurredTexture).sample(screenUV);
112
124
  const sizePin = uniforms.size.uniform.mul(float(0));
113
- return unpremultiplyAlpha(vec4(finalColor.add(sizePin), finalAlpha));
125
+ const intensity$1 = uniforms.intensity.uniform;
126
+ return unpremultiplyAlpha(vec4(original.rgb.add(bloom.rgb.mul(intensity$1)).add(sizePin), original.a));
114
127
  }
115
128
  const childTexture = convertToTexture(childNode);
116
129
  onCleanup(() => {
@@ -1,4 +1,4 @@
1
- import { t as applyEdgeHandling } from "./edges-CfGcQniB.js";
1
+ import { t as applyEdgeHandling } from "./edges-CX_lJB9R.js";
2
2
  import { c as transformEdges } from "./transformations-B5lM6fYX.js";
3
3
  import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
4
4
  import { StorageTexture } from "three/webgpu";
@@ -116,7 +116,7 @@ const componentDefinition = {
116
116
  }
117
117
  }
118
118
  },
119
- computeNode: ({ uniforms, onCleanup, dimensions }) => {
119
+ computeNode: ({ uniforms, onCleanup }) => {
120
120
  const GRID_SIZE = uniforms?.gridSize?.uniform?.value ? Math.max(8, Math.min(128, Math.floor(uniforms.gridSize.uniform.value))) : DEFAULT_GRID_SIZE;
121
121
  const buffer = attributeArray(GRID_SIZE * GRID_SIZE, "vec4");
122
122
  const dispTex = new StorageTexture(GRID_SIZE, GRID_SIZE);
@@ -179,7 +179,7 @@ const componentDefinition = {
179
179
  const currentTime = Date.now();
180
180
  const dt = Math.min((currentTime - lastTime) / 1e3, .016);
181
181
  lastTime = currentTime;
182
- const aspect = dimensions.width / Math.max(dimensions.height, 1);
182
+ const aspect = Math.max(1, params.dimensions.width) / Math.max(1, params.dimensions.height);
183
183
  const velX = dt > 0 ? (params.pointer.x - prevX) / dt : 0;
184
184
  const velY = dt > 0 ? (params.pointer.y - prevY) / dt : 0;
185
185
  smoothVelX = smoothVelX * .85 + velX * .15;
@@ -203,7 +203,7 @@ const componentDefinition = {
203
203
  }
204
204
  };
205
205
  },
206
- fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions, computeOutputs }) => {
206
+ fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, computeOutputs }) => {
207
207
  let displacementField;
208
208
  let GRID_SIZE;
209
209
  if (computeOutputs?.displacement) {
@@ -217,7 +217,7 @@ const componentDefinition = {
217
217
  const mouseVelX = uniform(0);
218
218
  const mouseVelY = uniform(0);
219
219
  let prevX = .5, prevY = .5, lastTime = Date.now();
220
- onBeforeRender(({ pointer }) => {
220
+ onBeforeRender(({ pointer, dimensions }) => {
221
221
  const currentTime = Date.now();
222
222
  const dt = Math.min((currentTime - lastTime) / 1e3, .016);
223
223
  lastTime = currentTime;
@@ -7,6 +7,7 @@ const componentDefinition = {
7
7
  props: { shift: {
8
8
  default: 0,
9
9
  description: "The amount to shift the hue by",
10
+ compileTimeWhen: (prev, next) => prev === 0 !== (next === 0),
10
11
  ui: {
11
12
  type: ["range", "map"],
12
13
  min: -180,
@@ -22,6 +23,7 @@ const componentDefinition = {
22
23
  console.error("You must pass a child component into the Hue Shift shader.");
23
24
  return vec4(0);
24
25
  }
26
+ if (uniforms.shift.uniform.value === 0) return childNode;
25
27
  const angle = uniforms.shift.uniform;
26
28
  const cosA = cos(angle);
27
29
  const sinA = sin(angle);
@@ -1,5 +1,5 @@
1
1
  import { SRGBColorSpace, Texture, TextureLoader } from "three/webgpu";
2
- import { float, max, min, or, screenUV, select, step, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
2
+ import { float, max, min, or, screenUV, select, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
3
3
  const componentDefinition = {
4
4
  name: "ImageTexture",
5
5
  category: "Textures",
@@ -26,6 +26,7 @@ const componentDefinition = {
26
26
  "none": 4
27
27
  }[value] ?? 0;
28
28
  },
29
+ compileTime: true,
29
30
  ui: {
30
31
  type: "select",
31
32
  options: [
@@ -167,22 +168,34 @@ const componentDefinition = {
167
168
  });
168
169
  const uv$1 = baseUV;
169
170
  const viewportAspect = viewportSize.x.div(viewportSize.y);
170
- const objectFitMode = uniforms.objectFit.uniform;
171
- const coverScale = max(viewportAspect.div(imageAspectUniform), float(1));
172
- const coverUVScale = vec2(imageAspectUniform.div(viewportAspect).mul(coverScale), coverScale);
173
- const containScale = min(viewportAspect.div(imageAspectUniform), float(1));
174
- const containUVScale = vec2(imageAspectUniform.div(viewportAspect).mul(containScale), containScale);
175
- const fillUVScale = vec2(1, 1);
176
- const scaleDownScale = min(min(viewportAspect.div(imageAspectUniform), float(1)), min(viewportSize.x.div(imageWidthUniform), viewportSize.y.div(imageHeightUniform)));
177
- const scaleDownUVScale = vec2(imageAspectUniform.div(viewportAspect).mul(scaleDownScale), scaleDownScale);
178
- const noneScale = min(viewportSize.x.div(imageWidthUniform), viewportSize.y.div(imageHeightUniform));
179
- const noneUVScale = vec2(imageAspectUniform.div(viewportAspect).mul(noneScale), noneScale);
180
- const isCover = step(objectFitMode, float(.5));
181
- const isContain = step(float(.5), objectFitMode).mul(step(objectFitMode, float(1.5)));
182
- const isFill = step(float(1.5), objectFitMode).mul(step(objectFitMode, float(2.5)));
183
- const isScaleDown = step(float(2.5), objectFitMode).mul(step(objectFitMode, float(3.5)));
184
- const isNone = step(float(3.5), objectFitMode);
185
- const uvScale = vec2(0).add(coverUVScale.mul(isCover)).add(containUVScale.mul(isContain)).add(fillUVScale.mul(isFill)).add(scaleDownUVScale.mul(isScaleDown)).add(noneUVScale.mul(isNone));
171
+ const objectFitMode = uniforms.objectFit.uniform.value;
172
+ let uvScale;
173
+ switch (objectFitMode) {
174
+ case 1: {
175
+ const containScale = min(viewportAspect.div(imageAspectUniform), float(1));
176
+ uvScale = vec2(imageAspectUniform.div(viewportAspect).mul(containScale), containScale);
177
+ break;
178
+ }
179
+ case 2:
180
+ uvScale = vec2(1, 1);
181
+ break;
182
+ case 3: {
183
+ const scaleDownScale = min(min(viewportAspect.div(imageAspectUniform), float(1)), min(viewportSize.x.div(imageWidthUniform), viewportSize.y.div(imageHeightUniform)));
184
+ uvScale = vec2(imageAspectUniform.div(viewportAspect).mul(scaleDownScale), scaleDownScale);
185
+ break;
186
+ }
187
+ case 4: {
188
+ const noneScale = min(viewportSize.x.div(imageWidthUniform), viewportSize.y.div(imageHeightUniform));
189
+ uvScale = vec2(imageAspectUniform.div(viewportAspect).mul(noneScale), noneScale);
190
+ break;
191
+ }
192
+ case 0:
193
+ default: {
194
+ const coverScale = max(viewportAspect.div(imageAspectUniform), float(1));
195
+ uvScale = vec2(imageAspectUniform.div(viewportAspect).mul(coverScale), coverScale);
196
+ break;
197
+ }
198
+ }
186
199
  const adjustedUV = uv$1.sub(vec2(.5)).div(uvScale).add(vec2(.5));
187
200
  const finalUV = vec2(adjustedUV.x, float(1).sub(adjustedUV.y));
188
201
  const sampledColor = textureNode.sample(finalUV);