@kolkrabbi/design-editor 0.1.0 → 0.2.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 (250) hide show
  1. package/README.md +3 -1
  2. package/dist/BufferResource-CKQMSOM4.js +265 -0
  3. package/dist/CanvasPool-ilDNHrRx.js +30 -0
  4. package/dist/CanvasRenderer-CDbc3nH9.js +3396 -0
  5. package/dist/Geometry-D3fkwmax.js +3724 -0
  6. package/dist/{OrbitControls-BAhLQ5d8.js → OrbitControls-CE3qSrHQ.js} +10260 -9043
  7. package/dist/RenderTargetSystem-umK0aqrs.js +2394 -0
  8. package/dist/WebGLRenderer-DVKPZbKc.js +2145 -0
  9. package/dist/WebGPURenderer-DHSBocAL.js +1656 -0
  10. package/dist/browserAll-CJ593myQ.js +983 -0
  11. package/dist/canvasUtils-CXoNqK7T.js +168 -0
  12. package/dist/defaultFilter.vert-C9efGgir.js +888 -0
  13. package/dist/design-editor.css +2 -2
  14. package/dist/design-editor.js +40809 -26749
  15. package/dist/getTextureBatchBindGroup-ChWkOJ3t.js +19 -0
  16. package/dist/{host-IfZgcJFg.js → host-6EhdLf5-.js} +506 -559
  17. package/dist/{host-Cidlc8xP.js → host-DPFYZP9I.js} +134 -88
  18. package/dist/init-4Y6mtayI.js +441 -0
  19. package/dist/phase-D3rwI6OO.js +1719 -0
  20. package/dist/pipeline-DfTD40M-.js +4825 -0
  21. package/dist/rolldown-runtime-B0aSnxlc.js +20 -0
  22. package/dist/src-zDOFeQWX.js +4314 -0
  23. package/dist/webworkerAll-wTH3MKcZ.js +2 -0
  24. package/package.json +26 -21
  25. package/dist/favicon/favicon.svg +0 -12
  26. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Black.woff2 +0 -0
  27. package/dist/fonts/Right-Grotesk/PPRightGrotesk-BlackItalic.woff2 +0 -0
  28. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Bold.woff2 +0 -0
  29. package/dist/fonts/Right-Grotesk/PPRightGrotesk-BoldItalic.woff2 +0 -0
  30. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBlack.woff2 +0 -0
  31. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBlackItalic.woff2 +0 -0
  32. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBold.woff2 +0 -0
  33. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBoldItalic.woff2 +0 -0
  34. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactDark.woff2 +0 -0
  35. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactDarkItalic.woff2 +0 -0
  36. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactFine.woff2 +0 -0
  37. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactFineItalic.woff2 +0 -0
  38. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactLight.woff2 +0 -0
  39. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactLightItalic.woff2 +0 -0
  40. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactMedium.woff2 +0 -0
  41. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactMediumItalic.woff2 +0 -0
  42. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactRegular.woff2 +0 -0
  43. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactRegularItalic.woff2 +0 -0
  44. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Dark.woff2 +0 -0
  45. package/dist/fonts/Right-Grotesk/PPRightGrotesk-DarkItalic.woff2 +0 -0
  46. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Fine.woff2 +0 -0
  47. package/dist/fonts/Right-Grotesk/PPRightGrotesk-FineItalic.woff2 +0 -0
  48. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Light.woff2 +0 -0
  49. package/dist/fonts/Right-Grotesk/PPRightGrotesk-LightItalic.woff2 +0 -0
  50. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Medium.woff2 +0 -0
  51. package/dist/fonts/Right-Grotesk/PPRightGrotesk-MediumItalic.woff2 +0 -0
  52. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBlack.woff2 +0 -0
  53. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBlackItalic.woff2 +0 -0
  54. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBold.woff2 +0 -0
  55. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBoldItalic.woff2 +0 -0
  56. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowDark.woff2 +0 -0
  57. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowDarkItalic.woff2 +0 -0
  58. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowFine.woff2 +0 -0
  59. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowFineItalic.woff2 +0 -0
  60. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowLight.woff2 +0 -0
  61. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowLightItalic.woff2 +0 -0
  62. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowMedium.woff2 +0 -0
  63. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowMediumItalic.woff2 +0 -0
  64. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowRegular.woff2 +0 -0
  65. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowRegularItalic.woff2 +0 -0
  66. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Regular.woff2 +0 -0
  67. package/dist/fonts/Right-Grotesk/PPRightGrotesk-RegularItalic.woff2 +0 -0
  68. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBlack.woff2 +0 -0
  69. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBlackItalic.woff2 +0 -0
  70. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBold.woff2 +0 -0
  71. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBoldItalic.woff2 +0 -0
  72. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialDark.woff2 +0 -0
  73. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialDarkItalic.woff2 +0 -0
  74. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialFine.woff2 +0 -0
  75. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialFineItalic.woff2 +0 -0
  76. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialLight.woff2 +0 -0
  77. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialLightItalic.woff2 +0 -0
  78. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialMedium.woff2 +0 -0
  79. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialMediumItalic.woff2 +0 -0
  80. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialRegular.woff2 +0 -0
  81. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialRegularItalic.woff2 +0 -0
  82. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBlack.woff2 +0 -0
  83. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBlackItalic.woff2 +0 -0
  84. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBold.woff2 +0 -0
  85. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBoldItalic.woff2 +0 -0
  86. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallDark.woff2 +0 -0
  87. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallDarkItalic.woff2 +0 -0
  88. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallFine.woff2 +0 -0
  89. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallFineItalic.woff2 +0 -0
  90. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallLight.woff2 +0 -0
  91. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallLightItalic.woff2 +0 -0
  92. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallMedium.woff2 +0 -0
  93. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallMediumItalic.woff2 +0 -0
  94. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallRegular.woff2 +0 -0
  95. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallRegularItalic.woff2 +0 -0
  96. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBlack.woff2 +0 -0
  97. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBlackItalic.woff2 +0 -0
  98. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBold.woff2 +0 -0
  99. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBoldItalic.woff2 +0 -0
  100. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightDark.woff2 +0 -0
  101. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightDarkItalic.woff2 +0 -0
  102. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightFine.woff2 +0 -0
  103. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightFineItalic.woff2 +0 -0
  104. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightLight.woff2 +0 -0
  105. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightLightItalic.woff2 +0 -0
  106. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightMedium.woff2 +0 -0
  107. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightMediumItalic.woff2 +0 -0
  108. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightRegular.woff2 +0 -0
  109. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightRegularItalic.woff2 +0 -0
  110. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBlack.woff2 +0 -0
  111. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBlackItalic.woff2 +0 -0
  112. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBold.woff2 +0 -0
  113. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBoldItalic.woff2 +0 -0
  114. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideDark.woff2 +0 -0
  115. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideDarkItalic.woff2 +0 -0
  116. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideFine.woff2 +0 -0
  117. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideFineItalic.woff2 +0 -0
  118. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideLight.woff2 +0 -0
  119. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideLightItalic.woff2 +0 -0
  120. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideMedium.woff2 +0 -0
  121. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideMediumItalic.woff2 +0 -0
  122. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideRegular.woff2 +0 -0
  123. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideRegularItalic.woff2 +0 -0
  124. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Bold.woff2 +0 -0
  125. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-BoldItalic.woff2 +0 -0
  126. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Dark.woff2 +0 -0
  127. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Fine.woff2 +0 -0
  128. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-FineItalic.woff2 +0 -0
  129. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Light.woff2 +0 -0
  130. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Medium.woff2 +0 -0
  131. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Regular.woff2 +0 -0
  132. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-RegularItalic.woff2 +0 -0
  133. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactLight.woff2 +0 -0
  134. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactLightItalic.woff2 +0 -0
  135. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactMedium.woff2 +0 -0
  136. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactMediumItalic.woff2 +0 -0
  137. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-Regular.woff2 +0 -0
  138. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-RegularItalic.woff2 +0 -0
  139. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialBold.woff2 +0 -0
  140. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialBoldItalic.woff2 +0 -0
  141. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialLight.woff2 +0 -0
  142. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialLightItalic.woff2 +0 -0
  143. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-WideBold.woff2 +0 -0
  144. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-WideBoldItalic.woff2 +0 -0
  145. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Black.ttf +0 -0
  146. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-BlackItalic.ttf +0 -0
  147. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Bold.ttf +0 -0
  148. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-BoldItalic.ttf +0 -0
  149. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBlack.ttf +0 -0
  150. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBlackItalic.ttf +0 -0
  151. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBold.ttf +0 -0
  152. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBoldItalic.ttf +0 -0
  153. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactDark.ttf +0 -0
  154. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactDarkItalic.ttf +0 -0
  155. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactFine.ttf +0 -0
  156. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactFineItalic.ttf +0 -0
  157. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactLight.ttf +0 -0
  158. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactLightItalic.ttf +0 -0
  159. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactMedium.ttf +0 -0
  160. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactMediumItalic.ttf +0 -0
  161. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactRegular.ttf +0 -0
  162. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactRegularItalic.ttf +0 -0
  163. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Dark.ttf +0 -0
  164. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-DarkItalic.ttf +0 -0
  165. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Fine.ttf +0 -0
  166. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-FineItalic.ttf +0 -0
  167. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Light.ttf +0 -0
  168. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-LightItalic.ttf +0 -0
  169. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Medium.ttf +0 -0
  170. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-MediumItalic.ttf +0 -0
  171. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBlack.ttf +0 -0
  172. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBlackItalic.ttf +0 -0
  173. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBold.ttf +0 -0
  174. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBoldItalic.ttf +0 -0
  175. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowDark.ttf +0 -0
  176. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowDarkItalic.ttf +0 -0
  177. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowFine.ttf +0 -0
  178. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowFineItalic.ttf +0 -0
  179. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowLight.ttf +0 -0
  180. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowLightItalic.ttf +0 -0
  181. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowMedium.ttf +0 -0
  182. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowMediumItalic.ttf +0 -0
  183. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowRegular.ttf +0 -0
  184. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowRegularItalic.ttf +0 -0
  185. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Regular.ttf +0 -0
  186. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-RegularItalic.ttf +0 -0
  187. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBlack.ttf +0 -0
  188. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBlackItalic.ttf +0 -0
  189. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBold.ttf +0 -0
  190. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBoldItalic.ttf +0 -0
  191. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialDark.ttf +0 -0
  192. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialDarkItalic.ttf +0 -0
  193. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialFine.ttf +0 -0
  194. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialFineItalic.ttf +0 -0
  195. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialLight.ttf +0 -0
  196. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialLightItalic.ttf +0 -0
  197. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialMedium.ttf +0 -0
  198. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialMediumItalic.ttf +0 -0
  199. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialRegular.ttf +0 -0
  200. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialRegularItalic.ttf +0 -0
  201. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBlack.ttf +0 -0
  202. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBlackItalic.ttf +0 -0
  203. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBold.ttf +0 -0
  204. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBoldItalic.ttf +0 -0
  205. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallDark.ttf +0 -0
  206. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallDarkItalic.ttf +0 -0
  207. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallFine.ttf +0 -0
  208. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallFineItalic.ttf +0 -0
  209. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallLight.ttf +0 -0
  210. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallLightItalic.ttf +0 -0
  211. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallMedium.ttf +0 -0
  212. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallMediumItalic.ttf +0 -0
  213. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallRegular.ttf +0 -0
  214. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallRegularItalic.ttf +0 -0
  215. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBlack.ttf +0 -0
  216. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBlackItalic.ttf +0 -0
  217. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBold.ttf +0 -0
  218. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBoldItalic.ttf +0 -0
  219. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightDark.ttf +0 -0
  220. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightDarkItalic.ttf +0 -0
  221. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightFine.ttf +0 -0
  222. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightFineItalic.ttf +0 -0
  223. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightLight.ttf +0 -0
  224. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightLightItalic.ttf +0 -0
  225. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightMedium.ttf +0 -0
  226. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightMediumItalic.ttf +0 -0
  227. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightRegular.ttf +0 -0
  228. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightRegularItalic.ttf +0 -0
  229. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBlack.ttf +0 -0
  230. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBlackItalic.ttf +0 -0
  231. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBold.ttf +0 -0
  232. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBoldItalic.ttf +0 -0
  233. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideDark.ttf +0 -0
  234. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideDarkItalic.ttf +0 -0
  235. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideFine.ttf +0 -0
  236. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideFineItalic.ttf +0 -0
  237. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideLight.ttf +0 -0
  238. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideLightItalic.ttf +0 -0
  239. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideMedium.ttf +0 -0
  240. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideMediumItalic.ttf +0 -0
  241. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideRegular.ttf +0 -0
  242. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideRegularItalic.ttf +0 -0
  243. package/dist/fonts/TG/TGGullhamrarVF.ttf +0 -0
  244. package/dist/fonts/TG/TGMalromurRomanVF.ttf +0 -0
  245. package/dist/fonts/TG/TGRotVF.ttf +0 -0
  246. package/dist/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
  247. package/dist/fonts/jetbrains-mono/JetBrainsMono-MediumItalic.woff2 +0 -0
  248. package/dist/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
  249. package/dist/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
  250. package/dist/meshPalettes-BJODHYrY.js +0 -892
@@ -1,7 +1,7 @@
1
- import { C as e, S as t, _ as n, a as r, b as i, c as a, f as o, g as s, h as c, l, m as u, p as d, r as f, s as p, u as m, y as h } from "./meshPalettes-BJODHYrY.js";
2
- import { $ as g, A as _, B as v, C as y, E as b, F as ee, G as x, H as te, I as ne, J as re, K as S, L as ie, M as ae, N as C, P as oe, Q as se, R as ce, S as le, T as ue, U as de, V as fe, W as w, X as pe, Y as me, Z as he, _ as ge, a as _e, at as T, b as ve, c as E, et as D, f as ye, g as O, h as be, i as xe, it as k, j as Se, k as A, l as Ce, m as we, n as Te, nt as j, o as M, ot as Ee, p as N, q as De, r as Oe, rt as ke, s as P, t as F, tt as I, u as Ae, v as L, w as je, x as R, y as Me, z } from "./OrbitControls-BAhLQ5d8.js";
1
+ import { D as e, N as t, O as n, S as r, T as i, _ as a, b as o, c as s, f as c, h as l, i as u, j as d, k as f, m as p, n as m, p as h, r as g, t as _, u as v, v as y, w as ee, x as te, y as b } from "./phase-D3rwI6OO.js";
2
+ import { $ as ne, A as x, B as re, C as ie, D as ae, E as oe, F as se, G as S, H as ce, I as le, J as ue, K as de, L as fe, N as C, O as pe, P as me, Q as he, R as ge, S as _e, T as ve, U as ye, V as be, W as w, X as T, Y as E, Z as xe, _ as Se, a as D, at as O, b as Ce, c as we, ct as k, d as A, et as Te, f as j, g as M, i as N, it as P, k as Ee, l as F, lt as De, m as Oe, n as ke, nt as Ae, o as je, ot as I, p as Me, q as Ne, r as L, rt as Pe, s as Fe, st as Ie, t as R, tt as Le, u as z, v as Re, w as B, x as V, y as H, z as ze } from "./OrbitControls-CE3qSrHQ.js";
3
3
  //#region src/loops/gl/DriftEngine.js
