shaders 3.2.475 → 4.0.0

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 (753) hide show
  1. package/LICENSE +21 -142
  2. package/README.md +192 -19
  3. package/dist/cli.js +2 -2
  4. package/dist/core/{AngularBlur-Cx1HVeYk.js → AngularBlur-BEBs-lRR.js} +2 -3
  5. package/dist/core/{Arc-D3FuqnDL.js → Arc-D-WnjM7T.js} +1 -3
  6. package/dist/core/{Ascii-Dhn0H0LB.js → Ascii-BGPIwMc3.js} +2 -5
  7. package/dist/core/{Aurora-BUfyvIyq.js → Aurora-DqJBPdMQ.js} +2 -11
  8. package/dist/core/{BarShift-v3D-9Lx4.js → BarShift-BcCOweUh.js} +2 -3
  9. package/dist/core/{BarnDoors-C5g6Sbze.js → BarnDoors-B9B-AmCV.js} +2 -3
  10. package/dist/core/{Beam-CV5g8m92.js → Beam-QG_9OS8I.js} +2 -3
  11. package/dist/core/{Bend-BFWQSHF7.js → Bend-Cy9VAowL.js} +1 -2
  12. package/dist/core/{Blob-CLvqov4O.js → Blob-C3txJeW0.js} +2 -10
  13. package/dist/core/{BlockDissolve-DER9y4PE.js → BlockDissolve-C1SFUys7.js} +2 -3
  14. package/dist/core/{BlockNoise-DpXWJkDL.js → BlockNoise-Cm3y8hce.js} +2 -4
  15. package/dist/core/{BlueNoise-CSQPDpkm.js → BlueNoise-BCLObOMm.js} +2 -4
  16. package/dist/core/{Blur-B-Tg7Sfr.js → Blur-Dg29SnXd.js} +1 -2
  17. package/dist/core/{Boids-BZo85-QR.js → Boids-rsGsPN5h.js} +2 -5
  18. package/dist/core/{BokehBlur-B1tY-T6q.js → BokehBlur-rFSFEnb0.js} +2 -3
  19. package/dist/core/{BrickPattern-DVhe3RgK.js → BrickPattern-DqN6JKEN.js} +2 -3
  20. package/dist/core/{BrightnessContrast-DBLjHzyE.js → BrightnessContrast-J9fCSBiC.js} +1 -3
  21. package/dist/core/{BrushedMetal-CpXTd3nZ.js → BrushedMetal-74wSZKjG.js} +3 -8
  22. package/dist/core/{Bulge-CHcE-9Oo.js → Bulge-BIk0oq8j.js} +1 -2
  23. package/dist/core/{CRTScreen-CyBtBJS4.js → CRTScreen-hEH-JNRd.js} +2 -3
  24. package/dist/core/{CarbonFiber-DK-0jUEs.js → CarbonFiber-CZdUDvRU.js} +3 -7
  25. package/dist/core/{Chalkboard-PmgH_OhS.js → Chalkboard-CClJHqvs.js} +2 -3
  26. package/dist/core/{ChannelBlur-J3MHHcGy.js → ChannelBlur-BEuEwQOC.js} +1 -2
  27. package/dist/core/{CheckerWipe-Dj2kjjDA.js → CheckerWipe-KuAWj2qg.js} +2 -3
  28. package/dist/core/{Checkerboard-eFWETR1S.js → Checkerboard-Rq9ze1W3.js} +2 -3
  29. package/dist/core/{Chevron-ColsT0Fy.js → Chevron-C1j6X2Ye.js} +2 -3
  30. package/dist/core/{ChromaFlow-DrdCgPGz.js → ChromaFlow-BgsCUYIl.js} +2 -5
  31. package/dist/core/{ChromaticAberration-C_It6mLf.js → ChromaticAberration-2_4tjQ0u.js} +2 -4
  32. package/dist/core/{Chrome-2WZpUHiT.js → Chrome-Be3z6C5i.js} +4 -10
  33. package/dist/core/{Circle-C-AKxSw4.js → Circle-e_qQI3tU.js} +1 -3
  34. package/dist/core/{ColorWheel-DfF0tqXE.js → ColorWheel-s5ep1H7d.js} +2 -3
  35. package/dist/core/{CompressionArtifacts-Zvwlutd7.js → CompressionArtifacts-OE9U9Qrq.js} +1 -3
  36. package/dist/core/{ConcentricSpin-tC8mylMA.js → ConcentricSpin-CLE_5yCJ.js} +1 -2
  37. package/dist/core/{ConicGradient-CNYvyjSs.js → ConicGradient-Cji2SgVO.js} +2 -4
  38. package/dist/core/{ContourLines-C4642NJd.js → ContourLines-wpPK00cF.js} +2 -3
  39. package/dist/core/{CornerPin-BF5gFRv9.js → CornerPin-gYU0Uf2m.js} +2 -3
  40. package/dist/core/{Crescent-wC0IwPjx.js → Crescent-viNc7Unp.js} +1 -2
  41. package/dist/core/{Cross-BO7JQKSq.js → Cross-DyQSsw_k.js} +1 -2
  42. package/dist/core/{Crystal-BK3ifbmV.js → Crystal-Vjj8azWg.js} +4 -9
  43. package/dist/core/{CurlNoise-UbI-Zda_.js → CurlNoise-C7PHjDht.js} +2 -4
  44. package/dist/core/{CursorRipples-rJlfKhyh.js → CursorRipples-BzPPNkA3.js} +3 -39
  45. package/dist/core/{CursorTrail-BuyQdFKJ.js → CursorTrail-cBj0AuQA.js} +2 -4
  46. package/dist/core/{DataMosh-C_ZI55Qq.js → DataMosh-5Yr9TyVx.js} +1 -3
  47. package/dist/core/{DiamondGradient-CPhUCUoq.js → DiamondGradient-DZM7HwF5.js} +2 -4
  48. package/dist/core/{DiamondWipe-y6uIpJM4.js → DiamondWipe-CqeT7lCt.js} +2 -3
  49. package/dist/core/{DiffuseBlur-BNxowfOL.js → DiffuseBlur-Y5hSDTZF.js} +2 -3
  50. package/dist/core/{DisplacementMap-BuM2b1nC.js → DisplacementMap-FobRx5Ie.js} +2 -3
  51. package/dist/core/{Dither-Bt1qdRag.js → Dither-50rqHpt9.js} +2 -3
  52. package/dist/core/{DotGrid-DJFnwMVS.js → DotGrid-B6AGLUbR.js} +3 -4
  53. package/dist/core/{DropShadow-C-IfgfyH.js → DropShadow-CEPpgatB.js} +2 -3
  54. package/dist/core/{Duotone-DML_9JhJ.js → Duotone-D76Kp7Pb.js} +2 -3
  55. package/dist/core/{Ellipse-BuNUnN8D.js → Ellipse-BGod1LeG.js} +1 -2
  56. package/dist/core/{Emboss-DvKk4zwp.js → Emboss-DMNFb_ww.js} +3 -6
  57. package/dist/core/{Engraving-DPFVnIjD.js → Engraving-Dj7bCATQ.js} +2 -3
  58. package/dist/core/{ErosionNoise-j_b7a5cl.js → ErosionNoise-4O68wJQZ.js} +2 -4
  59. package/dist/core/{Exposure-DALA5K55.js → Exposure-h-vapOpj.js} +1 -3
  60. package/dist/core/{FallingLines-CeMOKpxK.js → FallingLines-Dzop_89k.js} +2 -3
  61. package/dist/core/{FilmGrain-DsDYCjjs.js → FilmGrain-Bs8PCfdf.js} +1 -3
  62. package/dist/core/{FilmStock-DtDMkwF6.js → FilmStock-DBjVo6rL.js} +1 -4
  63. package/dist/core/{Flip-B9Av9MVn.js → Flip-CfrS4KfZ.js} +2 -3
  64. package/dist/core/{FloatingParticles-BcMOBX1m.js → FloatingParticles-D1R2tD2J.js} +2 -5
  65. package/dist/core/{FlowField-BunLIU80.js → FlowField-Slirm5AI.js} +2 -3
  66. package/dist/core/{Flower-CvqBYUCU.js → Flower-Ddlut7QZ.js} +1 -2
  67. package/dist/core/{FlowingGradient-DQ284uMb.js → FlowingGradient-CwIgTtbj.js} +2 -7
  68. package/dist/core/{FlutedGlass-BP7av96Y.js → FlutedGlass-CMMy2GJ5.js} +2 -4
  69. package/dist/core/{Fog-DyyljY9e.js → Fog-DjjUkcTZ.js} +2 -4
  70. package/dist/core/{Form3D-x-G-Lz4z.js → Form3D-DQDOHWpC.js} +2 -4
  71. package/dist/core/{FractalNoise-DTgEv-Hq.js → FractalNoise-BjI3IOIj.js} +2 -4
  72. package/dist/core/{Frost-BhMELsXw.js → Frost-CK12HnL1.js} +3 -8
  73. package/dist/core/{GaborNoise-B7kmxcRZ.js → GaborNoise-DKEIvvRJ.js} +3 -5
  74. package/dist/core/{Glass-BMCOKCUL.js → Glass-CzcOVD5Y.js} +3 -8
  75. package/dist/core/{GlassTiles-DgVooh8h.js → GlassTiles-gjhc563g.js} +1 -2
  76. package/dist/core/{Glitch-D0pvMdGd.js → Glitch-C_XAWltC.js} +1 -2
  77. package/dist/core/{Glow-CJ3i0al6.js → Glow-CrYCanBI.js} +1 -3
  78. package/dist/core/{Godrays-DOV1VQ9x.js → Godrays-BBTMOVLP.js} +2 -3
  79. package/dist/core/{Goo-sMwsU21Y.js → Goo-Brhjk8aS.js} +3 -8
  80. package/dist/core/{GradientMap-CCuimQDS.js → GradientMap-C5325QWw.js} +2 -4
  81. package/dist/core/{Grayscale-DR1xnpde.js → Grayscale-dPjs-wvf.js} +1 -2
  82. package/dist/core/{Grid-CCUodqje.js → Grid-UjEd3O76.js} +3 -4
  83. package/dist/core/{GridDistortion-DUnC2Z_Y.js → GridDistortion-vVgYya1U.js} +1 -5
  84. package/dist/core/{Group--MS8ZNKg.js → Group-KVdmAi5g.js} +1 -1
  85. package/dist/core/{HTMLInCanvas-D_Rc6bs1.js → HTMLInCanvas-CKr2u76R.js} +1 -2
  86. package/dist/core/{Halftone-CG1LNQkk.js → Halftone-pRV3TRUW.js} +2 -3
  87. package/dist/core/{Heart-qPxh2CWp.js → Heart-CX7MvvHZ.js} +1 -2
  88. package/dist/core/{Heatmap-BZDfR2vC.js → Heatmap-Dn6qyd2e.js} +3 -8
  89. package/dist/core/{HexGrid-DquaiXLF.js → HexGrid-BIfYhkfV.js} +3 -4
  90. package/dist/core/{Hologram-JAXPZFx0.js → Hologram-ou27baPQ.js} +3 -7
  91. package/dist/core/{Holographic-BBHJp93D.js → Holographic-CiHdBSMg.js} +3 -7
  92. package/dist/core/{HueShift-a1Hl7gFy.js → HueShift-CG7pcXfg.js} +1 -3
  93. package/dist/core/{ImageTexture-CLW3uX1b.js → ImageTexture-BiZuU58C.js} +1 -2
  94. package/dist/core/{InkFlow-Dfd_5vYf.js → InkFlow-D9_L7opB.js} +2 -5
  95. package/dist/core/{Invert-DBEURmcL.js → Invert-CHEaiQZO.js} +1 -2
  96. package/dist/core/{IrisWipe-DTlGb8v-.js → IrisWipe-x22vOQHm.js} +2 -3
  97. package/dist/core/Irradiance-7yq2K87_.js +389 -0
  98. package/dist/core/{IsometricCubes-BgmQXJXU.js → IsometricCubes-CkPGWr7M.js} +2 -3
  99. package/dist/core/{Kaleidoscope-0adfaQ5F.js → Kaleidoscope-CEC5m1Ww.js} +1 -2
  100. package/dist/core/{KeyFrames-BqANGVzW.js → KeyFrames-BMGEZsAZ.js} +2 -3
  101. package/dist/core/{LensDistortion-DVRKCZv8.js → LensDistortion-DKo8PiO5.js} +2 -3
  102. package/dist/core/{LensFlare-C41jY4jH.js → LensFlare-DMS-NUtK.js} +2 -3
  103. package/dist/core/LightEdge-DxmnCRls.js +315 -0
  104. package/dist/core/{LightLeak-GWrDFcI_.js → LightLeak-yoEsZtYg.js} +2 -4
  105. package/dist/core/{Line-DuV7dLdM.js → Line-D17XDUjO.js} +2 -3
  106. package/dist/core/{LinearBlur-Bft2CjmO.js → LinearBlur-CiyjPTUH.js} +2 -3
  107. package/dist/core/{LinearGradient-BzIE4ReW.js → LinearGradient-DfjKG70q.js} +2 -4
  108. package/dist/core/{LinearWipe-ArRG9OCp.js → LinearWipe-D9CtBg6S.js} +2 -3
  109. package/dist/core/{LiquidMetal-BgvfhyiQ.js → LiquidMetal-8EG6DwV6.js} +3 -8
  110. package/dist/core/{Liquify-B6EigQqP.js → Liquify-BySXF1OB.js} +1 -4
  111. package/dist/core/{MagneticFilings-Dj35dlIq.js → MagneticFilings-DNESH3Zs.js} +2 -5
  112. package/dist/core/{Marble-0kfSSCDj.js → Marble-C9WvdxrP.js} +2 -7
  113. package/dist/core/{MeshGradient-DY_rUhFv.js → MeshGradient-d9--RXOU.js} +2 -10
  114. package/dist/core/{Mirror-C1AIyKmb.js → Mirror-1V2FF2kD.js} +1 -2
  115. package/dist/core/{MultiPointGradient-B9z1J-d8.js → MultiPointGradient-cRA9ytgL.js} +2 -3
  116. package/dist/core/{Nebula-mZDwq-yl.js → Nebula-BRV-q74y.js} +4 -87
  117. package/dist/core/{Neon-CyQE26dS.js → Neon-4PemK9Rj.js} +3 -6
  118. package/dist/core/{NoiseDissolve-DQbBbxlP.js → NoiseDissolve-B7LgD46G.js} +2 -3
  119. package/dist/core/{ObjectTracker-CZd20LeZ.js → ObjectTracker-CdzDxhpy.js} +2 -3
  120. package/dist/core/{Obsidian-CjKezopV.js → Obsidian-2J1eX9kT.js} +3 -9
  121. package/dist/core/{PagePeel-ulnjqZzc.js → PagePeel-D-ziraOm.js} +1 -2
  122. package/dist/core/{Paper-c_1INiUk.js → Paper-BxzCLyzB.js} +1 -2
  123. package/dist/core/{Parallelogram-CnjzV4-0.js → Parallelogram-D4OflTwn.js} +1 -2
  124. package/dist/core/{ParticleField-yJztI6Ts.js → ParticleField-tWNicEDO.js} +1 -4
  125. package/dist/core/{ParticleFlow-DJYrNrb8.js → ParticleFlow-BiEYFyWR.js} +2 -6
  126. package/dist/core/{Particles-kT-8Aj5V.js → Particles-B7W4yWgo.js} +3 -7
  127. package/dist/core/{PerlinNoise-C_Pczp28.js → PerlinNoise-C-irUxp9.js} +3 -5
  128. package/dist/core/{Perspective-BrbfuYVk.js → Perspective-DlnAW-pe.js} +2 -3
  129. package/dist/core/{PixelSort-DoTMcLz4.js → PixelSort-BBOTYuOE.js} +1 -4
  130. package/dist/core/{PixelThrow-B8pxI6sI.js → PixelThrow-DCJb9Lxd.js} +2 -4
  131. package/dist/core/{Pixelate-DCU9U9Wb.js → Pixelate-CZdwB--K.js} +1 -2
  132. package/dist/core/{Plasma-Xe1I1Mmb.js → Plasma-CTOQJeqy.js} +2 -4
  133. package/dist/core/{Plastic-Ce9dVqPq.js → Plastic-DvyH9x-4.js} +3 -8
  134. package/dist/core/{PolarCoordinates-mtOsxdGf.js → PolarCoordinates-XhdDAOD0.js} +1 -2
  135. package/dist/core/{Polygon-Cv63keGU.js → Polygon-CLohB-Ly.js} +2 -4
  136. package/dist/core/{Posterize-QhGDzUuf.js → Posterize-BAQfnvmK.js} +1 -2
  137. package/dist/core/{Prism-DOXMcTrS.js → Prism-DJVCVAXX.js} +2 -6
  138. package/dist/core/{ProgressiveBlur-sSQrxqcr.js → ProgressiveBlur-Dirva1on.js} +2 -3
  139. package/dist/core/{RadialGradient-DWTDAQnq.js → RadialGradient-DuSKR8Ds.js} +2 -4
  140. package/dist/core/{RadialWipe-HfofRhY0.js → RadialWipe-n8tON7x2.js} +2 -3
  141. package/dist/core/{RandomBars-DspX9Utc.js → RandomBars-BYouiIgQ.js} +2 -3
  142. package/dist/core/{ReactionDiffusion-GsRfnqUY.js → ReactionDiffusion-CHDd3y2q.js} +2 -5
  143. package/dist/core/{RectangularCoordinates-DhPRrTPT.js → RectangularCoordinates-CYFfCawa.js} +1 -2
  144. package/dist/core/{ReflectivePlane-ej7XTkZ-.js → ReflectivePlane-DFTl5U9q.js} +2 -3
  145. package/dist/core/Repeater-CnbzXuAe.js +473 -0
  146. package/dist/core/{Ring-CC1LC05E.js → Ring-CGkHVSVd.js} +1 -2
  147. package/dist/core/{RippleWipe-CmmIx59a.js → RippleWipe-DLjPzY6u.js} +2 -3
  148. package/dist/core/{Ripples-ColS9_ej.js → Ripples-C2tITU62.js} +2 -3
  149. package/dist/core/{RoundedRect-BCL_4FLA.js → RoundedRect-sfNTUaCY.js} +1 -2
  150. package/dist/core/{Saturation-E77lSl0T.js → Saturation-BRkifYWj.js} +1 -3
  151. package/dist/core/{Scratches-ZHohp7K4.js → Scratches-D87O5C2K.js} +2 -4
  152. package/dist/core/{Sharpness-CgNxIvCA.js → Sharpness-BGv613Zw.js} +1 -3
  153. package/dist/core/Shatter-DuyCFU1f.js +328 -0
  154. package/dist/core/{SimplexNoise-CZf812YP.js → SimplexNoise-CQJvmqd-.js} +2 -4
  155. package/dist/core/{SineWave-CVHPlsdX.js → SineWave-BfOgSGMP.js} +2 -3
  156. package/dist/core/{SliceWipe-4Y_DLO0N.js → SliceWipe-CD_D99sl.js} +1 -2
  157. package/dist/core/{Smoke-CzjvGgBl.js → Smoke-BDQYKRP1.js} +2 -4
  158. package/dist/core/{SmokeFill-DkMjXE-D.js → SmokeFill-CPnzQtQv.js} +3 -8
  159. package/dist/core/{SmokeFlow-DQMNHV2s.js → SmokeFlow-BkPMjZq8.js} +2 -4
  160. package/dist/core/{Solarize-DmhOkKoO.js → Solarize-DSiS32QS.js} +1 -3
  161. package/dist/core/{SolidColor-CyYoqgG3.js → SolidColor-DEKpgy1c.js} +2 -3
  162. package/dist/core/Sparkle-BZur6gPW.js +178 -0
  163. package/dist/core/{Spherize-D2gNetxE.js → Spherize-D9Yg4n6O.js} +2 -3
  164. package/dist/core/{Spiral-BCO6OJXU.js → Spiral-BCacfEpT.js} +2 -3
  165. package/dist/core/{Star-9JERbdHT.js → Star-Dnw1ihk7.js} +1 -2
  166. package/dist/core/{Stone-92McvPwz.js → Stone-Cje-_vAg.js} +1 -3
  167. package/dist/core/{Strands-B6NfRExJ.js → Strands-CFRxS1G_.js} +2 -4
  168. package/dist/core/{Stretch-DbUOkCav.js → Stretch-DXVhfIqO.js} +1 -2
  169. package/dist/core/{Stripes-BG2zbwGV.js → Stripes-CCADWwyq.js} +2 -3
  170. package/dist/core/{StudioBackground-tpZpD080.js → StudioBackground-BlzYNAsu.js} +2 -6
  171. package/dist/core/{SunBurst-BMH4MKRL.js → SunBurst-CmWbI18r.js} +2 -3
  172. package/dist/core/{Surface3D-DUZMTBel.js → Surface3D-Dmh98-0V.js} +2 -6
  173. package/dist/core/{Swirl-CzOPAKx8.js → Swirl-CzI1qSVc.js} +2 -4
  174. package/dist/core/{Teardrop-aOr2VYQI.js → Teardrop-D24uulL0.js} +1 -2
  175. package/dist/core/{Text-CV3Lr3m0.js → Text-CrZKvBw6.js} +2 -6
  176. package/dist/core/{ThinFilm-CYOodpsx.js → ThinFilm-D7R2dt1O.js} +3 -6
  177. package/dist/core/{TiltShift-Cv80ZHW3.js → TiltShift-AMMDZBvf.js} +2 -3
  178. package/dist/core/{TimeTrail-fvJO2a1q.js → TimeTrail-BCYDP2ep.js} +2 -6
  179. package/dist/core/{Tint-D4m85tFF.js → Tint-DHb5wBN5.js} +2 -3
  180. package/dist/core/{Trapezoid-B-PkXCCJ.js → Trapezoid-CL5Fxvq7.js} +1 -2
  181. package/dist/core/{TriangularGrid-hMfK10up.js → TriangularGrid-Bp-SJS-H.js} +2 -3
  182. package/dist/core/{Tritone-n1wNQ1dI.js → Tritone-C0nx7OdC.js} +2 -3
  183. package/dist/core/{Truchet-BhmcbIE9.js → Truchet-DCetyDaq.js} +2 -3
  184. package/dist/core/{Twirl-D8gALHXr.js → Twirl-D_mv9KEi.js} +1 -2
  185. package/dist/core/{VHS-CaqSB2Op.js → VHS-Cp9aDjti.js} +1 -2
  186. package/dist/core/{VenetianBlinds-B1-WjIeY.js → VenetianBlinds-DUyvaT5w.js} +2 -3
  187. package/dist/core/{Vesica-Gh1CMA7n.js → Vesica-BpzrTPTA.js} +1 -2
  188. package/dist/core/{Vibrance-ixBSdj4B.js → Vibrance-DW3J-pvW.js} +1 -3
  189. package/dist/core/{VideoTexture-DVQ1YsW2.js → VideoTexture-zoKsSrex.js} +1 -2
  190. package/dist/core/{Vignette-B9v8l0So.js → Vignette-KKbP3qdZ.js} +2 -5
  191. package/dist/core/{Voronoi-CIHogO9V.js → Voronoi-Bp2-U6lm.js} +2 -5
  192. package/dist/core/Voxels-B3e3LHH5.js +469 -0
  193. package/dist/core/{Water-Dh4UB4UF.js → Water-CoYwvqKx.js} +3 -8
  194. package/dist/core/{Watercolor-C70_K8Lv.js → Watercolor-DUNjSIN1.js} +2 -4
  195. package/dist/core/{WaveDistortion-BCKxUa-p.js → WaveDistortion-Dp8ws0z1.js} +1 -2
  196. package/dist/core/{Waveform-BKMFhH8R.js → Waveform-DDBLB6zu.js} +2 -9
  197. package/dist/core/{WaveletNoise-CFpncHiR.js → WaveletNoise-CpBkzfRT.js} +2 -4
  198. package/dist/core/{Weave-CYgbepeB.js → Weave-cWkvSEAy.js} +2 -3
  199. package/dist/core/{WebcamTexture-B0vkMk_l.js → WebcamTexture-D484SXSE.js} +1 -2
  200. package/dist/core/{Wool-CLkJUMng.js → Wool-C9L7O9fD.js} +1 -3
  201. package/dist/core/{WorleyNoise-BxznxOxV.js → WorleyNoise-B5j5lDQZ.js} +2 -3
  202. package/dist/core/{ZoomBlur-DtujxMsW.js → ZoomBlur-bPC1dBu2.js} +2 -3
  203. package/dist/core/customShaders.d.ts +71 -0
  204. package/dist/core/customShaders.d.ts.map +1 -0
  205. package/dist/core/docs-manifest.json +29177 -0
  206. package/dist/core/gpu/composer.d.ts +2 -0
  207. package/dist/core/gpu/composer.d.ts.map +1 -1
  208. package/dist/core/gpu/contract.d.ts +15 -0
  209. package/dist/core/gpu/contract.d.ts.map +1 -1
  210. package/dist/core/gpu/frame.d.ts +5 -2
  211. package/dist/core/gpu/frame.d.ts.map +1 -1
  212. package/dist/core/gpu/index.d.ts.map +1 -1
  213. package/dist/core/gpu/kit/waves.d.ts +6 -0
  214. package/dist/core/gpu/kit/waves.d.ts.map +1 -1
  215. package/dist/core/gpu/scaffolds/sdfShape.d.ts +1 -1
  216. package/dist/core/gpu/scaffolds/sdfShape.d.ts.map +1 -1
  217. package/dist/core/gpu/support.d.ts +12 -0
  218. package/dist/core/gpu/support.d.ts.map +1 -1
  219. package/dist/core/index.d.ts +3 -2
  220. package/dist/core/index.d.ts.map +1 -1
  221. package/dist/core/index.js +238 -255
  222. package/dist/core/llms.txt +1558 -0
  223. package/dist/core/{noiseColor-_P7nIu_L.js → noiseColor-D_bPhJ4m.js} +2 -2
  224. package/dist/core/presetRenderer.d.ts +4 -0
  225. package/dist/core/presetRenderer.d.ts.map +1 -1
  226. package/dist/core/registry.js +204 -248
  227. package/dist/core/shaderRegistry-BaozBFyh.js +445 -0
  228. package/dist/core/shaderRegistry.d.ts.map +1 -1
  229. package/dist/core/shaders/AngularBlur/index.d.ts +1 -1
  230. package/dist/core/shaders/AngularBlur/index.d.ts.map +1 -1
  231. package/dist/core/shaders/AngularBlur/index.js +4 -10
  232. package/dist/core/shaders/Arc/index.js +4 -6
  233. package/dist/core/shaders/Ascii/index.d.ts +1 -1
  234. package/dist/core/shaders/Ascii/index.d.ts.map +1 -1
  235. package/dist/core/shaders/Ascii/index.js +4 -11
  236. package/dist/core/shaders/Aurora/index.js +4 -21
  237. package/dist/core/shaders/BarShift/index.js +4 -8
  238. package/dist/core/shaders/BarnDoors/index.js +4 -7
  239. package/dist/core/shaders/Beam/index.js +4 -11
  240. package/dist/core/shaders/Bend/index.js +4 -8
  241. package/dist/core/shaders/Blob/index.js +4 -18
  242. package/dist/core/shaders/BlockDissolve/index.js +4 -7
  243. package/dist/core/shaders/BlockNoise/index.d.ts +1 -1
  244. package/dist/core/shaders/BlockNoise/index.d.ts.map +1 -1
  245. package/dist/core/shaders/BlockNoise/index.js +5 -14
  246. package/dist/core/shaders/BlueNoise/index.d.ts +1 -1
  247. package/dist/core/shaders/BlueNoise/index.d.ts.map +1 -1
  248. package/dist/core/shaders/BlueNoise/index.js +5 -14
  249. package/dist/core/shaders/Blur/index.d.ts +1 -1
  250. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  251. package/dist/core/shaders/Blur/index.js +4 -10
  252. package/dist/core/shaders/Boids/index.js +4 -9
  253. package/dist/core/shaders/BokehBlur/index.js +4 -10
  254. package/dist/core/shaders/BrickPattern/index.d.ts +1 -1
  255. package/dist/core/shaders/BrickPattern/index.d.ts.map +1 -1
  256. package/dist/core/shaders/BrickPattern/index.js +4 -13
  257. package/dist/core/shaders/BrightnessContrast/index.js +4 -7
  258. package/dist/core/shaders/BrushedMetal/index.js +4 -11
  259. package/dist/core/shaders/Bulge/index.js +4 -8
  260. package/dist/core/shaders/CRTScreen/index.d.ts +2 -2
  261. package/dist/core/shaders/CRTScreen/index.d.ts.map +1 -1
  262. package/dist/core/shaders/CRTScreen/index.js +4 -10
  263. package/dist/core/shaders/CarbonFiber/index.js +4 -11
  264. package/dist/core/shaders/Chalkboard/index.d.ts +1 -1
  265. package/dist/core/shaders/Chalkboard/index.d.ts.map +1 -1
  266. package/dist/core/shaders/Chalkboard/index.js +4 -9
  267. package/dist/core/shaders/ChannelBlur/index.d.ts +1 -1
  268. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  269. package/dist/core/shaders/ChannelBlur/index.js +4 -10
  270. package/dist/core/shaders/CheckerWipe/index.js +4 -7
  271. package/dist/core/shaders/Checkerboard/index.d.ts +1 -1
  272. package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
  273. package/dist/core/shaders/Checkerboard/index.js +4 -13
  274. package/dist/core/shaders/Chevron/index.d.ts +1 -1
  275. package/dist/core/shaders/Chevron/index.d.ts.map +1 -1
  276. package/dist/core/shaders/Chevron/index.js +4 -13
  277. package/dist/core/shaders/ChromaFlow/index.js +4 -8
  278. package/dist/core/shaders/ChromaticAberration/index.js +4 -11
  279. package/dist/core/shaders/Chrome/index.js +4 -10
  280. package/dist/core/shaders/Circle/index.js +4 -6
  281. package/dist/core/shaders/ColorWheel/index.js +4 -11
  282. package/dist/core/shaders/CompressionArtifacts/index.js +4 -7
  283. package/dist/core/shaders/ConcentricSpin/index.js +4 -8
  284. package/dist/core/shaders/ConicGradient/index.js +4 -11
  285. package/dist/core/shaders/ContourLines/index.js +4 -6
  286. package/dist/core/shaders/CornerPin/index.js +4 -8
  287. package/dist/core/shaders/Crescent/index.js +4 -5
  288. package/dist/core/shaders/Cross/index.js +4 -5
  289. package/dist/core/shaders/Crystal/index.js +4 -11
  290. package/dist/core/shaders/CurlNoise/index.d.ts +1 -1
  291. package/dist/core/shaders/CurlNoise/index.d.ts.map +1 -1
  292. package/dist/core/shaders/CurlNoise/index.js +5 -14
  293. package/dist/core/shaders/CursorRipples/index.js +4 -7
  294. package/dist/core/shaders/CursorTrail/index.js +4 -7
  295. package/dist/core/shaders/DataMosh/index.js +4 -7
  296. package/dist/core/shaders/DiamondGradient/index.js +4 -11
  297. package/dist/core/shaders/DiamondWipe/index.js +4 -7
  298. package/dist/core/shaders/DiffuseBlur/index.d.ts +1 -1
  299. package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
  300. package/dist/core/shaders/DiffuseBlur/index.js +4 -10
  301. package/dist/core/shaders/DisplacementMap/index.js +4 -8
  302. package/dist/core/shaders/Dither/index.d.ts +1 -1
  303. package/dist/core/shaders/Dither/index.d.ts.map +1 -1
  304. package/dist/core/shaders/Dither/index.js +4 -13
  305. package/dist/core/shaders/DotGrid/index.d.ts +2 -2
  306. package/dist/core/shaders/DotGrid/index.d.ts.map +1 -1
  307. package/dist/core/shaders/DotGrid/index.js +4 -13
  308. package/dist/core/shaders/DropShadow/index.d.ts +1 -1
  309. package/dist/core/shaders/DropShadow/index.d.ts.map +1 -1
  310. package/dist/core/shaders/DropShadow/index.js +4 -10
  311. package/dist/core/shaders/Duotone/index.js +4 -6
  312. package/dist/core/shaders/Ellipse/index.js +4 -5
  313. package/dist/core/shaders/Emboss/index.js +4 -9
  314. package/dist/core/shaders/Engraving/index.js +4 -9
  315. package/dist/core/shaders/ErosionNoise/index.d.ts +1 -1
  316. package/dist/core/shaders/ErosionNoise/index.d.ts.map +1 -1
  317. package/dist/core/shaders/ErosionNoise/index.js +5 -14
  318. package/dist/core/shaders/Exposure/index.js +4 -7
  319. package/dist/core/shaders/FallingLines/index.d.ts +1 -1
  320. package/dist/core/shaders/FallingLines/index.d.ts.map +1 -1
  321. package/dist/core/shaders/FallingLines/index.js +4 -13
  322. package/dist/core/shaders/FilmGrain/index.js +4 -7
  323. package/dist/core/shaders/FilmStock/index.js +4 -13
  324. package/dist/core/shaders/Flip/index.js +4 -8
  325. package/dist/core/shaders/FloatingParticles/index.d.ts +1 -1
  326. package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
  327. package/dist/core/shaders/FloatingParticles/index.js +4 -9
  328. package/dist/core/shaders/FlowField/index.js +4 -8
  329. package/dist/core/shaders/Flower/index.js +4 -5
  330. package/dist/core/shaders/FlowingGradient/index.js +4 -15
  331. package/dist/core/shaders/FlutedGlass/index.js +4 -11
  332. package/dist/core/shaders/Fog/index.js +4 -7
  333. package/dist/core/shaders/Form3D/index.js +4 -7
  334. package/dist/core/shaders/FractalNoise/index.d.ts +1 -1
  335. package/dist/core/shaders/FractalNoise/index.d.ts.map +1 -1
  336. package/dist/core/shaders/FractalNoise/index.js +4 -13
  337. package/dist/core/shaders/Frost/index.js +4 -11
  338. package/dist/core/shaders/GaborNoise/index.d.ts +2 -2
  339. package/dist/core/shaders/GaborNoise/index.d.ts.map +1 -1
  340. package/dist/core/shaders/GaborNoise/index.js +5 -14
  341. package/dist/core/shaders/Glass/index.js +4 -11
  342. package/dist/core/shaders/GlassTiles/index.d.ts +1 -1
  343. package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
  344. package/dist/core/shaders/GlassTiles/index.js +4 -8
  345. package/dist/core/shaders/Glitch/index.d.ts +1 -1
  346. package/dist/core/shaders/Glitch/index.d.ts.map +1 -1
  347. package/dist/core/shaders/Glitch/index.js +4 -10
  348. package/dist/core/shaders/Glow/index.d.ts +1 -1
  349. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  350. package/dist/core/shaders/Glow/index.js +4 -11
  351. package/dist/core/shaders/Godrays/index.js +4 -12
  352. package/dist/core/shaders/Goo/index.js +4 -11
  353. package/dist/core/shaders/GradientMap/index.js +4 -7
  354. package/dist/core/shaders/Grayscale/index.js +4 -6
  355. package/dist/core/shaders/Grid/index.d.ts +2 -2
  356. package/dist/core/shaders/Grid/index.d.ts.map +1 -1
  357. package/dist/core/shaders/Grid/index.js +4 -13
  358. package/dist/core/shaders/GridDistortion/index.js +4 -11
  359. package/dist/core/shaders/Group/index.js +4 -6
  360. package/dist/core/shaders/HTMLInCanvas/index.js +4 -7
  361. package/dist/core/shaders/Halftone/index.d.ts +1 -1
  362. package/dist/core/shaders/Halftone/index.d.ts.map +1 -1
  363. package/dist/core/shaders/Halftone/index.js +4 -13
  364. package/dist/core/shaders/Heart/index.js +4 -5
  365. package/dist/core/shaders/Heatmap/index.js +4 -11
  366. package/dist/core/shaders/HexGrid/index.d.ts +2 -2
  367. package/dist/core/shaders/HexGrid/index.d.ts.map +1 -1
  368. package/dist/core/shaders/HexGrid/index.js +4 -13
  369. package/dist/core/shaders/Hologram/index.js +4 -10
  370. package/dist/core/shaders/Holographic/index.js +4 -10
  371. package/dist/core/shaders/HueShift/index.js +4 -7
  372. package/dist/core/shaders/ImageTexture/index.js +4 -6
  373. package/dist/core/shaders/InkFlow/index.js +4 -8
  374. package/dist/core/shaders/Invert/index.js +4 -6
  375. package/dist/core/shaders/IrisWipe/index.js +4 -7
  376. package/dist/core/shaders/Irradiance/index.js +4 -13
  377. package/dist/core/shaders/IsometricCubes/index.d.ts +1 -1
  378. package/dist/core/shaders/IsometricCubes/index.d.ts.map +1 -1
  379. package/dist/core/shaders/IsometricCubes/index.js +4 -13
  380. package/dist/core/shaders/Kaleidoscope/index.js +4 -8
  381. package/dist/core/shaders/KeyFrames/index.js +4 -10
  382. package/dist/core/shaders/LensDistortion/index.js +4 -6
  383. package/dist/core/shaders/LensFlare/index.d.ts +1 -1
  384. package/dist/core/shaders/LensFlare/index.d.ts.map +1 -1
  385. package/dist/core/shaders/LensFlare/index.js +4 -12
  386. package/dist/core/shaders/LightEdge/index.js +4 -10
  387. package/dist/core/shaders/LightLeak/index.js +4 -12
  388. package/dist/core/shaders/Line/index.js +4 -10
  389. package/dist/core/shaders/LinearBlur/index.d.ts +1 -1
  390. package/dist/core/shaders/LinearBlur/index.d.ts.map +1 -1
  391. package/dist/core/shaders/LinearBlur/index.js +4 -10
  392. package/dist/core/shaders/LinearGradient/index.js +4 -11
  393. package/dist/core/shaders/LinearWipe/index.js +4 -7
  394. package/dist/core/shaders/LiquidMetal/index.js +4 -11
  395. package/dist/core/shaders/Liquify/index.js +4 -10
  396. package/dist/core/shaders/MagneticFilings/index.js +4 -9
  397. package/dist/core/shaders/Marble/index.d.ts +1 -1
  398. package/dist/core/shaders/Marble/index.d.ts.map +1 -1
  399. package/dist/core/shaders/Marble/index.js +4 -15
  400. package/dist/core/shaders/MeshGradient/index.js +4 -17
  401. package/dist/core/shaders/Mirror/index.js +4 -8
  402. package/dist/core/shaders/MultiPointGradient/index.js +4 -11
  403. package/dist/core/shaders/Nebula/index.js +4 -13
  404. package/dist/core/shaders/Neon/index.js +4 -9
  405. package/dist/core/shaders/NoiseDissolve/index.js +4 -7
  406. package/dist/core/shaders/ObjectTracker/index.js +4 -10
  407. package/dist/core/shaders/Obsidian/index.js +4 -15
  408. package/dist/core/shaders/PagePeel/index.js +4 -10
  409. package/dist/core/shaders/Paper/index.d.ts +1 -1
  410. package/dist/core/shaders/Paper/index.d.ts.map +1 -1
  411. package/dist/core/shaders/Paper/index.js +4 -8
  412. package/dist/core/shaders/Parallelogram/index.js +4 -5
  413. package/dist/core/shaders/ParticleField/index.js +4 -9
  414. package/dist/core/shaders/ParticleFlow/index.js +4 -10
  415. package/dist/core/shaders/Particles/index.js +4 -9
  416. package/dist/core/shaders/PerlinNoise/index.d.ts +2 -2
  417. package/dist/core/shaders/PerlinNoise/index.d.ts.map +1 -1
  418. package/dist/core/shaders/PerlinNoise/index.js +5 -14
  419. package/dist/core/shaders/Perspective/index.js +4 -8
  420. package/dist/core/shaders/PixelSort/index.js +4 -8
  421. package/dist/core/shaders/PixelThrow/index.js +4 -8
  422. package/dist/core/shaders/Pixelate/index.d.ts +1 -1
  423. package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
  424. package/dist/core/shaders/Pixelate/index.js +4 -10
  425. package/dist/core/shaders/Plasma/index.js +4 -11
  426. package/dist/core/shaders/Plastic/index.js +4 -11
  427. package/dist/core/shaders/PolarCoordinates/index.js +4 -8
  428. package/dist/core/shaders/Polygon/index.js +4 -6
  429. package/dist/core/shaders/Posterize/index.js +4 -6
  430. package/dist/core/shaders/Prism/index.js +4 -12
  431. package/dist/core/shaders/ProgressiveBlur/index.d.ts +1 -1
  432. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  433. package/dist/core/shaders/ProgressiveBlur/index.js +4 -10
  434. package/dist/core/shaders/RadialGradient/index.js +4 -11
  435. package/dist/core/shaders/RadialWipe/index.js +4 -7
  436. package/dist/core/shaders/RandomBars/index.js +4 -7
  437. package/dist/core/shaders/ReactionDiffusion/index.js +4 -8
  438. package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
  439. package/dist/core/shaders/ReflectivePlane/index.js +4 -10
  440. package/dist/core/shaders/Repeater/index.js +4 -5
  441. package/dist/core/shaders/Ring/index.js +4 -5
  442. package/dist/core/shaders/RippleWipe/index.js +4 -7
  443. package/dist/core/shaders/Ripples/index.d.ts +1 -1
  444. package/dist/core/shaders/Ripples/index.d.ts.map +1 -1
  445. package/dist/core/shaders/Ripples/index.js +4 -13
  446. package/dist/core/shaders/RoundedRect/index.js +4 -5
  447. package/dist/core/shaders/Saturation/index.js +4 -7
  448. package/dist/core/shaders/Scratches/index.d.ts +1 -1
  449. package/dist/core/shaders/Scratches/index.d.ts.map +1 -1
  450. package/dist/core/shaders/Scratches/index.js +5 -14
  451. package/dist/core/shaders/Sharpness/index.d.ts +1 -1
  452. package/dist/core/shaders/Sharpness/index.d.ts.map +1 -1
  453. package/dist/core/shaders/Sharpness/index.js +4 -11
  454. package/dist/core/shaders/Shatter/index.js +4 -6
  455. package/dist/core/shaders/SimplexNoise/index.d.ts +1 -1
  456. package/dist/core/shaders/SimplexNoise/index.d.ts.map +1 -1
  457. package/dist/core/shaders/SimplexNoise/index.js +5 -14
  458. package/dist/core/shaders/SineWave/index.js +4 -10
  459. package/dist/core/shaders/SliceWipe/index.js +4 -8
  460. package/dist/core/shaders/Smoke/index.js +4 -7
  461. package/dist/core/shaders/SmokeFill/index.js +4 -10
  462. package/dist/core/shaders/SmokeFlow/index.js +4 -7
  463. package/dist/core/shaders/Solarize/index.js +4 -7
  464. package/dist/core/shaders/SolidColor/index.js +4 -11
  465. package/dist/core/shaders/Sparkle/index.d.ts +57 -0
  466. package/dist/core/shaders/Sparkle/index.d.ts.map +1 -0
  467. package/dist/core/shaders/Sparkle/index.js +5 -0
  468. package/dist/core/shaders/Spherize/index.d.ts +1 -1
  469. package/dist/core/shaders/Spherize/index.d.ts.map +1 -1
  470. package/dist/core/shaders/Spherize/index.js +4 -10
  471. package/dist/core/shaders/Spiral/index.js +4 -11
  472. package/dist/core/shaders/Star/index.js +4 -5
  473. package/dist/core/shaders/Stone/index.d.ts +1 -1
  474. package/dist/core/shaders/Stone/index.d.ts.map +1 -1
  475. package/dist/core/shaders/Stone/index.js +4 -14
  476. package/dist/core/shaders/Strands/index.d.ts +1 -1
  477. package/dist/core/shaders/Strands/index.d.ts.map +1 -1
  478. package/dist/core/shaders/Strands/index.js +4 -13
  479. package/dist/core/shaders/Stretch/index.js +4 -8
  480. package/dist/core/shaders/Stripes/index.d.ts +1 -1
  481. package/dist/core/shaders/Stripes/index.d.ts.map +1 -1
  482. package/dist/core/shaders/Stripes/index.js +4 -13
  483. package/dist/core/shaders/StudioBackground/index.js +4 -14
  484. package/dist/core/shaders/SunBurst/index.js +4 -12
  485. package/dist/core/shaders/Surface3D/index.js +4 -8
  486. package/dist/core/shaders/Swirl/index.js +4 -11
  487. package/dist/core/shaders/Teardrop/index.js +4 -5
  488. package/dist/core/shaders/Text/index.js +4 -12
  489. package/dist/core/shaders/ThinFilm/index.js +4 -9
  490. package/dist/core/shaders/TiltShift/index.d.ts +1 -1
  491. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  492. package/dist/core/shaders/TiltShift/index.js +4 -10
  493. package/dist/core/shaders/TimeTrail/index.js +4 -8
  494. package/dist/core/shaders/Tint/index.js +4 -6
  495. package/dist/core/shaders/Trapezoid/index.js +4 -5
  496. package/dist/core/shaders/TriangularGrid/index.d.ts +1 -1
  497. package/dist/core/shaders/TriangularGrid/index.d.ts.map +1 -1
  498. package/dist/core/shaders/TriangularGrid/index.js +4 -13
  499. package/dist/core/shaders/Tritone/index.js +4 -6
  500. package/dist/core/shaders/Truchet/index.d.ts +1 -1
  501. package/dist/core/shaders/Truchet/index.d.ts.map +1 -1
  502. package/dist/core/shaders/Truchet/index.js +4 -13
  503. package/dist/core/shaders/Twirl/index.js +4 -8
  504. package/dist/core/shaders/VHS/index.d.ts +1 -1
  505. package/dist/core/shaders/VHS/index.d.ts.map +1 -1
  506. package/dist/core/shaders/VHS/index.js +4 -10
  507. package/dist/core/shaders/VenetianBlinds/index.js +4 -7
  508. package/dist/core/shaders/Vesica/index.js +4 -5
  509. package/dist/core/shaders/Vibrance/index.js +4 -7
  510. package/dist/core/shaders/VideoTexture/index.js +4 -6
  511. package/dist/core/shaders/Vignette/index.js +4 -8
  512. package/dist/core/shaders/Voronoi/index.d.ts +1 -1
  513. package/dist/core/shaders/Voronoi/index.d.ts.map +1 -1
  514. package/dist/core/shaders/Voronoi/index.js +4 -13
  515. package/dist/core/shaders/Voxels/index.js +4 -14
  516. package/dist/core/shaders/Water/index.js +4 -11
  517. package/dist/core/shaders/Watercolor/index.d.ts +1 -1
  518. package/dist/core/shaders/Watercolor/index.d.ts.map +1 -1
  519. package/dist/core/shaders/Watercolor/index.js +4 -10
  520. package/dist/core/shaders/WaveDistortion/index.js +4 -8
  521. package/dist/core/shaders/Waveform/index.js +4 -16
  522. package/dist/core/shaders/WaveletNoise/index.d.ts +1 -1
  523. package/dist/core/shaders/WaveletNoise/index.d.ts.map +1 -1
  524. package/dist/core/shaders/WaveletNoise/index.js +5 -14
  525. package/dist/core/shaders/Weave/index.d.ts +1 -1
  526. package/dist/core/shaders/Weave/index.d.ts.map +1 -1
  527. package/dist/core/shaders/Weave/index.js +4 -13
  528. package/dist/core/shaders/WebcamTexture/index.js +4 -6
  529. package/dist/core/shaders/Wool/index.d.ts +1 -1
  530. package/dist/core/shaders/Wool/index.d.ts.map +1 -1
  531. package/dist/core/shaders/Wool/index.js +4 -14
  532. package/dist/core/shaders/WorleyNoise/index.d.ts +1 -1
  533. package/dist/core/shaders/WorleyNoise/index.d.ts.map +1 -1
  534. package/dist/core/shaders/WorleyNoise/index.js +4 -13
  535. package/dist/core/shaders/ZoomBlur/index.d.ts +1 -1
  536. package/dist/core/shaders/ZoomBlur/index.d.ts.map +1 -1
  537. package/dist/core/shaders/ZoomBlur/index.js +4 -10
  538. package/dist/core/std/effects/blurs.d.ts +656 -138
  539. package/dist/core/std/effects/blurs.d.ts.map +1 -1
  540. package/dist/core/std/effects/color.d.ts +209 -32
  541. package/dist/core/std/effects/color.d.ts.map +1 -1
  542. package/dist/core/std/effects/edgeGlow.d.ts +86 -17
  543. package/dist/core/std/effects/edgeGlow.d.ts.map +1 -1
  544. package/dist/core/std/effects/fracture.d.ts +72 -8
  545. package/dist/core/std/effects/fracture.d.ts.map +1 -1
  546. package/dist/core/std/effects/index.d.ts +15 -0
  547. package/dist/core/std/effects/index.d.ts.map +1 -0
  548. package/dist/core/std/effects/instances.d.ts +87 -8
  549. package/dist/core/std/effects/instances.d.ts.map +1 -1
  550. package/dist/core/std/effects/lens.d.ts +48 -12
  551. package/dist/core/std/effects/lens.d.ts.map +1 -1
  552. package/dist/core/std/effects/overlay.d.ts +63 -22
  553. package/dist/core/std/effects/overlay.d.ts.map +1 -1
  554. package/dist/core/std/effects/pointerFields.d.ts +45 -20
  555. package/dist/core/std/effects/pointerFields.d.ts.map +1 -1
  556. package/dist/core/std/effects/reveal.d.ts +118 -40
  557. package/dist/core/std/effects/reveal.d.ts.map +1 -1
  558. package/dist/core/std/effects/stylize.d.ts +139 -70
  559. package/dist/core/std/effects/stylize.d.ts.map +1 -1
  560. package/dist/core/std/filter.d.ts +72 -12
  561. package/dist/core/std/filter.d.ts.map +1 -1
  562. package/dist/core/std/frames.d.ts +91 -24
  563. package/dist/core/std/frames.d.ts.map +1 -1
  564. package/dist/core/std/index.d.ts +46 -8
  565. package/dist/core/std/index.d.ts.map +1 -1
  566. package/dist/core/std/index.js +4 -0
  567. package/dist/core/std/invoke.d.ts +107 -12
  568. package/dist/core/std/invoke.d.ts.map +1 -1
  569. package/dist/core/std/lists.d.ts +40 -10
  570. package/dist/core/std/lists.d.ts.map +1 -1
  571. package/dist/core/std/lower.d.ts +73 -1
  572. package/dist/core/std/lower.d.ts.map +1 -1
  573. package/dist/core/std/mask.d.ts +60 -17
  574. package/dist/core/std/mask.d.ts.map +1 -1
  575. package/dist/core/std/math.d.ts +484 -9
  576. package/dist/core/std/math.d.ts.map +1 -1
  577. package/dist/core/std/motion.d.ts +130 -10
  578. package/dist/core/std/motion.d.ts.map +1 -1
  579. package/dist/core/std/paint/compose.d.ts +57 -16
  580. package/dist/core/std/paint/compose.d.ts.map +1 -1
  581. package/dist/core/std/paint/fields.d.ts +376 -93
  582. package/dist/core/std/paint/fields.d.ts.map +1 -1
  583. package/dist/core/std/paint/figures.d.ts +32 -17
  584. package/dist/core/std/paint/figures.d.ts.map +1 -1
  585. package/dist/core/std/paint/gradients.d.ts +58 -25
  586. package/dist/core/std/paint/gradients.d.ts.map +1 -1
  587. package/dist/core/std/paint/light.d.ts +501 -77
  588. package/dist/core/std/paint/light.d.ts.map +1 -1
  589. package/dist/core/std/paint/materials.d.ts +678 -151
  590. package/dist/core/std/paint/materials.d.ts.map +1 -1
  591. package/dist/core/std/paint/media.d.ts +47 -32
  592. package/dist/core/std/paint/media.d.ts.map +1 -1
  593. package/dist/core/std/paint/noise.d.ts +436 -87
  594. package/dist/core/std/paint/noise.d.ts.map +1 -1
  595. package/dist/core/std/paint/patterns.d.ts +473 -91
  596. package/dist/core/std/paint/patterns.d.ts.map +1 -1
  597. package/dist/core/std/paint/radiance.d.ts +75 -29
  598. package/dist/core/std/paint/radiance.d.ts.map +1 -1
  599. package/dist/core/std/paint/volume.d.ts +68 -27
  600. package/dist/core/std/paint/volume.d.ts.map +1 -1
  601. package/dist/core/std/paint/voxels.d.ts +46 -26
  602. package/dist/core/std/paint/voxels.d.ts.map +1 -1
  603. package/dist/core/std/shape.d.ts +195 -1
  604. package/dist/core/std/shape.d.ts.map +1 -1
  605. package/dist/core/std/signal.d.ts +55 -15
  606. package/dist/core/std/signal.d.ts.map +1 -1
  607. package/dist/core/std/sim/agentForces.d.ts +441 -99
  608. package/dist/core/std/sim/agentForces.d.ts.map +1 -1
  609. package/dist/core/std/sim/agentFrame.d.ts +94 -20
  610. package/dist/core/std/sim/agentFrame.d.ts.map +1 -1
  611. package/dist/core/std/sim/agentRender.d.ts +187 -60
  612. package/dist/core/std/sim/agentRender.d.ts.map +1 -1
  613. package/dist/core/std/sim/agents.d.ts +99 -28
  614. package/dist/core/std/sim/agents.d.ts.map +1 -1
  615. package/dist/core/std/sim/feedback.d.ts +40 -19
  616. package/dist/core/std/sim/feedback.d.ts.map +1 -1
  617. package/dist/core/std/sim/fluids.d.ts +127 -63
  618. package/dist/core/std/sim/fluids.d.ts.map +1 -1
  619. package/dist/core/std/sim/grids.d.ts +200 -48
  620. package/dist/core/std/sim/grids.d.ts.map +1 -1
  621. package/dist/core/std/sim/index.d.ts +14 -0
  622. package/dist/core/std/sim/index.d.ts.map +1 -0
  623. package/dist/core/std/sim/shapeFields.d.ts +56 -0
  624. package/dist/core/std/sim/shapeFields.d.ts.map +1 -1
  625. package/dist/core/std/sim.d.ts +112 -10
  626. package/dist/core/std/sim.d.ts.map +1 -1
  627. package/dist/core/std/slots.d.ts +72 -6
  628. package/dist/core/std/slots.d.ts.map +1 -1
  629. package/dist/core/std/types.d.ts +97 -60
  630. package/dist/core/std/types.d.ts.map +1 -1
  631. package/dist/core/std/values.d.ts +33 -14
  632. package/dist/core/std/values.d.ts.map +1 -1
  633. package/dist/core/std/warps.d.ts +221 -76
  634. package/dist/core/std/warps.d.ts.map +1 -1
  635. package/dist/core/std/wgsl.d.ts +115 -0
  636. package/dist/core/std/wgsl.d.ts.map +1 -0
  637. package/dist/core/std-ClftfWpF.js +218889 -0
  638. package/dist/core/{support-GJphyuEe.js → support-D3W86vgR.js} +11 -1
  639. package/dist/core/telemetry/index.js +1 -1
  640. package/dist/core/utilities/transformations/index.js +1 -1
  641. package/dist/js/bundle.js +182 -180
  642. package/dist/js/createShader.d.ts.map +1 -1
  643. package/dist/js/createShader.js +4 -3
  644. package/dist/js/types.d.ts +5 -0
  645. package/dist/js/types.d.ts.map +1 -1
  646. package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
  647. package/dist/js/utils/generatePresetCode.js +35 -22
  648. package/dist/react/CustomShader.js +178 -0
  649. package/dist/react/Preview.js +1 -0
  650. package/dist/react/Shader.js +1 -1
  651. package/dist/react/Sparkle.js +226 -0
  652. package/dist/react/bundle.js +178 -176
  653. package/dist/react/components/Sparkle.d.ts +41 -0
  654. package/dist/react/components/Sparkle.d.ts.map +1 -0
  655. package/dist/react/engine/CustomShader.d.ts +37 -0
  656. package/dist/react/engine/CustomShader.d.ts.map +1 -0
  657. package/dist/react/engine/Preview.d.ts.map +1 -1
  658. package/dist/react/index.d.ts +5 -0
  659. package/dist/react/index.d.ts.map +1 -1
  660. package/dist/react/index.js +4 -2
  661. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  662. package/dist/react/utils/generatePresetCode.js +35 -22
  663. package/dist/registry.js +310 -58
  664. package/dist/solid/components/Sparkle.d.ts +38 -0
  665. package/dist/solid/components/Sparkle.d.ts.map +1 -0
  666. package/dist/solid/components/Sparkle.js +232 -0
  667. package/dist/solid/engine/CustomShader.d.ts +35 -0
  668. package/dist/solid/engine/CustomShader.d.ts.map +1 -0
  669. package/dist/solid/engine/CustomShader.js +160 -0
  670. package/dist/solid/engine/Preview.d.ts.map +1 -1
  671. package/dist/solid/engine/Preview.js +319 -317
  672. package/dist/solid/engine/Shader.js +1 -1
  673. package/dist/solid/index.d.ts +5 -0
  674. package/dist/solid/index.d.ts.map +1 -1
  675. package/dist/solid/index.js +95 -86
  676. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  677. package/dist/solid/utils/generatePresetCode.js +35 -22
  678. package/dist/svelte/components/Sparkle.svelte.d.ts +28 -0
  679. package/dist/svelte/engine/CustomShader.svelte.d.ts +40 -0
  680. package/dist/svelte/index.d.ts +4 -0
  681. package/dist/svelte/index.js +1237 -877
  682. package/dist/svelte/source/components/Sparkle.svelte +352 -0
  683. package/dist/svelte/source/engine/CustomShader.svelte +216 -0
  684. package/dist/svelte/source/engine/Preview.svelte +5 -3
  685. package/dist/svelte/source/index.js +4 -0
  686. package/dist/svelte/utils/generatePresetCode.js +35 -22
  687. package/dist/vue/CustomShader.js +3 -0
  688. package/dist/vue/CustomShader.vue_vue_type_script_setup_true_lang.js +173 -0
  689. package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +2 -0
  690. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  691. package/dist/vue/Sparkle.js +3 -0
  692. package/dist/vue/Sparkle.vue_vue_type_script_setup_true_lang.js +233 -0
  693. package/dist/vue/components/Sparkle.vue.d.ts +63 -0
  694. package/dist/vue/components/Sparkle.vue.d.ts.map +1 -0
  695. package/dist/vue/index.d.ts +4 -0
  696. package/dist/vue/index.d.ts.map +1 -1
  697. package/dist/vue/index.js +4 -2
  698. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  699. package/dist/vue/utils/generatePresetCode.js +35 -22
  700. package/package.json +27 -2
  701. package/dist/core/Irradiance-DtC4tqNu.js +0 -4191
  702. package/dist/core/LightEdge-BV9bO8YB.js +0 -2339
  703. package/dist/core/Repeater-DU_EhoxD.js +0 -762
  704. package/dist/core/Shatter-DYKKCVD8.js +0 -1479
  705. package/dist/core/Voxels-LEG0c9YC.js +0 -8547
  706. package/dist/core/agents-CdLlm-5E.js +0 -5357
  707. package/dist/core/agents-DZaZ4n9_.js +0 -15709
  708. package/dist/core/blur-CrEChFnm.js +0 -8015
  709. package/dist/core/blurs-D5a6ad3o.js +0 -1751
  710. package/dist/core/canvasRaster-DDBkrdY8.js +0 -80
  711. package/dist/core/color-CY5teMWa.js +0 -3619
  712. package/dist/core/compose-DNU_Ut36.js +0 -46
  713. package/dist/core/device-m0ud8-Fn.js +0 -10
  714. package/dist/core/feedback-yfT0pT6A.js +0 -46
  715. package/dist/core/fields-CXwmEUsd.js +0 -475
  716. package/dist/core/figures-BRYcB-p2.js +0 -48
  717. package/dist/core/filter-BrhpSs3Z.js +0 -23
  718. package/dist/core/fluids-CBhAiGAx.js +0 -226
  719. package/dist/core/fonts-BUXTd9qb.js +0 -59
  720. package/dist/core/frames-Clw8-BpA.js +0 -78
  721. package/dist/core/glass-DIEus1UY.js +0 -2532
  722. package/dist/core/gradientPaints-Cx2bT20T.js +0 -6564
  723. package/dist/core/gradients-C15o7_xy.js +0 -159
  724. package/dist/core/grids-Cv99xcJg.js +0 -151
  725. package/dist/core/lens-ChO_HVpe.js +0 -352
  726. package/dist/core/light-Bba_Pie_.js +0 -271
  727. package/dist/core/lightfields-D120ZvMt.js +0 -2255
  728. package/dist/core/lower-DtoDQ7hV.js +0 -49452
  729. package/dist/core/mask-6rnSCir2.js +0 -28
  730. package/dist/core/materials-BjsiWqS0.js +0 -2944
  731. package/dist/core/math-7PlusTFx.js +0 -56
  732. package/dist/core/media-CgWmWvGq.js +0 -832
  733. package/dist/core/mediaLifecycle-BTPb5i1-.js +0 -320
  734. package/dist/core/motionBlur-DzaHMq9p.js +0 -6766
  735. package/dist/core/noise-G7a5U0ar.js +0 -546
  736. package/dist/core/noisePaints-B_axPpuv.js +0 -3619
  737. package/dist/core/noiseStylize-CUrW_HiC.js +0 -65
  738. package/dist/core/overlay-W4DAsSzP.js +0 -4712
  739. package/dist/core/patterns-RTt6Fek8.js +0 -9723
  740. package/dist/core/pointerFields-Ch_-cbCV.js +0 -2339
  741. package/dist/core/porters-CQwDd2t4.js +0 -30201
  742. package/dist/core/reveal-dbBiS7gE.js +0 -1688
  743. package/dist/core/sdf3d-BMqCSSPB.js +0 -21082
  744. package/dist/core/shaderRegistry-Bs0XOv9A.js +0 -443
  745. package/dist/core/shape-B2CoDi6l.js +0 -20
  746. package/dist/core/shapePaints-7HrXeLYX.js +0 -3354
  747. package/dist/core/signal-emJuvOI3.js +0 -34
  748. package/dist/core/slots-BqIef2iV.js +0 -32
  749. package/dist/core/stylize-CiN0ZaMu.js +0 -4541
  750. package/dist/core/tone-CsRho9qb.js +0 -763
  751. package/dist/core/warpMaps-Dbuleg2M.js +0 -10773
  752. package/dist/core/warps-gIr3RmZV.js +0 -276
  753. /package/dist/core/{transformations-CzFmhZww.js → transformations-P50Uo_Ju.js} +0 -0
@@ -1,4191 +0,0 @@
1
- import { Ar as vec2u, Br as struct, Cr as sin, Gn as typegpu_default, I as sdf_exports, Jn as textureSampleLevel, Jr as i32, Lr as texture2d, Mr as vec4f, Or as vec2f, Rr as textureStorage2d, Yn as textureStore, Yr as u32, ar as clamp, cr as dot$1, d as glassShellProps, er as select, gr as min, gt as formatFloat, hr as max$1, ht as Expr, jr as vec3f, mr as length, or as cos, pr as fract, q as createGuardedCompute, qn as textureLoad, qr as f32, t as defineStd, vr as normalize$1, wr as smoothstep$1, y as buildAnalyticSdfFn, zn as TAU, zr as arrayOf } from "./lower-DtoDQ7hV.js";
2
- import { ct as listCountName, ft as listPropConfig, ut as listFieldName } from "./porters-CQwDd2t4.js";
3
- import { y as createGaussianBlurCompute } from "./blur-CrEChFnm.js";
4
- import { A as placementPoint, F as shapedSurface, R as silhouette, S as lambert, T as nearestEdge, V as surfaceField, f as geometricNormal, g as guarded, i as continuedField, j as pointLightFrom, l as fieldSlope, s as exposureTone, v as insideShape, y as inverseSquare } from "./materials-BjsiWqS0.js";
5
- import { t as isMobileGpuViewport } from "./device-m0ud8-Fn.js";
6
- import { O as resolveShapeType, k as shapeEffectBoundingBoxDeclaration, r as buildFieldSampleGraphArgs, w as sdf3d_exports } from "./sdf3d-BMqCSSPB.js";
7
- import { n as glass_exports } from "./glass-DIEus1UY.js";
8
- import { a as transformColor, c as transformPosition, i as transformBoolean } from "./transformations-CzFmhZww.js";
9
- import { B as vec2, C as mix, D as pow, E as normalize, H as vec4, I as splat3, P as smoothstep, V as vec3, h as gt, n as add, o as div, s as dot, u as float, w as mul, x as max, y as local, z as sub } from "./math-7PlusTFx.js";
10
- import { n as emissiveAlpha } from "./compose-DNU_Ut36.js";
11
- var { sdfSpaceUV } = glass_exports;
12
- const IRRADIANCE_FORMAT = "rgba16float";
13
- const IrradianceParams = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(struct({
14
- center: vec2f,
15
- lightPos: arrayOf(vec4f, 8),
16
- lightColor: arrayOf(vec4f, 8),
17
- lightCount: f32,
18
- scale: f32,
19
- rotation: f32,
20
- aspect: f32,
21
- reach: f32,
22
- wrap: f32,
23
- lightRange: f32,
24
- shadowSoftness: f32,
25
- eps: f32,
26
- res: f32,
27
- frame: f32,
28
- rays: f32,
29
- saRadius: f32,
30
- saSides: f32,
31
- saRounding: f32,
32
- saInnerRatio: f32,
33
- saRotation: f32,
34
- saHeight: f32,
35
- saOffset: f32,
36
- saAperture: f32,
37
- vfOriginX: f32,
38
- vfOriginY: f32,
39
- vfSpanX: f32,
40
- vfSpanY: f32,
41
- vfActiveRes: f32,
42
- vfRBound: f32
43
- }), "IrradianceParams");
44
- var outEntry = { storageTexture: textureStorage2d(IRRADIANCE_FORMAT, "write-only") };
45
- const irradianceAnalyticLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
46
- params: { uniform: IrradianceParams },
47
- outTex: outEntry
48
- }), "irradianceAnalyticLayout");
49
- const irradianceSvgLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
50
- params: { uniform: IrradianceParams },
51
- outTex: outEntry,
52
- sdfSource: { texture: texture2d(f32) },
53
- samp: { sampler: "filtering" }
54
- }), "irradianceSvgLayout");
55
- const irradianceFieldLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
56
- params: { uniform: IrradianceParams },
57
- outTex: outEntry,
58
- silhouetteTex: { texture: texture2d(f32) },
59
- samp: { sampler: "filtering" }
60
- }), "irradianceFieldLayout");
61
- var FAR = 1e3;
62
- var sane = typegpu_default.fn([f32], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((v) => {
63
- "use gpu";
64
- return max$1(min(v, FAR), __tsover_mul(FAR, -1));
65
- }), {
66
- v: 2,
67
- name: void 0,
68
- ast: {
69
- "params": [{
70
- "type": "i",
71
- "name": "v"
72
- }],
73
- "body": [0, [[10, [
74
- 6,
75
- "std.max",
76
- [[
77
- 6,
78
- "std.min",
79
- ["v", "FAR"]
80
- ], [
81
- 1,
82
- "FAR",
83
- "*",
84
- [
85
- 4,
86
- "-",
87
- [5, "1"]
88
- ]
89
- ]]
90
- ]]]]
91
- },
92
- externals: {
93
- "std.max": () => max$1,
94
- "std.min": () => min,
95
- "FAR": () => FAR
96
- }
97
- }) && $.f)({})).$name("irradianceSane");
98
- var beyondSquare = typegpu_default.fn([vec2f], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((uv) => {
99
- "use gpu";
100
- const c = clamp(uv, vec2f(0, 0), vec2f(1, 1));
101
- return length(uv.sub(c));
102
- }), {
103
- v: 2,
104
- name: void 0,
105
- ast: {
106
- "params": [{
107
- "type": "i",
108
- "name": "uv"
109
- }],
110
- "body": [0, [[
111
- 13,
112
- "c",
113
- [
114
- 6,
115
- "std.clamp",
116
- [
117
- "uv",
118
- [
119
- 6,
120
- "d.vec2f",
121
- [[5, "0"], [5, "0"]]
122
- ],
123
- [
124
- 6,
125
- "d.vec2f",
126
- [[5, "1"], [5, "1"]]
127
- ]
128
- ]
129
- ]
130
- ], [10, [
131
- 6,
132
- "std.length",
133
- [[
134
- 6,
135
- [
136
- 7,
137
- "uv",
138
- "sub"
139
- ],
140
- ["c"]
141
- ]]
142
- ]]]]
143
- },
144
- externals: {
145
- "std.clamp": () => clamp,
146
- "d.vec2f": () => vec2f,
147
- "std.length": () => length
148
- }
149
- }) && $.f)({})).$name("irradianceBeyondSquare");
150
- function analyticField(shapeType) {
151
- const sdfFn = buildAnalyticSdfFn(shapeType);
152
- return typegpu_default.fn([vec2f], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((uv) => {
153
- "use gpu";
154
- const p = irradianceAnalyticLayout.$.params;
155
- return sdfFn(uv, p.saRadius, p.saSides, p.saRounding, p.saInnerRatio, p.saRotation, p.saHeight, p.saOffset, p.saAperture).x;
156
- }), {
157
- v: 2,
158
- name: void 0,
159
- ast: {
160
- "params": [{
161
- "type": "i",
162
- "name": "uv"
163
- }],
164
- "body": [0, [[
165
- 13,
166
- "p",
167
- [
168
- 7,
169
- [
170
- 7,
171
- "irradianceAnalyticLayout",
172
- "$"
173
- ],
174
- "params"
175
- ]
176
- ], [10, [
177
- 7,
178
- [
179
- 6,
180
- "sdfFn",
181
- [
182
- "uv",
183
- [
184
- 7,
185
- "p",
186
- "saRadius"
187
- ],
188
- [
189
- 7,
190
- "p",
191
- "saSides"
192
- ],
193
- [
194
- 7,
195
- "p",
196
- "saRounding"
197
- ],
198
- [
199
- 7,
200
- "p",
201
- "saInnerRatio"
202
- ],
203
- [
204
- 7,
205
- "p",
206
- "saRotation"
207
- ],
208
- [
209
- 7,
210
- "p",
211
- "saHeight"
212
- ],
213
- [
214
- 7,
215
- "p",
216
- "saOffset"
217
- ],
218
- [
219
- 7,
220
- "p",
221
- "saAperture"
222
- ]
223
- ]
224
- ],
225
- "x"
226
- ]]]]
227
- },
228
- externals: {
229
- "irradianceAnalyticLayout": () => irradianceAnalyticLayout,
230
- "sdfFn": () => sdfFn
231
- }
232
- }) && $.f)({})).$name("irradianceAnalyticField");
233
- }
234
- const svgField = typegpu_default.fn([vec2f], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((uv) => {
235
- "use gpu";
236
- const border = textureSampleLevel(irradianceSvgLayout.$.sdfSource, irradianceSvgLayout.$.samp, uv, f32(0)).x;
237
- const beyond = beyondSquare(uv);
238
- return sane(select(border, max$1(beyond, __tsover_sub(border, beyond)), beyond > 0));
239
- }), {
240
- v: 2,
241
- name: void 0,
242
- ast: {
243
- "params": [{
244
- "type": "i",
245
- "name": "uv"
246
- }],
247
- "body": [0, [
248
- [
249
- 13,
250
- "border",
251
- [
252
- 7,
253
- [
254
- 6,
255
- "std.textureSampleLevel",
256
- [
257
- [
258
- 7,
259
- [
260
- 7,
261
- "irradianceSvgLayout",
262
- "$"
263
- ],
264
- "sdfSource"
265
- ],
266
- [
267
- 7,
268
- [
269
- 7,
270
- "irradianceSvgLayout",
271
- "$"
272
- ],
273
- "samp"
274
- ],
275
- "uv",
276
- [
277
- 6,
278
- "d.f32",
279
- [[5, "0"]]
280
- ]
281
- ]
282
- ],
283
- "x"
284
- ]
285
- ],
286
- [
287
- 13,
288
- "beyond",
289
- [
290
- 6,
291
- "beyondSquare",
292
- ["uv"]
293
- ]
294
- ],
295
- [10, [
296
- 6,
297
- "sane",
298
- [[
299
- 6,
300
- "std.select",
301
- [
302
- "border",
303
- [
304
- 6,
305
- "std.max",
306
- ["beyond", [
307
- 1,
308
- "border",
309
- "-",
310
- "beyond"
311
- ]]
312
- ],
313
- [
314
- 1,
315
- "beyond",
316
- ">",
317
- [5, "0"]
318
- ]
319
- ]
320
- ]]
321
- ]]
322
- ]]
323
- },
324
- externals: {
325
- "std.textureSampleLevel": () => textureSampleLevel,
326
- "irradianceSvgLayout": () => irradianceSvgLayout,
327
- "d.f32": () => f32,
328
- "beyondSquare": () => beyondSquare,
329
- "sane": () => sane,
330
- "std.select": () => select,
331
- "std.max": () => max$1
332
- }
333
- }) && $.f)({})).$name("irradianceSvgField");
334
- const volumetricField = typegpu_default.fn([vec2f], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((uv) => {
335
- "use gpu";
336
- const p = irradianceFieldLayout.$.params;
337
- const cx = clamp(uv.x, p.vfOriginX, __tsover_add(p.vfOriginX, p.vfSpanX));
338
- const cy = clamp(uv.y, p.vfOriginY, __tsover_add(p.vfOriginY, p.vfSpanY));
339
- const outside = length(vec2f(__tsover_sub(uv.x, cx), __tsover_sub(uv.y, cy)));
340
- const circle = __tsover_sub(length(vec2f(__tsover_sub(uv.x, .5), __tsover_sub(uv.y, .5))), p.vfRBound);
341
- const tuv = vec2f(__tsover_div(__tsover_sub(cx, p.vfOriginX), p.vfSpanX), __tsover_div(__tsover_sub(cy, p.vfOriginY), p.vfSpanY));
342
- const sil = textureSampleLevel(irradianceFieldLayout.$.silhouetteTex, irradianceFieldLayout.$.samp, tuv, f32(0));
343
- const inDomain = __tsover_mul(sil.z, sil.w);
344
- return sane(select(inDomain, max$1(max$1(outside, circle), __tsover_sub(inDomain, outside)), outside > 0));
345
- }), {
346
- v: 2,
347
- name: void 0,
348
- ast: {
349
- "params": [{
350
- "type": "i",
351
- "name": "uv"
352
- }],
353
- "body": [0, [
354
- [
355
- 13,
356
- "p",
357
- [
358
- 7,
359
- [
360
- 7,
361
- "irradianceFieldLayout",
362
- "$"
363
- ],
364
- "params"
365
- ]
366
- ],
367
- [
368
- 13,
369
- "cx",
370
- [
371
- 6,
372
- "std.clamp",
373
- [
374
- [
375
- 7,
376
- "uv",
377
- "x"
378
- ],
379
- [
380
- 7,
381
- "p",
382
- "vfOriginX"
383
- ],
384
- [
385
- 1,
386
- [
387
- 7,
388
- "p",
389
- "vfOriginX"
390
- ],
391
- "+",
392
- [
393
- 7,
394
- "p",
395
- "vfSpanX"
396
- ]
397
- ]
398
- ]
399
- ]
400
- ],
401
- [
402
- 13,
403
- "cy",
404
- [
405
- 6,
406
- "std.clamp",
407
- [
408
- [
409
- 7,
410
- "uv",
411
- "y"
412
- ],
413
- [
414
- 7,
415
- "p",
416
- "vfOriginY"
417
- ],
418
- [
419
- 1,
420
- [
421
- 7,
422
- "p",
423
- "vfOriginY"
424
- ],
425
- "+",
426
- [
427
- 7,
428
- "p",
429
- "vfSpanY"
430
- ]
431
- ]
432
- ]
433
- ]
434
- ],
435
- [
436
- 13,
437
- "outside",
438
- [
439
- 6,
440
- "std.length",
441
- [[
442
- 6,
443
- "d.vec2f",
444
- [[
445
- 1,
446
- [
447
- 7,
448
- "uv",
449
- "x"
450
- ],
451
- "-",
452
- "cx"
453
- ], [
454
- 1,
455
- [
456
- 7,
457
- "uv",
458
- "y"
459
- ],
460
- "-",
461
- "cy"
462
- ]]
463
- ]]
464
- ]
465
- ],
466
- [
467
- 13,
468
- "circle",
469
- [
470
- 1,
471
- [
472
- 6,
473
- "std.length",
474
- [[
475
- 6,
476
- "d.vec2f",
477
- [[
478
- 1,
479
- [
480
- 7,
481
- "uv",
482
- "x"
483
- ],
484
- "-",
485
- [5, "0.5"]
486
- ], [
487
- 1,
488
- [
489
- 7,
490
- "uv",
491
- "y"
492
- ],
493
- "-",
494
- [5, "0.5"]
495
- ]]
496
- ]]
497
- ],
498
- "-",
499
- [
500
- 7,
501
- "p",
502
- "vfRBound"
503
- ]
504
- ]
505
- ],
506
- [
507
- 13,
508
- "tuv",
509
- [
510
- 6,
511
- "d.vec2f",
512
- [[
513
- 1,
514
- [
515
- 1,
516
- "cx",
517
- "-",
518
- [
519
- 7,
520
- "p",
521
- "vfOriginX"
522
- ]
523
- ],
524
- "/",
525
- [
526
- 7,
527
- "p",
528
- "vfSpanX"
529
- ]
530
- ], [
531
- 1,
532
- [
533
- 1,
534
- "cy",
535
- "-",
536
- [
537
- 7,
538
- "p",
539
- "vfOriginY"
540
- ]
541
- ],
542
- "/",
543
- [
544
- 7,
545
- "p",
546
- "vfSpanY"
547
- ]
548
- ]]
549
- ]
550
- ],
551
- [
552
- 13,
553
- "sil",
554
- [
555
- 6,
556
- "std.textureSampleLevel",
557
- [
558
- [
559
- 7,
560
- [
561
- 7,
562
- "irradianceFieldLayout",
563
- "$"
564
- ],
565
- "silhouetteTex"
566
- ],
567
- [
568
- 7,
569
- [
570
- 7,
571
- "irradianceFieldLayout",
572
- "$"
573
- ],
574
- "samp"
575
- ],
576
- "tuv",
577
- [
578
- 6,
579
- "d.f32",
580
- [[5, "0"]]
581
- ]
582
- ]
583
- ]
584
- ],
585
- [
586
- 13,
587
- "inDomain",
588
- [
589
- 1,
590
- [
591
- 7,
592
- "sil",
593
- "z"
594
- ],
595
- "*",
596
- [
597
- 7,
598
- "sil",
599
- "w"
600
- ]
601
- ]
602
- ],
603
- [
604
- 13,
605
- "beyond",
606
- [
607
- 6,
608
- "std.max",
609
- [[
610
- 6,
611
- "std.max",
612
- ["outside", "circle"]
613
- ], [
614
- 1,
615
- "inDomain",
616
- "-",
617
- "outside"
618
- ]]
619
- ]
620
- ],
621
- [10, [
622
- 6,
623
- "sane",
624
- [[
625
- 6,
626
- "std.select",
627
- [
628
- "inDomain",
629
- "beyond",
630
- [
631
- 1,
632
- "outside",
633
- ">",
634
- [5, "0"]
635
- ]
636
- ]
637
- ]]
638
- ]]
639
- ]]
640
- },
641
- externals: {
642
- "irradianceFieldLayout": () => irradianceFieldLayout,
643
- "std.clamp": () => clamp,
644
- "std.length": () => length,
645
- "d.vec2f": () => vec2f,
646
- "std.textureSampleLevel": () => textureSampleLevel,
647
- "d.f32": () => f32,
648
- "std.max": () => max$1,
649
- "sane": () => sane,
650
- "std.select": () => select
651
- }
652
- }) && $.f)({})).$name("irradianceVolumetricField");
653
- const SilhouetteParams = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(struct({
654
- vfOriginX: f32,
655
- vfOriginY: f32,
656
- vfSpanX: f32,
657
- vfSpanY: f32,
658
- vfActiveRes: f32,
659
- vfRBound: f32,
660
- res: f32,
661
- step: f32
662
- }), "SilhouetteParams");
663
- const silhouetteSeedLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
664
- params: { uniform: SilhouetteParams },
665
- fieldTex: {
666
- texture: texture2d(f32),
667
- sampleType: "unfilterable-float"
668
- },
669
- out: outEntry
670
- }), "silhouetteSeedLayout");
671
- const silhouetteStepLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
672
- params: { uniform: SilhouetteParams },
673
- src: { texture: texture2d(f32) },
674
- out: outEntry
675
- }), "silhouetteStepLayout");
676
- var { fieldSampleFastArg } = buildFieldSampleGraphArgs();
677
- var silhouetteInside = typegpu_default.fn([f32, f32], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((tx, ty) => {
678
- "use gpu";
679
- const p = silhouetteSeedLayout.$.params;
680
- const v = fieldSampleFastArg(vec2f(__tsover_add(p.vfOriginX, __tsover_mul(__tsover_div(__tsover_add(tx, .5), p.res), p.vfSpanX)), __tsover_add(p.vfOriginY, __tsover_mul(__tsover_div(__tsover_add(ty, .5), p.res), p.vfSpanY))), silhouetteSeedLayout.$.fieldTex, p.vfOriginX, p.vfOriginY, p.vfSpanX, p.vfSpanY, p.vfActiveRes, p.vfRBound).x;
681
- return select(f32(1), f32(-1), v < 0);
682
- }), {
683
- v: 2,
684
- name: void 0,
685
- ast: {
686
- "params": [{
687
- "type": "i",
688
- "name": "tx"
689
- }, {
690
- "type": "i",
691
- "name": "ty"
692
- }],
693
- "body": [0, [
694
- [
695
- 13,
696
- "p",
697
- [
698
- 7,
699
- [
700
- 7,
701
- "silhouetteSeedLayout",
702
- "$"
703
- ],
704
- "params"
705
- ]
706
- ],
707
- [
708
- 13,
709
- "uv",
710
- [
711
- 6,
712
- "d.vec2f",
713
- [[
714
- 1,
715
- [
716
- 7,
717
- "p",
718
- "vfOriginX"
719
- ],
720
- "+",
721
- [
722
- 1,
723
- [
724
- 1,
725
- [
726
- 1,
727
- "tx",
728
- "+",
729
- [5, "0.5"]
730
- ],
731
- "/",
732
- [
733
- 7,
734
- "p",
735
- "res"
736
- ]
737
- ],
738
- "*",
739
- [
740
- 7,
741
- "p",
742
- "vfSpanX"
743
- ]
744
- ]
745
- ], [
746
- 1,
747
- [
748
- 7,
749
- "p",
750
- "vfOriginY"
751
- ],
752
- "+",
753
- [
754
- 1,
755
- [
756
- 1,
757
- [
758
- 1,
759
- "ty",
760
- "+",
761
- [5, "0.5"]
762
- ],
763
- "/",
764
- [
765
- 7,
766
- "p",
767
- "res"
768
- ]
769
- ],
770
- "*",
771
- [
772
- 7,
773
- "p",
774
- "vfSpanY"
775
- ]
776
- ]
777
- ]]
778
- ]
779
- ],
780
- [
781
- 13,
782
- "v",
783
- [
784
- 7,
785
- [
786
- 6,
787
- "fieldSampleFastArg",
788
- [
789
- "uv",
790
- [
791
- 7,
792
- [
793
- 7,
794
- "silhouetteSeedLayout",
795
- "$"
796
- ],
797
- "fieldTex"
798
- ],
799
- [
800
- 7,
801
- "p",
802
- "vfOriginX"
803
- ],
804
- [
805
- 7,
806
- "p",
807
- "vfOriginY"
808
- ],
809
- [
810
- 7,
811
- "p",
812
- "vfSpanX"
813
- ],
814
- [
815
- 7,
816
- "p",
817
- "vfSpanY"
818
- ],
819
- [
820
- 7,
821
- "p",
822
- "vfActiveRes"
823
- ],
824
- [
825
- 7,
826
- "p",
827
- "vfRBound"
828
- ]
829
- ]
830
- ],
831
- "x"
832
- ]
833
- ],
834
- [10, [
835
- 6,
836
- "std.select",
837
- [
838
- [
839
- 6,
840
- "d.f32",
841
- [[5, "1"]]
842
- ],
843
- [
844
- 6,
845
- "d.f32",
846
- [[
847
- 4,
848
- "-",
849
- [5, "1"]
850
- ]]
851
- ],
852
- [
853
- 1,
854
- "v",
855
- "<",
856
- [5, "0"]
857
- ]
858
- ]
859
- ]]
860
- ]]
861
- },
862
- externals: {
863
- "silhouetteSeedLayout": () => silhouetteSeedLayout,
864
- "d.vec2f": () => vec2f,
865
- "fieldSampleFastArg": () => fieldSampleFastArg,
866
- "std.select": () => select,
867
- "d.f32": () => f32
868
- }
869
- }) && $.f)({})).$name("silhouetteInside");
870
- const silhouetteSeedKernel = typegpu_default.fn([u32, u32])(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((cx, cy) => {
871
- "use gpu";
872
- const p = silhouetteSeedLayout.$.params;
873
- const fx = f32(cx);
874
- const fy = f32(cy);
875
- const s0 = silhouetteInside(fx, fy);
876
- const maxT = __tsover_sub(p.res, 1);
877
- const sL = silhouetteInside(max$1(__tsover_sub(fx, 1), 0), fy);
878
- const sR = silhouetteInside(min(__tsover_add(fx, 1), maxT), fy);
879
- const sD = silhouetteInside(fx, max$1(__tsover_sub(fy, 1), 0));
880
- const sU = silhouetteInside(fx, min(__tsover_add(fy, 1), maxT));
881
- const boundary = sL !== s0 || sR !== s0 || sD !== s0 || sU !== s0;
882
- const sx = __tsover_add(p.vfOriginX, __tsover_mul(__tsover_div(__tsover_add(fx, .5), p.res), p.vfSpanX));
883
- const sy = __tsover_add(p.vfOriginY, __tsover_mul(__tsover_div(__tsover_add(fy, .5), p.res), p.vfSpanY));
884
- const seed = select(vec4f(-1, -1, 6e4, s0), vec4f(sx, sy, 0, s0), boundary);
885
- textureStore(silhouetteSeedLayout.$.out, vec2u(cx, cy), seed);
886
- }), {
887
- v: 2,
888
- name: void 0,
889
- ast: {
890
- "params": [{
891
- "type": "i",
892
- "name": "cx"
893
- }, {
894
- "type": "i",
895
- "name": "cy"
896
- }],
897
- "body": [0, [
898
- [
899
- 13,
900
- "p",
901
- [
902
- 7,
903
- [
904
- 7,
905
- "silhouetteSeedLayout",
906
- "$"
907
- ],
908
- "params"
909
- ]
910
- ],
911
- [
912
- 13,
913
- "fx",
914
- [
915
- 6,
916
- "d.f32",
917
- ["cx"]
918
- ]
919
- ],
920
- [
921
- 13,
922
- "fy",
923
- [
924
- 6,
925
- "d.f32",
926
- ["cy"]
927
- ]
928
- ],
929
- [
930
- 13,
931
- "s0",
932
- [
933
- 6,
934
- "silhouetteInside",
935
- ["fx", "fy"]
936
- ]
937
- ],
938
- [
939
- 13,
940
- "maxT",
941
- [
942
- 1,
943
- [
944
- 7,
945
- "p",
946
- "res"
947
- ],
948
- "-",
949
- [5, "1"]
950
- ]
951
- ],
952
- [
953
- 13,
954
- "sL",
955
- [
956
- 6,
957
- "silhouetteInside",
958
- [[
959
- 6,
960
- "std.max",
961
- [[
962
- 1,
963
- "fx",
964
- "-",
965
- [5, "1"]
966
- ], [5, "0"]]
967
- ], "fy"]
968
- ]
969
- ],
970
- [
971
- 13,
972
- "sR",
973
- [
974
- 6,
975
- "silhouetteInside",
976
- [[
977
- 6,
978
- "std.min",
979
- [[
980
- 1,
981
- "fx",
982
- "+",
983
- [5, "1"]
984
- ], "maxT"]
985
- ], "fy"]
986
- ]
987
- ],
988
- [
989
- 13,
990
- "sD",
991
- [
992
- 6,
993
- "silhouetteInside",
994
- ["fx", [
995
- 6,
996
- "std.max",
997
- [[
998
- 1,
999
- "fy",
1000
- "-",
1001
- [5, "1"]
1002
- ], [5, "0"]]
1003
- ]]
1004
- ]
1005
- ],
1006
- [
1007
- 13,
1008
- "sU",
1009
- [
1010
- 6,
1011
- "silhouetteInside",
1012
- ["fx", [
1013
- 6,
1014
- "std.min",
1015
- [[
1016
- 1,
1017
- "fy",
1018
- "+",
1019
- [5, "1"]
1020
- ], "maxT"]
1021
- ]]
1022
- ]
1023
- ],
1024
- [
1025
- 13,
1026
- "boundary",
1027
- [
1028
- 3,
1029
- [
1030
- 3,
1031
- [
1032
- 3,
1033
- [
1034
- 1,
1035
- "sL",
1036
- "!==",
1037
- "s0"
1038
- ],
1039
- "||",
1040
- [
1041
- 1,
1042
- "sR",
1043
- "!==",
1044
- "s0"
1045
- ]
1046
- ],
1047
- "||",
1048
- [
1049
- 1,
1050
- "sD",
1051
- "!==",
1052
- "s0"
1053
- ]
1054
- ],
1055
- "||",
1056
- [
1057
- 1,
1058
- "sU",
1059
- "!==",
1060
- "s0"
1061
- ]
1062
- ]
1063
- ],
1064
- [
1065
- 13,
1066
- "sx",
1067
- [
1068
- 1,
1069
- [
1070
- 7,
1071
- "p",
1072
- "vfOriginX"
1073
- ],
1074
- "+",
1075
- [
1076
- 1,
1077
- [
1078
- 1,
1079
- [
1080
- 1,
1081
- "fx",
1082
- "+",
1083
- [5, "0.5"]
1084
- ],
1085
- "/",
1086
- [
1087
- 7,
1088
- "p",
1089
- "res"
1090
- ]
1091
- ],
1092
- "*",
1093
- [
1094
- 7,
1095
- "p",
1096
- "vfSpanX"
1097
- ]
1098
- ]
1099
- ]
1100
- ],
1101
- [
1102
- 13,
1103
- "sy",
1104
- [
1105
- 1,
1106
- [
1107
- 7,
1108
- "p",
1109
- "vfOriginY"
1110
- ],
1111
- "+",
1112
- [
1113
- 1,
1114
- [
1115
- 1,
1116
- [
1117
- 1,
1118
- "fy",
1119
- "+",
1120
- [5, "0.5"]
1121
- ],
1122
- "/",
1123
- [
1124
- 7,
1125
- "p",
1126
- "res"
1127
- ]
1128
- ],
1129
- "*",
1130
- [
1131
- 7,
1132
- "p",
1133
- "vfSpanY"
1134
- ]
1135
- ]
1136
- ]
1137
- ],
1138
- [
1139
- 13,
1140
- "seed",
1141
- [
1142
- 6,
1143
- "std.select",
1144
- [
1145
- [
1146
- 6,
1147
- "d.vec4f",
1148
- [
1149
- [
1150
- 4,
1151
- "-",
1152
- [5, "1"]
1153
- ],
1154
- [
1155
- 4,
1156
- "-",
1157
- [5, "1"]
1158
- ],
1159
- [5, "60000"],
1160
- "s0"
1161
- ]
1162
- ],
1163
- [
1164
- 6,
1165
- "d.vec4f",
1166
- [
1167
- "sx",
1168
- "sy",
1169
- [5, "0"],
1170
- "s0"
1171
- ]
1172
- ],
1173
- "boundary"
1174
- ]
1175
- ]
1176
- ],
1177
- [
1178
- 6,
1179
- "std.textureStore",
1180
- [
1181
- [
1182
- 7,
1183
- [
1184
- 7,
1185
- "silhouetteSeedLayout",
1186
- "$"
1187
- ],
1188
- "out"
1189
- ],
1190
- [
1191
- 6,
1192
- "d.vec2u",
1193
- ["cx", "cy"]
1194
- ],
1195
- "seed"
1196
- ]
1197
- ]
1198
- ]]
1199
- },
1200
- externals: {
1201
- "silhouetteSeedLayout": () => silhouetteSeedLayout,
1202
- "d.f32": () => f32,
1203
- "silhouetteInside": () => silhouetteInside,
1204
- "std.max": () => max$1,
1205
- "std.min": () => min,
1206
- "std.select": () => select,
1207
- "d.vec4f": () => vec4f,
1208
- "std.textureStore": () => textureStore,
1209
- "d.vec2u": () => vec2u
1210
- }
1211
- }) && $.f)({})).$name("silhouetteSeed");
1212
- const silhouetteStepKernel = typegpu_default.fn([u32, u32])(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((cx, cy) => {
1213
- "use gpu";
1214
- const p = silhouetteStepLayout.$.params;
1215
- const tx = f32(cx);
1216
- const ty = f32(cy);
1217
- const here = vec2f(__tsover_add(p.vfOriginX, __tsover_mul(__tsover_div(__tsover_add(tx, .5), p.res), p.vfSpanX)), __tsover_add(p.vfOriginY, __tsover_mul(__tsover_div(__tsover_add(ty, .5), p.res), p.vfSpanY)));
1218
- const self = textureLoad(silhouetteStepLayout.$.src, vec2u(cx, cy), 0);
1219
- let best = vec4f(self);
1220
- const maxT = __tsover_sub(p.res, 1);
1221
- for (let j = -1; j <= 1; j++) for (let i = -1; i <= 1; i++) {
1222
- const nx = clamp(__tsover_add(tx, __tsover_mul(f32(i), p.step)), 0, maxT);
1223
- const ny = clamp(__tsover_add(ty, __tsover_mul(f32(j), p.step)), 0, maxT);
1224
- const n = textureLoad(silhouetteStepLayout.$.src, vec2u(u32(nx), u32(ny)), 0);
1225
- if (n.x >= 0) {
1226
- const dist = length(n.xy.sub(here));
1227
- if (dist < best.z) best = vec4f(n.x, n.y, dist, best.w);
1228
- }
1229
- }
1230
- textureStore(silhouetteStepLayout.$.out, vec2u(cx, cy), vec4f(best.x, best.y, best.z, self.w));
1231
- }), {
1232
- v: 2,
1233
- name: void 0,
1234
- ast: {
1235
- "params": [{
1236
- "type": "i",
1237
- "name": "cx"
1238
- }, {
1239
- "type": "i",
1240
- "name": "cy"
1241
- }],
1242
- "body": [0, [
1243
- [
1244
- 13,
1245
- "p",
1246
- [
1247
- 7,
1248
- [
1249
- 7,
1250
- "silhouetteStepLayout",
1251
- "$"
1252
- ],
1253
- "params"
1254
- ]
1255
- ],
1256
- [
1257
- 13,
1258
- "tx",
1259
- [
1260
- 6,
1261
- "d.f32",
1262
- ["cx"]
1263
- ]
1264
- ],
1265
- [
1266
- 13,
1267
- "ty",
1268
- [
1269
- 6,
1270
- "d.f32",
1271
- ["cy"]
1272
- ]
1273
- ],
1274
- [
1275
- 13,
1276
- "here",
1277
- [
1278
- 6,
1279
- "d.vec2f",
1280
- [[
1281
- 1,
1282
- [
1283
- 7,
1284
- "p",
1285
- "vfOriginX"
1286
- ],
1287
- "+",
1288
- [
1289
- 1,
1290
- [
1291
- 1,
1292
- [
1293
- 1,
1294
- "tx",
1295
- "+",
1296
- [5, "0.5"]
1297
- ],
1298
- "/",
1299
- [
1300
- 7,
1301
- "p",
1302
- "res"
1303
- ]
1304
- ],
1305
- "*",
1306
- [
1307
- 7,
1308
- "p",
1309
- "vfSpanX"
1310
- ]
1311
- ]
1312
- ], [
1313
- 1,
1314
- [
1315
- 7,
1316
- "p",
1317
- "vfOriginY"
1318
- ],
1319
- "+",
1320
- [
1321
- 1,
1322
- [
1323
- 1,
1324
- [
1325
- 1,
1326
- "ty",
1327
- "+",
1328
- [5, "0.5"]
1329
- ],
1330
- "/",
1331
- [
1332
- 7,
1333
- "p",
1334
- "res"
1335
- ]
1336
- ],
1337
- "*",
1338
- [
1339
- 7,
1340
- "p",
1341
- "vfSpanY"
1342
- ]
1343
- ]
1344
- ]]
1345
- ]
1346
- ],
1347
- [
1348
- 13,
1349
- "self",
1350
- [
1351
- 6,
1352
- "std.textureLoad",
1353
- [
1354
- [
1355
- 7,
1356
- [
1357
- 7,
1358
- "silhouetteStepLayout",
1359
- "$"
1360
- ],
1361
- "src"
1362
- ],
1363
- [
1364
- 6,
1365
- "d.vec2u",
1366
- ["cx", "cy"]
1367
- ],
1368
- [5, "0"]
1369
- ]
1370
- ]
1371
- ],
1372
- [
1373
- 12,
1374
- "best",
1375
- [
1376
- 6,
1377
- "d.vec4f",
1378
- ["self"]
1379
- ]
1380
- ],
1381
- [
1382
- 13,
1383
- "maxT",
1384
- [
1385
- 1,
1386
- [
1387
- 7,
1388
- "p",
1389
- "res"
1390
- ],
1391
- "-",
1392
- [5, "1"]
1393
- ]
1394
- ],
1395
- [
1396
- 14,
1397
- [
1398
- 12,
1399
- "j",
1400
- [
1401
- 4,
1402
- "-",
1403
- [5, "1"]
1404
- ]
1405
- ],
1406
- [
1407
- 1,
1408
- "j",
1409
- "<=",
1410
- [5, "1"]
1411
- ],
1412
- [
1413
- 102,
1414
- "++",
1415
- "j"
1416
- ],
1417
- [0, [[
1418
- 14,
1419
- [
1420
- 12,
1421
- "i",
1422
- [
1423
- 4,
1424
- "-",
1425
- [5, "1"]
1426
- ]
1427
- ],
1428
- [
1429
- 1,
1430
- "i",
1431
- "<=",
1432
- [5, "1"]
1433
- ],
1434
- [
1435
- 102,
1436
- "++",
1437
- "i"
1438
- ],
1439
- [0, [
1440
- [
1441
- 13,
1442
- "nx",
1443
- [
1444
- 6,
1445
- "std.clamp",
1446
- [
1447
- [
1448
- 1,
1449
- "tx",
1450
- "+",
1451
- [
1452
- 1,
1453
- [
1454
- 6,
1455
- "d.f32",
1456
- ["i"]
1457
- ],
1458
- "*",
1459
- [
1460
- 7,
1461
- "p",
1462
- "step"
1463
- ]
1464
- ]
1465
- ],
1466
- [5, "0"],
1467
- "maxT"
1468
- ]
1469
- ]
1470
- ],
1471
- [
1472
- 13,
1473
- "ny",
1474
- [
1475
- 6,
1476
- "std.clamp",
1477
- [
1478
- [
1479
- 1,
1480
- "ty",
1481
- "+",
1482
- [
1483
- 1,
1484
- [
1485
- 6,
1486
- "d.f32",
1487
- ["j"]
1488
- ],
1489
- "*",
1490
- [
1491
- 7,
1492
- "p",
1493
- "step"
1494
- ]
1495
- ]
1496
- ],
1497
- [5, "0"],
1498
- "maxT"
1499
- ]
1500
- ]
1501
- ],
1502
- [
1503
- 13,
1504
- "n",
1505
- [
1506
- 6,
1507
- "std.textureLoad",
1508
- [
1509
- [
1510
- 7,
1511
- [
1512
- 7,
1513
- "silhouetteStepLayout",
1514
- "$"
1515
- ],
1516
- "src"
1517
- ],
1518
- [
1519
- 6,
1520
- "d.vec2u",
1521
- [[
1522
- 6,
1523
- "d.u32",
1524
- ["nx"]
1525
- ], [
1526
- 6,
1527
- "d.u32",
1528
- ["ny"]
1529
- ]]
1530
- ],
1531
- [5, "0"]
1532
- ]
1533
- ]
1534
- ],
1535
- [
1536
- 11,
1537
- [
1538
- 1,
1539
- [
1540
- 7,
1541
- "n",
1542
- "x"
1543
- ],
1544
- ">=",
1545
- [5, "0"]
1546
- ],
1547
- [0, [[
1548
- 13,
1549
- "dist",
1550
- [
1551
- 6,
1552
- "std.length",
1553
- [[
1554
- 6,
1555
- [
1556
- 7,
1557
- [
1558
- 7,
1559
- "n",
1560
- "xy"
1561
- ],
1562
- "sub"
1563
- ],
1564
- ["here"]
1565
- ]]
1566
- ]
1567
- ], [
1568
- 11,
1569
- [
1570
- 1,
1571
- "dist",
1572
- "<",
1573
- [
1574
- 7,
1575
- "best",
1576
- "z"
1577
- ]
1578
- ],
1579
- [0, [[
1580
- 2,
1581
- "best",
1582
- "=",
1583
- [
1584
- 6,
1585
- "d.vec4f",
1586
- [
1587
- [
1588
- 7,
1589
- "n",
1590
- "x"
1591
- ],
1592
- [
1593
- 7,
1594
- "n",
1595
- "y"
1596
- ],
1597
- "dist",
1598
- [
1599
- 7,
1600
- "best",
1601
- "w"
1602
- ]
1603
- ]
1604
- ]
1605
- ]]]
1606
- ]]]
1607
- ]
1608
- ]]
1609
- ]]]
1610
- ],
1611
- [
1612
- 6,
1613
- "std.textureStore",
1614
- [
1615
- [
1616
- 7,
1617
- [
1618
- 7,
1619
- "silhouetteStepLayout",
1620
- "$"
1621
- ],
1622
- "out"
1623
- ],
1624
- [
1625
- 6,
1626
- "d.vec2u",
1627
- ["cx", "cy"]
1628
- ],
1629
- [
1630
- 6,
1631
- "d.vec4f",
1632
- [
1633
- [
1634
- 7,
1635
- "best",
1636
- "x"
1637
- ],
1638
- [
1639
- 7,
1640
- "best",
1641
- "y"
1642
- ],
1643
- [
1644
- 7,
1645
- "best",
1646
- "z"
1647
- ],
1648
- [
1649
- 7,
1650
- "self",
1651
- "w"
1652
- ]
1653
- ]
1654
- ]
1655
- ]
1656
- ]
1657
- ]]
1658
- },
1659
- externals: {
1660
- "silhouetteStepLayout": () => silhouetteStepLayout,
1661
- "d.f32": () => f32,
1662
- "d.vec2f": () => vec2f,
1663
- "std.textureLoad": () => textureLoad,
1664
- "d.vec2u": () => vec2u,
1665
- "d.vec4f": () => vec4f,
1666
- "std.clamp": () => clamp,
1667
- "d.u32": () => u32,
1668
- "std.length": () => length,
1669
- "std.textureStore": () => textureStore
1670
- }
1671
- }) && $.f)({})).$name("silhouetteStep");
1672
- function buildIrradianceKernel(layout, fieldAt, opts) {
1673
- const { steps, shadowSteps, namePrefix } = opts;
1674
- const RAY_SPAN = 3;
1675
- const shadows = shadowSteps > 0;
1676
- const shadowLoop = Math.max(shadowSteps, 1);
1677
- const lay = layout;
1678
- const visibility = typegpu_default.fn([
1679
- vec2f,
1680
- vec2f,
1681
- f32,
1682
- f32
1683
- ], f32)(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((from, toward, eps, soft) => {
1684
- "use gpu";
1685
- const seg = toward.sub(from);
1686
- const len = length(seg);
1687
- const dir = seg.div(max$1(len, 1e-4));
1688
- let vis = f32(1);
1689
- let t = __tsover_mul(eps, 2);
1690
- for (let k = 0; k < shadowLoop; k++) {
1691
- if (t >= len) break;
1692
- const dd = fieldAt(from.add(dir.mul(t)));
1693
- vis = min(vis, clamp(__tsover_div(dd, max$1(__tsover_mul(t, soft), eps)), 0, 1));
1694
- if (vis <= 0) break;
1695
- t = __tsover_add(t, max$1(dd, eps));
1696
- }
1697
- return vis;
1698
- }), {
1699
- v: 2,
1700
- name: void 0,
1701
- ast: {
1702
- "params": [
1703
- {
1704
- "type": "i",
1705
- "name": "from"
1706
- },
1707
- {
1708
- "type": "i",
1709
- "name": "toward"
1710
- },
1711
- {
1712
- "type": "i",
1713
- "name": "eps"
1714
- },
1715
- {
1716
- "type": "i",
1717
- "name": "soft"
1718
- }
1719
- ],
1720
- "body": [0, [
1721
- [
1722
- 13,
1723
- "seg",
1724
- [
1725
- 6,
1726
- [
1727
- 7,
1728
- "toward",
1729
- "sub"
1730
- ],
1731
- ["from"]
1732
- ]
1733
- ],
1734
- [
1735
- 13,
1736
- "len",
1737
- [
1738
- 6,
1739
- "std.length",
1740
- ["seg"]
1741
- ]
1742
- ],
1743
- [
1744
- 13,
1745
- "dir",
1746
- [
1747
- 6,
1748
- [
1749
- 7,
1750
- "seg",
1751
- "div"
1752
- ],
1753
- [[
1754
- 6,
1755
- "std.max",
1756
- ["len", [5, "0.0001"]]
1757
- ]]
1758
- ]
1759
- ],
1760
- [
1761
- 12,
1762
- "vis",
1763
- [
1764
- 6,
1765
- "d.f32",
1766
- [[5, "1"]]
1767
- ]
1768
- ],
1769
- [
1770
- 12,
1771
- "t",
1772
- [
1773
- 1,
1774
- "eps",
1775
- "*",
1776
- [5, "2"]
1777
- ]
1778
- ],
1779
- [
1780
- 14,
1781
- [
1782
- 12,
1783
- "k",
1784
- [5, "0"]
1785
- ],
1786
- [
1787
- 1,
1788
- "k",
1789
- "<",
1790
- "shadowLoop"
1791
- ],
1792
- [
1793
- 102,
1794
- "++",
1795
- "k"
1796
- ],
1797
- [0, [
1798
- [
1799
- 11,
1800
- [
1801
- 1,
1802
- "t",
1803
- ">=",
1804
- "len"
1805
- ],
1806
- [0, [[17]]]
1807
- ],
1808
- [
1809
- 13,
1810
- "dd",
1811
- [
1812
- 6,
1813
- "fieldAt",
1814
- [[
1815
- 6,
1816
- [
1817
- 7,
1818
- "from",
1819
- "add"
1820
- ],
1821
- [[
1822
- 6,
1823
- [
1824
- 7,
1825
- "dir",
1826
- "mul"
1827
- ],
1828
- ["t"]
1829
- ]]
1830
- ]]
1831
- ]
1832
- ],
1833
- [
1834
- 2,
1835
- "vis",
1836
- "=",
1837
- [
1838
- 6,
1839
- "std.min",
1840
- ["vis", [
1841
- 6,
1842
- "std.clamp",
1843
- [
1844
- [
1845
- 1,
1846
- "dd",
1847
- "/",
1848
- [
1849
- 6,
1850
- "std.max",
1851
- [[
1852
- 1,
1853
- "t",
1854
- "*",
1855
- "soft"
1856
- ], "eps"]
1857
- ]
1858
- ],
1859
- [5, "0"],
1860
- [5, "1"]
1861
- ]
1862
- ]]
1863
- ]
1864
- ],
1865
- [
1866
- 11,
1867
- [
1868
- 1,
1869
- "vis",
1870
- "<=",
1871
- [5, "0"]
1872
- ],
1873
- [0, [[17]]]
1874
- ],
1875
- [
1876
- 2,
1877
- "t",
1878
- "+=",
1879
- [
1880
- 6,
1881
- "std.max",
1882
- ["dd", "eps"]
1883
- ]
1884
- ]
1885
- ]]
1886
- ],
1887
- [10, "vis"]
1888
- ]]
1889
- },
1890
- externals: {
1891
- "std.length": () => length,
1892
- "std.max": () => max$1,
1893
- "d.f32": () => f32,
1894
- "shadowLoop": () => shadowLoop,
1895
- "fieldAt": () => fieldAt,
1896
- "std.min": () => min,
1897
- "std.clamp": () => clamp
1898
- }
1899
- }) && $.f)({})).$name(`${namePrefix}Visibility`);
1900
- return typegpu_default.fn([u32, u32])(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((cx, cy) => {
1901
- "use gpu";
1902
- const p = lay.$.params;
1903
- const eps = p.eps;
1904
- const uv = vec2f(__tsover_div(__tsover_add(f32(cx), .5), p.res), __tsover_div(__tsover_add(f32(cy), .5), p.res));
1905
- const sdfUV = sdfSpaceUV(p.center, p.scale, p.rotation, uv, p.aspect);
1906
- const d0 = fieldAt(sdfUV);
1907
- if (d0 < __tsover_mul(eps, -1)) {
1908
- textureStore(lay.$.outTex, vec2u(cx, cy), vec4f(0, 0, 0, 0));
1909
- return;
1910
- }
1911
- let o = vec2f(sdfUV);
1912
- if (d0 < __tsover_mul(eps, 2)) {
1913
- const gx = __tsover_sub(fieldAt(sdfUV.add(vec2f(eps, 0))), d0);
1914
- const gy = __tsover_sub(fieldAt(sdfUV.add(vec2f(0, eps))), d0);
1915
- const g = normalize$1(vec2f(gx, __tsover_add(gy, 1e-6)));
1916
- o = sdfUV.add(g.mul(__tsover_sub(__tsover_mul(eps, 2), d0)));
1917
- }
1918
- const start = max$1(fieldAt(o), eps);
1919
- const tMax = __tsover_add(start, RAY_SPAN);
1920
- const ign = fract(__tsover_mul(52.9829189, fract(__tsover_add(__tsover_mul(f32(cx), .06711056), __tsover_mul(f32(cy), .00583715)))));
1921
- const u = fract(__tsover_add(ign, __tsover_mul(p.frame, .6180339887)));
1922
- const rays = i32(p.rays);
1923
- const rayStep = __tsover_div(TAU, p.rays);
1924
- const lightCount = i32(p.lightCount);
1925
- let acc = vec3f(0, 0, 0);
1926
- for (let i = 0; i < rays; i++) {
1927
- const ang = __tsover_mul(__tsover_add(f32(i), u), rayStep);
1928
- const dir = vec2f(cos(ang), sin(ang));
1929
- let t = start;
1930
- let hitD = f32(1);
1931
- for (let s = 0; s < steps; s++) {
1932
- const dd = fieldAt(o.add(dir.mul(t)));
1933
- if (dd < eps) {
1934
- hitD = dd;
1935
- break;
1936
- }
1937
- t = __tsover_add(t, max$1(dd, eps));
1938
- if (t > tMax) break;
1939
- }
1940
- if (hitD < eps) {
1941
- const pos = o.add(dir.mul(t));
1942
- const nx = __tsover_sub(fieldAt(pos.add(vec2f(eps, 0))), hitD);
1943
- const ny = __tsover_sub(fieldAt(pos.add(vec2f(0, eps))), hitD);
1944
- const n = normalize$1(vec2f(nx, __tsover_add(ny, 1e-6)));
1945
- const hitP = pos.sub(n.mul(max$1(hitD, 0)));
1946
- const shadowFrom = hitP.add(n.mul(__tsover_mul(eps, 2)));
1947
- for (let l = 0; l < lightCount; l++) {
1948
- const lp = p.lightPos[l];
1949
- const lc = p.lightColor[l];
1950
- const lightUV = lp.xy;
1951
- const toL = lightUV.sub(hitP);
1952
- const dist = length(toL);
1953
- const dirL = toL.div(max$1(dist, 1e-4));
1954
- const facing = clamp(__tsover_div(__tsover_add(dot$1(n, dirL), p.wrap), __tsover_add(1, p.wrap)), 0, 1);
1955
- if (facing > 0) {
1956
- const r = __tsover_div(dist, p.lightRange);
1957
- let struck = __tsover_div(facing, __tsover_add(1, __tsover_mul(r, r)));
1958
- if (shadows) struck = __tsover_mul(struck, visibility(shadowFrom, lightUV, eps, p.shadowSoftness));
1959
- acc = acc.add(lc.xyz.mul(__tsover_mul(struck, lc.w)));
1960
- }
1961
- }
1962
- }
1963
- }
1964
- const fade = __tsover_sub(1, smoothstep$1(__tsover_mul(p.reach, .25), p.reach, max$1(d0, 0)));
1965
- const m = clamp(__tsover_add(__tsover_div(d0, eps), 1), 0, 1);
1966
- const irr = min(max$1(acc.div(p.rays), vec3f(0, 0, 0)), vec3f(FAR, FAR, FAR));
1967
- textureStore(lay.$.outTex, vec2u(cx, cy), vec4f(irr.mul(__tsover_mul(fade, m)), m));
1968
- }), {
1969
- v: 2,
1970
- name: void 0,
1971
- ast: {
1972
- "params": [{
1973
- "type": "i",
1974
- "name": "cx"
1975
- }, {
1976
- "type": "i",
1977
- "name": "cy"
1978
- }],
1979
- "body": [0, [
1980
- [
1981
- 13,
1982
- "p",
1983
- [
1984
- 7,
1985
- [
1986
- 7,
1987
- "lay",
1988
- "$"
1989
- ],
1990
- "params"
1991
- ]
1992
- ],
1993
- [
1994
- 13,
1995
- "eps",
1996
- [
1997
- 7,
1998
- "p",
1999
- "eps"
2000
- ]
2001
- ],
2002
- [
2003
- 13,
2004
- "uv",
2005
- [
2006
- 6,
2007
- "d.vec2f",
2008
- [[
2009
- 1,
2010
- [
2011
- 1,
2012
- [
2013
- 6,
2014
- "d.f32",
2015
- ["cx"]
2016
- ],
2017
- "+",
2018
- [5, "0.5"]
2019
- ],
2020
- "/",
2021
- [
2022
- 7,
2023
- "p",
2024
- "res"
2025
- ]
2026
- ], [
2027
- 1,
2028
- [
2029
- 1,
2030
- [
2031
- 6,
2032
- "d.f32",
2033
- ["cy"]
2034
- ],
2035
- "+",
2036
- [5, "0.5"]
2037
- ],
2038
- "/",
2039
- [
2040
- 7,
2041
- "p",
2042
- "res"
2043
- ]
2044
- ]]
2045
- ]
2046
- ],
2047
- [
2048
- 13,
2049
- "sdfUV",
2050
- [
2051
- 6,
2052
- "sdfSpaceUV",
2053
- [
2054
- [
2055
- 7,
2056
- "p",
2057
- "center"
2058
- ],
2059
- [
2060
- 7,
2061
- "p",
2062
- "scale"
2063
- ],
2064
- [
2065
- 7,
2066
- "p",
2067
- "rotation"
2068
- ],
2069
- "uv",
2070
- [
2071
- 7,
2072
- "p",
2073
- "aspect"
2074
- ]
2075
- ]
2076
- ]
2077
- ],
2078
- [
2079
- 13,
2080
- "d0",
2081
- [
2082
- 6,
2083
- "fieldAt",
2084
- ["sdfUV"]
2085
- ]
2086
- ],
2087
- [
2088
- 11,
2089
- [
2090
- 1,
2091
- "d0",
2092
- "<",
2093
- [
2094
- 1,
2095
- "eps",
2096
- "*",
2097
- [
2098
- 4,
2099
- "-",
2100
- [5, "1"]
2101
- ]
2102
- ]
2103
- ],
2104
- [0, [[
2105
- 6,
2106
- "std.textureStore",
2107
- [
2108
- [
2109
- 7,
2110
- [
2111
- 7,
2112
- "lay",
2113
- "$"
2114
- ],
2115
- "outTex"
2116
- ],
2117
- [
2118
- 6,
2119
- "d.vec2u",
2120
- ["cx", "cy"]
2121
- ],
2122
- [
2123
- 6,
2124
- "d.vec4f",
2125
- [
2126
- [5, "0"],
2127
- [5, "0"],
2128
- [5, "0"],
2129
- [5, "0"]
2130
- ]
2131
- ]
2132
- ]
2133
- ], [10]]]
2134
- ],
2135
- [
2136
- 12,
2137
- "o",
2138
- [
2139
- 6,
2140
- "d.vec2f",
2141
- ["sdfUV"]
2142
- ]
2143
- ],
2144
- [
2145
- 11,
2146
- [
2147
- 1,
2148
- "d0",
2149
- "<",
2150
- [
2151
- 1,
2152
- "eps",
2153
- "*",
2154
- [5, "2"]
2155
- ]
2156
- ],
2157
- [0, [
2158
- [
2159
- 13,
2160
- "gx",
2161
- [
2162
- 1,
2163
- [
2164
- 6,
2165
- "fieldAt",
2166
- [[
2167
- 6,
2168
- [
2169
- 7,
2170
- "sdfUV",
2171
- "add"
2172
- ],
2173
- [[
2174
- 6,
2175
- "d.vec2f",
2176
- ["eps", [5, "0"]]
2177
- ]]
2178
- ]]
2179
- ],
2180
- "-",
2181
- "d0"
2182
- ]
2183
- ],
2184
- [
2185
- 13,
2186
- "gy",
2187
- [
2188
- 1,
2189
- [
2190
- 6,
2191
- "fieldAt",
2192
- [[
2193
- 6,
2194
- [
2195
- 7,
2196
- "sdfUV",
2197
- "add"
2198
- ],
2199
- [[
2200
- 6,
2201
- "d.vec2f",
2202
- [[5, "0"], "eps"]
2203
- ]]
2204
- ]]
2205
- ],
2206
- "-",
2207
- "d0"
2208
- ]
2209
- ],
2210
- [
2211
- 13,
2212
- "g",
2213
- [
2214
- 6,
2215
- "std.normalize",
2216
- [[
2217
- 6,
2218
- "d.vec2f",
2219
- ["gx", [
2220
- 1,
2221
- "gy",
2222
- "+",
2223
- [5, "0.000001"]
2224
- ]]
2225
- ]]
2226
- ]
2227
- ],
2228
- [
2229
- 2,
2230
- "o",
2231
- "=",
2232
- [
2233
- 6,
2234
- [
2235
- 7,
2236
- "sdfUV",
2237
- "add"
2238
- ],
2239
- [[
2240
- 6,
2241
- [
2242
- 7,
2243
- "g",
2244
- "mul"
2245
- ],
2246
- [[
2247
- 1,
2248
- [
2249
- 1,
2250
- "eps",
2251
- "*",
2252
- [5, "2"]
2253
- ],
2254
- "-",
2255
- "d0"
2256
- ]]
2257
- ]]
2258
- ]
2259
- ]
2260
- ]]
2261
- ],
2262
- [
2263
- 13,
2264
- "start",
2265
- [
2266
- 6,
2267
- "std.max",
2268
- [[
2269
- 6,
2270
- "fieldAt",
2271
- ["o"]
2272
- ], "eps"]
2273
- ]
2274
- ],
2275
- [
2276
- 13,
2277
- "tMax",
2278
- [
2279
- 1,
2280
- "start",
2281
- "+",
2282
- "RAY_SPAN"
2283
- ]
2284
- ],
2285
- [
2286
- 13,
2287
- "ign",
2288
- [
2289
- 6,
2290
- "std.fract",
2291
- [[
2292
- 1,
2293
- [5, "52.9829189"],
2294
- "*",
2295
- [
2296
- 6,
2297
- "std.fract",
2298
- [[
2299
- 1,
2300
- [
2301
- 1,
2302
- [
2303
- 6,
2304
- "d.f32",
2305
- ["cx"]
2306
- ],
2307
- "*",
2308
- [5, "0.06711056"]
2309
- ],
2310
- "+",
2311
- [
2312
- 1,
2313
- [
2314
- 6,
2315
- "d.f32",
2316
- ["cy"]
2317
- ],
2318
- "*",
2319
- [5, "0.00583715"]
2320
- ]
2321
- ]]
2322
- ]
2323
- ]]
2324
- ]
2325
- ],
2326
- [
2327
- 13,
2328
- "u",
2329
- [
2330
- 6,
2331
- "std.fract",
2332
- [[
2333
- 1,
2334
- "ign",
2335
- "+",
2336
- [
2337
- 1,
2338
- [
2339
- 7,
2340
- "p",
2341
- "frame"
2342
- ],
2343
- "*",
2344
- [5, "0.6180339887"]
2345
- ]
2346
- ]]
2347
- ]
2348
- ],
2349
- [
2350
- 13,
2351
- "rays",
2352
- [
2353
- 6,
2354
- "d.i32",
2355
- [[
2356
- 7,
2357
- "p",
2358
- "rays"
2359
- ]]
2360
- ]
2361
- ],
2362
- [
2363
- 13,
2364
- "rayStep",
2365
- [
2366
- 1,
2367
- "TAU",
2368
- "/",
2369
- [
2370
- 7,
2371
- "p",
2372
- "rays"
2373
- ]
2374
- ]
2375
- ],
2376
- [
2377
- 13,
2378
- "lightCount",
2379
- [
2380
- 6,
2381
- "d.i32",
2382
- [[
2383
- 7,
2384
- "p",
2385
- "lightCount"
2386
- ]]
2387
- ]
2388
- ],
2389
- [
2390
- 12,
2391
- "acc",
2392
- [
2393
- 6,
2394
- "d.vec3f",
2395
- [
2396
- [5, "0"],
2397
- [5, "0"],
2398
- [5, "0"]
2399
- ]
2400
- ]
2401
- ],
2402
- [
2403
- 14,
2404
- [
2405
- 12,
2406
- "i",
2407
- [5, "0"]
2408
- ],
2409
- [
2410
- 1,
2411
- "i",
2412
- "<",
2413
- "rays"
2414
- ],
2415
- [
2416
- 102,
2417
- "++",
2418
- "i"
2419
- ],
2420
- [0, [
2421
- [
2422
- 13,
2423
- "ang",
2424
- [
2425
- 1,
2426
- [
2427
- 1,
2428
- [
2429
- 6,
2430
- "d.f32",
2431
- ["i"]
2432
- ],
2433
- "+",
2434
- "u"
2435
- ],
2436
- "*",
2437
- "rayStep"
2438
- ]
2439
- ],
2440
- [
2441
- 13,
2442
- "dir",
2443
- [
2444
- 6,
2445
- "d.vec2f",
2446
- [[
2447
- 6,
2448
- "std.cos",
2449
- ["ang"]
2450
- ], [
2451
- 6,
2452
- "std.sin",
2453
- ["ang"]
2454
- ]]
2455
- ]
2456
- ],
2457
- [
2458
- 12,
2459
- "t",
2460
- "start"
2461
- ],
2462
- [
2463
- 12,
2464
- "hitD",
2465
- [
2466
- 6,
2467
- "d.f32",
2468
- [[5, "1"]]
2469
- ]
2470
- ],
2471
- [
2472
- 14,
2473
- [
2474
- 12,
2475
- "s",
2476
- [5, "0"]
2477
- ],
2478
- [
2479
- 1,
2480
- "s",
2481
- "<",
2482
- "steps"
2483
- ],
2484
- [
2485
- 102,
2486
- "++",
2487
- "s"
2488
- ],
2489
- [0, [
2490
- [
2491
- 13,
2492
- "dd",
2493
- [
2494
- 6,
2495
- "fieldAt",
2496
- [[
2497
- 6,
2498
- [
2499
- 7,
2500
- "o",
2501
- "add"
2502
- ],
2503
- [[
2504
- 6,
2505
- [
2506
- 7,
2507
- "dir",
2508
- "mul"
2509
- ],
2510
- ["t"]
2511
- ]]
2512
- ]]
2513
- ]
2514
- ],
2515
- [
2516
- 11,
2517
- [
2518
- 1,
2519
- "dd",
2520
- "<",
2521
- "eps"
2522
- ],
2523
- [0, [[
2524
- 2,
2525
- "hitD",
2526
- "=",
2527
- "dd"
2528
- ], [17]]]
2529
- ],
2530
- [
2531
- 2,
2532
- "t",
2533
- "+=",
2534
- [
2535
- 6,
2536
- "std.max",
2537
- ["dd", "eps"]
2538
- ]
2539
- ],
2540
- [
2541
- 11,
2542
- [
2543
- 1,
2544
- "t",
2545
- ">",
2546
- "tMax"
2547
- ],
2548
- [0, [[17]]]
2549
- ]
2550
- ]]
2551
- ],
2552
- [
2553
- 11,
2554
- [
2555
- 1,
2556
- "hitD",
2557
- "<",
2558
- "eps"
2559
- ],
2560
- [0, [
2561
- [
2562
- 13,
2563
- "pos",
2564
- [
2565
- 6,
2566
- [
2567
- 7,
2568
- "o",
2569
- "add"
2570
- ],
2571
- [[
2572
- 6,
2573
- [
2574
- 7,
2575
- "dir",
2576
- "mul"
2577
- ],
2578
- ["t"]
2579
- ]]
2580
- ]
2581
- ],
2582
- [
2583
- 13,
2584
- "nx",
2585
- [
2586
- 1,
2587
- [
2588
- 6,
2589
- "fieldAt",
2590
- [[
2591
- 6,
2592
- [
2593
- 7,
2594
- "pos",
2595
- "add"
2596
- ],
2597
- [[
2598
- 6,
2599
- "d.vec2f",
2600
- ["eps", [5, "0"]]
2601
- ]]
2602
- ]]
2603
- ],
2604
- "-",
2605
- "hitD"
2606
- ]
2607
- ],
2608
- [
2609
- 13,
2610
- "ny",
2611
- [
2612
- 1,
2613
- [
2614
- 6,
2615
- "fieldAt",
2616
- [[
2617
- 6,
2618
- [
2619
- 7,
2620
- "pos",
2621
- "add"
2622
- ],
2623
- [[
2624
- 6,
2625
- "d.vec2f",
2626
- [[5, "0"], "eps"]
2627
- ]]
2628
- ]]
2629
- ],
2630
- "-",
2631
- "hitD"
2632
- ]
2633
- ],
2634
- [
2635
- 13,
2636
- "n",
2637
- [
2638
- 6,
2639
- "std.normalize",
2640
- [[
2641
- 6,
2642
- "d.vec2f",
2643
- ["nx", [
2644
- 1,
2645
- "ny",
2646
- "+",
2647
- [5, "0.000001"]
2648
- ]]
2649
- ]]
2650
- ]
2651
- ],
2652
- [
2653
- 13,
2654
- "hitP",
2655
- [
2656
- 6,
2657
- [
2658
- 7,
2659
- "pos",
2660
- "sub"
2661
- ],
2662
- [[
2663
- 6,
2664
- [
2665
- 7,
2666
- "n",
2667
- "mul"
2668
- ],
2669
- [[
2670
- 6,
2671
- "std.max",
2672
- ["hitD", [5, "0"]]
2673
- ]]
2674
- ]]
2675
- ]
2676
- ],
2677
- [
2678
- 13,
2679
- "shadowFrom",
2680
- [
2681
- 6,
2682
- [
2683
- 7,
2684
- "hitP",
2685
- "add"
2686
- ],
2687
- [[
2688
- 6,
2689
- [
2690
- 7,
2691
- "n",
2692
- "mul"
2693
- ],
2694
- [[
2695
- 1,
2696
- "eps",
2697
- "*",
2698
- [5, "2"]
2699
- ]]
2700
- ]]
2701
- ]
2702
- ],
2703
- [
2704
- 14,
2705
- [
2706
- 12,
2707
- "l",
2708
- [5, "0"]
2709
- ],
2710
- [
2711
- 1,
2712
- "l",
2713
- "<",
2714
- "lightCount"
2715
- ],
2716
- [
2717
- 102,
2718
- "++",
2719
- "l"
2720
- ],
2721
- [0, [
2722
- [
2723
- 13,
2724
- "lp",
2725
- [
2726
- 8,
2727
- [
2728
- 7,
2729
- "p",
2730
- "lightPos"
2731
- ],
2732
- "l"
2733
- ]
2734
- ],
2735
- [
2736
- 13,
2737
- "lc",
2738
- [
2739
- 8,
2740
- [
2741
- 7,
2742
- "p",
2743
- "lightColor"
2744
- ],
2745
- "l"
2746
- ]
2747
- ],
2748
- [
2749
- 13,
2750
- "lightUV",
2751
- [
2752
- 7,
2753
- "lp",
2754
- "xy"
2755
- ]
2756
- ],
2757
- [
2758
- 13,
2759
- "toL",
2760
- [
2761
- 6,
2762
- [
2763
- 7,
2764
- "lightUV",
2765
- "sub"
2766
- ],
2767
- ["hitP"]
2768
- ]
2769
- ],
2770
- [
2771
- 13,
2772
- "dist",
2773
- [
2774
- 6,
2775
- "std.length",
2776
- ["toL"]
2777
- ]
2778
- ],
2779
- [
2780
- 13,
2781
- "dirL",
2782
- [
2783
- 6,
2784
- [
2785
- 7,
2786
- "toL",
2787
- "div"
2788
- ],
2789
- [[
2790
- 6,
2791
- "std.max",
2792
- ["dist", [5, "0.0001"]]
2793
- ]]
2794
- ]
2795
- ],
2796
- [
2797
- 13,
2798
- "facing",
2799
- [
2800
- 6,
2801
- "std.clamp",
2802
- [
2803
- [
2804
- 1,
2805
- [
2806
- 1,
2807
- [
2808
- 6,
2809
- "std.dot",
2810
- ["n", "dirL"]
2811
- ],
2812
- "+",
2813
- [
2814
- 7,
2815
- "p",
2816
- "wrap"
2817
- ]
2818
- ],
2819
- "/",
2820
- [
2821
- 1,
2822
- [5, "1"],
2823
- "+",
2824
- [
2825
- 7,
2826
- "p",
2827
- "wrap"
2828
- ]
2829
- ]
2830
- ],
2831
- [5, "0"],
2832
- [5, "1"]
2833
- ]
2834
- ]
2835
- ],
2836
- [
2837
- 11,
2838
- [
2839
- 1,
2840
- "facing",
2841
- ">",
2842
- [5, "0"]
2843
- ],
2844
- [0, [
2845
- [
2846
- 13,
2847
- "r",
2848
- [
2849
- 1,
2850
- "dist",
2851
- "/",
2852
- [
2853
- 7,
2854
- "p",
2855
- "lightRange"
2856
- ]
2857
- ]
2858
- ],
2859
- [
2860
- 12,
2861
- "struck",
2862
- [
2863
- 1,
2864
- "facing",
2865
- "/",
2866
- [
2867
- 1,
2868
- [5, "1"],
2869
- "+",
2870
- [
2871
- 1,
2872
- "r",
2873
- "*",
2874
- "r"
2875
- ]
2876
- ]
2877
- ]
2878
- ],
2879
- [
2880
- 11,
2881
- "shadows",
2882
- [0, [[
2883
- 2,
2884
- "struck",
2885
- "=",
2886
- [
2887
- 1,
2888
- "struck",
2889
- "*",
2890
- [
2891
- 6,
2892
- "visibility",
2893
- [
2894
- "shadowFrom",
2895
- "lightUV",
2896
- "eps",
2897
- [
2898
- 7,
2899
- "p",
2900
- "shadowSoftness"
2901
- ]
2902
- ]
2903
- ]
2904
- ]
2905
- ]]]
2906
- ],
2907
- [
2908
- 2,
2909
- "acc",
2910
- "=",
2911
- [
2912
- 6,
2913
- [
2914
- 7,
2915
- "acc",
2916
- "add"
2917
- ],
2918
- [[
2919
- 6,
2920
- [
2921
- 7,
2922
- [
2923
- 7,
2924
- "lc",
2925
- "xyz"
2926
- ],
2927
- "mul"
2928
- ],
2929
- [[
2930
- 1,
2931
- "struck",
2932
- "*",
2933
- [
2934
- 7,
2935
- "lc",
2936
- "w"
2937
- ]
2938
- ]]
2939
- ]]
2940
- ]
2941
- ]
2942
- ]]
2943
- ]
2944
- ]]
2945
- ]
2946
- ]]
2947
- ]
2948
- ]]
2949
- ],
2950
- [
2951
- 13,
2952
- "fade",
2953
- [
2954
- 1,
2955
- [5, "1"],
2956
- "-",
2957
- [
2958
- 6,
2959
- "std.smoothstep",
2960
- [
2961
- [
2962
- 1,
2963
- [
2964
- 7,
2965
- "p",
2966
- "reach"
2967
- ],
2968
- "*",
2969
- [5, "0.25"]
2970
- ],
2971
- [
2972
- 7,
2973
- "p",
2974
- "reach"
2975
- ],
2976
- [
2977
- 6,
2978
- "std.max",
2979
- ["d0", [5, "0"]]
2980
- ]
2981
- ]
2982
- ]
2983
- ]
2984
- ],
2985
- [
2986
- 13,
2987
- "m",
2988
- [
2989
- 6,
2990
- "std.clamp",
2991
- [
2992
- [
2993
- 1,
2994
- [
2995
- 1,
2996
- "d0",
2997
- "/",
2998
- "eps"
2999
- ],
3000
- "+",
3001
- [5, "1"]
3002
- ],
3003
- [5, "0"],
3004
- [5, "1"]
3005
- ]
3006
- ]
3007
- ],
3008
- [
3009
- 13,
3010
- "irr",
3011
- [
3012
- 6,
3013
- "std.min",
3014
- [[
3015
- 6,
3016
- "std.max",
3017
- [[
3018
- 6,
3019
- [
3020
- 7,
3021
- "acc",
3022
- "div"
3023
- ],
3024
- [[
3025
- 7,
3026
- "p",
3027
- "rays"
3028
- ]]
3029
- ], [
3030
- 6,
3031
- "d.vec3f",
3032
- [
3033
- [5, "0"],
3034
- [5, "0"],
3035
- [5, "0"]
3036
- ]
3037
- ]]
3038
- ], [
3039
- 6,
3040
- "d.vec3f",
3041
- [
3042
- "FAR",
3043
- "FAR",
3044
- "FAR"
3045
- ]
3046
- ]]
3047
- ]
3048
- ],
3049
- [
3050
- 6,
3051
- "std.textureStore",
3052
- [
3053
- [
3054
- 7,
3055
- [
3056
- 7,
3057
- "lay",
3058
- "$"
3059
- ],
3060
- "outTex"
3061
- ],
3062
- [
3063
- 6,
3064
- "d.vec2u",
3065
- ["cx", "cy"]
3066
- ],
3067
- [
3068
- 6,
3069
- "d.vec4f",
3070
- [[
3071
- 6,
3072
- [
3073
- 7,
3074
- "irr",
3075
- "mul"
3076
- ],
3077
- [[
3078
- 1,
3079
- "fade",
3080
- "*",
3081
- "m"
3082
- ]]
3083
- ], "m"]
3084
- ]
3085
- ]
3086
- ]
3087
- ]]
3088
- },
3089
- externals: {
3090
- "lay": () => lay,
3091
- "d.vec2f": () => vec2f,
3092
- "d.f32": () => f32,
3093
- "sdfSpaceUV": () => sdfSpaceUV,
3094
- "fieldAt": () => fieldAt,
3095
- "std.textureStore": () => textureStore,
3096
- "d.vec2u": () => vec2u,
3097
- "d.vec4f": () => vec4f,
3098
- "std.normalize": () => normalize$1,
3099
- "std.max": () => max$1,
3100
- "RAY_SPAN": () => RAY_SPAN,
3101
- "std.fract": () => fract,
3102
- "d.i32": () => i32,
3103
- "TAU": () => TAU,
3104
- "d.vec3f": () => vec3f,
3105
- "std.cos": () => cos,
3106
- "std.sin": () => sin,
3107
- "steps": () => steps,
3108
- "std.length": () => length,
3109
- "std.clamp": () => clamp,
3110
- "std.dot": () => dot$1,
3111
- "shadows": () => shadows,
3112
- "visibility": () => visibility,
3113
- "std.smoothstep": () => smoothstep$1,
3114
- "std.min": () => min,
3115
- "FAR": () => FAR
3116
- }
3117
- }) && $.f)({})).$name(`${namePrefix}Gather`);
3118
- }
3119
- function createIrradiancePass(root, kernel, opts) {
3120
- return createGuardedCompute(root, /* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((cx, cy) => {
3121
- "use gpu";
3122
- kernel(cx, cy);
3123
- }), {
3124
- v: 2,
3125
- name: void 0,
3126
- ast: {
3127
- "params": [{
3128
- "type": "i",
3129
- "name": "cx"
3130
- }, {
3131
- "type": "i",
3132
- "name": "cy"
3133
- }],
3134
- "body": [0, [[
3135
- 6,
3136
- "kernel",
3137
- ["cx", "cy"]
3138
- ]]]
3139
- },
3140
- externals: { "kernel": () => kernel }
3141
- }) && $.f)({}), {
3142
- size: [opts.res, opts.res],
3143
- bindGroup: opts.bindGroup
3144
- });
3145
- }
3146
- const AccumulateParams = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(struct({ weight: f32 }), "AccumulateParams");
3147
- const accumulateLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
3148
- sample: { texture: texture2d(f32) },
3149
- prev: { texture: texture2d(f32) },
3150
- out: outEntry,
3151
- params: { uniform: AccumulateParams }
3152
- }), "accumulateLayout");
3153
- const accumulateKernel = typegpu_default.fn([u32, u32])(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((cx, cy) => {
3154
- "use gpu";
3155
- const at = vec2u(cx, cy);
3156
- const s = textureLoad(accumulateLayout.$.sample, at, 0);
3157
- const prev = textureLoad(accumulateLayout.$.prev, at, 0);
3158
- const w = accumulateLayout.$.params.weight;
3159
- textureStore(accumulateLayout.$.out, at, select(prev.add(s.sub(prev).mul(w)), s, w >= 1));
3160
- }), {
3161
- v: 2,
3162
- name: void 0,
3163
- ast: {
3164
- "params": [{
3165
- "type": "i",
3166
- "name": "cx"
3167
- }, {
3168
- "type": "i",
3169
- "name": "cy"
3170
- }],
3171
- "body": [0, [
3172
- [
3173
- 13,
3174
- "at",
3175
- [
3176
- 6,
3177
- "d.vec2u",
3178
- ["cx", "cy"]
3179
- ]
3180
- ],
3181
- [
3182
- 13,
3183
- "s",
3184
- [
3185
- 6,
3186
- "std.textureLoad",
3187
- [
3188
- [
3189
- 7,
3190
- [
3191
- 7,
3192
- "accumulateLayout",
3193
- "$"
3194
- ],
3195
- "sample"
3196
- ],
3197
- "at",
3198
- [5, "0"]
3199
- ]
3200
- ]
3201
- ],
3202
- [
3203
- 13,
3204
- "prev",
3205
- [
3206
- 6,
3207
- "std.textureLoad",
3208
- [
3209
- [
3210
- 7,
3211
- [
3212
- 7,
3213
- "accumulateLayout",
3214
- "$"
3215
- ],
3216
- "prev"
3217
- ],
3218
- "at",
3219
- [5, "0"]
3220
- ]
3221
- ]
3222
- ],
3223
- [
3224
- 13,
3225
- "w",
3226
- [
3227
- 7,
3228
- [
3229
- 7,
3230
- [
3231
- 7,
3232
- "accumulateLayout",
3233
- "$"
3234
- ],
3235
- "params"
3236
- ],
3237
- "weight"
3238
- ]
3239
- ],
3240
- [
3241
- 6,
3242
- "std.textureStore",
3243
- [
3244
- [
3245
- 7,
3246
- [
3247
- 7,
3248
- "accumulateLayout",
3249
- "$"
3250
- ],
3251
- "out"
3252
- ],
3253
- "at",
3254
- [
3255
- 6,
3256
- "std.select",
3257
- [
3258
- [
3259
- 6,
3260
- [
3261
- 7,
3262
- "prev",
3263
- "add"
3264
- ],
3265
- [[
3266
- 6,
3267
- [
3268
- 7,
3269
- [
3270
- 6,
3271
- [
3272
- 7,
3273
- "s",
3274
- "sub"
3275
- ],
3276
- ["prev"]
3277
- ],
3278
- "mul"
3279
- ],
3280
- ["w"]
3281
- ]]
3282
- ],
3283
- "s",
3284
- [
3285
- 1,
3286
- "w",
3287
- ">=",
3288
- [5, "1"]
3289
- ]
3290
- ]
3291
- ]
3292
- ]
3293
- ]
3294
- ]]
3295
- },
3296
- externals: {
3297
- "d.vec2u": () => vec2u,
3298
- "std.textureLoad": () => textureLoad,
3299
- "accumulateLayout": () => accumulateLayout,
3300
- "std.textureStore": () => textureStore,
3301
- "std.select": () => select
3302
- }
3303
- }) && $.f)({})).$name("irradianceAccumulate");
3304
- const copyLayout = /* @__PURE__ */ (globalThis.__TYPEGPU_AUTONAME__ ?? ((a) => a))(typegpu_default.bindGroupLayout({
3305
- src: { texture: texture2d(f32) },
3306
- out: outEntry
3307
- }), "copyLayout");
3308
- const copyKernel = typegpu_default.fn([u32, u32])(/* @__PURE__ */ (($) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set($.f = ((cx, cy) => {
3309
- "use gpu";
3310
- const at = vec2u(cx, cy);
3311
- textureStore(copyLayout.$.out, at, textureLoad(copyLayout.$.src, at, 0));
3312
- }), {
3313
- v: 2,
3314
- name: void 0,
3315
- ast: {
3316
- "params": [{
3317
- "type": "i",
3318
- "name": "cx"
3319
- }, {
3320
- "type": "i",
3321
- "name": "cy"
3322
- }],
3323
- "body": [0, [[
3324
- 13,
3325
- "at",
3326
- [
3327
- 6,
3328
- "d.vec2u",
3329
- ["cx", "cy"]
3330
- ]
3331
- ], [
3332
- 6,
3333
- "std.textureStore",
3334
- [
3335
- [
3336
- 7,
3337
- [
3338
- 7,
3339
- "copyLayout",
3340
- "$"
3341
- ],
3342
- "out"
3343
- ],
3344
- "at",
3345
- [
3346
- 6,
3347
- "std.textureLoad",
3348
- [
3349
- [
3350
- 7,
3351
- [
3352
- 7,
3353
- "copyLayout",
3354
- "$"
3355
- ],
3356
- "src"
3357
- ],
3358
- "at",
3359
- [5, "0"]
3360
- ]
3361
- ]
3362
- ]
3363
- ]]]
3364
- },
3365
- externals: {
3366
- "d.vec2u": () => vec2u,
3367
- "std.textureStore": () => textureStore,
3368
- "copyLayout": () => copyLayout,
3369
- "std.textureLoad": () => textureLoad
3370
- }
3371
- }) && $.f)({})).$name("irradianceCopy");
3372
- var radianceCounter = 0;
3373
- var raw$1 = (name) => new Expr(() => name);
3374
- var num = (v, ctx) => typeof v === "number" ? formatFloat(v) : v._emit(ctx);
3375
- function scopedInto(ctx, into) {
3376
- return {
3377
- external: (v, h) => ctx.external(v, h),
3378
- statement: (w) => into.push(w),
3379
- freshLocal: (h) => ctx.freshLocal(h),
3380
- memo: (k, f) => ctx.memo(k, f)
3381
- };
3382
- }
3383
- function shadowVisibility(spec) {
3384
- const id = radianceCounter++;
3385
- const hint = spec.hint ?? "visibility";
3386
- return new Expr((ctx) => ctx.memo(`shadow:${id}`, () => {
3387
- const vis = ctx.freshLocal(hint);
3388
- const from = ctx.freshLocal("shFrom");
3389
- const seg = ctx.freshLocal("shSeg");
3390
- const len = ctx.freshLocal("shLen");
3391
- const dir = ctx.freshLocal("shDir");
3392
- const eps = ctx.freshLocal("shEps");
3393
- const soft = ctx.freshLocal("shSoft");
3394
- const t = ctx.freshLocal("shT");
3395
- const pos = ctx.freshLocal("shPos");
3396
- const dd = ctx.freshLocal("shD");
3397
- const k = ctx.freshLocal("shStep");
3398
- ctx.statement(`let ${from} = ${spec.from._emit(ctx)};`);
3399
- ctx.statement(`let ${seg} = ${spec.toward._emit(ctx)} - ${from};`);
3400
- ctx.statement(`let ${len} = length(${seg});`);
3401
- ctx.statement(`let ${dir} = ${seg} / max(${len}, 0.0001);`);
3402
- ctx.statement(`let ${eps} = ${num(spec.surfaceEps, ctx)};`);
3403
- ctx.statement(`let ${soft} = ${num(spec.softness ?? 0, ctx)};`);
3404
- ctx.statement(`var ${vis} = 1.0;`);
3405
- const marchStmts = [];
3406
- const fieldAtPos = spec.field(raw$1(pos))._emit(scopedInto(ctx, marchStmts));
3407
- ctx.statement([
3408
- `{`,
3409
- ` var ${t} = ${eps} * 2.0;`,
3410
- ` for (var ${k} = 0u; ${k} < ${spec.steps}u; ${k}++) {`,
3411
- ` if (${t} >= ${len}) { break; }`,
3412
- ` let ${pos} = ${from} + ${dir} * ${t};`,
3413
- ...marchStmts.map((w) => ` ${w}`),
3414
- ` let ${dd} = ${fieldAtPos};`,
3415
- ` ${vis} = min(${vis}, clamp(${dd} / max(${t} * ${soft}, ${eps}), 0.0, 1.0));`,
3416
- ` if (${vis} <= 0.0) { break; }`,
3417
- ` ${t} += max(${dd}, ${eps});`,
3418
- ` }`,
3419
- `}`
3420
- ].join("\n"));
3421
- return vis;
3422
- }));
3423
- }
3424
- var DENOISE_RADIUS = 3;
3425
- var DENOISE_HALF_KERNEL = 6;
3426
- var WARMUP_FRAMES = 3;
3427
- var { createSdfDataTexture, analyticSubPropValues, parseShapeConfigValue } = sdf_exports;
3428
- var { createVolumetricFieldComputeNode } = sdf3d_exports;
3429
- function toPlacement(center, scale, rotationDeg, aspect, stored) {
3430
- const dxAc = (stored.x - center.x) * aspect;
3431
- const dy = 1 - stored.y - (1 - center.y);
3432
- const r = rotationDeg * Math.PI / 180;
3433
- const c = Math.cos(r);
3434
- const s = Math.sin(r);
3435
- const sc = Math.max(scale, .001);
3436
- return {
3437
- x: (dxAc * c + dy * s) / sc + .5,
3438
- y: (dy * c - dxAc * s) / sc + .5
3439
- };
3440
- }
3441
- function lightLanes(items, fields, placement) {
3442
- const list = (Array.isArray(items) ? items : []).slice(0, 8);
3443
- const pos = [];
3444
- const color = [];
3445
- for (let i = 0; i < 8; i++) {
3446
- const item = list[i];
3447
- const stored = item?.[fields.position] ?? {
3448
- x: .5,
3449
- y: .5
3450
- };
3451
- const p = toPlacement(placement.center, placement.scale, placement.rotation, placement.aspect, stored);
3452
- const c = item?.[fields.color] ?? [
3453
- 1,
3454
- 1,
3455
- 1,
3456
- 1
3457
- ];
3458
- const intensity = typeof item?.[fields.intensity] === "number" ? item[fields.intensity] : 0;
3459
- pos.push(item ? [
3460
- p.x,
3461
- p.y,
3462
- 0,
3463
- 0
3464
- ] : [
3465
- 0,
3466
- 0,
3467
- 0,
3468
- 0
3469
- ]);
3470
- color.push(item ? [
3471
- c[0],
3472
- c[1],
3473
- c[2],
3474
- intensity
3475
- ] : [
3476
- 0,
3477
- 0,
3478
- 0,
3479
- 0
3480
- ]);
3481
- }
3482
- return {
3483
- pos,
3484
- color,
3485
- count: list.length
3486
- };
3487
- }
3488
- function irradianceField(spec) {
3489
- const outputKey = spec.outputKey ?? "irradianceTexture";
3490
- const namePrefix = spec.namePrefix ?? "irradiance";
3491
- const kernelOpts = {
3492
- steps: spec.steps ?? 32,
3493
- shadowSteps: spec.shadowSteps ?? 12,
3494
- namePrefix
3495
- };
3496
- const res = spec.resolution;
3497
- const compute = (params) => {
3498
- const { gpu, getCpuValue, registerComputeTexture, onCleanup, onResize } = params;
3499
- const root = gpu?.root;
3500
- if (!root) return null;
3501
- const shapeSdfUrl = getCpuValue("shapeSdfUrl") || "";
3502
- const shapeType = resolveShapeType(getCpuValue("shapeType") || "", getCpuValue("shape"));
3503
- const vf = createVolumetricFieldComputeNode(params, () => getCpuValue("shape"), "none", "span");
3504
- const mkTex = () => {
3505
- const t = root.createTexture({
3506
- size: [res, res],
3507
- format: IRRADIANCE_FORMAT
3508
- }).$usage("storage", "sampled");
3509
- onCleanup(() => t.destroy());
3510
- return t;
3511
- };
3512
- const outTex = mkTex();
3513
- const meanTex = mkTex();
3514
- const prevTex = mkTex();
3515
- const denoise = createGaussianBlurCompute(root, meanTex, res, res, onCleanup, DENOISE_HALF_KERNEL, res, res);
3516
- denoise.updateRadius(DENOISE_RADIUS);
3517
- const outputTexture = registerComputeTexture(denoise.outputTexture);
3518
- const paramsU = root.createUniform(IrradianceParams);
3519
- const accumU = root.createUniform(AccumulateParams);
3520
- const accumulate$1 = createIrradiancePass(root, accumulateKernel, {
3521
- res,
3522
- bindGroup: root.createBindGroup(accumulateLayout, {
3523
- sample: outTex,
3524
- prev: prevTex,
3525
- out: meanTex,
3526
- params: accumU.buffer
3527
- })
3528
- });
3529
- const keepMean = createIrradiancePass(root, copyKernel, {
3530
- res,
3531
- bindGroup: root.createBindGroup(copyLayout, {
3532
- src: meanTex,
3533
- out: prevTex
3534
- })
3535
- });
3536
- let pass;
3537
- let fieldVersion = () => 0;
3538
- let silhouette$1 = null;
3539
- if (vf) {
3540
- const jfaA = mkTex();
3541
- const jfaB = mkTex();
3542
- const silU = root.createUniform(SilhouetteParams);
3543
- const seedPass = createIrradiancePass(root, silhouetteSeedKernel, {
3544
- res,
3545
- bindGroup: root.createBindGroup(silhouetteSeedLayout, {
3546
- params: silU.buffer,
3547
- fieldTex: vf.fieldTexture,
3548
- out: jfaA
3549
- })
3550
- });
3551
- const stepAB = createIrradiancePass(root, silhouetteStepKernel, {
3552
- res,
3553
- bindGroup: root.createBindGroup(silhouetteStepLayout, {
3554
- params: silU.buffer,
3555
- src: jfaA,
3556
- out: jfaB
3557
- })
3558
- });
3559
- const stepBA = createIrradiancePass(root, silhouetteStepKernel, {
3560
- res,
3561
- bindGroup: root.createBindGroup(silhouetteStepLayout, {
3562
- params: silU.buffer,
3563
- src: jfaB,
3564
- out: jfaA
3565
- })
3566
- });
3567
- const jumps = [];
3568
- for (let step = Math.ceil(res / 2); step >= 1; step = Math.floor(step / 2)) {
3569
- jumps.push(step);
3570
- if (step === 1) break;
3571
- }
3572
- const finalTex = jumps.length % 2 === 1 ? jfaB : jfaA;
3573
- silhouette$1 = { steps: (domain) => {
3574
- const nodes = [];
3575
- const base = {
3576
- vfOriginX: domain.originX,
3577
- vfOriginY: domain.originY,
3578
- vfSpanX: domain.spanX,
3579
- vfSpanY: domain.spanY,
3580
- vfActiveRes: domain.activeRes,
3581
- vfRBound: domain.rBound,
3582
- res
3583
- };
3584
- nodes.push(() => silU.write({
3585
- ...base,
3586
- step: 0
3587
- }), seedPass);
3588
- jumps.forEach((step, i) => {
3589
- nodes.push(() => silU.write({
3590
- ...base,
3591
- step
3592
- }), i % 2 === 0 ? stepAB : stepBA);
3593
- });
3594
- return nodes;
3595
- } };
3596
- const samp = root.createSampler({
3597
- magFilter: "linear",
3598
- minFilter: "linear",
3599
- addressModeU: "clamp-to-edge",
3600
- addressModeV: "clamp-to-edge"
3601
- });
3602
- pass = createIrradiancePass(root, buildIrradianceKernel(irradianceFieldLayout, volumetricField, kernelOpts), {
3603
- res,
3604
- bindGroup: root.createBindGroup(irradianceFieldLayout, {
3605
- params: paramsU.buffer,
3606
- outTex,
3607
- silhouetteTex: finalTex,
3608
- samp
3609
- })
3610
- });
3611
- } else if (shapeSdfUrl) {
3612
- const sdfTex = createSdfDataTexture(params, shapeSdfUrl);
3613
- fieldVersion = () => sdfTex.getVersion();
3614
- const samp = root.createSampler({
3615
- magFilter: "linear",
3616
- minFilter: "linear",
3617
- addressModeU: "clamp-to-edge",
3618
- addressModeV: "clamp-to-edge"
3619
- });
3620
- pass = createIrradiancePass(root, buildIrradianceKernel(irradianceSvgLayout, svgField, kernelOpts), {
3621
- res,
3622
- bindGroup: root.createBindGroup(irradianceSvgLayout, {
3623
- params: paramsU.buffer,
3624
- outTex,
3625
- sdfSource: sdfTex.texture.texture,
3626
- samp
3627
- })
3628
- });
3629
- } else pass = createIrradiancePass(root, buildIrradianceKernel(irradianceAnalyticLayout, analyticField(shapeType), kernelOpts), {
3630
- res,
3631
- bindGroup: root.createBindGroup(irradianceAnalyticLayout, {
3632
- params: paramsU.buffer,
3633
- outTex
3634
- })
3635
- });
3636
- let width = Math.max(1, params.dimensions.width);
3637
- let height = Math.max(1, params.dimensions.height);
3638
- onResize(({ width: w, height: h }) => {
3639
- width = Math.max(1, w);
3640
- height = Math.max(1, h);
3641
- });
3642
- const num$1 = (key, fallback) => {
3643
- const v = getCpuValue(key);
3644
- return typeof v === "number" ? v : fallback;
3645
- };
3646
- const pos = (key) => {
3647
- const v = getCpuValue(key);
3648
- return {
3649
- x: typeof v?.x === "number" ? v.x : .5,
3650
- y: typeof v?.y === "number" ? v.y : .5
3651
- };
3652
- };
3653
- let lastKey = "";
3654
- let silhouetteReady = false;
3655
- let frame = 0;
3656
- let warmup = WARMUP_FRAMES;
3657
- let samples = 0;
3658
- let changedLastFrame = false;
3659
- return {
3660
- outputs: {
3661
- [outputKey]: outputTexture,
3662
- ...vf?.outputs ?? {}
3663
- },
3664
- getComputeNodes: (frameParams) => {
3665
- const pre = vf?.getComputeNodes(frameParams) ?? null;
3666
- let silhouettePasses = [];
3667
- if (silhouette$1 && (pre || !silhouetteReady)) {
3668
- const dom$1 = vf.getFieldDomain();
3669
- silhouettePasses = silhouette$1.steps(dom$1);
3670
- silhouetteReady = true;
3671
- }
3672
- const center = pos("center");
3673
- const scale = num$1("scale", 1);
3674
- const rotation = num$1("rotation", 0);
3675
- const lights = lightLanes(getCpuValue(spec.lights.prop), spec.lights, {
3676
- center,
3677
- scale,
3678
- rotation,
3679
- aspect: width / height
3680
- });
3681
- const sub$1 = analyticSubPropValues(parseShapeConfigValue(getCpuValue("shape")));
3682
- const dom = vf?.getFieldDomain();
3683
- const values = {
3684
- center: [center.x, center.y],
3685
- lightPos: lights.pos,
3686
- lightColor: lights.color,
3687
- lightCount: lights.count,
3688
- scale,
3689
- rotation,
3690
- aspect: width / height,
3691
- reach: num$1(spec.reach, 3),
3692
- wrap: num$1(spec.wrap, 0),
3693
- lightRange: num$1(spec.lightRange, 1),
3694
- shadowSoftness: num$1(spec.shadowSoftness, 0),
3695
- eps: 1 / res / Math.max(scale, .001),
3696
- res,
3697
- saRadius: sub$1.radius,
3698
- saSides: sub$1.sides,
3699
- saRounding: sub$1.rounding,
3700
- saInnerRatio: sub$1.innerRatio,
3701
- saRotation: sub$1.rotation,
3702
- saHeight: sub$1.height,
3703
- saOffset: sub$1.offset,
3704
- saAperture: sub$1.aperture,
3705
- vfOriginX: dom?.originX ?? 0,
3706
- vfOriginY: dom?.originY ?? 0,
3707
- vfSpanX: dom?.spanX ?? 1,
3708
- vfSpanY: dom?.spanY ?? 1,
3709
- vfActiveRes: dom?.activeRes ?? 1,
3710
- vfRBound: dom?.rBound ?? .6,
3711
- fieldVersion: fieldVersion()
3712
- };
3713
- const key = JSON.stringify(values);
3714
- const warming = warmup > 0;
3715
- if (warming) warmup--;
3716
- const changed = key !== lastKey || Boolean(pre) || silhouettePasses.length > 0 || warming;
3717
- let rays;
3718
- if (changed) {
3719
- lastKey = key;
3720
- frame = 0;
3721
- samples = 0;
3722
- rays = changedLastFrame ? spec.rays.motion : spec.rays.burst;
3723
- } else if (frame > spec.rays.refineFrames) {
3724
- changedLastFrame = false;
3725
- return null;
3726
- } else rays = spec.rays.refine;
3727
- changedLastFrame = changed;
3728
- const sampleIndex = frame++;
3729
- const weight = rays / (samples + rays);
3730
- samples += rays;
3731
- const nodes = pre ? [...pre, ...silhouettePasses] : [...silhouettePasses];
3732
- nodes.push(() => {
3733
- const { fieldVersion: _version,...abi } = values;
3734
- paramsU.write({
3735
- ...abi,
3736
- frame: sampleIndex,
3737
- rays,
3738
- center: vec2f(values.center[0], values.center[1]),
3739
- lightPos: values.lightPos.map((l) => vec4f(l[0], l[1], l[2], l[3])),
3740
- lightColor: values.lightColor.map((l) => vec4f(l[0], l[1], l[2], l[3]))
3741
- });
3742
- accumU.write({ weight });
3743
- });
3744
- nodes.push(pass, accumulate$1, keepMean, ...denoise.computeSteps);
3745
- return nodes;
3746
- }
3747
- };
3748
- };
3749
- const sample = (params) => {
3750
- const tex = params.computeOutputs?.[outputKey];
3751
- if (!tex) return void 0;
3752
- const s = local(tex.sampleLevel(params.ctx.uv), "irrTex");
3753
- return div(s.member("rgb"), max(s.member("a"), .001));
3754
- };
3755
- return {
3756
- compute,
3757
- sample
3758
- };
3759
- }
3760
- var listCounter = 0;
3761
- var raw = (name) => new Expr(() => name);
3762
- function listOf(params, prop) {
3763
- const lane = (field, i) => {
3764
- const arr = params.uniforms[listFieldName(prop, field)];
3765
- if (!arr) throw new Error(`std: list '${prop}' has no field '${field}'`);
3766
- return new Expr((ctx) => `${arr._emit(ctx)}[${i._emit(ctx)}]`);
3767
- };
3768
- const count = params.uniforms[listCountName(prop)];
3769
- if (!count) throw new Error(`std: '${prop}' is not a list prop`);
3770
- return {
3771
- count,
3772
- at: (i) => ({
3773
- position: (field) => lane(field, i).member("xy"),
3774
- color: (field) => lane(field, i),
3775
- number: (field) => lane(field, i).member("x")
3776
- })
3777
- };
3778
- }
3779
- function accumulate(list, body, opts = {}) {
3780
- const id = listCounter++;
3781
- const zero = opts.zero === "vec3f" ? "vec3f(0.0)" : "0.0";
3782
- const hint = opts.hint ?? "sum";
3783
- return new Expr((ctx) => ctx.memo(`accumulate:${id}`, () => {
3784
- for (const dep of opts.deps ?? []) dep._emit(ctx);
3785
- const acc = ctx.freshLocal(hint);
3786
- const i = ctx.freshLocal("item");
3787
- const countText = list.count._emit(ctx);
3788
- const stmts = [];
3789
- const term = body(raw(i))._emit({
3790
- external: (v, h) => ctx.external(v, h),
3791
- statement: (w) => stmts.push(w),
3792
- freshLocal: (h) => ctx.freshLocal(h),
3793
- memo: (k, f) => ctx.memo(k, f)
3794
- });
3795
- ctx.statement(`var ${acc} = ${zero};`);
3796
- ctx.statement([
3797
- `for (var ${i} = 0u; ${i} < u32(${countText}); ${i}++) {`,
3798
- ...stmts.map((w) => ` ${w}`),
3799
- ` ${acc} += ${term};`,
3800
- `}`
3801
- ].join("\n"));
3802
- return acc;
3803
- }));
3804
- }
3805
- var DEFAULT_SHAPE_CONFIG = JSON.stringify({
3806
- type: "circleSDF",
3807
- radius: .35
3808
- });
3809
- var DEFAULT_LIGHTS = [{
3810
- position: {
3811
- x: .3,
3812
- y: .3
3813
- },
3814
- color: "#ffb347",
3815
- intensity: 3
3816
- }, {
3817
- position: {
3818
- x: .72,
3819
- y: .7
3820
- },
3821
- color: "#7a5cff",
3822
- intensity: 2
3823
- }];
3824
- var MAX_LIGHTS = 6;
3825
- var RAYS = {
3826
- burst: 128,
3827
- motion: 64,
3828
- refine: 32,
3829
- refineFrames: 12
3830
- };
3831
- var MOBILE_RAY_DIVISOR = 2;
3832
- var MARCH_STEPS = 32;
3833
- var SHADOW_STEPS = 12;
3834
- var FIELD_RES = 512;
3835
- var FIELD_RES_MOBILE = 320;
3836
- var CORE_WIDTH_PX = 2.5;
3837
- var STENCIL_EPS = .01;
3838
- var BODY_AMBIENT = .3;
3839
- var GLINT_EXPONENT = 60;
3840
- var GLINT_GAIN = .6;
3841
- function gatherSettings(propValues) {
3842
- const shadowsRaw = propValues.shadows;
3843
- const shadows = typeof shadowsRaw === "number" ? shadowsRaw > 0 : shadowsRaw !== false;
3844
- const mobile = isMobileGpuViewport();
3845
- const div$1 = mobile ? MOBILE_RAY_DIVISOR : 1;
3846
- return {
3847
- rays: {
3848
- burst: RAYS.burst / div$1,
3849
- motion: RAYS.motion / div$1,
3850
- refine: RAYS.refine / div$1,
3851
- refineFrames: RAYS.refineFrames
3852
- },
3853
- shadowSteps: shadows ? SHADOW_STEPS : 0,
3854
- resolution: mobile ? FIELD_RES_MOBILE : FIELD_RES
3855
- };
3856
- }
3857
- var GATHER_PROPS = {
3858
- lights: {
3859
- prop: "lights",
3860
- position: "position",
3861
- color: "color",
3862
- intensity: "intensity"
3863
- },
3864
- reach: "reach",
3865
- wrap: "wrap",
3866
- lightRange: "lightRange",
3867
- shadowSoftness: "shadowSoftness",
3868
- steps: MARCH_STEPS
3869
- };
3870
- var spine = shapedSurface({
3871
- stencil: "centre",
3872
- centreTap: "fast",
3873
- surface: (frame, params) => {
3874
- const { uniforms: u, propValues } = params;
3875
- const { shadowSteps } = gatherSettings(propValues);
3876
- const shadows = shadowSteps > 0;
3877
- const field = surfaceField(frame, params);
3878
- const stencilled = (hint) => ({
3879
- ...field,
3880
- s0: local(frame.sampler(frame.sdfUV), `${hint}S0`),
3881
- sX: local(frame.gradSampler(add(frame.sdfUV, vec2(STENCIL_EPS, 0))), `${hint}X`),
3882
- sY: local(frame.gradSampler(add(frame.sdfUV, vec2(0, STENCIL_EPS))), `${hint}Y`)
3883
- });
3884
- const px = local(div(field.pxH, max(u.scale, .001)), "pxUV");
3885
- const far = continuedField(frame, field, params);
3886
- const lights = listOf(params, "lights");
3887
- const lightAt = (i) => {
3888
- const item = lights.at(i);
3889
- return {
3890
- uv: placementPoint(params, item.position("position"), "lightUV"),
3891
- rgb: mul(item.color("color").member("rgb"), item.number("intensity"))
3892
- };
3893
- };
3894
- const irradiance = irradianceField({
3895
- ...gatherSettings(propValues),
3896
- ...GATHER_PROPS
3897
- }).sample(params) ?? splat3(0);
3898
- const rim = local(sub(1, smoothstep(0, mul(px, CORE_WIDTH_PX), far.sdf)), "rim");
3899
- const rimLight = () => {
3900
- const edge = nearestEdge(frame.sdfUV, far.sdf, add(fieldSlope(stencilled("rim"), STENCIL_EPS), far.outward));
3901
- return accumulate(lights, (i) => {
3902
- const light = lightAt(i);
3903
- const onEdge = pointLightFrom({
3904
- position: light.uv,
3905
- height: u.lightHeight
3906
- }, edge.point, "rimLight");
3907
- let struck = mul(lambert(edge.normal, onEdge.toLight, { wrap: u.wrap }), inverseSquare(onEdge.distance, u.lightRange));
3908
- if (shadows) struck = mul(struck, shadowVisibility({
3909
- from: add(edge.point, mul(edge.normal, mul(px, 2))),
3910
- toward: light.uv,
3911
- field: far.at,
3912
- steps: SHADOW_STEPS,
3913
- surfaceEps: px,
3914
- softness: u.shadowSoftness,
3915
- hint: "rimVisibility"
3916
- }));
3917
- return mul(light.rgb, struck);
3918
- }, {
3919
- zero: "vec3f",
3920
- hint: "rimSum",
3921
- deps: [edge.point, edge.normal]
3922
- });
3923
- };
3924
- const glow = emissiveAlpha(exposureTone(add(irradiance, guarded(gt(rim, 0), mul(rimLight(), mul(rim, u.core)), splat3(0), "emitter", [px]))), "glow");
3925
- const shadeBody = () => {
3926
- const n = geometricNormal(frame, stencilled("body"), {
3927
- bevelWidth: u.bevelWidth,
3928
- bevelShape: float(0),
3929
- eps: STENCIL_EPS
3930
- });
3931
- const lit = accumulate(lights, (i) => {
3932
- const light = lightAt(i);
3933
- const onBody = pointLightFrom({
3934
- position: light.uv,
3935
- height: u.lightHeight
3936
- }, frame.sdfUV, "bodyLight");
3937
- const bodyLit = local(mul(inverseSquare(onBody.distance, u.lightRange), u.bodyLight), "bodyLit");
3938
- const glint = mul(pow(max(dot(n, normalize(add(onBody.L, vec3(0, 0, -1)))), 0), GLINT_EXPONENT), GLINT_GAIN);
3939
- return add(mul(u.bodyColor.member("rgb"), mul(lambert(n, onBody.L), bodyLit)), mul(light.rgb, mul(glint, bodyLit)));
3940
- }, {
3941
- zero: "vec3f",
3942
- hint: "bodySum",
3943
- deps: [n]
3944
- });
3945
- return exposureTone(add(mul(u.bodyColor.member("rgb"), BODY_AMBIENT), lit));
3946
- };
3947
- const body = guarded(insideShape(field.sdf, px), shadeBody(), splat3(0), "body", []);
3948
- const cov = local(silhouette({
3949
- ...field,
3950
- pxH: px
3951
- }, u.edgeSoftness), "cov");
3952
- return vec4(mix(glow.member("rgb"), body, cov), mix(glow.member("a"), 1, cov));
3953
- }
3954
- });
3955
- const componentDefinition = defineStd({
3956
- name: "Irradiance",
3957
- role: "shapeEffect",
3958
- species: "custom",
3959
- boundingBoxDeclaration: shapeEffectBoundingBoxDeclaration,
3960
- category: "Shape Effects",
3961
- description: "Photorealistic light spilling around the edge of any 2D, SVG, or 3D shape — any number of movable colored point lights strike the silhouette and the lit edges irradiate their surroundings, gathered in a compute pass with real cast shadows, mixing where they meet and burning to white at the rim",
3962
- props: {
3963
- origin: {
3964
- default: "center",
3965
- description: "Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.",
3966
- ui: {
3967
- type: "origin",
3968
- label: "Origin",
3969
- group: "Position"
3970
- }
3971
- },
3972
- center: {
3973
- default: {
3974
- x: .5,
3975
- y: .5
3976
- },
3977
- transform: transformPosition,
3978
- description: "Center position of the shape",
3979
- ui: {
3980
- type: "position",
3981
- label: "Center",
3982
- group: "Position",
3983
- units: ["%", "px"]
3984
- }
3985
- },
3986
- scale: {
3987
- default: 1,
3988
- description: "Scale of the shape (1 = default size)",
3989
- ui: {
3990
- type: "range",
3991
- min: .1,
3992
- max: 3,
3993
- step: .01,
3994
- label: "Scale",
3995
- group: "Position"
3996
- }
3997
- },
3998
- rotation: {
3999
- default: 0,
4000
- description: "Rotation of the shape in degrees",
4001
- ui: {
4002
- type: "range",
4003
- min: 0,
4004
- max: 360,
4005
- step: 1,
4006
- label: "Rotation",
4007
- group: "Position"
4008
- }
4009
- },
4010
- lights: listPropConfig({
4011
- maxItems: MAX_LIGHTS,
4012
- minItems: 1,
4013
- itemLabel: "Light",
4014
- item: {
4015
- position: {
4016
- kind: "position",
4017
- default: {
4018
- x: .3,
4019
- y: .3
4020
- },
4021
- label: "Position",
4022
- description: "Where this light sits — the edges facing it are struck and spill light outward. Map it to the mouse to carry the light around the shape."
4023
- },
4024
- color: {
4025
- kind: "color",
4026
- default: "#ffb347",
4027
- label: "Color",
4028
- description: "The color this light casts"
4029
- },
4030
- intensity: {
4031
- kind: "number",
4032
- default: 3,
4033
- label: "Intensity",
4034
- min: 0,
4035
- max: 8,
4036
- step: .01,
4037
- description: "Brightness of this light — past ~2 the rim it strikes overexposes to white"
4038
- }
4039
- }
4040
- }, {
4041
- default: DEFAULT_LIGHTS,
4042
- description: "The point lights striking the shape — each with its own position, color and brightness",
4043
- label: "Lights",
4044
- group: "Lights"
4045
- }),
4046
- lightHeight: {
4047
- default: .5,
4048
- description: "Height of the lights above the shape plane, relative to the shape — low lights graze the body, high lights flood it evenly",
4049
- ui: {
4050
- type: ["range", "map"],
4051
- min: .05,
4052
- max: 3,
4053
- step: .01,
4054
- label: "Light Height",
4055
- group: "Light"
4056
- }
4057
- },
4058
- lightRange: {
4059
- default: 1.2,
4060
- description: "Reach of each light — the distance at which it has fallen to half strength, relative to the shape",
4061
- ui: {
4062
- type: ["range", "map"],
4063
- min: .1,
4064
- max: 4,
4065
- step: .01,
4066
- label: "Range",
4067
- group: "Light"
4068
- }
4069
- },
4070
- reach: {
4071
- default: 3,
4072
- description: "How far from the shape the spilled light is gathered, relative to the shape — the glow fades out toward this distance",
4073
- ui: {
4074
- type: ["range", "map"],
4075
- min: .5,
4076
- max: 8,
4077
- step: .01,
4078
- label: "Reach",
4079
- group: "Glow"
4080
- }
4081
- },
4082
- core: {
4083
- default: 1,
4084
- description: "The lit edge seen directly — the white-hot line along the rim where the lights strike",
4085
- ui: {
4086
- type: ["range", "map"],
4087
- min: 0,
4088
- max: 2,
4089
- step: .01,
4090
- label: "Core",
4091
- group: "Glow"
4092
- }
4093
- },
4094
- wrap: {
4095
- default: .1,
4096
- description: "How far light wraps around edges that face away from it — 0 leaves the far side dark",
4097
- ui: {
4098
- type: ["range", "map"],
4099
- min: 0,
4100
- max: 1,
4101
- step: .01,
4102
- label: "Wrap",
4103
- group: "Glow"
4104
- }
4105
- },
4106
- shadows: {
4107
- default: true,
4108
- compileTime: true,
4109
- transform: transformBoolean,
4110
- description: "Cast shadows — the body blocks each light from edges it stands in front of (keeps holes and concave pockets dark)",
4111
- ui: {
4112
- type: "checkbox",
4113
- label: "Shadows",
4114
- group: "Glow"
4115
- }
4116
- },
4117
- shadowSoftness: {
4118
- default: .15,
4119
- description: "Penumbra width of the cast shadows — 0 is razor sharp",
4120
- ui: {
4121
- type: ["range", "map"],
4122
- min: 0,
4123
- max: 1,
4124
- step: .01,
4125
- label: "Shadow Softness",
4126
- group: "Glow"
4127
- }
4128
- },
4129
- bodyColor: {
4130
- default: "#000000",
4131
- transform: transformColor,
4132
- description: "Color of the shape itself — black for a pure occluder, lighter to see the lights land on its form",
4133
- ui: {
4134
- type: "color",
4135
- label: "Body Color",
4136
- group: "Body"
4137
- }
4138
- },
4139
- bodyLight: {
4140
- default: .6,
4141
- description: "How much the lights illuminate the body — the bevel of a flat shape or the form of a 3D one",
4142
- ui: {
4143
- type: ["range", "map"],
4144
- min: 0,
4145
- max: 2,
4146
- step: .01,
4147
- label: "Body Light",
4148
- group: "Body"
4149
- }
4150
- },
4151
- bevelWidth: {
4152
- default: .01,
4153
- description: "Width of the rounded edge a flat shape catches the light on, relative to the shape",
4154
- ui: {
4155
- type: ["range", "map"],
4156
- min: .005,
4157
- max: .2,
4158
- step: .001,
4159
- label: "Bevel Width",
4160
- group: "Body"
4161
- }
4162
- },
4163
- ...glassShellProps({ edgeSoftness: { ui: { group: "Body" } } }),
4164
- shape: {
4165
- default: DEFAULT_SHAPE_CONFIG,
4166
- description: "Serialized shape configuration (JSON)",
4167
- ui: {
4168
- type: "shape",
4169
- label: "Shape",
4170
- group: "Shape"
4171
- }
4172
- },
4173
- shapeSdfUrl: {
4174
- default: "",
4175
- compileTime: true,
4176
- description: "URL to a pre-generated SDF .bin file"
4177
- },
4178
- shapeType: {
4179
- default: "",
4180
- compileTime: true,
4181
- description: "Active SDF shape type"
4182
- }
4183
- },
4184
- ...spine,
4185
- compute: (params) => irradianceField({
4186
- ...gatherSettings(params.propValues),
4187
- ...GATHER_PROPS
4188
- }).compute(params)
4189
- });
4190
- var Irradiance_default = componentDefinition;
4191
- export { componentDefinition as n, Irradiance_default as t };