4
- var Ne = {
4
+ var Be = {
5
5
  clouds: 0,
6
6
  cirrus: 1,
7
7
  aurora: 2,
@@ -11,24 +11,24 @@ var Ne = {
11
11
  folds: 0,
12
12
  flag: 1,
13
13
  drape: 2
14
- }, Pe = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Fe = "\n precision highp float;\n varying vec2 vUv;\n uniform float uPhase, uAspect;\n uniform float uScale, uWarp, uEvolve, uGust, uContrast, uCoverage, uSoft, uSheen, uGrain;\n uniform float uAmp, uChop, uFoam, uFold, uDrape, uSway;\n uniform vec2 uFlow, uLight; // direction vectors (unit)\n uniform int uStyle;\n uniform vec3 uColors[5];\n uniform vec3 uBase;\n", Ie = "\n const float TAU = 6.28318530718;\n \n vec4 mod289(vec4 x){ return x - floor(x*(1.0/289.0))*289.0; }\n float mod289(float x){ return x - floor(x*(1.0/289.0))*289.0; }\n vec4 permute(vec4 x){ return mod289(((x*34.0)+1.0)*x); }\n float permute(float x){ return mod289(((x*34.0)+1.0)*x); }\n vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314*r; }\n float taylorInvSqrt(float r){ return 1.79284291400159 - 0.85373472095314*r; }\n vec4 grad4(float j, vec4 ip){\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p, s;\n p.xyz = floor( fract(vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n return p;\n }\n float snoise(vec4 v){\n const vec4 C = vec4(0.138196601125011, 0.276393202250021, 0.414589803375032, -0.447213595499958);\n vec4 i = floor(v + dot(v, vec4(0.309016994374947451)) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n vec4 i0;\n vec3 isX = step(x0.yzw, x0.xxx);\n vec3 isYZ = step(x0.zww, x0.yyz);\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n vec4 i3 = clamp(i0, 0.0, 1.0);\n vec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n vec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n i = mod289(i);\n float j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute(permute(permute(permute(\n i.w + vec4(i1.w, i2.w, i3.w, 1.0))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0);\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)), 0.0);\n m0 = m0*m0; m1 = m1*m1;\n return 49.0 * ( dot(m0*m0, vec3(dot(p0,x0), dot(p1,x1), dot(p2,x2)))\n + dot(m1*m1, vec2(dot(p3,x3), dot(p4,x4))) );\n }\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\n // noise sampled on a circle in (z,w) → perfectly periodic in phase.\n float loopNoise(vec2 p, float ph, float r){\n float a = TAU * ph;\n return snoise(vec4(p, r * cos(a), r * sin(a)));\n }\n float lfbm(vec2 p, float ph, float r){\n float v = 0.0, amp = 0.5;\n for (int i = 0; i < 4; i++){ v += amp * loopNoise(p, ph, r); p *= 2.02; amp *= 0.5; r *= 1.7; }\n return v;\n }\n vec3 ramp(float t){\n float ft = clamp(t, 0.0, 1.0) * 4.0; // 5 stops → 4 segments\n int i = int(floor(ft));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(ft));\n }\n // loop-safe grain: seeded off the same phase circle so it closes too.\n float grain(float ph){ return hash(vUv * vec2(1920.0, 1080.0) + (0.5 + 0.5*cos(TAU*ph)) * 13.0) - 0.5; }\n", Le = {
15
- air: Fe + Ie + "\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n vec2 gust = uFlow * sin(TAU * ph) * uGust; // directional sway, loop-safe\n\n float f; float sheen = 0.0;\n if (uStyle == 1) {\n vec2 ps = vec2(p.x * 0.28 + p.y * 0.22, p.y * 1.25) * uScale + gust; // cirrus\n f = lfbm(ps, ph, uEvolve);\n } else if (uStyle == 2) {\n vec2 sp = p * uScale + gust; // aurora\n float band = sp.x * 1.6 + 0.6 * lfbm(vec2(sp.y * 1.2, 0.0), ph, uEvolve);\n f = sin(band * 3.14159) * 0.5 + 0.4 * lfbm(sp, ph, uEvolve);\n } else {\n vec2 sp = p * 0.62 * uScale + gust; // clouds (domain-warped)\n vec2 q = vec2(lfbm(sp + vec2(0.0, 1.3), ph, uEvolve), lfbm(sp + vec2(5.2, 1.3), ph, uEvolve));\n vec2 r = vec2(lfbm(sp + uWarp * q + vec2(1.7, 9.2), ph, uEvolve),\n lfbm(sp + uWarp * q + vec2(8.3, 2.8), ph, uEvolve));\n f = lfbm(sp + uWarp * r, ph, uEvolve);\n sheen = pow(clamp(length(r) * 0.6, 0.0, 1.0), 3.0);\n }\n\n float d = clamp(f * 0.5 + 0.5, 0.0, 1.0);\n vec3 cloudCol = ramp(d);\n float edge = mix(0.04, 0.6, uSoft);\n float lo = 1.0 - uCoverage;\n float cov = smoothstep(lo, lo + edge, d);\n vec3 col = mix(uBase, cloudCol, cov);\n col += sheen * uSheen * 0.18 * cov;\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
16
- water: Fe + Ie + "\n // height field — directional swells (integer cycles/loop) + looped ripple.\n float waterH(vec2 p, float ph, float scl){\n vec2 d1 = normalize(uFlow + vec2(0.0001));\n vec2 d2 = normalize(vec2(-d1.y, d1.x) * 0.7 + d1 * 0.3);\n float k = uScale * scl;\n float a = uAmp;\n float v = 0.0;\n v += a * sin(dot(p, d1) * 2.2 * k + TAU * ph * 2.0);\n v += a * 0.55 * sin(dot(p, d2) * 3.6 * k + TAU * ph * 3.0);\n v += a * 0.30 * sin(dot(p, normalize(d1 + d2)) * 6.0 * k + TAU * ph * 5.0);\n v += uChop * 0.35 * lfbm(p * 3.0 * k, ph, uEvolve);\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n\n if (uStyle == 2) { // caustics — ridged looped-noise veins over deep water\n float c = pow(1.0 - abs(lfbm(p * 2.4 * uScale, ph, uEvolve)), 6.0)\n + 0.6 * pow(1.0 - abs(lfbm(p * 4.8 * uScale + vec2(3.0), ph, uEvolve)), 8.0);\n c *= uChop + 0.5;\n vec3 col = ramp(clamp(0.3 + c * 0.7, 0.0, 1.0));\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n return;\n }\n\n float scl = (uStyle == 1) ? 2.2 : 1.0; // ripples = higher frequency\n float e = 0.0022;\n float hC = waterH(p, ph, scl);\n float hX = waterH(p + vec2(e, 0.0), ph, scl);\n float hY = waterH(p + vec2(0.0, e), ph, scl);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 8.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.8, 0.6));\n vec3 V = vec3(0.0, 0.0, 1.0);\n float spec = pow(max(dot(reflect(-L, n), V), 0.0), 40.0) * uSheen;\n float fres = pow(1.0 - max(n.z, 0.0), 3.0);\n\n float t = clamp(0.5 + hC * 0.6, 0.0, 1.0);\n vec3 col = mix(ramp(t), uBase, fres * 0.6); // sky reflection at grazing\n col += spec;\n float slope = clamp(length(vec2(hC - hX, hC - hY)) * 120.0, 0.0, 1.0);\n float foam = smoothstep(1.0 - uFoam, 1.0, max(slope, t * 0.8));\n col = mix(col, vec3(0.95), foam * uFoam);\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
17
- cloth: Fe + Ie + "\n float clothH(vec2 p, float ph){\n vec2 fd = normalize(uFlow + vec2(0.0001)); // fold direction\n vec2 pd = vec2(-fd.y, fd.x);\n float k = uScale;\n float sway = uSway * sin(TAU * ph);\n float v = uFold * sin(dot(p, pd) * 5.0 * k + sway * 2.0 + 0.6 * lfbm(p * 1.5 * k, ph, uEvolve));\n if (uStyle == 1) v += uFold * 0.7 * sin(dot(p, fd) * 4.0 * k + TAU * ph * 2.0); // flag travel\n if (uStyle == 2) v += uDrape * sin(p.y * 3.0 * k + TAU * ph) * (0.5 + 0.5 * p.y); // drape sag\n v += uDrape * 0.30 * lfbm(p * 4.0 * k, ph, uEvolve); // wrinkle\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n float e = 0.0025;\n float hC = clothH(p, ph);\n float hX = clothH(p + vec2(e, 0.0), ph);\n float hY = clothH(p + vec2(0.0, e), ph);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 6.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.9, 0.5));\n float diff = 0.5 + 0.5 * dot(n, L);\n float sheen = pow(1.0 - abs(dot(n, L)), 3.0) * uSheen; // anisotropic satin rim\n vec3 col = ramp(clamp(diff, 0.0, 1.0));\n col += sheen * 0.5;\n col *= mix(1.0, 0.7, smoothstep(0.0, -uFold, hC)); // valley self-shadow\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n"
18
- }, B = (e) => {
14
+ }, Ve = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", He = "\n precision highp float;\n varying vec2 vUv;\n uniform float uPhase, uAspect;\n uniform float uScale, uWarp, uEvolve, uGust, uContrast, uCoverage, uSoft, uSheen, uGrain;\n uniform float uAmp, uChop, uFoam, uFold, uDrape, uSway;\n uniform vec2 uFlow, uLight; // direction vectors (unit)\n uniform int uStyle;\n uniform vec3 uColors[5];\n uniform vec3 uBase;\n", Ue = "\n const float TAU = 6.28318530718;\n \n vec4 mod289(vec4 x){ return x - floor(x*(1.0/289.0))*289.0; }\n float mod289(float x){ return x - floor(x*(1.0/289.0))*289.0; }\n vec4 permute(vec4 x){ return mod289(((x*34.0)+1.0)*x); }\n float permute(float x){ return mod289(((x*34.0)+1.0)*x); }\n vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314*r; }\n float taylorInvSqrt(float r){ return 1.79284291400159 - 0.85373472095314*r; }\n vec4 grad4(float j, vec4 ip){\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p, s;\n p.xyz = floor( fract(vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n return p;\n }\n float snoise(vec4 v){\n const vec4 C = vec4(0.138196601125011, 0.276393202250021, 0.414589803375032, -0.447213595499958);\n vec4 i = floor(v + dot(v, vec4(0.309016994374947451)) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n vec4 i0;\n vec3 isX = step(x0.yzw, x0.xxx);\n vec3 isYZ = step(x0.zww, x0.yyz);\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n vec4 i3 = clamp(i0, 0.0, 1.0);\n vec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n vec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n i = mod289(i);\n float j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute(permute(permute(permute(\n i.w + vec4(i1.w, i2.w, i3.w, 1.0))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0);\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)), 0.0);\n m0 = m0*m0; m1 = m1*m1;\n return 49.0 * ( dot(m0*m0, vec3(dot(p0,x0), dot(p1,x1), dot(p2,x2)))\n + dot(m1*m1, vec2(dot(p3,x3), dot(p4,x4))) );\n }\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\n // noise sampled on a circle in (z,w) → perfectly periodic in phase.\n float loopNoise(vec2 p, float ph, float r){\n float a = TAU * ph;\n return snoise(vec4(p, r * cos(a), r * sin(a)));\n }\n float lfbm(vec2 p, float ph, float r){\n float v = 0.0, amp = 0.5;\n for (int i = 0; i < 4; i++){ v += amp * loopNoise(p, ph, r); p *= 2.02; amp *= 0.5; r *= 1.7; }\n return v;\n }\n vec3 ramp(float t){\n float ft = clamp(t, 0.0, 1.0) * 4.0; // 5 stops → 4 segments\n int i = int(floor(ft));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(ft));\n }\n // loop-safe grain: seeded off the same phase circle so it closes too.\n float grain(float ph){ return hash(vUv * vec2(1920.0, 1080.0) + (0.5 + 0.5*cos(TAU*ph)) * 13.0) - 0.5; }\n", We = {
15
+ air: He + Ue + "\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n vec2 gust = uFlow * sin(TAU * ph) * uGust; // directional sway, loop-safe\n\n float f; float sheen = 0.0;\n if (uStyle == 1) {\n vec2 ps = vec2(p.x * 0.28 + p.y * 0.22, p.y * 1.25) * uScale + gust; // cirrus\n f = lfbm(ps, ph, uEvolve);\n } else if (uStyle == 2) {\n vec2 sp = p * uScale + gust; // aurora\n float band = sp.x * 1.6 + 0.6 * lfbm(vec2(sp.y * 1.2, 0.0), ph, uEvolve);\n f = sin(band * 3.14159) * 0.5 + 0.4 * lfbm(sp, ph, uEvolve);\n } else {\n vec2 sp = p * 0.62 * uScale + gust; // clouds (domain-warped)\n vec2 q = vec2(lfbm(sp + vec2(0.0, 1.3), ph, uEvolve), lfbm(sp + vec2(5.2, 1.3), ph, uEvolve));\n vec2 r = vec2(lfbm(sp + uWarp * q + vec2(1.7, 9.2), ph, uEvolve),\n lfbm(sp + uWarp * q + vec2(8.3, 2.8), ph, uEvolve));\n f = lfbm(sp + uWarp * r, ph, uEvolve);\n sheen = pow(clamp(length(r) * 0.6, 0.0, 1.0), 3.0);\n }\n\n float d = clamp(f * 0.5 + 0.5, 0.0, 1.0);\n vec3 cloudCol = ramp(d);\n float edge = mix(0.04, 0.6, uSoft);\n float lo = 1.0 - uCoverage;\n float cov = smoothstep(lo, lo + edge, d);\n vec3 col = mix(uBase, cloudCol, cov);\n col += sheen * uSheen * 0.18 * cov;\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
16
+ water: He + Ue + "\n // height field — directional swells (integer cycles/loop) + looped ripple.\n float waterH(vec2 p, float ph, float scl){\n vec2 d1 = normalize(uFlow + vec2(0.0001));\n vec2 d2 = normalize(vec2(-d1.y, d1.x) * 0.7 + d1 * 0.3);\n float k = uScale * scl;\n float a = uAmp;\n float v = 0.0;\n v += a * sin(dot(p, d1) * 2.2 * k + TAU * ph * 2.0);\n v += a * 0.55 * sin(dot(p, d2) * 3.6 * k + TAU * ph * 3.0);\n v += a * 0.30 * sin(dot(p, normalize(d1 + d2)) * 6.0 * k + TAU * ph * 5.0);\n v += uChop * 0.35 * lfbm(p * 3.0 * k, ph, uEvolve);\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n\n if (uStyle == 2) { // caustics — ridged looped-noise veins over deep water\n float c = pow(1.0 - abs(lfbm(p * 2.4 * uScale, ph, uEvolve)), 6.0)\n + 0.6 * pow(1.0 - abs(lfbm(p * 4.8 * uScale + vec2(3.0), ph, uEvolve)), 8.0);\n c *= uChop + 0.5;\n vec3 col = ramp(clamp(0.3 + c * 0.7, 0.0, 1.0));\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n return;\n }\n\n float scl = (uStyle == 1) ? 2.2 : 1.0; // ripples = higher frequency\n float e = 0.0022;\n float hC = waterH(p, ph, scl);\n float hX = waterH(p + vec2(e, 0.0), ph, scl);\n float hY = waterH(p + vec2(0.0, e), ph, scl);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 8.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.8, 0.6));\n vec3 V = vec3(0.0, 0.0, 1.0);\n float spec = pow(max(dot(reflect(-L, n), V), 0.0), 40.0) * uSheen;\n float fres = pow(1.0 - max(n.z, 0.0), 3.0);\n\n float t = clamp(0.5 + hC * 0.6, 0.0, 1.0);\n vec3 col = mix(ramp(t), uBase, fres * 0.6); // sky reflection at grazing\n col += spec;\n float slope = clamp(length(vec2(hC - hX, hC - hY)) * 120.0, 0.0, 1.0);\n float foam = smoothstep(1.0 - uFoam, 1.0, max(slope, t * 0.8));\n col = mix(col, vec3(0.95), foam * uFoam);\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
17
+ cloth: He + Ue + "\n float clothH(vec2 p, float ph){\n vec2 fd = normalize(uFlow + vec2(0.0001)); // fold direction\n vec2 pd = vec2(-fd.y, fd.x);\n float k = uScale;\n float sway = uSway * sin(TAU * ph);\n float v = uFold * sin(dot(p, pd) * 5.0 * k + sway * 2.0 + 0.6 * lfbm(p * 1.5 * k, ph, uEvolve));\n if (uStyle == 1) v += uFold * 0.7 * sin(dot(p, fd) * 4.0 * k + TAU * ph * 2.0); // flag travel\n if (uStyle == 2) v += uDrape * sin(p.y * 3.0 * k + TAU * ph) * (0.5 + 0.5 * p.y); // drape sag\n v += uDrape * 0.30 * lfbm(p * 4.0 * k, ph, uEvolve); // wrinkle\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n float e = 0.0025;\n float hC = clothH(p, ph);\n float hX = clothH(p + vec2(e, 0.0), ph);\n float hY = clothH(p + vec2(0.0, e), ph);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 6.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.9, 0.5));\n float diff = 0.5 + 0.5 * dot(n, L);\n float sheen = pow(1.0 - abs(dot(n, L)), 3.0) * uSheen; // anisotropic satin rim\n vec3 col = ramp(clamp(diff, 0.0, 1.0));\n col += sheen * 0.5;\n col *= mix(1.0, 0.7, smoothstep(0.0, -uFold, hC)); // valley self-shadow\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n"
18
+ }, U = (e) => {
19
19
  let t = parseInt(e.slice(1), 16);
20
- return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
21
- }, Re = class {
20
+ return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
21
+ }, Ge = class {
22
22
  constructor(e = "air") {
23
23
  this.family = e, this.renderer = null, this.time = 0, this.period = 8, this.playing = !0, this.speed = 1;
24
24
  }
25
- init(e) {
26
- this.renderer = new T({
27
- canvas: e,
25
+ init(t) {
26
+ this.renderer = new D({
27
+ canvas: t,
28
28
  antialias: !0,
29
29
  preserveDrawingBuffer: !0
30
- }), this.scene = new w(), this.cam = new E();
31
- let n = t[this.family][0];
30
+ }), this.scene = new E(), this.cam = new j();
31
+ let n = e[this.family][0];
32
32
  this.uniforms = {
33
33
  uPhase: { value: 0 },
34
34
  uAspect: { value: 1 },
@@ -47,34 +47,39 @@ var Ne = {
47
47
  uFold: { value: .7 },
48
48
  uDrape: { value: .5 },
49
49
  uSway: { value: .5 },
50
- uFlow: { value: new I(1, 0) },
51
- uLight: { value: new I(.7, .7) },
50
+ uFlow: { value: new O(1, 0) },
51
+ uLight: { value: new O(.7, .7) },
52
52
  uStyle: { value: 0 },
53
- uColors: { value: n.cols.map(B) },
54
- uBase: { value: B(n.base) }
55
- }, this.mat = new S({
56
- vertexShader: Pe,
57
- fragmentShader: Le[this.family],
53
+ uColors: { value: n.cols.map(U) },
54
+ uBase: { value: U(n.base) }
55
+ }, this.mat = new T({
56
+ vertexShader: Ve,
57
+ fragmentShader: We[this.family],
58
58
  uniforms: this.uniforms
59
- }), this.scene.add(new A(new v(2, 2), this.mat));
59
+ }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
60
60
  }
61
61
  resize(e, t) {
62
62
  this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
63
63
  }
64
- setParams(t) {
64
+ setPointer(e) {
65
+ if (!this.uniforms || !e) return;
66
+ let t = this.uniforms, n = (e.x - .5) * Math.PI * .6, r = t.uFlow.value, i = Math.cos(n), a = Math.sin(n);
67
+ r.set(r.x * i - r.y * a, r.x * a + r.y * i), e.down && (t.uGust.value = Math.min(1.5, t.uGust.value * 2 + .3));
68
+ }
69
+ setParams(e) {
65
70
  if (!this.uniforms) return;
66
- let n = this.uniforms;
67
- if (t.freq != null && (n.uScale.value = t.freq), t.warp != null && (n.uWarp.value = t.warp), t.evolve != null && (n.uEvolve.value = t.evolve), t.wind != null && (n.uGust.value = t.wind), t.contrast != null && (n.uContrast.value = t.contrast), t.coverage != null && (n.uCoverage.value = t.coverage), t.soft != null && (n.uSoft.value = t.soft), t.sheen != null && (n.uSheen.value = t.sheen), t.grain != null && (n.uGrain.value = t.grain), t.amp != null && (n.uAmp.value = t.amp), t.chop != null && (n.uChop.value = t.chop), t.foam != null && (n.uFoam.value = t.foam), t.fold != null && (n.uFold.value = t.fold), t.drape != null && (n.uDrape.value = t.drape), t.sway != null && (n.uSway.value = t.sway), t.direction != null) {
68
- let e = t.direction * Math.PI / 180;
69
- n.uFlow.value.set(Math.cos(e), Math.sin(e));
71
+ let t = this.uniforms;
72
+ if (e.freq != null && (t.uScale.value = e.freq), e.warp != null && (t.uWarp.value = e.warp), e.evolve != null && (t.uEvolve.value = e.evolve), e.wind != null && (t.uGust.value = e.wind), e.contrast != null && (t.uContrast.value = e.contrast), e.coverage != null && (t.uCoverage.value = e.coverage), e.soft != null && (t.uSoft.value = e.soft), e.sheen != null && (t.uSheen.value = e.sheen), e.grain != null && (t.uGrain.value = e.grain), e.amp != null && (t.uAmp.value = e.amp), e.chop != null && (t.uChop.value = e.chop), e.foam != null && (t.uFoam.value = e.foam), e.fold != null && (t.uFold.value = e.fold), e.drape != null && (t.uDrape.value = e.drape), e.sway != null && (t.uSway.value = e.sway), e.direction != null) {
73
+ let n = e.direction * Math.PI / 180;
74
+ t.uFlow.value.set(Math.cos(n), Math.sin(n));
70
75
  }
71
- if (t.light != null) {
72
- let e = t.light * Math.PI / 180;
73
- n.uLight.value.set(Math.cos(e), Math.sin(e));
76
+ if (e.light != null) {
77
+ let n = e.light * Math.PI / 180;
78
+ t.uLight.value.set(Math.cos(n), Math.sin(n));
74
79
  }
75
- if (t.period != null && (this.period = t.period), t.speed != null && (this.speed = t.speed), t.style != null && (n.uStyle.value = Ne[t.style] ?? 0), t.palette != null) {
76
- let r = e(this.family, t.palette);
77
- n.uColors.value = r.cols.map(B), n.uBase.value = B(r.base);
80
+ if (e.period != null && (this.period = e.period), e.speed != null && (this.speed = e.speed), e.style != null && (t.uStyle.value = Be[e.style] ?? 0), e.palette != null) {
81
+ let r = n(this.family, e.palette);
82
+ t.uColors.value = r.cols.map(U), t.uBase.value = U(r.base);
78
83
  }
79
84
  }
80
85
  setPlaying(e) {
@@ -107,21 +112,21 @@ var Ne = {
107
112
  });
108
113
  }
109
114
  destroy() {
110
- this.renderer &&= (this.renderer.dispose(), null);
115
+ this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
111
116
  }
112
- }, ze = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Be = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uSize, uSpread, uIrid, uHue, uSheen, uGloss;\n uniform float uRelief, uWarp, uGrain, uSpectral, uAngle, uFreq;\n uniform float uWinds, uPitch, uPetals, uSpin, uMouth;\n uniform int uCat, uType, uCount;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n vec3 poleColor(int i){\n int idx = i < 5 ? i : 4;\n return mix(uColors[idx], spectral(uHue + float(i) * 0.18), uSpectral);\n }\n\n // Shared surface lighting: soft key light + broad glossy specular + rim lift.\n vec3 applyLight(vec3 col, vec3 n){\n vec3 viewDir = vec3(0.0, 0.0, 1.0);\n vec3 L = normalize(vec3(0.35, 0.55, 0.85));\n vec3 H = normalize(L + viewDir);\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n col *= 0.58 + 0.42 * max(dot(n, L), 0.0);\n col += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n col += col * fres * 0.35;\n return col;\n }\n\n vec2 blobPos(int i){\n float fi = float(i);\n return vec2(sin(uTime*0.30 + fi*2.10)*uSpread,\n cos(uTime*0.26 + fi*1.70)*uSpread*0.82);\n }\n float field(vec2 q){\n float s = 0.0;\n for(int i=0;i<6;i++){\n if(i>=uCount) break;\n vec2 d = q - blobPos(i);\n s += (uSize*uSize) / (dot(d,d) + 0.0009);\n }\n return s;\n }\n float heightOf(float v){ return smoothstep(0.65, 3.2, v); }\n\n vec4 blobLayer(vec2 q){\n float e = 0.014;\n float h = heightOf(field(q));\n float hx = heightOf(field(q + vec2(e, 0.0)));\n float hy = heightOf(field(q + vec2(0.0, e)));\n vec2 g = vec2(hx - h, hy - h) / e;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.25 + (n.x * 0.5 + 0.5) * 0.55 + h * 0.45) + uTime * 0.018;\n return vec4(applyLight(tint(ci), n), smoothstep(0.015, 0.22, h));\n }\n\n vec3 coreGlow(vec2 q){\n float d = length(q);\n float m = smoothstep(uMouth * 1.25, 0.0, d);\n vec3 n = normalize(vec3(-q * 1.6, 1.0));\n float ci = uHue + uIrid * ((q.x * 0.5 + 0.5) * 0.6 + d * 0.6) + uTime * 0.05;\n return applyLight(tint(ci), n) * m;\n }\n\n vec3 spiralLayer(vec2 c){\n float r = length(c) + 1e-4;\n float ang = atan(c.y, c.x);\n float scallop = 0.07 * sin(ang * uPetals + uTime * 0.1);\n float sp = ang * (uWinds * 0.159155) + log(r) * uPitch + scallop - uTime * 0.15 * uSpin;\n float cell = fract(sp);\n float fid = floor(sp);\n float bump = sin(cell * 3.14159);\n float seam = smoothstep(0.0, 0.10, cell) * smoothstep(1.0, 0.90, cell);\n vec2 gdir = (uWinds * 0.159155) * vec2(-c.y, c.x) / (r * r) + uPitch * c / (r * r);\n float slope = cos(cell * 3.14159) * 3.14159;\n vec3 n = normalize(vec3(-gdir * slope * uRelief * 0.05, 1.0));\n float ci = uHue + uIrid * 0.5 * (fid * 0.10 + (n.x * 0.5 + 0.5) * 0.5);\n vec3 plate = applyLight(tint(ci), n) * (0.35 + 0.65 * bump);\n plate = mix(uBg, plate, seam);\n float mouth = smoothstep(0.0, uMouth, r);\n return mix(uBg, plate, mouth) + coreGlow(c) * (1.0 - mouth * 0.6);\n }\n\n // ── Field — flat colour gradients ──\n vec3 fieldCol(vec2 q, vec2 p){\n float s;\n vec2 dir = vec2(cos(uAngle), sin(uAngle));\n if (uType == 0) s = clamp(dot(q, dir) * 0.6 + 0.5, 0.0, 1.0); // linear\n else if (uType == 1) { float x = dot(q, dir) * uFreq - uTime * 0.1 * uSpin; s = abs(fract(x) * 2.0 - 1.0); } // stripe\n else if (uType == 2) s = clamp(length(q) * uFreq * 0.6, 0.0, 1.0); // radial\n else s = fract(atan(q.y, q.x) * 0.159155 + 0.5 + uAngle * 0.159155 - uTime * 0.05 * uSpin); // conic\n vec3 col = tint(uHue + s * uIrid);\n col *= mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.22); // soft vignette\n return col;\n }\n\n // ── Pole — influence fields ──\n vec3 poleCol(vec2 q){\n if (uType == 0) { // monopole\n vec2 src = vec2(sin(uTime * 0.2) * uSpread, cos(uTime * 0.17) * uSpread);\n float d = length(q - src);\n float infl = 1.0 / (1.0 + d * d * uFreq * 1.5);\n return tint(uHue + (1.0 - infl) * uIrid) + infl * infl * uSheen * 0.4;\n } else if (uType == 1) { // multipole (inverse-distance blend)\n vec3 acc = vec3(0.0); float wsum = 0.0;\n for (int i = 0; i < 5; i++) {\n if (i >= uCount) break;\n vec2 pp = blobPos(i);\n float d = distance(q, pp);\n float w = 1.0 / (d * d + 0.02);\n acc += poleColor(i) * w; wsum += w;\n }\n vec3 col = acc / max(wsum, 1e-4);\n float sh = pow(max(0.0, 0.5 + 0.5 * sin((q.x + q.y) * 3.1416 - uTime * 0.2)), 3.0);\n return col + sh * uSheen * 0.2;\n } else if (uType == 2) { // bilinear mesh (4 palette corners)\n vec2 g = clamp(q * 0.5 + 0.5, 0.0, 1.0);\n return mix(mix(poleColor(0), poleColor(1), g.x), mix(poleColor(2), poleColor(3), g.x), g.y);\n } else { // aurora — domain-warped fbm\n vec2 sp = q * 0.7;\n vec2 a = vec2(fbm(sp + vec2(0.0, uTime * 0.08)), fbm(sp + vec2(5.2, 1.3) - uTime * 0.08));\n vec2 b = vec2(fbm(sp + 1.6 * a + uTime * 0.06), fbm(sp + 1.6 * a + vec2(8.3, 2.8) - uTime * 0.06));\n float f = fbm(sp + 2.2 * b);\n return tint(uHue + (f * 0.5 + 0.5) * uIrid);\n }\n }\n\n // ── Volume — glossy 3D-reading forms ──\n vec3 volumeCol(vec2 q, vec2 p){\n if (uType == 0) { vec4 bl = blobLayer(q); return mix(uBg, bl.rgb, bl.a); }\n if (uType == 1) return spiralLayer(q);\n if (uType == 2) { // dome — glossy iridescent orb\n float R = uSize * 1.6;\n float rr = length(q) / R;\n vec3 col = uBg;\n if (rr < 1.0) {\n float h = sqrt(max(0.0, 1.0 - rr * rr));\n vec3 n = normalize(vec3(q / R, h));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.1 + (n.x * 0.5 + 0.5) * 0.5 + h * 0.4) + uTime * 0.05;\n col = applyLight(tint(ci), n);\n }\n return mix(uBg, col, smoothstep(1.02, 0.96, rr));\n }\n // ripple — concentric glossy ridges\n float e = 0.01;\n float k = uFreq * 3.0; float ph = uTime * uSpin * 1.5;\n float hC = 0.5 + 0.5 * sin(length(q) * k - ph);\n float hX = 0.5 + 0.5 * sin(length(q + vec2(e, 0.0)) * k - ph);\n float hY = 0.5 + 0.5 * sin(length(q + vec2(0.0, e)) * k - ph);\n vec2 gg = vec2(hX - hC, hY - hC) / e;\n vec3 n = normalize(vec3(-gg * uRelief * 0.15, 1.0));\n float ci = uHue + uIrid * (length(q) * 0.5 + hC * 0.4) + uTime * 0.04;\n vec3 col = applyLight(tint(ci), n);\n return col * mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.3);\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec2 wv = vec2(fbm(p*1.4 + uTime*0.05), fbm(p*1.4 + 7.3 - uTime*0.05));\n vec2 q = p + (wv - 0.5) * uWarp;\n\n vec3 col;\n if (uCat == 0) col = fieldCol(q, p);\n else if (uCat == 1) col = poleCol(q);\n else col = volumeCol(q, p);\n\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", V = (e) => {
117
+ }, Ke = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", qe = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uSize, uSpread, uIrid, uHue, uSheen, uGloss;\n uniform float uRelief, uWarp, uGrain, uSpectral, uAngle, uFreq;\n uniform float uWinds, uPitch, uPetals, uSpin, uMouth;\n uniform int uCat, uType, uCount;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n vec3 poleColor(int i){\n int idx = i < 5 ? i : 4;\n return mix(uColors[idx], spectral(uHue + float(i) * 0.18), uSpectral);\n }\n\n // Shared surface lighting: soft key light + broad glossy specular + rim lift.\n vec3 applyLight(vec3 col, vec3 n){\n vec3 viewDir = vec3(0.0, 0.0, 1.0);\n vec3 L = normalize(vec3(0.35, 0.55, 0.85));\n vec3 H = normalize(L + viewDir);\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n col *= 0.58 + 0.42 * max(dot(n, L), 0.0);\n col += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n col += col * fres * 0.35;\n return col;\n }\n\n vec2 blobPos(int i){\n float fi = float(i);\n return vec2(sin(uTime*0.30 + fi*2.10)*uSpread,\n cos(uTime*0.26 + fi*1.70)*uSpread*0.82);\n }\n float field(vec2 q){\n float s = 0.0;\n for(int i=0;i<6;i++){\n if(i>=uCount) break;\n vec2 d = q - blobPos(i);\n s += (uSize*uSize) / (dot(d,d) + 0.0009);\n }\n return s;\n }\n float heightOf(float v){ return smoothstep(0.65, 3.2, v); }\n\n vec4 blobLayer(vec2 q){\n float e = 0.014;\n float h = heightOf(field(q));\n float hx = heightOf(field(q + vec2(e, 0.0)));\n float hy = heightOf(field(q + vec2(0.0, e)));\n vec2 g = vec2(hx - h, hy - h) / e;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.25 + (n.x * 0.5 + 0.5) * 0.55 + h * 0.45) + uTime * 0.018;\n return vec4(applyLight(tint(ci), n), smoothstep(0.015, 0.22, h));\n }\n\n vec3 coreGlow(vec2 q){\n float d = length(q);\n float m = smoothstep(uMouth * 1.25, 0.0, d);\n vec3 n = normalize(vec3(-q * 1.6, 1.0));\n float ci = uHue + uIrid * ((q.x * 0.5 + 0.5) * 0.6 + d * 0.6) + uTime * 0.05;\n return applyLight(tint(ci), n) * m;\n }\n\n vec3 spiralLayer(vec2 c){\n float r = length(c) + 1e-4;\n float ang = atan(c.y, c.x);\n float scallop = 0.07 * sin(ang * uPetals + uTime * 0.1);\n float sp = ang * (uWinds * 0.159155) + log(r) * uPitch + scallop - uTime * 0.15 * uSpin;\n float cell = fract(sp);\n float fid = floor(sp);\n float bump = sin(cell * 3.14159);\n float seam = smoothstep(0.0, 0.10, cell) * smoothstep(1.0, 0.90, cell);\n vec2 gdir = (uWinds * 0.159155) * vec2(-c.y, c.x) / (r * r) + uPitch * c / (r * r);\n float slope = cos(cell * 3.14159) * 3.14159;\n vec3 n = normalize(vec3(-gdir * slope * uRelief * 0.05, 1.0));\n float ci = uHue + uIrid * 0.5 * (fid * 0.10 + (n.x * 0.5 + 0.5) * 0.5);\n vec3 plate = applyLight(tint(ci), n) * (0.35 + 0.65 * bump);\n plate = mix(uBg, plate, seam);\n float mouth = smoothstep(0.0, uMouth, r);\n return mix(uBg, plate, mouth) + coreGlow(c) * (1.0 - mouth * 0.6);\n }\n\n // ── Field — flat colour gradients ──\n vec3 fieldCol(vec2 q, vec2 p){\n float s;\n vec2 dir = vec2(cos(uAngle), sin(uAngle));\n if (uType == 0) s = clamp(dot(q, dir) * 0.6 + 0.5, 0.0, 1.0); // linear\n else if (uType == 1) { float x = dot(q, dir) * uFreq - uTime * 0.1 * uSpin; s = abs(fract(x) * 2.0 - 1.0); } // stripe\n else if (uType == 2) s = clamp(length(q) * uFreq * 0.6, 0.0, 1.0); // radial\n else s = fract(atan(q.y, q.x) * 0.159155 + 0.5 + uAngle * 0.159155 - uTime * 0.05 * uSpin); // conic\n vec3 col = tint(uHue + s * uIrid);\n col *= mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.22); // soft vignette\n return col;\n }\n\n // ── Pole — influence fields ──\n vec3 poleCol(vec2 q){\n if (uType == 0) { // monopole\n vec2 src = vec2(sin(uTime * 0.2) * uSpread, cos(uTime * 0.17) * uSpread);\n float d = length(q - src);\n float infl = 1.0 / (1.0 + d * d * uFreq * 1.5);\n return tint(uHue + (1.0 - infl) * uIrid) + infl * infl * uSheen * 0.4;\n } else if (uType == 1) { // multipole (inverse-distance blend)\n vec3 acc = vec3(0.0); float wsum = 0.0;\n for (int i = 0; i < 5; i++) {\n if (i >= uCount) break;\n vec2 pp = blobPos(i);\n float d = distance(q, pp);\n float w = 1.0 / (d * d + 0.02);\n acc += poleColor(i) * w; wsum += w;\n }\n vec3 col = acc / max(wsum, 1e-4);\n float sh = pow(max(0.0, 0.5 + 0.5 * sin((q.x + q.y) * 3.1416 - uTime * 0.2)), 3.0);\n return col + sh * uSheen * 0.2;\n } else if (uType == 2) { // bilinear mesh (4 palette corners)\n vec2 g = clamp(q * 0.5 + 0.5, 0.0, 1.0);\n return mix(mix(poleColor(0), poleColor(1), g.x), mix(poleColor(2), poleColor(3), g.x), g.y);\n } else { // aurora — domain-warped fbm\n vec2 sp = q * 0.7;\n vec2 a = vec2(fbm(sp + vec2(0.0, uTime * 0.08)), fbm(sp + vec2(5.2, 1.3) - uTime * 0.08));\n vec2 b = vec2(fbm(sp + 1.6 * a + uTime * 0.06), fbm(sp + 1.6 * a + vec2(8.3, 2.8) - uTime * 0.06));\n float f = fbm(sp + 2.2 * b);\n return tint(uHue + (f * 0.5 + 0.5) * uIrid);\n }\n }\n\n // ── Volume — glossy 3D-reading forms ──\n vec3 volumeCol(vec2 q, vec2 p){\n if (uType == 0) { vec4 bl = blobLayer(q); return mix(uBg, bl.rgb, bl.a); }\n if (uType == 1) return spiralLayer(q);\n if (uType == 2) { // dome — glossy iridescent orb\n float R = uSize * 1.6;\n float rr = length(q) / R;\n vec3 col = uBg;\n if (rr < 1.0) {\n float h = sqrt(max(0.0, 1.0 - rr * rr));\n vec3 n = normalize(vec3(q / R, h));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.1 + (n.x * 0.5 + 0.5) * 0.5 + h * 0.4) + uTime * 0.05;\n col = applyLight(tint(ci), n);\n }\n return mix(uBg, col, smoothstep(1.02, 0.96, rr));\n }\n // ripple — concentric glossy ridges\n float e = 0.01;\n float k = uFreq * 3.0; float ph = uTime * uSpin * 1.5;\n float hC = 0.5 + 0.5 * sin(length(q) * k - ph);\n float hX = 0.5 + 0.5 * sin(length(q + vec2(e, 0.0)) * k - ph);\n float hY = 0.5 + 0.5 * sin(length(q + vec2(0.0, e)) * k - ph);\n vec2 gg = vec2(hX - hC, hY - hC) / e;\n vec3 n = normalize(vec3(-gg * uRelief * 0.15, 1.0));\n float ci = uHue + uIrid * (length(q) * 0.5 + hC * 0.4) + uTime * 0.04;\n vec3 col = applyLight(tint(ci), n);\n return col * mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.3);\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec2 wv = vec2(fbm(p*1.4 + uTime*0.05), fbm(p*1.4 + 7.3 - uTime*0.05));\n vec2 q = p + (wv - 0.5) * uWarp;\n\n vec3 col;\n if (uCat == 0) col = fieldCol(q, p);\n else if (uCat == 1) col = poleCol(q);\n else col = volumeCol(q, p);\n\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", W = (e) => {
113
118
  let t = parseInt(e.slice(1), 16);
114
- return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
115
- }, Ve = class {
119
+ return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
120
+ }, Je = class {
116
121
  constructor() {
117
122
  this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
118
123
  }
119
124
  init(e) {
120
- this.renderer = new T({
125
+ this.renderer = new D({
121
126
  canvas: e,
122
127
  antialias: !0,
123
128
  preserveDrawingBuffer: !0
124
- }), this.scene = new w(), this.cam = new E(), this.uniforms = {
129
+ }), this.scene = new E(), this.cam = new j(), this.uniforms = {
125
130
  uTime: { value: 0 },
126
131
  uAspect: { value: 1 },
127
132
  uCat: { value: 2 },
@@ -144,32 +149,37 @@ var Ne = {
144
149
  uPetals: { value: 9 },
145
150
  uSpin: { value: 1 },
146
151
  uMouth: { value: .5 },
147
- uBg: { value: V("#000000") },
148
- uColors: { value: n[0].cols.map(V) }
149
- }, this.mat = new S({
150
- vertexShader: ze,
151
- fragmentShader: Be,
152
+ uBg: { value: W("#000000") },
153
+ uColors: { value: r[0].cols.map(W) }
154
+ }, this.mat = new T({
155
+ vertexShader: Ke,
156
+ fragmentShader: qe,
152
157
  uniforms: this.uniforms
153
- }), this.scene.add(new A(new v(2, 2), this.mat));
158
+ }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
154
159
  }
155
160
  resize(e, t) {
156
161
  this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
157
162
  }
163
+ setPointer(e) {
164
+ if (!this.uniforms || !e) return;
165
+ let t = this.uniforms;
166
+ t.uHue.value = ((t.uHue.value + (e.x - .5) * .5) % 1 + 1) % 1, e.down && (t.uWarp.value = t.uWarp.value + .6);
167
+ }
158
168
  setParams(e) {
159
169
  if (!this.uniforms) return;
160
- let t = e.look ? s.find((t) => t.value === e.look) : null;
170
+ let t = e.look ? te.find((t) => t.value === e.look) : null;
161
171
  t?.p && (e = {
162
172
  ...e,
163
173
  ...t.p
164
174
  });
165
- let r = this.uniforms;
166
- if (e.cat != null && (r.uCat.value = Math.round(e.cat)), e.type != null && (r.uType.value = Math.round(e.type)), e.count != null && (r.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (r.uSize.value = e.size), e.spread != null && (r.uSpread.value = e.spread), e.irid != null && (r.uIrid.value = e.irid), e.hue != null && (r.uHue.value = e.hue), e.sheen != null && (r.uSheen.value = e.sheen), e.gloss != null && (r.uGloss.value = e.gloss), e.relief != null && (r.uRelief.value = e.relief), e.warp != null && (r.uWarp.value = e.warp), e.grain != null && (r.uGrain.value = e.grain), e.spectral != null && (r.uSpectral.value = +!!e.spectral), e.angle != null && (r.uAngle.value = e.angle), e.freq != null && (r.uFreq.value = e.freq), e.winds != null && (r.uWinds.value = e.winds), e.pitch != null && (r.uPitch.value = e.pitch), e.petals != null && (r.uPetals.value = e.petals), e.spin != null && (r.uSpin.value = e.spin), e.mouth != null && (r.uMouth.value = e.mouth), e.speed != null && (this.speed = e.speed), e.palette != null) {
167
- let t = n.find((t) => t.value === e.palette) || n[0];
168
- r.uColors.value = t.cols.map(V);
175
+ let n = this.uniforms;
176
+ if (e.cat != null && (n.uCat.value = Math.round(e.cat)), e.form != null && (n.uType.value = Math.round(e.form)), e.count != null && (n.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (n.uSize.value = e.size), e.spread != null && (n.uSpread.value = e.spread), e.irid != null && (n.uIrid.value = e.irid), e.hue != null && (n.uHue.value = e.hue), e.sheen != null && (n.uSheen.value = e.sheen), e.gloss != null && (n.uGloss.value = e.gloss), n.uRelief.value = e.relief ?? .9, e.warp != null && (n.uWarp.value = e.warp), e.grain != null && (n.uGrain.value = e.grain), e.spectral != null && (n.uSpectral.value = +!!e.spectral), e.angle != null && (n.uAngle.value = e.angle), n.uFreq.value = e.freq ?? 2, e.winds != null && (n.uWinds.value = e.winds), e.pitch != null && (n.uPitch.value = e.pitch), e.petals != null && (n.uPetals.value = e.petals), n.uSpin.value = e.spin ?? 1, e.mouth != null && (n.uMouth.value = e.mouth), e.speed != null && (this.speed = e.speed), e.palette != null) {
177
+ let t = r.find((t) => t.value === e.palette) || r[0];
178
+ n.uColors.value = t.cols.map(W);
169
179
  }
170
180
  if (e.backdrop != null) {
171
- let t = c.find((t) => t.value === e.backdrop) || c[0];
172
- r.uBg.value = V(t.col);
181
+ let t = o.find((t) => t.value === e.backdrop) || o[0];
182
+ n.uBg.value = W(t.col);
173
183
  }
174
184
  }
175
185
  setPlaying(e) {
@@ -194,27 +204,27 @@ var Ne = {
194
204
  });
195
205
  }
196
206
  destroy() {
197
- this.renderer &&= (this.renderer.dispose(), null);
207
+ this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
198
208
  }
199
- }, H = 5, He = {
209
+ }, G = 5, Ye = {
200
210
  teardrop: 0,
201
211
  pill: 1,
202
212
  dome: 2,
203
213
  super: 3,
204
214
  orb: 2
205
- }, Ue = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", We = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uCount;\n uniform float uHue, uIrid, uSheen, uGloss, uRim, uRimPow, uRimShift, uSSS;\n uniform float uBulge, uRelief, uMotion, uGrain, uSpectral, uEdge;\n uniform vec2 uDir, uBgFade;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n uniform float uType[5];\n uniform vec2 uPos[5];\n uniform vec2 uScale[5];\n uniform float uRot[5];\n uniform float uHueOff[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\n vec2 rot2(vec2 v, float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c) * v; }\n\n // Signed-ish distance for each form (negative inside). q is form-local\n // (centred, unrotated, divided by the form's scale → \"radius 1\" forms).\n float formDist(float ty, vec2 q){\n if (ty < 0.5) { // teardrop — ellipse tapered toward +y\n float taper = mix(1.0, 0.36, clamp(q.y * 0.5 + 0.5, 0.0, 1.0));\n return length(vec2(q.x / taper, q.y)) - 1.0;\n } else if (ty < 1.5) { // pill — horizontal capsule\n vec2 d = q; d.x = max(abs(d.x) - 0.58, 0.0);\n return length(d) - 0.5;\n } else if (ty < 2.5) { // dome / orb — ellipse\n return length(q) - 1.0;\n }\n vec2 e = pow(abs(q), vec2(3.4)); // superellipse — soft-cornered lozenge\n return pow(e.x + e.y, 1.0/3.4) - 1.0;\n }\n\n // Inside a form (d<0) the surface bulges up; sqrt gives spherical edge falloff.\n float heightOf(float d){ float t = clamp(-d / uBulge, 0.0, 1.0); return sqrt(t * (2.0 - t)); }\n\n // Procedural matcap: hue swept across the surface normal (the broad gradient\n // that flows over the volume) + baked soft key light + glossy hotspot +\n // coloured fresnel rim + a touch of subsurface glow at thin edges.\n vec3 shade(vec3 n, float hueOff, float h){\n float ci = uHue + hueOff + uIrid * (dot(n.xy, uDir) * 0.5 + 0.5);\n vec3 base = tint(ci);\n vec3 L = normalize(vec3(-0.35, 0.55, 0.85));\n float key = 0.5 + 0.5 * dot(n, L);\n base *= mix(0.6, 1.18, key);\n vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n base += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), uRimPow);\n base += tint(ci + uRimShift) * fres * uRim;\n base += base * (1.0 - clamp(h, 0.0, 1.0)) * uSSS;\n return base;\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec3 col = uBg;\n const float E = 0.012;\n\n for (int i = 0; i < 5; i++){\n if (float(i) >= uCount) break;\n vec2 pos = uPos[i] + uMotion * vec2(sin(uTime*0.40 + float(i)*1.7),\n cos(uTime*0.33 + float(i)*2.1)) * 0.05;\n float ty = uType[i];\n vec2 sc = uScale[i];\n float rt = uRot[i];\n\n vec2 q = rot2(p - pos, -rt) / sc;\n vec2 qx = rot2(p + vec2(E, 0.0) - pos, -rt) / sc;\n vec2 qy = rot2(p + vec2(0.0, E) - pos, -rt) / sc;\n float d = formDist(ty, q);\n float h = heightOf(d);\n vec2 g = vec2(heightOf(formDist(ty, qx)) - h,\n heightOf(formDist(ty, qy)) - h) / E;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n\n float a = smoothstep(uEdge, -uEdge, d);\n col = mix(col, shade(n, uHueOff[i], h), a);\n }\n\n col *= mix(1.0, smoothstep(uBgFade.y, uBgFade.x, length(p)), 0.18); // soft vignette\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", U = (e) => {
215
+ }, Xe = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Ze = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uCount;\n uniform float uHue, uIrid, uSheen, uGloss, uRim, uRimPow, uRimShift, uSSS;\n uniform float uBulge, uRelief, uMotion, uGrain, uSpectral, uEdge;\n uniform vec2 uDir, uBgFade;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n uniform float uType[5];\n uniform vec2 uPos[5];\n uniform vec2 uScale[5];\n uniform float uRot[5];\n uniform float uHueOff[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\n vec2 rot2(vec2 v, float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c) * v; }\n\n // Signed-ish distance for each form (negative inside). q is form-local\n // (centred, unrotated, divided by the form's scale → \"radius 1\" forms).\n float formDist(float ty, vec2 q){\n if (ty < 0.5) { // teardrop — ellipse tapered toward +y\n float taper = mix(1.0, 0.36, clamp(q.y * 0.5 + 0.5, 0.0, 1.0));\n return length(vec2(q.x / taper, q.y)) - 1.0;\n } else if (ty < 1.5) { // pill — horizontal capsule\n vec2 d = q; d.x = max(abs(d.x) - 0.58, 0.0);\n return length(d) - 0.5;\n } else if (ty < 2.5) { // dome / orb — ellipse\n return length(q) - 1.0;\n }\n vec2 e = pow(abs(q), vec2(3.4)); // superellipse — soft-cornered lozenge\n return pow(e.x + e.y, 1.0/3.4) - 1.0;\n }\n\n // Inside a form (d<0) the surface bulges up; sqrt gives spherical edge falloff.\n float heightOf(float d){ float t = clamp(-d / uBulge, 0.0, 1.0); return sqrt(t * (2.0 - t)); }\n\n // Procedural matcap: hue swept across the surface normal (the broad gradient\n // that flows over the volume) + baked soft key light + glossy hotspot +\n // coloured fresnel rim + a touch of subsurface glow at thin edges.\n vec3 shade(vec3 n, float hueOff, float h){\n float ci = uHue + hueOff + uIrid * (dot(n.xy, uDir) * 0.5 + 0.5);\n vec3 base = tint(ci);\n vec3 L = normalize(vec3(-0.35, 0.55, 0.85));\n float key = 0.5 + 0.5 * dot(n, L);\n base *= mix(0.6, 1.18, key);\n vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n base += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), uRimPow);\n base += tint(ci + uRimShift) * fres * uRim;\n base += base * (1.0 - clamp(h, 0.0, 1.0)) * uSSS;\n return base;\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec3 col = uBg;\n const float E = 0.012;\n\n for (int i = 0; i < 5; i++){\n if (float(i) >= uCount) break;\n vec2 pos = uPos[i] + uMotion * vec2(sin(uTime*0.40 + float(i)*1.7),\n cos(uTime*0.33 + float(i)*2.1)) * 0.05;\n float ty = uType[i];\n vec2 sc = uScale[i];\n float rt = uRot[i];\n\n vec2 q = rot2(p - pos, -rt) / sc;\n vec2 qx = rot2(p + vec2(E, 0.0) - pos, -rt) / sc;\n vec2 qy = rot2(p + vec2(0.0, E) - pos, -rt) / sc;\n float d = formDist(ty, q);\n float h = heightOf(d);\n vec2 g = vec2(heightOf(formDist(ty, qx)) - h,\n heightOf(formDist(ty, qy)) - h) / E;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n\n float a = smoothstep(uEdge, -uEdge, d);\n col = mix(col, shade(n, uHueOff[i], h), a);\n }\n\n col *= mix(1.0, smoothstep(uBgFade.y, uBgFade.x, length(p)), 0.18); // soft vignette\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", Qe = (e) => {
206
216
  let t = parseInt(e.slice(1), 16);
207
- return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
208
- }, Ge = class {
217
+ return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
218
+ }, $e = class {
209
219
  constructor() {
210
220
  this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
211
221
  }
212
222
  init(e) {
213
- this.renderer = new T({
223
+ this.renderer = new D({
214
224
  canvas: e,
215
225
  antialias: !0,
216
226
  preserveDrawingBuffer: !0
217
- }), this.scene = new w(), this.cam = new E(), this.uniforms = {
227
+ }), this.scene = new E(), this.cam = new j(), this.uniforms = {
218
228
  uTime: { value: 0 },
219
229
  uAspect: { value: 1 },
220
230
  uCount: { value: 3 },
@@ -232,38 +242,43 @@ var Ne = {
232
242
  uGrain: { value: .02 },
233
243
  uSpectral: { value: 0 },
234
244
  uEdge: { value: .02 },
235
- uDir: { value: new I(.3, .95) },
236
- uBgFade: { value: new I(.2, 1.9) },
237
- uBg: { value: U("#000000") },
238
- uColors: { value: n[0].cols.map(U) },
239
- uType: { value: Array(H).fill(2) },
240
- uPos: { value: Array.from({ length: H }, () => new I()) },
241
- uScale: { value: Array.from({ length: H }, () => new I(.6, .6)) },
242
- uRot: { value: Array(H).fill(0) },
243
- uHueOff: { value: Array(H).fill(0) }
244
- }, this.mat = new S({
245
- vertexShader: Ue,
246
- fragmentShader: We,
245
+ uDir: { value: new O(.3, .95) },
246
+ uBgFade: { value: new O(.2, 1.9) },
247
+ uBg: { value: Qe("#000000") },
248
+ uColors: { value: r[0].cols.map(Qe) },
249
+ uType: { value: Array(G).fill(2) },
250
+ uPos: { value: Array.from({ length: G }, () => new O()) },
251
+ uScale: { value: Array.from({ length: G }, () => new O(.6, .6)) },
252
+ uRot: { value: Array(G).fill(0) },
253
+ uHueOff: { value: Array(G).fill(0) }
254
+ }, this.mat = new T({
255
+ vertexShader: Xe,
256
+ fragmentShader: Ze,
247
257
  uniforms: this.uniforms
248
- }), this.scene.add(new A(new v(2, 2), this.mat));
258
+ }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
249
259
  }
250
260
  resize(e, t) {
251
261
  this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
252
262
  }
253
263
  setForms(e) {
254
264
  if (!this.uniforms || !e) return;
255
- let t = this.uniforms, n = e.slice(0, H);
265
+ let t = this.uniforms, n = e.slice(0, G);
256
266
  t.uCount.value = n.length || 1;
257
- for (let e = 0; e < H; e++) {
267
+ for (let e = 0; e < G; e++) {
258
268
  let r = n[e] || n[n.length - 1] || {};
259
- t.uType.value[e] = He[r.t] ?? 2, t.uPos.value[e].set(r.x ?? 0, r.y ?? 0);
269
+ t.uType.value[e] = Ye[r.t] ?? 2, t.uPos.value[e].set(r.x ?? 0, r.y ?? 0);
260
270
  let i = r.sx ?? .6;
261
271
  t.uScale.value[e].set(i, r.sy ?? i), t.uRot.value[e] = (r.rot ?? 0) * Math.PI / 180, t.uHueOff.value[e] = r.hue ?? 0;
262
272
  }
263
273
  }
274
+ setPointer(e) {
275
+ if (!this.uniforms || !e) return;
276
+ let t = this.uniforms;
277
+ t.uHue.value = t.uHue.value + (e.x - .5) * .4, e.down && (t.uBulge.value = Math.min(1.2, t.uBulge.value + .35));
278
+ }
264
279
  setParams(e) {
265
280
  if (!this.uniforms) return;
266
- let t = this.uniforms, r = {
281
+ let t = this.uniforms, n = {
267
282
  hue: "uHue",
268
283
  irid: "uIrid",
269
284
  sheen: "uSheen",
@@ -272,24 +287,23 @@ var Ne = {
272
287
  rimPow: "uRimPow",
273
288
  rimShift: "uRimShift",
274
289
  sss: "uSSS",
275
- bulge: "uBulge",
276
290
  relief: "uRelief",
277
291
  motion: "uMotion",
278
292
  grain: "uGrain",
279
293
  edge: "uEdge"
280
294
  };
281
- for (let n in r) e[n] != null && (t[r[n]].value = e[n]);
282
- if (e.spectral != null && (t.uSpectral.value = +!!e.spectral), e.sweep != null) {
295
+ for (let r in n) e[r] != null && (t[n[r]].value = e[r]);
296
+ if (t.uBulge.value = e.bulge ?? .55, e.spectral != null && (t.uSpectral.value = +!!e.spectral), e.sweep != null) {
283
297
  let n = e.sweep * Math.PI / 180;
284
298
  t.uDir.value.set(Math.sin(n), Math.cos(n));
285
299
  }
286
300
  if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
287
- let r = n.find((t) => t.value === e.palette) || n[0];
288
- t.uColors.value = r.cols.map(U);
301
+ let n = r.find((t) => t.value === e.palette) || r[0];
302
+ t.uColors.value = n.cols.map(Qe);
289
303
  }
290
304
  if (e.backdrop != null) {
291
- let n = c.find((t) => t.value === e.backdrop) || c[0];
292
- t.uBg.value = U(n.col);
305
+ let n = o.find((t) => t.value === e.backdrop) || o[0];
306
+ t.uBg.value = Qe(n.col);
293
307
  }
294
308
  }
295
309
  setPlaying(e) {
@@ -314,9 +328,9 @@ var Ne = {
314
328
  });
315
329
  }
316
330
  destroy() {
317
- this.renderer &&= (this.renderer.dispose(), null);
331
+ this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
318
332
  }
319
- }, W = 5, Ke = {
333
+ }, K = 5, et = {
320
334
  sphere: 0,
321
335
  orb: 0,
322
336
  capsule: 1,
@@ -324,19 +338,19 @@ var Ne = {
324
338
  teardrop: 2,
325
339
  lozenge: 3,
326
340
  super: 3
327
- }, qe = "varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy,0.,1.); }", Je = "\nprecision highp float;\nvarying vec2 vUv;\n\nuniform float uTime, uAspect, uCount;\nuniform float uTheta, uPhi, uDist;\nuniform float uHue, uIrid, uSheen, uGloss;\nuniform float uRim, uRimPow, uRimShift, uSSS;\nuniform float uMotion, uGrain, uSpectral, uMetaball;\nuniform vec2 uDir;\nuniform vec3 uBg;\nuniform vec3 uColors[5];\nuniform float uType[5];\nuniform vec3 uPos3[5];\nuniform vec3 uScale3[5];\nuniform float uRot3[5];\nuniform float uHueOff[5];\n\nfloat hash(vec2 p){ return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }\n\nvec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t+vec3(0.,0.333,0.667)));\n}\nvec3 ramp(float t){\n t = fract(t)*4.;\n int i = int(floor(t));\n return mix(uColors[i], uColors[i+1<5?i+1:4], fract(t));\n}\nvec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\nvec3 rotY(vec3 p, float a){ float c=cos(a),s=sin(a); return vec3(c*p.x+s*p.z,p.y,-s*p.x+c*p.z); }\n\nfloat sdSphere(vec3 q){ return length(q)-1.; }\nfloat sdCapsule(vec3 q){ q.y-=clamp(q.y,-0.5,0.5); return length(q)-0.5; }\nfloat sdTeardrop(vec3 q){\n float tp = mix(1.,0.36,clamp(q.y*0.5+0.5,0.,1.));\n return length(vec3(q.x/tp,q.y,q.z/tp))-1.;\n}\nfloat sdLozenge(vec3 q){\n vec3 a = pow(abs(q),vec3(3.4));\n return pow(a.x+a.y+a.z,1./3.4)-1.;\n}\n\n// Forms: return (dist, hueOff_of_nearest). Loop-index access of uHueOff[] is\n// safe in GLSL ES 1.00 (loop induction variable, not a dynamic expression).\nvec2 mapForms(vec3 p){\n vec2 res = vec2(1e9, 0.);\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.06;\n vec3 sc = uScale3[i];\n vec3 q = rotY(p-uPos3[i]-anim,-uRot3[i])/sc;\n float ty=uType[i],d;\n if (ty<.5) d=sdSphere(q);\n else if(ty<1.5)d=sdCapsule(q);\n else if(ty<2.5)d=sdTeardrop(q);\n else d=sdLozenge(q);\n d*=min(sc.x,min(sc.y,sc.z));\n if(d<res.x) res=vec2(d,uHueOff[i]);\n }\n return res;\n}\n\n// Metaballs: potential = Σ r²/(|p-c|²+ε); isosurface at potential = 1.\n// Animation amplitude 0.35 per axis so balls visibly cycle separated→merged.\nvec2 mapMeta(vec3 p){\n float field=0.,wh=0.,wsum=0.;\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.35;\n float r = uScale3[i].x;\n vec3 dv= p-uPos3[i]-anim;\n float w = r*r/(dot(dv,dv)+0.0001);\n field+=w; wh+=uHueOff[i]*w; wsum+=w;\n }\n return vec2(1.-field, wsum>0.?wh/wsum:0.);\n}\n\nvec2 map(vec3 p){ return uMetaball>.5 ? mapMeta(p) : mapForms(p); }\n\n// World-space surface normal via central difference\nvec3 calcNormal(vec3 p){\n const float E=0.002;\n return normalize(vec3(\n map(p+vec3(E,0,0)).x-map(p-vec3(E,0,0)).x,\n map(p+vec3(0,E,0)).x-map(p-vec3(0,E,0)).x,\n map(p+vec3(0,0,E)).x-map(p-vec3(0,0,E)).x\n ));\n}\n\n// AO: 6 samples along the world normal. Merge zones between metaballs have low\n// potential headroom → small d values → high occlusion → dark necks.\nfloat calcAO(vec3 p, vec3 n){\n float occ=0.,sca=1.;\n for(int i=1;i<=6;i++){\n float h = 0.006+0.08*float(i)/6.;\n float d = map(p+n*h).x;\n occ += max(h-d,0.)*sca;\n sca *= 0.87;\n }\n return clamp(1.-14.*occ, 0., 1.);\n}\n\n// Soft shadow: march from surface toward the world key light.\n// One metaball casts a soft shadow onto another → depth is unmistakable.\nfloat calcShadow(vec3 ro, vec3 rd){\n float sha=1.,t=0.02;\n for(int i=0;i<28;i++){\n float h=map(ro+rd*t).x;\n if(h<0.001) return 0.;\n sha=min(sha,8.*h/t);\n t+=clamp(h,0.01,0.18);\n if(sha<0.005||t>4.) break;\n }\n return clamp(sha,0.,1.);\n}\n\n// Shading: matcap iridescence (view-space) + world lighting (view-space L) + AO + shadow.\n// nv = view-space normal (n.z=1 faces camera).\n// Lv = world key light transformed to view space: diffuse changes as you orbit.\nvec3 shade(vec3 nv, float hueOff, float ao, float sha, vec3 Lv){\n float ci = uHue+hueOff+uIrid*(dot(nv.xy,uDir)*.5+.5);\n vec3 base = tint(ci);\n\n // Key: world-space light, so shading shifts as camera orbits\n float diff = max(dot(nv,Lv),0.);\n base *= mix(0.15,1.,diff*sha)*ao;\n\n // Cool fill from opposite quarter (unshadowed, softer)\n base += tint(ci+0.5)*max(dot(nv,normalize(-Lv+vec3(.2,-.1,0.))),0.)*0.09*ao;\n\n // Gloss specular\n vec3 H = normalize(Lv+vec3(0,0,1));\n base += pow(max(dot(nv,H),0.),uGloss)*uSheen*sha;\n\n // Coloured fresnel rim at silhouette\n float fres = pow(1.-clamp(nv.z,0.,1.),uRimPow);\n base += tint(ci+uRimShift)*fres*uRim;\n\n // SSS: scattered inner glow — most visible at metaball neck/thin spots\n base += tint(ci+0.5)*fres*fres*uSSS*0.5;\n\n return base;\n}\n\nvoid main(){\n vec2 uv = vUv*2.-1.;\n uv.x *= uAspect;\n\n // Orbit camera\n float cosPhi=cos(uPhi);\n vec3 ro = vec3(uDist*cosPhi*sin(uTheta), uDist*sin(uPhi), uDist*cosPhi*cos(uTheta));\n vec3 fwd = normalize(-ro);\n vec3 right = normalize(cross(fwd,vec3(0,1,0)));\n vec3 upV = cross(right,fwd);\n vec3 rd = normalize(fwd+uv.x*right*.9+uv.y*upV*.9);\n\n // World key light → view space (so diffuse changes as you orbit)\n vec3 L_w = normalize(vec3(-.4,.8,.6));\n vec3 Lv = normalize(vec3(dot(L_w,right),dot(L_w,upV),-dot(L_w,fwd)));\n\n vec3 col = uBg;\n float t = 0.1;\n float hitHue = 0.;\n bool didHit = false;\n\n for(int i=0;i<200;i++){\n vec3 p = ro+rd*t;\n vec2 r = map(p);\n if(r.x<0.0012){ hitHue=r.y; didHit=true; break; }\n float step = r.x*0.85;\n if(uMetaball>.5) step=clamp(r.x*0.45, 0.005, 0.13); // conservative: field isn't a true SDF\n t+=step;\n if(t>10.) break;\n }\n\n if(didHit){\n vec3 p = ro+rd*t;\n vec3 n = calcNormal(p); // world normal\n vec3 nv = normalize(vec3(dot(n,right),dot(n,upV),-dot(n,fwd))); // view normal\n\n float ao = calcAO(p, n);\n float sha = calcShadow(p+n*0.006, L_w);\n\n col = shade(nv, hitHue, ao, sha, Lv);\n }\n\n // Cinematic vignette\n col *= 1.-0.55*pow(dot(uv,uv)/2.,1.4);\n col += (hash(vUv*1920.+uTime)-.5)*uGrain;\n gl_FragColor = vec4(clamp(col,0.,1.),1.);\n}\n", G = (e) => {
341
+ }, tt = "varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy,0.,1.); }", nt = "\nprecision highp float;\nvarying vec2 vUv;\n\nuniform float uTime, uAspect, uCount;\nuniform float uTheta, uPhi, uDist;\nuniform float uHue, uIrid, uSheen, uGloss;\nuniform float uRim, uRimPow, uRimShift, uSSS;\nuniform float uMotion, uGrain, uSpectral, uMetaball;\nuniform vec2 uDir;\nuniform vec3 uBg;\nuniform vec3 uColors[5];\nuniform float uType[5];\nuniform vec3 uPos3[5];\nuniform vec3 uScale3[5];\nuniform float uRot3[5];\nuniform float uHueOff[5];\n\nfloat hash(vec2 p){ return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }\n\nvec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t+vec3(0.,0.333,0.667)));\n}\nvec3 ramp(float t){\n t = fract(t)*4.;\n int i = int(floor(t));\n return mix(uColors[i], uColors[i+1<5?i+1:4], fract(t));\n}\nvec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\nvec3 rotY(vec3 p, float a){ float c=cos(a),s=sin(a); return vec3(c*p.x+s*p.z,p.y,-s*p.x+c*p.z); }\n\nfloat sdSphere(vec3 q){ return length(q)-1.; }\nfloat sdCapsule(vec3 q){ q.y-=clamp(q.y,-0.5,0.5); return length(q)-0.5; }\nfloat sdTeardrop(vec3 q){\n float tp = mix(1.,0.36,clamp(q.y*0.5+0.5,0.,1.));\n return length(vec3(q.x/tp,q.y,q.z/tp))-1.;\n}\nfloat sdLozenge(vec3 q){\n vec3 a = pow(abs(q),vec3(3.4));\n return pow(a.x+a.y+a.z,1./3.4)-1.;\n}\n\n// Forms: return (dist, hueOff_of_nearest). Loop-index access of uHueOff[] is\n// safe in GLSL ES 1.00 (loop induction variable, not a dynamic expression).\nvec2 mapForms(vec3 p){\n vec2 res = vec2(1e9, 0.);\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.06;\n vec3 sc = uScale3[i];\n vec3 q = rotY(p-uPos3[i]-anim,-uRot3[i])/sc;\n float ty=uType[i],d;\n if (ty<.5) d=sdSphere(q);\n else if(ty<1.5)d=sdCapsule(q);\n else if(ty<2.5)d=sdTeardrop(q);\n else d=sdLozenge(q);\n d*=min(sc.x,min(sc.y,sc.z));\n if(d<res.x) res=vec2(d,uHueOff[i]);\n }\n return res;\n}\n\n// Metaballs: potential = Σ r²/(|p-c|²+ε); isosurface at potential = 1.\n// Animation amplitude 0.35 per axis so balls visibly cycle separated→merged.\nvec2 mapMeta(vec3 p){\n float field=0.,wh=0.,wsum=0.;\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.35;\n float r = uScale3[i].x;\n vec3 dv= p-uPos3[i]-anim;\n float w = r*r/(dot(dv,dv)+0.0001);\n field+=w; wh+=uHueOff[i]*w; wsum+=w;\n }\n return vec2(1.-field, wsum>0.?wh/wsum:0.);\n}\n\nvec2 map(vec3 p){ return uMetaball>.5 ? mapMeta(p) : mapForms(p); }\n\n// World-space surface normal via central difference\nvec3 calcNormal(vec3 p){\n const float E=0.002;\n return normalize(vec3(\n map(p+vec3(E,0,0)).x-map(p-vec3(E,0,0)).x,\n map(p+vec3(0,E,0)).x-map(p-vec3(0,E,0)).x,\n map(p+vec3(0,0,E)).x-map(p-vec3(0,0,E)).x\n ));\n}\n\n// AO: 6 samples along the world normal. Merge zones between metaballs have low\n// potential headroom → small d values → high occlusion → dark necks.\nfloat calcAO(vec3 p, vec3 n){\n float occ=0.,sca=1.;\n for(int i=1;i<=6;i++){\n float h = 0.006+0.08*float(i)/6.;\n float d = map(p+n*h).x;\n occ += max(h-d,0.)*sca;\n sca *= 0.87;\n }\n return clamp(1.-14.*occ, 0., 1.);\n}\n\n// Soft shadow: march from surface toward the world key light.\n// One metaball casts a soft shadow onto another → depth is unmistakable.\nfloat calcShadow(vec3 ro, vec3 rd){\n float sha=1.,t=0.02;\n for(int i=0;i<28;i++){\n float h=map(ro+rd*t).x;\n if(h<0.001) return 0.;\n sha=min(sha,8.*h/t);\n t+=clamp(h,0.01,0.18);\n if(sha<0.005||t>4.) break;\n }\n return clamp(sha,0.,1.);\n}\n\n// Shading: matcap iridescence (view-space) + world lighting (view-space L) + AO + shadow.\n// nv = view-space normal (n.z=1 faces camera).\n// Lv = world key light transformed to view space: diffuse changes as you orbit.\nvec3 shade(vec3 nv, float hueOff, float ao, float sha, vec3 Lv){\n float ci = uHue+hueOff+uIrid*(dot(nv.xy,uDir)*.5+.5);\n vec3 base = tint(ci);\n\n // Key: world-space light, so shading shifts as camera orbits\n float diff = max(dot(nv,Lv),0.);\n base *= mix(0.15,1.,diff*sha)*ao;\n\n // Cool fill from opposite quarter (unshadowed, softer)\n base += tint(ci+0.5)*max(dot(nv,normalize(-Lv+vec3(.2,-.1,0.))),0.)*0.09*ao;\n\n // Gloss specular\n vec3 H = normalize(Lv+vec3(0,0,1));\n base += pow(max(dot(nv,H),0.),uGloss)*uSheen*sha;\n\n // Coloured fresnel rim at silhouette\n float fres = pow(1.-clamp(nv.z,0.,1.),uRimPow);\n base += tint(ci+uRimShift)*fres*uRim;\n\n // SSS: scattered inner glow — most visible at metaball neck/thin spots\n base += tint(ci+0.5)*fres*fres*uSSS*0.5;\n\n return base;\n}\n\nvoid main(){\n vec2 uv = vUv*2.-1.;\n uv.x *= uAspect;\n\n // Orbit camera\n float cosPhi=cos(uPhi);\n vec3 ro = vec3(uDist*cosPhi*sin(uTheta), uDist*sin(uPhi), uDist*cosPhi*cos(uTheta));\n vec3 fwd = normalize(-ro);\n vec3 right = normalize(cross(fwd,vec3(0,1,0)));\n vec3 upV = cross(right,fwd);\n vec3 rd = normalize(fwd+uv.x*right*.9+uv.y*upV*.9);\n\n // World key light → view space (so diffuse changes as you orbit)\n vec3 L_w = normalize(vec3(-.4,.8,.6));\n vec3 Lv = normalize(vec3(dot(L_w,right),dot(L_w,upV),-dot(L_w,fwd)));\n\n vec3 col = uBg;\n float t = 0.1;\n float hitHue = 0.;\n bool didHit = false;\n\n for(int i=0;i<200;i++){\n vec3 p = ro+rd*t;\n vec2 r = map(p);\n if(r.x<0.0012){ hitHue=r.y; didHit=true; break; }\n float step = r.x*0.85;\n if(uMetaball>.5) step=clamp(r.x*0.45, 0.005, 0.13); // conservative: field isn't a true SDF\n t+=step;\n if(t>10.) break;\n }\n\n if(didHit){\n vec3 p = ro+rd*t;\n vec3 n = calcNormal(p); // world normal\n vec3 nv = normalize(vec3(dot(n,right),dot(n,upV),-dot(n,fwd))); // view normal\n\n float ao = calcAO(p, n);\n float sha = calcShadow(p+n*0.006, L_w);\n\n col = shade(nv, hitHue, ao, sha, Lv);\n }\n\n // Cinematic vignette\n col *= 1.-0.55*pow(dot(uv,uv)/2.,1.4);\n col += (hash(vUv*1920.+uTime)-.5)*uGrain;\n gl_FragColor = vec4(clamp(col,0.,1.),1.);\n}\n", rt = (e) => {
328
342
  let t = parseInt(e.slice(1), 16);
329
- return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
330
- }, Ye = class {
343
+ return new I((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
344
+ }, it = class {
331
345
  constructor() {
332
346
  this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
333
347
  }
334
348
  init(e) {
335
- this.renderer = new T({
349
+ this.renderer = new D({
336
350
  canvas: e,
337
351
  antialias: !0,
338
352
  preserveDrawingBuffer: !0
339
- }), this.scene = new w(), this.cam = new E(), this.uniforms = {
353
+ }), this.scene = new E(), this.cam = new j(), this.uniforms = {
340
354
  uTime: { value: 0 },
341
355
  uAspect: { value: 1 },
342
356
  uCount: { value: 1 },
@@ -355,19 +369,19 @@ var Ne = {
355
369
  uGrain: { value: .018 },
356
370
  uSpectral: { value: 1 },
357
371
  uMetaball: { value: 0 },
358
- uDir: { value: new I(.3, .95) },
359
- uBg: { value: G("#000000") },
360
- uColors: { value: n[0].cols.map(G) },
361
- uType: { value: Array(W).fill(0) },
362
- uPos3: { value: Array.from({ length: W }, () => new j()) },
363
- uScale3: { value: Array.from({ length: W }, () => new j(.7, .7, .7)) },
364
- uRot3: { value: Array(W).fill(0) },
365
- uHueOff: { value: Array(W).fill(0) }
366
- }, this.mat = new S({
367
- vertexShader: qe,
368
- fragmentShader: Je,
372
+ uDir: { value: new O(.3, .95) },
373
+ uBg: { value: rt("#000000") },
374
+ uColors: { value: r[0].cols.map(rt) },
375
+ uType: { value: Array(K).fill(0) },
376
+ uPos3: { value: Array.from({ length: K }, () => new I()) },
377
+ uScale3: { value: Array.from({ length: K }, () => new I(.7, .7, .7)) },
378
+ uRot3: { value: Array(K).fill(0) },
379
+ uHueOff: { value: Array(K).fill(0) }
380
+ }, this.mat = new T({
381
+ vertexShader: tt,
382
+ fragmentShader: nt,
369
383
  uniforms: this.uniforms
370
- }), this.scene.add(new A(new v(2, 2), this.mat));
384
+ }), this.geo = new S(2, 2), this.scene.add(new C(this.geo, this.mat));
371
385
  }
372
386
  resize(e, t) {
373
387
  this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
@@ -377,18 +391,18 @@ var Ne = {
377
391
  }
378
392
  setForms(e) {
379
393
  if (!this.uniforms || !e) return;
380
- let t = this.uniforms, n = e.slice(0, W);
394
+ let t = this.uniforms, n = e.slice(0, K);
381
395
  t.uCount.value = n.length || 1;
382
- for (let e = 0; e < W; e++) {
396
+ for (let e = 0; e < K; e++) {
383
397
  let r = n[e] || {};
384
- t.uType.value[e] = Ke[r.t] ?? 0, t.uPos3.value[e].set(r.x ?? 0, r.y ?? 0, r.z ?? 0);
398
+ t.uType.value[e] = et[r.t] ?? 0, t.uPos3.value[e].set(r.x ?? 0, r.y ?? 0, r.z ?? 0);
385
399
  let i = r.sx ?? .7;
386
400
  t.uScale3.value[e].set(i, r.sy ?? i, r.sz ?? i), t.uRot3.value[e] = (r.rot ?? 0) * Math.PI / 180, t.uHueOff.value[e] = r.hue ?? 0;
387
401
  }
388
402
  }
389
403
  setParams(e) {
390
404
  if (!this.uniforms) return;
391
- let t = this.uniforms, r = {
405
+ let t = this.uniforms, n = {
392
406
  hue: "uHue",
393
407
  irid: "uIrid",
394
408
  sheen: "uSheen",
@@ -400,18 +414,18 @@ var Ne = {
400
414
  motion: "uMotion",
401
415
  grain: "uGrain"
402
416
  };
403
- for (let n in r) e[n] != null && (t[r[n]].value = e[n]);
417
+ for (let r in n) e[r] != null && (t[n[r]].value = e[r]);
404
418
  if (e.spectral != null && (t.uSpectral.value = +!!e.spectral), e.metaball != null && (t.uMetaball.value = +!!e.metaball), e.sweep != null) {
405
419
  let n = e.sweep * Math.PI / 180;
406
420
  t.uDir.value.set(Math.sin(n), Math.cos(n));
407
421
  }
408
422
  if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
409
- let r = n.find((t) => t.value === e.palette) || n[0];
410
- t.uColors.value = r.cols.map(G);
423
+ let n = r.find((t) => t.value === e.palette) || r[0];
424
+ t.uColors.value = n.cols.map(rt);
411
425
  }
412
426
  if (e.backdrop != null) {
413
- let n = c.find((t) => t.value === e.backdrop) || c[0];
414
- t.uBg.value = G(n.col);
427
+ let n = o.find((t) => t.value === e.backdrop) || o[0];
428
+ t.uBg.value = rt(n.col);
415
429
  }
416
430
  }
417
431
  setPlaying(e) {
@@ -436,43 +450,51 @@ var Ne = {
436
450
  });
437
451
  }
438
452
  destroy() {
439
- this.renderer &&= (this.renderer.dispose(), null);
453
+ this.mat?.dispose(), this.geo?.dispose(), this.renderer &&= (this.renderer.dispose(), null);
440
454
  }
441
- }, K = new j();
442
- function q(e, t, n, r, i, a) {
455
+ }, q = new I();
456
+ function J(e, t, n, r, i, a) {
443
457
  let o = 2 * Math.PI * i / 4, s = Math.max(a - 2 * i, 0), c = Math.PI / 4;
444
- K.copy(t), K[r] = 0, K.normalize();
445
- let l = .5 * o / (o + s), u = 1 - K.angleTo(e) / c;
446
- return Math.sign(K[n]) === 1 ? u * l : s / (o + s) + l + l * (1 - u);
458
+ q.copy(t), q[r] = 0, q.normalize();
459
+ let l = .5 * o / (o + s), u = 1 - q.angleTo(e) / c;
460
+ return Math.sign(q[n]) === 1 ? u * l : s / (o + s) + l + l * (1 - u);
447
461
  }
448
- var Xe = class extends _e {
462
+ var at = class e extends F {
449
463
  constructor(e = 1, t = 1, n = 1, r = 2, i = .1) {
450
- if (r = r * 2 + 1, i = Math.min(e / 2, t / 2, n / 2, i), super(1, 1, 1, r, r, r), r === 1) return;
451
- let a = this.toNonIndexed();
452
- this.index = null, this.attributes.position = a.attributes.position, this.attributes.normal = a.attributes.normal, this.attributes.uv = a.attributes.uv;
453
- let o = new j(), s = new j(), c = new j(e, t, n).divideScalar(2).subScalar(i), l = this.attributes.position.array, u = this.attributes.normal.array, d = this.attributes.uv.array, f = l.length / 6, p = new j(), m = .5 / r;
454
- for (let r = 0, a = 0; r < l.length; r += 3, a += 2) switch (o.fromArray(l, r), s.copy(o), s.x -= Math.sign(s.x) * m, s.y -= Math.sign(s.y) * m, s.z -= Math.sign(s.z) * m, s.normalize(), l[r + 0] = c.x * Math.sign(o.x) + s.x * i, l[r + 1] = c.y * Math.sign(o.y) + s.y * i, l[r + 2] = c.z * Math.sign(o.z) + s.z * i, u[r + 0] = s.x, u[r + 1] = s.y, u[r + 2] = s.z, Math.floor(r / f)) {
464
+ let a = r * 2 + 1;
465
+ if (i = Math.min(e / 2, t / 2, n / 2, i), super(1, 1, 1, a, a, a), this.type = "RoundedBoxGeometry", this.parameters = {
466
+ width: e,
467
+ height: t,
468
+ depth: n,
469
+ segments: r,
470
+ radius: i
471
+ }, a === 1) return;
472
+ let o = this.toNonIndexed();
473
+ this.index = null, this.attributes.position = o.attributes.position, this.attributes.normal = o.attributes.normal, this.attributes.uv = o.attributes.uv;
474
+ let s = new I(), c = new I(), l = new I(e, t, n).divideScalar(2).subScalar(i), u = this.attributes.position.array, d = this.attributes.normal.array, f = this.attributes.uv.array, p = u.length / 6, m = new I(), h = .5 / a;
475
+ for (let r = 0, a = 0; r < u.length; r += 3, a += 2) switch (s.fromArray(u, r), c.copy(s), c.x -= Math.sign(c.x) * h, c.y -= Math.sign(c.y) * h, c.z -= Math.sign(c.z) * h, c.normalize(), u[r + 0] = l.x * Math.sign(s.x) + c.x * i, u[r + 1] = l.y * Math.sign(s.y) + c.y * i, u[r + 2] = l.z * Math.sign(s.z) + c.z * i, d[r + 0] = c.x, d[r + 1] = c.y, d[r + 2] = c.z, Math.floor(r / p)) {
455
476
  case 0:
456
- p.set(1, 0, 0), d[a + 0] = q(p, s, "z", "y", i, n), d[a + 1] = 1 - q(p, s, "y", "z", i, t);
477
+ m.set(1, 0, 0), f[a + 0] = J(m, c, "z", "y", i, n), f[a + 1] = 1 - J(m, c, "y", "z", i, t);
457
478
  break;
458
479
  case 1:
459
- p.set(-1, 0, 0), d[a + 0] = 1 - q(p, s, "z", "y", i, n), d[a + 1] = 1 - q(p, s, "y", "z", i, t);
480
+ m.set(-1, 0, 0), f[a + 0] = 1 - J(m, c, "z", "y", i, n), f[a + 1] = 1 - J(m, c, "y", "z", i, t);
460
481
  break;
461
482
  case 2:
462
- p.set(0, 1, 0), d[a + 0] = 1 - q(p, s, "x", "z", i, e), d[a + 1] = q(p, s, "z", "x", i, n);
483
+ m.set(0, 1, 0), f[a + 0] = 1 - J(m, c, "x", "z", i, e), f[a + 1] = J(m, c, "z", "x", i, n);
463
484
  break;
464
485
  case 3:
465
- p.set(0, -1, 0), d[a + 0] = 1 - q(p, s, "x", "z", i, e), d[a + 1] = 1 - q(p, s, "z", "x", i, n);
486
+ m.set(0, -1, 0), f[a + 0] = 1 - J(m, c, "x", "z", i, e), f[a + 1] = 1 - J(m, c, "z", "x", i, n);
466
487
  break;
467
488
  case 4:
468
- p.set(0, 0, 1), d[a + 0] = 1 - q(p, s, "x", "y", i, e), d[a + 1] = 1 - q(p, s, "y", "x", i, t);
469
- break;
470
- case 5:
471
- p.set(0, 0, -1), d[a + 0] = q(p, s, "x", "y", i, e), d[a + 1] = 1 - q(p, s, "y", "x", i, t);
489
+ m.set(0, 0, 1), f[a + 0] = 1 - J(m, c, "x", "y", i, e), f[a + 1] = 1 - J(m, c, "y", "x", i, t);
472
490
  break;
491
+ case 5: m.set(0, 0, -1), f[a + 0] = J(m, c, "x", "y", i, e), f[a + 1] = 1 - J(m, c, "y", "x", i, t);
473
492
  }
474
493
  }
475
- }, Ze = new xe(), J = new j(), Qe = class extends je {
494
+ static fromJSON(t) {
495
+ return new e(t.width, t.height, t.depth, t.segments, t.radius);
496
+ }
497
+ }, ot = new we(), st = new I(), ct = class extends ae {
476
498
  constructor() {
477
499
  super(), this.isLineSegmentsGeometry = !0, this.type = "LineSegmentsGeometry", this.setIndex([
478
500
  0,
@@ -493,7 +515,7 @@ var Xe = class extends _e {
493
515
  6,
494
516
  7,
495
517
  5
496
- ]), this.setAttribute("position", new L([
518
+ ]), this.setAttribute("position", new V([
497
519
  -1,
498
520
  2,
499
521
  0,
@@ -518,7 +540,7 @@ var Xe = class extends _e {
518
540
  1,
519
541
  -1,
520
542
  0
521
- ], 3)), this.setAttribute("uv", new L([
543
+ ], 3)), this.setAttribute("uv", new V([
522
544
  -1,
523
545
  2,
524
546
  1,
@@ -544,14 +566,14 @@ var Xe = class extends _e {
544
566
  setPositions(e) {
545
567
  let t;
546
568
  e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
547
- let n = new ue(t, 6, 1);
548
- return this.setAttribute("instanceStart", new b(n, 3, 0)), this.setAttribute("instanceEnd", new b(n, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this;
569
+ let n = new pe(t, 6, 1);
570
+ return this.setAttribute("instanceStart", new x(n, 3, 0)), this.setAttribute("instanceEnd", new x(n, 3, 3)), this.instanceCount = this.attributes.instanceStart.count, this.computeBoundingBox(), this.computeBoundingSphere(), this;
549
571
  }
550
572
  setColors(e) {
551
573
  let t;
552
574
  e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
553
- let n = new ue(t, 6, 1);
554
- return this.setAttribute("instanceColorStart", new b(n, 3, 0)), this.setAttribute("instanceColorEnd", new b(n, 3, 3)), this;
575
+ let n = new pe(t, 6, 1);
576
+ return this.setAttribute("instanceColorStart", new x(n, 3, 0)), this.setAttribute("instanceColorEnd", new x(n, 3, 3)), this;
555
577
  }
556
578
  fromWireframeGeometry(e) {
557
579
  return this.setPositions(e.attributes.position.array), this;
@@ -560,57 +582,54 @@ var Xe = class extends _e {
560
582
  return this.setPositions(e.attributes.position.array), this;
561
583
  }
562
584
  fromMesh(e) {
563
- return this.fromWireframeGeometry(new Ee(e.geometry)), this;
585
+ return this.fromWireframeGeometry(new De(e.geometry)), this;
564
586
  }
565
587
  fromLineSegments(e) {
566
588
  let t = e.geometry;
567
589
  return this.setPositions(t.attributes.position.array), this;
568
590
  }
569
591
  computeBoundingBox() {
570
- this.boundingBox === null && (this.boundingBox = new xe());
592
+ this.boundingBox === null && (this.boundingBox = new we());
571
593
  let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
572
- e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), Ze.setFromBufferAttribute(t), this.boundingBox.union(Ze));
594
+ e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), ot.setFromBufferAttribute(t), this.boundingBox.union(ot));
573
595
  }
574
596
  computeBoundingSphere() {
575
- this.boundingSphere === null && (this.boundingSphere = new De()), this.boundingBox === null && this.computeBoundingBox();
597
+ this.boundingSphere === null && (this.boundingSphere = new xe()), this.boundingBox === null && this.computeBoundingBox();
576
598
  let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
577
599
  if (e !== void 0 && t !== void 0) {
578
600
  let n = this.boundingSphere.center;
579
601
  this.boundingBox.getCenter(n);
580
602
  let r = 0;
581
- for (let i = 0, a = e.count; i < a; i++) J.fromBufferAttribute(e, i), r = Math.max(r, n.distanceToSquared(J)), J.fromBufferAttribute(t, i), r = Math.max(r, n.distanceToSquared(J));
603
+ for (let i = 0, a = e.count; i < a; i++) st.fromBufferAttribute(e, i), r = Math.max(r, n.distanceToSquared(st)), st.fromBufferAttribute(t, i), r = Math.max(r, n.distanceToSquared(st));
582
604
  this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
583
605
  }
584
606
  }
585
607
  toJSON() {}
586
- applyMatrix(e) {
587
- return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(e);
588
- }
589
608
  };
590
- g.line = {
609
+ N.line = {
591
610
  worldUnits: { value: 1 },
592
611
  linewidth: { value: 1 },
593
- resolution: { value: new I(1, 1) },
612
+ resolution: { value: new O() },
594
613
  dashOffset: { value: 0 },
595
614
  dashScale: { value: 1 },
596
615
  dashSize: { value: 1 },
597
616
  gapSize: { value: 1 }
598
- }, x.line = {
599
- uniforms: D.merge([
600
- g.common,
601
- g.fog,
602
- g.line
617
+ }, L.line = {
618
+ uniforms: P.merge([
619
+ N.common,
620
+ N.fog,
621
+ N.line
603
622
  ]),
604
- vertexShader: "\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n uniform float linewidth;\n uniform vec2 resolution;\n\n attribute vec3 instanceStart;\n attribute vec3 instanceEnd;\n\n attribute vec3 instanceColorStart;\n attribute vec3 instanceColorEnd;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #ifdef USE_DASH\n\n uniform float dashScale;\n attribute float instanceDistanceStart;\n attribute float instanceDistanceEnd;\n varying float vLineDistance;\n\n #endif\n\n void trimSegment( const in vec4 start, inout vec4 end ) {\n\n // trim end segment so it terminates between the camera plane and the near plane\n\n // conservative estimate of the near plane\n float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n float nearEstimate = - 0.5 * b / a;\n\n float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n end.xyz = mix( start.xyz, end.xyz, alpha );\n\n }\n\n void main() {\n\n #ifdef USE_COLOR\n\n vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n #endif\n\n #ifdef USE_DASH\n\n vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n vUv = uv;\n\n #endif\n\n float aspect = resolution.x / resolution.y;\n\n // camera space\n vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n #ifdef WORLD_UNITS\n\n worldStart = start.xyz;\n worldEnd = end.xyz;\n\n #else\n\n vUv = uv;\n\n #endif\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n\n bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n if ( perspective ) {\n\n if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n trimSegment( start, end );\n\n } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n trimSegment( end, start );\n\n }\n\n }\n\n // clip space\n vec4 clipStart = projectionMatrix * start;\n vec4 clipEnd = projectionMatrix * end;\n\n // ndc space\n vec3 ndcStart = clipStart.xyz / clipStart.w;\n vec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd.xy - ndcStart.xy;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize( dir );\n\n #ifdef WORLD_UNITS\n\n vec3 worldDir = normalize( end.xyz - start.xyz );\n vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n vec3 worldFwd = cross( worldDir, worldUp );\n worldPos = position.y < 0.5 ? start: end;\n\n // height offset\n float hw = linewidth * 0.5;\n worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n // don't extend the line if we're rendering dashes because we\n // won't be rendering the endcaps\n #ifndef USE_DASH\n\n // cap extension\n worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n // add width to the box\n worldPos.xyz += worldFwd * hw;\n\n // endcaps\n if ( position.y > 1.0 || position.y < 0.0 ) {\n\n worldPos.xyz -= worldFwd * 2.0 * hw;\n\n }\n\n #endif\n\n // project the worldpos\n vec4 clip = projectionMatrix * worldPos;\n\n // shift the depth of the projected points so the line\n // segments overlap neatly\n vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n clip.z = clipPose.z * clip.w;\n\n #else\n\n vec2 offset = vec2( dir.y, - dir.x );\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n // endcaps\n if ( position.y < 0.0 ) {\n\n offset += - dir;\n\n } else if ( position.y > 1.0 ) {\n\n offset += dir;\n\n }\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n offset /= resolution.y;\n\n // select end\n vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n\n clip.xy += offset;\n\n #endif\n\n gl_Position = clip;\n\n vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n }\n ",
605
- fragmentShader: "\n uniform vec3 diffuse;\n uniform float opacity;\n uniform float linewidth;\n\n #ifdef USE_DASH\n\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n #endif\n\n varying float vLineDistance;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n float mua;\n float mub;\n\n vec3 p13 = p1 - p3;\n vec3 p43 = p4 - p3;\n\n vec3 p21 = p2 - p1;\n\n float d1343 = dot( p13, p43 );\n float d4321 = dot( p43, p21 );\n float d1321 = dot( p13, p21 );\n float d4343 = dot( p43, p43 );\n float d2121 = dot( p21, p21 );\n\n float denom = d2121 * d4343 - d4321 * d4321;\n\n float numer = d1343 * d4321 - d1321 * d4343;\n\n mua = numer / denom;\n mua = clamp( mua, 0.0, 1.0 );\n mub = ( d1343 + d4321 * ( mua ) ) / d4343;\n mub = clamp( mub, 0.0, 1.0 );\n\n return vec2( mua, mub );\n\n }\n\n void main() {\n\n #include <clipping_planes_fragment>\n\n #ifdef USE_DASH\n\n if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n #endif\n\n float alpha = opacity;\n\n #ifdef WORLD_UNITS\n\n // Find the closest points on the view ray and the line segment\n vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n vec3 lineDir = worldEnd - worldStart;\n vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n vec3 p1 = worldStart + lineDir * params.x;\n vec3 p2 = rayEnd * params.y;\n vec3 delta = p1 - p2;\n float len = length( delta );\n float norm = len / linewidth;\n\n #ifndef USE_DASH\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n float dnorm = fwidth( norm );\n alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n #else\n\n if ( norm > 0.5 ) {\n\n discard;\n\n }\n\n #endif\n\n #endif\n\n #else\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n // artifacts appear on some hardware if a derivative is taken within a conditional\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n float dlen = fwidth( len2 );\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n }\n\n #else\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n\n if ( len2 > 1.0 ) discard;\n\n }\n\n #endif\n\n #endif\n\n vec4 diffuseColor = vec4( diffuse, alpha );\n\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n }\n "
623
+ vertexShader: "\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n uniform float linewidth;\n uniform vec2 resolution;\n\n attribute vec3 instanceStart;\n attribute vec3 instanceEnd;\n\n attribute vec3 instanceColorStart;\n attribute vec3 instanceColorEnd;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #ifdef USE_DASH\n\n uniform float dashScale;\n attribute float instanceDistanceStart;\n attribute float instanceDistanceEnd;\n varying float vLineDistance;\n\n #endif\n\n float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {\n\n // compute the interpolation factor needed to trim the segment so it terminates\n // between the camera plane and the near plane\n\n // conservative estimate of the near plane\n float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\n // we need different nearEstimate formula for reversed and default depth buffer\n // a is positive with a reversed depth buffer so it can be used for controlling the code flow\n float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );\n\n return ( nearEstimate - start.z ) / ( end.z - start.z );\n\n }\n\n void main() {\n\n #ifdef USE_COLOR\n\n vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n #endif\n\n float aspect = resolution.x / resolution.y;\n\n // camera space\n vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n #ifdef USE_DASH\n\n float lineDistanceStart = dashScale * instanceDistanceStart;\n float lineDistanceEnd = dashScale * instanceDistanceEnd;\n\n #endif\n\n #ifdef WORLD_UNITS\n\n worldStart = start.xyz;\n worldEnd = end.xyz;\n\n #else\n\n vUv = uv;\n\n #endif\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n\n bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n if ( perspective ) {\n\n if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n float alpha = trimSegmentAlpha( start, end );\n end.xyz = mix( start.xyz, end.xyz, alpha );\n\n #ifdef USE_DASH\n\n lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );\n\n #endif\n\n } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n float alpha = trimSegmentAlpha( end, start );\n start.xyz = mix( end.xyz, start.xyz, alpha );\n\n #ifdef USE_DASH\n\n lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );\n\n #endif\n\n }\n\n }\n\n #ifdef USE_DASH\n\n vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;\n vUv = uv;\n\n #endif\n\n // clip space\n vec4 clipStart = projectionMatrix * start;\n vec4 clipEnd = projectionMatrix * end;\n\n // ndc space\n vec3 ndcStart = clipStart.xyz / clipStart.w;\n vec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd.xy - ndcStart.xy;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize( dir );\n\n #ifdef WORLD_UNITS\n\n vec3 worldDir = normalize( end.xyz - start.xyz );\n vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n vec3 worldFwd = cross( worldDir, worldUp );\n worldPos = position.y < 0.5 ? start: end;\n\n // height offset\n float hw = linewidth * 0.5;\n worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n // don't extend the line if we're rendering dashes because we\n // won't be rendering the endcaps\n #ifndef USE_DASH\n\n // cap extension\n worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n // add width to the box\n worldPos.xyz += worldFwd * hw;\n\n // endcaps\n if ( position.y > 1.0 || position.y < 0.0 ) {\n\n worldPos.xyz -= worldFwd * 2.0 * hw;\n\n }\n\n #endif\n\n // project the worldpos\n vec4 clip = projectionMatrix * worldPos;\n\n // shift the depth of the projected points so the line\n // segments overlap neatly\n vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n clip.z = clipPose.z * clip.w;\n\n #else\n\n vec2 offset = vec2( dir.y, - dir.x );\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n // endcaps\n if ( position.y < 0.0 ) {\n\n offset += - dir;\n\n } else if ( position.y > 1.0 ) {\n\n offset += dir;\n\n }\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n offset /= resolution.y;\n\n // select end\n vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n\n clip.xy += offset;\n\n #endif\n\n gl_Position = clip;\n\n vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n }\n ",
624
+ fragmentShader: "\n uniform vec3 diffuse;\n uniform float opacity;\n uniform float linewidth;\n\n #ifdef USE_DASH\n\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n #endif\n\n varying float vLineDistance;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n float mua;\n float mub;\n\n vec3 p13 = p1 - p3;\n vec3 p43 = p4 - p3;\n\n vec3 p21 = p2 - p1;\n\n float d1343 = dot( p13, p43 );\n float d4321 = dot( p43, p21 );\n float d1321 = dot( p13, p21 );\n float d4343 = dot( p43, p43 );\n float d2121 = dot( p21, p21 );\n\n float denom = d2121 * d4343 - d4321 * d4321;\n\n float numer = d1343 * d4321 - d1321 * d4343;\n\n mua = numer / denom;\n mua = clamp( mua, 0.0, 1.0 );\n mub = ( d1343 + d4321 * ( mua ) ) / d4343;\n mub = clamp( mub, 0.0, 1.0 );\n\n return vec2( mua, mub );\n\n }\n\n void main() {\n\n float alpha = opacity;\n vec4 diffuseColor = vec4( diffuse, alpha );\n\n #include <clipping_planes_fragment>\n\n #ifdef USE_DASH\n\n if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n #endif\n\n #ifdef WORLD_UNITS\n\n // Find the closest points on the view ray and the line segment\n vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n vec3 lineDir = worldEnd - worldStart;\n vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n vec3 p1 = worldStart + lineDir * params.x;\n vec3 p2 = rayEnd * params.y;\n vec3 delta = p1 - p2;\n float len = length( delta );\n float norm = len / linewidth;\n\n #ifndef USE_DASH\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n float dnorm = fwidth( norm );\n alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n #else\n\n if ( norm > 0.5 ) {\n\n discard;\n\n }\n\n #endif\n\n #endif\n\n #else\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n // artifacts appear on some hardware if a derivative is taken within a conditional\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n float dlen = fwidth( len2 );\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n }\n\n #else\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n\n if ( len2 > 1.0 ) discard;\n\n }\n\n #endif\n\n #endif\n\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n }\n "
606
625
  };
607
- var $e = class extends S {
626
+ var lt = class extends T {
608
627
  constructor(e) {
609
628
  super({
610
629
  type: "LineMaterial",
611
- uniforms: D.clone(x.line.uniforms),
612
- vertexShader: x.line.vertexShader,
613
- fragmentShader: x.line.fragmentShader,
630
+ uniforms: P.clone(L.line.uniforms),
631
+ vertexShader: L.line.vertexShader,
632
+ fragmentShader: L.line.fragmentShader,
614
633
  clipping: !0
615
634
  }), this.isLineMaterial = !0, this.setValues(e);
616
635
  }
@@ -624,7 +643,7 @@ var $e = class extends S {
624
643
  return "WORLD_UNITS" in this.defines;
625
644
  }
626
645
  set worldUnits(e) {
627
- e === !0 ? this.defines.WORLD_UNITS = "" : delete this.defines.WORLD_UNITS;
646
+ e === !0 !== this.worldUnits && (this.needsUpdate = !0), e === !0 ? this.defines.WORLD_UNITS = "" : delete this.defines.WORLD_UNITS;
628
647
  }
629
648
  get linewidth() {
630
649
  return this.uniforms.linewidth.value;
@@ -680,57 +699,47 @@ var $e = class extends S {
680
699
  set alphaToCoverage(e) {
681
700
  this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
682
701
  }
683
- }, et = new j(), tt = new j(), nt = new ke(), rt = class extends A {
684
- constructor(e = new Qe(), t = new $e({ color: Math.random() * 16777215 })) {
702
+ }, ut = new I(), dt = new I(), ft = new Ie(), pt = class extends C {
703
+ constructor(e = new ct(), t = new lt({ color: Math.random() * 16777215 })) {
685
704
  super(e, t), this.isWireframe = !0, this.type = "Wireframe";
686
705
  }
687
706
  computeLineDistances() {
688
707
  let e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, r = new Float32Array(2 * t.count);
689
- for (let e = 0, i = 0, a = t.count; e < a; e++, i += 2) et.fromBufferAttribute(t, e), tt.fromBufferAttribute(n, e), r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + et.distanceTo(tt);
690
- let i = new ue(r, 2, 1);
691
- return e.setAttribute("instanceDistanceStart", new b(i, 1, 0)), e.setAttribute("instanceDistanceEnd", new b(i, 1, 1)), this;
708
+ for (let e = 0, i = 0, a = t.count; e < a; e++, i += 2) ut.fromBufferAttribute(t, e), dt.fromBufferAttribute(n, e), r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + ut.distanceTo(dt);
709
+ let i = new pe(r, 2, 1);
710
+ return e.setAttribute("instanceDistanceStart", new x(i, 1, 0)), e.setAttribute("instanceDistanceEnd", new x(i, 1, 1)), this;
692
711
  }
693
712
  onBeforeRender(e) {
694
713
  let t = this.material.uniforms;
695
- t && t.resolution && (e.getViewport(nt), this.material.uniforms.resolution.value.set(nt.z, nt.w));
714
+ t && t.resolution && (e.getViewport(ft), this.material.uniforms.resolution.value.set(ft.z, ft.w));
696
715
  }
697
- }, Y = class extends Qe {
716
+ }, mt = class extends ct {
698
717
  constructor(e) {
699
- super(), this.isWireframeGeometry2 = !0, this.type = "WireframeGeometry2", this.fromWireframeGeometry(new Ee(e));
718
+ super(), this.isWireframeGeometry2 = !0, this.type = "WireframeGeometry2", this.fromWireframeGeometry(new De(e));
700
719
  }
701
- }, it = class extends w {
720
+ }, ht = class extends E {
702
721
  constructor() {
703
- super();
704
- let e = new _e();
722
+ super(), this.name = "RoomEnvironment", this.position.y = -3.5;
723
+ let e = new F();
705
724
  e.deleteAttribute("uv");
706
- let t = new oe({ side: 1 }), n = new oe(), r = new fe(16777215, 900, 28, 2);
725
+ let t = new ze({ side: 1 }), n = new ze(), r = new de(16777215, 900, 28, 2);
707
726
  r.position.set(.418, 16.199, .3), this.add(r);
708
- let i = new A(e, t);
727
+ let i = new C(e, t);
709
728
  i.position.set(-.757, 13.219, .717), i.scale.set(31.713, 28.305, 28.591), this.add(i);
710
- let a = new A(e, n);
711
- a.position.set(-10.906, 2.009, 1.846), a.rotation.set(0, -.195, 0), a.scale.set(2.328, 7.905, 4.651), this.add(a);
712
- let o = new A(e, n);
713
- o.position.set(-5.607, -.754, -.758), o.rotation.set(0, .994, 0), o.scale.set(1.97, 1.534, 3.955), this.add(o);
714
- let s = new A(e, n);
715
- s.position.set(6.167, .857, 7.803), s.rotation.set(0, .561, 0), s.scale.set(3.927, 6.285, 3.687), this.add(s);
716
- let c = new A(e, n);
717
- c.position.set(-2.017, .018, 6.124), c.rotation.set(0, .333, 0), c.scale.set(2.002, 4.566, 2.064), this.add(c);
718
- let l = new A(e, n);
719
- l.position.set(2.291, -.756, -2.621), l.rotation.set(0, -.286, 0), l.scale.set(1.546, 1.552, 1.496), this.add(l);
720
- let u = new A(e, n);
721
- u.position.set(-2.193, -.369, -5.547), u.rotation.set(0, .516, 0), u.scale.set(3.875, 3.487, 2.986), this.add(u);
722
- let d = new A(e, X(50));
723
- d.position.set(-16.116, 14.37, 8.208), d.scale.set(.1, 2.428, 2.739), this.add(d);
724
- let f = new A(e, X(50));
725
- f.position.set(-16.109, 18.021, -8.207), f.scale.set(.1, 2.425, 2.751), this.add(f);
726
- let p = new A(e, X(17));
727
- p.position.set(14.904, 12.198, -1.832), p.scale.set(.15, 4.265, 6.331), this.add(p);
728
- let m = new A(e, X(43));
729
- m.position.set(-.462, 8.89, 14.52), m.scale.set(4.38, 5.441, .088), this.add(m);
730
- let h = new A(e, X(20));
731
- h.position.set(3.235, 11.486, -12.541), h.scale.set(2.5, 2, .1), this.add(h);
732
- let g = new A(e, X(100));
733
- g.position.set(0, 20, 0), g.scale.set(1, .1, 1), this.add(g);
729
+ let a = new Ee(e, n, 6), o = new be();
730
+ o.position.set(-10.906, 2.009, 1.846), o.rotation.set(0, -.195, 0), o.scale.set(2.328, 7.905, 4.651), o.updateMatrix(), a.setMatrixAt(0, o.matrix), o.position.set(-5.607, -.754, -.758), o.rotation.set(0, .994, 0), o.scale.set(1.97, 1.534, 3.955), o.updateMatrix(), a.setMatrixAt(1, o.matrix), o.position.set(6.167, .857, 7.803), o.rotation.set(0, .561, 0), o.scale.set(3.927, 6.285, 3.687), o.updateMatrix(), a.setMatrixAt(2, o.matrix), o.position.set(-2.017, .018, 6.124), o.rotation.set(0, .333, 0), o.scale.set(2.002, 4.566, 2.064), o.updateMatrix(), a.setMatrixAt(3, o.matrix), o.position.set(2.291, -.756, -2.621), o.rotation.set(0, -.286, 0), o.scale.set(1.546, 1.552, 1.496), o.updateMatrix(), a.setMatrixAt(4, o.matrix), o.position.set(-2.193, -.369, -5.547), o.rotation.set(0, .516, 0), o.scale.set(3.875, 3.487, 2.986), o.updateMatrix(), a.setMatrixAt(5, o.matrix), this.add(a);
731
+ let s = new C(e, Y(50));
732
+ s.position.set(-16.116, 14.37, 8.208), s.scale.set(.1, 2.428, 2.739), this.add(s);
733
+ let c = new C(e, Y(50));
734
+ c.position.set(-16.109, 18.021, -8.207), c.scale.set(.1, 2.425, 2.751), this.add(c);
735
+ let l = new C(e, Y(17));
736
+ l.position.set(14.904, 12.198, -1.832), l.scale.set(.15, 4.265, 6.331), this.add(l);
737
+ let u = new C(e, Y(43));
738
+ u.position.set(-.462, 8.89, 14.52), u.scale.set(4.38, 5.441, .088), this.add(u);
739
+ let d = new C(e, Y(20));
740
+ d.position.set(3.235, 11.486, -12.541), d.scale.set(2.5, 2, .1), this.add(d);
741
+ let f = new C(e, Y(100));
742
+ f.position.set(0, 20, 0), f.scale.set(1, .1, 1), this.add(f);
734
743
  }
735
744
  dispose() {
736
745
  let e = /* @__PURE__ */ new Set();
@@ -740,134 +749,40 @@ var $e = class extends S {
740
749
  for (let t of e) t.dispose();
741
750
  }
742
751
  };
743
- function X(e) {
744
- let t = new _();
745
- return t.color.setScalar(e), t;
746
- }
747
- //#endregion
748
- //#region src/loops/gl/primitiveEasing.js
749
- function at(e) {
750
- let t = 7.5625, n = 2.75;
751
- return e < 1 / n ? t * e * e : e < 2 / n ? (e -= 1.5 / n, t * e * e + .75) : e < 2.5 / n ? (e -= 2.25 / n, t * e * e + .9375) : (e -= 2.625 / n, t * e * e + .984375);
752
- }
753
- var ot = {
754
- linear: (e) => e,
755
- in: (e) => e * e,
756
- out: (e) => 1 - (1 - e) * (1 - e),
757
- inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
758
- sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
759
- cubicIn: (e) => e * e * e,
760
- cubicOut: (e) => 1 - (1 - e) ** 3,
761
- cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
762
- expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
763
- expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
764
- backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
765
- backInOut: (e) => {
766
- let t = 1.70158 * 1.525;
767
- return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
768
- },
769
- elasticOut: (e) => {
770
- if (e <= 0) return 0;
771
- if (e >= 1) return 1;
772
- let t = 2 * Math.PI / 3;
773
- return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
774
- },
775
- bounceOut: at
776
- }, st = {
777
- linear: "Linear",
778
- in: "Ease in",
779
- out: "Ease out",
780
- inout: "Ease in-out",
781
- sine: "Sine",
782
- cubicIn: "Cubic in",
783
- cubicOut: "Cubic out",
784
- cubicInOut: "Cubic in-out",
785
- expoOut: "Expo out",
786
- expoInOut: "Expo in-out",
787
- backOut: "Back out",
788
- backInOut: "Back in-out",
789
- elasticOut: "Elastic out",
790
- bounceOut: "Bounce out"
791
- };
792
- Object.keys(ot).map((e) => ({
793
- value: e,
794
- label: st[e] || e
795
- }));
796
- //#endregion
797
- //#region src/loops/gl/primitiveKeyframes.js
798
- var ct = (e, t, n) => e + (t - e) * n, lt = (e, t, n) => [
799
- ct(e[0], t[0], n),
800
- ct(e[1], t[1], n),
801
- ct(e[2], t[2], n)
802
- ], ut = (e) => ({
803
- rot: e.rot || [
804
- 0,
805
- 0,
806
- 0
807
- ],
808
- pos: e.pos || [
809
- 0,
810
- 0,
811
- 0
812
- ],
813
- scale: e.scale ?? 1
814
- });
815
- function dt(e, t) {
816
- if (!e || !e.length) return {};
817
- if (e.length === 1) return ut(e[0]);
818
- let n = 0;
819
- for (; n < e.length - 1 && t > e[n + 1].t;) n++;
820
- let r = e[n], i = e[n + 1] || r, a = i.t - r.t || 1, o = Math.max(0, Math.min(1, (t - r.t) / a));
821
- return o = (ot[i.ease] || ot.inout)(o), {
822
- rot: lt(r.rot || [
823
- 0,
824
- 0,
825
- 0
826
- ], i.rot || [
827
- 0,
828
- 0,
829
- 0
830
- ], o),
831
- pos: lt(r.pos || [
832
- 0,
833
- 0,
834
- 0
835
- ], i.pos || [
836
- 0,
837
- 0,
838
- 0
839
- ], o),
840
- scale: ct(r.scale ?? 1, i.scale ?? 1, o)
841
- };
752
+ function Y(e) {
753
+ return new se({
754
+ color: 0,
755
+ emissive: 16777215,
756
+ emissiveIntensity: e
757
+ });
842
758
  }
843
- Math.PI * 2;
844
759
  //#endregion
845
760
  //#region src/loops/gl/PrimitiveEngine.js
846
- var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
761
+ var gt = "#0b0b0e", _t = .004, vt = 24, yt = class {
847
762
  constructor(e, { autoLoop: t = !1 } = {}) {
848
- this.canvas = e, this.autoLoop = t, this.renderer = new T({
763
+ this.canvas = e, this.autoLoop = t, this.renderer = new D({
849
764
  canvas: e,
850
765
  antialias: !0,
851
766
  preserveDrawingBuffer: !0,
852
767
  alpha: !0
853
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(ft), 1), this.scene = new w(), this.camera = new z(38, 1, .1, 100), this.camera.position.set(0, .6, 4), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.scene.add(new Te(16777215, .35)), this.scene.add(new le(13424383, 2105384, .5));
854
- let n = new O(16777215, 1.5);
768
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(gt), 1), this.scene = new E(), this.camera = new w(38, 1, .1, 100), this.camera.position.set(0, .6, 4), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.scene.add(new je(16777215, .35)), this.scene.add(new ve(13424383, 2105384, .5));
769
+ let n = new H(16777215, 1.5);
855
770
  n.position.set(3, 4, 2), this.scene.add(n);
856
- let r = new O(10070783, .5);
857
- r.position.set(-3, -1, -2), this.scene.add(r), this.pmrem = new ce(this.renderer), this.envTex = null, this.color = "#b9c2d0", this.roughness = .38, this.metalness = .18, this.flat = !1, this.matType = "standard", this.material = this.makeMaterial("standard"), this.lineMat = new $e({
771
+ let r = new H(10070783, .5);
772
+ r.position.set(-3, -1, -2), this.scene.add(r), this.pmrem = new ke(this.renderer), this.envTex = null, this.color = "#b9c2d0", this.roughness = .38, this.metalness = .18, this.flat = !1, this.matType = "standard", this.material = this.makeMaterial("standard"), this.lineMat = new lt({
858
773
  color: 12174032,
859
- linewidth: 3 * pt,
774
+ linewidth: 3 * _t,
860
775
  worldUnits: !0
861
776
  }), this.primId = "box", this.params = {
862
777
  tube: .32,
863
778
  p: 2,
864
779
  q: 3,
865
780
  detail: 0
866
- }, this.rounding = .22, this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new Y(this.activeGeom), this.items = [], this.layoutPos = [[
781
+ }, this.rounding = .22, this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new mt(this.activeGeom), this.items = [], this.layoutPos = [[
867
782
  0,
868
783
  0,
869
784
  0
870
- ]], this.setCount(1), this.axes = new Oe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(i.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
785
+ ]], this.setCount(1), this.axes = new Fe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(i.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
871
786
  preset: "spin",
872
787
  animMode: "preset",
873
788
  keyframes: [],
@@ -901,36 +816,36 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
901
816
  switch (e) {
902
817
  case "box": {
903
818
  let e = Math.min(Math.max(this.rounding, 0), .7);
904
- return e > 0 ? new Xe(1.5, 1.5, 1.5, 6, e) : new _e(1.5, 1.5, 1.5);
819
+ return e > 0 ? new at(1.5, 1.5, 1.5, 6, e) : new F(1.5, 1.5, 1.5);
905
820
  }
906
- case "sphere": return new re(1, 64, 48);
907
- case "torus": return new he(.78, t.tube ?? .32, 48, 96);
908
- case "torusKnot": return new se(.7, .26, 160, 32, t.p ?? 2, t.q ?? 3);
909
- case "cone": return new we(.95, 1.7, 64);
910
- case "cylinder": return new be(.8, .8, 1.6, 64);
911
- case "icosahedron": return new y(1.1, t.detail ?? 0);
912
- case "octahedron": return new ne(1.15, t.detail ?? 0);
913
- case "dodecahedron": return new ge(1.05, t.detail ?? 0);
914
- default: return new _e(1.5, 1.5, 1.5);
821
+ case "sphere": return new he(1, 64, 48);
822
+ case "torus": return new Ae(.78, t.tube ?? .32, 48, 96);
823
+ case "torusKnot": return new Pe(.7, .26, 160, 32, t.p ?? 2, t.q ?? 3);
824
+ case "cone": return new Se(.95, 1.7, 64);
825
+ case "cylinder": return new Re(.8, .8, 1.6, 64);
826
+ case "icosahedron": return new oe(1.1, t.detail ?? 0);
827
+ case "octahedron": return new ce(1.15, t.detail ?? 0);
828
+ case "dodecahedron": return new Ce(1.05, t.detail ?? 0);
829
+ default: return new F(1.5, 1.5, 1.5);
915
830
  }
916
831
  }
917
832
  rebuildGeometry() {
918
833
  let e = this.activeGeom, t = this.wireGeom;
919
- this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new Y(this.activeGeom);
834
+ this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new mt(this.activeGeom);
920
835
  for (let e of this.items) e.mesh.geometry = this.activeGeom, e.wire.geometry = this.wireGeom;
921
836
  e.dispose(), t.dispose();
922
837
  }
923
838
  makeMaterial(e) {
924
- let t = new N(this.color);
839
+ let t = new M(this.color);
925
840
  switch (e) {
926
- case "normal": return new Se({ flatShading: this.flat });
927
- case "phong": return new ae({
841
+ case "normal": return new le({ flatShading: this.flat });
842
+ case "phong": return new fe({
928
843
  color: t,
929
844
  flatShading: this.flat,
930
845
  shininess: 60
931
846
  });
932
- case "toon": return new ee({ color: t });
933
- case "glass": return new C({
847
+ case "toon": return new re({ color: t });
848
+ case "glass": return new ge({
934
849
  color: t,
935
850
  metalness: 0,
936
851
  roughness: this.roughness,
@@ -939,7 +854,7 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
939
854
  ior: 1.4,
940
855
  flatShading: this.flat
941
856
  });
942
- case "dispersion": return new C({
857
+ case "dispersion": return new ge({
943
858
  color: t,
944
859
  metalness: 0,
945
860
  roughness: this.roughness,
@@ -949,7 +864,7 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
949
864
  dispersion: 6,
950
865
  flatShading: this.flat
951
866
  });
952
- default: return new oe({
867
+ default: return new ze({
953
868
  color: t,
954
869
  roughness: this.roughness,
955
870
  metalness: this.metalness,
@@ -969,8 +884,8 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
969
884
  e.color && this.matType !== "normal" && e.color.set(this.color), "roughness" in e && (e.roughness = this.roughness), "metalness" in e && this.matType !== "glass" && this.matType !== "dispersion" && (e.metalness = this.metalness), "flatShading" in e && e.flatShading !== this.flat && (e.flatShading = this.flat, e.needsUpdate = !0), this.lineMat.color.set(this.color);
970
885
  }
971
886
  setCount(e) {
972
- for (e = Math.max(1, Math.min(mt, Math.round(e))); this.items.length < e;) {
973
- let e = new A(this.activeGeom, this.material), t = new rt(this.wireGeom, this.lineMat);
887
+ for (e = Math.max(1, Math.min(vt, Math.round(e))); this.items.length < e;) {
888
+ let e = new C(this.activeGeom, this.material), t = new pt(this.wireGeom, this.lineMat);
974
889
  t.visible = !1, this.scene.add(e), this.scene.add(t), this.items.push({
975
890
  mesh: e,
976
891
  wire: t
@@ -982,7 +897,7 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
982
897
  }
983
898
  }
984
899
  ensureEnv() {
985
- return this.envTex ||= this.pmrem.fromScene(new it(), .04).texture, this.envTex;
900
+ return this.envTex ||= this.pmrem.fromScene(new ht(), .04).texture, this.envTex;
986
901
  }
987
902
  update({ globals: e, primitive: t, params: n } = {}) {
988
903
  let r = !1;
@@ -993,7 +908,7 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
993
908
  this.globals = e, this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.flat = !!e.flatShading, this.setMaterialType(e.materialType || "standard"), this.applyMaterialProps();
994
909
  let t = !!e.wireframe;
995
910
  for (let e of this.items) e.mesh.visible = !t, e.wire.visible = t;
996
- this.lineMat.linewidth = (e.strokeWidth ?? 3) * pt, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos = h(e.arrangement || "single", e.count ?? 1, e.spread ?? 2.2), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), this.scene.environment = e.environment ? this.ensureEnv() : null, this.axes.visible = !!e.showAxis, this.axes.scale.setScalar(e.axisLength ?? 1.5), this.axes.material.opacity = e.axisOpacity ?? .7;
911
+ this.lineMat.linewidth = (e.strokeWidth ?? 3) * _t, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos = ee(e.arrangement || "single", e.count ?? 1, e.spread ?? 2.2), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), this.scene.environment = e.environment ? this.ensureEnv() : null, this.axes.visible = !!e.showAxis, this.axes.scale.setScalar(e.axisLength ?? 1.5), this.axes.material.opacity = e.axisOpacity ?? .7;
997
912
  }
998
913
  r && this.rebuildGeometry();
999
914
  }
@@ -1004,18 +919,18 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
1004
919
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1005
920
  }
1006
921
  setBackground(e) {
1007
- this.renderer.setClearColor(new N(e), 1);
922
+ this.renderer.setClearColor(new M(e), 1);
1008
923
  }
1009
924
  resetCamera() {
1010
925
  this.camera.position.set(0, .6, 4), this.controls.target.set(0, 0, 0), this.controls.update();
1011
926
  }
1012
927
  poseAt(e) {
1013
928
  let t = this.globals;
1014
- return t.animMode === "keyframe" ? dt(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
929
+ return t.animMode === "keyframe" ? u(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
1015
930
  }
1016
931
  _applyLive(e) {
1017
932
  let t = this.material;
1018
- Number.isFinite(e.roughness) && "roughness" in t && (t.roughness = e.roughness), Number.isFinite(e.metalness) && "metalness" in t && this.matType !== "glass" && this.matType !== "dispersion" && (t.metalness = e.metalness), Number.isFinite(e.strokeWidth) && (this.lineMat.linewidth = e.strokeWidth * pt), Number.isFinite(e.fov) && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Number.isFinite(e.axisLength) && this.axes.scale.setScalar(e.axisLength), Number.isFinite(e.axisOpacity) && (this.axes.material.opacity = e.axisOpacity);
933
+ Number.isFinite(e.roughness) && "roughness" in t && (t.roughness = e.roughness), Number.isFinite(e.metalness) && "metalness" in t && this.matType !== "glass" && this.matType !== "dispersion" && (t.metalness = e.metalness), Number.isFinite(e.strokeWidth) && (this.lineMat.linewidth = e.strokeWidth * _t), Number.isFinite(e.fov) && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Number.isFinite(e.axisLength) && this.axes.scale.setScalar(e.axisLength), Number.isFinite(e.axisOpacity) && (this.axes.material.opacity = e.axisOpacity);
1019
934
  }
1020
935
  frame(e) {
1021
936
  this.step(e);
@@ -1084,23 +999,23 @@ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
1084
999
  dispose() {
1085
1000
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.lineMat.dispose(), this.activeGeom.dispose(), this.wireGeom.dispose(), this.axes.geometry.dispose(), this.axes.material.dispose(), this.envTex?.dispose(), this.pmrem.dispose(), this.renderer.dispose();
1086
1001
  }
1087
- }, gt = Math.PI * 2, _t = "#0b0b0e";
1088
- function vt() {
1002
+ }, bt = Math.PI * 2, xt = "#0b0b0e";
1003
+ function St() {
1089
1004
  let e = document.createElement("canvas");
1090
1005
  e.width = e.height = 64;
1091
- let t = e.getContext("2d"), n = t.createRadialGradient(64 / 2, 64 / 2, 0, 64 / 2, 64 / 2, 64 / 2);
1006
+ let t = e.getContext("2d"), n = t.createRadialGradient(32, 32, 0, 32, 32, 32);
1092
1007
  n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(.55, "rgba(255,255,255,0.85)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 64, 64);
1093
- let r = new Ce(e);
1008
+ let r = new Me(e);
1094
1009
  return r.needsUpdate = !0, r;
1095
1010
  }
1096
- var yt = class {
1011
+ var Ct = class {
1097
1012
  constructor(e, { autoLoop: t = !1 } = {}) {
1098
- this.autoLoop = t, this.canvas = e, this.renderer = new T({
1013
+ this.autoLoop = t, this.canvas = e, this.renderer = new D({
1099
1014
  canvas: e,
1100
1015
  antialias: !0,
1101
1016
  preserveDrawingBuffer: !0,
1102
1017
  alpha: !0
1103
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(_t), 1), this.scene = new w(), this.scene.fog = new Me(new N(_t), 3.2, 9.5), this.camera = new z(40, 1, .1, 100), this.camera.position.set(0, .4, 4.4), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.sprite = vt(), this.material = new de({
1018
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(xt), 1), this.scene = new E(), this.scene.fog = new _e(new M(xt), 3.2, 9.5), this.camera = new w(40, 1, .1, 100), this.camera.position.set(0, .4, 4.4), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.sprite = St(), this.material = new ue({
1104
1019
  map: this.sprite,
1105
1020
  vertexColors: !0,
1106
1021
  size: .05,
@@ -1108,7 +1023,7 @@ var yt = class {
1108
1023
  transparent: !0,
1109
1024
  alphaTest: .4,
1110
1025
  depthWrite: !0
1111
- }), this.geometry = new P(), this.points = new te(this.geometry, this.material), this.scene.add(this.points), this.form = "helix", this.samples = 30, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this.count = 0, this._rebuild(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1026
+ }), this.geometry = new A(), this.points = new Ne(this.geometry, this.material), this.scene.add(this.points), this.form = "helix", this.samples = 30, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this.count = 0, this._rebuild(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1112
1027
  form: "helix",
1113
1028
  samples: 30,
1114
1029
  cycles: 2,
@@ -1129,14 +1044,14 @@ var yt = class {
1129
1044
  }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1130
1045
  }
1131
1046
  _rebuild() {
1132
- this.count = o(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), u(this.form, this.samples, this.vparArr);
1133
- let e = new P();
1134
- e.setAttribute("position", new M(this.posArr, 3)), e.setAttribute("color", new M(this.colArr, 3));
1047
+ this.count = a(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), b(this.form, this.samples, this.vparArr);
1048
+ let e = new A();
1049
+ e.setAttribute("position", new z(this.posArr, 3)), e.setAttribute("color", new z(this.colArr, 3));
1135
1050
  let t = this.geometry;
1136
1051
  this.geometry = e, this.points.geometry = e, t.dispose(), this._recolor();
1137
1052
  }
1138
1053
  _recolor() {
1139
- let e = new N(this.colFg), t = new N(this.colAccent), n = this.colArr;
1054
+ let e = new M(this.colFg), t = new M(this.colAccent), n = this.colArr;
1140
1055
  for (let r = 0; r < this.count; r++) {
1141
1056
  let i = this.vparArr[r];
1142
1057
  n[r * 3] = t.r + (e.r - t.r) * i, n[r * 3 + 1] = t.g + (e.g - t.g) * i, n[r * 3 + 2] = t.b + (e.b - t.b) * i;
@@ -1158,7 +1073,7 @@ var yt = class {
1158
1073
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1159
1074
  }
1160
1075
  setBackground(e) {
1161
- let t = new N(e);
1076
+ let t = new M(e);
1162
1077
  this.renderer.setClearColor(t, 1), this.scene.fog && this.scene.fog.color.copy(t);
1163
1078
  }
1164
1079
  resetCamera() {
@@ -1178,8 +1093,8 @@ var yt = class {
1178
1093
  t: n,
1179
1094
  dur: this.dur
1180
1095
  });
1181
- let r = (this.dur > 0 ? n / this.dur : 0) * gt * (t.cycles ?? 2);
1182
- if (d(this.form, this.samples, r, {
1096
+ let r = (this.dur > 0 ? n / this.dur : 0) * bt * (t.cycles ?? 2);
1097
+ if (y(this.form, this.samples, r, {
1183
1098
  amp: t.amp ?? .35,
1184
1099
  turns: t.turns,
1185
1100
  radius: t.radius,
@@ -1220,7 +1135,7 @@ var yt = class {
1220
1135
  dispose() {
1221
1136
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.sprite.dispose(), this.geometry.dispose(), this.renderer.dispose();
1222
1137
  }
1223
- }, bt = Math.PI * 2, xt = "#0b0b0e", St = {
1138
+ }, wt = Math.PI * 2, Tt = "#0b0b0e", Et = {
1224
1139
  mountain: {
1225
1140
  pos: [
1226
1141
  0,
@@ -1260,17 +1175,17 @@ var yt = class {
1260
1175
  ],
1261
1176
  fov: 70
1262
1177
  }
1263
- }, Ct = class {
1178
+ }, Dt = class {
1264
1179
  constructor(e, { autoLoop: t = !1 } = {}) {
1265
- this.autoLoop = t, this.canvas = e, this.renderer = new T({
1180
+ this.autoLoop = t, this.canvas = e, this.renderer = new D({
1266
1181
  canvas: e,
1267
1182
  antialias: !0,
1268
1183
  preserveDrawingBuffer: !0,
1269
1184
  alpha: !0
1270
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(xt), 1), this.scene = new w(), this.scene.fog = new Me(new N(xt), 3, 11), this.camera = new z(45, 1, .1, 100), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.minDistance = .1, this.controls.maxDistance = 16, this.material = new _({
1185
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(Tt), 1), this.scene = new E(), this.scene.fog = new _e(new M(Tt), 3, 11), this.camera = new w(45, 1, .1, 100), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.minDistance = .1, this.controls.maxDistance = 16, this.material = new me({
1271
1186
  vertexColors: !0,
1272
1187
  side: 2
1273
- }), this.geometry = new P(), this.mesh = new A(this.geometry, this.material), this.scene.add(this.mesh), this.env = "mountain", this.samples = 48, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this._rebuild(), this.resetCamera(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1188
+ }), this.geometry = new A(), this.mesh = new C(this.geometry, this.material), this.scene.add(this.mesh), this.env = "mountain", this.samples = 48, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this._rebuild(), this.resetCamera(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1274
1189
  env: "mountain",
1275
1190
  samples: 48,
1276
1191
  cycles: 2,
@@ -1288,14 +1203,14 @@ var yt = class {
1288
1203
  }
1289
1204
  _rebuild() {
1290
1205
  let e = this.samples * this.samples;
1291
- this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), m(this.env, this.samples, this.vparArr);
1292
- let t = new P();
1293
- t.setAttribute("position", new M(this.posArr, 3)), t.setAttribute("color", new M(this.colArr, 3)), t.setIndex(new M(p(this.env, this.samples), 1));
1206
+ this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), l(this.env, this.samples, this.vparArr);
1207
+ let t = new A();
1208
+ t.setAttribute("position", new z(this.posArr, 3)), t.setAttribute("color", new z(this.colArr, 3)), t.setIndex(new z(c(this.env, this.samples), 1));
1294
1209
  let n = this.geometry;
1295
1210
  this.geometry = t, this.mesh.geometry = t, n.dispose(), this._recolor();
1296
1211
  }
1297
1212
  _recolor() {
1298
- let e = new N(this.colFg), t = new N(this.colAccent), n = this.colArr, r = this.samples * this.samples;
1213
+ let e = new M(this.colFg), t = new M(this.colAccent), n = this.colArr, r = this.samples * this.samples;
1299
1214
  for (let i = 0; i < r; i++) {
1300
1215
  let r = this.vparArr[i];
1301
1216
  n[i * 3] = t.r + (e.r - t.r) * r, n[i * 3 + 1] = t.g + (e.g - t.g) * r, n[i * 3 + 2] = t.b + (e.b - t.b) * r;
@@ -1317,11 +1232,11 @@ var yt = class {
1317
1232
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1318
1233
  }
1319
1234
  setBackground(e) {
1320
- let t = new N(e);
1235
+ let t = new M(e);
1321
1236
  this.renderer.setClearColor(t, 1), this.scene.fog && this.scene.fog.color.copy(t);
1322
1237
  }
1323
1238
  resetCamera() {
1324
- let e = St[this.env] || St.mountain;
1239
+ let e = Et[this.env] || Et.mountain;
1325
1240
  this.camera.position.set(...e.pos), this.camera.fov = this.globals?.fov ?? e.fov, this.camera.updateProjectionMatrix(), this.controls.target.set(...e.target), this.controls.update();
1326
1241
  }
1327
1242
  frame(e) {
@@ -1338,8 +1253,8 @@ var yt = class {
1338
1253
  t: n,
1339
1254
  dur: this.dur
1340
1255
  });
1341
- let r = (this.dur > 0 ? n / this.dur : 0) * bt * (t.cycles ?? 2);
1342
- if (l(this.env, this.samples, r, { amp: t.amp ?? .5 }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.geometry.computeVertexNormals(), this.controls.autoRotate = !this.recording && !!t.spin && !t.paused && !a(this.env), this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1256
+ let r = (this.dur > 0 ? n / this.dur : 0) * wt * (t.cycles ?? 2);
1257
+ if (p(this.env, this.samples, r, { amp: t.amp ?? .5 }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.geometry.computeVertexNormals(), this.controls.autoRotate = !this.recording && !!t.spin && !t.paused && !h(this.env), this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1343
1258
  let e = this._recStop;
1344
1259
  this._recStop = null, e();
1345
1260
  }
@@ -1375,7 +1290,7 @@ var yt = class {
1375
1290
  dispose() {
1376
1291
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.geometry.dispose(), this.renderer.dispose();
1377
1292
  }
1378
- }, wt = {
1293
+ }, Ot = {
1379
1294
  name: "CopyShader",
1380
1295
  uniforms: {
1381
1296
  tDiffuse: { value: null },
@@ -1383,7 +1298,7 @@ var yt = class {
1383
1298
  },
1384
1299
  vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1385
1300
  fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
1386
- }, Z = class {
1301
+ }, X = class {
1387
1302
  constructor() {
1388
1303
  this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
1389
1304
  }
@@ -1392,9 +1307,9 @@ var yt = class {
1392
1307
  console.error("THREE.Pass: .render() must be implemented in derived pass.");
1393
1308
  }
1394
1309
  dispose() {}
1395
- }, Tt = new ie(-1, 1, 1, -1, 0, 1), Et = new class extends P {
1310
+ }, kt = new ye(-1, 1, 1, -1, 0, 1), At = new class extends A {
1396
1311
  constructor() {
1397
- super(), this.setAttribute("position", new L([
1312
+ super(), this.setAttribute("position", new V([
1398
1313
  -1,
1399
1314
  3,
1400
1315
  0,
@@ -1404,7 +1319,7 @@ var yt = class {
1404
1319
  3,
1405
1320
  -1,
1406
1321
  0
1407
- ], 3)), this.setAttribute("uv", new L([
1322
+ ], 3)), this.setAttribute("uv", new V([
1408
1323
  0,
1409
1324
  2,
1410
1325
  0,
@@ -1413,15 +1328,15 @@ var yt = class {
1413
1328
  0
1414
1329
  ], 2));
1415
1330
  }
1416
- }(), Dt = class {
1331
+ }(), jt = class {
1417
1332
  constructor(e) {
1418
- this._mesh = new A(Et, e);
1333
+ this._mesh = new C(At, e);
1419
1334
  }
1420
1335
  dispose() {
1421
1336
  this._mesh.geometry.dispose();
1422
1337
  }
1423
1338
  render(e) {
1424
- e.render(this._mesh, Tt);
1339
+ e.render(this._mesh, kt);
1425
1340
  }
1426
1341
  get material() {
1427
1342
  return this._mesh.material;
@@ -1429,23 +1344,23 @@ var yt = class {
1429
1344
  set material(e) {
1430
1345
  this._mesh.material = e;
1431
1346
  }
1432
- }, Ot = class extends Z {
1433
- constructor(e, t) {
1434
- super(), this.textureID = t === void 0 ? "tDiffuse" : t, e instanceof S ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = D.clone(e.uniforms), this.material = new S({
1347
+ }, Mt = class extends X {
1348
+ constructor(e, t = "tDiffuse") {
1349
+ super(), this.textureID = t, this.uniforms = null, this.material = null, e instanceof T ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = P.clone(e.uniforms), this.material = new T({
1435
1350
  name: e.name === void 0 ? "unspecified" : e.name,
1436
1351
  defines: Object.assign({}, e.defines),
1437
1352
  uniforms: this.uniforms,
1438
1353
  vertexShader: e.vertexShader,
1439
1354
  fragmentShader: e.fragmentShader
1440
- })), this.fsQuad = new Dt(this.material);
1355
+ })), this._fsQuad = new jt(this.material);
1441
1356
  }
1442
1357
  render(e, t, n) {
1443
- this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = n.texture), this.fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this.fsQuad.render(e));
1358
+ this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = n.texture), this._fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this._fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this._fsQuad.render(e));
1444
1359
  }
1445
1360
  dispose() {
1446
- this.material.dispose(), this.fsQuad.dispose();
1361
+ this.material.dispose(), this._fsQuad.dispose();
1447
1362
  }
1448
- }, kt = class extends Z {
1363
+ }, Nt = class extends X {
1449
1364
  constructor(e, t) {
1450
1365
  super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
1451
1366
  }
@@ -1455,20 +1370,20 @@ var yt = class {
1455
1370
  let a, o;
1456
1371
  this.inverse ? (a = 0, o = 1) : (a = 1, o = 0), i.buffers.stencil.setTest(!0), i.buffers.stencil.setOp(r.REPLACE, r.REPLACE, r.REPLACE), i.buffers.stencil.setFunc(r.ALWAYS, a, 4294967295), i.buffers.stencil.setClear(o), i.buffers.stencil.setLocked(!0), e.setRenderTarget(n), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), i.buffers.color.setLocked(!1), i.buffers.depth.setLocked(!1), i.buffers.color.setMask(!0), i.buffers.depth.setMask(!0), i.buffers.stencil.setLocked(!1), i.buffers.stencil.setFunc(r.EQUAL, 1, 4294967295), i.buffers.stencil.setOp(r.KEEP, r.KEEP, r.KEEP), i.buffers.stencil.setLocked(!0);
1457
1372
  }
1458
- }, At = class extends Z {
1373
+ }, Pt = class extends X {
1459
1374
  constructor() {
1460
1375
  super(), this.needsSwap = !1;
1461
1376
  }
1462
1377
  render(e) {
1463
1378
  e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
1464
1379
  }
1465
- }, jt = class {
1380
+ }, Ft = class {
1466
1381
  constructor(e, t) {
1467
1382
  if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
1468
- let n = e.getSize(new I());
1469
- this._width = n.width, this._height = n.height, t = new k(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: R }), t.texture.name = "EffectComposer.rt1";
1383
+ let n = e.getSize(new O());
1384
+ this._width = n.width, this._height = n.height, t = new k(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: B }), t.texture.name = "EffectComposer.rt1";
1470
1385
  } else this._width = t.width, this._height = t.height;
1471
- this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new Ot(wt), this.copyPass.material.blending = 0, this.clock = new ye();
1386
+ this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new Mt(Ot), this.copyPass.material.blending = 0, this.timer = new Le();
1472
1387
  }
1473
1388
  swapBuffers() {
1474
1389
  let e = this.readBuffer;
@@ -1489,7 +1404,7 @@ var yt = class {
1489
1404
  return !0;
1490
1405
  }
1491
1406
  render(e) {
1492
- e === void 0 && (e = this.clock.getDelta());
1407
+ this.timer.update(), e === void 0 && (e = this.timer.getDelta());
1493
1408
  let t = this.renderer.getRenderTarget(), n = !1;
1494
1409
  for (let t = 0, r = this.passes.length; t < r; t++) {
1495
1410
  let r = this.passes[t];
@@ -1501,14 +1416,14 @@ var yt = class {
1501
1416
  }
1502
1417
  this.swapBuffers();
1503
1418
  }
1504
- kt !== void 0 && (r instanceof kt ? n = !0 : r instanceof At && (n = !1));
1419
+ Nt !== void 0 && (r instanceof Nt ? n = !0 : r instanceof Pt && (n = !1));
1505
1420
  }
1506
1421
  }
1507
1422
  this.renderer.setRenderTarget(t);
1508
1423
  }
1509
1424
  reset(e) {
1510
1425
  if (e === void 0) {
1511
- let t = this.renderer.getSize(new I());
1426
+ let t = this.renderer.getSize(new O());
1512
1427
  this._pixelRatio = this.renderer.getPixelRatio(), this._width = t.width, this._height = t.height, e = this.renderTarget1.clone(), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
1513
1428
  }
1514
1429
  this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
@@ -1525,9 +1440,9 @@ var yt = class {
1525
1440
  dispose() {
1526
1441
  this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
1527
1442
  }
1528
- }, Mt = class extends Z {
1443
+ }, It = class extends X {
1529
1444
  constructor(e, t, n = null, r = null, i = null) {
1530
- super(), this.scene = e, this.camera = t, this.overrideMaterial = n, this.clearColor = r, this.clearAlpha = i, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this._oldClearColor = new N();
1445
+ super(), this.scene = e, this.camera = t, this.overrideMaterial = n, this.clearColor = r, this.clearAlpha = i, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this.isRenderPass = !0, this._oldClearColor = new M();
1531
1446
  }
1532
1447
  render(e, t, n) {
1533
1448
  let r = e.autoClear;
@@ -1535,45 +1450,44 @@ var yt = class {
1535
1450
  let i, a;
1536
1451
  this.overrideMaterial !== null && (a = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (e.getClearColor(this._oldClearColor), e.setClearColor(this.clearColor, e.getClearAlpha())), this.clearAlpha !== null && (i = e.getClearAlpha(), e.setClearAlpha(this.clearAlpha)), this.clearDepth == 1 && e.clearDepth(), e.setRenderTarget(this.renderToScreen ? null : n), this.clear === !0 && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), e.render(this.scene, this.camera), this.clearColor !== null && e.setClearColor(this._oldClearColor), this.clearAlpha !== null && e.setClearAlpha(i), this.overrideMaterial !== null && (this.scene.overrideMaterial = a), e.autoClear = r;
1537
1452
  }
1538
- }, Nt = {
1453
+ }, Lt = {
1539
1454
  name: "LuminosityHighPassShader",
1540
- shaderID: "luminosityHighPass",
1541
1455
  uniforms: {
1542
1456
  tDiffuse: { value: null },
1543
1457
  luminosityThreshold: { value: 1 },
1544
1458
  smoothWidth: { value: 1 },
1545
- defaultColor: { value: new N(0) },
1459
+ defaultColor: { value: new M(0) },
1546
1460
  defaultOpacity: { value: 0 }
1547
1461
  },
1548
1462
  vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1549
1463
  fragmentShader: "\n\n uniform sampler2D tDiffuse;\n uniform vec3 defaultColor;\n uniform float defaultOpacity;\n uniform float luminosityThreshold;\n uniform float smoothWidth;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n\n float v = luminance( texel.xyz );\n\n vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n gl_FragColor = mix( outputColor, texel, alpha );\n\n }"
1550
- }, Pt = class e extends Z {
1551
- constructor(e, t, n, r) {
1552
- super(), this.strength = t === void 0 ? 1 : t, this.radius = n, this.threshold = r, this.resolution = e === void 0 ? new I(256, 256) : new I(e.x, e.y), this.clearColor = new N(0, 0, 0), this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
1464
+ }, Rt = class e extends X {
1465
+ constructor(e, t = 1, n, r) {
1466
+ super(), this.strength = t, this.radius = n, this.threshold = r, this.resolution = e === void 0 ? new O(256, 256) : new O(e.x, e.y), this.clearColor = new M(0, 0, 0), this.needsSwap = !1, this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
1553
1467
  let i = Math.round(this.resolution.x / 2), a = Math.round(this.resolution.y / 2);
1554
- this.renderTargetBright = new k(i, a, { type: R }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
1468
+ this.renderTargetBright = new k(i, a, { type: B }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
1555
1469
  for (let e = 0; e < this.nMips; e++) {
1556
- let t = new k(i, a, { type: R });
1470
+ let t = new k(i, a, { type: B });
1557
1471
  t.texture.name = "UnrealBloomPass.h" + e, t.texture.generateMipmaps = !1, this.renderTargetsHorizontal.push(t);
1558
- let n = new k(i, a, { type: R });
1472
+ let n = new k(i, a, { type: B });
1559
1473
  n.texture.name = "UnrealBloomPass.v" + e, n.texture.generateMipmaps = !1, this.renderTargetsVertical.push(n), i = Math.round(i / 2), a = Math.round(a / 2);
1560
1474
  }
1561
- let o = Nt;
1562
- this.highPassUniforms = D.clone(o.uniforms), this.highPassUniforms.luminosityThreshold.value = r, this.highPassUniforms.smoothWidth.value = .01, this.materialHighPassFilter = new S({
1475
+ let o = Lt;
1476
+ this.highPassUniforms = P.clone(o.uniforms), this.highPassUniforms.luminosityThreshold.value = r, this.highPassUniforms.smoothWidth.value = .01, this.materialHighPassFilter = new T({
1563
1477
  uniforms: this.highPassUniforms,
1564
1478
  vertexShader: o.vertexShader,
1565
1479
  fragmentShader: o.fragmentShader
1566
1480
  }), this.separableBlurMaterials = [];
1567
1481
  let s = [
1568
- 3,
1569
- 5,
1570
- 7,
1571
- 9,
1572
- 11
1482
+ 6,
1483
+ 10,
1484
+ 14,
1485
+ 18,
1486
+ 22
1573
1487
  ];
1574
1488
  i = Math.round(this.resolution.x / 2), a = Math.round(this.resolution.y / 2);
1575
- for (let e = 0; e < this.nMips; e++) this.separableBlurMaterials.push(this.getSeperableBlurMaterial(s[e])), this.separableBlurMaterials[e].uniforms.invSize.value = new I(1 / i, 1 / a), i = Math.round(i / 2), a = Math.round(a / 2);
1576
- this.compositeMaterial = this.getCompositeMaterial(this.nMips), this.compositeMaterial.uniforms.blurTexture1.value = this.renderTargetsVertical[0].texture, this.compositeMaterial.uniforms.blurTexture2.value = this.renderTargetsVertical[1].texture, this.compositeMaterial.uniforms.blurTexture3.value = this.renderTargetsVertical[2].texture, this.compositeMaterial.uniforms.blurTexture4.value = this.renderTargetsVertical[3].texture, this.compositeMaterial.uniforms.blurTexture5.value = this.renderTargetsVertical[4].texture, this.compositeMaterial.uniforms.bloomStrength.value = t, this.compositeMaterial.uniforms.bloomRadius.value = .1;
1489
+ for (let e = 0; e < this.nMips; e++) this.separableBlurMaterials.push(this._getSeparableBlurMaterial(s[e])), this.separableBlurMaterials[e].uniforms.invSize.value = new O(1 / i, 1 / a), i = Math.round(i / 2), a = Math.round(a / 2);
1490
+ this.compositeMaterial = this._getCompositeMaterial(this.nMips), this.compositeMaterial.uniforms.blurTexture1.value = this.renderTargetsVertical[0].texture, this.compositeMaterial.uniforms.blurTexture2.value = this.renderTargetsVertical[1].texture, this.compositeMaterial.uniforms.blurTexture3.value = this.renderTargetsVertical[2].texture, this.compositeMaterial.uniforms.blurTexture4.value = this.renderTargetsVertical[3].texture, this.compositeMaterial.uniforms.blurTexture5.value = this.renderTargetsVertical[4].texture, this.compositeMaterial.uniforms.bloomStrength.value = t, this.compositeMaterial.uniforms.bloomRadius.value = .1;
1577
1491
  let c = [
1578
1492
  1,
1579
1493
  .8,
@@ -1582,60 +1496,59 @@ var yt = class {
1582
1496
  .2
1583
1497
  ];
1584
1498
  this.compositeMaterial.uniforms.bloomFactors.value = c, this.bloomTintColors = [
1585
- new j(1, 1, 1),
1586
- new j(1, 1, 1),
1587
- new j(1, 1, 1),
1588
- new j(1, 1, 1),
1589
- new j(1, 1, 1)
1590
- ], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors;
1591
- let l = wt;
1592
- this.copyUniforms = D.clone(l.uniforms), this.blendMaterial = new S({
1499
+ new I(1, 1, 1),
1500
+ new I(1, 1, 1),
1501
+ new I(1, 1, 1),
1502
+ new I(1, 1, 1),
1503
+ new I(1, 1, 1)
1504
+ ], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, this.copyUniforms = P.clone(Ot.uniforms), this.blendMaterial = new T({
1593
1505
  uniforms: this.copyUniforms,
1594
- vertexShader: l.vertexShader,
1595
- fragmentShader: l.fragmentShader,
1506
+ vertexShader: Ot.vertexShader,
1507
+ fragmentShader: Ot.fragmentShader,
1508
+ premultipliedAlpha: !0,
1596
1509
  blending: 2,
1597
1510
  depthTest: !1,
1598
1511
  depthWrite: !1,
1599
1512
  transparent: !0
1600
- }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new N(), this.oldClearAlpha = 1, this.basic = new _(), this.fsQuad = new Dt(null);
1513
+ }), this._oldClearColor = new M(), this._oldClearAlpha = 1, this._basic = new me(), this._fsQuad = new jt(null);
1601
1514
  }
1602
1515
  dispose() {
1603
1516
  for (let e = 0; e < this.renderTargetsHorizontal.length; e++) this.renderTargetsHorizontal[e].dispose();
1604
1517
  for (let e = 0; e < this.renderTargetsVertical.length; e++) this.renderTargetsVertical[e].dispose();
1605
1518
  this.renderTargetBright.dispose();
1606
1519
  for (let e = 0; e < this.separableBlurMaterials.length; e++) this.separableBlurMaterials[e].dispose();
1607
- this.compositeMaterial.dispose(), this.blendMaterial.dispose(), this.basic.dispose(), this.fsQuad.dispose();
1520
+ this.compositeMaterial.dispose(), this.blendMaterial.dispose(), this._basic.dispose(), this._fsQuad.dispose();
1608
1521
  }
1609
1522
  setSize(e, t) {
1610
1523
  let n = Math.round(e / 2), r = Math.round(t / 2);
1611
1524
  this.renderTargetBright.setSize(n, r);
1612
- for (let e = 0; e < this.nMips; e++) this.renderTargetsHorizontal[e].setSize(n, r), this.renderTargetsVertical[e].setSize(n, r), this.separableBlurMaterials[e].uniforms.invSize.value = new I(1 / n, 1 / r), n = Math.round(n / 2), r = Math.round(r / 2);
1525
+ for (let e = 0; e < this.nMips; e++) this.renderTargetsHorizontal[e].setSize(n, r), this.renderTargetsVertical[e].setSize(n, r), this.separableBlurMaterials[e].uniforms.invSize.value = new O(1 / n, 1 / r), n = Math.round(n / 2), r = Math.round(r / 2);
1613
1526
  }
1614
1527
  render(t, n, r, i, a) {
1615
- t.getClearColor(this._oldClearColor), this.oldClearAlpha = t.getClearAlpha();
1528
+ t.getClearColor(this._oldClearColor), this._oldClearAlpha = t.getClearAlpha();
1616
1529
  let o = t.autoClear;
1617
- t.autoClear = !1, t.setClearColor(this.clearColor, 0), a && t.state.buffers.stencil.setTest(!1), this.renderToScreen && (this.fsQuad.material = this.basic, this.basic.map = r.texture, t.setRenderTarget(null), t.clear(), this.fsQuad.render(t)), this.highPassUniforms.tDiffuse.value = r.texture, this.highPassUniforms.luminosityThreshold.value = this.threshold, this.fsQuad.material = this.materialHighPassFilter, t.setRenderTarget(this.renderTargetBright), t.clear(), this.fsQuad.render(t);
1530
+ t.autoClear = !1, t.setClearColor(this.clearColor, 0), a && t.state.buffers.stencil.setTest(!1), this.renderToScreen && (this._fsQuad.material = this._basic, this._basic.map = r.texture, t.setRenderTarget(null), t.clear(), this._fsQuad.render(t)), this.highPassUniforms.tDiffuse.value = r.texture, this.highPassUniforms.luminosityThreshold.value = this.threshold, this._fsQuad.material = this.materialHighPassFilter, t.setRenderTarget(this.renderTargetBright), t.clear(), this._fsQuad.render(t);
1618
1531
  let s = this.renderTargetBright;
1619
- for (let n = 0; n < this.nMips; n++) this.fsQuad.material = this.separableBlurMaterials[n], this.separableBlurMaterials[n].uniforms.colorTexture.value = s.texture, this.separableBlurMaterials[n].uniforms.direction.value = e.BlurDirectionX, t.setRenderTarget(this.renderTargetsHorizontal[n]), t.clear(), this.fsQuad.render(t), this.separableBlurMaterials[n].uniforms.colorTexture.value = this.renderTargetsHorizontal[n].texture, this.separableBlurMaterials[n].uniforms.direction.value = e.BlurDirectionY, t.setRenderTarget(this.renderTargetsVertical[n]), t.clear(), this.fsQuad.render(t), s = this.renderTargetsVertical[n];
1620
- this.fsQuad.material = this.compositeMaterial, this.compositeMaterial.uniforms.bloomStrength.value = this.strength, this.compositeMaterial.uniforms.bloomRadius.value = this.radius, this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, t.setRenderTarget(this.renderTargetsHorizontal[0]), t.clear(), this.fsQuad.render(t), this.fsQuad.material = this.blendMaterial, this.copyUniforms.tDiffuse.value = this.renderTargetsHorizontal[0].texture, a && t.state.buffers.stencil.setTest(!0), this.renderToScreen ? (t.setRenderTarget(null), this.fsQuad.render(t)) : (t.setRenderTarget(r), this.fsQuad.render(t)), t.setClearColor(this._oldClearColor, this.oldClearAlpha), t.autoClear = o;
1532
+ for (let n = 0; n < this.nMips; n++) this._fsQuad.material = this.separableBlurMaterials[n], this.separableBlurMaterials[n].uniforms.colorTexture.value = s.texture, this.separableBlurMaterials[n].uniforms.direction.value = e.BlurDirectionX, t.setRenderTarget(this.renderTargetsHorizontal[n]), t.clear(), this._fsQuad.render(t), this.separableBlurMaterials[n].uniforms.colorTexture.value = this.renderTargetsHorizontal[n].texture, this.separableBlurMaterials[n].uniforms.direction.value = e.BlurDirectionY, t.setRenderTarget(this.renderTargetsVertical[n]), t.clear(), this._fsQuad.render(t), s = this.renderTargetsVertical[n];
1533
+ this._fsQuad.material = this.compositeMaterial, this.compositeMaterial.uniforms.bloomStrength.value = this.strength, this.compositeMaterial.uniforms.bloomRadius.value = this.radius, this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, t.setRenderTarget(this.renderTargetsHorizontal[0]), t.clear(), this._fsQuad.render(t), this._fsQuad.material = this.blendMaterial, this.copyUniforms.tDiffuse.value = this.renderTargetsHorizontal[0].texture, a && t.state.buffers.stencil.setTest(!0), this.renderToScreen ? (t.setRenderTarget(null), this._fsQuad.render(t)) : (t.setRenderTarget(r), this._fsQuad.render(t)), t.setClearColor(this._oldClearColor, this._oldClearAlpha), t.autoClear = o;
1621
1534
  }
1622
- getSeperableBlurMaterial(e) {
1623
- let t = [];
1624
- for (let n = 0; n < e; n++) t.push(.39894 * Math.exp(-.5 * n * n / (e * e)) / e);
1625
- return new S({
1535
+ _getSeparableBlurMaterial(e) {
1536
+ let t = [], n = e / 3;
1537
+ for (let r = 0; r < e; r++) t.push(.39894 * Math.exp(-.5 * r * r / (n * n)) / n);
1538
+ return new T({
1626
1539
  defines: { KERNEL_RADIUS: e },
1627
1540
  uniforms: {
1628
1541
  colorTexture: { value: null },
1629
- invSize: { value: new I(.5, .5) },
1630
- direction: { value: new I(.5, .5) },
1542
+ invSize: { value: new O(.5, .5) },
1543
+ direction: { value: new O(.5, .5) },
1631
1544
  gaussianCoefficients: { value: t }
1632
1545
  },
1633
- vertexShader: "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
1634
- fragmentShader: "#include <common>\n varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 invSize;\n uniform vec2 direction;\n uniform float gaussianCoefficients[KERNEL_RADIUS];\n\n void main() {\n float weightSum = gaussianCoefficients[0];\n vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n for( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n float x = float(i);\n float w = gaussianCoefficients[i];\n vec2 uvOffset = direction * invSize * x;\n vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n diffuseSum += (sample1 + sample2) * w;\n weightSum += 2.0 * w;\n }\n gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n }"
1546
+ vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1547
+ fragmentShader: "\n\n #include <common>\n\n varying vec2 vUv;\n\n uniform sampler2D colorTexture;\n uniform vec2 invSize;\n uniform vec2 direction;\n uniform float gaussianCoefficients[KERNEL_RADIUS];\n\n void main() {\n\n float weightSum = gaussianCoefficients[0];\n vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\n for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\n float x = float( i );\n float w = gaussianCoefficients[i];\n vec2 uvOffset = direction * invSize * x;\n vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n diffuseSum += ( sample1 + sample2 ) * w;\n\n }\n\n gl_FragColor = vec4( diffuseSum, 1.0 );\n\n }"
1635
1548
  });
1636
1549
  }
1637
- getCompositeMaterial(e) {
1638
- return new S({
1550
+ _getCompositeMaterial(e) {
1551
+ return new T({
1639
1552
  defines: { NUM_MIPS: e },
1640
1553
  uniforms: {
1641
1554
  blurTexture1: { value: null },
@@ -1648,25 +1561,15 @@ var yt = class {
1648
1561
  bloomTintColors: { value: null },
1649
1562
  bloomRadius: { value: 0 }
1650
1563
  },
1651
- vertexShader: "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
1652
- fragmentShader: "varying vec2 vUv;\n uniform sampler2D blurTexture1;\n uniform sampler2D blurTexture2;\n uniform sampler2D blurTexture3;\n uniform sampler2D blurTexture4;\n uniform sampler2D blurTexture5;\n uniform float bloomStrength;\n uniform float bloomRadius;\n uniform float bloomFactors[NUM_MIPS];\n uniform vec3 bloomTintColors[NUM_MIPS];\n\n float lerpBloomFactor(const in float factor) {\n float mirrorFactor = 1.2 - factor;\n return mix(factor, mirrorFactor, bloomRadius);\n }\n\n void main() {\n gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n }"
1564
+ vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1565
+ fragmentShader: "\n\n varying vec2 vUv;\n\n uniform sampler2D blurTexture1;\n uniform sampler2D blurTexture2;\n uniform sampler2D blurTexture3;\n uniform sampler2D blurTexture4;\n uniform sampler2D blurTexture5;\n uniform float bloomStrength;\n uniform float bloomRadius;\n uniform float bloomFactors[NUM_MIPS];\n uniform vec3 bloomTintColors[NUM_MIPS];\n\n float lerpBloomFactor( const in float factor ) {\n\n float mirrorFactor = 1.2 - factor;\n return mix( factor, mirrorFactor, bloomRadius );\n\n }\n\n void main() {\n\n // 3.0 for backwards compatibility with previous alpha-based intensity\n vec3 bloom = 3.0 * bloomStrength * (\n lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +\n lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +\n lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +\n lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +\n lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb\n );\n\n float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );\n gl_FragColor = vec4( bloom, bloomAlpha );\n\n }"
1653
1566
  });
1654
1567
  }
1655
1568
  };
1656
- Pt.BlurDirectionX = new I(1, 0), Pt.BlurDirectionY = new I(0, 1);
1657
- //#endregion
1658
- //#region src/loops/gl/rng.js
1659
- function Ft(e) {
1660
- let t = e >>> 0;
1661
- return function() {
1662
- t |= 0, t = t + 1831565813 | 0;
1663
- let e = Math.imul(t ^ t >>> 15, 1 | t);
1664
- return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
1665
- };
1666
- }
1569
+ Rt.BlurDirectionX = new O(1, 0), Rt.BlurDirectionY = new O(0, 1);
1667
1570
  //#endregion
1668
1571
  //#region src/loops/gl/ribbonGeometry.js
1669
- function It(e, t, n, r) {
1572
+ function zt(e, t, n, r) {
1670
1573
  n = Math.min(n, e, t);
1671
1574
  let i = Math.max(4, Math.round(r / 4)), a = [
1672
1575
  {
@@ -1699,32 +1602,32 @@ function It(e, t, n, r) {
1699
1602
  }
1700
1603
  return o;
1701
1604
  }
1702
- function Lt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1 } = {}) {
1703
- let o = Ft(e >>> 0 || 1), s = (e) => (o() - .5) * 2 * e, c = Math.max(1, Math.round(t)), l = -((c - 1) * r) / 2, u = n, d = [], f = 0, p = (t, n) => {
1704
- d.push(new j(t, n, Math.sin(f * 1.7 + e) * i)), f += 1;
1605
+ function Bt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1 } = {}) {
1606
+ let o = f(e >>> 0 || 1), s = (e) => (o() - .5) * 2 * e, c = Math.max(1, Math.round(t)), l = -((c - 1) * r) / 2, u = n, d = [], p = 0, m = (t, n) => {
1607
+ d.push(new I(t, n, Math.sin(p * 1.7 + e) * i)), p += 1;
1705
1608
  };
1706
1609
  for (let e = 0; e < c; e++) {
1707
1610
  let t = l + e * r + s(r * .06), n = e % 2 == 0, i = n ? -u / 2 : u / 2, a = n ? u / 2 : -u / 2;
1708
- for (let e = 0; e < 10; e++) p(t, i + (a - i) * e / 10);
1611
+ for (let e = 0; e < 10; e++) m(t, i + (a - i) * e / 10);
1709
1612
  if (e < c - 1) {
1710
1613
  let i = l + (e + 1) * r, o = (t + i) / 2, s = (i - t) / 2, c = n ? 1 : -1;
1711
1614
  for (let e = 0; e <= 24; e++) {
1712
1615
  let t = e / 24 * Math.PI;
1713
- p(o - Math.cos(t) * s, a + c * Math.sin(t) * s);
1616
+ m(o - Math.cos(t) * s, a + c * Math.sin(t) * s);
1714
1617
  }
1715
1618
  }
1716
1619
  }
1717
1620
  if (a > 0 && d.length >= 2) {
1718
- let t = d[d.length - 1], n = d[d.length - 2], o = t.clone().sub(n).setZ(0).normalize(), s = new j(-o.y, o.x, 0).normalize(), c = r * .5, l = t.clone().add(s.clone().multiplyScalar(c)), u = Math.atan2(t.y - l.y, t.x - l.x), f = 1.1 * a;
1621
+ let t = d[d.length - 1], n = d[d.length - 2], o = t.clone().sub(n).setZ(0).normalize(), s = new I(-o.y, o.x, 0).normalize(), c = r * .5, l = t.clone().add(s.clone().multiplyScalar(c)), u = Math.atan2(t.y - l.y, t.x - l.x), f = 1.1 * a;
1719
1622
  for (let n = 1; n <= 44; n++) {
1720
1623
  let r = n / 44, a = u - f * Math.PI * 2 * r, o = c * (1 - .7 * r);
1721
- d.push(new j(l.x + Math.cos(a) * o, l.y + Math.sin(a) * o, t.z + Math.sin(r * 3 + e) * i * .4));
1624
+ d.push(new I(l.x + Math.cos(a) * o, l.y + Math.sin(a) * o, t.z + Math.sin(r * 3 + e) * i * .4));
1722
1625
  }
1723
1626
  }
1724
- return new Ae(d, !1, "centripetal");
1627
+ return new Oe(d, !1, "centripetal");
1725
1628
  }
1726
- function Rt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1, width: o = .5, ribbonThickness: s = .12, corner: c = .045, tubularSegments: l = 800, radialSegments: u = 48 } = {}) {
1727
- let d = Lt({
1629
+ function Vt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1, width: o = .5, ribbonThickness: s = .12, corner: c = .045, tubularSegments: l = 800, radialSegments: u = 48 } = {}) {
1630
+ let d = Bt({
1728
1631
  seed: e,
1729
1632
  loops: t,
1730
1633
  height: n,
@@ -1733,7 +1636,7 @@ function Rt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i
1733
1636
  curl: a
1734
1637
  });
1735
1638
  d.arcLengthDivisions = Math.max(400, l);
1736
- let f = d.computeFrenetFrames(l, !1), p = It(o / 2, s / 2, c, u), m = p.length, h = m + 1, g = [], _ = [], v = [], y = new j();
1639
+ let f = d.computeFrenetFrames(l, !1), p = zt(o / 2, s / 2, c, u), m = p.length, h = m + 1, g = [], _ = [], v = [], y = new I();
1737
1640
  for (let e = 0; e <= l; e++) {
1738
1641
  d.getPointAt(e / l, y);
1739
1642
  let t = f.normals[e], n = f.binormals[e];
@@ -1746,26 +1649,26 @@ function Rt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i
1746
1649
  let n = e * h + t, r = (e + 1) * h + t, i = (e + 1) * h + t + 1, a = e * h + t + 1;
1747
1650
  v.push(n, r, a, r, i, a);
1748
1651
  }
1749
- let b = g.length / 3;
1750
- d.getPointAt(0, y), g.push(y.x, y.y, y.z), _.push(0, .5);
1751
1652
  let ee = g.length / 3;
1653
+ d.getPointAt(0, y), g.push(y.x, y.y, y.z), _.push(0, .5);
1654
+ let te = g.length / 3;
1752
1655
  d.getPointAt(1, y), g.push(y.x, y.y, y.z), _.push(1, .5);
1753
1656
  for (let e = 0; e < m; e++) {
1754
- v.push(b, e + 1, e);
1657
+ v.push(ee, e + 1, e);
1755
1658
  let t = l * h;
1756
- v.push(ee, t + e, t + e + 1);
1659
+ v.push(te, t + e, t + e + 1);
1757
1660
  }
1758
- let x = new P();
1759
- return x.setAttribute("position", new L(g, 3)), x.setAttribute("uv", new L(_, 2)), x.setIndex(v), x.computeVertexNormals(), x.computeBoundingSphere(), x.userData = {
1661
+ let b = new A();
1662
+ return b.setAttribute("position", new V(g, 3)), b.setAttribute("uv", new V(_, 2)), b.setIndex(v), b.computeVertexNormals(), b.computeBoundingSphere(), b.userData = {
1760
1663
  tubularSegments: l,
1761
1664
  ringIndexCount: m * 6,
1762
1665
  bodyIndexCount: l * m * 6,
1763
1666
  totalIndexCount: v.length
1764
- }, x;
1667
+ }, b;
1765
1668
  }
1766
1669
  //#endregion
1767
1670
  //#region src/loops/gl/filterPass.js
1768
- var zt = {
1671
+ var Ht = {
1769
1672
  uniforms: {
1770
1673
  tDiffuse: { value: null },
1771
1674
  uAberration: { value: 0 },
@@ -1775,20 +1678,20 @@ var zt = {
1775
1678
  },
1776
1679
  vertexShader: "\n varying vec2 vUv;\n void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }\n ",
1777
1680
  fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform float uAberration, uGrain, uVignette, uTime;\n varying vec2 vUv;\n float rand(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }\n void main() {\n vec2 uv = vUv;\n vec2 dir = uv - 0.5;\n // chromatic aberration — split R/B outward, scaled by distance from centre\n float a = uAberration * 0.02;\n vec3 col;\n col.r = texture2D(tDiffuse, uv + dir * a).r;\n col.g = texture2D(tDiffuse, uv).g;\n col.b = texture2D(tDiffuse, uv - dir * a).b;\n // grain\n if (uGrain > 0.0) col += (rand(uv + fract(uTime)) - 0.5) * uGrain;\n // vignette\n if (uVignette > 0.0) {\n float v = smoothstep(0.85, 0.25, length(dir));\n col *= mix(1.0, v, uVignette);\n }\n gl_FragColor = vec4(col, 1.0);\n }\n "
1778
- }, Bt = .004, Vt = class {
1681
+ }, Ut = .004, Wt = class {
1779
1682
  constructor(e, { autoLoop: t = !1 } = {}) {
1780
- this.autoLoop = t, this.canvas = e, this.renderer = new T({
1683
+ this.autoLoop = t, this.canvas = e, this.renderer = new D({
1781
1684
  canvas: e,
1782
1685
  antialias: !0,
1783
1686
  preserveDrawingBuffer: !0,
1784
1687
  alpha: !0
1785
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N("#000000"), 1), this.renderer.toneMapping = 4, this.renderer.toneMappingExposure = 1.1, this.scene = new w(), this.camera = new z(36, 1, .1, 100), this.camera.position.set(0, 0, 6), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2.5, this.controls.maxDistance = 18, this.scene.add(new Te(16777215, .25));
1786
- let n = new O(16777215, 2.2);
1688
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M("#000000"), 1), this.renderer.toneMapping = 4, this.renderer.toneMappingExposure = 1.1, this.scene = new E(), this.camera = new w(36, 1, .1, 100), this.camera.position.set(0, 0, 6), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2.5, this.controls.maxDistance = 18, this.scene.add(new je(16777215, .25));
1689
+ let n = new H(16777215, 2.2);
1787
1690
  n.position.set(4, 5, 3), this.scene.add(n);
1788
- let r = new O(8956671, 1);
1789
- r.position.set(-4, -2, -3), this.scene.add(r), this.pmrem = new ce(this.renderer), this.envTex = this.pmrem.fromScene(new it(), .01).texture, this.scene.environment = this.envTex, this.group = new ve(), this.scene.add(this.group), this.matType = "glass", this.color = "#cfe0ff", this.roughness = .06, this.metalness = 1, this.ior = 1.55, this.dispersion = 10, this.material = this.makeMaterial("glass"), this.lineMat = new $e({
1691
+ let r = new H(8956671, 1);
1692
+ r.position.set(-4, -2, -3), this.scene.add(r), this.pmrem = new ke(this.renderer), this.envTex = this.pmrem.fromScene(new ht(), .01).texture, this.scene.environment = this.envTex, this.group = new ie(), this.scene.add(this.group), this.matType = "glass", this.color = "#cfe0ff", this.roughness = .06, this.metalness = 1, this.ior = 1.55, this.dispersion = 10, this.material = this.makeMaterial("glass"), this.lineMat = new lt({
1790
1693
  color: 10466006,
1791
- linewidth: 2.5 * Bt,
1694
+ linewidth: 2.5 * Ut,
1792
1695
  worldUnits: !0
1793
1696
  }), this.geomParams = {
1794
1697
  seed: 3,
@@ -1800,7 +1703,7 @@ var zt = {
1800
1703
  width: .5,
1801
1704
  ribbonThickness: .12,
1802
1705
  corner: .045
1803
- }, this.geom = Rt(this.geomParams), this.wireGeom = new Y(this.geom), this.mesh = new A(this.geom, this.material), this.wire = new rt(this.wireGeom, this.lineMat), this.wire.visible = !1, this.group.add(this.mesh), this.group.add(this.wire), this.composer = new jt(this.renderer), this.composer.addPass(new Mt(this.scene, this.camera)), this.bloom = new Pt(new I(1, 1), 0, .7, .85), this.composer.addPass(this.bloom), this.filter = new Ot(zt), this.composer.addPass(this.filter), this.dur = 12, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1706
+ }, this.geom = Vt(this.geomParams), this.wireGeom = new mt(this.geom), this.mesh = new C(this.geom, this.material), this.wire = new pt(this.wireGeom, this.lineMat), this.wire.visible = !1, this.group.add(this.mesh), this.group.add(this.wire), this.composer = new Ft(this.renderer), this.composer.addPass(new It(this.scene, this.camera)), this.bloom = new Rt(new O(1, 1), 0, .7, .85), this.composer.addPass(this.bloom), this.filter = new Mt(Ht), this.composer.addPass(this.filter), this.dur = 12, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1804
1707
  paused: !0,
1805
1708
  loop: !0,
1806
1709
  speed: 1,
@@ -1825,15 +1728,15 @@ var zt = {
1825
1728
  }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1826
1729
  }
1827
1730
  makeMaterial(e) {
1828
- let t = new N(this.color);
1829
- return e === "chrome" ? new C({
1731
+ let t = new M(this.color);
1732
+ return e === "chrome" ? new ge({
1830
1733
  color: t,
1831
1734
  metalness: 1,
1832
1735
  roughness: this.roughness,
1833
1736
  clearcoat: 1,
1834
1737
  clearcoatRoughness: .04,
1835
1738
  envMapIntensity: 2.2
1836
- }) : new C({
1739
+ }) : new ge({
1837
1740
  color: t,
1838
1741
  metalness: 0,
1839
1742
  roughness: this.roughness,
@@ -1858,7 +1761,7 @@ var zt = {
1858
1761
  }
1859
1762
  rebuildGeometry() {
1860
1763
  let e = this.geom, t = this.wireGeom;
1861
- this.geom = Rt(this.geomParams), this.wireGeom = new Y(this.geom), this.mesh.geometry = this.geom, this.wire.geometry = this.wireGeom, e.dispose(), t.dispose();
1764
+ this.geom = Vt(this.geomParams), this.wireGeom = new mt(this.geom), this.mesh.geometry = this.geom, this.wire.geometry = this.wireGeom, e.dispose(), t.dispose();
1862
1765
  }
1863
1766
  update({ globals: e, geom: t } = {}) {
1864
1767
  let n = !1;
@@ -1874,7 +1777,7 @@ var zt = {
1874
1777
  if (e) {
1875
1778
  this.globals = e, this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.ior = e.ior ?? this.ior, this.dispersion = e.dispersion ?? this.dispersion, this.setMaterialType(e.materialType || "glass"), this.applyMaterialProps(), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix());
1876
1779
  let t = !!e.wireframe;
1877
- this.mesh.visible = !t, this.wire.visible = t, this.lineMat.linewidth = (e.strokeWidth ?? 2.5) * Bt, this.bloom.strength = e.bloom ?? 0, this.filter.uniforms.uAberration.value = e.aberration ?? 0, this.filter.uniforms.uVignette.value = e.vignette ?? 0, this.filter.uniforms.uGrain.value = e.grain ?? 0;
1780
+ this.mesh.visible = !t, this.wire.visible = t, this.lineMat.linewidth = (e.strokeWidth ?? 2.5) * Ut, this.bloom.strength = e.bloom ?? 0, this.filter.uniforms.uAberration.value = e.aberration ?? 0, this.filter.uniforms.uVignette.value = e.vignette ?? 0, this.filter.uniforms.uGrain.value = e.grain ?? 0;
1878
1781
  }
1879
1782
  n && this.rebuildGeometry();
1880
1783
  }
@@ -1885,7 +1788,7 @@ var zt = {
1885
1788
  this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1886
1789
  }
1887
1790
  setBackground(e) {
1888
- this.renderer.setClearColor(new N(e), 1);
1791
+ this.renderer.setClearColor(new M(e), 1);
1889
1792
  }
1890
1793
  resetCamera() {
1891
1794
  this.camera.position.set(0, 0, 6), this.controls.target.set(0, 0, 0), this.controls.update();
@@ -1948,7 +1851,7 @@ var zt = {
1948
1851
  dispose() {
1949
1852
  cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.lineMat.dispose(), this.geom.dispose(), this.wireGeom.dispose(), this.bloom.dispose(), this.composer.dispose?.(), this.envTex.dispose(), this.pmrem.dispose(), this.renderer.dispose();
1950
1853
  }
1951
- }, Ht = "\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n", Ut = "\nvarying vec2 vUv;\nvoid main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Wt = `
1854
+ }, Gt = "\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n", Kt = "\nvarying vec2 vUv;\nvoid main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", qt = `
1952
1855
  uniform vec3 uColors[5];
1953
1856
  uniform int uCount;
1954
1857
  uniform float uTime;
@@ -1957,7 +1860,7 @@ uniform float uIntensity;
1957
1860
  uniform int uStyle;
1958
1861
  uniform vec3 uBase;
1959
1862
  varying vec2 vUv;
1960
- ${Ht}
1863
+ ${Gt}
1961
1864
  vec3 ramp(float t) {
1962
1865
  float ft = clamp(t, 0.0, 1.0) * float(uCount - 1);
1963
1866
  int i = int(floor(ft));
@@ -1999,14 +1902,14 @@ void main() {
1999
1902
  col = mix(uBase, col, uIntensity);
2000
1903
  gl_FragColor = vec4(col, 1.0);
2001
1904
  }
2002
- `, Gt = `
1905
+ `, Jt = `
2003
1906
  uniform float uTime;
2004
1907
  uniform float uDistort;
2005
1908
  uniform float uSeedOffset;
2006
1909
  varying vec3 vNormal;
2007
1910
  varying vec3 vWorldPos;
2008
1911
  varying vec3 vViewDir;
2009
- ${Ht}
1912
+ ${Gt}
2010
1913
  void main() {
2011
1914
  vec3 p = position;
2012
1915
  float n = snoise(position * 1.4 + vec3(uSeedOffset) + vec3(0.0, 0.0, uTime * 0.35));
@@ -2017,7 +1920,7 @@ void main() {
2017
1920
  vViewDir = cameraPosition - world.xyz;
2018
1921
  gl_Position = projectionMatrix * viewMatrix * world;
2019
1922
  }
2020
- `, Kt = `
1923
+ `, Yt = `
2021
1924
  uniform vec3 uColors[5];
2022
1925
  uniform int uCount;
2023
1926
  uniform int uDriver;
@@ -2028,7 +1931,7 @@ uniform float uSeedOffset;
2028
1931
  varying vec3 vNormal;
2029
1932
  varying vec3 vWorldPos;
2030
1933
  varying vec3 vViewDir;
2031
- ${Ht}
1934
+ ${Gt}
2032
1935
  vec3 ramp(float t) {
2033
1936
  float ft = clamp(t, 0.0, 1.0) * float(uCount - 1);
2034
1937
  int i = int(floor(ft));
@@ -2054,20 +1957,20 @@ void main() {
2054
1957
  col += (hash(gl_FragCoord.xy) - 0.5) * uGrain;
2055
1958
  gl_FragColor = vec4(col, 1.0);
2056
1959
  }
2057
- `, qt = "#0b0b0e", Q = 14, $ = 5, Jt = () => {
1960
+ `, Xt = "#0b0b0e", Z = 14, Q = 5, Zt = () => {
2058
1961
  let e = document.createElement("canvas");
2059
1962
  e.width = e.height = 128;
2060
1963
  let t = e.getContext("2d"), n = t.createRadialGradient(64, 64, 0, 64, 64, 64);
2061
- return n.addColorStop(0, "rgba(255,255,255,0.85)"), n.addColorStop(.4, "rgba(255,255,255,0.25)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 128, 128), new Ce(e);
2062
- }, Yt = class {
1964
+ return n.addColorStop(0, "rgba(255,255,255,0.85)"), n.addColorStop(.4, "rgba(255,255,255,0.25)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 128, 128), new Me(e);
1965
+ }, Qt = class {
2063
1966
  constructor(e, { autoLoop: t = !1 } = {}) {
2064
- this.autoLoop = t, this.canvas = e, this.renderer = new T({
1967
+ this.autoLoop = t, this.canvas = e, this.renderer = new D({
2065
1968
  canvas: e,
2066
1969
  antialias: !0,
2067
1970
  preserveDrawingBuffer: !0
2068
- }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(qt), 1), this.camera = new z(32, 1, .1, 50), this.camera.position.set(0, .15, 4.2), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 1.6, this.controls.maxDistance = 12, this.glowTex = Jt(), this.bgGeo = new v(2, 2), this.bgCam = new E(), this.bgBase = new N(qt), this.geoms = {
2069
- sphere: new re(1.02, 96, 96),
2070
- plane: new v(2.1, 1.5, 128, 96)
1971
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new M(Xt), 1), this.camera = new w(32, 1, .1, 50), this.camera.position.set(0, .15, 4.2), this.camera.lookAt(0, 0, 0), this.controls = new R(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 1.6, this.controls.maxDistance = 12, this.glowTex = Zt(), this.bgGeo = new S(2, 2), this.bgCam = new j(), this.bgBase = new M(Xt), this.geoms = {
1972
+ sphere: new he(1.02, 96, 96),
1973
+ plane: new S(2.1, 1.5, 128, 96)
2071
1974
  }, this.tiles = [], this.rects = [], this.mode = "grid", this.idx = 0, this.globals = {
2072
1975
  glow: .6,
2073
1976
  grain: .06,
@@ -2078,21 +1981,21 @@ void main() {
2078
1981
  }, this.time = 0, this.last = performance.now(), this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
2079
1982
  }
2080
1983
  buildTile(e) {
2081
- let t = new w(), n = new S({
2082
- vertexShader: Gt,
2083
- fragmentShader: Kt,
1984
+ let t = new E(), n = new T({
1985
+ vertexShader: Jt,
1986
+ fragmentShader: Yt,
2084
1987
  side: 2,
2085
1988
  uniforms: {
2086
1989
  uTime: { value: 0 },
2087
1990
  uDistort: { value: 0 },
2088
1991
  uSeedOffset: { value: 0 },
2089
- uColors: { value: Array.from({ length: $ }, () => new N()) },
1992
+ uColors: { value: Array.from({ length: Q }, () => new M()) },
2090
1993
  uCount: { value: 2 },
2091
1994
  uDriver: { value: 0 },
2092
1995
  uGlow: { value: .6 },
2093
1996
  uGrain: { value: .06 }
2094
1997
  }
2095
- }), r = new A(this.geoms[e.shape], n), i = new me(new pe({
1998
+ }), r = new C(this.geoms[e.shape], n), i = new ne(new Te({
2096
1999
  map: this.glowTex,
2097
2000
  transparent: !0,
2098
2001
  depthWrite: !1,
@@ -2100,22 +2003,22 @@ void main() {
2100
2003
  opacity: .3
2101
2004
  }));
2102
2005
  i.position.set(0, -.5, -1.2), i.scale.set(3.6, 3.6, 1), t.add(i), t.add(r);
2103
- let a = new S({
2104
- vertexShader: Ut,
2105
- fragmentShader: Wt,
2006
+ let a = new T({
2007
+ vertexShader: Kt,
2008
+ fragmentShader: qt,
2106
2009
  depthTest: !1,
2107
2010
  depthWrite: !1,
2108
2011
  uniforms: {
2109
2012
  uTime: { value: 0 },
2110
- uColors: { value: Array.from({ length: $ }, () => new N()) },
2013
+ uColors: { value: Array.from({ length: Q }, () => new M()) },
2111
2014
  uCount: { value: 2 },
2112
2015
  uSeedOffset: { value: 0 },
2113
2016
  uIntensity: { value: .75 },
2114
2017
  uStyle: { value: 0 },
2115
2018
  uBase: { value: this.bgBase }
2116
2019
  }
2117
- }), o = new w();
2118
- return o.add(new A(this.bgGeo, a)), {
2020
+ }), o = new E();
2021
+ return o.add(new C(this.bgGeo, a)), {
2119
2022
  scene: t,
2120
2023
  mesh: r,
2121
2024
  material: n,
@@ -2127,9 +2030,9 @@ void main() {
2127
2030
  }
2128
2031
  applySpec(e, t) {
2129
2032
  let n = e.material.uniforms;
2130
- e.mesh.geometry = this.geoms[t.shape], e.mesh.rotation.set(t.shape === "plane" ? -.35 : .12, 0, 0), n.uDistort.value = t.distort, n.uSeedOffset.value = t.seed % 977, n.uDriver.value = t.driver, n.uCount.value = Math.min(t.colors.length, $), t.colors.slice(0, $).forEach((e, t) => n.uColors.value[t].set(e)), e.glow.material.color.set(t.colors[Math.floor(t.colors.length / 2)]);
2033
+ e.mesh.geometry = this.geoms[t.shape], e.mesh.rotation.set(t.shape === "plane" ? -.35 : .12, 0, 0), n.uDistort.value = t.distort, n.uSeedOffset.value = t.seed % 977, n.uDriver.value = t.driver, n.uCount.value = Math.min(t.colors.length, Q), t.colors.slice(0, Q).forEach((e, t) => n.uColors.value[t].set(e)), e.glow.material.color.set(t.colors[Math.floor(t.colors.length / 2)]);
2131
2034
  let r = e.bgMaterial.uniforms;
2132
- r.uCount.value = Math.min(t.colors.length, $), t.colors.slice(0, $).forEach((e, t) => r.uColors.value[t].set(e)), r.uSeedOffset.value = t.seed % 977, e.spec = t;
2035
+ r.uCount.value = Math.min(t.colors.length, Q), t.colors.slice(0, Q).forEach((e, t) => r.uColors.value[t].set(e)), r.uSeedOffset.value = t.seed % 977, e.spec = t;
2133
2036
  }
2134
2037
  update({ specs: e, mode: t, idx: n, globals: r }) {
2135
2038
  if (e) {
@@ -2177,10 +2080,10 @@ void main() {
2177
2080
  };
2178
2081
  this.rects = [e], this.renderTile(this.tiles[this.idx], e);
2179
2082
  } else {
2180
- let e = this.tiles.length, t = Math.ceil(e / 3), n = (this.w - Q * 4) / 3, r = (this.h - Q * (t + 1)) / t;
2083
+ let e = this.tiles.length, t = Math.ceil(e / 3), n = (this.w - 56) / 3, r = (this.h - Z * (t + 1)) / t;
2181
2084
  this.rects = this.tiles.map((e, t) => ({
2182
- x: Q + t % 3 * (n + Q),
2183
- y: Q + Math.floor(t / 3) * (r + Q),
2085
+ x: Z + t % 3 * (n + Z),
2086
+ y: Z + Math.floor(t / 3) * (r + Z),
2184
2087
  w: n,
2185
2088
  h: r
2186
2089
  })), this.tiles.forEach((e, t) => this.renderTile(e, this.rects[t]));
@@ -2189,7 +2092,7 @@ void main() {
2189
2092
  }
2190
2093
  };
2191
2094
  setBackground(e) {
2192
- this.renderer.setClearColor(new N(e), 1), this.bgBase.set(e);
2095
+ this.renderer.setClearColor(new M(e), 1), this.bgBase.set(e);
2193
2096
  }
2194
2097
  resetCamera() {
2195
2098
  this.camera.position.set(0, .15, 4.2), this.controls.target.set(0, 0, 0), this.controls.update();
@@ -2206,61 +2109,87 @@ void main() {
2206
2109
  for (let e of Object.values(this.geoms)) e.dispose();
2207
2110
  this.bgGeo.dispose(), this.glowTex.dispose(), this.renderer.dispose();
2208
2111
  }
2209
- };
2210
- //#endregion
2211
- //#region src/loops/gl/host.js
2212
- function Xt(e, t) {
2213
- let n = Qt(e, t);
2214
- return n.controls && (n.controls.enabled = !1), n;
2112
+ }, $ = /* @__PURE__ */ new Map(), $t = /* @__PURE__ */ new WeakMap(), en = /* @__PURE__ */ new WeakMap();
2113
+ function tn(e, t) {
2114
+ let n = an(e, t);
2115
+ n.controls && (n.controls.enabled = !1);
2116
+ let r = t?.dataset?.layerId;
2117
+ return r && $.set(r, n), n;
2215
2118
  }
2216
- function Zt(e, t, n) {
2119
+ function nn(e, t) {
2120
+ let n = $.get(e);
2121
+ return n ? t === "resetCamera" && (n.resetCamera?.(), !0) : !1;
2122
+ }
2123
+ function rn(e, t, n) {
2217
2124
  t?.controls && (t.controls.enabled = !!n);
2218
2125
  }
2219
- function Qt(e, t) {
2126
+ function an(e, t) {
2220
2127
  switch (e.engine) {
2221
2128
  case "drift": {
2222
- let n = new Re(e.family);
2129
+ let n = new Ge(e.family);
2223
2130
  return n.init(t), n;
2224
2131
  }
2225
2132
  case "iridescent": {
2226
- let e = new Ve();
2133
+ let e = new Je();
2227
2134
  return e.init(t), e;
2228
2135
  }
2229
2136
  case "softforms": {
2230
- let e = new Ge();
2137
+ let e = new $e();
2231
2138
  return e.init(t), e;
2232
2139
  }
2233
2140
  case "softforms3d": {
2234
- let e = new Ye();
2141
+ let e = new it();
2235
2142
  return e.init(t), e;
2236
2143
  }
2237
- case "scene": return new ht(t);
2238
- case "forms": return new yt(t);
2239
- case "environment": return new Ct(t);
2240
- case "ribbon": return new Vt(t);
2241
- case "mesh": return new Yt(t);
2144
+ case "scene": return new yt(t);
2145
+ case "forms": return new Ct(t);
2146
+ case "environment": return new Dt(t);
2147
+ case "ribbon": return new Wt(t);
2148
+ case "mesh": return new Qt(t);
2242
2149
  default: throw Error(`unknown gl engine "${e.engine}"`);
2243
2150
  }
2244
2151
  }
2245
- var $t = {
2152
+ var on = {
2246
2153
  loop: !0,
2247
2154
  paused: !1,
2248
2155
  speed: 0
2249
2156
  };
2250
- function en(e, t, n) {
2251
- tn(e, t, n), e.bgToggle && t.renderer?.setClearAlpha(n.bgOn === !1 ? 0 : 1);
2157
+ function sn(e, n, r) {
2158
+ if (cn(e, n, r), typeof n.setPointer == "function") {
2159
+ let e = t.getCtx().stage, i = r.w ?? 0, a = r.h ?? 0, o = null;
2160
+ if (e && i > 0 && a > 0) {
2161
+ let t = (e.x - (r.x ?? 0)) / i, n = (e.y - (r.y ?? 0)) / a;
2162
+ t >= 0 && t <= 1 && n >= 0 && n <= 1 && (o = {
2163
+ x: t,
2164
+ y: n,
2165
+ down: !!e.down
2166
+ });
2167
+ }
2168
+ n.setPointer(o);
2169
+ }
2170
+ e.bgToggle && n.renderer?.setClearAlpha(r.bgOn === !1 ? 0 : 1);
2252
2171
  }
2253
- function tn(e, t, n) {
2172
+ function cn(e, t, n) {
2254
2173
  switch (e.engine) {
2255
- case "scene":
2256
- t.update({
2174
+ case "scene": {
2175
+ $t.set(t, n.duration ?? 8);
2176
+ let e = {
2177
+ tube: n.tube ?? .32,
2178
+ p: n.pWinds ?? 2,
2179
+ q: n.qWinds ?? 3,
2180
+ detail: n.detail ?? 0
2181
+ }, r = `${e.tube}|${e.p}|${e.q}|${e.detail}`, i = en.get(t) !== r;
2182
+ i && en.set(t, r), t.update({
2257
2183
  primitive: n.primitive,
2184
+ ...i ? { params: e } : {},
2258
2185
  globals: {
2259
2186
  preset: n.pose,
2260
- animMode: "preset",
2187
+ animMode: n.animMode === "keyframes" || n.animMode === "keyframe" ? "keyframe" : "preset",
2188
+ keyframes: Array.isArray(n.keyframes) && n.keyframes.length ? n.keyframes : g,
2261
2189
  loop: !0,
2262
2190
  paused: !1,
2263
2191
  speed: 0,
2192
+ duration: n.duration ?? 8,
2264
2193
  count: n.count,
2265
2194
  arrangement: n.arrangement,
2266
2195
  spread: n.spread,
@@ -2276,11 +2205,15 @@ function tn(e, t, n) {
2276
2205
  roughness: n.roughness,
2277
2206
  metalness: n.metalness,
2278
2207
  color: n.sceneColor,
2279
- flatShading: !1,
2280
- showAxis: !1
2208
+ flatShading: !!n.flatShading,
2209
+ rounding: n.rounding,
2210
+ showAxis: !!n.showAxis,
2211
+ axisLength: n.axisLength,
2212
+ axisOpacity: n.axisOpacity
2281
2213
  }
2282
2214
  });
2283
2215
  return;
2216
+ }
2284
2217
  case "softforms3d":
2285
2218
  t.setParams(n), n.camTheta != null && t.setCamera({
2286
2219
  theta: n.camTheta,
@@ -2292,7 +2225,7 @@ function tn(e, t, n) {
2292
2225
  t.update({
2293
2226
  form: n.form,
2294
2227
  globals: {
2295
- ...$t,
2228
+ ...on,
2296
2229
  duration: 8,
2297
2230
  samples: n.samples,
2298
2231
  cycles: n.cycles,
@@ -2313,7 +2246,7 @@ function tn(e, t, n) {
2313
2246
  t.update({
2314
2247
  env: n.env,
2315
2248
  globals: {
2316
- ...$t,
2249
+ ...on,
2317
2250
  duration: 8,
2318
2251
  samples: n.samples,
2319
2252
  cycles: n.cycles,
@@ -2327,7 +2260,7 @@ function tn(e, t, n) {
2327
2260
  });
2328
2261
  return;
2329
2262
  case "ribbon":
2330
- t.update({
2263
+ $t.set(t, n.duration ?? 12), t.update({
2331
2264
  geom: {
2332
2265
  seed: n.seed,
2333
2266
  loops: n.loops,
@@ -2340,8 +2273,8 @@ function tn(e, t, n) {
2340
2273
  corner: n.corner ?? .045
2341
2274
  },
2342
2275
  globals: {
2343
- ...$t,
2344
- duration: 12,
2276
+ ...on,
2277
+ duration: n.duration ?? 12,
2345
2278
  flow: n.flow,
2346
2279
  cameraOrbit: n.cameraOrbit,
2347
2280
  orbitSpeed: n.orbitSpeed,
@@ -2352,8 +2285,8 @@ function tn(e, t, n) {
2352
2285
  metalness: n.metalness,
2353
2286
  ior: n.ior,
2354
2287
  dispersion: n.dispersion,
2355
- wireframe: !1,
2356
- strokeWidth: 2.5,
2288
+ wireframe: !!n.wireframe,
2289
+ strokeWidth: n.wireStroke ?? 2.5,
2357
2290
  aberration: n.aberration,
2358
2291
  bloom: n.bloom,
2359
2292
  vignette: n.vignette,
@@ -2362,21 +2295,11 @@ function tn(e, t, n) {
2362
2295
  }), n.background != null && t.setBackground(n.background);
2363
2296
  return;
2364
2297
  case "mesh": {
2365
- let e = Ft(n.seed ?? 7);
2366
- e(), e(), e();
2367
- let i = e(), a = .12 + e() * .3, o = e() * Math.PI * 2, s = f.find((e) => e.id === n.palette) || f[0];
2298
+ let e = n.mode === "grid" ? "grid" : "single", r = n.seed ?? 7, i = e === "grid" ? Array.from({ length: 9 }, (e, t) => r + t * 7919) : [r];
2368
2299
  t.update({
2369
- mode: "single",
2300
+ mode: e,
2370
2301
  idx: 0,
2371
- specs: [{
2372
- seed: n.seed ?? 7,
2373
- shape: n.shape || "sphere",
2374
- colors: s.colors.map((e) => r(e, n.hueShift || 0)),
2375
- driver: n.driver ?? 0,
2376
- distort: (n.distort ?? .5) * (.6 + i * .5),
2377
- rotSpeed: a,
2378
- phase: o
2379
- }],
2302
+ specs: i.map((e) => ln(e, n)),
2380
2303
  globals: {
2381
2304
  glow: n.glow,
2382
2305
  grain: n.grain,
@@ -2385,21 +2308,45 @@ function tn(e, t, n) {
2385
2308
  bg: n.bgAmount ?? .85,
2386
2309
  bgStyle: n.bgStyle ?? 0
2387
2310
  }
2388
- });
2311
+ }), t.setBackground(d(n.themeId ?? "kol", !!n.themeInvert).bg);
2389
2312
  return;
2390
2313
  }
2391
2314
  default: t.setParams(n);
2392
2315
  }
2393
2316
  }
2394
- function nn(e, t, { u: n, dt: r }) {
2395
- e.drive === "phase" ? t.renderAtPhase(n) : e.drive === "seek" ? (t.seek(n), t.frame(0)) : t.frame(r);
2317
+ function ln(e, t) {
2318
+ let n = f(e);
2319
+ n(), n(), n();
2320
+ let r = n(), i = .12 + n() * .3, a = n() * Math.PI * 2, o = s.find((e) => e.id === t.palette) || s[0];
2321
+ return {
2322
+ seed: e,
2323
+ shape: t.shape || "sphere",
2324
+ colors: o.colors.map((e) => v(e, t.hueShift || 0)),
2325
+ driver: t.driver ?? 0,
2326
+ distort: (t.distort ?? .5) * (.6 + r * .5),
2327
+ rotSpeed: i,
2328
+ phase: a
2329
+ };
2330
+ }
2331
+ function un(e, n, { u: r, dt: i }) {
2332
+ if (e.drive === "phase") n.renderAtPhase(r);
2333
+ else if (e.drive === "seek") {
2334
+ let e = $t.get(n), i = e ? m(r, _(e, t.getLoopSeconds())) : r;
2335
+ n.seek(i), n.frame(0);
2336
+ } else n.frame(i);
2396
2337
  }
2397
- function rn(e) {
2398
- if (e) try {
2338
+ function dn(e) {
2339
+ if (!e) return;
2340
+ for (let [t, n] of $) n === e && $.delete(t);
2341
+ let t = e.renderer;
2342
+ try {
2399
2343
  typeof e.dispose == "function" ? e.dispose() : typeof e.destroy == "function" && e.destroy();
2400
2344
  } catch (e) {
2401
2345
  console.warn("[gl] engine dispose failed (ignored):", e?.message ?? e);
2402
2346
  }
2347
+ try {
2348
+ t?.forceContextLoss?.();
2349
+ } catch {}
2403
2350
  }
2404
2351
  //#endregion
2405
- export { en as applyParams, Xt as createEngine, rn as destroyEngine, nn as driveEngine, Zt as setCameraDrag };
2352
+ export { sn as applyParams, tn as createEngine, dn as destroyEngine, un as driveEngine, nn as hostAction, rn as setCameraDrag };