trillion3d 1.0.2 → 1.0.3-next.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 (1158) hide show
  1. package/dist/pageWorker.js +1 -1
  2. package/dist/pageWorker.js.map +2 -2
  3. package/dist/sdk-browser/src/geometry/cluster/shippedBytes.d.ts +15 -4
  4. package/dist/sdk-browser/src/geometry/cluster/shippedBytes.js +56 -7
  5. package/dist/sdk-browser/src/gpu/noise/blueNoise.bin.js +1 -0
  6. package/dist/sdk-browser/src/gpu/noise/blueNoiseSource.js +6 -2
  7. package/dist/sdk-browser/src/lighting/direct/skinTable.bin.js +1 -0
  8. package/dist/sdk-browser/src/lighting/direct/skinTableSource.js +5 -2
  9. package/dist/sdk-browser/src/measurement/buildProvenance.js +1 -1
  10. package/dist/sdk-browser/src/wasm/kernels.wasm.js +1 -0
  11. package/dist/sdk-browser/src/wasm/sdkWasm.d.ts +4 -3
  12. package/dist/sdk-browser/src/wasm/sdkWasm.js +9 -5
  13. package/dist/sdk-core/src/contracts/base.js +1 -1
  14. package/dist/sdk-node/src/cli/cli.mjs +0 -0
  15. package/dist/trillion3d-aoCode-2JTKFXZ5.js +489 -0
  16. package/dist/trillion3d-assemblies-BENCUAG3.js +2 -0
  17. package/dist/trillion3d-audioCode-M3I6FF7A.js +2 -0
  18. package/dist/trillion3d-autoExposureCode-AQ3IV5LH.js +198 -0
  19. package/dist/trillion3d-avatarCode-RTIDGTIA.js +2 -0
  20. package/dist/trillion3d-bounceCode-GEAWSI3A.js +4675 -0
  21. package/dist/trillion3d-catalogueCode-KZ3X7U7G.js +2 -0
  22. package/dist/trillion3d-chunk-22KA6FS4.js +116 -0
  23. package/dist/trillion3d-chunk-25B7I4D5.js +177 -0
  24. package/dist/trillion3d-chunk-2D7RBB5X.js +132 -0
  25. package/dist/trillion3d-chunk-2EJ4CRNA.js +46 -0
  26. package/dist/trillion3d-chunk-2PKPG2QJ.js +519 -0
  27. package/dist/trillion3d-chunk-2YXWLU7F.js +2 -0
  28. package/dist/trillion3d-chunk-2ZIQ3EEG.js +12 -0
  29. package/dist/trillion3d-chunk-33J4ZHIV.js +113 -0
  30. package/dist/trillion3d-chunk-3CTKK6Y4.js +14 -0
  31. package/dist/trillion3d-chunk-3F65K5TK.js +2 -0
  32. package/dist/trillion3d-chunk-3IRHFCKO.js +2 -0
  33. package/dist/trillion3d-chunk-3OWQBLPF.js +2 -0
  34. package/dist/trillion3d-chunk-3QKVCESS.js +2 -0
  35. package/dist/trillion3d-chunk-3TG7TWTW.js +56 -0
  36. package/dist/trillion3d-chunk-3UAK2IRC.js +91 -0
  37. package/dist/trillion3d-chunk-3VO6VVHD.js +4 -0
  38. package/dist/trillion3d-chunk-3W3YJ4KI.js +4 -0
  39. package/dist/trillion3d-chunk-3XBFYA3P.js +2 -0
  40. package/dist/trillion3d-chunk-435NEAXB.js +2 -0
  41. package/dist/trillion3d-chunk-4JYI3X5D.js +2 -0
  42. package/dist/trillion3d-chunk-4KEDPBE4.js +2 -0
  43. package/dist/trillion3d-chunk-4KWKWEQL.js +26 -0
  44. package/dist/trillion3d-chunk-4Z6VA66T.js +303 -0
  45. package/dist/trillion3d-chunk-5243PXB7.js +2 -0
  46. package/dist/trillion3d-chunk-53CFT7G7.js +2 -0
  47. package/dist/trillion3d-chunk-53QFLAA3.js +16 -0
  48. package/dist/trillion3d-chunk-56N6ZOBE.js +2 -0
  49. package/dist/trillion3d-chunk-5E744XXD.js +17 -0
  50. package/dist/trillion3d-chunk-5KEW2ZOY.js +2 -0
  51. package/dist/trillion3d-chunk-5ORGGJA5.js +2 -0
  52. package/dist/trillion3d-chunk-5RMOZCQA.js +2 -0
  53. package/dist/trillion3d-chunk-5SJT7EQ3.js +2 -0
  54. package/dist/trillion3d-chunk-5TTX63XG.js +24 -0
  55. package/dist/trillion3d-chunk-5WEWDH7F.js +2 -0
  56. package/dist/trillion3d-chunk-64WTBYW5.js +328 -0
  57. package/dist/trillion3d-chunk-6I7I5ZYU.js +2 -0
  58. package/dist/trillion3d-chunk-6OYOGQUQ.js +172 -0
  59. package/dist/trillion3d-chunk-6PMAMKLI.js +2 -0
  60. package/dist/trillion3d-chunk-6S7S5WI5.js +2 -0
  61. package/dist/trillion3d-chunk-6UP3ZCNV.js +2 -0
  62. package/dist/trillion3d-chunk-6WOJ6TQD.js +2 -0
  63. package/dist/trillion3d-chunk-6WS2EEBU.js +86 -0
  64. package/dist/trillion3d-chunk-6WUY2OOX.js +68 -0
  65. package/dist/trillion3d-chunk-72FCWPUJ.js +2 -0
  66. package/dist/trillion3d-chunk-72IAEP44.js +2 -0
  67. package/dist/trillion3d-chunk-77FPYTBQ.js +2 -0
  68. package/dist/trillion3d-chunk-7AQANLZ3.js +2 -0
  69. package/dist/trillion3d-chunk-7ATTJ3AJ.js +27 -0
  70. package/dist/trillion3d-chunk-7G4WOX6B.js +583 -0
  71. package/dist/trillion3d-chunk-7LIWCQGR.js +2 -0
  72. package/dist/trillion3d-chunk-7N3FUKOD.js +155 -0
  73. package/dist/trillion3d-chunk-7QFOJHAZ.js +435 -0
  74. package/dist/trillion3d-chunk-7TIVZUM6.js +81 -0
  75. package/dist/trillion3d-chunk-7U7CHALH.js +2 -0
  76. package/dist/trillion3d-chunk-7UXM26LW.js +2 -0
  77. package/dist/trillion3d-chunk-7VTYT5MF.js +2 -0
  78. package/dist/trillion3d-chunk-A4ULELL5.js +2 -0
  79. package/dist/trillion3d-chunk-ADMXPAEH.js +592 -0
  80. package/dist/trillion3d-chunk-AFRFQ25D.js +9 -0
  81. package/dist/trillion3d-chunk-AIB6NXH4.js +2 -0
  82. package/dist/trillion3d-chunk-AIQAWNNP.js +11 -0
  83. package/dist/trillion3d-chunk-AMJ6I7P4.js +11 -0
  84. package/dist/trillion3d-chunk-AQAJMS5A.js +2 -0
  85. package/dist/trillion3d-chunk-ARDABN2G.js +165 -0
  86. package/dist/trillion3d-chunk-B3QB55EK.js +2 -0
  87. package/dist/trillion3d-chunk-B5NXEPES.js +2 -0
  88. package/dist/trillion3d-chunk-BARQSI5Q.js +2 -0
  89. package/dist/trillion3d-chunk-BCYA7LWA.js +2 -0
  90. package/dist/trillion3d-chunk-BIBJMHIN.js +125 -0
  91. package/dist/trillion3d-chunk-BIGALHRE.js +2 -0
  92. package/dist/trillion3d-chunk-BKON7HDQ.js +6 -0
  93. package/dist/trillion3d-chunk-BRHXHYWB.js +2 -0
  94. package/dist/trillion3d-chunk-BVXHXONN.js +2 -0
  95. package/dist/trillion3d-chunk-BWPZMIFY.js +4 -0
  96. package/dist/trillion3d-chunk-C2WWWTMZ.js +2 -0
  97. package/dist/trillion3d-chunk-C7DCG2NV.js +2 -0
  98. package/dist/trillion3d-chunk-CCZJZMRJ.js +2 -0
  99. package/dist/trillion3d-chunk-CFIW2PLU.js +76 -0
  100. package/dist/trillion3d-chunk-CH3UKBVF.js +6 -0
  101. package/dist/trillion3d-chunk-COAMUWUG.js +6 -0
  102. package/dist/trillion3d-chunk-CS3EWLHS.js +2 -0
  103. package/dist/trillion3d-chunk-CS6MYZM7.js +42 -0
  104. package/dist/trillion3d-chunk-CSVCHCKI.js +2 -0
  105. package/dist/trillion3d-chunk-CYW43B6C.js +1615 -0
  106. package/dist/trillion3d-chunk-D2UJO22L.js +2 -0
  107. package/dist/trillion3d-chunk-D5LNZFJU.js +2 -0
  108. package/dist/trillion3d-chunk-DJIWKT4L.js +217 -0
  109. package/dist/trillion3d-chunk-DNAAW2B5.js +2 -0
  110. package/dist/trillion3d-chunk-DOXBXQJU.js +2 -0
  111. package/dist/trillion3d-chunk-DQVEKWHY.js +46 -0
  112. package/dist/trillion3d-chunk-DQYIKRAI.js +77 -0
  113. package/dist/trillion3d-chunk-DX5UNL5O.js +2 -0
  114. package/dist/trillion3d-chunk-EF6DURKO.js +19 -0
  115. package/dist/trillion3d-chunk-EKH44M5H.js +438 -0
  116. package/dist/trillion3d-chunk-EKHMHUHO.js +2 -0
  117. package/dist/trillion3d-chunk-EKMPAWJU.js +2 -0
  118. package/dist/trillion3d-chunk-ELCIIOBC.js +2 -0
  119. package/dist/trillion3d-chunk-EME34J3O.js +2 -0
  120. package/dist/trillion3d-chunk-EMNL3VBH.js +17 -0
  121. package/dist/trillion3d-chunk-EOA6RIXX.js +2 -0
  122. package/dist/trillion3d-chunk-ESEYMHSX.js +2 -0
  123. package/dist/trillion3d-chunk-EVWXSXV3.js +2 -0
  124. package/dist/trillion3d-chunk-EW3266JI.js +2 -0
  125. package/dist/trillion3d-chunk-F5ZFHT7O.js +2 -0
  126. package/dist/trillion3d-chunk-FBPHTYO3.js +2 -0
  127. package/dist/trillion3d-chunk-FCITXHHL.js +2 -0
  128. package/dist/trillion3d-chunk-FG4VFY2I.js +2 -0
  129. package/dist/trillion3d-chunk-FJ6PAVLE.js +178 -0
  130. package/dist/trillion3d-chunk-FNZKGTZC.js +2 -0
  131. package/dist/trillion3d-chunk-FVKZE7SE.js +1953 -0
  132. package/dist/trillion3d-chunk-FXEJM7VG.js +2 -0
  133. package/dist/trillion3d-chunk-FYXZW5DA.js +13 -0
  134. package/dist/trillion3d-chunk-G3DRTVHN.js +988 -0
  135. package/dist/trillion3d-chunk-G4AJOGQ7.js +265 -0
  136. package/dist/trillion3d-chunk-GEI5JB66.js +20 -0
  137. package/dist/trillion3d-chunk-GHFAPXBM.js +2 -0
  138. package/dist/trillion3d-chunk-GI2T6FOU.js +184 -0
  139. package/dist/trillion3d-chunk-GJZNN5UJ.js +2 -0
  140. package/dist/trillion3d-chunk-GK2DII6G.js +27 -0
  141. package/dist/trillion3d-chunk-GPVAVLAF.js +2 -0
  142. package/dist/trillion3d-chunk-GTR23Z5K.js +2 -0
  143. package/dist/trillion3d-chunk-GVOSTFBW.js +59 -0
  144. package/dist/trillion3d-chunk-GYORYIF5.js +2 -0
  145. package/dist/trillion3d-chunk-H3DVML7I.js +2 -0
  146. package/dist/trillion3d-chunk-H7KLPWI5.js +2 -0
  147. package/dist/trillion3d-chunk-H7LQGPKQ.js +50 -0
  148. package/dist/trillion3d-chunk-HBJ6VZPO.js +10 -0
  149. package/dist/trillion3d-chunk-HBMBGWN2.js +19 -0
  150. package/dist/trillion3d-chunk-HBSLKLSZ.js +94 -0
  151. package/dist/trillion3d-chunk-HCG3ESSV.js +2 -0
  152. package/dist/trillion3d-chunk-HDQGK2TL.js +2 -0
  153. package/dist/trillion3d-chunk-HRCLDXIF.js +35 -0
  154. package/dist/trillion3d-chunk-HRIARS44.js +2 -0
  155. package/dist/trillion3d-chunk-HV2YN5CF.js +2 -0
  156. package/dist/trillion3d-chunk-I5M3F6OY.js +6 -0
  157. package/dist/trillion3d-chunk-I75EGJAB.js +2 -0
  158. package/dist/trillion3d-chunk-I7QRTDI7.js +125 -0
  159. package/dist/trillion3d-chunk-IAELZYJF.js +2 -0
  160. package/dist/trillion3d-chunk-ICJUDIVR.js +276 -0
  161. package/dist/trillion3d-chunk-IEYEFEDV.js +2 -0
  162. package/dist/trillion3d-chunk-IFLJYROA.js +2 -0
  163. package/dist/trillion3d-chunk-IFZHDHIG.js +104 -0
  164. package/dist/trillion3d-chunk-IHNPAPHM.js +74 -0
  165. package/dist/trillion3d-chunk-IJJXMYSL.js +2 -0
  166. package/dist/trillion3d-chunk-IJMFDLYO.js +2 -0
  167. package/dist/trillion3d-chunk-INTWD5DJ.js +35 -0
  168. package/dist/trillion3d-chunk-IWP6655A.js +2 -0
  169. package/dist/trillion3d-chunk-IZTRWVNI.js +771 -0
  170. package/dist/trillion3d-chunk-J2BIHJ55.js +2 -0
  171. package/dist/trillion3d-chunk-J3NX2PWF.js +54 -0
  172. package/dist/trillion3d-chunk-J6G75W5Q.js +45 -0
  173. package/dist/trillion3d-chunk-J7ML34IT.js +2 -0
  174. package/dist/trillion3d-chunk-JD25N5D6.js +59 -0
  175. package/dist/trillion3d-chunk-JDIIZKDU.js +2 -0
  176. package/dist/trillion3d-chunk-JHRQF53B.js +4 -0
  177. package/dist/trillion3d-chunk-JPN76QOL.js +2 -0
  178. package/dist/trillion3d-chunk-JRCGXELE.js +2 -0
  179. package/dist/trillion3d-chunk-JXIMDH6A.js +2 -0
  180. package/dist/trillion3d-chunk-K6R7UEQZ.js +27 -0
  181. package/dist/trillion3d-chunk-K72UANQN.js +2 -0
  182. package/dist/trillion3d-chunk-KKECIVIP.js +2 -0
  183. package/dist/trillion3d-chunk-KLGN5XV3.js +2 -0
  184. package/dist/trillion3d-chunk-KLIGAVUH.js +2 -0
  185. package/dist/trillion3d-chunk-KLP7IBDS.js +2 -0
  186. package/dist/trillion3d-chunk-KPFGILKK.js +285 -0
  187. package/dist/trillion3d-chunk-KR4PIU6F.js +2 -0
  188. package/dist/trillion3d-chunk-KRV5VQCR.js +4 -0
  189. package/dist/trillion3d-chunk-KUJMOLHB.js +2 -0
  190. package/dist/trillion3d-chunk-KUKNVBWH.js +167 -0
  191. package/dist/trillion3d-chunk-KXM3DYQH.js +2 -0
  192. package/dist/trillion3d-chunk-L2F5RZRX.js +2 -0
  193. package/dist/trillion3d-chunk-L2FRHLXI.js +18 -0
  194. package/dist/trillion3d-chunk-L3VCBYGD.js +2 -0
  195. package/dist/trillion3d-chunk-LAAPTFVW.js +2 -0
  196. package/dist/trillion3d-chunk-LANLTCBQ.js +607 -0
  197. package/dist/trillion3d-chunk-LE4HL44Z.js +2 -0
  198. package/dist/trillion3d-chunk-LEY2Q6DZ.js +188 -0
  199. package/dist/trillion3d-chunk-LMWJTQFR.js +2 -0
  200. package/dist/trillion3d-chunk-LQLIXMMD.js +400 -0
  201. package/dist/trillion3d-chunk-LTWG3NOL.js +2 -0
  202. package/dist/trillion3d-chunk-M773YMP6.js +2 -0
  203. package/dist/trillion3d-chunk-MAKYPLYF.js +13 -0
  204. package/dist/trillion3d-chunk-MCNOP7UR.js +2 -0
  205. package/dist/trillion3d-chunk-MCSS3F6E.js +40 -0
  206. package/dist/trillion3d-chunk-MF4CAU3R.js +2 -0
  207. package/dist/trillion3d-chunk-MJTRABFR.js +242 -0
  208. package/dist/trillion3d-chunk-MQBDHCB3.js +2 -0
  209. package/dist/trillion3d-chunk-MUMQYHCQ.js +82 -0
  210. package/dist/trillion3d-chunk-MXZGFCOM.js +1166 -0
  211. package/dist/trillion3d-chunk-N33FXDXZ.js +2 -0
  212. package/dist/trillion3d-chunk-N7EXMVTQ.js +756 -0
  213. package/dist/trillion3d-chunk-N7EXMVTQ.js.map +6 -0
  214. package/dist/trillion3d-chunk-N7YEU2CT.js +2 -0
  215. package/dist/trillion3d-chunk-NB7XML37.js +2 -0
  216. package/dist/trillion3d-chunk-NBFOHDNN.js +2 -0
  217. package/dist/trillion3d-chunk-NEVMYKGT.js +28 -0
  218. package/dist/trillion3d-chunk-NHC4DXYP.js +2 -0
  219. package/dist/trillion3d-chunk-NNF42O54.js +197 -0
  220. package/dist/trillion3d-chunk-NTHEHPA5.js +418 -0
  221. package/dist/trillion3d-chunk-NVYEQ3JS.js +40 -0
  222. package/dist/trillion3d-chunk-NZRMWUGY.js +3109 -0
  223. package/dist/trillion3d-chunk-OD3JBU6D.js +5 -0
  224. package/dist/trillion3d-chunk-OFCF3GAC.js +360 -0
  225. package/dist/trillion3d-chunk-OHFYUKAD.js +2 -0
  226. package/dist/trillion3d-chunk-OHTUNWUN.js +2 -0
  227. package/dist/trillion3d-chunk-OLDTBAXR.js +2537 -0
  228. package/dist/trillion3d-chunk-OYZFVYYH.js +107 -0
  229. package/dist/trillion3d-chunk-P35JRX3H.js +2 -0
  230. package/dist/trillion3d-chunk-P3HTLS2O.js +2 -0
  231. package/dist/trillion3d-chunk-P7UZ7W2B.js +377 -0
  232. package/dist/trillion3d-chunk-PDWU4CCX.js +2 -0
  233. package/dist/trillion3d-chunk-PFMAOUBW.js +70 -0
  234. package/dist/trillion3d-chunk-PHE5OKAE.js +277 -0
  235. package/dist/trillion3d-chunk-PJN3TXFS.js +14 -0
  236. package/dist/trillion3d-chunk-PJN3TXFS.js.map +6 -0
  237. package/dist/trillion3d-chunk-PMF6JTVJ.js +2 -0
  238. package/dist/trillion3d-chunk-PXYUWON5.js +2 -0
  239. package/dist/trillion3d-chunk-PYVXDVAE.js +79 -0
  240. package/dist/trillion3d-chunk-PZBXWJFT.js +139 -0
  241. package/dist/trillion3d-chunk-Q2T4HBTW.js +2 -0
  242. package/dist/trillion3d-chunk-QAHCZ4CN.js +2 -0
  243. package/dist/trillion3d-chunk-QFIAXDBJ.js +2 -0
  244. package/dist/trillion3d-chunk-QGHAYZR3.js +2 -0
  245. package/dist/trillion3d-chunk-QMREUFAO.js +2 -0
  246. package/dist/trillion3d-chunk-QN7VBGUP.js +2 -0
  247. package/dist/trillion3d-chunk-QVFWEZOK.js +318 -0
  248. package/dist/trillion3d-chunk-QW5YCJAB.js +100 -0
  249. package/dist/trillion3d-chunk-R2A7QWWZ.js +2 -0
  250. package/dist/trillion3d-chunk-R4BXG67P.js +2 -0
  251. package/dist/trillion3d-chunk-R56L2MST.js +2 -0
  252. package/dist/trillion3d-chunk-RLDDQEQJ.js +10 -0
  253. package/dist/trillion3d-chunk-RMFAMI5T.js +2 -0
  254. package/dist/trillion3d-chunk-ROHK5HT5.js +19 -0
  255. package/dist/trillion3d-chunk-RPMC2FKD.js +2 -0
  256. package/dist/trillion3d-chunk-RTBXAMIZ.js +113 -0
  257. package/dist/trillion3d-chunk-S2NA64OJ.js +2 -0
  258. package/dist/trillion3d-chunk-SPIIJAMX.js +34 -0
  259. package/dist/trillion3d-chunk-SSWVBSJZ.js +2 -0
  260. package/dist/trillion3d-chunk-SUDBSFLJ.js +2 -0
  261. package/dist/trillion3d-chunk-SUU45ZK7.js +2 -0
  262. package/dist/trillion3d-chunk-TFNOURGL.js +6 -0
  263. package/dist/trillion3d-chunk-TLIN2DEK.js +1505 -0
  264. package/dist/trillion3d-chunk-TLO4XKYG.js +2 -0
  265. package/dist/trillion3d-chunk-TVYIOVGI.js +2 -0
  266. package/dist/trillion3d-chunk-TY7RGAI4.js +210 -0
  267. package/dist/trillion3d-chunk-U5NZRFEN.js +4403 -0
  268. package/dist/trillion3d-chunk-U5NZRFEN.js.map +6 -0
  269. package/dist/trillion3d-chunk-UBSICE2S.js +26 -0
  270. package/dist/trillion3d-chunk-UCIL746V.js +2 -0
  271. package/dist/trillion3d-chunk-UGTFIP7T.js +2 -0
  272. package/dist/trillion3d-chunk-UH2X4DC7.js +2 -0
  273. package/dist/trillion3d-chunk-UL5AQCHN.js +2 -0
  274. package/dist/trillion3d-chunk-UMAIYYSB.js +28 -0
  275. package/dist/trillion3d-chunk-UROCVT3W.js +53 -0
  276. package/dist/trillion3d-chunk-US6WKM5M.js +2 -0
  277. package/dist/trillion3d-chunk-UT5VM3B7.js +2 -0
  278. package/dist/trillion3d-chunk-UXCQ7A3K.js +2 -0
  279. package/dist/trillion3d-chunk-UXQKO5IH.js +2 -0
  280. package/dist/trillion3d-chunk-UXRWIFOC.js +12 -0
  281. package/dist/trillion3d-chunk-V44TZZB3.js +2 -0
  282. package/dist/trillion3d-chunk-VFPDIIEP.js +2 -0
  283. package/dist/trillion3d-chunk-VL44QEQI.js +2 -0
  284. package/dist/trillion3d-chunk-VP3GS2OQ.js +553 -0
  285. package/dist/trillion3d-chunk-VWRK33DS.js +172 -0
  286. package/dist/trillion3d-chunk-W2AGULE7.js +55 -0
  287. package/dist/trillion3d-chunk-W4L4ZLLZ.js +25 -0
  288. package/dist/trillion3d-chunk-WAR4LFLB.js +2 -0
  289. package/dist/trillion3d-chunk-WCVRKGQD.js +2 -0
  290. package/dist/trillion3d-chunk-WEACAP55.js +2 -0
  291. package/dist/trillion3d-chunk-WG6NZENK.js +2 -0
  292. package/dist/trillion3d-chunk-WJ4XQVTQ.js +411 -0
  293. package/dist/trillion3d-chunk-WR43FBB3.js +2 -0
  294. package/dist/trillion3d-chunk-WXECWHZ5.js +2 -0
  295. package/dist/trillion3d-chunk-WYKIXSUS.js +22 -0
  296. package/dist/trillion3d-chunk-XBDQHYBL.js +2 -0
  297. package/dist/trillion3d-chunk-XEPOPZZY.js +2 -0
  298. package/dist/trillion3d-chunk-XEQBUJNB.js +2 -0
  299. package/dist/trillion3d-chunk-XL4F65A7.js +174 -0
  300. package/dist/trillion3d-chunk-XOAWZNRA.js +2 -0
  301. package/dist/trillion3d-chunk-XQHULSDL.js +30 -0
  302. package/dist/trillion3d-chunk-XQSMKVTL.js +2 -0
  303. package/dist/trillion3d-chunk-XQSU4SY6.js +2 -0
  304. package/dist/trillion3d-chunk-XWJQJK22.js +2 -0
  305. package/dist/trillion3d-chunk-XXOXGG47.js +2 -0
  306. package/dist/trillion3d-chunk-XY7DNXWL.js +2 -0
  307. package/dist/trillion3d-chunk-XYZRT3VR.js +223 -0
  308. package/dist/trillion3d-chunk-XZPUDNQA.js +2 -0
  309. package/dist/trillion3d-chunk-Y2RAGKRM.js +2 -0
  310. package/dist/trillion3d-chunk-YA4TWJRK.js +442 -0
  311. package/dist/trillion3d-chunk-YAFEYU2S.js +2 -0
  312. package/dist/trillion3d-chunk-YBKRRMOT.js +2 -0
  313. package/dist/trillion3d-chunk-YFSDLEIZ.js +85 -0
  314. package/dist/trillion3d-chunk-YIUAOG6X.js +2 -0
  315. package/dist/trillion3d-chunk-YKZXAXMM.js +11 -0
  316. package/dist/trillion3d-chunk-YMR3WF2W.js +2 -0
  317. package/dist/trillion3d-chunk-YNRZO4Y4.js +27 -0
  318. package/dist/trillion3d-chunk-YOXV4W6I.js +266 -0
  319. package/dist/trillion3d-chunk-YQT76FYC.js +2 -0
  320. package/dist/trillion3d-chunk-YRPBW7AK.js +2 -0
  321. package/dist/trillion3d-chunk-YULZ6QUZ.js +2 -0
  322. package/dist/trillion3d-chunk-YWWOBEV2.js +2 -0
  323. package/dist/trillion3d-chunk-YYWNNHNI.js +2 -0
  324. package/dist/trillion3d-chunk-ZBIQ6S5Z.js +173 -0
  325. package/dist/trillion3d-chunk-ZBXTCONH.js +2 -0
  326. package/dist/trillion3d-chunk-ZDNFJYCW.js +2 -0
  327. package/dist/trillion3d-chunk-ZF5EDFJS.js +523 -0
  328. package/dist/trillion3d-chunk-ZFAKVFKL.js +21 -0
  329. package/dist/trillion3d-chunk-ZIGGUJM6.js +2 -0
  330. package/dist/trillion3d-chunk-ZNJ4TNBW.js +47 -0
  331. package/dist/trillion3d-chunk-ZQPT2YFE.js +2 -0
  332. package/dist/trillion3d-chunk-ZUFX2HVV.js +14 -0
  333. package/dist/trillion3d-chunk-ZUQDRSYB.js +14 -0
  334. package/dist/trillion3d-chunk-ZVSX6CGW.js +14 -0
  335. package/dist/trillion3d-chunk-ZYS4E37Q.js +2 -0
  336. package/dist/trillion3d-chunk-ZZWX6Q7H.js +2 -0
  337. package/dist/trillion3d-cinematicsCode-2YP657C3.js +2 -0
  338. package/dist/trillion3d-cubeCapturesCode-BOLBDRJD.js +77 -0
  339. package/dist/trillion3d-debugViewsCode-F4KTKXOZ.js +973 -0
  340. package/dist/trillion3d-decalCode-4OSGACRW.js +79 -0
  341. package/dist/trillion3d-deformationCode-GJBRRE4B.js +235 -0
  342. package/dist/trillion3d-displacementCode-OS37YHNO.js +659 -0
  343. package/dist/trillion3d-effectCode-CNDEXEFI.js +1874 -0
  344. package/dist/trillion3d-explorer-3SU2HTGD.js +2 -0
  345. package/dist/trillion3d-export-3COKIWS6.js +2 -0
  346. package/dist/trillion3d-family-YNJWVKWC.js +280 -0
  347. package/dist/trillion3d-fieldsCode-JQLVIT4H.js +2 -0
  348. package/dist/trillion3d-fogCode-PM5UY2TW.js +582 -0
  349. package/dist/trillion3d-geometryPage-DVJ4N2A6.js +2 -0
  350. package/dist/trillion3d-graphCode-MCIPPACK.js +2 -0
  351. package/dist/trillion3d-graphCode-MOTJ4WBF.js +2 -0
  352. package/dist/trillion3d-grassCode-J7CCF63J.js +2 -0
  353. package/dist/trillion3d-guideCode-ONWTGY2H.js +47 -0
  354. package/dist/trillion3d-hairCode-PNWJMXWH.js +3215 -0
  355. package/dist/trillion3d-hardwareBenchmark-JD2ITGNS.js +132 -0
  356. package/dist/trillion3d-headlessCode-JAXG4XPK.js +2 -0
  357. package/dist/trillion3d-iesCode-QVSRIT37.js +2 -0
  358. package/dist/trillion3d-indicator-ZDOOX6EU.js +22 -0
  359. package/dist/trillion3d-installCode-5NOFNOTZ.js +426 -0
  360. package/dist/trillion3d-manifestLoad-TEO2A7XO.js +2 -0
  361. package/dist/trillion3d-markCode-DD7RPZ2V.js +164 -0
  362. package/dist/trillion3d-measurementCode-I6LN3Z4A.js +2 -0
  363. package/dist/trillion3d-measurementCode-I6LN3Z4A.js.map +6 -0
  364. package/dist/trillion3d-modelArrivalCode-AS2ZIO5I.js +2 -0
  365. package/dist/trillion3d-modelCapture-OZNK2KHI.js +2 -0
  366. package/dist/trillion3d-modelCopiesCode-X7PCUUUT.js +2 -0
  367. package/dist/trillion3d-modelImagesCode-7NZ3BIL5.js +2 -0
  368. package/dist/trillion3d-pageAudioCode-PQWNFXNH.js +2 -0
  369. package/dist/trillion3d-pageCompile-4KI5TP2J.js +34 -0
  370. package/dist/trillion3d-panel-4BMTNA6N.js +79 -0
  371. package/dist/trillion3d-particleCode-X7RJYMM2.js +574 -0
  372. package/dist/trillion3d-partitionCode-KNTGZUZG.js +2 -0
  373. package/dist/trillion3d-pathTracingCode-IUDUNO7P.js +3333 -0
  374. package/dist/trillion3d-planarReflectionsCode-22NVSPZ2.js +96 -0
  375. package/dist/trillion3d-previewRun-YOUFRKDJ.js +33 -0
  376. package/dist/trillion3d-ragdollCode-XOZ7BBU4.js +2 -0
  377. package/dist/trillion3d-ragdollStage-EGRNR3QB.js +2 -0
  378. package/dist/trillion3d-read-6L2UR4EJ.js +2 -0
  379. package/dist/trillion3d-reflectionsCode-3T6W62HT.js +2128 -0
  380. package/dist/trillion3d-sampledLightsCode-MSZ2YCSJ.js +1795 -0
  381. package/dist/trillion3d-scene-3LL23MZI.js +2 -0
  382. package/dist/trillion3d-session-S4GIQNV6.js +2 -0
  383. package/dist/trillion3d-shadowsCode-UZNPLVCV.js +3667 -0
  384. package/dist/trillion3d-skyCode-BYIIBWAM.js +2212 -0
  385. package/dist/trillion3d-sortedTranslucencyCode-VLSTGX5S.js +181 -0
  386. package/dist/trillion3d-splineMeshCode-AWDX5BIG.js +2 -0
  387. package/dist/trillion3d-subsurfaceCode-PROXJTLS.js +732 -0
  388. package/dist/trillion3d-surfaceCode-CW2NSI5O.js +2 -0
  389. package/dist/trillion3d-terrainCode-ZDONXR5X.js +2 -0
  390. package/dist/trillion3d-transformCode-SE55EUCN.js +2 -0
  391. package/dist/trillion3d-translucentLightVolumeCode-EQKMCGMD.js +195 -0
  392. package/dist/trillion3d-viewCode-52L7D5ZW.js +18 -0
  393. package/dist/trillion3d-volumesCode-NYAC6KYU.js +2334 -0
  394. package/dist/trillion3d-waterCode-CWZ5XYNU.js +102 -0
  395. package/dist/trillion3d-webgpuCode-2GNPUWQ4.js +1646 -0
  396. package/dist/trillion3d-workCode-DCC25A2D.js +2 -0
  397. package/dist/trillion3d-worldRootPages-P75VSIXR.js +2 -0
  398. package/dist/trillion3d.module.js +1 -1
  399. package/dist/trillion3d.module.js.modules.json +1 -1
  400. package/package.json +2 -2
  401. package/dist/trillion3d-aoCode-T2V54NAO.js +0 -489
  402. package/dist/trillion3d-assemblies-3DUP5X66.js +0 -2
  403. package/dist/trillion3d-audioCode-53XT65XV.js +0 -2
  404. package/dist/trillion3d-autoExposureCode-B5KISRSD.js +0 -198
  405. package/dist/trillion3d-avatarCode-AZDPGA73.js +0 -2
  406. package/dist/trillion3d-bounceCode-AZC4HMJI.js +0 -4675
  407. package/dist/trillion3d-catalogueCode-ZAOFZQLB.js +0 -2
  408. package/dist/trillion3d-chunk-2BOYJZCQ.js +0 -2
  409. package/dist/trillion3d-chunk-2CZ6RWTW.js +0 -607
  410. package/dist/trillion3d-chunk-2HSBVYCY.js +0 -2
  411. package/dist/trillion3d-chunk-2JAAFFQC.js +0 -438
  412. package/dist/trillion3d-chunk-2JCF4HLE.js +0 -132
  413. package/dist/trillion3d-chunk-2JM7B67K.js +0 -2
  414. package/dist/trillion3d-chunk-2KRIKK4D.js +0 -2
  415. package/dist/trillion3d-chunk-2L52NUG7.js +0 -2
  416. package/dist/trillion3d-chunk-2MVQXOFZ.js +0 -2
  417. package/dist/trillion3d-chunk-2OFUDJNU.js +0 -2
  418. package/dist/trillion3d-chunk-2PBJSBLO.js +0 -46
  419. package/dist/trillion3d-chunk-2TYAUOQ5.js +0 -2
  420. package/dist/trillion3d-chunk-2VZIVK5U.js +0 -2
  421. package/dist/trillion3d-chunk-36VHFR62.js +0 -2
  422. package/dist/trillion3d-chunk-3BY2FPRS.js +0 -2
  423. package/dist/trillion3d-chunk-3EPZT7SR.js +0 -167
  424. package/dist/trillion3d-chunk-3GEQFGGV.js +0 -360
  425. package/dist/trillion3d-chunk-3H2OZEPR.js +0 -2
  426. package/dist/trillion3d-chunk-3HE5HBCK.js +0 -14
  427. package/dist/trillion3d-chunk-3HPFLXCF.js +0 -125
  428. package/dist/trillion3d-chunk-42JJO5YV.js +0 -771
  429. package/dist/trillion3d-chunk-44GU3ERA.js +0 -756
  430. package/dist/trillion3d-chunk-44GU3ERA.js.map +0 -6
  431. package/dist/trillion3d-chunk-46P46SRG.js +0 -2
  432. package/dist/trillion3d-chunk-472QQ27C.js +0 -2
  433. package/dist/trillion3d-chunk-4BOD343S.js +0 -2
  434. package/dist/trillion3d-chunk-4JBRHV7G.js +0 -174
  435. package/dist/trillion3d-chunk-4KXFERR4.js +0 -2
  436. package/dist/trillion3d-chunk-5ASFLMJ6.js +0 -583
  437. package/dist/trillion3d-chunk-5B3ML3DL.js +0 -2
  438. package/dist/trillion3d-chunk-5COTXELO.js +0 -2
  439. package/dist/trillion3d-chunk-5GW525BI.js +0 -2
  440. package/dist/trillion3d-chunk-5GY24CJD.js +0 -2
  441. package/dist/trillion3d-chunk-5HWOHERQ.js +0 -2
  442. package/dist/trillion3d-chunk-5K6QSSBR.js +0 -2
  443. package/dist/trillion3d-chunk-5KHPSLRC.js +0 -2
  444. package/dist/trillion3d-chunk-5LQDA7UM.js +0 -2
  445. package/dist/trillion3d-chunk-5O2GDLHX.js +0 -2
  446. package/dist/trillion3d-chunk-5ONOJMSW.js +0 -2
  447. package/dist/trillion3d-chunk-5Q666YQV.js +0 -519
  448. package/dist/trillion3d-chunk-5ROJIVV3.js +0 -20
  449. package/dist/trillion3d-chunk-5VVVL3GH.js +0 -2
  450. package/dist/trillion3d-chunk-5VX27QFH.js +0 -2
  451. package/dist/trillion3d-chunk-6VDAUYE6.js +0 -2
  452. package/dist/trillion3d-chunk-6VPPLI5X.js +0 -46
  453. package/dist/trillion3d-chunk-6Y7TZO62.js +0 -523
  454. package/dist/trillion3d-chunk-742WGJYH.js +0 -2
  455. package/dist/trillion3d-chunk-74PQZHDK.js +0 -104
  456. package/dist/trillion3d-chunk-77T2WOXU.js +0 -2
  457. package/dist/trillion3d-chunk-7C5HNDEL.js +0 -2
  458. package/dist/trillion3d-chunk-7CGRPLOC.js +0 -188
  459. package/dist/trillion3d-chunk-7CSS2AWO.js +0 -94
  460. package/dist/trillion3d-chunk-7F2KAZFC.js +0 -2
  461. package/dist/trillion3d-chunk-7IZI5OZK.js +0 -2
  462. package/dist/trillion3d-chunk-7NZTUQYT.js +0 -592
  463. package/dist/trillion3d-chunk-7QYR7QUU.js +0 -13
  464. package/dist/trillion3d-chunk-7XEWHG3S.js +0 -223
  465. package/dist/trillion3d-chunk-AA2V3CRQ.js +0 -2
  466. package/dist/trillion3d-chunk-AA6W2SUV.js +0 -77
  467. package/dist/trillion3d-chunk-ABKLIRWX.js +0 -2
  468. package/dist/trillion3d-chunk-ADUR3TJH.js +0 -76
  469. package/dist/trillion3d-chunk-AEW6BD4P.js +0 -2
  470. package/dist/trillion3d-chunk-AU725OCC.js +0 -2
  471. package/dist/trillion3d-chunk-AYCFHOHV.js +0 -2
  472. package/dist/trillion3d-chunk-AYJO3NNO.js +0 -2
  473. package/dist/trillion3d-chunk-AZ6SQT7V.js +0 -1953
  474. package/dist/trillion3d-chunk-AZHGOCPF.js +0 -2
  475. package/dist/trillion3d-chunk-B3ATF6PP.js +0 -418
  476. package/dist/trillion3d-chunk-B3ECL3UB.js +0 -24
  477. package/dist/trillion3d-chunk-BDWRLDJI.js +0 -3109
  478. package/dist/trillion3d-chunk-BGNYLCJW.js +0 -303
  479. package/dist/trillion3d-chunk-BS3H5DRX.js +0 -2
  480. package/dist/trillion3d-chunk-BUP4DDEO.js +0 -2
  481. package/dist/trillion3d-chunk-BZAV5BK7.js +0 -2
  482. package/dist/trillion3d-chunk-C2QSQDHV.js +0 -4403
  483. package/dist/trillion3d-chunk-C2QSQDHV.js.map +0 -6
  484. package/dist/trillion3d-chunk-CBPJFYIU.js +0 -172
  485. package/dist/trillion3d-chunk-CD7EZNRP.js +0 -53
  486. package/dist/trillion3d-chunk-CJHN7L75.js +0 -2
  487. package/dist/trillion3d-chunk-CMHKMP7M.js +0 -6
  488. package/dist/trillion3d-chunk-CPLMDH47.js +0 -2
  489. package/dist/trillion3d-chunk-CQESL7F5.js +0 -28
  490. package/dist/trillion3d-chunk-CVJOTXK5.js +0 -2
  491. package/dist/trillion3d-chunk-D4DXAQPJ.js +0 -4
  492. package/dist/trillion3d-chunk-DA3S4LZH.js +0 -34
  493. package/dist/trillion3d-chunk-DPXM3DHU.js +0 -2
  494. package/dist/trillion3d-chunk-DUWMZGSW.js +0 -18
  495. package/dist/trillion3d-chunk-DZ5A6N23.js +0 -11
  496. package/dist/trillion3d-chunk-E2VRYXCO.js +0 -55
  497. package/dist/trillion3d-chunk-E4N7LNGP.js +0 -2
  498. package/dist/trillion3d-chunk-E5M5PMK3.js +0 -2
  499. package/dist/trillion3d-chunk-EAHDFM7D.js +0 -139
  500. package/dist/trillion3d-chunk-ECWU67MC.js +0 -54
  501. package/dist/trillion3d-chunk-EI2XZGZC.js +0 -2
  502. package/dist/trillion3d-chunk-EIOQWCJW.js +0 -35
  503. package/dist/trillion3d-chunk-EO2IHUHA.js +0 -2
  504. package/dist/trillion3d-chunk-ESO5KVG2.js +0 -2
  505. package/dist/trillion3d-chunk-ETCQFZ4S.js +0 -435
  506. package/dist/trillion3d-chunk-EU4OYQGR.js +0 -2
  507. package/dist/trillion3d-chunk-EUCLXLYS.js +0 -2
  508. package/dist/trillion3d-chunk-EZ2JYRNP.js +0 -70
  509. package/dist/trillion3d-chunk-F2BKXVDP.js +0 -59
  510. package/dist/trillion3d-chunk-F4TG7DXL.js +0 -2
  511. package/dist/trillion3d-chunk-FBPR5PIL.js +0 -2
  512. package/dist/trillion3d-chunk-FDP5PHNI.js +0 -17
  513. package/dist/trillion3d-chunk-FJRD6RXY.js +0 -4
  514. package/dist/trillion3d-chunk-FLJAAUWJ.js +0 -2
  515. package/dist/trillion3d-chunk-FPH3NDSE.js +0 -2
  516. package/dist/trillion3d-chunk-FYTCEF3P.js +0 -2
  517. package/dist/trillion3d-chunk-G4ZEQPJE.js +0 -2
  518. package/dist/trillion3d-chunk-G5MFUE5P.js +0 -2
  519. package/dist/trillion3d-chunk-G6HYU5QH.js +0 -2
  520. package/dist/trillion3d-chunk-GJAAOF62.js +0 -2
  521. package/dist/trillion3d-chunk-GOFFACVN.js +0 -210
  522. package/dist/trillion3d-chunk-GPKNAWFR.js +0 -2
  523. package/dist/trillion3d-chunk-GTJAMKXA.js +0 -2
  524. package/dist/trillion3d-chunk-GUWCZ2WR.js +0 -40
  525. package/dist/trillion3d-chunk-GXDVY3QD.js +0 -2
  526. package/dist/trillion3d-chunk-GXMTFTCW.js +0 -2
  527. package/dist/trillion3d-chunk-H5B36GHI.js +0 -2
  528. package/dist/trillion3d-chunk-HBFRB6UY.js +0 -79
  529. package/dist/trillion3d-chunk-HCXQHHY4.js +0 -2
  530. package/dist/trillion3d-chunk-HDA6WCOZ.js +0 -2
  531. package/dist/trillion3d-chunk-HTCY6CIU.js +0 -19
  532. package/dist/trillion3d-chunk-I2L32YAH.js +0 -10
  533. package/dist/trillion3d-chunk-I4HFBLVO.js +0 -2
  534. package/dist/trillion3d-chunk-I5PD2IYL.js +0 -2
  535. package/dist/trillion3d-chunk-I63LRS3P.js +0 -2
  536. package/dist/trillion3d-chunk-I7R4YZP2.js +0 -6
  537. package/dist/trillion3d-chunk-ICWUGQNV.js +0 -2
  538. package/dist/trillion3d-chunk-IGBD22JD.js +0 -155
  539. package/dist/trillion3d-chunk-IGH6C5NL.js +0 -2
  540. package/dist/trillion3d-chunk-IVAI2C6D.js +0 -2
  541. package/dist/trillion3d-chunk-IWBFD73G.js +0 -173
  542. package/dist/trillion3d-chunk-J2KR4G6F.js +0 -74
  543. package/dist/trillion3d-chunk-J2YDEAKO.js +0 -553
  544. package/dist/trillion3d-chunk-J5SMDUDO.js +0 -2
  545. package/dist/trillion3d-chunk-JCTPF4CK.js +0 -14
  546. package/dist/trillion3d-chunk-JFCEIZBH.js +0 -2
  547. package/dist/trillion3d-chunk-JH7I4RDZ.js +0 -25
  548. package/dist/trillion3d-chunk-JLJSXR5R.js +0 -2
  549. package/dist/trillion3d-chunk-JN2SWJKC.js +0 -178
  550. package/dist/trillion3d-chunk-JO55XZVA.js +0 -1615
  551. package/dist/trillion3d-chunk-JOPRGF7Z.js +0 -2
  552. package/dist/trillion3d-chunk-JQ2VUCTW.js +0 -2
  553. package/dist/trillion3d-chunk-JRLCX4ZB.js +0 -2
  554. package/dist/trillion3d-chunk-JRVTAQY2.js +0 -2
  555. package/dist/trillion3d-chunk-JVNGK4EV.js +0 -113
  556. package/dist/trillion3d-chunk-JXEBQPRX.js +0 -2
  557. package/dist/trillion3d-chunk-K3434KA7.js +0 -59
  558. package/dist/trillion3d-chunk-K364ZTPY.js +0 -27
  559. package/dist/trillion3d-chunk-K5D3PLUN.js +0 -2
  560. package/dist/trillion3d-chunk-KCXWBXK2.js +0 -2
  561. package/dist/trillion3d-chunk-KEIULYWY.js +0 -45
  562. package/dist/trillion3d-chunk-KEQDYXLL.js +0 -2
  563. package/dist/trillion3d-chunk-KITYCFGK.js +0 -2
  564. package/dist/trillion3d-chunk-KJXQTIKM.js +0 -2
  565. package/dist/trillion3d-chunk-KS3GXZPA.js +0 -184
  566. package/dist/trillion3d-chunk-KTGIIVAQ.js +0 -47
  567. package/dist/trillion3d-chunk-KU7R2CLN.js +0 -2
  568. package/dist/trillion3d-chunk-KWS6MEDX.js +0 -2
  569. package/dist/trillion3d-chunk-KYDPV56Z.js +0 -265
  570. package/dist/trillion3d-chunk-LB2MHAHM.js +0 -85
  571. package/dist/trillion3d-chunk-LE7PGKD4.js +0 -86
  572. package/dist/trillion3d-chunk-LHCO3J7M.js +0 -2
  573. package/dist/trillion3d-chunk-LHFBY6CF.js +0 -276
  574. package/dist/trillion3d-chunk-LHHZH3SV.js +0 -2
  575. package/dist/trillion3d-chunk-LV5NP2OD.js +0 -2
  576. package/dist/trillion3d-chunk-LZSYLDTU.js +0 -100
  577. package/dist/trillion3d-chunk-M2AYPZAT.js +0 -2
  578. package/dist/trillion3d-chunk-M2F7Q77E.js +0 -277
  579. package/dist/trillion3d-chunk-M63PPBDR.js +0 -2
  580. package/dist/trillion3d-chunk-MBN7REAP.js +0 -2
  581. package/dist/trillion3d-chunk-MCIY254D.js +0 -26
  582. package/dist/trillion3d-chunk-MEMYKAVP.js +0 -197
  583. package/dist/trillion3d-chunk-MH3RWDUK.js +0 -56
  584. package/dist/trillion3d-chunk-MLBX4WMV.js +0 -2
  585. package/dist/trillion3d-chunk-MQEVNNBK.js +0 -2
  586. package/dist/trillion3d-chunk-MUZUZS2F.js +0 -2
  587. package/dist/trillion3d-chunk-N45WPUNA.js +0 -2
  588. package/dist/trillion3d-chunk-N76JAZ32.js +0 -68
  589. package/dist/trillion3d-chunk-NFFLZRMN.js +0 -2
  590. package/dist/trillion3d-chunk-NH3GZRI7.js +0 -2
  591. package/dist/trillion3d-chunk-NH7JVT4M.js +0 -2
  592. package/dist/trillion3d-chunk-NJW7NEZW.js +0 -2
  593. package/dist/trillion3d-chunk-NQT36E2Z.js +0 -28
  594. package/dist/trillion3d-chunk-NUSOZ5NQ.js +0 -16
  595. package/dist/trillion3d-chunk-O3H5RZXC.js +0 -14
  596. package/dist/trillion3d-chunk-O3H5RZXC.js.map +0 -6
  597. package/dist/trillion3d-chunk-O3OYDVQH.js +0 -2
  598. package/dist/trillion3d-chunk-O6RA4K6A.js +0 -2
  599. package/dist/trillion3d-chunk-OG5M47HN.js +0 -6
  600. package/dist/trillion3d-chunk-OOOINENB.js +0 -2
  601. package/dist/trillion3d-chunk-OPFDHDV7.js +0 -2
  602. package/dist/trillion3d-chunk-OVVY7IKC.js +0 -2
  603. package/dist/trillion3d-chunk-OXKMBXZD.js +0 -2
  604. package/dist/trillion3d-chunk-P2RDFAA2.js +0 -1166
  605. package/dist/trillion3d-chunk-P4Q7TPID.js +0 -40
  606. package/dist/trillion3d-chunk-P74SV4JJ.js +0 -328
  607. package/dist/trillion3d-chunk-P75YOB5K.js +0 -27
  608. package/dist/trillion3d-chunk-PN2YD2PU.js +0 -27
  609. package/dist/trillion3d-chunk-POPUJ5RT.js +0 -4
  610. package/dist/trillion3d-chunk-PPUZR76B.js +0 -11
  611. package/dist/trillion3d-chunk-PQH6Z3ZK.js +0 -19
  612. package/dist/trillion3d-chunk-PSMSPY5U.js +0 -2
  613. package/dist/trillion3d-chunk-PU4JWKCC.js +0 -2
  614. package/dist/trillion3d-chunk-PUS6DQHP.js +0 -2
  615. package/dist/trillion3d-chunk-Q4XTYMSK.js +0 -2
  616. package/dist/trillion3d-chunk-QCE7DOXK.js +0 -21
  617. package/dist/trillion3d-chunk-QDNYR3XW.js +0 -2
  618. package/dist/trillion3d-chunk-QEJGU4DQ.js +0 -217
  619. package/dist/trillion3d-chunk-QFWHSCJS.js +0 -2
  620. package/dist/trillion3d-chunk-QGELETHW.js +0 -2
  621. package/dist/trillion3d-chunk-QHLP3RMM.js +0 -2
  622. package/dist/trillion3d-chunk-QJVAWFWA.js +0 -2
  623. package/dist/trillion3d-chunk-QLEZIRFO.js +0 -2
  624. package/dist/trillion3d-chunk-QNKA4ESA.js +0 -2
  625. package/dist/trillion3d-chunk-QOKJKCXP.js +0 -442
  626. package/dist/trillion3d-chunk-QPNQ6MAU.js +0 -35
  627. package/dist/trillion3d-chunk-QW7R4JSU.js +0 -6
  628. package/dist/trillion3d-chunk-QWRJTGQA.js +0 -4
  629. package/dist/trillion3d-chunk-QZURF55R.js +0 -2
  630. package/dist/trillion3d-chunk-R3HHRSA5.js +0 -82
  631. package/dist/trillion3d-chunk-RB22IHFT.js +0 -27
  632. package/dist/trillion3d-chunk-RUOI3D3D.js +0 -2
  633. package/dist/trillion3d-chunk-S25VCORA.js +0 -2
  634. package/dist/trillion3d-chunk-S2JLIIRM.js +0 -10
  635. package/dist/trillion3d-chunk-S47ADXWU.js +0 -30
  636. package/dist/trillion3d-chunk-S4NKU3YU.js +0 -14
  637. package/dist/trillion3d-chunk-S4P42ZHN.js +0 -2
  638. package/dist/trillion3d-chunk-SAYEA3NT.js +0 -2
  639. package/dist/trillion3d-chunk-SCJINCDV.js +0 -2
  640. package/dist/trillion3d-chunk-SG3C5SMX.js +0 -2
  641. package/dist/trillion3d-chunk-SIPUEAJ5.js +0 -266
  642. package/dist/trillion3d-chunk-SKH3XZ4Q.js +0 -2
  643. package/dist/trillion3d-chunk-SLLV2LYS.js +0 -2
  644. package/dist/trillion3d-chunk-SM64HJZI.js +0 -2
  645. package/dist/trillion3d-chunk-SYQOPTR2.js +0 -165
  646. package/dist/trillion3d-chunk-T43PRG7O.js +0 -2
  647. package/dist/trillion3d-chunk-TI3PM7XW.js +0 -2
  648. package/dist/trillion3d-chunk-TLVZXCTJ.js +0 -2537
  649. package/dist/trillion3d-chunk-TWFQBYBV.js +0 -14
  650. package/dist/trillion3d-chunk-TZ3XBBRE.js +0 -12
  651. package/dist/trillion3d-chunk-U3CLZW3E.js +0 -2
  652. package/dist/trillion3d-chunk-U4EL7JGK.js +0 -2
  653. package/dist/trillion3d-chunk-UBMIQXK3.js +0 -2
  654. package/dist/trillion3d-chunk-UBW2ZWPI.js +0 -26
  655. package/dist/trillion3d-chunk-UCGD7DGZ.js +0 -2
  656. package/dist/trillion3d-chunk-UH663TJS.js +0 -125
  657. package/dist/trillion3d-chunk-UHWPSNJD.js +0 -177
  658. package/dist/trillion3d-chunk-UL2YJ52J.js +0 -2
  659. package/dist/trillion3d-chunk-UPJHDFQP.js +0 -2
  660. package/dist/trillion3d-chunk-UR2BLLWY.js +0 -2
  661. package/dist/trillion3d-chunk-URIYQIA6.js +0 -116
  662. package/dist/trillion3d-chunk-URXU62XN.js +0 -2
  663. package/dist/trillion3d-chunk-UTTH7HS7.js +0 -2
  664. package/dist/trillion3d-chunk-UX44ZL4D.js +0 -2
  665. package/dist/trillion3d-chunk-UXRH76J5.js +0 -17
  666. package/dist/trillion3d-chunk-V2BAFU66.js +0 -2
  667. package/dist/trillion3d-chunk-V4M3HNJD.js +0 -318
  668. package/dist/trillion3d-chunk-V6HD2TKX.js +0 -2
  669. package/dist/trillion3d-chunk-V6VZ5QXG.js +0 -2
  670. package/dist/trillion3d-chunk-VCIRYPE7.js +0 -2
  671. package/dist/trillion3d-chunk-VGIJRZO5.js +0 -400
  672. package/dist/trillion3d-chunk-VQ7DWMHP.js +0 -2
  673. package/dist/trillion3d-chunk-VYQB6KF6.js +0 -2
  674. package/dist/trillion3d-chunk-W42TUOJC.js +0 -285
  675. package/dist/trillion3d-chunk-W4SMNFPI.js +0 -2
  676. package/dist/trillion3d-chunk-WFPJ35TV.js +0 -2
  677. package/dist/trillion3d-chunk-WJBLDQVZ.js +0 -19
  678. package/dist/trillion3d-chunk-WLOE6LQT.js +0 -42
  679. package/dist/trillion3d-chunk-WMW4G2T3.js +0 -12
  680. package/dist/trillion3d-chunk-WOE7ECLG.js +0 -172
  681. package/dist/trillion3d-chunk-WPZHDV22.js +0 -6
  682. package/dist/trillion3d-chunk-WUZB5LTJ.js +0 -50
  683. package/dist/trillion3d-chunk-X2FMWMUT.js +0 -988
  684. package/dist/trillion3d-chunk-XAWENX7C.js +0 -81
  685. package/dist/trillion3d-chunk-XHUSYLI3.js +0 -2
  686. package/dist/trillion3d-chunk-XI6O5F6V.js +0 -11
  687. package/dist/trillion3d-chunk-XM5IBOQ3.js +0 -2
  688. package/dist/trillion3d-chunk-XS7FCVOV.js +0 -2
  689. package/dist/trillion3d-chunk-XUD7A3GH.js +0 -2
  690. package/dist/trillion3d-chunk-XXCX4QIN.js +0 -377
  691. package/dist/trillion3d-chunk-XYMF73ZW.js +0 -107
  692. package/dist/trillion3d-chunk-XYP27BGE.js +0 -2
  693. package/dist/trillion3d-chunk-Y2DWPDRM.js +0 -5
  694. package/dist/trillion3d-chunk-Y322OCAR.js +0 -2
  695. package/dist/trillion3d-chunk-Y3SDC6TY.js +0 -2
  696. package/dist/trillion3d-chunk-Y42MTEVG.js +0 -2
  697. package/dist/trillion3d-chunk-Y4MIWQBS.js +0 -2
  698. package/dist/trillion3d-chunk-YI2MFQEG.js +0 -2
  699. package/dist/trillion3d-chunk-YIE3H5JS.js +0 -411
  700. package/dist/trillion3d-chunk-YON3TSAG.js +0 -4
  701. package/dist/trillion3d-chunk-YQC77N7M.js +0 -2
  702. package/dist/trillion3d-chunk-YTL2XIXN.js +0 -2
  703. package/dist/trillion3d-chunk-YWUEHJ6S.js +0 -2
  704. package/dist/trillion3d-chunk-YZARCC7T.js +0 -91
  705. package/dist/trillion3d-chunk-Z6ISTRN2.js +0 -2
  706. package/dist/trillion3d-chunk-ZDT7Z7AV.js +0 -2
  707. package/dist/trillion3d-chunk-ZFEJXND5.js +0 -9
  708. package/dist/trillion3d-chunk-ZGWEZTGI.js +0 -2
  709. package/dist/trillion3d-chunk-ZHRUP5WY.js +0 -2
  710. package/dist/trillion3d-chunk-ZHV4B2CP.js +0 -2
  711. package/dist/trillion3d-chunk-ZKTXPZUU.js +0 -2
  712. package/dist/trillion3d-chunk-ZM6OWZBZ.js +0 -1505
  713. package/dist/trillion3d-chunk-ZNNO6SDC.js +0 -2
  714. package/dist/trillion3d-chunk-ZSKD2IX5.js +0 -2
  715. package/dist/trillion3d-chunk-ZSTYK7WY.js +0 -2
  716. package/dist/trillion3d-chunk-ZTNOBS5G.js +0 -13
  717. package/dist/trillion3d-chunk-ZTYP3T5T.js +0 -2
  718. package/dist/trillion3d-chunk-ZUU5E7FO.js +0 -2
  719. package/dist/trillion3d-chunk-ZVO6IOK3.js +0 -22
  720. package/dist/trillion3d-chunk-ZWZTGI5M.js +0 -113
  721. package/dist/trillion3d-chunk-ZXF6BEYU.js +0 -242
  722. package/dist/trillion3d-chunk-ZXGUNSUQ.js +0 -2
  723. package/dist/trillion3d-cinematicsCode-5UPGQFVV.js +0 -2
  724. package/dist/trillion3d-cubeCapturesCode-LCBK47X5.js +0 -77
  725. package/dist/trillion3d-debugViewsCode-7GJW7RDI.js +0 -973
  726. package/dist/trillion3d-decalCode-ID2FWTA7.js +0 -79
  727. package/dist/trillion3d-deformationCode-PIIEMRNF.js +0 -235
  728. package/dist/trillion3d-displacementCode-ZMPJRUDW.js +0 -659
  729. package/dist/trillion3d-effectCode-J22OGAGG.js +0 -1874
  730. package/dist/trillion3d-explorer-JTT6UBU6.js +0 -2
  731. package/dist/trillion3d-export-H3WTWO2M.js +0 -2
  732. package/dist/trillion3d-family-IM6JIBGG.js +0 -280
  733. package/dist/trillion3d-fieldsCode-QD2TBZOM.js +0 -2
  734. package/dist/trillion3d-fogCode-PNHAG2DD.js +0 -582
  735. package/dist/trillion3d-geometryPage-3J5Q2EZN.js +0 -2
  736. package/dist/trillion3d-graphCode-DWZUBHZQ.js +0 -2
  737. package/dist/trillion3d-graphCode-HGVQ47X4.js +0 -2
  738. package/dist/trillion3d-grassCode-HASCTGFB.js +0 -2
  739. package/dist/trillion3d-guideCode-XKNU3UOB.js +0 -47
  740. package/dist/trillion3d-hairCode-VUMV4M33.js +0 -3215
  741. package/dist/trillion3d-hardwareBenchmark-H2SLAEER.js +0 -132
  742. package/dist/trillion3d-headlessCode-3KBNVKND.js +0 -2
  743. package/dist/trillion3d-iesCode-GVJDBPQY.js +0 -2
  744. package/dist/trillion3d-indicator-VCCCRO7K.js +0 -22
  745. package/dist/trillion3d-installCode-GDJ6EA73.js +0 -426
  746. package/dist/trillion3d-manifestLoad-Y2XKGXCD.js +0 -2
  747. package/dist/trillion3d-markCode-VYWQBD3K.js +0 -164
  748. package/dist/trillion3d-measurementCode-FGD5D2RI.js +0 -2
  749. package/dist/trillion3d-measurementCode-FGD5D2RI.js.map +0 -6
  750. package/dist/trillion3d-modelArrivalCode-ENI7UWDQ.js +0 -2
  751. package/dist/trillion3d-modelCapture-BMLNM2DT.js +0 -2
  752. package/dist/trillion3d-modelCopiesCode-7JYQXGVF.js +0 -2
  753. package/dist/trillion3d-modelImagesCode-C3O4XMTN.js +0 -2
  754. package/dist/trillion3d-pageAudioCode-JV4TWD5B.js +0 -2
  755. package/dist/trillion3d-pageCompile-YNZYXLLY.js +0 -34
  756. package/dist/trillion3d-panel-RYDJZQFJ.js +0 -79
  757. package/dist/trillion3d-particleCode-244NV3QC.js +0 -574
  758. package/dist/trillion3d-partitionCode-LJW6NXJO.js +0 -2
  759. package/dist/trillion3d-pathTracingCode-PY4YXX2K.js +0 -3333
  760. package/dist/trillion3d-planarReflectionsCode-3HPS33JS.js +0 -96
  761. package/dist/trillion3d-previewRun-MYYO5L7K.js +0 -33
  762. package/dist/trillion3d-ragdollCode-Q2F4YXCT.js +0 -2
  763. package/dist/trillion3d-ragdollStage-673NKNJC.js +0 -2
  764. package/dist/trillion3d-read-KTRGUDEK.js +0 -2
  765. package/dist/trillion3d-reflectionsCode-EYZ2I2RG.js +0 -2128
  766. package/dist/trillion3d-sampledLightsCode-44YPQANZ.js +0 -1795
  767. package/dist/trillion3d-scene-VDR67XPZ.js +0 -2
  768. package/dist/trillion3d-session-V5UGVDGM.js +0 -2
  769. package/dist/trillion3d-shadowsCode-IGFSPJZS.js +0 -3667
  770. package/dist/trillion3d-skyCode-VIAPJ6TS.js +0 -2212
  771. package/dist/trillion3d-sortedTranslucencyCode-ENOIPRNP.js +0 -181
  772. package/dist/trillion3d-splineMeshCode-X6CFRALJ.js +0 -2
  773. package/dist/trillion3d-subsurfaceCode-L36SYFNH.js +0 -732
  774. package/dist/trillion3d-surfaceCode-J3JUDHSC.js +0 -2
  775. package/dist/trillion3d-terrainCode-BHCQQRET.js +0 -2
  776. package/dist/trillion3d-transformCode-74Z7PQYM.js +0 -2
  777. package/dist/trillion3d-translucentLightVolumeCode-3HU4TBPQ.js +0 -195
  778. package/dist/trillion3d-viewCode-IXEIJJWS.js +0 -18
  779. package/dist/trillion3d-volumesCode-RDBBXG3U.js +0 -2334
  780. package/dist/trillion3d-waterCode-3ZRB2JP7.js +0 -102
  781. package/dist/trillion3d-webgpuCode-BQTJL2EM.js +0 -1646
  782. package/dist/trillion3d-workCode-V42SMDJA.js +0 -2
  783. package/dist/trillion3d-worldRootPages-3SFAHS63.js +0 -2
  784. /package/dist/{trillion3d-aoCode-T2V54NAO.js.map → trillion3d-aoCode-2JTKFXZ5.js.map} +0 -0
  785. /package/dist/{trillion3d-assemblies-3DUP5X66.js.map → trillion3d-assemblies-BENCUAG3.js.map} +0 -0
  786. /package/dist/{trillion3d-audioCode-53XT65XV.js.map → trillion3d-audioCode-M3I6FF7A.js.map} +0 -0
  787. /package/dist/{trillion3d-autoExposureCode-B5KISRSD.js.map → trillion3d-autoExposureCode-AQ3IV5LH.js.map} +0 -0
  788. /package/dist/{trillion3d-avatarCode-AZDPGA73.js.map → trillion3d-avatarCode-RTIDGTIA.js.map} +0 -0
  789. /package/dist/{trillion3d-bounceCode-AZC4HMJI.js.map → trillion3d-bounceCode-GEAWSI3A.js.map} +0 -0
  790. /package/dist/{trillion3d-catalogueCode-ZAOFZQLB.js.map → trillion3d-catalogueCode-KZ3X7U7G.js.map} +0 -0
  791. /package/dist/{trillion3d-chunk-URIYQIA6.js.map → trillion3d-chunk-22KA6FS4.js.map} +0 -0
  792. /package/dist/{trillion3d-chunk-UHWPSNJD.js.map → trillion3d-chunk-25B7I4D5.js.map} +0 -0
  793. /package/dist/{trillion3d-chunk-2JCF4HLE.js.map → trillion3d-chunk-2D7RBB5X.js.map} +0 -0
  794. /package/dist/{trillion3d-chunk-6VPPLI5X.js.map → trillion3d-chunk-2EJ4CRNA.js.map} +0 -0
  795. /package/dist/{trillion3d-chunk-5Q666YQV.js.map → trillion3d-chunk-2PKPG2QJ.js.map} +0 -0
  796. /package/dist/{trillion3d-chunk-AZHGOCPF.js.map → trillion3d-chunk-2YXWLU7F.js.map} +0 -0
  797. /package/dist/{trillion3d-chunk-WMW4G2T3.js.map → trillion3d-chunk-2ZIQ3EEG.js.map} +0 -0
  798. /package/dist/{trillion3d-chunk-ZWZTGI5M.js.map → trillion3d-chunk-33J4ZHIV.js.map} +0 -0
  799. /package/dist/{trillion3d-chunk-3HE5HBCK.js.map → trillion3d-chunk-3CTKK6Y4.js.map} +0 -0
  800. /package/dist/{trillion3d-chunk-5O2GDLHX.js.map → trillion3d-chunk-3F65K5TK.js.map} +0 -0
  801. /package/dist/{trillion3d-chunk-BS3H5DRX.js.map → trillion3d-chunk-3IRHFCKO.js.map} +0 -0
  802. /package/dist/{trillion3d-chunk-QNKA4ESA.js.map → trillion3d-chunk-3OWQBLPF.js.map} +0 -0
  803. /package/dist/{trillion3d-chunk-3H2OZEPR.js.map → trillion3d-chunk-3QKVCESS.js.map} +0 -0
  804. /package/dist/{trillion3d-chunk-MH3RWDUK.js.map → trillion3d-chunk-3TG7TWTW.js.map} +0 -0
  805. /package/dist/{trillion3d-chunk-YZARCC7T.js.map → trillion3d-chunk-3UAK2IRC.js.map} +0 -0
  806. /package/dist/{trillion3d-chunk-QWRJTGQA.js.map → trillion3d-chunk-3VO6VVHD.js.map} +0 -0
  807. /package/dist/{trillion3d-chunk-YON3TSAG.js.map → trillion3d-chunk-3W3YJ4KI.js.map} +0 -0
  808. /package/dist/{trillion3d-chunk-I4HFBLVO.js.map → trillion3d-chunk-3XBFYA3P.js.map} +0 -0
  809. /package/dist/{trillion3d-chunk-QJVAWFWA.js.map → trillion3d-chunk-435NEAXB.js.map} +0 -0
  810. /package/dist/{trillion3d-chunk-E4N7LNGP.js.map → trillion3d-chunk-4JYI3X5D.js.map} +0 -0
  811. /package/dist/{trillion3d-chunk-SG3C5SMX.js.map → trillion3d-chunk-4KEDPBE4.js.map} +0 -0
  812. /package/dist/{trillion3d-chunk-UBW2ZWPI.js.map → trillion3d-chunk-4KWKWEQL.js.map} +0 -0
  813. /package/dist/{trillion3d-chunk-BGNYLCJW.js.map → trillion3d-chunk-4Z6VA66T.js.map} +0 -0
  814. /package/dist/{trillion3d-chunk-GJAAOF62.js.map → trillion3d-chunk-5243PXB7.js.map} +0 -0
  815. /package/dist/{trillion3d-chunk-VQ7DWMHP.js.map → trillion3d-chunk-53CFT7G7.js.map} +0 -0
  816. /package/dist/{trillion3d-chunk-NUSOZ5NQ.js.map → trillion3d-chunk-53QFLAA3.js.map} +0 -0
  817. /package/dist/{trillion3d-chunk-I5PD2IYL.js.map → trillion3d-chunk-56N6ZOBE.js.map} +0 -0
  818. /package/dist/{trillion3d-chunk-UXRH76J5.js.map → trillion3d-chunk-5E744XXD.js.map} +0 -0
  819. /package/dist/{trillion3d-chunk-NJW7NEZW.js.map → trillion3d-chunk-5KEW2ZOY.js.map} +0 -0
  820. /package/dist/{trillion3d-chunk-KCXWBXK2.js.map → trillion3d-chunk-5ORGGJA5.js.map} +0 -0
  821. /package/dist/{trillion3d-chunk-XS7FCVOV.js.map → trillion3d-chunk-5RMOZCQA.js.map} +0 -0
  822. /package/dist/{trillion3d-chunk-AA2V3CRQ.js.map → trillion3d-chunk-5SJT7EQ3.js.map} +0 -0
  823. /package/dist/{trillion3d-chunk-B3ECL3UB.js.map → trillion3d-chunk-5TTX63XG.js.map} +0 -0
  824. /package/dist/{trillion3d-chunk-4KXFERR4.js.map → trillion3d-chunk-5WEWDH7F.js.map} +0 -0
  825. /package/dist/{trillion3d-chunk-P74SV4JJ.js.map → trillion3d-chunk-64WTBYW5.js.map} +0 -0
  826. /package/dist/{trillion3d-chunk-77T2WOXU.js.map → trillion3d-chunk-6I7I5ZYU.js.map} +0 -0
  827. /package/dist/{trillion3d-chunk-CBPJFYIU.js.map → trillion3d-chunk-6OYOGQUQ.js.map} +0 -0
  828. /package/dist/{trillion3d-chunk-GTJAMKXA.js.map → trillion3d-chunk-6PMAMKLI.js.map} +0 -0
  829. /package/dist/{trillion3d-chunk-UX44ZL4D.js.map → trillion3d-chunk-6S7S5WI5.js.map} +0 -0
  830. /package/dist/{trillion3d-chunk-OOOINENB.js.map → trillion3d-chunk-6UP3ZCNV.js.map} +0 -0
  831. /package/dist/{trillion3d-chunk-46P46SRG.js.map → trillion3d-chunk-6WOJ6TQD.js.map} +0 -0
  832. /package/dist/{trillion3d-chunk-LE7PGKD4.js.map → trillion3d-chunk-6WS2EEBU.js.map} +0 -0
  833. /package/dist/{trillion3d-chunk-N76JAZ32.js.map → trillion3d-chunk-6WUY2OOX.js.map} +0 -0
  834. /package/dist/{trillion3d-chunk-KITYCFGK.js.map → trillion3d-chunk-72FCWPUJ.js.map} +0 -0
  835. /package/dist/{trillion3d-chunk-FLJAAUWJ.js.map → trillion3d-chunk-72IAEP44.js.map} +0 -0
  836. /package/dist/{trillion3d-chunk-O3OYDVQH.js.map → trillion3d-chunk-77FPYTBQ.js.map} +0 -0
  837. /package/dist/{trillion3d-chunk-SAYEA3NT.js.map → trillion3d-chunk-7AQANLZ3.js.map} +0 -0
  838. /package/dist/{trillion3d-chunk-K364ZTPY.js.map → trillion3d-chunk-7ATTJ3AJ.js.map} +0 -0
  839. /package/dist/{trillion3d-chunk-5ASFLMJ6.js.map → trillion3d-chunk-7G4WOX6B.js.map} +0 -0
  840. /package/dist/{trillion3d-chunk-PU4JWKCC.js.map → trillion3d-chunk-7LIWCQGR.js.map} +0 -0
  841. /package/dist/{trillion3d-chunk-IGBD22JD.js.map → trillion3d-chunk-7N3FUKOD.js.map} +0 -0
  842. /package/dist/{trillion3d-chunk-ETCQFZ4S.js.map → trillion3d-chunk-7QFOJHAZ.js.map} +0 -0
  843. /package/dist/{trillion3d-chunk-XAWENX7C.js.map → trillion3d-chunk-7TIVZUM6.js.map} +0 -0
  844. /package/dist/{trillion3d-chunk-UL2YJ52J.js.map → trillion3d-chunk-7U7CHALH.js.map} +0 -0
  845. /package/dist/{trillion3d-chunk-KU7R2CLN.js.map → trillion3d-chunk-7UXM26LW.js.map} +0 -0
  846. /package/dist/{trillion3d-chunk-XUD7A3GH.js.map → trillion3d-chunk-7VTYT5MF.js.map} +0 -0
  847. /package/dist/{trillion3d-chunk-FYTCEF3P.js.map → trillion3d-chunk-A4ULELL5.js.map} +0 -0
  848. /package/dist/{trillion3d-chunk-7NZTUQYT.js.map → trillion3d-chunk-ADMXPAEH.js.map} +0 -0
  849. /package/dist/{trillion3d-chunk-ZFEJXND5.js.map → trillion3d-chunk-AFRFQ25D.js.map} +0 -0
  850. /package/dist/{trillion3d-chunk-G6HYU5QH.js.map → trillion3d-chunk-AIB6NXH4.js.map} +0 -0
  851. /package/dist/{trillion3d-chunk-DZ5A6N23.js.map → trillion3d-chunk-AIQAWNNP.js.map} +0 -0
  852. /package/dist/{trillion3d-chunk-XI6O5F6V.js.map → trillion3d-chunk-AMJ6I7P4.js.map} +0 -0
  853. /package/dist/{trillion3d-chunk-ZNNO6SDC.js.map → trillion3d-chunk-AQAJMS5A.js.map} +0 -0
  854. /package/dist/{trillion3d-chunk-SYQOPTR2.js.map → trillion3d-chunk-ARDABN2G.js.map} +0 -0
  855. /package/dist/{trillion3d-chunk-5HWOHERQ.js.map → trillion3d-chunk-B3QB55EK.js.map} +0 -0
  856. /package/dist/{trillion3d-chunk-AYJO3NNO.js.map → trillion3d-chunk-B5NXEPES.js.map} +0 -0
  857. /package/dist/{trillion3d-chunk-36VHFR62.js.map → trillion3d-chunk-BARQSI5Q.js.map} +0 -0
  858. /package/dist/{trillion3d-chunk-ESO5KVG2.js.map → trillion3d-chunk-BCYA7LWA.js.map} +0 -0
  859. /package/dist/{trillion3d-chunk-3HPFLXCF.js.map → trillion3d-chunk-BIBJMHIN.js.map} +0 -0
  860. /package/dist/{trillion3d-chunk-H5B36GHI.js.map → trillion3d-chunk-BIGALHRE.js.map} +0 -0
  861. /package/dist/{trillion3d-chunk-QW7R4JSU.js.map → trillion3d-chunk-BKON7HDQ.js.map} +0 -0
  862. /package/dist/{trillion3d-chunk-IGH6C5NL.js.map → trillion3d-chunk-BRHXHYWB.js.map} +0 -0
  863. /package/dist/{trillion3d-chunk-JXEBQPRX.js.map → trillion3d-chunk-BVXHXONN.js.map} +0 -0
  864. /package/dist/{trillion3d-chunk-POPUJ5RT.js.map → trillion3d-chunk-BWPZMIFY.js.map} +0 -0
  865. /package/dist/{trillion3d-chunk-CPLMDH47.js.map → trillion3d-chunk-C2WWWTMZ.js.map} +0 -0
  866. /package/dist/{trillion3d-chunk-ZDT7Z7AV.js.map → trillion3d-chunk-C7DCG2NV.js.map} +0 -0
  867. /package/dist/{trillion3d-chunk-IVAI2C6D.js.map → trillion3d-chunk-CCZJZMRJ.js.map} +0 -0
  868. /package/dist/{trillion3d-chunk-ADUR3TJH.js.map → trillion3d-chunk-CFIW2PLU.js.map} +0 -0
  869. /package/dist/{trillion3d-chunk-WPZHDV22.js.map → trillion3d-chunk-CH3UKBVF.js.map} +0 -0
  870. /package/dist/{trillion3d-chunk-OG5M47HN.js.map → trillion3d-chunk-COAMUWUG.js.map} +0 -0
  871. /package/dist/{trillion3d-chunk-Q4XTYMSK.js.map → trillion3d-chunk-CS3EWLHS.js.map} +0 -0
  872. /package/dist/{trillion3d-chunk-WLOE6LQT.js.map → trillion3d-chunk-CS6MYZM7.js.map} +0 -0
  873. /package/dist/{trillion3d-chunk-KEQDYXLL.js.map → trillion3d-chunk-CSVCHCKI.js.map} +0 -0
  874. /package/dist/{trillion3d-chunk-JO55XZVA.js.map → trillion3d-chunk-CYW43B6C.js.map} +0 -0
  875. /package/dist/{trillion3d-chunk-NH3GZRI7.js.map → trillion3d-chunk-D2UJO22L.js.map} +0 -0
  876. /package/dist/{trillion3d-chunk-Y3SDC6TY.js.map → trillion3d-chunk-D5LNZFJU.js.map} +0 -0
  877. /package/dist/{trillion3d-chunk-QEJGU4DQ.js.map → trillion3d-chunk-DJIWKT4L.js.map} +0 -0
  878. /package/dist/{trillion3d-chunk-XM5IBOQ3.js.map → trillion3d-chunk-DNAAW2B5.js.map} +0 -0
  879. /package/dist/{trillion3d-chunk-SM64HJZI.js.map → trillion3d-chunk-DOXBXQJU.js.map} +0 -0
  880. /package/dist/{trillion3d-chunk-2PBJSBLO.js.map → trillion3d-chunk-DQVEKWHY.js.map} +0 -0
  881. /package/dist/{trillion3d-chunk-AA6W2SUV.js.map → trillion3d-chunk-DQYIKRAI.js.map} +0 -0
  882. /package/dist/{trillion3d-chunk-3BY2FPRS.js.map → trillion3d-chunk-DX5UNL5O.js.map} +0 -0
  883. /package/dist/{trillion3d-chunk-PQH6Z3ZK.js.map → trillion3d-chunk-EF6DURKO.js.map} +0 -0
  884. /package/dist/{trillion3d-chunk-2JAAFFQC.js.map → trillion3d-chunk-EKH44M5H.js.map} +0 -0
  885. /package/dist/{trillion3d-chunk-JRLCX4ZB.js.map → trillion3d-chunk-EKHMHUHO.js.map} +0 -0
  886. /package/dist/{trillion3d-chunk-CJHN7L75.js.map → trillion3d-chunk-EKMPAWJU.js.map} +0 -0
  887. /package/dist/{trillion3d-chunk-HDA6WCOZ.js.map → trillion3d-chunk-ELCIIOBC.js.map} +0 -0
  888. /package/dist/{trillion3d-chunk-JRVTAQY2.js.map → trillion3d-chunk-EME34J3O.js.map} +0 -0
  889. /package/dist/{trillion3d-chunk-FDP5PHNI.js.map → trillion3d-chunk-EMNL3VBH.js.map} +0 -0
  890. /package/dist/{trillion3d-chunk-PUS6DQHP.js.map → trillion3d-chunk-EOA6RIXX.js.map} +0 -0
  891. /package/dist/{trillion3d-chunk-ZSTYK7WY.js.map → trillion3d-chunk-ESEYMHSX.js.map} +0 -0
  892. /package/dist/{trillion3d-chunk-KJXQTIKM.js.map → trillion3d-chunk-EVWXSXV3.js.map} +0 -0
  893. /package/dist/{trillion3d-chunk-T43PRG7O.js.map → trillion3d-chunk-EW3266JI.js.map} +0 -0
  894. /package/dist/{trillion3d-chunk-2JM7B67K.js.map → trillion3d-chunk-F5ZFHT7O.js.map} +0 -0
  895. /package/dist/{trillion3d-chunk-YTL2XIXN.js.map → trillion3d-chunk-FBPHTYO3.js.map} +0 -0
  896. /package/dist/{trillion3d-chunk-EO2IHUHA.js.map → trillion3d-chunk-FCITXHHL.js.map} +0 -0
  897. /package/dist/{trillion3d-chunk-2OFUDJNU.js.map → trillion3d-chunk-FG4VFY2I.js.map} +0 -0
  898. /package/dist/{trillion3d-chunk-JN2SWJKC.js.map → trillion3d-chunk-FJ6PAVLE.js.map} +0 -0
  899. /package/dist/{trillion3d-chunk-UTTH7HS7.js.map → trillion3d-chunk-FNZKGTZC.js.map} +0 -0
  900. /package/dist/{trillion3d-chunk-AZ6SQT7V.js.map → trillion3d-chunk-FVKZE7SE.js.map} +0 -0
  901. /package/dist/{trillion3d-chunk-472QQ27C.js.map → trillion3d-chunk-FXEJM7VG.js.map} +0 -0
  902. /package/dist/{trillion3d-chunk-7QYR7QUU.js.map → trillion3d-chunk-FYXZW5DA.js.map} +0 -0
  903. /package/dist/{trillion3d-chunk-X2FMWMUT.js.map → trillion3d-chunk-G3DRTVHN.js.map} +0 -0
  904. /package/dist/{trillion3d-chunk-KYDPV56Z.js.map → trillion3d-chunk-G4AJOGQ7.js.map} +0 -0
  905. /package/dist/{trillion3d-chunk-5ROJIVV3.js.map → trillion3d-chunk-GEI5JB66.js.map} +0 -0
  906. /package/dist/{trillion3d-chunk-2VZIVK5U.js.map → trillion3d-chunk-GHFAPXBM.js.map} +0 -0
  907. /package/dist/{trillion3d-chunk-KS3GXZPA.js.map → trillion3d-chunk-GI2T6FOU.js.map} +0 -0
  908. /package/dist/{trillion3d-chunk-W4SMNFPI.js.map → trillion3d-chunk-GJZNN5UJ.js.map} +0 -0
  909. /package/dist/{trillion3d-chunk-PN2YD2PU.js.map → trillion3d-chunk-GK2DII6G.js.map} +0 -0
  910. /package/dist/{trillion3d-chunk-SLLV2LYS.js.map → trillion3d-chunk-GPVAVLAF.js.map} +0 -0
  911. /package/dist/{trillion3d-chunk-S25VCORA.js.map → trillion3d-chunk-GTR23Z5K.js.map} +0 -0
  912. /package/dist/{trillion3d-chunk-K3434KA7.js.map → trillion3d-chunk-GVOSTFBW.js.map} +0 -0
  913. /package/dist/{trillion3d-chunk-M63PPBDR.js.map → trillion3d-chunk-GYORYIF5.js.map} +0 -0
  914. /package/dist/{trillion3d-chunk-JLJSXR5R.js.map → trillion3d-chunk-H3DVML7I.js.map} +0 -0
  915. /package/dist/{trillion3d-chunk-F4TG7DXL.js.map → trillion3d-chunk-H7KLPWI5.js.map} +0 -0
  916. /package/dist/{trillion3d-chunk-WUZB5LTJ.js.map → trillion3d-chunk-H7LQGPKQ.js.map} +0 -0
  917. /package/dist/{trillion3d-chunk-I2L32YAH.js.map → trillion3d-chunk-HBJ6VZPO.js.map} +0 -0
  918. /package/dist/{trillion3d-chunk-HTCY6CIU.js.map → trillion3d-chunk-HBMBGWN2.js.map} +0 -0
  919. /package/dist/{trillion3d-chunk-7CSS2AWO.js.map → trillion3d-chunk-HBSLKLSZ.js.map} +0 -0
  920. /package/dist/{trillion3d-chunk-Y4MIWQBS.js.map → trillion3d-chunk-HCG3ESSV.js.map} +0 -0
  921. /package/dist/{trillion3d-chunk-YQC77N7M.js.map → trillion3d-chunk-HDQGK2TL.js.map} +0 -0
  922. /package/dist/{trillion3d-chunk-QPNQ6MAU.js.map → trillion3d-chunk-HRCLDXIF.js.map} +0 -0
  923. /package/dist/{trillion3d-chunk-2KRIKK4D.js.map → trillion3d-chunk-HRIARS44.js.map} +0 -0
  924. /package/dist/{trillion3d-chunk-GPKNAWFR.js.map → trillion3d-chunk-HV2YN5CF.js.map} +0 -0
  925. /package/dist/{trillion3d-chunk-I7R4YZP2.js.map → trillion3d-chunk-I5M3F6OY.js.map} +0 -0
  926. /package/dist/{trillion3d-chunk-ZTYP3T5T.js.map → trillion3d-chunk-I75EGJAB.js.map} +0 -0
  927. /package/dist/{trillion3d-chunk-UH663TJS.js.map → trillion3d-chunk-I7QRTDI7.js.map} +0 -0
  928. /package/dist/{trillion3d-chunk-K5D3PLUN.js.map → trillion3d-chunk-IAELZYJF.js.map} +0 -0
  929. /package/dist/{trillion3d-chunk-LHFBY6CF.js.map → trillion3d-chunk-ICJUDIVR.js.map} +0 -0
  930. /package/dist/{trillion3d-chunk-OPFDHDV7.js.map → trillion3d-chunk-IEYEFEDV.js.map} +0 -0
  931. /package/dist/{trillion3d-chunk-2HSBVYCY.js.map → trillion3d-chunk-IFLJYROA.js.map} +0 -0
  932. /package/dist/{trillion3d-chunk-74PQZHDK.js.map → trillion3d-chunk-IFZHDHIG.js.map} +0 -0
  933. /package/dist/{trillion3d-chunk-J2KR4G6F.js.map → trillion3d-chunk-IHNPAPHM.js.map} +0 -0
  934. /package/dist/{trillion3d-chunk-5GW525BI.js.map → trillion3d-chunk-IJJXMYSL.js.map} +0 -0
  935. /package/dist/{trillion3d-chunk-XHUSYLI3.js.map → trillion3d-chunk-IJMFDLYO.js.map} +0 -0
  936. /package/dist/{trillion3d-chunk-EIOQWCJW.js.map → trillion3d-chunk-INTWD5DJ.js.map} +0 -0
  937. /package/dist/{trillion3d-chunk-SCJINCDV.js.map → trillion3d-chunk-IWP6655A.js.map} +0 -0
  938. /package/dist/{trillion3d-chunk-42JJO5YV.js.map → trillion3d-chunk-IZTRWVNI.js.map} +0 -0
  939. /package/dist/{trillion3d-chunk-GXMTFTCW.js.map → trillion3d-chunk-J2BIHJ55.js.map} +0 -0
  940. /package/dist/{trillion3d-chunk-ECWU67MC.js.map → trillion3d-chunk-J3NX2PWF.js.map} +0 -0
  941. /package/dist/{trillion3d-chunk-KEIULYWY.js.map → trillion3d-chunk-J6G75W5Q.js.map} +0 -0
  942. /package/dist/{trillion3d-chunk-QDNYR3XW.js.map → trillion3d-chunk-J7ML34IT.js.map} +0 -0
  943. /package/dist/{trillion3d-chunk-F2BKXVDP.js.map → trillion3d-chunk-JD25N5D6.js.map} +0 -0
  944. /package/dist/{trillion3d-chunk-YI2MFQEG.js.map → trillion3d-chunk-JDIIZKDU.js.map} +0 -0
  945. /package/dist/{trillion3d-chunk-FJRD6RXY.js.map → trillion3d-chunk-JHRQF53B.js.map} +0 -0
  946. /package/dist/{trillion3d-chunk-S4P42ZHN.js.map → trillion3d-chunk-JPN76QOL.js.map} +0 -0
  947. /package/dist/{trillion3d-chunk-MUZUZS2F.js.map → trillion3d-chunk-JRCGXELE.js.map} +0 -0
  948. /package/dist/{trillion3d-chunk-QGELETHW.js.map → trillion3d-chunk-JXIMDH6A.js.map} +0 -0
  949. /package/dist/{trillion3d-chunk-P75YOB5K.js.map → trillion3d-chunk-K6R7UEQZ.js.map} +0 -0
  950. /package/dist/{trillion3d-chunk-LV5NP2OD.js.map → trillion3d-chunk-K72UANQN.js.map} +0 -0
  951. /package/dist/{trillion3d-chunk-BZAV5BK7.js.map → trillion3d-chunk-KKECIVIP.js.map} +0 -0
  952. /package/dist/{trillion3d-chunk-XYP27BGE.js.map → trillion3d-chunk-KLGN5XV3.js.map} +0 -0
  953. /package/dist/{trillion3d-chunk-I63LRS3P.js.map → trillion3d-chunk-KLIGAVUH.js.map} +0 -0
  954. /package/dist/{trillion3d-chunk-ZHRUP5WY.js.map → trillion3d-chunk-KLP7IBDS.js.map} +0 -0
  955. /package/dist/{trillion3d-chunk-W42TUOJC.js.map → trillion3d-chunk-KPFGILKK.js.map} +0 -0
  956. /package/dist/{trillion3d-chunk-G5MFUE5P.js.map → trillion3d-chunk-KR4PIU6F.js.map} +0 -0
  957. /package/dist/{trillion3d-chunk-D4DXAQPJ.js.map → trillion3d-chunk-KRV5VQCR.js.map} +0 -0
  958. /package/dist/{trillion3d-chunk-PSMSPY5U.js.map → trillion3d-chunk-KUJMOLHB.js.map} +0 -0
  959. /package/dist/{trillion3d-chunk-3EPZT7SR.js.map → trillion3d-chunk-KUKNVBWH.js.map} +0 -0
  960. /package/dist/{trillion3d-chunk-Y322OCAR.js.map → trillion3d-chunk-KXM3DYQH.js.map} +0 -0
  961. /package/dist/{trillion3d-chunk-2MVQXOFZ.js.map → trillion3d-chunk-L2F5RZRX.js.map} +0 -0
  962. /package/dist/{trillion3d-chunk-DUWMZGSW.js.map → trillion3d-chunk-L2FRHLXI.js.map} +0 -0
  963. /package/dist/{trillion3d-chunk-2TYAUOQ5.js.map → trillion3d-chunk-L3VCBYGD.js.map} +0 -0
  964. /package/dist/{trillion3d-chunk-MQEVNNBK.js.map → trillion3d-chunk-LAAPTFVW.js.map} +0 -0
  965. /package/dist/{trillion3d-chunk-2CZ6RWTW.js.map → trillion3d-chunk-LANLTCBQ.js.map} +0 -0
  966. /package/dist/{trillion3d-chunk-UCGD7DGZ.js.map → trillion3d-chunk-LE4HL44Z.js.map} +0 -0
  967. /package/dist/{trillion3d-chunk-7CGRPLOC.js.map → trillion3d-chunk-LEY2Q6DZ.js.map} +0 -0
  968. /package/dist/{trillion3d-chunk-SKH3XZ4Q.js.map → trillion3d-chunk-LMWJTQFR.js.map} +0 -0
  969. /package/dist/{trillion3d-chunk-VGIJRZO5.js.map → trillion3d-chunk-LQLIXMMD.js.map} +0 -0
  970. /package/dist/{trillion3d-chunk-Z6ISTRN2.js.map → trillion3d-chunk-LTWG3NOL.js.map} +0 -0
  971. /package/dist/{trillion3d-chunk-OXKMBXZD.js.map → trillion3d-chunk-M773YMP6.js.map} +0 -0
  972. /package/dist/{trillion3d-chunk-ZTNOBS5G.js.map → trillion3d-chunk-MAKYPLYF.js.map} +0 -0
  973. /package/dist/{trillion3d-chunk-5LQDA7UM.js.map → trillion3d-chunk-MCNOP7UR.js.map} +0 -0
  974. /package/dist/{trillion3d-chunk-GUWCZ2WR.js.map → trillion3d-chunk-MCSS3F6E.js.map} +0 -0
  975. /package/dist/{trillion3d-chunk-ZXGUNSUQ.js.map → trillion3d-chunk-MF4CAU3R.js.map} +0 -0
  976. /package/dist/{trillion3d-chunk-ZXF6BEYU.js.map → trillion3d-chunk-MJTRABFR.js.map} +0 -0
  977. /package/dist/{trillion3d-chunk-AU725OCC.js.map → trillion3d-chunk-MQBDHCB3.js.map} +0 -0
  978. /package/dist/{trillion3d-chunk-R3HHRSA5.js.map → trillion3d-chunk-MUMQYHCQ.js.map} +0 -0
  979. /package/dist/{trillion3d-chunk-P2RDFAA2.js.map → trillion3d-chunk-MXZGFCOM.js.map} +0 -0
  980. /package/dist/{trillion3d-chunk-J5SMDUDO.js.map → trillion3d-chunk-N33FXDXZ.js.map} +0 -0
  981. /package/dist/{trillion3d-chunk-LHHZH3SV.js.map → trillion3d-chunk-N7YEU2CT.js.map} +0 -0
  982. /package/dist/{trillion3d-chunk-BUP4DDEO.js.map → trillion3d-chunk-NB7XML37.js.map} +0 -0
  983. /package/dist/{trillion3d-chunk-5ONOJMSW.js.map → trillion3d-chunk-NBFOHDNN.js.map} +0 -0
  984. /package/dist/{trillion3d-chunk-CQESL7F5.js.map → trillion3d-chunk-NEVMYKGT.js.map} +0 -0
  985. /package/dist/{trillion3d-chunk-ICWUGQNV.js.map → trillion3d-chunk-NHC4DXYP.js.map} +0 -0
  986. /package/dist/{trillion3d-chunk-MEMYKAVP.js.map → trillion3d-chunk-NNF42O54.js.map} +0 -0
  987. /package/dist/{trillion3d-chunk-B3ATF6PP.js.map → trillion3d-chunk-NTHEHPA5.js.map} +0 -0
  988. /package/dist/{trillion3d-chunk-P4Q7TPID.js.map → trillion3d-chunk-NVYEQ3JS.js.map} +0 -0
  989. /package/dist/{trillion3d-chunk-BDWRLDJI.js.map → trillion3d-chunk-NZRMWUGY.js.map} +0 -0
  990. /package/dist/{trillion3d-chunk-Y2DWPDRM.js.map → trillion3d-chunk-OD3JBU6D.js.map} +0 -0
  991. /package/dist/{trillion3d-chunk-3GEQFGGV.js.map → trillion3d-chunk-OFCF3GAC.js.map} +0 -0
  992. /package/dist/{trillion3d-chunk-U3CLZW3E.js.map → trillion3d-chunk-OHFYUKAD.js.map} +0 -0
  993. /package/dist/{trillion3d-chunk-NFFLZRMN.js.map → trillion3d-chunk-OHTUNWUN.js.map} +0 -0
  994. /package/dist/{trillion3d-chunk-TLVZXCTJ.js.map → trillion3d-chunk-OLDTBAXR.js.map} +0 -0
  995. /package/dist/{trillion3d-chunk-XYMF73ZW.js.map → trillion3d-chunk-OYZFVYYH.js.map} +0 -0
  996. /package/dist/{trillion3d-chunk-ZUU5E7FO.js.map → trillion3d-chunk-P35JRX3H.js.map} +0 -0
  997. /package/dist/{trillion3d-chunk-HCXQHHY4.js.map → trillion3d-chunk-P3HTLS2O.js.map} +0 -0
  998. /package/dist/{trillion3d-chunk-XXCX4QIN.js.map → trillion3d-chunk-P7UZ7W2B.js.map} +0 -0
  999. /package/dist/{trillion3d-chunk-E5M5PMK3.js.map → trillion3d-chunk-PDWU4CCX.js.map} +0 -0
  1000. /package/dist/{trillion3d-chunk-EZ2JYRNP.js.map → trillion3d-chunk-PFMAOUBW.js.map} +0 -0
  1001. /package/dist/{trillion3d-chunk-M2F7Q77E.js.map → trillion3d-chunk-PHE5OKAE.js.map} +0 -0
  1002. /package/dist/{trillion3d-chunk-7F2KAZFC.js.map → trillion3d-chunk-PMF6JTVJ.js.map} +0 -0
  1003. /package/dist/{trillion3d-chunk-GXDVY3QD.js.map → trillion3d-chunk-PXYUWON5.js.map} +0 -0
  1004. /package/dist/{trillion3d-chunk-HBFRB6UY.js.map → trillion3d-chunk-PYVXDVAE.js.map} +0 -0
  1005. /package/dist/{trillion3d-chunk-EAHDFM7D.js.map → trillion3d-chunk-PZBXWJFT.js.map} +0 -0
  1006. /package/dist/{trillion3d-chunk-URXU62XN.js.map → trillion3d-chunk-Q2T4HBTW.js.map} +0 -0
  1007. /package/dist/{trillion3d-chunk-QFWHSCJS.js.map → trillion3d-chunk-QAHCZ4CN.js.map} +0 -0
  1008. /package/dist/{trillion3d-chunk-WFPJ35TV.js.map → trillion3d-chunk-QFIAXDBJ.js.map} +0 -0
  1009. /package/dist/{trillion3d-chunk-EU4OYQGR.js.map → trillion3d-chunk-QGHAYZR3.js.map} +0 -0
  1010. /package/dist/{trillion3d-chunk-MBN7REAP.js.map → trillion3d-chunk-QMREUFAO.js.map} +0 -0
  1011. /package/dist/{trillion3d-chunk-NH7JVT4M.js.map → trillion3d-chunk-QN7VBGUP.js.map} +0 -0
  1012. /package/dist/{trillion3d-chunk-V4M3HNJD.js.map → trillion3d-chunk-QVFWEZOK.js.map} +0 -0
  1013. /package/dist/{trillion3d-chunk-LZSYLDTU.js.map → trillion3d-chunk-QW5YCJAB.js.map} +0 -0
  1014. /package/dist/{trillion3d-chunk-UBMIQXK3.js.map → trillion3d-chunk-R2A7QWWZ.js.map} +0 -0
  1015. /package/dist/{trillion3d-chunk-V6HD2TKX.js.map → trillion3d-chunk-R4BXG67P.js.map} +0 -0
  1016. /package/dist/{trillion3d-chunk-5KHPSLRC.js.map → trillion3d-chunk-R56L2MST.js.map} +0 -0
  1017. /package/dist/{trillion3d-chunk-S2JLIIRM.js.map → trillion3d-chunk-RLDDQEQJ.js.map} +0 -0
  1018. /package/dist/{trillion3d-chunk-7IZI5OZK.js.map → trillion3d-chunk-RMFAMI5T.js.map} +0 -0
  1019. /package/dist/{trillion3d-chunk-WJBLDQVZ.js.map → trillion3d-chunk-ROHK5HT5.js.map} +0 -0
  1020. /package/dist/{trillion3d-chunk-YWUEHJ6S.js.map → trillion3d-chunk-RPMC2FKD.js.map} +0 -0
  1021. /package/dist/{trillion3d-chunk-JVNGK4EV.js.map → trillion3d-chunk-RTBXAMIZ.js.map} +0 -0
  1022. /package/dist/{trillion3d-chunk-EUCLXLYS.js.map → trillion3d-chunk-S2NA64OJ.js.map} +0 -0
  1023. /package/dist/{trillion3d-chunk-DA3S4LZH.js.map → trillion3d-chunk-SPIIJAMX.js.map} +0 -0
  1024. /package/dist/{trillion3d-chunk-MLBX4WMV.js.map → trillion3d-chunk-SSWVBSJZ.js.map} +0 -0
  1025. /package/dist/{trillion3d-chunk-AEW6BD4P.js.map → trillion3d-chunk-SUDBSFLJ.js.map} +0 -0
  1026. /package/dist/{trillion3d-chunk-VCIRYPE7.js.map → trillion3d-chunk-SUU45ZK7.js.map} +0 -0
  1027. /package/dist/{trillion3d-chunk-CMHKMP7M.js.map → trillion3d-chunk-TFNOURGL.js.map} +0 -0
  1028. /package/dist/{trillion3d-chunk-ZM6OWZBZ.js.map → trillion3d-chunk-TLIN2DEK.js.map} +0 -0
  1029. /package/dist/{trillion3d-chunk-7C5HNDEL.js.map → trillion3d-chunk-TLO4XKYG.js.map} +0 -0
  1030. /package/dist/{trillion3d-chunk-ZKTXPZUU.js.map → trillion3d-chunk-TVYIOVGI.js.map} +0 -0
  1031. /package/dist/{trillion3d-chunk-GOFFACVN.js.map → trillion3d-chunk-TY7RGAI4.js.map} +0 -0
  1032. /package/dist/{trillion3d-chunk-MCIY254D.js.map → trillion3d-chunk-UBSICE2S.js.map} +0 -0
  1033. /package/dist/{trillion3d-chunk-G4ZEQPJE.js.map → trillion3d-chunk-UCIL746V.js.map} +0 -0
  1034. /package/dist/{trillion3d-chunk-5VX27QFH.js.map → trillion3d-chunk-UGTFIP7T.js.map} +0 -0
  1035. /package/dist/{trillion3d-chunk-FBPR5PIL.js.map → trillion3d-chunk-UH2X4DC7.js.map} +0 -0
  1036. /package/dist/{trillion3d-chunk-KWS6MEDX.js.map → trillion3d-chunk-UL5AQCHN.js.map} +0 -0
  1037. /package/dist/{trillion3d-chunk-NQT36E2Z.js.map → trillion3d-chunk-UMAIYYSB.js.map} +0 -0
  1038. /package/dist/{trillion3d-chunk-CD7EZNRP.js.map → trillion3d-chunk-UROCVT3W.js.map} +0 -0
  1039. /package/dist/{trillion3d-chunk-ZHV4B2CP.js.map → trillion3d-chunk-US6WKM5M.js.map} +0 -0
  1040. /package/dist/{trillion3d-chunk-UPJHDFQP.js.map → trillion3d-chunk-UT5VM3B7.js.map} +0 -0
  1041. /package/dist/{trillion3d-chunk-VYQB6KF6.js.map → trillion3d-chunk-UXCQ7A3K.js.map} +0 -0
  1042. /package/dist/{trillion3d-chunk-QHLP3RMM.js.map → trillion3d-chunk-UXQKO5IH.js.map} +0 -0
  1043. /package/dist/{trillion3d-chunk-TZ3XBBRE.js.map → trillion3d-chunk-UXRWIFOC.js.map} +0 -0
  1044. /package/dist/{trillion3d-chunk-2BOYJZCQ.js.map → trillion3d-chunk-V44TZZB3.js.map} +0 -0
  1045. /package/dist/{trillion3d-chunk-DPXM3DHU.js.map → trillion3d-chunk-VFPDIIEP.js.map} +0 -0
  1046. /package/dist/{trillion3d-chunk-5GY24CJD.js.map → trillion3d-chunk-VL44QEQI.js.map} +0 -0
  1047. /package/dist/{trillion3d-chunk-J2YDEAKO.js.map → trillion3d-chunk-VP3GS2OQ.js.map} +0 -0
  1048. /package/dist/{trillion3d-chunk-WOE7ECLG.js.map → trillion3d-chunk-VWRK33DS.js.map} +0 -0
  1049. /package/dist/{trillion3d-chunk-E2VRYXCO.js.map → trillion3d-chunk-W2AGULE7.js.map} +0 -0
  1050. /package/dist/{trillion3d-chunk-JH7I4RDZ.js.map → trillion3d-chunk-W4L4ZLLZ.js.map} +0 -0
  1051. /package/dist/{trillion3d-chunk-742WGJYH.js.map → trillion3d-chunk-WAR4LFLB.js.map} +0 -0
  1052. /package/dist/{trillion3d-chunk-4BOD343S.js.map → trillion3d-chunk-WCVRKGQD.js.map} +0 -0
  1053. /package/dist/{trillion3d-chunk-AYCFHOHV.js.map → trillion3d-chunk-WEACAP55.js.map} +0 -0
  1054. /package/dist/{trillion3d-chunk-O6RA4K6A.js.map → trillion3d-chunk-WG6NZENK.js.map} +0 -0
  1055. /package/dist/{trillion3d-chunk-YIE3H5JS.js.map → trillion3d-chunk-WJ4XQVTQ.js.map} +0 -0
  1056. /package/dist/{trillion3d-chunk-JFCEIZBH.js.map → trillion3d-chunk-WR43FBB3.js.map} +0 -0
  1057. /package/dist/{trillion3d-chunk-CVJOTXK5.js.map → trillion3d-chunk-WXECWHZ5.js.map} +0 -0
  1058. /package/dist/{trillion3d-chunk-ZVO6IOK3.js.map → trillion3d-chunk-WYKIXSUS.js.map} +0 -0
  1059. /package/dist/{trillion3d-chunk-ZSKD2IX5.js.map → trillion3d-chunk-XBDQHYBL.js.map} +0 -0
  1060. /package/dist/{trillion3d-chunk-6VDAUYE6.js.map → trillion3d-chunk-XEPOPZZY.js.map} +0 -0
  1061. /package/dist/{trillion3d-chunk-5COTXELO.js.map → trillion3d-chunk-XEQBUJNB.js.map} +0 -0
  1062. /package/dist/{trillion3d-chunk-4JBRHV7G.js.map → trillion3d-chunk-XL4F65A7.js.map} +0 -0
  1063. /package/dist/{trillion3d-chunk-QLEZIRFO.js.map → trillion3d-chunk-XOAWZNRA.js.map} +0 -0
  1064. /package/dist/{trillion3d-chunk-S47ADXWU.js.map → trillion3d-chunk-XQHULSDL.js.map} +0 -0
  1065. /package/dist/{trillion3d-chunk-FPH3NDSE.js.map → trillion3d-chunk-XQSMKVTL.js.map} +0 -0
  1066. /package/dist/{trillion3d-chunk-OVVY7IKC.js.map → trillion3d-chunk-XQSU4SY6.js.map} +0 -0
  1067. /package/dist/{trillion3d-chunk-UR2BLLWY.js.map → trillion3d-chunk-XWJQJK22.js.map} +0 -0
  1068. /package/dist/{trillion3d-chunk-RUOI3D3D.js.map → trillion3d-chunk-XXOXGG47.js.map} +0 -0
  1069. /package/dist/{trillion3d-chunk-5B3ML3DL.js.map → trillion3d-chunk-XY7DNXWL.js.map} +0 -0
  1070. /package/dist/{trillion3d-chunk-7XEWHG3S.js.map → trillion3d-chunk-XYZRT3VR.js.map} +0 -0
  1071. /package/dist/{trillion3d-chunk-JOPRGF7Z.js.map → trillion3d-chunk-XZPUDNQA.js.map} +0 -0
  1072. /package/dist/{trillion3d-chunk-QZURF55R.js.map → trillion3d-chunk-Y2RAGKRM.js.map} +0 -0
  1073. /package/dist/{trillion3d-chunk-QOKJKCXP.js.map → trillion3d-chunk-YA4TWJRK.js.map} +0 -0
  1074. /package/dist/{trillion3d-chunk-2L52NUG7.js.map → trillion3d-chunk-YAFEYU2S.js.map} +0 -0
  1075. /package/dist/{trillion3d-chunk-ABKLIRWX.js.map → trillion3d-chunk-YBKRRMOT.js.map} +0 -0
  1076. /package/dist/{trillion3d-chunk-LB2MHAHM.js.map → trillion3d-chunk-YFSDLEIZ.js.map} +0 -0
  1077. /package/dist/{trillion3d-chunk-LHCO3J7M.js.map → trillion3d-chunk-YIUAOG6X.js.map} +0 -0
  1078. /package/dist/{trillion3d-chunk-PPUZR76B.js.map → trillion3d-chunk-YKZXAXMM.js.map} +0 -0
  1079. /package/dist/{trillion3d-chunk-U4EL7JGK.js.map → trillion3d-chunk-YMR3WF2W.js.map} +0 -0
  1080. /package/dist/{trillion3d-chunk-RB22IHFT.js.map → trillion3d-chunk-YNRZO4Y4.js.map} +0 -0
  1081. /package/dist/{trillion3d-chunk-SIPUEAJ5.js.map → trillion3d-chunk-YOXV4W6I.js.map} +0 -0
  1082. /package/dist/{trillion3d-chunk-V2BAFU66.js.map → trillion3d-chunk-YQT76FYC.js.map} +0 -0
  1083. /package/dist/{trillion3d-chunk-Y42MTEVG.js.map → trillion3d-chunk-YRPBW7AK.js.map} +0 -0
  1084. /package/dist/{trillion3d-chunk-M2AYPZAT.js.map → trillion3d-chunk-YULZ6QUZ.js.map} +0 -0
  1085. /package/dist/{trillion3d-chunk-N45WPUNA.js.map → trillion3d-chunk-YWWOBEV2.js.map} +0 -0
  1086. /package/dist/{trillion3d-chunk-EI2XZGZC.js.map → trillion3d-chunk-YYWNNHNI.js.map} +0 -0
  1087. /package/dist/{trillion3d-chunk-IWBFD73G.js.map → trillion3d-chunk-ZBIQ6S5Z.js.map} +0 -0
  1088. /package/dist/{trillion3d-chunk-ZGWEZTGI.js.map → trillion3d-chunk-ZBXTCONH.js.map} +0 -0
  1089. /package/dist/{trillion3d-chunk-TI3PM7XW.js.map → trillion3d-chunk-ZDNFJYCW.js.map} +0 -0
  1090. /package/dist/{trillion3d-chunk-6Y7TZO62.js.map → trillion3d-chunk-ZF5EDFJS.js.map} +0 -0
  1091. /package/dist/{trillion3d-chunk-QCE7DOXK.js.map → trillion3d-chunk-ZFAKVFKL.js.map} +0 -0
  1092. /package/dist/{trillion3d-chunk-V6VZ5QXG.js.map → trillion3d-chunk-ZIGGUJM6.js.map} +0 -0
  1093. /package/dist/{trillion3d-chunk-KTGIIVAQ.js.map → trillion3d-chunk-ZNJ4TNBW.js.map} +0 -0
  1094. /package/dist/{trillion3d-chunk-JQ2VUCTW.js.map → trillion3d-chunk-ZQPT2YFE.js.map} +0 -0
  1095. /package/dist/{trillion3d-chunk-JCTPF4CK.js.map → trillion3d-chunk-ZUFX2HVV.js.map} +0 -0
  1096. /package/dist/{trillion3d-chunk-S4NKU3YU.js.map → trillion3d-chunk-ZUQDRSYB.js.map} +0 -0
  1097. /package/dist/{trillion3d-chunk-TWFQBYBV.js.map → trillion3d-chunk-ZVSX6CGW.js.map} +0 -0
  1098. /package/dist/{trillion3d-chunk-5K6QSSBR.js.map → trillion3d-chunk-ZYS4E37Q.js.map} +0 -0
  1099. /package/dist/{trillion3d-chunk-5VVVL3GH.js.map → trillion3d-chunk-ZZWX6Q7H.js.map} +0 -0
  1100. /package/dist/{trillion3d-cinematicsCode-5UPGQFVV.js.map → trillion3d-cinematicsCode-2YP657C3.js.map} +0 -0
  1101. /package/dist/{trillion3d-cubeCapturesCode-LCBK47X5.js.map → trillion3d-cubeCapturesCode-BOLBDRJD.js.map} +0 -0
  1102. /package/dist/{trillion3d-debugViewsCode-7GJW7RDI.js.map → trillion3d-debugViewsCode-F4KTKXOZ.js.map} +0 -0
  1103. /package/dist/{trillion3d-decalCode-ID2FWTA7.js.map → trillion3d-decalCode-4OSGACRW.js.map} +0 -0
  1104. /package/dist/{trillion3d-deformationCode-PIIEMRNF.js.map → trillion3d-deformationCode-GJBRRE4B.js.map} +0 -0
  1105. /package/dist/{trillion3d-displacementCode-ZMPJRUDW.js.map → trillion3d-displacementCode-OS37YHNO.js.map} +0 -0
  1106. /package/dist/{trillion3d-effectCode-J22OGAGG.js.map → trillion3d-effectCode-CNDEXEFI.js.map} +0 -0
  1107. /package/dist/{trillion3d-explorer-JTT6UBU6.js.map → trillion3d-explorer-3SU2HTGD.js.map} +0 -0
  1108. /package/dist/{trillion3d-export-H3WTWO2M.js.map → trillion3d-export-3COKIWS6.js.map} +0 -0
  1109. /package/dist/{trillion3d-family-IM6JIBGG.js.map → trillion3d-family-YNJWVKWC.js.map} +0 -0
  1110. /package/dist/{trillion3d-fieldsCode-QD2TBZOM.js.map → trillion3d-fieldsCode-JQLVIT4H.js.map} +0 -0
  1111. /package/dist/{trillion3d-fogCode-PNHAG2DD.js.map → trillion3d-fogCode-PM5UY2TW.js.map} +0 -0
  1112. /package/dist/{trillion3d-geometryPage-3J5Q2EZN.js.map → trillion3d-geometryPage-DVJ4N2A6.js.map} +0 -0
  1113. /package/dist/{trillion3d-graphCode-DWZUBHZQ.js.map → trillion3d-graphCode-MCIPPACK.js.map} +0 -0
  1114. /package/dist/{trillion3d-graphCode-HGVQ47X4.js.map → trillion3d-graphCode-MOTJ4WBF.js.map} +0 -0
  1115. /package/dist/{trillion3d-grassCode-HASCTGFB.js.map → trillion3d-grassCode-J7CCF63J.js.map} +0 -0
  1116. /package/dist/{trillion3d-guideCode-XKNU3UOB.js.map → trillion3d-guideCode-ONWTGY2H.js.map} +0 -0
  1117. /package/dist/{trillion3d-hairCode-VUMV4M33.js.map → trillion3d-hairCode-PNWJMXWH.js.map} +0 -0
  1118. /package/dist/{trillion3d-hardwareBenchmark-H2SLAEER.js.map → trillion3d-hardwareBenchmark-JD2ITGNS.js.map} +0 -0
  1119. /package/dist/{trillion3d-headlessCode-3KBNVKND.js.map → trillion3d-headlessCode-JAXG4XPK.js.map} +0 -0
  1120. /package/dist/{trillion3d-iesCode-GVJDBPQY.js.map → trillion3d-iesCode-QVSRIT37.js.map} +0 -0
  1121. /package/dist/{trillion3d-indicator-VCCCRO7K.js.map → trillion3d-indicator-ZDOOX6EU.js.map} +0 -0
  1122. /package/dist/{trillion3d-installCode-GDJ6EA73.js.map → trillion3d-installCode-5NOFNOTZ.js.map} +0 -0
  1123. /package/dist/{trillion3d-manifestLoad-Y2XKGXCD.js.map → trillion3d-manifestLoad-TEO2A7XO.js.map} +0 -0
  1124. /package/dist/{trillion3d-markCode-VYWQBD3K.js.map → trillion3d-markCode-DD7RPZ2V.js.map} +0 -0
  1125. /package/dist/{trillion3d-modelArrivalCode-ENI7UWDQ.js.map → trillion3d-modelArrivalCode-AS2ZIO5I.js.map} +0 -0
  1126. /package/dist/{trillion3d-modelCapture-BMLNM2DT.js.map → trillion3d-modelCapture-OZNK2KHI.js.map} +0 -0
  1127. /package/dist/{trillion3d-modelCopiesCode-7JYQXGVF.js.map → trillion3d-modelCopiesCode-X7PCUUUT.js.map} +0 -0
  1128. /package/dist/{trillion3d-modelImagesCode-C3O4XMTN.js.map → trillion3d-modelImagesCode-7NZ3BIL5.js.map} +0 -0
  1129. /package/dist/{trillion3d-pageAudioCode-JV4TWD5B.js.map → trillion3d-pageAudioCode-PQWNFXNH.js.map} +0 -0
  1130. /package/dist/{trillion3d-pageCompile-YNZYXLLY.js.map → trillion3d-pageCompile-4KI5TP2J.js.map} +0 -0
  1131. /package/dist/{trillion3d-panel-RYDJZQFJ.js.map → trillion3d-panel-4BMTNA6N.js.map} +0 -0
  1132. /package/dist/{trillion3d-particleCode-244NV3QC.js.map → trillion3d-particleCode-X7RJYMM2.js.map} +0 -0
  1133. /package/dist/{trillion3d-partitionCode-LJW6NXJO.js.map → trillion3d-partitionCode-KNTGZUZG.js.map} +0 -0
  1134. /package/dist/{trillion3d-pathTracingCode-PY4YXX2K.js.map → trillion3d-pathTracingCode-IUDUNO7P.js.map} +0 -0
  1135. /package/dist/{trillion3d-planarReflectionsCode-3HPS33JS.js.map → trillion3d-planarReflectionsCode-22NVSPZ2.js.map} +0 -0
  1136. /package/dist/{trillion3d-previewRun-MYYO5L7K.js.map → trillion3d-previewRun-YOUFRKDJ.js.map} +0 -0
  1137. /package/dist/{trillion3d-ragdollCode-Q2F4YXCT.js.map → trillion3d-ragdollCode-XOZ7BBU4.js.map} +0 -0
  1138. /package/dist/{trillion3d-ragdollStage-673NKNJC.js.map → trillion3d-ragdollStage-EGRNR3QB.js.map} +0 -0
  1139. /package/dist/{trillion3d-read-KTRGUDEK.js.map → trillion3d-read-6L2UR4EJ.js.map} +0 -0
  1140. /package/dist/{trillion3d-reflectionsCode-EYZ2I2RG.js.map → trillion3d-reflectionsCode-3T6W62HT.js.map} +0 -0
  1141. /package/dist/{trillion3d-sampledLightsCode-44YPQANZ.js.map → trillion3d-sampledLightsCode-MSZ2YCSJ.js.map} +0 -0
  1142. /package/dist/{trillion3d-scene-VDR67XPZ.js.map → trillion3d-scene-3LL23MZI.js.map} +0 -0
  1143. /package/dist/{trillion3d-session-V5UGVDGM.js.map → trillion3d-session-S4GIQNV6.js.map} +0 -0
  1144. /package/dist/{trillion3d-shadowsCode-IGFSPJZS.js.map → trillion3d-shadowsCode-UZNPLVCV.js.map} +0 -0
  1145. /package/dist/{trillion3d-skyCode-VIAPJ6TS.js.map → trillion3d-skyCode-BYIIBWAM.js.map} +0 -0
  1146. /package/dist/{trillion3d-sortedTranslucencyCode-ENOIPRNP.js.map → trillion3d-sortedTranslucencyCode-VLSTGX5S.js.map} +0 -0
  1147. /package/dist/{trillion3d-splineMeshCode-X6CFRALJ.js.map → trillion3d-splineMeshCode-AWDX5BIG.js.map} +0 -0
  1148. /package/dist/{trillion3d-subsurfaceCode-L36SYFNH.js.map → trillion3d-subsurfaceCode-PROXJTLS.js.map} +0 -0
  1149. /package/dist/{trillion3d-surfaceCode-J3JUDHSC.js.map → trillion3d-surfaceCode-CW2NSI5O.js.map} +0 -0
  1150. /package/dist/{trillion3d-terrainCode-BHCQQRET.js.map → trillion3d-terrainCode-ZDONXR5X.js.map} +0 -0
  1151. /package/dist/{trillion3d-transformCode-74Z7PQYM.js.map → trillion3d-transformCode-SE55EUCN.js.map} +0 -0
  1152. /package/dist/{trillion3d-translucentLightVolumeCode-3HU4TBPQ.js.map → trillion3d-translucentLightVolumeCode-EQKMCGMD.js.map} +0 -0
  1153. /package/dist/{trillion3d-viewCode-IXEIJJWS.js.map → trillion3d-viewCode-52L7D5ZW.js.map} +0 -0
  1154. /package/dist/{trillion3d-volumesCode-RDBBXG3U.js.map → trillion3d-volumesCode-NYAC6KYU.js.map} +0 -0
  1155. /package/dist/{trillion3d-waterCode-3ZRB2JP7.js.map → trillion3d-waterCode-CWZ5XYNU.js.map} +0 -0
  1156. /package/dist/{trillion3d-webgpuCode-BQTJL2EM.js.map → trillion3d-webgpuCode-2GNPUWQ4.js.map} +0 -0
  1157. /package/dist/{trillion3d-workCode-V42SMDJA.js.map → trillion3d-workCode-DCC25A2D.js.map} +0 -0
  1158. /package/dist/{trillion3d-worldRootPages-3SFAHS63.js.map → trillion3d-worldRootPages-P75VSIXR.js.map} +0 -0
@@ -1,2537 +0,0 @@
1
- import{$c as Q,$l as qf,Al as Mf,Ba as Ac,Cb as $c,Cl as Vf,Db as Dc,Eb as Qr,Ec as Xa,Em as Jf,Fe as Gf,Ga as Et,Gc as df,Gm as eu,Hc as Kt,Hm as tu,Ic as vf,Ja as Nc,Jm as ru,Kb as Wc,Kc as Ef,Lk as kf,Lm as ou,Mc as _f,Ni as Qa,Oi as Pf,Ok as en,Pa as Ce,Pm as su,Ql as xt,Rb as Mc,Rl as co,Sb as Vc,Sc as Sf,Si as $f,Sl as Hf,Sm as on,Tb as Hc,Tc as xf,Uc as Tf,Ui as Pe,Vb as jc,Vc as qe,Vi as me,W as Ol,Wa,Wc as we,Wd as Ff,Wi as Df,Wl as Uf,Xb as Zc,Xl as zf,Yc as wf,Yl as H,Zb as nf,Zl as U,_b as za,_c as Za,_l as Yf,a as qi,ac as sf,ad as no,am as tn,b as Xi,bc as lf,bd as Le,bm as Xf,cd as so,cm as Kf,d as Ki,dd as Lf,dj as Ja,dm as jf,ea as Rl,ed as bf,fd as io,gd as ne,ha as Ec,hb as Cc,hc as ao,hd as Ge,hn as iu,ia as _c,ic as cf,id as _t,im as Zf,jc as Ya,jd as yf,la as Sc,nc as qa,ob as Fc,pb as jr,pc as ff,pd as Of,qb as Gc,qc as uf,rb as Pc,rc as hf,rd as Rf,rn as fu,sb as Fe,sd as lo,t as ga,tb as Zr,td as St,ud as Af,un as uu,wd as Nf,xa as Oc,xd as If,xm as Qf,yl as Wf,yn as hu,za as Rc,zl as Bf}from"./trillion3d-chunk-C2QSQDHV.js";import{a as Bc}from"./trillion3d-chunk-M2F7Q77E.js";import{a as S,b as ji,d as Ar,e as W,f as Ue,n as ae}from"./trillion3d-chunk-PN2YD2PU.js";import{Ea as hc,Fa as dc,I as Ca,J as zt,O as ec,Ra as pc,Ua as mc,cc as kc,f as Ye,h as Xl,i as Ia,ic as Cf,k as Kl,m as jl,ma as cc,na as zr,oa as Yr,ob as vc,pa as fc,pb as Ic,q as Mr,qa as qr,ra as Xr,t as Zl,ua as uc,v as Ql,w as Jl}from"./trillion3d-chunk-2JCF4HLE.js";import{Ca as yi,Ea as Oi,Ka as Ri,La as he,Ma as Wi,Na as de,Sa as Bi,Ua as Mi,Wa as ma,Xa as Vi,Za as Hi,db as Ui,w as oi,wa as mi,y as ai}from"./trillion3d-chunk-XXCX4QIN.js";import{a as Ka,b as pf,c as mf}from"./trillion3d-chunk-2JM7B67K.js";import{b as Al,c as Nl}from"./trillion3d-chunk-DKF76O2Z.js";import{a as ia,p as tc}from"./trillion3d-chunk-7QYR7QUU.js";import{h as wr,i as Lr,j as Ai,k as Ni,m as Ii,r as br,s as Ci,v as Kr}from"./trillion3d-chunk-B3ECL3UB.js";import{j as Zi,k as Ir,l as Qi,m as Ji,n as el,o as va,u as tl}from"./trillion3d-chunk-URXU62XN.js";import{k as Gi,l as Pi,m as pa,n as $i,o as dt,p as Di,r as ki}from"./trillion3d-chunk-S2JLIIRM.js";import{e as yr,f as Or,g as Fi}from"./trillion3d-chunk-P4Q7TPID.js";import{A as Xt,C as Ur,E as $a,N as ic,R as lc,S as Da,o as Ga,u as _,z as Pa}from"./trillion3d-chunk-MEMYKAVP.js";import{a as Ie}from"./trillion3d-chunk-JH7I4RDZ.js";import{b as Cl,i as Yt,x as oc}from"./trillion3d-chunk-JN2SWJKC.js";import{b as fa}from"./trillion3d-chunk-25C7OMDW.js";import{a as Vr,b as rc}from"./trillion3d-chunk-QW7R4JSU.js";import{d as gc}from"./trillion3d-chunk-ABKLIRWX.js";import{B as Ma,E as of,F as Va,G as af,H as Ha,I as Ua,K as au,T as rn,a as wl,f as kr,h as yl,l as bc,o as ro,q as Qc,t as oo,u as Jc,v as ef,y as tf,z as rf}from"./trillion3d-chunk-YIE3H5JS.js";import{B as ja,g as qt,h as ac,j as Fa,l as nc,n as Hr,o as sc}from"./trillion3d-chunk-7XEWHG3S.js";import{a as da,b as ft}from"./trillion3d-chunk-5TB32DUC.js";import{e as xr,j as Jr,k as Uc,l as eo,m as zc,n as Yc,o as qc,p as Xc,v as to,w as Kc}from"./trillion3d-chunk-S4NKU3YU.js";import{a as D}from"./trillion3d-chunk-GKWIL5RN.js";import{e as Ut}from"./trillion3d-chunk-3HE5HBCK.js";import{l as ua}from"./trillion3d-chunk-5LQDA7UM.js";import{c as nu,e as Tt,g as fo}from"./trillion3d-chunk-I63LRS3P.js";import{a as xi,h as Ti,k as wi,p as Li,r as bi}from"./trillion3d-chunk-DUWMZGSW.js";import{d as fi}from"./trillion3d-chunk-G6HYU5QH.js";import{a as Il}from"./trillion3d-chunk-KUJMKMT4.js";import{a as yc}from"./trillion3d-chunk-TZ3XBBRE.js";import{d as Yi}from"./trillion3d-chunk-3BY2FPRS.js";import{b as lu}from"./trillion3d-chunk-KWS6MEDX.js";import{A as ii,B as li,D as ct,b as si,o as Re}from"./trillion3d-chunk-5GW525BI.js";import{b as Dr}from"./trillion3d-chunk-PPUZR76B.js";import{A as vi,F as Ei,H as _i,P as Si,c as di,h as pi,u as ht,v as gi,x as He}from"./trillion3d-chunk-SYQOPTR2.js";import{a as ca,b as Ee,c as lt,d as v,g as V,h as N,i as Tr,j as $}from"./trillion3d-chunk-GUUF3TMW.js";import{a as b,f as Ae,h as ut,j as ui,r as hi}from"./trillion3d-chunk-QDNYR3XW.js";import{a as Nr}from"./trillion3d-chunk-PU4JWKCC.js";import{a as Tl}from"./trillion3d-chunk-SAVFDWTS.js";import{$k as j,$n as A,$s as dl,$w as bl,An as la,Bs as cl,Bx as Ml,DB as Ba,Db as Ds,Dp as Z,Dr as ol,Dx as Vl,Ee as Ms,Es as fl,Ey as Br,Fa as Fs,Ge as na,Gt as El,Gx as Hl,H as aa,Ht,I as As,Im as ei,It as Fr,Ja as Gs,Jt as _l,Ks as ul,Kt as Sl,Kx as Wr,Lb as ks,Mf as m,Mt as xl,Nf as zs,Of as sa,Ox as gt,Pc as fe,Px as Ul,Pz as Tc,Qc as T,Sf as Ys,Vd as Bs,Vk as M,Xd as ue,Xi as Ks,Xk as Zs,Yw as Ll,Zk as Qs,Zn as ti,_f as qs,_k as Sr,_s as hl,aD as gf,ar as Ea,bD as B,bl as Te,bo as ri,cA as ka,cg as _r,co as f,ct as pl,cy as vt,dA as wc,dl as st,dt as _e,eo as ni,ey as Ra,ga as Ns,gs as al,gt as Se,gu as mt,gx as ze,gy as Aa,hi as Y,ia as Is,is as nl,it as pt,kD as uo,kt as ml,kx as Fl,lf as Vs,mA as Lc,mf as Hs,mq as Rr,mr as _a,ns as sl,nt as Ne,nw as ba,oD as cu,oa as Cs,ol as k,or as Sa,ox as Gl,pl as Vt,pr as xa,pt as gl,qh as Xs,qk as js,ql as P,qq as pe,qr as rl,qx as Pl,qy as Na,rf as Us,rq as zi,rs as il,rt as vl,rx as $l,ry as zl,tb as Ps,tl as Js,ts as Ta,tt as Cr,tx as Dl,ua as Mt,ul as Oe,ux as kl,vn as Ve,vt as wa,vw as Gr,vx as Wl,vz as xc,wb as $s,wp as ci,wt as La,xc as Ws,xn as w,xw as Pr,xx as Bl,xy as Yl,yp as ha,yw as $r,yx as ya,yy as ql,zn as it,zs as ll,zx as Oa}from"./trillion3d-chunk-O3H5RZXC.js";var lm=Object.freeze({viewProjection:new Float64Array(16),eye:new Float64Array(3),image:-1}),du=e=>({viewProjection:new Float64Array(16),eye:new Float64Array(3),image:e}),an=new WeakMap;function TS(e,t){let r=an.get(e.views.active);r||an.set(e.views.active,r={now:du(-1),before:du(-1)});let{now:o,before:a}=r;o.image!==e.run.frame&&(a.viewProjection.set(o.viewProjection),a.eye.set(o.eye),a.image=o.image,o.viewProjection.set(t.viewProjection),o.eye.set(t.eye),o.image=e.run.frame)}var wS=e=>an.get(e.views.active)?.before??lm,LS=(e,t)=>t!==-1&&e.image===t?e:void 0;var nn=2,L={params:0,color:1,depth:2,mask:3,point:4,normals:5,specular:6,waterDepth:7,tiles:8,sun:9},RS={params:0,color:1,depth:2,sampler:3,tiles:4},AS={params:0,waterDepth:1,opaqueDepth:2,sceneLinear:3},NS={params:0,waterDepth:1,opaqueDepth:2,mask:3,list:4,args:5,ids:6,dispatch:7},IS={params:0,mask:1,tiles:2},wt=8,Lt="rgba16float",Xe="rgba8uint",CS={enabled:0,disabled:1,captures:2,screenSpace:3},cm=[["inverseViewProjection","mat4x4f"],["clipW","vec4f"],["eye","vec4f"],["scene","vec4f"],["bounds","vec4f"],["modes","vec4u"],["distanceRange","vec4f"],["fresnelRange","vec4f"],["depthRange","vec4f"],["tiles","vec4u"],["filters","vec4u"]],sn=k("WaterParams",cm),jt=sn.words,FS=sn.at,GS=f("WATER_PARAMS_WGSL",[],sn.wgsl),ho="r32float",po="r8unorm",bt="rgba16float",se={vertex:1,fragment:2,compute:4},pu=se.vertex|se.fragment;var mu=e=>we(e).granted.has("reflection"),gu=e=>vf("r11g11b10",e.features);var Zt=(e,t)=>[V(no,{minBindingSize:wf},e),...t.depth==="pyramid"?Oc(Le,e):[],...t.depth==="level0"?Rc(Le,e):[],v(so,"uniform",e),...t.image?[N(Lf,"float","2d",e)]:[],...t.front?[N(bf,"unfilterable-float","2d",e)]:[],...Ui(io,e)],US=w(e=>e.createBindGroupLayout({entries:Zt(4|GPUShaderStage.FRAGMENT,{depth:"pyramid",image:!0,front:!0})})),zS=w(e=>e.createBindGroupLayout({entries:Zt(4,{depth:"pyramid",image:!1,front:!0})})),YS=w(e=>e.createBindGroupLayout({entries:Zt(4,{depth:"none",image:!1,front:!1})}));var jS=e=>f(`toonTablesBinding(${e.group}:${e.binding})`,[],`
2
- @group(${e.group}) @binding(${e.binding}) var<storage,read> toonTables:array<u32>;
3
- fn toonSize()->u32{return toonTables[1];}
4
- fn toonRowWord(row:u32,at:u32)->u32{return toonTables[${zl}u+row*toonTables[2]+at];}
5
- fn toonPatternWord(i:u32)->u32{return toonTables[toonTables[0]+i];}
6
- fn toonPeakWord(i:u32)->vec2u{return vec2u(toonTables[${Na}u+i*2u],toonTables[${Na+1}u+i*2u]);}`),vu=f("TOON_TABLES_NONE_WGSL",[],`
7
- fn toonSize()->u32{return 64u;}
8
- fn toonRowWord(row:u32,at:u32)->u32{return 0u;}
9
- fn toonPatternWord(i:u32)->u32{return 0u;}
10
- fn toonPeakWord(i:u32)->vec2u{return vec2u(0u);}`);var Eu=f("CLEAR_COAT_WGSL",[Ae,ut,Ii,Lr,br,Mi,Bi,cf,ao],`
11
- struct CoatContext{NoL:f32,NoV:f32,NoH:f32,VoL:f32,VoH:f32,invH:f32,XoV:f32,XoL:f32,XoH:f32,YoV:f32,YoL:f32,YoH:f32,}
12
- fn coatContextOf(N:vec3f,V:vec3f,L:vec3f)->CoatContext{
13
- var c:CoatContext;
14
- c.NoL=dot(N,L);c.NoV=dot(N,V);c.VoL=dot(V,L);
15
- c.invH=inverseSqrt(2.0+2.0*c.VoL);
16
- c.NoH=saturate((c.NoL+c.NoV)*c.invH);
17
- c.VoH=saturate(c.invH+c.invH*c.VoL);
18
- return c;
19
- }
20
- fn coatContextSkewed(N:vec3f,X:vec3f,Y:vec3f,V:vec3f,L:vec3f)->CoatContext{
21
- var c=coatContextOf(N,V,L);
22
- c.XoV=dot(X,V);c.XoL=dot(X,L);c.XoH=(c.XoL+c.XoV)*c.invH;
23
- c.YoV=dot(Y,V);c.YoL=dot(Y,L);c.YoH=(c.YoL+c.YoV)*c.invH;
24
- return c;
25
- }
26
-
27
-
28
- fn refractedCoat(c:CoatContext)->CoatContext{
29
- var r=c;
30
- let eta=1.0/1.5;
31
- let blend=(0.63-0.22*c.VoH)*c.VoH-0.745;
32
- let projection=blend*c.NoH;
33
- r.NoV=clamp(eta*c.NoV-projection,0.001,1.0);
34
- r.NoL=clamp(eta*c.NoL-projection,0.001,1.0);
35
- r.VoH=saturate(eta*c.VoH-blend);
36
- r.VoL=2.0*r.VoH*r.VoH-1.0;
37
- r.NoH=c.NoH;
38
- return r;
39
- }
40
-
41
-
42
-
43
- fn coatTransmittance(NoL:f32,NoV:f32)->vec3f{
44
- if(lobes.metal<=0.0){return vec3f(1.0);}
45
- let thin=1.0/NoV+1.0/NoL;
46
- let depth=lobes.extinction*max(thin-2.0,0.0);
47
- return mix(vec3f(1.0),exp(-depth),lobes.metal);
48
- }
49
- fn coatGgxSkewed(ax:f32,ay:f32,NoH:f32,XoH:f32,YoH:f32)->f32{
50
- let a2=ax*ay;
51
- let v=vec3f(ay*XoH,ax*YoH,a2*NoH);
52
- let s=dot(v,v);
53
- return (1.0/PI)*a2*(a2/s)*(a2/s);
54
- }
55
- fn coatVisSkewed(ax:f32,ay:f32,c:CoatContext)->f32{
56
- let vis_v=c.NoL*length(vec3f(ax*c.XoV,ay*c.YoV,c.NoV));
57
- let vis_l=c.NoV*length(vec3f(ax*c.XoL,ay*c.YoL,c.NoL));
58
- return 0.5/(vis_v+vis_l);
59
- }
60
-
61
-
62
-
63
-
64
- fn coatedLight(s:LobeSurface,N:vec3f,V:vec3f,L:vec3f,cosine:f32,direct:f32,sine:f32,soft:f32,lineCos:f32,rect:bool,topLtc:vec3f,bottomLtc:vec3f,micro:f32)->mat2x3f{
65
- let c=lobes.coat;
66
- let alphaCoat=lobes.coatAlpha;
67
- let Nspec=lobes.coatN;
68
- let skewed=hasSkew();
69
- let keepNewton=sphereNoNewton;
70
- var ctx=coatContextOf(Nspec,V,L);
71
-
72
- var compensation=1.0-s.alpha;
73
- compensation=select(0.0,(1.0-alphaCoat)/compensation,compensation>0.0);
74
- let topSine=saturate(sine*compensation);
75
- sphereNoNewton=clearCoatBottom;
76
- if(topSine>0.0){
77
- let m=sphereMoved(ctx.NoL,ctx.NoV,ctx.VoL,topSine);
78
- ctx.NoL=m.x;ctx.VoL=m.y;ctx.NoH=m.z;ctx.VoH=m.w;
79
- }
80
- ctx.NoV=clampNoV(ctx.NoV);
81
- if(rect){ctx.VoH=ctx.NoV;}
82
- let F=fresnelSchlick(DIELECTRIC_F0,1.0,ctx.VoH).x;
83
- var specular=vec3f(0.0);
84
- if(rect){specular=c*topLtc;}
85
- else{
86
- let wide=lobeEnergy(alphaCoat*alphaCoat,ctx.VoH,topSine,soft,lineCos);
87
- let vis=visibility(wide.x,ctx.NoV,cosine,s.accurate);
88
- let D=ggxDistribution(wide.x,ctx.NoH,max(1.0-ctx.NoH*ctx.NoH,0.0))*wide.y;
89
- specular=vec3f(c*direct*D*vis*F);
90
- }
91
- let fresnel=(1.0-F)*(1.0-F);
92
-
93
- if(clearCoatBottom){
94
- let H=normalize(V+L);
95
- ctx.NoH=saturate(dot(N,H));ctx.NoV=saturate(dot(N,V));ctx.NoL=saturate(dot(N,L));
96
- ctx.VoL=saturate(dot(V,L));ctx.VoH=saturate(dot(V,H));
97
- if(!skewed&&sine>0.0){
98
- sphereNoNewton=false;
99
- let m=sphereMoved(ctx.NoL,ctx.NoV,ctx.VoL,sine);
100
- ctx.NoL=m.x;ctx.VoL=m.y;ctx.NoH=m.z;ctx.VoH=m.w;
101
- }
102
- ctx.NoV=clampNoV(ctx.NoV);
103
- }
104
- sphereNoNewton=keepNewton;
105
- if(skewed){ctx=coatContextSkewed(Nspec,lobes.T,lobes.B,V,L);}
106
- var bottom=refractedCoat(ctx);
107
- if(rect){bottom.VoH=bottom.NoV;}
108
- let transmission=coatTransmittance(bottom.NoL,bottom.NoV);
109
- let plainDiffuse=direct*lobeDiffuse(s,cosine,dot(V,L),micro);
110
- let diffuse=mix(plainDiffuse,fresnel*transmission*plainDiffuse,c);
111
- if(!skewed&&rect){
112
- specular+=mix(bottomLtc,fresnel*transmission*bottomLtc,c);
113
- }else{
114
- var energy=1.0;
115
- var D2=0.0;
116
- var vis2=0.0;
117
- if(skewed){
118
- D2=coatGgxSkewed(lobes.at,lobes.ab,ctx.NoH,ctx.XoH,ctx.YoH);
119
- vis2=coatVisSkewed(lobes.at,lobes.ab,bottom);
120
- }else{
121
- let wide=lobeEnergy(s.alpha2,ctx.VoH,sine,soft,lineCos);
122
- energy=wide.y;
123
- vis2=visibility(wide.x,bottom.NoV,cosine,s.accurate);
124
- D2=ggxDistribution(wide.x,bottom.NoH,max(1.0-bottom.NoH*bottom.NoH,0.0));
125
- }
126
- let fBottom=fresnelSchlick(s.f0,s.f90,bottom.VoH);
127
- let fPlain=fresnelSchlick(s.f0,s.f90,ctx.VoH);
128
- specular+=(energy*direct*D2*vis2)*mix(fPlain,fresnel*transmission*fBottom,c);
129
- }
130
- return mat2x3f(diffuse,specular);
131
- }
132
-
133
- fn coatedPoint(s:LobeSurface,N:vec3f,V:vec3f,L:vec3f,energy:f32)->mat2x3f{
134
- let cosine=max(dot(N,L),0.0);
135
- return coatedLight(s,N,V,L,cosine,energy*cosine,0.0,0.0,1.0,false,vec3f(0.0),vec3f(0.0),1.0);
136
- }
137
-
138
- fn coatedLamp(s:LobeSurface,N:vec3f,V:vec3f,look:Look,lamp:Lamp,energy:f32)->mat2x3f{
139
- return coatedLight(s,N,V,look.toward,lamp.cosine,energy*lamp.cosine,saturate(look.reach*(1.0-s.alpha)),saturate(look.soft),lamp.lineCos,false,vec3f(0.0),vec3f(0.0),look.micro);
140
- }
141
-
142
-
143
-
144
- struct CoatRemap{diffuse:vec3f,specular:vec3f,}
145
- fn coatRemap(rgb:vec3f,metal:f32)->CoatRemap{
146
- let c=lobes.coat;
147
- let NoV=lobes.coatNoV;
148
- let refraction=((NoV*0.5+0.5)*NoV-1.0)*saturate(1.25-1.25*lobes.baseRough)+1.0;
149
- let metalSpec=0.9;
150
- let absorptionColour=rgb*(1.0/metalSpec);
151
- let absorption=absorptionColour*((NoV-1.0)*0.85*(1.0-mix(absorptionColour,absorptionColour*absorptionColour,vec3f(-0.78)))+1.0);
152
- let F=fresnelSchlick(DIELECTRIC_F0,1.0,NoV).x;
153
- let attenuation=mix(1.0,1.0-F,c);
154
- let base=mix(rgb*attenuation,metalSpec*absorption*refraction,metal*c);
155
- let specular=mix(surfaceSpecular,refraction,c);
156
- return CoatRemap(base-base*metal,mix(vec3f(0.08*specular),base,metal));
157
- }`);var _u=f("ENERGY_TERMS_WGSL",[df("shadingEnergyTexel","shadingEnergyPair","energy",ga,ga)],`
158
- fn energyTerms(f0:vec3f,f90:f32,rough:f32,NdotV:f32)->vec3f{
159
- let e=shadingEnergyPair(rough,NdotV);
160
- let restored=vec3f(1.0)+f0*((1.0-e.x)/e.x);
161
- return restored*(f0*e.x+(vec3f(f90)-f0)*e.y);
162
- }`);var Qt=f("LOBES_LIGHTING_WGSL",[Ae,ut,Lr,Ni,Ci,br,_u,de,ma,Ya,ff,hf,Ai,Xa,Eu],`
163
- struct Lobes{cloth:f32,fuzz:vec3f,sheen:SheenView,on:bool,skewed:bool,T:vec3f,B:vec3f,coat:f32,coatRough:f32,coatN:vec3f,coatAlpha:f32,coatNoV:f32,baseColour:vec3f,extinction:vec3f,metal:f32,baseRough:f32,at:f32,ab:f32,invAt:f32,invAb:f32,dScale:f32,view:vec2f,viewLength:f32,}
164
- var<private> lobes:Lobes;
165
- fn hasCloth()->bool{return lobes.on&&lobes.cloth>0.0;}
166
- fn hasSkew()->bool{return lobes.on&&lobes.skewed;}
167
-
168
-
169
- fn skewedDistribution(N:vec3f,H:vec3f,alpha:f32)->f32{
170
- let s=skewedAnisotropy();
171
- let at=max(alpha*(1.0+s),0.001);let ab=max(alpha*(1.0-s),0.001);
172
- let h=vec3f(dot(lobes.T,H)/at,dot(lobes.B,H)/ab,max(dot(N,H),0.0));
173
- let q=dot(h,h);
174
- return 1.0/(PI*at*ab*q*q);
175
- }
176
- fn skewedAnisotropy()->f32{return (lobes.at-lobes.ab)/(lobes.at+lobes.ab);}
177
- fn hasCoat()->bool{return lobes.on&&lobes.coat>0.0;}
178
-
179
-
180
-
181
- fn setLobes(axis:vec4f,coat:f32,coatRough:f32,coatN:vec3f,N:vec3f,V:vec3f,alpha:f32){
182
- lobes.on=true;
183
- lobes.cloth=0.0;lobes.fuzz=vec3f(0.0);
184
- lobes.skewed=any(axis.xyz!=vec3f(0.0));
185
- lobes.T=axis.xyz;
186
- lobes.B=cross(N,lobes.T);
187
- lobes.coat=coat;lobes.coatRough=coatRough;lobes.coatN=coatN;
188
- let coatFloor=lobeRoughness(coatRough);lobes.coatAlpha=coatFloor*coatFloor;
189
- lobes.at=axis.w;lobes.ab=alpha;
190
- lobes.invAt=1.0/lobes.at;lobes.invAb=1.0/lobes.ab;lobes.dScale=1.0/(PI*lobes.at*lobes.ab);
191
- lobes.view=vec2f(lobes.at*dot(lobes.T,V),lobes.ab*dot(lobes.B,V));
192
- lobes.coatNoV=saturate(dot(coatN,V));
193
- }
194
-
195
-
196
- fn setLobeBase(rgb:vec3f,metal:f32,rough:f32){
197
- lobes.baseColour=rgb;lobes.metal=metal;lobes.baseRough=rough;
198
- // A metal's absorption along the coat's path (\`coatTransmittance\`), taken here once, not once a light.
199
- if(metal>0.0){lobes.extinction=-log(max(rgb*INVERSE_PI,vec3f(0.0001)))/2.0;}
200
- }
201
-
202
-
203
-
204
- fn setCloth(fuzz:vec3f,cloth:f32,N:vec3f,V:vec3f,rough:f32){
205
- lobes.fuzz=fuzz;lobes.cloth=cloth;roughDiffuse=false;
206
- lobes.sheen=clothSheen(N,V,rough);
207
- }
208
-
209
-
210
-
211
- fn setClothLobes(fuzz:vec3f,cloth:f32,alpha:f32,N:vec3f,V:vec3f,rough:f32){
212
- lobes.on=true;
213
- lobes.cloth=cloth;lobes.fuzz=fuzz;roughDiffuse=false;
214
- lobes.sheen=clothSheen(N,V,rough);
215
- lobes.skewed=false;lobes.T=vec3f(0.0);lobes.at=alpha;
216
- lobes.coat=0.0;
217
- }
218
-
219
-
220
- fn clothMix(lit:vec3f,fuzz:vec3f)->vec3f{return lit*sheenKeep(lobes.sheen,lobes.cloth)+fuzz;}
221
-
222
-
223
-
224
- fn clothSurface(s:LobeSurface)->LobeSurface{
225
- if(!hasCloth()){return s;}
226
- var c=s;
227
- c.f0=s.f0*(1.0-lobes.cloth);
228
- c.f90=slabF90(c.f0);
229
- return c;
230
- }
231
-
232
- fn indirectKeep()->f32{
233
- if(!hasCloth()){return 1.0;}
234
- return sheenKeep(lobes.sheen,lobes.cloth);
235
- }
236
-
237
-
238
- fn clothDiffuse(rgb:vec3f,metal:f32)->vec4f{
239
- if(hasCloth()){return vec4f(rgb*(1.0-metal)*indirectKeep()+lobes.fuzz*(lobes.cloth*lobes.sheen.albedo),0.0);}
240
- if(hasCoat()){return vec4f(coatRemap(rgb,metal).diffuse,0.0);}
241
- return modelDiffuse(vec4f(rgb,metal));
242
- }
243
-
244
-
245
- fn indirectF0(rgb:vec3f,metal:f32)->vec3f{
246
- if(hasCoat()){return coatRemap(rgb,metal).specular;}
247
- return surfaceF0(rgb,metal);
248
- }
249
- /** What the coat lets through of the base's reflections: one minus the coat's weight times the energy of its own
250
- * dielectric lobe at its roughness and N\xB7V (the energy terms every reflection weighs the coat by), one without a coat. */
251
- fn coatLayerKeep()->f32{
252
- if(!hasCoat()){return 1.0;}
253
- return 1.0-lobes.coat*energyTerms(DIELECTRIC_F0,envBrdfF90(DIELECTRIC_F0),lobeRoughness(lobes.coatRough),clampNoV(lobes.coatNoV)).x;
254
- }
255
- /** The view's length in the stretched frame, finished once a pixel on its surface's N\xB7V
256
- * (\`lobeSurface\`), which the light loop hands it (\`sliceLighting\`): one N\xB7V a pixel. */
257
- fn lobeView(s:LobeSurface){if(lobes.on){lobes.viewLength=length(vec3f(lobes.view,s.NdotV));}}
258
-
259
-
260
- fn anisotropicLobe(s:LobeSurface,N:vec3f,V:vec3f,L:vec3f,H:vec3f,NdotL:f32,energy:f32)->vec3f{
261
- let direct=energy*NdotL;
262
- let T=lobes.T;let B=lobes.B;let at=lobes.at;let ab=lobes.ab;
263
- let h=vec3f(dot(T,H)*lobes.invAt,dot(B,H)*lobes.invAb,max(dot(N,H),0.0));
264
- let q=dot(h,h);
265
- let D=lobes.dScale/(q*q);
266
- let gV=NdotL*lobes.viewLength;
267
- let gL=s.NdotV*length(vec3f(at*dot(T,L),ab*dot(B,L),NdotL));
268
- let VdotH=max(dot(V,H),0.0);
269
- return lobeSum(s,lobeDiffuseH(s,NdotL,VdotH,1.0),D,gV,gL,VdotH,direct);
270
- }
271
-
272
-
273
-
274
-
275
- fn baseLobe(s:LobeSurface,N:vec3f,V:vec3f,L:vec3f,H:vec3f,NdotL:f32,energy:f32)->vec3f{
276
- if(hasSkew()){return anisotropicLobe(s,N,V,L,H,NdotL,energy);}
277
- let lit=standardLobe(s,N,V,H,NdotL,energy);
278
- if(hasCloth()){return clothMix(lit,sheenFuzz(lobes.sheen,N,L,lobes.fuzz,lobes.cloth,energy));}
279
- return lit;
280
- }
281
- /** The same hook for a lamp of size (\`lampLight\`, \`lampLobeWgsl.ts\`): the base lobe \u2014 a skewed one
282
- * keeps its anisotropic distribution at the lamp's cosine and its highlight's direction, none of
283
- * the sphere's widening. */
284
- fn baseLampLobe(s:LobeSurface,N:vec3f,V:vec3f,look:Look,lamp:Lamp,energy:f32)->vec3f{
285
- if(lamp.cosine<=0.0){return vec3f(0.0);}
286
- if(hasSkew()){return anisotropicLobe(s,N,V,look.toward,normalize(look.toward+V),lamp.cosine,energy);}
287
- let h=lampHalf(s,N,V,look);
288
- let lit=lampLobeWith(h,s,V,look,lamp.cosine,lamp.lineCos,energy);
289
- if(hasCloth()){return clothMix(lit,sheenFuzz(lobes.sheen,N,lamp.toward,lobes.fuzz,lobes.cloth,energy));}
290
- return lit;
291
- }`),Tx=f("LOBES_RECT_WGSL",[Qt,qa,uf],`
292
- fn rectBase(r:RectView,N:vec3f,V:vec3f,f0:vec3f,rough:f32)->vec3f{
293
- if(!hasSkew()){return rectLtc(r,pixelRectFrame(N,V,rough),f0);}
294
- let T=lobes.T;let k=lobes.ab/lobes.at-1.0;
295
- let s=RectView(r.a+k*T*dot(T,r.a),r.b+k*T*dot(T,r.b),r.c+k*T*dot(T,r.c),r.d+k*T*dot(T,r.d),r.window,r.slot);
296
- return rectLtc(s,pixelRectFrame(N,normalize(V+k*T*dot(T,V)),rough),f0);
297
- }
298
- var<private> coatFrameHeld:bool=false;
299
- var<private> coatFrameKept:RectFrame;
300
- fn coatRectFrame(V:vec3f)->RectFrame{
301
- if(!coatFrameHeld){coatFrameKept=rectFrameOf(lobes.coatN,V,lobes.coatRough);coatFrameHeld=true;}
302
- return coatFrameKept;
303
- }
304
-
305
-
306
-
307
- fn rectCloth(parts:mat2x3f,r:RectView,N:vec3f,intensity:f32,picture:vec3f)->mat2x3f{
308
- if(!hasCloth()){return parts;}
309
- let keep=sheenKeep(lobes.sheen,lobes.cloth);
310
- let fuzz=lobes.fuzz*(lobes.cloth*intensity*r.window*sheenRect(lobes.sheen,N,r))*picture;
311
- return mat2x3f(parts[0]*keep,parts[1]*keep+fuzz);
312
- }
313
-
314
-
315
-
316
- fn coatedRect(light:DirectLight,r:RectView,incident:vec4f,s:LobeSurface,N:vec3f,V:vec3f,rough:f32)->mat2x3f{
317
- let intensity=lightStrength(light);
318
- let form=rectFormOf(r)*r.window;
319
- let cosine=select(0.0,incident.w/form,form>0.0);
320
- let topLtc=rectLtc(r,coatRectFrame(V),DIELECTRIC_F0)*(intensity*r.window);
321
- let bottomLtc=rectBase(r,N,V,s.f0,rough)*(intensity*r.window);
322
- return coatedLight(s,N,V,incident.xyz,cosine,intensity*incident.w,0.0,0.0,1.0,true,topLtc,bottomLtc,0.0);
323
- }`),Su=f("LOBELESS_HOOKS_WGSL",[ma,Ya],`fn hasCoat()->bool{return false;}
324
- fn hasSkew()->bool{return false;}
325
- fn skewedDistribution(N:vec3f,H:vec3f,alpha:f32)->f32{return 0.0;}
326
- fn skewedAnisotropy()->f32{return 0.0;}
327
- fn coatedPoint(s:LobeSurface,N:vec3f,V:vec3f,L:vec3f,energy:f32)->mat2x3f{return mat2x3f();}
328
- fn coatedLamp(s:LobeSurface,N:vec3f,V:vec3f,look:Look,lamp:Lamp,energy:f32)->mat2x3f{return mat2x3f();}
329
- fn coatLayerKeep()->f32{return 1.0;}
330
- fn indirectF0(rgb:vec3f,metal:f32)->vec3f{return surfaceF0(rgb,metal);}
331
- fn lobeView(s:LobeSurface){}
332
- fn clothSurface(s:LobeSurface)->LobeSurface{return s;}
333
- fn indirectKeep()->f32{return 1.0;}
334
- fn baseLobe(s:LobeSurface,N:vec3f,V:vec3f,L:vec3f,H:vec3f,NdotL:f32,energy:f32)->vec3f{return standardLobe(s,N,V,H,NdotL,energy);}
335
- fn baseLampLobe(s:LobeSurface,N:vec3f,V:vec3f,look:Look,lamp:Lamp,energy:f32)->vec3f{
336
- if(lamp.cosine<=0.0){return vec3f(0.0);}
337
- return lampLobe(s,N,V,look,lamp.cosine,lamp.lineCos,energy);
338
- }`),wx=f("LOBELESS_LIGHTING_WGSL",[Su],"fn clothDiffuse(rgb:vec3f,metal:f32)->vec4f{return vec4f(rgb,metal);}"),Lx=f("LOBELESS_MODELS_LIGHTING_WGSL",[Su,Xa],"fn clothDiffuse(rgb:vec3f,metal:f32)->vec4f{return modelDiffuse(vec4f(rgb,metal));}"),bx=f("LOBELESS_RECT_WGSL",[qa],`fn rectBase(r:RectView,N:vec3f,V:vec3f,f0:vec3f,rough:f32)->vec3f{return rectLtc(r,pixelRectFrame(N,V,rough),f0);}
339
- fn rectCloth(parts:mat2x3f,r:RectView,N:vec3f,intensity:f32,picture:vec3f)->mat2x3f{return parts;}
340
- fn coatedRect(light:DirectLight,r:RectView,incident:vec4f,s:LobeSurface,N:vec3f,V:vec3f,rough:f32)->mat2x3f{return mat2x3f();}`),Jt=f("LOBES_DECODE_WGSL",[ki,de],`
341
- fn lobesAt(w:vec4u,side:f32,N:vec3f,V:vec3f,rough:f32){
342
- let alpha=lobeAlpha(rough);
343
- if(lobeIsCloth(w)){
344
- setClothLobes(packedFuzz(w),packedCloth(w),alpha,N,V,rough);
345
- return;
346
- }
347
- let coat=packedCoat(w);
348
- setLobes(packedLobeAxis(w,N,alpha),coat.x,coat.y,lobeOctDecode(w.y)*side,N,V,packedLobeAcross(w,alpha));
349
- }`),yx=f("LOBES_TARGET_WGSL",[Jt],`
350
- ${dt.wgsl}
351
- fn readLobes(coord:vec2i,N:vec3f,V:vec3f,rough:f32){lobesAt(textureLoad(physicalLobes,coord),1.0,N,V,rough);}`),Ox=e=>`if((surfaceFlag&${e}u)!=0u){readLobes(coord,N,V,normal.a);setLobeBase(base.rgb,base.a,normal.a);}`;var xu="rgba32float",Tu=4,fn=128,cn=1024,fm=0,Gx=e=>[cn,Math.max(1,m(m(e,Tu),cn)),1],Px=e=>Zs({size:e,format:xu}),wu=(e,t=!1)=>t?$(e,xu,"write-only","2d-array"):N(e,"unfilterable-float","2d-array"),Lu=f("TABLE_AT_WGSL",[],`${D({TABLE_WIDTH:cn,TABLE_LAYER:fm,TABLE_LANES:Tu})}
352
- fn tableLanes(entry:u32)->vec4f{
353
- let texel=entry/TABLE_LANES;
354
- return textureLoad(cellTable,vec2u(texel%TABLE_WIDTH,texel/TABLE_WIDTH),TABLE_LAYER,0);
355
- }
356
- fn tableEntry(entry:u32)->u32{return u32(tableLanes(entry)[entry%TABLE_LANES]);}`);var er=k("BounceLevel",[["base","vec3f"],["spacing","f32"]]),mo=k("BounceGrid",[["reach","vec4f"],["counts","vec4u"],["frame","vec4u"],["eye","vec4f"],["forward","vec4f"],["levels",Js(er,_r)]]),um=mo.words*4,q=mo.at,bu=er.at;function hm(e,t){for(let r=0;r<t.levels.length;r++){let{base:o,spacing:a}=t.levels[r],n=q.levels+r*er.words;for(let s=0;s<3;s++)e[n+bu.base+s]=o[s];e[n+bu.spacing]=a}}function Mx(e,t){let r=new ArrayBuffer(um),o=new Float32Array(r),a=new Uint32Array(r),n=e.createBuffer({label:"Trillion3D bounce cascades v1",size:r.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});o[q.reach]=zi,o[q.reach+1]=pe.radianceProbeMinTraceScale,o[q.reach+2]=o[q.reach+3]=1,a.set([t.size,t.levels.length,t.cells,t.probes],q.counts);let s=()=>e.queue.writeBuffer(n,0,r),i=()=>hm(o,t);return i(),s(),{buffer:n,write(l,c,u,h,d,g,R){o[q.reach]=h,o[q.reach+1]=d,o[q.reach+2]=g,o[q.reach+3]=1/g,a[q.frame]=c,a[q.frame+1]=0,a[q.frame+2]=l;for(let E=0;E<3;E++)o[q.eye+E]=u[E];for(let E=0;E<3;E++)o[q.forward+E]=R?.[E]??0;o[q.forward+3]=R?1:0,i(),s()},dispose(){n.destroy()}}}var jx=.99,yu=f("BOUNCE_GRID_STRUCTS_WGSL",[],`${er.wgsl}
357
- ${mo.wgsl}
358
- ${D({CASCADE_LEVELS:_r})}`),dm=f("BOUNCE_CELLS_WGSL",[yu],`/** World position of the probe of a cell: the global lattice, independent of the camera and of the level, the probe of cell n at n \xB7 spacing. */
359
- fn probePosition(cell:vec3i,spacing:f32)->vec3f{return vec3f(cell)*spacing;}
360
- /** Where \`P\` lies in the cells of a level, counted from its corner (the world point half a cell before the level's lowest probe): the cell k of the
361
- * level holds its probe at k + \xBD. The one place a position becomes a coordinate among a level's probes. */
362
- fn probeCoordFloat(level:u32,P:vec3f)->vec3f{
363
- let spacing=bounce.levels[level].spacing;
364
- let corner=(bounce.levels[level].base-vec3f(0.5))*spacing;
365
- return (P-corner)/spacing;
366
- }
367
-
368
-
369
- fn probeCornerFloat(level:u32,P:vec3f)->vec3f{return probeCoordFloat(level,P)-vec3f(0.5);}
370
-
371
- fn probeBottomCell(level:u32,P:vec3f)->vec3i{
372
- return vec3i(bounce.levels[level].base)+vec3i(floor(probeCornerFloat(level,P)));
373
- }
374
-
375
- fn probeFraction(level:u32,P:vec3f)->vec3f{return fract(probeCornerFloat(level,P));}
376
-
377
-
378
- fn levelEdgeFadeOver(level:u32,P:vec3f,invFade:f32)->f32{
379
- let among=probeCornerFloat(level,P);
380
- let inside=saturate(min(among,vec3f(f32(bounce.counts.x)-1.0)-among)*invFade);
381
- return min(inside.x,min(inside.y,inside.z));
382
- }
383
- const LEVEL_INV_FADE:f32=${b(pe.radianceInvLevelFadeSize)};
384
-
385
- fn levelEdgeFade(level:u32,P:vec3f)->f32{return levelEdgeFadeOver(level,P,LEVEL_INV_FADE);}
386
-
387
- fn probeWrap(cell:vec3i)->vec3u{
388
- let side=i32(bounce.counts.x);
389
- return vec3u(((cell%side)+side)%side);
390
- }
391
-
392
- fn levelHolds(level:u32,cell:vec3i)->bool{
393
- let inside=cell-vec3i(bounce.levels[level].base);
394
- return all(inside>=vec3i(0))&&all(inside<vec3i(i32(bounce.counts.x)));
395
- }
396
-
397
-
398
- fn cameraDistanceSq(toCamera:vec3f)->f32{
399
- if(bounce.forward.w==0.0){return dot(toCamera,toCamera);}
400
- let span=sqrt(dot(toCamera,toCamera));
401
- let reduced=span*(span/dot(toCamera,bounce.forward.xyz));
402
- return reduced*reduced;
403
- }
404
-
405
- fn cellEntry(level:u32,wrapped:vec3u)->u32{
406
- let side=bounce.counts.x;
407
- return ((level*side+wrapped.z)*side+wrapped.y)*side+wrapped.x;
408
- }
409
- /**
410
- * Where a level reads a surface at \`P\`, the point itself, never pushed off its surface: the first of the eight probes around it (\`corner\`)
411
- * and its share of the answer (\`fade\`, \`levelEdgeFade\`, over the fade a caller names where it has one of its own: \`bounceReadOver\`) \u2014 a partial answer would make a seam. The one rule by which a surface point marks the cells that hold its light (\`poolMarkWgsl.ts\`).
412
- */
413
- struct BounceRead{corner:vec3i,fade:f32,}
414
- fn bounceReadOver(level:u32,P:vec3f,invFade:f32)->BounceRead{return BounceRead(probeBottomCell(level,P),levelEdgeFadeOver(level,P,invFade));}
415
- fn bounceRead(level:u32,P:vec3f)->BounceRead{return bounceReadOver(level,P,LEVEL_INV_FADE);}`),un=f("BOUNCE_GRID_HEAD_WGSL",[Lu,yu,dm],""),Ou=(e,t,r)=>f(`bounceBindingsWgsl(${e}, ${t}, ${r})`,[un],`@group(${e}) @binding(${t}) var<uniform> bounce:BounceGrid;
416
- @group(${e}) @binding(${r}) var cellTable:texture_2d_array<f32>;`);var tT=f("REFLECTION_LOBE_WGSL",[],`struct ReflectionLobe{R:vec3f,rough:f32,}
417
- fn reflectionLobeOf(R:vec3f,alpha:f32)->ReflectionLobe{
418
- return ReflectionLobe(R,sqrt(alpha));
419
- }`),go=f("REFLECTION_CLAMP_WGSL",[Za],`fn reflectionClampRay(c:vec3f)->vec3f{
420
- let most=max(c.x,max(c.y,c.z));
421
- return select(c,c*(reflectionView.light.x/most),most>reflectionView.light.x);
422
- }`),hn=f("REFLECTION_ENVIRONMENT_WGSL",[lo],`fn reflectionEnvironment(R:vec3f,rough:f32)->vec3f{
423
- return skyRadianceAt(R,rough);
424
- }`),rT=f("REFLECTION_MISS_WGSL",[hn,Za],`fn reflectionMiss(R:vec3f,rough:f32)->vec3f{
425
- return select(reflectionView.background.rgb,reflectionEnvironment(R,rough),skyLit());
426
- }`),oT=ri("RadianceAnswer",[],"struct RadianceAnswer{color:vec3f,hit:bool,distance:f32,}"),aT=f("REFLECTION_MET_SHARE_WGSL",[],`var<private> reflectionMetShare:f32=0.0;
427
- var<private> reflectionMetLight:vec3f=vec3f(0.0);
428
- var<private> reflectionMetAt:f32=0.0;`);var dn=.17,pm={rgba8unorm:[8,8,8],bgra8unorm:[8,8,8],rg8unorm:[8,8,8],rgb10a2unorm:[10,10,10],rgba16float:[10,10,10],rg11b10ufloat:[6,6,5]},vo=e=>pm[e]??[23,23,23],hT=e=>.5**ha(vo(e)),mm=e=>`vec3f(${vo(e).map(t=>b(.5**t)).join(",")})`,gm=e=>`vec3u(${vo(e).map(t=>`0x${(4294967295<<23-t>>>0).toString(16)}u`).join(",")})`,dT=e=>e.endsWith("unorm"),pT=e=>1/(2**ha(vo(e))-1),pn=2,mT=pn+1,gT=e=>f(`sceneColorWgsl(${e})`,[qi,Xi,Ki],`
429
- fn packHalf(f:f32)->u32{return packSmallFloatDown(abs(f),10u)|select(0u,0x8000u,f<0.0);}
430
- fn packSceneColor(c:vec4f)->array<u32,${pn}>{${e==="rg11b10ufloat"?`
431
- let held=unpackLight(packSmallFloatDown(c.r,6u)|(packSmallFloatDown(c.g,6u)<<11u)|(packSmallFloatDown(c.b,5u)<<22u));
432
- return array<u32,2>(pack2x16float(held.rg),pack2x16float(vec2f(held.b,1.0)));`:`
433
- return array<u32,2>(packHalf(c.r)|(packHalf(c.g)<<16u),packHalf(c.b)|(packHalf(c.a)<<16u));`}
434
- }
435
- fn unpackSceneColor(w:array<u32,${pn}>)->vec4f{
436
- return vec4f(unpack2x16float(w[0]),unpack2x16float(w[1]));
437
- }`),vT=Mt*.25,ET=65024,_T=.5/1024,vm=3,Ru=f("F16_WGSL",[],"enable f16;"),Em={F:"f32",V2:"vec2f",V3:"vec3f",V4:"vec4f",S:"",tiny:1e-30,enable:[]},Au={F:"f16",V2:"vec2h",V3:"vec3h",V4:"vec4h",S:"H",tiny:2**-24,enable:[Ru]},Nu=({F:e,V3:t,S:r,tiny:o})=>`
438
- fn addPerception${r}(c:${t},offset:${e})->${t}{return c/(c+offset);}
439
- fn removePerception${r}(c:${t},offset:${e})->${t}{return c*min(${t}(offset)/max(${t}(1.0)-c,${t}(${b(o)})),${t}(${b(Mt)}));}
440
- fn linearToPerceptual${r}(c:${t})->${t}{return addPerception${r}(c,${b(dn)});}
441
- fn perceptualToLinear${r}(g:${t})->${t}{return removePerception${r}(g,${b(dn)});}
442
- fn exposedShadingBy${r}(g:${t},ratio:${e})->${t}{return max(linearToPerceptual${r}(perceptualToLinear${r}(g)*ratio),${t}(0.0));}
443
- fn measureOf${r}(x:${e})->${e}{let g=x/(x+${b(dn)});return g*g;}
444
- fn linearToMeasure${r}(c:${t})->${t}{return ${t}(measureOf${r}(c.r),measureOf${r}(c.g),measureOf${r}(c.b));}
445
- fn measureLuma${r}(c:${t})->${e}{return dot(linearToMeasure${r}(c),${t}(${b(1/vm)}));}
446
- fn luma4${r}(c:${t})->${e}{return c.g*2.0+c.r+c.b;}
447
- fn toneWeightOfLuma4${r}(l:${e})->${e}{return max(0.0001,1.0/(l+4.0));}
448
- fn toneWeight${r}(c:${t})->${e}{return toneWeightOfLuma4${r}(luma4${r}(c));}${r?`
449
- fn safeRcpH(x:${e})->${e}{return select(0.0,1.0/x,x>0.0);}`:""}`,_m=f("COLOR_SPACES_WGSL",[],Nu(Em)),Sm=f("COLOR_SPACES_HALF_WGSL",[Ru],Nu(Au)),ST=e=>e===Au?Sm:_m,mn=f("DITHER_WGSL",[He,ht],`
450
- fn frameRandom(p:vec2i,slot:u32)->vec2f{return vec2f(rand3dPcg16(vec3i(p,i32(slot))).xy)*(1.0/65536.0);}
451
- fn ditherUnorm(c:vec3f,e:f32,step:f32)->vec3f{return c+vec3f(step)*(e-0.5);}
452
- fn ditherFloat(c:vec3f,e:f32,error:vec3f)->vec3f{
453
- let size=bitcast<vec3f>(bitcast<vec3u>(c*error)&vec3u(0xff800000u));
454
- return c+size*e;
455
- }`),xT=f("DITHER_INTO_FLOAT_WGSL",[mn],"fn cutToFloat(c:vec3f,mask:vec3u)->vec3f{return bitcast<vec3f>(bitcast<vec3u>(c)&mask);}"),TT=(e,t,r)=>`cutToFloat(ditherFloat(${e},${t},${mm(r)}),${gm(r)})`;var Iu=f("CACHE_WORDS_WGSL",[un,yr,Or,mn],`${D({POOL_ROW_SHIFT:Math.log2(fn),POOL_ROW_MASK:fn-1})}
456
- const CACHE_MAX_HIT:f32=${b(pe.probeCacheMaxHitDistance)};
457
- const CACHE_SQRT3:f32=1.7320508;
458
- fn cacheDepthWord(distance:f32,hit:bool,sky:f32,front:bool,twoSided:bool)->u32{
459
- let ended=(pack2x16float(vec2f(clamp(distance,0.0,CACHE_MAX_HIT),0.0))&0x7ffeu)|select(0u,0x8000u,front)|select(0u,1u,twoSided);
460
- return select(0xffffu,ended,hit)|(u32(round(saturate(sky)*255.0))<<16u);
461
- }
462
- fn cacheHitIs(word:u32)->bool{return (word&0xffffu)!=0xffffu;}
463
-
464
- fn cacheFrontIs(word:u32)->bool{return (word&0x8000u)!=0u;}
465
-
466
- fn cacheTwoSidedIs(word:u32)->bool{return (word&1u)!=0u;}
467
- fn cacheDepthOf(word:u32)->f32{
468
- return select(CACHE_MAX_HIT,unpack2x16float(word&0x7ffeu).x,cacheHitIs(word));
469
- }
470
- fn cacheSkyOf(word:u32)->f32{return f32((word>>16u)&0xffu)/255.0;}
471
-
472
- fn cacheDither(at:vec2u)->f32{return frameRandom(vec2i(at),bounce.frame.x%8u).x;}
473
-
474
- fn cacheTileOf(slot:u32,resolution:u32)->vec2u{
475
- return vec2u(slot&POOL_ROW_MASK,slot>>POOL_ROW_SHIFT)*resolution;
476
- }
477
-
478
- fn cacheTempTileOf(rank:u32,resolution:u32,row:u32)->vec2u{
479
- return vec2u(rank%row,rank/row)*resolution;
480
- }
481
- /** Where the noise of the rays of the probe of \`cell\` at \`level\` starts: a hash of the cell and the level, never of its slot \u2014 the
482
- * slots are given in the order the threads reached the stack, which differs from run to run \u2014, so a scene casts the same rays every run. */
483
- fn cacheNoiseOrigin(cell:vec3i,level:u32)->vec2u{
484
- var h=(bitcast<u32>(cell.x)*0x9e3779b1u)^(bitcast<u32>(cell.y)*0x85ebca6bu)^(bitcast<u32>(cell.z)*0xc2b2ae35u)^(level*0x27d4eb2fu);
485
- h=(h^(h>>15u))*0x2c1b3c6du;
486
- h=(h^(h>>12u))*0x297a2d39u;
487
- h^=h>>15u;
488
- return vec2u(h&0xffffu,h>>16u);
489
- }
490
-
491
- fn cacheMinTrace(level:u32)->f32{
492
- return bounce.levels[level].spacing*CACHE_SQRT3*bounce.reach.y;
493
- }
494
- struct CacheCoverage{level:u32,valid:bool,minTrace:f32,}
495
-
496
- fn cacheCoverageOf(level:u32)->CacheCoverage{
497
- return CacheCoverage(level,true,cacheMinTrace(level)+bounce.levels[level].spacing*CACHE_SQRT3);
498
- }
499
-
500
-
501
-
502
-
503
- fn cacheCoverage(P:vec3f,random:f32)->CacheCoverage{
504
- if(bounce.counts.w==0u){return CacheCoverage(0u,false,0.0);}
505
- for(var level=0u;level<CASCADE_LEVELS;level++){
506
- if(level>=bounce.counts.y){break;}
507
- if(levelEdgeFade(level,P)>random){return cacheCoverageOf(level);}
508
- }
509
- return CacheCoverage(0u,false,0.0);
510
- }
511
-
512
-
513
- fn cacheCoverageBiased(P:vec3f,bias:u32,random:f32)->CacheCoverage{
514
- let base=cacheCoverage(P,random);
515
- if(!base.valid||bias==0u){return base;}
516
- let level=min(base.level+bias,bounce.counts.y-1u);
517
- return cacheCoverageOf(level);
518
- }
519
-
520
- fn cacheSlotOf(level:u32,cell:vec3i)->u32{return tableEntry(cellEntry(level,probeWrap(cell)));}
521
- /** THE WAY A RAY READS A PROBE OF THE CACHE (\`cacheProbeWay\`): the ray from \`P\` along \`d\` read on the probe at \`place\` along the way from the
522
- * probe to where the ray leaves the sphere of \`radius\` round it (the far root; the ray's own way where it misses it) \u2014 the parallax
523
- * correction. A radiance is the same all along a ray: the map's light along that way is the ray's, as it is, no factor of solid angle
524
- * (#1598). Every read of the cache by a ray takes it: the view probes' (\`spCacheProbe\`) and the scene's debug view's (\`sceneProbe\`). */
525
- fn cacheProbeWay(P:vec3f,place:vec3f,d:vec3f,radius:f32)->vec3f{
526
- let local=P-place;
527
- let b=dot(d,local);
528
- let reach=b*b-(dot(local,local)-radius*radius);
529
- let t=select(-1.0,sqrt(max(reach,0.0))-b,reach>=0.0);
530
- return local+d*t;
531
- }`);var GT=e=>St(e)===1?"vec2u":"vec4u",PT=e=>St(e)===1?"rg":"rgba",$T=(e,t,r="xy")=>St(e)===1?`unpackLight(${t}.${r[0]})`:`lightFloats(${t}.${r==="xy"?"xyz":"rgb"})`,DT=(e,t,r="xy")=>`${t}.${gn(e,r)}`,gn=(e,t="xy")=>St(e)===1?t[1]:t==="xy"?"w":"a",kT=e=>{let t=St(e);return t===1?[]:[Af(t)]};var xm=(e,t,r,o,a,n)=>`@group(${n}) @binding(${e}) var cacheFinal:texture_2d<${Ef(a)}>;
532
- @group(${n}) @binding(${t}) var cacheRaw:texture_2d<u32>;
533
- @group(${n}) @binding(${r}) var cacheSky:texture_2d<f32>;
534
- struct CacheSample{radiance:vec3f,distance:f32,sky:f32,}
535
- struct CacheGathered{corner:array<u32,8>,place:array<vec3f,8>,alpha:vec3f,levelHeld:u32,}
536
- var<${o}> cacheNow:CacheGathered;
537
- fn spCacheRes()->u32{return u32(sp.cache.y);}
538
-
539
- fn spCacheCovers()->bool{return cacheNow.levelHeld!=0u;}
540
-
541
-
542
- fn spCacheCorner(cover:CacheCoverage,bottom:vec3i,spacing:f32,lane:u32){
543
- cacheNow.corner[lane]=0u;
544
- if(!cover.valid){return;}
545
- let cell=bottom+vec3i(vec3u(lane&1u,(lane>>1u)&1u,(lane>>2u)&1u));
546
- let slot=cacheSlotOf(cover.level,cell);
547
- if(slot!=0u){
548
- cacheNow.corner[lane]=slot;
549
- cacheNow.place[lane]=probePosition(cell,spacing);
550
- }
551
- }
552
- `,Tm=`/** The level held plus one and the fractions of the point between its eight probes, kept in \`cacheNow\` (none held for zero). */
553
- fn spCacheHeld(cover:CacheCoverage,P:vec3f){
554
- cacheNow.levelHeld=select(0u,cover.level+1u,cover.valid);
555
- cacheNow.alpha=probeFraction(cover.level,P);
556
- }
557
- `,wm=`/** A point of a surface of normal \`N\`, just under it: a floor that stands on the probes' lattice, as a ground at zero does, then keeps the probes in its plane, whichever way the depth rounds. */
558
- fn spCacheUnder(P:vec3f,N:vec3f)->vec3f{return P-N*0.02;}
559
-
560
-
561
-
562
-
563
-
564
- fn spCacheKeepFacing(P:vec3f,N:vec3f){
565
- var facing=0u;
566
- for(var lane=0u;lane<8u;lane++){
567
- if(cacheNow.corner[lane]==0u){continue;}
568
- let along=dot(cacheNow.place[lane]-P,N);
569
- if(along>=0.0){facing|=1u<<lane;}
570
- cacheNow.place[lane]-=N*along;
571
- }
572
- if(facing==0u){return;}
573
- for(var lane=0u;lane<8u;lane++){
574
- if(((facing>>lane)&1u)==0u){cacheNow.corner[lane]=0u;}
575
- }
576
- }`,Lm=e=>e==="workgroup"?`/** The probes round \`P\` the workgroup reads, found by its lanes: a lane the corner of its rank, in the level drawn by \`random\` (\`cacheCoverage\`). */
577
- fn spCacheGather(P:vec3f,lane:u32,random:f32){
578
- let cover=cacheCoverage(P,random);
579
- if(lane==0u){
580
- spCacheHeld(cover,P);
581
- }
582
- if(lane>=8u){return;}
583
- spCacheCorner(cover,probeBottomCell(cover.level,P),bounce.levels[cover.level].spacing,lane);
584
- }`:`/** The probes round \`P\` the thread reads, all eight found by it, in the level \`bias\` coarser than the one that covers it (\`random\`: the number the level is chosen with, \`cacheCoverage\`). */
585
- fn spCacheGatherOwnBiased(P:vec3f,bias:u32,random:f32){
586
- let cover=cacheCoverageBiased(P,bias,random);
587
- let spacing=bounce.levels[cover.level].spacing;
588
- let bottom=probeBottomCell(cover.level,P);
589
- spCacheHeld(cover,P);
590
- for(var lane=0u;lane<8u;lane+=2u){spCacheCornerPair(cover,bottom,spacing,lane);}
591
- }
592
-
593
-
594
- fn spCacheCornerPair(cover:CacheCoverage,bottom:vec3i,spacing:f32,lane:u32){
595
- cacheNow.corner[lane]=0u;
596
- cacheNow.corner[lane+1u]=0u;
597
- if(!cover.valid){return;}
598
- let cell=bottom+vec3i(0,i32((lane>>1u)&1u),i32(lane>>2u));
599
- let entry=cellEntry(cover.level,probeWrap(cell));
600
- let beside=cellEntry(cover.level,probeWrap(cell+vec3i(1,0,0)));
601
- let lanes=tableLanes(entry);
602
- var slots=vec2u(u32(lanes[entry%TABLE_LANES]),0u);
603
- if(beside/TABLE_LANES==entry/TABLE_LANES){slots.y=u32(lanes[beside%TABLE_LANES]);}else{slots.y=tableEntry(beside);}
604
- for(var k=0u;k<2u;k++){
605
- if(slots[k]!=0u){
606
- cacheNow.corner[lane+k]=slots[k];
607
- cacheNow.place[lane+k]=probePosition(cell+vec3i(i32(k),0,0),spacing);
608
- }
609
- }
610
- }
611
- fn spCacheGatherOwn(P:vec3f){spCacheGatherOwnBiased(P,0u,0.0);}
612
-
613
- fn spCacheGatherFacing(P:vec3f,N:vec3f,random:f32){
614
- let under=spCacheUnder(P,N);
615
- spCacheGatherOwnBiased(under,0u,random);
616
- spCacheKeepFacing(under,N);
617
- }`,bm=e=>`
618
-
619
- fn spCacheBorder()->u32{return 1u<<(u32(sp.cache.z)-1u);}
620
-
621
-
622
- fn spCacheTaps(tile:vec2u,q:vec2f,at:u32)->vec2i{
623
- return vec2i(tile+vec2u(vec2i(floor(q))+vec2i(i32(at&1u),i32(at>>1u))));
624
- }
625
-
626
-
627
- fn spCacheLevel(slot:u32,uv:vec2f,res:u32,level:u32)->vec3f{
628
- let border=spCacheBorder();
629
- let tile=cacheTileOf(slot,(res+2u*border)>>level);
630
- let q=uv*f32(res>>level)+vec2f(f32(border>>level)-0.5);
631
- var taps=array<vec3f,4>();
632
- for(var i=0u;i<4u;i++){taps[i]=${_f(e,"textureLoad(cacheFinal,spCacheTaps(tile,q,i),i32(level))")};}
633
- return bilinear3(taps[0],taps[1],taps[2],taps[3],q-floor(q))*bounce.reach.w;
634
- }
635
-
636
- fn spCacheRadiance(slot:u32,uv:vec2f,res:u32,mip:f32)->vec3f{
637
- let low=u32(floor(mip));
638
- let near=spCacheLevel(slot,uv,res,low);
639
- let high=min(low+1u,u32(sp.cache.z)-1u);
640
- if(high==low||fract(mip)==0.0){return near;}
641
- return mix(near,spCacheLevel(slot,uv,res,high),fract(mip));
642
- }
643
-
644
- fn spCacheSky(slot:u32,uv:vec2f,res:u32)->f32{
645
- let border=spCacheBorder();
646
- let tile=cacheTileOf(slot,res+2u*border);
647
- let q=uv*f32(res)+vec2f(f32(border)-0.5);
648
- var taps=array<f32,4>();
649
- for(var i=0u;i<4u;i++){taps[i]=textureLoad(cacheSky,spCacheTaps(tile,q,i),0).r;}
650
- let f=q-floor(q);
651
- return mix(mix(taps[0],taps[1],f.x),mix(taps[2],taps[3],f.x),f.y);
652
- }`,ym=e=>`
653
-
654
- fn spCacheShare(i:u32)->f32{
655
- let a=cacheNow.alpha;
656
- let share=mix(vec3f(1.0)-a,a,vec3f(f32(i&1u),f32((i>>1u)&1u),f32((i>>2u)&1u)));
657
- return share.x*share.y*share.z;
658
- }
659
- /** What the probe at corner \`i\`, one that holds a map, gives along the ray \`d\` from \`P\`, of a cone \`size\` texels of its grid a side: the radiance its map holds toward the
660
- * point where the ray leaves the sphere round it (\`cacheProbeWay\`), as it is \u2014 a radiance is the same all along a ray, so one ray's read takes no factor of solid angle. */
661
- fn spCacheProbe(i:u32,P:vec3f,d:vec3f,res:u32,size:f32)->CacheSample{
662
- // The table names a probe by its slot plus one, zero for none (\`traced\`): its maps lie at the slot itself.
663
- let slot=cacheNow.corner[i]-1u;
664
- let radius=sp.cache.x*cacheMinTrace(cacheNow.levelHeld-1u);
665
- let uv=equalAreaEncode(cacheProbeWay(P,cacheNow.place[i],d,radius));
666
- let mip=clamp(log2(f32(res)/size),0.0,sp.cache.z-1.0);
667
- let word=textureLoad(cacheRaw,vec2i(cacheTileOf(slot,res)+min(vec2u(uv*f32(res)),vec2u(res-1u))),0).${gn(e,"rg")};
668
- let apart=spFlag(SP_FLAG_CACHE_SKY);
669
- return CacheSample(
670
- spCacheRadiance(slot,uv,res,mip),
671
- cacheDepthOf(word),
672
- select(0.0,spCacheSky(slot,uv,res),apart));
673
- }
674
-
675
-
676
-
677
- fn spCacheSample(P:vec3f,d:vec3f,size:f32)->CacheSample{
678
- var out=CacheSample(vec3f(0.0),0.0,0.0);
679
- let res=spCacheRes();
680
- var held=0.0;
681
- for(var i=0u;i<8u;i++){
682
- if(cacheNow.corner[i]==0u){continue;}
683
- let weight=spCacheShare(i);
684
- let s=spCacheProbe(i,P,d,res,size);
685
- held+=weight;
686
- out.radiance+=s.radiance*weight;
687
- out.distance+=s.distance*weight;
688
- out.sky+=s.sky*weight;
689
- }
690
- if(held>0.0){
691
- let share=1.0/held;
692
- out.radiance*=share;
693
- out.distance*=share;
694
- out.sky*=share;
695
- }
696
- if(out.sky>0.0&&skyLit()){out.radiance=mix(out.radiance,skyProbeRadiance(d),out.sky);}
697
- return out;
698
- }
699
-
700
-
701
- struct SpFar{radiance:vec3f,distance:f32,stored:f32,}
702
-
703
- fn spFarOf(P:vec3f,d:vec3f,size:f32)->SpFar{
704
- if(spFlag(SP_FLAG_CACHE)&&spCacheCovers()){
705
- let s=spCacheSample(P,d,size);
706
-
707
- let reached=s.distance>=CACHE_MAX_HIT*(1.0-1e-6);
708
- return SpFar(s.radiance,s.distance,select(s.distance,spMaxTrace(),reached));
709
- }
710
- return SpFar(reflectionEnvironment(d,0.0),spMaxTrace(),spMaxTrace());
711
- }`,Cu=(e,t,r,o="workgroup",a=Kt,n=0)=>f(`spCacheRead(${e}, ${t}, ${r}, ${o}, ${a}${n?`, ${n}`:""})`,[Iu,...Sf(a),Ei,hn,lo],xm(e,t,r,o,a,n)+Tm+wm+Lm(o)+bm(a)+ym(a));var Om=64,QT={info:"rgba32float",normal:"r32uint",trace:"r32uint",hit:"r32uint",ray:"r32uint",gather:"rgba16float",irradiance:"rgba16float",extraAo:"r32float",radianceMip:"rgba16float",cacheRecord:"rgba32uint",history:"rgba32uint",shading:"rg32uint",keptDepth:"r32float",integrated:"rgba32uint",offsets:"r32uint",occlusion:"r32float",bentOcclusion:"r32uint",nearBounce:"rgba16float"};function Rm(e,t){return t==="uniform"?V(e):t==="buffer-read"?v(e,"read-only-storage"):t==="buffer"?v(e,"storage"):t==="float"?N(e,"unfilterable-float"):t==="uint"?N(e,"uint"):$(e,t.store,t.access)}var JT={params:[0,"uniform"],info:[1,"float"],normal:[2,"uint"],counts:[3,"buffer-read"],pixels:[4,"buffer-read"]};function $u(e){let t={},r=[];for(let o of Object.keys(e))t[o]=e[o][0],r.push(Rm(e[o][0],e[o][1]));return{at:t,entries:r}}var Am=e=>e>=16?[4,4]:e>=8?[4,2]:[2,2];function ew(e,t){return t?m(m(e.height,e.tile)*e.samplesY,8):m(m(e.width,e.tile)*e.samplesX,8)}var Nm=(e,t,r)=>e+2**t>>r,Im=(e,t,r)=>Math.max(e,Rr+2,9,Nm(t,r,0));function Fu(e,t,r,o){let a=Math.max(1,m(e,r)),n=Math.max(1,m(t,r)),s=o.values.viewProbeAdaptiveFraction,i=o.adaptiveProbes>0&&s>0,l=n+(i?Math.trunc(n*s):0),c=a*n,u=i?Math.min(Math.trunc(c*s),l*a-c):0,[h,d]=Am(o.adaptiveProbes);return{width:e,height:t,tile:r,tilesX:a,tilesY:n,rows:l,uniform:c,maxAdaptive:u,samplesX:h,samplesY:d,tracing:o.tracingResolution,gather:o.gatherResolution}}function tw(e,t,r,o=1/0){let a=r.downsampleFactor,n=Fu(e,t,a,r);for(;a<Om&&!Cm(n,r,o);)a*=2,n=Fu(e,t,a,r);return n}var Cm=(e,t,r)=>Math.max(e.tilesX,e.rows)*Im(t.tracingResolution,t.gatherResolution,t.gatherMips)<=r,Du={screenTraces:1,importance:2,importanceLighting:4,radianceHistory:8,temporal:16,cache:64,octahedral:128,occlusion:256,sceneTraces:512,skipHairHits:1024,velocity:2048,movers:4096,disocclusion:8192,occlusionTemporal:16384,fullResDepth:32768,skipFoliageHits:65536,cacheSky:1<<17,backfaceDiffuse:1<<18,skipUnlitHits:1<<20,occlusionInIntegration:1<<21,materialAo:1<<23,posesMoving:1<<24,forceMoving:1<<25,exactLight:1<<26,historyView:1<<27,youngHistory:1<<28},vn=k("ViewProbeParams",[["size","vec4u"],["grid","vec4u"],["mode","vec4u"],["counts","vec4u"],["weights","vec4f"],["spatial","vec4f"],["occlusion","vec4f"],["scene","vec4f"],["cache","vec4f"],["motion","vec4f"],["tuning","vec4f"],["trace","vec4f"],["foliage","vec4f"],["screen","vec4f"],["leak","vec4f"],["frames","vec4u"],["traced","vec4f"],["tracedHit","vec4f"],["lit","vec4u"],["gi","vec4f"],["projection","vec4f"],["eyeXY","vec4u"],["eyeZ","vec4u"],["previous","mat4x4f"]]),rw=vn.words*4,ow={probes:0,texels:3,words:6},aw=7,nw=5,sw=1,Gu=8,Pu=8,iw=e=>m(e.width,Pu)*m(e.height,Pu),lw=8,cw=(e,t=1)=>{let[r,o]=Fm(e,t);return r*o},Fm=(e,t=1)=>[m(m(e.width,t),Gu),m(m(e.height,t),Gu)],fw=65535,uw={simple:0,sampled:1,complete:2},ku=3,hw=ku*4,dw=ku*3,pw=e=>e*3*4;var Gm=f("SP_PARAMS_STRUCT",[],vn.wgsl),Ow=e=>`@group(0) @binding(${e}) var<uniform> sp:ViewProbeParams;`,Pm=D(Object.fromEntries(Object.entries(Du).map(([e,t])=>[`SP_FLAG_${e.replace(/[A-Z]/g,r=>`_${r}`).toUpperCase()}`,t]))),En=f("SP_REFLECTION",[_t(Q),ne(Q),Ge],""),$m=f("SP_BASIS",[],`fn spBasis(d:vec3f)->array<f32,9>{return ${Nf("d")};}
712
- fn spCosine(n:vec3f)->array<f32,9>{return ${If("n")};}`),Dm=f("SP_PLACES",[vi,He],`fn spFlag(bit:u32)->bool{return (sp.mode.z&bit)!=0u;}
713
-
714
-
715
- fn spFastAmount(moving:f32)->f32{
716
- let share=saturate(moving*sp.motion.y);
717
- return saturate(min((share-0.2)/0.8,sp.motion.z));
718
- }
719
-
720
- fn spTileJitter(index:u32)->vec2u{
721
- return vec2u(hammersley16(index%SP_TILE_JITTERS,SP_TILE_JITTERS,vec2u(0u))*f32(sp.size.z));
722
- }
723
-
724
- fn spUniformPixel(tile:vec2u,index:u32)->vec2u{
725
- return min(tile*sp.size.z+spTileJitter(index),sp.size.xy-vec2u(1u));
726
- }
727
-
728
- fn spAdaptivePixel(tile:vec2u,sample:u32)->vec2u{
729
- let seed=rand3dPcg16(vec3i(vec2i(tile),i32(sp.mode.x))).xy;
730
- let h=hammersley16(sample,SP_SAMPLES,seed)*f32(sp.size.z);
731
- let held=clamp(h,vec2f(0.0),vec2f(f32(sp.size.z)-1.0));
732
- return tile*sp.size.z+spTileJitter(sp.mode.x)+vec2u(held);
733
- }
734
- fn spAtlasOf(index:u32)->vec2u{return vec2u(index%sp.grid.x,index/sp.grid.x);}
735
- fn spIndexOf(atlas:vec2u)->u32{return atlas.y*sp.grid.x+atlas.x;}
736
-
737
-
738
- fn spProbeTile(index:u32,word:u32)->vec2u{
739
- if(index<sp.counts.y){return spAtlasOf(index);}
740
- let pix=vec2u(word&0xffffu,word>>16u);
741
- return (pix-min(pix,spTileJitter(sp.mode.x)))/vec2u(sp.size.z);
742
- }`),Rw=f("SP_TARGET_DITHER",[He],`fn spTargetDither(texel:vec2u,salt:i32)->f32{
743
- return f32(rand3dPcg16(vec3i(vec2i(texel),i32(sp.size.w%SP_TILE_JITTERS)+salt)).x)/65536.0;
744
- }`),Aw=e=>f(`spCoefficientTexel(${e})`,[],e?`fn spCoefficientTexel(atlas:vec2u,k:u32)->vec2i{
745
- let border=${Rr+2}u;
746
- return vec2i(atlas*border+vec2u(k%border,k/border));
747
- }`:"fn spCoefficientTexel(atlas:vec2u,k:u32)->vec2i{return vec2i(vec2u(atlas.x*9u+k,atlas.y));}"),km=f("SP_DEPTHS",[En,to,ja],`fn spDepthOf(p:vec3f)->f32{
748
- if(slabPerspective(reflectionView.slab)){return max(surfaceLinearDepth(p),1e-3);}
749
- return max(viewEyeDistance(p),1e-3);
750
- }
751
-
752
- fn spMaxTrace()->f32{return sp.spatial.w;}
753
- fn spMaxRay()->f32{return sp.weights.w/view.preExposure.x;}`),Wm=f("SP_SKY_LEAK",[En],`fn spSkyLeak(d:vec3f,distance:f32)->vec3f{
754
- if(!skyLightApplied()||all(sp.leak.xyz<=vec3f(0.0))){return vec3f(0.0);}
755
- return skyLightReflection(d,sp.leak.w)*sp.leak.xyz*saturate(distance*sp.cache.w);
756
- }`),Bm=f("SP_HITS",[],`${D({SP_IMPORTANCE_LEVELS:pe.importanceLevels})}
757
- fn spHitWord(distance:f32,moving:bool)->u32{
758
- return (bitcast<u32>(max(distance,0.0))&0x7ffffffeu)|select(0u,1u,moving);
759
- }
760
- fn spHitDistance(word:u32)->f32{return bitcast<f32>(word&0x7ffffffeu);}
761
- fn spHitMoves(word:u32)->bool{return (word&1u)!=0u;}
762
- fn spPackRay(coord:vec2u,level:u32)->u32{return (coord.x&63u)|((coord.y&63u)<<6u)|((level&15u)<<12u);}
763
-
764
- const SP_RAY_NONE:u32=0x10000u;
765
- fn spRayNone(word:u32)->bool{return (word&SP_RAY_NONE)!=0u;}
766
- fn spRayCoord(word:u32)->vec2u{return vec2u(word&63u,(word>>6u)&63u);}
767
- fn spRayLevel(word:u32)->u32{return (word>>12u)&15u;}
768
-
769
- fn spRayMip(level:u32,trace:u32)->u32{return (trace<<SP_IMPORTANCE_LEVELS)>>level;}
770
- /** A probe: its world point, its signed depth \u2014 negative where it stands on no lit surface \u2014, its normal, the speed of its
771
- * surface, in metres an image, and whether its surface has backface diffuse light (\`foliage\`: a thin double-sided sheet or a subsurface
772
- * material) or is hair. */
773
- struct SpProbe{P:vec3f,depth:f32,N:vec3f,speed:f32,foliage:bool,hair:bool,}`),Wu=e=>f(`spCommon(${e[0]}, ${e[1]})`,[Gm,En,$m,Dm,km,Wm,Bm,Ae,ja,yr,Or,Fi],`${Pm}
774
- ${D({SP_SAMPLES_X:e[0],SP_SAMPLES_Y:e[1],SP_SAMPLES:e[0]*e[1],SP_TILE_JITTERS:pe.tileJitters})}
775
- const SP_MIN_WEIGHT:f32=${pe.minInterpolationWeight};
776
- const SP_PLANE_SCALE:f32=${pe.pixelPlaneWeightScale}.0;`);var Bu={REFLECTION_THICKNESS:4,REFLECTION_MIRROR_ROUGHNESS:.05,REFLECTION_EPSILON:2**-11,REFLECTION_FRONT_COVERAGE:.5,REFLECTION_FAR:2**23,REFLECTION_DISTANCE_MAX:Mt/100,REFLECTION_CLAMP_FLOOR:.1,REFLECTION_STILL_READ:1/256,REFLECTION_FLOOR:1e-30,REFLECTION_CENTIMETRES:100,REFLECTION_PULLBACK:4,REFLECTION_MESH_BAND_MOST:2,REFLECTION_MISS_OFFSET:.02,REFLECTION_STEP_DITHER:.95,REFLECTION_STEP_DITHER_CONE:Ns/128,REFLECTION_MIN_CONE:1e-5,REFLECTION_ONE_SURFACE:.25},Cw=8,Mu={REFLECTION_SCENE_TRACES:1,REFLECTION_DISTANT_TRACES:2,REFLECTION_SCREEN_TRACES:4,REFLECTION_TEMPORAL:8,REFLECTION_RECONSTRUCTION:16,REFLECTION_BILATERAL:32,REFLECTION_SCENE_COLOR:64,REFLECTION_HEIGHT_FOG:128,REFLECTION_HI_RES_SURFACE:256,REFLECTION_STAGE_VIEW:512,REFLECTION_SCENE_TRIANGLES:1024,REFLECTION_OWN_RAYS:2048},J=8;var Vm=f("HAZE_UNPACK_WGSL",[],`
777
- fn hazeUnpack(a:vec2u,b:vec2u,full:bool)->vec4f{
778
- if(full){return vec4f(bitcast<f32>(a.x),bitcast<f32>(a.y),bitcast<f32>(b.x),bitcast<f32>(b.y));}
779
- let x=unpack2x16float(a.x);
780
- let y=unpack2x16float(a.y);
781
- return vec4f(x.x,x.y,y.x,y.y);
782
- }`),Hm=e=>`
783
- fn ${e}Cell(cell:vec3i,size:vec3f,full:bool)->vec4f{
784
- let c=clamp(cell,vec3i(0),vec3i(size)-vec3i(1));
785
- return ${e}Words((u32(c.z)*u32(size.y)+u32(c.y))*u32(size.x)+u32(c.x),full);
786
- }
787
- fn ${e}At(uvw:vec3f,size:vec3f,full:bool)->vec4f{
788
- let p=uvw*size-0.5;
789
- let base=floor(p);
790
- let f=p-base;
791
- let c=vec3i(base);
792
- let near0=mix(mix(${e}Cell(c,size,full),${e}Cell(c+vec3i(1,0,0),size,full),f.x),mix(${e}Cell(c+vec3i(0,1,0),size,full),${e}Cell(c+vec3i(1,1,0),size,full),f.x),f.y);
793
- let near1=mix(mix(${e}Cell(c+vec3i(0,0,1),size,full),${e}Cell(c+vec3i(1,0,1),size,full),f.x),mix(${e}Cell(c+vec3i(0,1,1),size,full),${e}Cell(c+vec3i(1,1,1),size,full),f.x),f.y);
794
- return mix(near0,near1,f.z);
795
- }`,Vu=f("HAZE_WEIGHT_WGSL",[],`
796
- fn hazeWeight(depth:f32,volume:vec4f,fadeInv:f32)->vec2f{
797
- let w=min(sqrt(depth/volume.w),1.0);
798
- let slice=w*volume.z;
799
- var weight=select(1.0,saturate(slice*slice*2.0),slice<0.70710678);
800
- weight*=saturate(depth*fadeInv);
801
- return vec2f(w,weight);
802
- }`);function Um({reader:e,sample:t}){let r=a=>`${e}At(vec3f(uv,at.x),volume.xyz,${a})`,o=t?.("vec3f(uv,at.x)");return e&&o?`var haze:vec4f;
803
- if(flags.x!=0.0){haze=${r("true")};}else{haze=${o};}`:`let haze=${o??r("flags.x!=0.0")};`}var Hu=e=>`
804
- fn ${e.name}(P:vec3f,eye:vec3f${e.extra??""})->vec4f{
805
- let none=vec4f(0.0,0.0,0.0,1.0);
806
- let kind=directLights.atmosphereView[${ae.haze}].w;
807
- if(kind==0.0){return none;}
808
- let clip=mat4x4f(directLights.atmosphereView[${ae.projection}],directLights.atmosphereView[${ae.projection+1}],directLights.atmosphereView[${ae.projection+2}],directLights.atmosphereView[${ae.projection+3}])*vec4f(P,1.0);
809
- if(clip.w<=0.0){return none;}
810
- let uv=vec2f(clip.x/clip.w*0.5+0.5,0.5-clip.y/clip.w*0.5);
811
- let volume=directLights.atmosphereView[${ae.volume}];
812
- let flags=directLights.atmosphereView[${ae.flags}];
813
- var away=length(P-eye);
814
- if(kind==2.0){
815
- let ortho=directLights.atmosphereView[${ae.ortho}];
816
- away=dot(P,ortho.xyz)-ortho.w;
817
- }
818
- let depth=max(0.0,away*0.001-(${e.start}));
819
- if(flags.y!=0.0&&depth<=0.0){return none;}
820
- let at=hazeWeight(depth,volume,${e.fade});
821
- ${Um(e)}
822
- return vec4f(haze.rgb*at.y,1.0-at.y*(1.0-haze.a));
823
- }`,Uu=f("OPAQUE_HAZE_MARCHED_WGSL",[],`fn opaqueHazeMarched()->bool{return directLights.atmosphereView[${ae.flags}].w!=0.0;}`),zu=f("HAZE_CELLS_WGSL",[Vm],`
824
- fn hazeWords(index:u32,full:bool)->vec4f{
825
- let at=select(index,index*2u,full);
826
- return hazeUnpack(directLights.aerial[at],directLights.aerial[select(at,at+1u,full)],full);
827
- }${Hm("haze")}`),Yu={start:`directLights.atmosphere[${Y.scatteredFactor}].w`,fade:"100000.0"},_n=f("HAZE_READ_WGSL",[zu,Vu,Uu],`${Hu({name:"aerialPerspective",reader:"haze",...Yu})}
828
- `),qu=(e,t)=>f(`HAZE_SAMPLED_WGSL(${e}, ${t})`,[zu,Vu,Uu],`@group(${e}) @binding(${t}) var hazeVolume:texture_3d<f32>;${Hu({name:"aerialPerspective",reader:"haze",sample:r=>`textureSampleLevel(hazeVolume,fogSampler,${r},0.0)`,...Yu})}
829
- `);var zm=.095,Xu=1e-11,Ym=1/256,Ku=1e4;function Mw(e){let t=Math.abs(e.volumetricFogHistoryShare);if(!e.volumetricFogUsesHistory||t===0||t>=1)return 1;let r=Math.log(Ym)/Math.log(t);return Math.ceil(r)}var qm=2048;function Vw(e,t,r,o,a=qm,n={x:0,y:0,z:0,pixelSize:0}){let s=Math.max(1,Math.floor(r)),i=m(e,s),l=m(t,s);return(i>a||l>a)&&(s=Math.max(m(e,a),m(t,a)),i=m(e,s),l=m(t,s)),n.x=i,n.y=l,n.z=Math.max(1,Math.floor(o)),n.pixelSize=s,n}function ju(e,t,r,o,a={b:0,o:0,s:0}){let n=e+zm,s=(t-n*2**(o/r))/(t-n);return a.b=(1-s)/n,a.o=s,a.s=r,a}var tr=(e,t,r)=>(e*r-(Math.floor(r/2)+1))/(t*r),Hw="rgba32float",Uw="r32uint",zw=32,Zu=16;function Qu(e,t,r,o,a){for(let n=0;n<Zu;n++){let s=r-n&1023,i=t+n*4,l=a&&n<o;e[i]=l?Nr(s,2):.5,e[i+1]=l?Nr(s,3):.5,e[i+2]=l?Nr(s,5):.5,e[i+3]=0}}var Eo=k("FogVolumeFrame",[["inverseViewProj","mat4x4f"],["viewProj","mat4x4f"],["depthViewProj","mat4x4f"],["prevViewProj","mat4x4f"],["eye","vec4f"],["forward","vec4f"],["view","vec4f"],["grid","vec4f"],["texture","vec4f"],["sliceMap","vec4f"],["depthMap","vec4f"],["uv","vec4f"],["previous","vec4f"],["history","vec4f"],["blend","vec4f"],["lighting","vec4f"],["tune","vec4f"],["medium","vec4f"],["particleColor","vec4f"],["glow","vec4f"],["staticLight","vec4f"],["exposure","vec4f"],["giGrid","vec4f"],["giZ","vec4f"],["offsets",Vt(Zu)],["traced","vec4u"],["frame","vec4u"]]),Ju=Eo.words,rr=Eo.at;var eh=f("FOG_LAW_WGSL",[],`
830
- const FOG_LN2:f32=${Math.LN2};
831
-
832
- const FOG_HALF_DENSITY:f32=0.5;
833
-
834
- const FOG_NO_BOUND:f32=3.0e38;
835
- fn fogLayerDensity(layer:vec4f,z:f32,lowest:f32,highest:f32)->f32{
836
- return layer.x*exp2(clamp(-layer.y*(z-layer.z),lowest,highest));
837
- }
838
- fn fogDensityAt(z:f32)->f32{
839
- return fogLayerDensity(directLights.fog[${T.law}],z,-FOG_NO_BOUND,FOG_NO_BOUND)
840
- +fogLayerDensity(directLights.fog[${T.second}],z,-FOG_NO_BOUND,FOG_NO_BOUND);
841
- }`);var O=e=>`directLights.fog[${e}]`,ge=e=>`directLights.atmosphere[${e}]`,x=e=>`directLights.fogView[${e}]`,$e=`${ge(Y.planet)}.x!=0.0`;var C=e=>`directLights.fogSphere[${e}]`,Sn=f("FOG_LOCAL_DATA_WGSL",[],`
842
- struct FogSphere{centre:vec3f,radius:f32,axis:vec3f,start:f32,radial:f32,height:f32,falloff:f32,offset:f32,albedo:vec3f,phase:f32,emissive:vec3f,}
843
- const FOG_SPHERE_INSTANCES:u32=${W.instances}u;
844
- const FOG_SPHERE_SLOTS_EACH:u32=${Ue.slots}u;
845
-
846
- fn fogSphereCount()->u32{return u32(${C(W.header)}.x);}
847
-
848
- fn fogSphereFlagged(bit:u32)->bool{return (u32(${C(W.header)}.y)&bit)!=0u;}
849
-
850
- fn fogSphereStart()->f32{return ${C(W.header)}.w;}
851
-
852
- fn fogSphereAt(i:u32)->FogSphere{
853
- let base=FOG_SPHERE_INSTANCES+i*FOG_SPHERE_SLOTS_EACH;
854
- let c=${C(`base+${Ue.centre}u`)};
855
- let a=${C(`base+${Ue.axis}u`)};
856
- let l=${C(`base+${Ue.law}u`)};
857
- let o=${C(`base+${Ue.albedo}u`)};
858
- let e=${C(`base+${Ue.emissive}u`)};
859
- return FogSphere(c.xyz,c.w,a.xyz,a.w,l.x,l.y,l.z,l.w,o.xyz,o.w,e.xyz);
860
- }`),th=e=>f(`fogTilesWgsl(${e.group}, ${e.tiles})`,[],e.tiles===void 0?`
861
- fn fogSphereTileWord(i:u32)->u32{return 0u;}
862
- fn fogSphereTileWords()->u32{return 0u;}`:`
863
- @group(${e.group}) @binding(${e.tiles}) var<storage,read> fogSphereTiles:array<u32>;
864
- fn fogSphereTileWord(i:u32)->u32{return fogSphereTiles[i];}
865
- fn fogSphereTileWords()->u32{return arrayLength(&fogSphereTiles);}`),rh=f("FOG_LOCAL_LIST_WGSL",[Sn],`
866
-
867
- const FOG_SPHERE_NO_LIST:u32=4294967295u;
868
-
869
- fn fogSphereTiled()->bool{
870
- return ${C(W.tiling)}.y>=1.0&&fogSphereTileWords()>=u32(${C(W.screen)}.w);
871
- }
872
-
873
- fn fogSphereListAt(pixel:vec2f)->u32{
874
- if(!fogSphereTiled()){return FOG_SPHERE_NO_LIST;}
875
- let tiling=${C(W.tiling)};
876
- let tile=clamp(floor(pixel/tiling.x),vec2f(0.0),tiling.yz-1.0);
877
- return (u32(tile.y)*u32(tiling.y)+u32(tile.x))*u32(tiling.w);
878
- }
879
-
880
-
881
-
882
- fn fogSphereListOver(toward:vec3f)->u32{
883
- let p=vec4f(toward,1.0);
884
- let w=dot(${C(W.projection+3)},p);
885
- if(w<=0.0){return FOG_SPHERE_NO_LIST;}
886
- let ndc=vec2f(dot(${C(W.projection)},p),dot(${C(W.projection+1)},p))/w;
887
- return fogSphereListAt((vec2f(ndc.x,-ndc.y)*0.5+0.5)*${C(W.screen)}.xy);
888
- }
889
-
890
- fn fogSphereListCount(list:u32)->u32{
891
- if(list==FOG_SPHERE_NO_LIST){return fogSphereCount();}
892
- return fogSphereTileWord(list);
893
- }
894
-
895
- fn fogSphereListVolume(list:u32,k:u32)->u32{
896
- if(list==FOG_SPHERE_NO_LIST){return k;}
897
- return (fogSphereTileWord(list+1u+(k>>2u))>>((k&3u)*8u))&255u;
898
- }`),oh=f("FOG_LOCAL_OVER_WGSL",[Sn,rh,wr],`
899
-
900
- const FOG_SPHERE_SAFE_DIRECTION:f32=0.0001;
901
- /** The coverage \u2014 one minus the transmittance \u2014 of the volume \`f\` along the ray from \`start\`, in its unit
902
- * space, along the unit \`dir\` for \`run\`: the radial law's integral \u2014 the sphere's density \`1 \u2212 d\xB2\` in
903
- * closed form, three quarters of it, so that a ray through the centre takes the extinction itself \u2014,
904
- * the height law's \u2014 \`height \xB7 e^(\u2212falloff \xB7 (h \u2212 offset))\` along the ray, the exponent of its start held
905
- * above \u221280 \u2014, combined. */
906
- fn fogSphereCoverage(f:FogSphere,start:vec3f,dir:vec3f,run:f32)->f32{
907
- var radial=0.0;
908
- var height=0.0;
909
- if(f.radial>0.0){
910
- let b=dot(dir,start);
911
- let c=dot(start,start)-1.0;
912
- var h=b*b-c;
913
- if(h>=0.0){
914
- h=sqrt(h);
915
- let first=max(-b-h,0.0);
916
- let last=min(max(-b+h,0.0),run);
917
- let firstSquare=first*first;
918
- let lastSquare=last*last;
919
- let integral0=-(c*first+b*firstSquare+firstSquare*first/3.0);
920
- let integral1=-(c*last+b*lastSquare+lastSquare*last/3.0);
921
- radial=max(0.0,f.radial*(integral1-integral0)*(3.0/4.0));
922
- }
923
- }
924
- if(f.height>0.0){
925
- let rise=dot(dir,f.axis);
926
- let lean=select(-1.0,1.0,rise>=0.0);
927
- let safe=select(rise,FOG_SPHERE_SAFE_DIRECTION*lean,abs(rise)<FOG_SPHERE_SAFE_DIRECTION);
928
- let low=max(-80.0,(dot(start,f.axis)-f.offset)*f.falloff);
929
- let along=safe*run*f.falloff;
930
- height=(f.height/(f.falloff*safe))*(exp(-low)-exp(-(low+along)));
931
- }
932
- let kept=1.0-(1.0-exp(-radial))*(1.0-exp(-height));
933
- return 1.0-exp(log(kept)*f.radius);
934
- }
935
-
936
-
937
-
938
- fn fogSphereLight(f:FogSphere,coverage:f32,dir:vec3f)->vec3f{
939
- var light=${C(W.sunLight)}.rgb*hgPhase(-f.phase,dot(dir,${C(W.sunDirection)}.xyz));
940
- let v=-f.phase*dir;
941
- let sky0=${C(W.sky)};
942
- let sky1=${C(W.sky+1)};
943
- let sky2=${C(W.sky+2)};
944
- light+=max(vec3f(dot(sky0.xyz,v)+sky0.w,dot(sky1.xyz,v)+sky1.w,dot(sky2.xyz,v)+sky2.w),vec3f(0.0));
945
- return (light*f.albedo+f.emissive)*coverage;
946
- }
947
-
948
-
949
- fn fogSphereInstance(f:FogSphere,toward:vec3f,dir:vec3f,excluded:f32)->vec4f{
950
- let inverse=1.0/f.radius;
951
- let depthPoint=(toward-f.centre)*inverse;
952
- let origin=-f.centre*inverse;
953
- let b=2.0*dot(dir,origin);
954
- let c=dot(origin,origin)-1.0;
955
- let discriminant=b*b-4.0*c;
956
- var span=vec2f(-1.0);
957
- if(discriminant>=0.0){
958
- let root=sqrt(discriminant);
959
- span=(-b+vec2f(-root,root))*0.5;
960
- }
961
- span=max(vec2f(max(fogSphereStart(),f.start)*inverse),span);
962
- span=min(span,vec2f(length(depthPoint-origin)));
963
- var light=vec3f(0.0);
964
- var kept=1.0;
965
- if(any(span>vec2f(0.0))){
966
- span=max(span,vec2f(excluded*inverse));
967
- let reach=max(0.0,abs(span.y-span.x));
968
- if(reach>0.0){
969
- let coverage=fogSphereCoverage(f,origin+dir*span.x,dir,reach);
970
- light=fogSphereLight(f,coverage,dir);
971
- kept=1.0-coverage;
972
- }
973
- }
974
- return vec4f(light,kept);
975
- }
976
-
977
-
978
-
979
-
980
- fn fogSphereOverList(toward:vec3f,list:u32)->vec4f{
981
- let none=vec4f(0.0,0.0,0.0,1.0);
982
- let reach=length(toward);
983
- if(fogSphereCount()==0u||reach<1e-6){return none;}
984
- let count=fogSphereListCount(list);
985
- if(count==0u){return none;}
986
- let dir=toward/reach;
987
- let excluded=select(0.0,fogVolumeExclude(toward),fogSphereFlagged(${Ar.inVolume}u));
988
- var light=vec3f(0.0);
989
- var kept=1.0;
990
- for(var k=0u;k<count;k++){
991
- let seen=fogSphereInstance(fogSphereAt(fogSphereListVolume(list,k)),toward,dir,excluded);
992
- light=light*seen.a+seen.rgb;
993
- kept*=seen.a;
994
- }
995
- return vec4f(light,kept);
996
- }
997
-
998
-
999
- fn fogSphereOver(toward:vec3f,pixel:vec2f)->vec4f{return fogSphereOverList(toward,fogSphereListAt(pixel));}
1000
-
1001
-
1002
- fn fogSphereOverVertex(toward:vec3f)->vec4f{
1003
-
1004
- if(fogSphereCount()==0u){return vec4f(0.0,0.0,0.0,1.0);}
1005
- return fogSphereOverList(toward,fogSphereListOver(toward));
1006
- }`),tL=f("FOG_LOCAL_MEDIUM_WGSL",[Sn,rh],`
1007
- struct FogSphereMedium{scattering:vec3f,extinction:f32,emissive:vec3f,}
1008
- fn fogSphereMedium(position:vec3f,distanceBack:f32,distanceFront:f32)->FogSphereMedium{
1009
- var medium=FogSphereMedium(vec3f(0.0),0.0,vec3f(0.0));
1010
- let viewStart=fogSphereStart();
1011
- if(distanceBack<=viewStart){return medium;}
1012
- let list=fogSphereListOver(position);
1013
- let count=fogSphereListCount(list);
1014
- for(var k=0u;k<count;k++){
1015
- let f=fogSphereAt(fogSphereListVolume(list,k));
1016
- let start=max(viewStart,f.start);
1017
- if(distanceBack<start){continue;}
1018
- var soft=1.0;
1019
- if(distanceFront<start&&start<distanceBack){soft=(distanceBack-start)/max(0.0001,distanceBack-distanceFront);}
1020
- let unitPoint=(position-f.centre)/f.radius;
1021
- let fade=saturate(1.0-length(unitPoint));
1022
- if(fade<=0.0){continue;}
1023
- let heightExtinction=f.height*exp(-f.falloff*(dot(unitPoint,f.axis)-f.offset));
1024
- let radialExtinction=f.radial*pow(fade,0.82);
1025
- let a=exp(-heightExtinction);
1026
- let b=exp(-radialExtinction);
1027
- var extinction=max(0.0,-log(a-a*b+b));
1028
- extinction=min(${C(W.header)}.z,extinction)*soft;
1029
- medium.scattering+=extinction*f.albedo;
1030
- medium.extinction+=extinction;
1031
- medium.emissive+=extinction*f.emissive;
1032
- }
1033
- return medium;
1034
- }`);var ah=new Map;function nh(e){let t=ah.get(e);return t||ah.set(e,t=Zm(e)),t}function Xm(e){return{functions:e?`/** Whether a fog sphere lies over a point: the view draws one. */
1035
- fn fogSphereApplies()->bool{return fogSphereCount()>0u;}
1036
- `:"",laid:t=>e?`
1037
- if(local){over=fogStack(fogHeld(fogSphereOver(${t},pixel)),over);}`:"",vertex:e?`if(!fogDrawn()||!fogSphereFlagged(${Ar.onTranslucent}u)){return vec4f(0.0,0.0,0.0,1.0);}
1038
- return fogHeld(fogSphereOverVertex(P-eye));`:"return vec4f(0.0,0.0,0.0,1.0);",background:e?"||fogSphereApplies()":"",free:e?"&&!fogSphereApplies()":"",applies:e?"fogSphereApplies()":"false"}}var Km=e=>`
1039
-
1040
- fn fogStack(near:vec4f,behind:vec4f)->vec4f{
1041
- return vec4f(near.rgb+behind.rgb*near.a,near.a*behind.a);
1042
- }
1043
- ${e.functions}/** The fog along \`toward\`, the ray from \`eye\` to the point it reaches: an endless one for the sky (\`fogBeyondWith\`), the distance of the surface seen for a capture that has its depth. */
1044
- fn fogBeyondAlong(toward:vec3f,eye:vec3f,local:bool,pixel:vec2f,inView:bool)->vec4f{
1045
- if(!fogDrawn()){return vec4f(0.0,0.0,0.0,1.0);}
1046
- let height=${O(T.color)}.w>${fe.exponential-.5};
1047
- var over=vec4f(0.0,0.0,0.0,1.0);
1048
- if(height&&inView){over=heightFogAlong(toward,eye.y,fogSkyShown());}
1049
- if(height&&!inView){over=heightFogLaw(toward,eye.y,fogSkyShown(),false);}${e.laid("toward")}
1050
- if(height){over=fogStack(fogHeld(fogVolumeLookup(toward)),over);}
1051
- return over;
1052
- }
1053
- fn fogBeyondWith(dir:vec3f,eye:vec3f,local:bool,pixel:vec2f,inView:bool)->vec4f{return fogBeyondAlong(dir*FOG_FAR_DEPTH,eye,local,pixel,inView);}
1054
- fn fogBeyond(dir:vec3f,eye:vec3f)->vec4f{return fogBeyondWith(dir,eye,false,vec2f(0.0),false);}`,jm=e=>`fn fogsBackground()->bool{
1055
- return fogDrawn()&&((${O(T.color)}.w>${fe.exponential-.5}&&heightFogShown())${e.background})&&!(${$e});
1056
- }
1057
-
1058
-
1059
-
1060
- fn fogLaidFar(P:vec3f,eye:vec3f,haze:bool)->vec4f{
1061
- var over=vec4f(0.0,0.0,0.0,1.0);
1062
- if(!fogDrawn()){return over;}
1063
- let withSky=fogSkyShown();
1064
- let mode=${O(T.color)}.w;
1065
- if(mode>${fe.exponential-.5}){over=heightFog(P,eye,withSky);}
1066
- else if(mode>${fe.none}.5){over=linearFog(P,eye,withSky);}
1067
- if(haze&&${$e}){over=fogStack(over,fogHeld(aerialPerspective(P,eye)));}
1068
- return over;
1069
- }
1070
-
1071
-
1072
-
1073
- fn fogLocalVertex(P:vec3f,eye:vec3f)->vec4f{
1074
- ${e.vertex}
1075
- }
1076
-
1077
-
1078
- fn fogVolumeOver(layer:vec4f,P:vec3f,eye:vec3f)->vec4f{
1079
- if(!fogDrawn()||${O(T.color)}.w<=${fe.exponential-.5}){return layer;}
1080
- return fogStack(fogHeld(fogVolumeLookup(P-eye)),layer);
1081
- }
1082
-
1083
- fn fogNear(far:vec4f,P:vec3f,eye:vec3f,local:bool,pixel:vec2f)->vec4f{
1084
- var over=far;
1085
- if(!fogDrawn()){return over;}${e.laid("P-eye")}
1086
- over=fogVolumeOver(over,P,eye);
1087
- return over;
1088
- }
1089
- fn fogLaid(P:vec3f,eye:vec3f,haze:bool,local:bool,pixel:vec2f)->vec4f{
1090
- return fogNear(fogLaidFar(P,eye,haze),P,eye,local,pixel);
1091
- }
1092
-
1093
-
1094
- fn fogOver(P:vec3f,eye:vec3f,pixel:vec2f)->vec4f{return fogLaid(P,eye,true,${e.applies},pixel);}
1095
- fn fogOverNoHaze(P:vec3f,eye:vec3f,pixel:vec2f)->vec4f{return fogLaid(P,eye,false,${e.applies},pixel);}
1096
- /** The fog \`over\` seen at the pixel \`pixel\` of the scene, its inscattering multiplied by the light
1097
- * shafts' occlusion mask there (\`lightShaftMask\`, \`./fog/readWgsl.ts\`): the whole fog's \u2014 the
1098
- * height fog, the local volumes, the volume and the haze laid with them \u2014, its transmittance as it is; and
1099
- * \`fogBeyondAt\`, the same over the sky's pixels. */
1100
- fn fogShafted(over:vec4f,pixel:vec2f)->vec4f{return vec4f(over.rgb*lightShaftMask(pixel),over.a);}
1101
- fn fogBeyondAt(dir:vec3f,eye:vec3f,pixel:vec2f)->vec4f{return fogShafted(fogBeyondWith(dir,eye,true,pixel,true),pixel);}
1102
-
1103
-
1104
-
1105
-
1106
- fn fogOpaque(P:vec3f,eye:vec3f,pixel:vec2f)->vec4f{
1107
- if(${O(T.color)}.w==${fe.none}.0&&!(${$e})${e.free}){return vec4f(0.0,0.0,0.0,1.0);}
1108
- return fogShafted(fogLaid(P,eye,!opaqueHazeMarched(),${e.applies},pixel),pixel);
1109
- }
1110
-
1111
- fn fogThrough(P:vec3f,eye:vec3f,pixel:vec2f)->f32{
1112
- if(${O(T.color)}.w==${fe.none}.0&&!(${$e})${e.free}){return 1.0;}
1113
- return fogOver(P,eye,pixel).a;
1114
- }
1115
-
1116
-
1117
- fn fogThroughModulating(P:vec3f,eye:vec3f,pixel:vec2f)->f32{
1118
- let seen=fogThrough(P,eye,pixel);
1119
- return seen*seen;
1120
- }
1121
-
1122
-
1123
- fn foggedBy(rgb:vec3f,inscatter:f32,P:vec3f,eye:vec3f,pixel:vec2f)->vec3f{
1124
- if(${O(T.color)}.w==${fe.none}.0&&!(${$e})${e.free}){return rgb;}
1125
- let over=fogOver(P,eye,pixel);
1126
- return rgb*over.a+over.rgb*inscatter;
1127
- }
1128
- fn fogged(rgb:vec3f,P:vec3f,eye:vec3f,pixel:vec2f)->vec3f{return foggedBy(rgb,1.0,P,eye,pixel);}`;function Zm(e){let t=Xm(e);return f(`FOG_COMPOSE_WGSL(${e})`,e?[oh]:[],`${Km(t)}
1129
- ${jm(t)}`)}var Qm=`directLights.atmosphereView[${ae.haze}].xyz`,sh=`${O(T.sky)}.rgb*${Qm}*${ge(Y.sunTransmittance)}.w`,Jm=`${ge(Y.sunIlluminance)}.rgb*${ge(Y.sunTransmittance)}.rgb*${ge(Y.sunTransmittance)}.w`,eg=`${ge(Y.secondIlluminance)}.rgb*${ge(Y.secondTransmittance)}.rgb*${ge(Y.sunTransmittance)}.w`,tg=`${ge(Y.secondDisk)}.w>0.0`,rg=`
1130
- const FOG_EYE_CEILING:f32=${b(ji)};
1131
- /** The depth the depth buffer's far value converts to: one over the tiny fudge added to its
1132
- * reciprocal (\`FOG_DEPTH_FUDGE\`), 10\xB9\xB9 metres. */
1133
- const FOG_FAR_DEPTH:f32=${b(1/Xu)};
1134
-
1135
-
1136
- const FOG_MIN_COSINE:f32=${b(.001)};
1137
-
1138
- const FOG_TAYLOR_BELOW:f32=0.01;
1139
-
1140
-
1141
-
1142
- fn fogDrawn()->bool{return ${x(S.options)}.x==0.0;}
1143
-
1144
-
1145
- fn heightFogShown()->bool{return ${x(S.heightFog)}.x==0.0;}
1146
-
1147
-
1148
- fn fogHoldout()->bool{return ${x(S.holdout)}.x!=0.0;}
1149
- fn fogHeld(over:vec4f)->vec4f{return select(over,vec4f(0.0,0.0,0.0,over.a),fogHoldout());}
1150
- fn fogSkyShown()->bool{return ${$e}&&${x(S.options)}.y==0.0;}
1151
- fn fogMatches()->bool{return ${x(S.options)}.z!=0.0;}
1152
-
1153
-
1154
- fn fogSkyAmbient()->vec3f{
1155
- return ${sh}*select(vec3f(1.0),${x(S.albedo)}.rgb,fogMatches());
1156
- }
1157
- fn linearFog(P:vec3f,eye:vec3f,withSky:bool)->vec4f{
1158
- let law=${O(T.law)};
1159
- let kept=clamp((law.y-length(P-eye))/max(law.y-law.x,1e-6),0.0,1.0);
1160
- var colour=${O(T.color)}.rgb;
1161
- if(withSky){colour+=${sh};}
1162
- return vec4f(colour*(1.0-kept),kept);
1163
- }
1164
- /** The density of a layer (\`fogLayerDensity\`, the law the volume's cells read too) where a ray starts, at
1165
- * the height \`z\`. Where the ray starts at the held eye, the exponent is held to [\u2212125, 126], so that a
1166
- * layer never reads an infinity; where it starts past a distance of the eye, to its floor of \u2212127. */
1167
- fn fogOriginTerms(layer:vec4f,z:f32,moved:bool)->f32{
1168
- if(moved){return fogLayerDensity(layer,z,-FOG_NO_BOUND,127.0);}
1169
- return fogLayerDensity(layer,z,-125.0,126.0);
1170
- }
1171
- /** A layer's line integral along the ray: its density \`terms\` where the ray starts times \`(1 \u2212 2^(\u2212F)) / F\`,
1172
- * \`F\` the layer's falloff times the ray's \`rise\`, held above \u2212127; the first-order expansion where
1173
- * \`|F|\` is nearly nil. */
1174
- fn fogLineIntegral(falloff:f32,rise:f32,terms:f32)->f32{
1175
- let f=max(-127.0,falloff*rise);
1176
- let whole=(1.0-exp2(-f))/f;
1177
- let expanded=FOG_LN2-0.5*FOG_LN2*FOG_LN2*f;
1178
- return terms*select(expanded,whole,abs(f)>FOG_TAYLOR_BELOW);
1179
- }
1180
-
1181
-
1182
-
1183
- fn fogCubeColour(v:vec3f,span:f32)->vec3f{
1184
- let cube=${O(T.cubemap)};
1185
- let blend=${O(T.cubeBlend)};
1186
- let lookup=vec3f(v.x*cube.y-v.z*cube.x,v.y,v.x*cube.x+v.z*cube.y);
1187
- let sharp=saturate(span*blend.x+blend.y);
1188
- if(sharp<=0.0){return fogCubeAverage(lookup);}
1189
- if(sharp>=1.0){return fogCubeSharp(lookup);}
1190
- return mix(fogCubeAverage(lookup),fogCubeSharp(lookup),sharp);
1191
- }
1192
- /** The colour the fog scatters along \`ray\` of length \`d\`, before its opacity: its own colour \u2014 the
1193
- * cubemap's tint times what the cubemap holds there, where \`own\` reads it \u2014 and, where an atmosphere
1194
- * shows, the sky's radiance times the fog's factor. */
1195
- fn fogInscatteringOf(ray:vec3f,d:f32,withSky:bool,own:bool)->vec3f{
1196
- var colour=select(${O(T.color)}.rgb,${x(S.match)}.rgb,fogMatches());
1197
- if(own&&${O(T.cubemap)}.w>0.5){colour*=fogCubeColour(ray,d);}
1198
- if(withSky){colour+=fogSkyAmbient();}
1199
- return colour;
1200
- }
1201
-
1202
-
1203
- fn fogInscattering(ray:vec3f,d:f32,withSky:bool)->vec3f{return fogInscatteringOf(ray,d,withSky,true);}
1204
- /** The height the observer may not rise above: the least, over the layers that have a density, of 655 m
1205
- * above their base \u2014 an orthographic view that measures the fog from its position (the view block's
1206
- * observer lane) rises by its own height instead \u2014; huge where no layer has one. */
1207
- fn fogObserverLimit()->f32{
1208
- var limit=3.0e38;
1209
- let reach=FOG_EYE_CEILING+${x(S.observer)}.x;
1210
- if(${O(T.law)}.x>0.0){limit=min(limit,${O(T.law)}.z+reach);}
1211
- if(${O(T.second)}.x>0.0){limit=min(limit,${O(T.second)}.z+reach);}
1212
- return limit;
1213
- }
1214
-
1215
- fn fogHeldEye(eyeHeight:f32)->f32{return min(eyeHeight,fogObserverLimit());}
1216
- /** The height the layers' densities are taken at where the ray starts at the eye: the held eye's \u2014 for an
1217
- * orthographic view that measures the fog from its position, the observer's limit, where a layer
1218
- * has a density. */
1219
- fn fogOriginHeight(held:f32)->f32{
1220
- let limit=fogObserverLimit();
1221
- return select(held,limit,${x(S.options)}.w!=0.0&&limit<3.0e37);
1222
- }
1223
-
1224
-
1225
- fn fogLobePhase(direction:vec3f,toLight:vec3f)->f32{
1226
- if(fogMatches()){return hgPhase(${x(S.match)}.w,dot(-direction,toLight));}
1227
- return pow(saturate(dot(direction,toLight)),${O(T.range)}.z);
1228
- }
1229
- /** The light the sun scatters in the fog along a ray of \`rayLength\` and \`direction\`, \`thickness\` the line
1230
- * integral per metre: the fog's lobe colour and, where the atmosphere adds to it, the sun's light on
1231
- * the ground \u2014 and the air's second light's, a second lobe \u2014 over the sphere, none where a cubemap
1232
- * colours the fog (\`own\`: it is read) or no sun lights it. Where the atmosphere does not add to the
1233
- * fog, or the fog is made to match the volume, the light is not divided over the sphere; the
1234
- * volume's own phase function and no start distance, a lobe of no colour of its own and its light
1235
- * times the volume's particle colour are the match's. */
1236
- fn fogDirectional(direction:vec3f,thickness:f32,rayLength:f32,withSky:bool,own:bool)->vec3f{
1237
- let sun=${O(T.sun)};
1238
- let matches=fogMatches();
1239
- let fogLobe=select(${O(T.lobe)}.rgb*sun.w,vec3f(0.0),matches);
1240
- let second=withSky&&${tg};
1241
- let lobeColour=fogLobe+select(vec3f(0.0),${Jm},withSky);
1242
- let secondColour=select(vec3f(0.0),fogLobe+${eg},second);
1243
-
1244
- if((own&&${O(T.cubemap)}.w>=0.5)||dot(sun.xyz,sun.xyz)<=0.0||dot(lobeColour+secondColour,vec3f(1.0))<=0.0){return vec3f(0.0);}
1245
- let start=select(${O(T.range)}.w,0.0,matches);
1246
- let through=saturate(exp2(-thickness*max(rayLength-start,0.0)));
1247
- let scattered=(1.0-through)*select(INVERSE_FOUR_PI,1.0,matches||${x(S.options)}.y!=0.0);
1248
- var lobe=lobeColour*(fogLobePhase(direction,sun.xyz)*scattered);
1249
- if(second){lobe+=secondColour*(fogLobePhase(direction,${ge(Y.secondDirection)}.xyz)*scattered);}
1250
- return lobe*select(vec3f(1.0),${x(S.albedo)}.rgb,matches);
1251
- }
1252
-
1253
-
1254
-
1255
-
1256
- fn heightFogLaw(toP:vec3f,eyeHeight:f32,withSky:bool,skyLit:bool)->vec4f{
1257
- let law=${O(T.law)};
1258
- let range=${O(T.range)};
1259
- let reach=${O(T.reach)};
1260
- let second=${O(T.second)};
1261
- let eye=fogHeldEye(eyeHeight);
1262
- var ray=toP;
1263
- if(reach.x>0.0){
1264
- let horizontal=dot(ray.xz,ray.xz);
1265
- if(horizontal>reach.x*reach.x){ray*=reach.x/sqrt(max(horizontal,1e-4));}
1266
- }
1267
- ray.y+=eyeHeight-eye;
1268
- let invLength=inverseSqrt(max(dot(ray,ray),1e-12));
1269
- let d=dot(ray,ray)*invLength;
1270
- if(range.y>0.0&&d>range.y){return vec4f(0.0,0.0,0.0,1.0);}
1271
-
1272
-
1273
- // eye (\`w\` the plane's offset at the eye, \`FOG_VIEW_SLOT.clipPlane\`), so that the held observer is at
1274
- // \`w + normal.y * (eye - eyeHeight)\`; a view without a plane, all zero, leaves the fog as it is.
1275
- var excluded=max(fogVolumeExclude(toP),range.x);
1276
- let plane=directLights.fogView[${S.clipPlane}];
1277
- if(any(plane.xyz!=vec3f(0.0))){
1278
- let time=-(plane.w+plane.y*(eye-eyeHeight))/dot(ray,plane.xyz);
1279
- if(time>0.0&&time<1.0){excluded=max(excluded,time*d);}
1280
- }
1281
- var rayLength=d;
1282
- var rise=ray.y;
1283
- var startHeight=fogOriginHeight(eye);
1284
- if(excluded>0.0){
1285
- let along=excluded*invLength;
1286
- startHeight=eye+along*ray.y;
1287
- rise=ray.y-along*ray.y;
1288
- rayLength=(1.0-along)*d;
1289
- }
1290
- var thickness=fogLineIntegral(law.y,rise,fogOriginTerms(law,startHeight,excluded>0.0));
1291
- if(second.x>0.0){thickness+=fogLineIntegral(second.y,rise,fogOriginTerms(second,startHeight,excluded>0.0));}
1292
- let kept=max(saturate(exp2(-thickness*rayLength)),1.0-law.w);
1293
- let strength=select(0.0,fogSkyLightStrength(),skyLit);
1294
- let own=strength<=0.0;
1295
- var colour=fogInscatteringOf(ray,d,withSky,own);
1296
- var lobe=fogDirectional(ray*invLength,thickness,rayLength,withSky,own);
1297
- if(!own){
1298
- colour=mix(colour,fogSkyLightColour(ray),strength);
1299
- lobe*=1.0-strength;
1300
- }
1301
- return vec4f(colour*(1.0-kept)+lobe,kept);
1302
- }
1303
-
1304
- fn heightFogAlong(toP:vec3f,eyeHeight:f32,withSky:bool)->vec4f{
1305
- if(!heightFogShown()){return vec4f(0.0,0.0,0.0,1.0);}
1306
- return fogHeld(heightFogLaw(toP,eyeHeight,withSky,true));
1307
- }
1308
- fn heightFog(P:vec3f,eye:vec3f,withSky:bool)->vec4f{
1309
- return heightFogAlong(P-eye,eye.y,withSky);
1310
- }`,ih=(e,t=!0,r=_n)=>f(`fogWgsl(${e.name}${t?"":", no fog spheres"}${r===_n?"":`, ${r.name}`})`,[r,ui,wr,eh,nh(t),e],rg);var be={glow:1,skipHidden:2,usesHistory:4,fogColors:8,voxels:16,localShadows:32,matches:64,rectTexture:128,lightingOnly:256},xn=[0,0],ch=new Uint32Array(1),og=new Float32Array(ch.buffer),lh=(e,t,r)=>{ch[0]=r,e[t]=og[0]},ag={b:0,o:0,s:0};function ng(e,t){let r=rr,{camera:o,grid:a,resource:n,medium:s,settings:i}=t,l=a.pixelSize,c=ju(Math.max(o.near,s.startAt),s.farEnd,i.volumetricFogSliceSpread,a.z,ag);Cf(xn,o.projection),P(e,r.grid,a.x,a.y,a.z,l),P(e,r.texture,n.x,n.y,n.z,l),P(e,r.sliceMap,c.b,c.o,c.s,1/a.z),P(e,r.depthMap,xn[0],xn[1],o.perspective?0:1);let{pixelSize:u}=n;P(e,r.uv,o.width/(n.x*l),o.height/(n.y*l),tr(m(o.width,u),n.x,u),tr(m(o.height,u),n.y,u))}var _o=(e,t,r)=>e/(t*r);function sg(e,t){let r=rr,{camera:o,grid:a,resource:n,settings:s,previous:i}=t,l=i??o,{pixelSize:c}=n,u=m(l.width,c),h=m(l.height,c),d=_o(l.width,u,c)/_o(o.width,a.x,c),g=_o(l.height,h,c)/_o(o.height,a.y,c),R=tr(u,n.x,c),E=tr(h,n.y,c),y=u/n.x,z=h/n.y;P(e,r.previous,d,g,R,E),P(e,r.history,d*y,g*z,y,z);let X=!!i&&s.volumetricFogUsesHistory;P(e,r.blend,X?s.volumetricFogHistoryShare:0,t.rebuildSamples,s.volumetricFogEdgeFade);let K=t.preExposure;P(e,r.exposure,K,i?K/i.preExposure:1,1/K,t.exposure)}function ig(e,t){let r=rr,{medium:o,settings:a}=t;P(e,r.lighting,t.sunRank,t.lightCells[0],t.lightCells[1],0);let n=a.volumetricFogMovesSamples;P(e,r.tune,a.volumetricFogSurfaceLift,a.volumetricFogLiftRange,n?a.volumetricFogSampleScatter:0,a.volumetricFogLampSoftening);let s=(a.volumetricFogGlow?be.glow:0)|(t.skipHidden?be.skipHidden:0)|(a.volumetricFogUsesHistory?be.usesHistory:0)|(o.useFogColors?be.fogColors:0)|(t.voxels?be.voxels:0)|(t.lightingOnly?be.lightingOnly:0)|(a.volumetricFogLocalShadows?be.localShadows:0)|(a.volumetricFogAreaLightTexture?be.rectTexture:0)|(a.fogMatchesVolume?be.matches:0),{anisotropy:i,densityScale:l,fadeInRate:c}=o;P(e,r.medium,i,l,c,s),P(e,r.particleColor,o.particleColor[0],o.particleColor[1],o.particleColor[2]);let u=a.fogMatchesVolume?Ku:1;P(e,r.glow,o.glow[0]*u,o.glow[1]*u,o.glow[2]*u);let{staticLight:h,translucentBounce:d}=t;d&&(e.set(d.grid,r.giGrid),e.set(d.z,r.giZ)),P(e,r.staticLight,h.intensity,h.skyShadowing&&t.staticBuilt?1:0,h.skyDiffuse?1:0,t.staticBuilt?1:0);let g=n&&a.volumetricFogUsesHistory;Qu(e,r.offsets,t.frameIndex,t.rebuildSamples,g)}function OL(e,t){let r=rr,{camera:o,previous:a}=t;return e.fill(0,0,Ju),e.set(o.inverseViewProj,r.inverseViewProj),e.set(o.viewProj,r.viewProj),e.set(o.depthViewProj,r.depthViewProj),e.set(a?.viewProj??o.viewProj,r.prevViewProj),P(e,r.eye,o.eye[0],o.eye[1],o.eye[2]),P(e,r.forward,o.forward[0],o.forward[1],o.forward[2]),P(e,r.view,o.width,o.height,1/o.width,1/o.height),ng(e,t),sg(e,t),ig(e,t),lh(e,r.frame,t.frameIndex&7),lh(e,r.traced,t.tracedWords),e}var fh=Eo.wgsl;var BL=f("FOG_FRAME_STRUCT_WGSL",[],fh),lg=e=>`${e.group}, ${e.cubemap}, ${e.volume}, ${e.sampler}${e.translucent?", translucent":""}${e.lightShaft===void 0?"":`, ${e.lightShaft}`}${e.tiles===void 0?"":`, tiles ${e.tiles}`}${e.fogSphere===!1?", no fog spheres":""}${e.haze===void 0?"":`, haze ${e.haze}`}${e.skyLight?", sky light":""}`,cg=()=>`mat4x4f(${[0,1,2,3].map(e=>x(S.projection+e)).join(",")})`,Tn=`directLights.fog[${T.reach}]`,fg=e=>`
1311
- @group(${e.group}) @binding(${e.cubemap}) var fogCubemap:texture_cube<f32>;
1312
- fn fogCubeSharp(direction:vec3f)->vec3f{return textureSampleLevel(fogCubemap,fogSampler,direction,0.0).rgb;}
1313
- fn fogCubeAverage(direction:vec3f)->vec3f{return textureSampleLevel(fogCubemap,fogSampler,direction,directLights.fog[${T.cubemap}].z).rgb;}`,ug=`
1314
- fn fogSkyLightStrength()->f32{return ${x(S.heightFog)}.y;}
1315
- fn fogSkyLightColour(direction:vec3f)->vec3f{
1316
- let read=${x(S.heightFog)};
1317
- let mip=roughnessMip(read.z,read.w);
1318
- return ${x(S.skyLightColour)}.rgb*textureSampleLevel(fogCubemap,fogSampler,sceneToCube(direction),mip).rgb;
1319
- }`,hg=`
1320
- fn fogSkyLightStrength()->f32{return ${x(S.heightFog)}.y;}
1321
- fn fogSkyLightColour(direction:vec3f)->vec3f{
1322
- let read=${x(S.heightFog)};
1323
- let mip=roughnessMip(read.z,read.w);
1324
- return ${x(S.skyLightColour)}.rgb*textureSampleLevel(skyLightCube,skyLightSampler,sceneToCube(direction),i32(skyLight.levels.z),mip).rgb;
1325
- }`,dg=`fn fogCubeSharp(direction:vec3f)->vec3f{return vec3f(1.0);}
1326
- fn fogCubeAverage(direction:vec3f)->vec3f{return vec3f(1.0);}`,pg=`
1327
- fn fogSkyLightStrength()->f32{return 0.0;}
1328
- fn fogSkyLightColour(direction:vec3f)->vec3f{return vec3f(0.0);}`,mg=`
1329
- fn fogSampleVolume(uvw:vec3f)->vec4f{return textureSampleLevel(fogVolume,fogSampler,uvw,0.0);}`,gg=`
1330
- fn fogSampleFiltered(uvw:vec3f)->vec4f{
1331
- let mode=u32(${x(S.forward)}.w);
1332
- if(mode==0u){return fogSampleVolume(uvw);}
1333
- let cells=${x(S.grid)}.xyz;
1334
- let at=uvw*cells+0.5;
1335
- let floored=floor(at);
1336
- let g=fract(at);
1337
- let o=1.0-g;
1338
- let w0=o*o*o/6.0;
1339
- let w1=2.0/3.0-0.5*g*g*(2.0-g);
1340
- let w2=2.0/3.0-0.5*o*o*(2.0-o);
1341
- let w3=g*g*g/6.0;
1342
- let g0=w0+w1;
1343
- let g1=w2+w3;
1344
- var h0=(w1/g0-1.5+floored)/cells;
1345
- var h1=(w3/g1+0.5+floored)/cells;
1346
- h1=vec3f(min(h1.xy,${x(S.uv)}.zw),h1.z);
1347
- h0.z=uvw.z;
1348
- var t000=mix(fogSampleVolume(vec3f(h1.x,h0.y,h0.z)),fogSampleVolume(h0),g0.x);
1349
- let t010=mix(fogSampleVolume(vec3f(h1.x,h1.y,h0.z)),fogSampleVolume(vec3f(h0.x,h1.y,h0.z)),g0.x);
1350
- t000=mix(t010,t000,g0.y);
1351
- if(mode==1u){return t000;}
1352
- var t001=mix(fogSampleVolume(vec3f(h1.x,h0.y,h1.z)),fogSampleVolume(vec3f(h0.x,h0.y,h1.z)),g0.x);
1353
- let t011=mix(fogSampleVolume(h1),fogSampleVolume(vec3f(h0.x,h1.y,h1.z)),g0.x);
1354
- t001=mix(t011,t001,g0.y);
1355
- return mix(t001,t000,g0.z);
1356
- }`,vg=`
1357
- fn fogSampleFiltered(uvw:vec3f)->vec4f{return fogSampleVolume(uvw);}`,Eg=`
1358
- fn fogReadUV(uv:vec2f)->vec2f{
1359
- let reads=${x(S.uv)};
1360
- var at=uv*reads.xy;
1361
- let jitter=${x(S.stretch)}.z;
1362
- if(jitter!=0.0){
1363
- let cells=${x(S.grid)};
1364
- let extent=cells.xy*cells.w;
1365
- let pixel=vec2i(floor(uv*reads.xy*extent));
1366
- let random=vec2f(rand3dPcg16(vec3i(pixel,i32(${x(S.stretch)}.w))).xy)/65535.0*2.0-1.0;
1367
- at+=random*(jitter*cells.w)/extent;
1368
- }
1369
- return min(at,reads.zw);
1370
- }`,_g=`
1371
- fn fogReadUV(uv:vec2f)->vec2f{
1372
- return min(uv*${x(S.stretch)}.xy,${x(S.uv)}.zw);
1373
- }`,Sg=`
1374
-
1375
-
1376
-
1377
- fn fogVolumeBuilt()->bool{return ${Tn}.w>0.5&&${x(S.eye)}.w>0.5;}
1378
- /** How far along the ray \`toward\` the volume covers the near air: its far end over the cosine of the
1379
- * ray to the view's forward \u2014 the volume is cut at a depth, not at a distance \u2014, none behind the view
1380
- * or where there is no volume. */
1381
- fn fogVolumeExclude(toward:vec3f)->f32{
1382
- if(!fogVolumeBuilt()){return 0.0;}
1383
- let cosine=dot(normalize(toward),${x(S.forward)}.xyz);
1384
- return ${Tn}.y*select(0.0,1.0/cosine,cosine>FOG_MIN_COSINE);
1385
- }
1386
- /** The volume's light and transmittance along \`toward\`, the vector from the eye to a point: read at
1387
- * the point's screen place (\`fogReadUV\`) and view depth \u2014 its distance along the forward, which
1388
- * an orthographic view's clip weight is not \u2014, and faded in from the volume's start distance by a step, not a
1389
- * ramp (its own fade is built into it), the light divided by the pre-exposure it was written
1390
- * multiplied by. */
1391
- fn fogVolumeLookup(toward:vec3f)->vec4f{
1392
- let none=vec4f(0.0,0.0,0.0,1.0);
1393
- if(!fogVolumeBuilt()){return none;}
1394
- let clip=${cg()}*vec4f(${x(S.eye)}.xyz+toward,1.0);
1395
- let depth=dot(toward,${x(S.forward)}.xyz);
1396
- let uv=ndcToUv(perspectiveDivide(clip).xy);
1397
- let sliceMap=${x(S.sliceMap)};
1398
- let slice=logSliceOfDepth(depth,sliceMap.xyz)*sliceMap.w;
1399
- let found=fogSampleFiltered(vec3f(fogReadUV(uv),slice));
1400
- let unexposed=vec4f(found.rgb*${x(S.exposure)}.z,found.a);
1401
- return mix(none,unexposed,saturate((depth-${Tn}.z)*100000000.0));
1402
- }`,xg=e=>`
1403
- @group(${e.group}) @binding(${e.lightShaft}) var lightShaftMaskTexture:texture_2d<f32>;
1404
- fn lightShaftMask(pixel:vec2f)->f32{
1405
- let bounds=${x(S.lightShaftBounds)};
1406
- let uv=clamp(pixel*${x(S.lightShaftScene)}.zw,bounds.xy,bounds.zw);
1407
- return textureSampleLevel(lightShaftMaskTexture,fogSampler,uv,0.0).x;
1408
- }`;function Tg(e){let{group:t,cubemap:r,volume:o,sampler:a,translucent:n,lightShaft:s,fogSphere:i}=e;if((o!==void 0||r!==void 0||s!==void 0||e.haze!==void 0)&&a===void 0)throw new Error("the cubemap, the volumes and the light shafts are read through a sampler");let l=[a===void 0?"":`@group(${t}) @binding(${a}) var fogSampler:sampler;`,o===void 0?`fn fogVolumeExclude(toward:vec3f)->f32{return 0.0;}
1409
- fn fogVolumeLookup(toward:vec3f)->vec4f{return vec4f(0.0,0.0,0.0,1.0);}`:`@group(${t}) @binding(${o}) var fogVolume:texture_3d<f32>;${mg}${n?vg:gg}${n?_g:Eg}${Sg}`,r===void 0?dg:fg({group:t,cubemap:r}),e.skyLight?hg:r===void 0?pg:ug,s===void 0?"fn lightShaftMask(pixel:vec2f)->f32{return 1.0;}":xg({group:t,lightShaft:s})];return f(`fogResourcesWgsl(${lg(e)})`,[Jr,zc,eo,He,Kc,...r===void 0&&!e.skyLight?[]:[Hi],...i===!1?[]:[th(e)]],l.join(`
1410
- `))}var uh=e=>ih(Tg(e),e.fogSphere!==!1,e.haze===void 0?void 0:qu(e.group,e.haze));var ve=f("REFLECTION_CONSTANTS_WGSL",[],Object.entries(Bu).map(([e,t])=>`const ${e}:f32=${b(t)};`).join(`
1411
- `)+`
1412
- `+D(Mu));var KL=5e-4,hh={on:1,forced:2},ee={direct:4,skylight:8,forceOpaque:16,translucencyShift:5,captures:128,bouncesShift:8,refractionsShift:15},jL=4,dh=4,ZL=4,QL=2147483648,JL=1073741824,eb=e=>e.shadowMode|(e.direct?ee.direct:0)|(e.skylight?ee.skylight:0)|(e.forceOpaque?ee.forceOpaque:0)|(e.captures?ee.captures:0)|e.translucencyMode<<ee.translucencyShift|e.bounces<<ee.bouncesShift|e.refractions<<ee.refractionsShift,wg=e=>f(`hitLightModeWgsl(${e})`,[],`${D({HIT_LIGHT_DIRECT:ee.direct,HIT_LIGHT_SKYLIGHT:ee.skylight,HIT_LIGHT_FORCE_OPAQUE:ee.forceOpaque,HIT_LIGHT_CAPTURES:ee.captures})}
1413
- const HIT_LIGHT_TRANSLUCENCY_SHIFT:u32=${ee.translucencyShift}u;
1414
- const HIT_LIGHT_BOUNCES_SHIFT:u32=${ee.bouncesShift}u;
1415
- const HIT_LIGHT_REFRACTIONS_SHIFT:u32=${ee.refractionsShift}u;
1416
- fn hitLightShadowMode()->u32{return ${e}&3u;}
1417
- fn hitLightTranslucency()->u32{return (${e}>>HIT_LIGHT_TRANSLUCENCY_SHIFT)&3u;}
1418
- fn hitLightHas(bit:u32)->bool{return (${e}&bit)!=0u;}
1419
- fn hitLightBounces()->u32{return max((${e}>>HIT_LIGHT_BOUNCES_SHIFT)&127u,1u);}
1420
- fn hitLightRefractions()->u32{return (${e}>>HIT_LIGHT_REFRACTIONS_SHIFT)&127u;}
1421
- fn hitLightVertices()->u32{return hitLightBounces()*(1u+hitLightRefractions());}`),tb=f("HIT_LIGHT_WGSL",[wg("reflectionView.translucent.w")],`${D({HIT_LIGHT_ON:hh.on,HIT_LIGHT_FORCED:hh.forced})}
1422
- fn hitLightOn()->bool{return (reflectionView.translucent.z&HIT_LIGHT_ON)!=0u;}
1423
- fn hitLightForced()->bool{return (reflectionView.translucent.z&HIT_LIGHT_FORCED)!=0u;}`);var So=new Uint32Array([0,0,1,0]),ph=(e,t)=>e.queue.writeBuffer(t,0,So),Lg=ti(e=>{let t=e.createBuffer({label:"Trillion3D list head",size:So.byteLength,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(t,0,So),t}),lb=(e,t,r)=>t.copyBufferToBuffer(Lg(e),0,r,0,So.byteLength),mh=(e,t,r,o)=>e.createBuffer({label:t,size:Oe(r,o),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_DST}),gh=({name:e,group:t,binding:r,entry:o,append:a})=>{let n=`${e[0].toUpperCase()}${e.slice(1)}List`,s=l=>a?`${l}:atomic<u32>`:`${l}:u32`,i=`struct ${n}{${s("x")},${s("y")},one:u32,${s("count")},entries:array<${o}>,}
1424
- @group(${t}) @binding(${r}) var<storage,${a?"read_write":"read"}> ${e}:${n};`;return f(`listWgsl(${e}, ${t}, ${r}, ${o}, ${a})`,[sc,Hr,xi],a?`${i}
1425
- fn ${e}Append(n:u32,lanes:u32)->u32{
1426
- let at=atomicAdd(&${e}.count,n);
1427
- if(ceilDiv(at+n,lanes)>ceilDiv(at,lanes)){
1428
- let grid=groupGrid(ceilDiv(at+n,lanes));
1429
- atomicMax(&${e}.x,grid.x);
1430
- atomicMax(&${e}.y,grid.y);
1431
- }
1432
- return at;
1433
- }`:i)};var bg=(e,t)=>e-t>=120;function wn(e,t,r,o,a){if(r!==void 0&&(e.most=o(e.most,r)),!bg(t,e.since))return;let n=e.most;return e.most=r??a,e.since=t,n}var Ze="rg32uint",yt="r32uint",_h=4,or="rgba32uint",Qe="r32float",nr="r32uint",Sh=3,xb=(e,t)=>e*t*M(Qe),ar=2,Tb=ar*4,yg=(e,t)=>m(e,t),xh=(e,t)=>[e,t],Ke=(e,t)=>m(e,J)*m(t,J),Th=M(Ze),Og=_h*M(yt),Rg=M(or),wh=(e,t)=>e*t*Th,Ot=(e,t,r=!1)=>{let[o,a]=xh(e,t);return o*a*(Th+Og)+2*e*t*Rg+2*Oe(Ke(o,a),1)+2*Oe(Ke(e,t),1)+Ke(e,t)*Sh*M(nr)+Oe(o*a,ar)+Oe(r?o*a:1,ar)+(r?Oe(o*a,1):0)};function vh(e,t,r){let o=e.createTexture({label:`${t} empty tiles`,size:[m(r[0],J),m(r[1],J),Sh],format:nr,usage:GPUTextureUsage.STORAGE_BINDING});return{texture:o,resolved:ft(o,0),history:[ft(o,1),ft(o,2)]}}var je=(e,t,r,o)=>e.createTexture({label:t,size:r,format:o,usage:Pi()}),Eh={width:0,height:0,vertices:1},Ag=(e,t)=>({width:Math.max(e.width,t.width),height:Math.max(e.height,t.height),vertices:Math.max(e.vertices,t.vertices)}),Ng=e=>e?5:4,Lh=e=>8+(e-1)*dh*4,wb=(e,t,r)=>yg(e,Math.min(t,r)),Ig=(e,t=1)=>e[0]*e[1]*Lh(t)*4,Lb=(e,t,r=1)=>Math.max(Ig(t,r),t[0]*t[1]*Ng(!0)*4)<=Math.min(e.limits.maxStorageBufferBindingSize,e.limits.maxBufferSize);function Cg(e,t,r,o){let a=r[0]*r[1],n=(s,i,l)=>e.createBuffer({label:`Trillion3D reflection hit shading ${s} ${t}`,size:i,usage:l});return{params:n("parameters",16,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST),list:n("list",(2+2*a)*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST),sorted:n("sorted",2*a*4,GPUBufferUsage.STORAGE),args:n("arguments",24,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT),radiance:n("radiance",a*Lh(o)*4,GPUBufferUsage.STORAGE),materials:e.createTexture({label:`Trillion3D reflection hit shading materials ${t}`,size:[r[0],r[1]],format:"r32uint",usage:GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.TEXTURE_BINDING})}}var Ln=e=>[e.params,e.list,e.sorted,e.args,e.radiance,e.materials],Fg=e=>{for(let t of Ln(e))t.destroy()},bn=class{device;label;hitBuffer;litState;asked={most:Eh,since:0};hitsAsked=0;hitsWindow={most:0,since:0};constructor(t,r){this.device=t,this.label=r}hits(t,r){let o=r[0]*r[1]*t*4;return this.hitsAsked=Math.max(this.hitsAsked,o),this.hitBuffer&&this.hitBuffer.bytes>=o?this.hitBuffer.buffer:(this.hitBuffer&&Z(this.device,this.hitBuffer.buffer),this.hitBuffer={bytes:o,buffer:this.device.createBuffer({label:`Trillion3D reflection hits ${this.label}`,size:o,usage:GPUBufferUsage.STORAGE})},this.hitBuffer.buffer)}keepLit(t,r){let o=wn(this.hitsWindow,t,this.hitsAsked||void 0,Math.max,0);this.hitsAsked=0,o!==void 0&&this.hitBuffer&&this.hitBuffer.bytes>o&&(Z(this.device,this.hitBuffer.buffer),this.hitBuffer=void 0);let a=wn(this.asked,t,r&&{width:r.grid[0],height:r.grid[1],vertices:r.vertices},Ag,Eh),n=this.litState;a&&n&&(n.size[0]>a.width||n.size[1]>a.height||n.vertices>a.vertices)&&this.retireLit()}lit(t,r=1){let o=this.litState;return o&&o.size[0]>=t[0]&&o.size[1]>=t[1]&&o.vertices>=r?o.state:(this.retireLit(),this.litState={state:Cg(this.device,this.label,t,r),size:[t[0],t[1]],vertices:r},this.litState.state)}retireLit(){if(!this.litState)return;let t=this.litState.state;for(let r of Ln(t))Z(this.device,r);this.litState=void 0}get bytes(){let t=this.litState?Sr(Ln(this.litState.state)):0;return(this.hitBuffer?.buffer.size??0)+t}destroy(){this.hitBuffer?.buffer.destroy(),this.litState&&Fg(this.litState.state)}};function Gg(e,t,r,o){let a=(n,s,i=1)=>{let l=mh(e,`Trillion3D reflection ${n}`,s,i);return ph(e,l),l};return{tracing:a("tracing tiles",Ke(t[0],t[1])),clearTracing:a("unused tracing tiles",Ke(t[0],t[1])),resolve:a("resolve tiles",Ke(r[0],r[1])),clear:a("clear tiles",Ke(r[0],r[1])),pending:a("rays missed",t[0]*t[1],ar),triangleRays:a("rays sent whole",o?t[0]*t[1]:1,ar),...o?{meshRays:a("rays near the meshes",t[0]*t[1])}:{}}}function sr(e,t,r,o=!1){let a=xh(r[0],r[1]),n=[je(e,t,a,Ze),je(e,t,[...a,_h],yt),je(e,t,r,or),je(e,t,r,or)],s=n.map(h=>h.createView()),i=Gg(e,a,r,o),l=new bn(e,t),c=vh(e,t,r),u;return{textures:n,...i,lists:Object.values(i),pixels:r,fresh:s[0],rays:s[1],history:[s[2],s[3]],hits:(h,d)=>l.hits(h,d),keepLit:(h,d)=>l.keepLit(h,d),lit:(h,d=1)=>l.lit(h,d),emptyMarks(h){return u!==h&&(u&&(Z(e,c.texture),c=vh(e,t,r)),u=h),c},get retiredBytes(){let h=Sr(Object.values(i));return Sr(n)+h+Qs(c.texture)+l.bytes},destroy(){for(let h of n)h.destroy();for(let h of Object.values(i))h.destroy();c.texture.destroy(),l.destroy()}}}function bb(e,t,r,o){let a;return{get:()=>a??=sr(e,t,[r,o],!0),peek:()=>a,release(n){return a?(n(a),a=void 0,!0):!1}}}var bh=8,Nb=1,yh=0,Oh="r32uint",Pg=w(e=>e.createBindGroupLayout({entries:[$(yh,Oh,"write-only","2d",GPUShaderStage.FRAGMENT)]})),Rh=(e,t)=>[m(e,bh),m(t,bh)],Ah=(e,t)=>{let[r,o]=Rh(e,t);return 8*r*o+16+16};function Ib(e,t){e.clearBuffer(t.allocator),e.beginRenderPass(t.clearPass).end()}function Nh(e,t,r){let o="Trillion3D front layer tiles",[a,n]=Rh(t,r),s=e.createTexture({label:o,size:[a,n],format:Oh,usage:GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT}),i=s.createView(),l=(d,g,R)=>e.createBuffer({label:`${o} ${d}`,size:g,usage:GPUBufferUsage.STORAGE|R}),c=l("count",16,GPUBufferUsage.COPY_DST),u=l("list",Math.max(16,4*a*n),0),h=l("arguments",16,GPUBufferUsage.INDIRECT);return{mask:s,maskView:i,maskGroup:e.createBindGroup({label:o,layout:Pg(e),entries:[{binding:yh,resource:i}]}),clearPass:{label:"Trillion3D front layer tiles clear",colorAttachments:[{view:i,loadOp:"clear",storeOp:"store",clearValue:[0,0,0,0]}]},allocator:c,data:u,args:h,destroy(){for(let d of[s,c,u,h])d.destroy()}}}var At="rgba32uint",Ih=lt(At),De={front:{wgsl:"vec4f",format:Nc,from:0},flags:{wgsl:"u32",format:Ce[3],from:0},normal:{wgsl:"vec4f",format:Ce[1],from:1},lobes:{wgsl:"vec4u",format:$i,from:2},base:{wgsl:"vec4f",format:Ce[0],from:3}},xo=[0,1,2,3].map(e=>Object.entries(De).filter(([,{from:t}])=>t<=e).map(([t,r])=>({name:t,...r}))),$g=[xo[2],xo[3].slice(xo[2].length)],ke="Trillion3D reflection front layer",On=(e,t)=>je(e,`${ke} traced`,t,At),Yb=(e,t,r)=>(r?e*t:1)*(M(Te)+M(De.flags.format))+M(De.normal.format)+Ot(1,1)+M(At)+dt.bytes(e,t,!1),qb=e=>e+1>>>0,Je=()=>GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,Rt=(e,t,r,o)=>e.createTexture({label:ke,size:o,format:t,usage:r});function Dg(e,t,r,o){let a=[t,r],n=[1,1],s=Rt(e,Te,Je()|GPUTextureUsage.COPY_DST,o?a:n),i=Rt(e,De.flags.format,Je(),o?a:n),l=Rt(e,De.normal.format,Je(),n),c=Rt(e,De.lobes.format,Je(),n),u=On(e,n),h={depth:s.createView(),flags:i.createView(),normals:l.createView(),lobes:c.createView(),traced:u.createView()};return{depth:s,flags:i,normals:l,lobes:c,traced:u,grids:sr(e,ke,n),views:h}}function kg(e,t,r){let o=e.createTexture({label:ke,size:[t,r,2],format:Ce[0],usage:Je()|GPUTextureUsage.COPY_DST}),a=e.createTexture({label:ke,size:[t,r,1],format:Ce[3],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST});return{colours:o,words:a,coloursView:da(o),wordsView:da(a),baseView:ft(o,0)}}function yn(e,t,r,o,a=(t.width*t.height-r.width*r.height)*M(r.format)){return Wa(t,r)?{texture:r,bytes:0}:(Z(e,r),{texture:o(),bytes:a})}function Wg(e,t,r,o,a){let{width:n,height:s}=t,{views:i}=r;if(o>0){let l=yn(e,t,r.normals,()=>Rt(e,De.normal.format,Je(),[n,s])),c={width:n,height:o>2?s*2:s},u=yn(e,c,r.traced,()=>On(e,[c.width,c.height]));r.resolved||(r.resolved=je(e,ke,[n,s],Ze),i.resolved=r.resolved.createView(),a.targetBytes+=wh(n,s)),l.texture!==r.normals&&(i.normals=(r.normals=l.texture).createView()),u.texture!==r.traced&&(i.traced=(r.traced=u.texture).createView()),a.targetBytes+=l.bytes+u.bytes,(r.grids.pixels[0]<n||r.grids.pixels[1]<s)&&(Z(e,r.grids),r.grids=sr(e,ke,[n,s]),a.targetBytes+=Ot(n,s)-Ot(1,1))}if(o>1){let l=yn(e,t,r.lobes,()=>Rt(e,De.lobes.format,Je(),[n,s]),dt.bytes(n,s,!0)-dt.bytes(n,s,!1));l.texture!==r.lobes&&(i.lobes=(r.lobes=l.texture).createView()),a.targetBytes+=l.bytes}o>2&&!(r.surface&&Wa(t,r.surface.colours))&&(r.surface&&(Z(e,r.surface.colours),Z(e,r.surface.words)),r.tiles&&Z(e,r.tiles),r.surface=kg(e,n,s),r.tiles=Nh(e,n,s),a.targetBytes+=n*s*(2*M(Ce[0])+M(Ce[3]))+Ah(n,s))}function Bg(e,t,r,o){let{traced:a}=r;if(a.height<=t.height)return!1;Z(e,a),r.traced=On(e,[1,1]),r.views.traced=r.traced.createView();let n=(a.width*a.height-1)*M(At);return o.targetBytes=Math.max(0,o.targetBytes-n),!0}function Mg(e,t,r){let{grids:o}=t,[a,n]=o.pixels;if(a*n<=1)return!1;Z(e,o),t.grids=sr(e,ke,[1,1]);let s=Ot(a,n)-Ot(1,1);return r.targetBytes=Math.max(0,r.targetBytes-s),!0}function Vg(e){let t={front:ct(),flags:ct(),normal:ct(),lobes:ct(),base:ct()};t.flags.view=e.flags;let r=xo.map(l=>l.map(({name:c})=>t[c])),[o,a]=$g.map(l=>l.map(({name:c})=>t[c])),n={view:e.depth,depthLoadOp:"load",depthStoreOp:"store"},s={label:Ba,colorAttachments:r[0],depthStencilAttachment:n};return{out:t,colours:r,surface:o,pass:s,basePass:{label:Ba,colorAttachments:a,depthStencilAttachment:n}}}function Hg(e,t,r,o,a,n,s){let{out:i,colours:l,surface:c,pass:u}=o;return u.colorAttachments=s?c:l[a],Wg(e,t,r,a,n),a>0&&(i.normal.view=r.views.normals),a>1&&(i.lobes.view=r.views.lobes),a>2&&(i.base.view=r.surface.baseView),u}function Ug(e,t,r){let o=[r.colours.width,r.colours.height];e.copyTextureToTexture({texture:t.normals},{texture:r.colours,origin:[0,0,1]},o),e.copyTextureToTexture({texture:t.flags},{texture:r.words},o)}function zg(e){for(let t of[e.depth,e.flags,e.normals,e.lobes,e.traced])t.destroy();e.resolved?.destroy(),e.surface?.colours.destroy(),e.surface?.words.destroy(),e.tiles?.destroy(),e.grids.destroy()}function Xb(e,t,r,o){let a=Dg(e,t,r,o),{views:n}=a,s=Vg(n);return Xs({wanted:o,depth:a.depth,views:n,drawn:0,reflected:0,surfaced:0,get surface(){return a.surface},get tiles(){return a.tiles},get grids(){return a.grids}},Yg(e,{width:t,height:r},a,s))}function Yg(e,t,r,o){return{begin(a,n,s,i,l=!1){return this.drawn=a,o.out.front.view=n,s>0&&(this.reflected=a),Hg(e,t,r,o,s,i,l)},basePass(){return o.basePass},surfaceFrom(a){let{surface:n}=r;n&&(this.surfaced=this.drawn,Ug(a,r,n))},get lobesView(){return r.views.lobes},releaseLit(a){return Bg(e,t,r,a)},releaseGrids(a){return Mg(e,r,a)},dispose(){zg(r)}}}var Zb=(e,t)=>e.fogVolume?.read??t.fog,Ch=(e,t)=>t?[N(e.cubemap,"float","cube"),Tr(e.sampler,"filtering")]:[],Qb=(e,t,r)=>t?[{binding:e.cubemap,resource:r.cubemap},{binding:e.sampler,resource:r.sampler}]:[];var S0=f("REFLECTION_LAYER_WGSL",[],""),F={flags:0,normals:58,lobes:2,lights:3,traceOut:10,rays:11,freshIn:12,resolvedOut:14,temporalIn:15,historyIn:16,historyOut:17,bilateralIn:18,target:20,frontTarget:21,tiles:22,pendingOut:25,pendingIn:26,tracingOut:31,resolveOut:32,raysRead:33,clearTracingOut:34,clearOut:35,depthHistory:36,depthKeep:37,census:38,field:39,imprints:45,grid:54,instances:55,vectors:56,blue:57,fogCubemap:59,fogSampler:60,pendingMesh:61,hits:62,litList:63,litSorted:64,litRadiance:65,litFunction:66,litProfile:67,litProfileSampler:68,litGrid:69,overflow:70,marks:71,marked:72,triangleRaysOut:73,layerMotion:74,emptyResolved:75,emptyHistory:76,movers:77},p=F,qg={cubemap:p.fogCubemap,sampler:p.fogSampler},x0=e=>Ff(0,p.field,e),lr={group:0,field:p.field,grid:p.grid,imprints:p.imprints,instances:p.instances,feedback:!0},Xg={...lr,visualize:Gf.indirectLighting},T0=(e,t)=>$f(lr,e,t),An=()=>[N(p.flags,"uint"),N(p.normals,"unfilterable-float"),N(p.lobes,"uint")],ye=()=>$(p.rays,yt,"read-write","2d-array"),Kg=()=>N(p.raysRead,"uint","2d-array"),To=(e=Kg(),t=!0)=>[...An(),e,...t?[v(p.tiles,"read-only-storage")]:[]],jg=()=>$(p.blue,Zr,"read-only"),Rn=(e=!1)=>[N(p.vectors,"uint"),e?$(p.depthHistory,Qe,"read-only"):N(p.depthHistory,"unfilterable-float")],ie=()=>[v(p.lights,"read-only-storage")],Nn=()=>Ch(qg,!0),Zg=(e,t)=>[...ie(),...Nn(),...Pf(lr,e,t)],Qg=e=>e.createBindGroupLayout({entries:[...An(),v(p.tracingOut,"storage"),v(p.clearTracingOut,"storage"),v(p.resolveOut,"storage"),v(p.clearOut,"storage"),$(p.emptyResolved,nr,"read-write"),$(p.emptyHistory,nr,"read-write")]}),w0=w(e=>({mark:e.createBindGroupLayout({entries:[v(p.overflow,"read-only-storage"),v(p.marks,"storage")]}),list:e.createBindGroupLayout({entries:[v(p.marks,"storage"),v(p.marked,"storage")]}),classify:e.createBindGroupLayout({entries:[...An(),v(p.tiles,"read-only-storage"),v(p.tracingOut,"storage"),v(p.clearTracingOut,"storage"),v(p.resolveOut,"storage"),v(p.clearOut,"storage")]})})),ir=e=>$(e,Ze),et=e=>N(e,"uint");function Jg(e,t,r,o){let a=t?[v(p.census,"storage")]:[];return{generate:e([...ie(),jg(),v(p.triangleRaysOut,"storage")],ye()),screen:e([...ie(),...Rn(),ir(p.traceOut),v(p.pendingOut,"storage"),...a],ye()),clearTracing:e([],ye()),scene:e([...Zg(r,o),...Rn(),...a,ir(p.traceOut),v(p.pendingIn,"read-only-storage")],ye(),!1),meshCompact:e([v(p.pendingMesh,"read-only-storage")],ye(),!1),meshTrace:e([...ie(),...Nn(),...Qa(lr,r),ir(p.traceOut),v(p.pendingMesh,"storage"),V(p.movers)],ye(),!1)}}function ev(e){let t=[$(p.target,j,"write-only","2d-array")],r=[$(p.frontTarget,At)],o=[et(p.bilateralIn),et(p.temporalIn)],a=$(p.historyOut,or),n=[ir(p.resolvedOut),a];return{resolve:e([...ie(),et(p.freshIn),ir(p.resolvedOut),V(p.movers)]),temporal:e([et(p.freshIn),et(p.temporalIn),et(p.historyIn),et(p.vectors),N(p.layerMotion,"unfilterable-float"),V(p.movers),a]),bilateral:e([...ie(),...t,...o]),bilateralFront:e([...ie(),...r,...o]),clear:e([...ie(),...t,...n]),clearFront:e([...ie(),...r,...n])}}var L0=(e,t,r=Kt)=>{let o=(a,n,s)=>e.createBindGroupLayout({entries:[...To(n,s),...a]});return{classify:Qg(e),keepDepth:e.createBindGroupLayout({entries:[$(p.depthKeep,Qe)]}),...Jg(o,t,r,bl(e.features)),...ev(o)}},tv=2147483648,rv=1073741824,Fh=f("REFLECTION_TILES_WGSL",[gh({name:"reflectionTiles",group:0,binding:p.tiles,entry:"u32",append:!1})],`const REFLECTION_NO_TILE:u32=0xffffffffu;
1434
- const REFLECTION_EMPTY_RESOLVED:u32=${tv}u;
1435
- const REFLECTION_EMPTY_HISTORY:u32=${rv}u;
1436
- fn reflectionTileOf(wg:vec3u,groups:vec3u)->u32{
1437
- let at=flatIndex(wg,groups,1u);
1438
- if(at>=reflectionTiles.count){return REFLECTION_NO_TILE;}
1439
- return reflectionTiles.entries[at];
1440
- }
1441
- fn reflectionTileOrigin(t:u32)->vec2u{return vec2u(t&0xffffu,(t>>16u)&0x3fffu)*${J}u;}`),In={group:2,first:0},ov=it((e,t)=>Gh(e,t,lr,[v(p.pendingIn,"read-only-storage"),v(p.hits,"storage"),V(p.movers)])),Gh=(e,t,r,o)=>e.createBindGroupLayout({label:"Trillion3D reflection scene trace",entries:[...To(ye(),!1),...ie(),...Nn(),...Rn(!0),...Qa(r,t),$(p.traceOut,Ze),...o]}),b0=(e,t=Kt)=>ov(e,t),y0=w(e=>e.createBindGroupLayout({label:"Trillion3D reflection scene trace triangles",entries:Zf(In.first)})),av={group:3,binding:0},O0=w(e=>e.createBindGroupLayout({label:"Trillion3D reflection own rays round",entries:[V(av.binding)]})),R0=w(e=>e.createBindGroupLayout({label:"Trillion3D reflection scene trace hits",entries:[...To(ye(),!1),...ie(),...en(),v(p.pendingIn,"read-only-storage"),v(p.hits,"storage"),v(p.pendingOut,"storage")]})),A0=w(e=>e.createBindGroupLayout({label:"Trillion3D reflection hit shading direct",entries:[...To(ye(),!1),...ie(),...en(),v(p.hits,"storage"),v(p.litList,"read-only-storage"),v(p.litSorted,"read-only-storage"),v(p.litRadiance,"storage"),eu(p.litFunction,void 0,!0),...ru({atlas:p.litProfile,sampler:p.litProfileSampler}),$(p.litGrid,"r32uint","read-only")]})),N0=it((e,t)=>Gh(e,t,Xg,[v(p.hits,"storage"),v(p.litList,"read-only-storage"),v(p.litSorted,"read-only-storage"),v(p.litRadiance,"read-only-storage")])),I0=w(e=>e.createBindGroupLayout({label:"Trillion3D reflection scene trace triangles masked",entries:Qf(In.first)})),C0=w(e=>e.createBindGroupLayout({label:"Trillion3D reflection hit shading finish scene",entries:[V(In.first)]}));var wo=(e,t)=>e.width+2*t,Ph=(e,t)=>wo(e,t)*(e.height+2*t),$h=({width:e,height:t})=>e*t,D0=(e,t)=>`@compute @workgroup_size(${$h(e)})
1442
- fn ${t}(@builtin(workgroup_id) wg:vec3u,@builtin(local_invocation_index) lane:u32){
1443
- let corner=vec2i(wg.xy*vec2u(${e.width}u,${e.height}u));
1444
- let origin=corner-vec2i(${e.border});`,Dh=f("TILE_CLAMP_WGSL",[_i],`
1445
- fn clampTexel(p:vec2i)->vec2i{return clampToExtent(p,vec2i(view.render.xy));}`),k0=(e,t,r,o=!1,a="")=>{let n=wo(e,t),s=` for(var ringSlot=lane;ringSlot<${Ph(e,t)}u;ringSlot+=${$h(e)}u){
1446
- let l=vec2i(i32(ringSlot%${n}u),i32(ringSlot/${n}u))+vec2i(${e.border-t});
1447
- let g=origin+l;let c=clampTexel(g);
1448
- ${r}
1449
- }`;return`${a?` if(${a}){
1450
- ${s}
1451
- }`:s}
1452
- ${o?"":" workgroupBarrier();"}`},W0=(e,t,r,o=0)=>{let a=wo(e,t),n=Ph(e,t),s=e.border-t;return{index:`${o}u+u32((l.y-${s})*${a}+l.x-${s})`,side:a,stride:n,end:o+r*n}},B0=(e,t)=>{let r=e.border-t;return`(all(l>=vec2i(${r}))&&all(l<vec2i(${r+wo(e,t)},${r+e.height+2*t})))`},M0=(e,t=0,r=16384)=>{if(e*4+t>r)throw new Error(`TAA_TILE_WORKGROUP_BYTES ${e*4+t}`);return`var<workgroup> tileWords:array<u32,${e}>;`},V0=f("TILE_WORDS_WGSL",[],`
1453
- fn nearWord(k:u32,n:i32,side:i32)->u32{return u32(i32(k)+(n/3-1)*side+n%3-1);}
1454
- fn pairAt(k:u32)->vec2f{return unpack2x16float(tileWords[k]);}
1455
- fn putPair(k:u32,a:f32,b:f32){tileWords[k]=pack2x16float(vec2f(a,b));}
1456
- fn tripleAt(k:u32,stride:u32)->array<vec3f,2>{
1457
- let a=pairAt(k);let b=pairAt(k+stride);let d=pairAt(k+2u*stride);
1458
- return array<vec3f,2>(vec3f(a,b.x),vec3f(b.y,d));
1459
- }
1460
- fn putTriple(k:u32,stride:u32,u:vec3f,v:vec3f){
1461
- tileWords[k]=pack2x16float(u.xy);tileWords[k+stride]=pack2x16float(vec2f(u.z,v.x));tileWords[k+2u*stride]=pack2x16float(v.yz);
1462
- }`),nv=(e,t)=>`
1463
- fn min9${t}(n:array<${e},9>)->${e}{var t=n;var v=t[0];for(var k=1;k<9;k++){v=min(v,t[k]);}return v;}
1464
- fn max9${t}(n:array<${e},9>)->${e}{var t=n;var v=t[0];for(var k=1;k<9;k++){v=max(v,t[k]);}return v;}
1465
- fn sum9${t}(n:array<${e},9>,w:vec3f)->${e}{
1466
- var t=n;
1467
- let up=t[0]*w.x+t[1]*w.y+t[2]*w.z;let mid=t[3]*w.x+t[4]*w.y+t[5]*w.z;let down=t[6]*w.x+t[7]*w.y+t[8]*w.z;
1468
- return up*w.x+mid*w.y+down*w.z;
1469
- }
1470
- fn variation9${t}(n:array<${e},9>)->${e}{
1471
- var t=n;var s=t[0];for(var k=1;k<9;k++){s+=t[k];}
1472
- return 1.125*t[4]-0.125*s;
1473
- }
1474
- fn median3${t}(a:${e},b:${e},c:${e})->${e}{return max(min(a,b),min(max(a,b),c));}
1475
- fn median9${t}(n:array<${e},9>)->${e}{
1476
- var t=n;
1477
- var l:array<${e},3>;var m:array<${e},3>;var h:array<${e},3>;
1478
- for(var x=0;x<3;x++){
1479
- let a=t[x];let b=t[3+x];let c=t[6+x];
1480
- l[x]=min(a,min(b,c));m[x]=median3${t}(a,b,c);h[x]=max(a,max(b,c));
1481
- }
1482
- return median3${t}(max(l[0],max(l[1],l[2])),median3${t}(m[0],m[1],m[2]),min(h[0],min(h[1],h[2])));
1483
- }`,H0=f("NINE_OPERATORS_WGSL",[],[["f32",""],["vec2f","p"],["vec3f","c"],["vec4f","q"]].map(([e,t])=>nv(e,t)).join(""));var Q0=8,Gn=18,Nt=13,cr=Gn-Nt,Cn=32,Fn=8388607,tt=f("VECTOR_CODEC_WGSL",[],`
1484
- fn encodeVector(v:vec2f)->u32{
1485
- let g=sign(v)*sqrt(abs(v))*${b(2/Math.SQRT2)};
1486
- let e=g*${b(.499*.5)}+${b(32767/65535)};
1487
- let u=vec2u(clamp(e*65535.0+0.5,vec2f(0.0),vec2f(65535.0)));
1488
- return u.x|(u.y<<16u);
1489
- }
1490
- fn decodeVector(w:u32)->vec2f{
1491
- let e=vec2f(f32(w&0xffffu),f32(w>>16u))*${b(1/65535)};
1492
- let g=e*${b(1/(.499*.5))}-${b(32767/65535/(.499*.5))};
1493
- return g*abs(g)*0.5;
1494
- }
1495
- fn encodeOwnVector(v:vec2f,own:bool)->u32{return (encodeVector(v)&~1u)|select(0u,1u,own);}
1496
- fn hasOwnMotion(word:u32)->bool{return (word&1u)!=0u;}
1497
- fn withDepthStep(word:u32,step:f32)->u32{return word|(pack2x16float(vec2f(step,0.0))<<16u);}
1498
- fn depthStepOf(word:u32)->f32{return unpack2x16float(word>>16u).x;}`),J0=f("REPROJECTION_VECTOR_WGSL",[Jr,tt],`
1499
- fn screenOfTexel(p:vec2i)->vec2f{return uvToNdc((vec2f(p)+0.5)*view.render.zw);}
1500
- fn pixelVelocity(v:vec2f)->vec2f{return v*vec2f(0.5,-0.5)*view.render.xy;}
1501
- fn screenVelocity(v:vec2f)->vec2f{return v*vec2f(2.0,-2.0)*view.render.zw;}`),ey=f("HOLE_FILL_WGSL",[Ae],`
1502
- const HOLE_FILL_LENGTH_MAX:f32=${b(((1<<Nt)-1.5)/Cn)};
1503
- const HOLE_FILL_ANGLE_STEP:f32=${b(Is/(1<<cr))};
1504
- fn encodeHoleFill(v:vec2f)->u32{
1505
- let angle=atan2(v.y,v.x)*${b(.5*(1<<cr)/Math.PI)}+${(.5*(1<<cr)).toFixed(1)};
1506
- let a=u32(round(angle))&${(1<<cr)-1}u;
1507
- let l=u32(min(ceil(length(v)*${Cn}.0),${(1<<Nt)-1}.0));
1508
- return a*${1<<Nt}u+l;
1509
- }
1510
-
1511
- fn decodeHoleFill(code:u32)->vec2f{
1512
- let l=f32(code%${1<<Nt}u)*${b(1/Cn)};
1513
- let a=f32((code>>${Nt}u)%${1<<cr}u)*HOLE_FILL_ANGLE_STEP-PI;
1514
- return vec2f(a,l);
1515
- }`),ty=f("OCCLUDER_WORD_WGSL",[],`
1516
- fn occluderWord(z:f32,code:u32)->u32{return ((pack2x16float(vec2f(z,0.0))&0xffffu)<<${Gn}u)|code;}
1517
- fn occluderDepth(word:u32)->f32{return unpack2x16float(word>>${Gn}u).x;}
1518
- fn orthoOccluderWords(z:f32,code:u32)->vec2u{
1519
- let d=u32(clamp(round(z*${Fn}.0),0.0,${Fn}.0))<<9u;
1520
- return vec2u(d|((code>>9u)&0x1ffu),d|(code&0x1ffu));
1521
- }
1522
- fn orthoOccluderDepth(word:u32)->f32{return f32(word>>9u)*${b(1/Fn)};}
1523
- fn orthoOccluderFill(word:u32,low:u32)->u32{return ((word&0x1ffu)<<9u)|(low&0x1ffu);}`),ry=f("CLOSEST_TEXEL_WGSL",[Dh],`
1524
- fn closestOffsetOf(c:vec2i)->vec2i{
1525
- let code=textureLoad(marks,c,0).a&0xfu;
1526
- return vec2i(i32(code&3u),i32((code>>2u)&3u))-vec2i(1);
1527
- }
1528
- fn closestDepthOf(c:vec2i)->f32{return textureLoad(depth,clampTexel(c+closestOffsetOf(c)),0);}`),oy="r32uint",ay="rgba8uint",ny=16,sy=32,iy="rg32uint",kh=_l,Wh=Sl,ly=f("PIXEL_FLAGS_WGSL",[],`
1529
- fn pixelAnimated(flags:u32)->bool{return (flags&${kh}u)!=0u;}
1530
- fn pixelRestarts(flags:u32)->bool{return (flags&${Wh}u)!=0u;}
1531
- fn pixelResponsive(flags:u32)->bool{return (flags&${kh|Wh}u)!=0u;}`);var sv=f("SURFACE_PAST_WGSL",[tt],`fn surfacePast(word:u32,here:vec2f,camera:vec2f)->vec2f{
1532
- if(!hasOwnMotion(word)){return camera;}
1533
- return here-decodeVector(word);
1534
- }`),iv=f("STILL_PAST_WGSL",[],`fn stillPast(clip:vec4f)->vec2f{
1535
- let jitter=reflectionView.jitter;
1536
- return clip.xy/clip.w-jitter.zw+jitter.xy;
1537
- }`),Bh=f("SCREEN_PAST_WGSL",[tt,sv,iv,Yc,Uc],`struct ScreenPast{pixel:vec2f,z:f32,valid:bool,}
1538
- fn screenPast(vectors:texture_2d<u32>,P:vec3f,S:vec2f,z:f32)->ScreenPast{
1539
- let previous=reflectionView.radianceViewProj*vec4f(P,1.0);
1540
- let last=vec2i(textureDimensions(vectors))-vec2i(1);
1541
- let words=textureLoad(vectors,clamp(vec2i(S),vec2i(0),last),0);
1542
- let moves=hasOwnMotion(words.r);
1543
- let ndc=surfacePast(words.r,pixelToNdc(S,view.viewport.xy),stillPast(previous));
1544
- return ScreenPast(ndcToPixel(ndc,reflectionView.radiance.xy),select(previous.z/previous.w,z-depthStepOf(words.g),moves),moves||previous.w>0.0);
1545
- }`),dy=e=>f(`spVectors(${e})`,[tt],`@group(0) @binding(${e}) var sceneVectors:texture_2d<u32>;
1546
- struct SpMotion{ndc:vec2f,speed:f32,before:vec3f,}
1547
- fn spMotionOf(pixel:vec2i,P:vec3f,camera:vec2f)->SpMotion{
1548
- if(!spFlag(SP_FLAG_VELOCITY)){return SpMotion(camera,0.0,P);}
1549
- let last=vec2i(sp.size.xy)-vec2i(1);
1550
- let words=textureLoad(sceneVectors,clamp(pixel,vec2i(0),last),0);
1551
- if(!hasOwnMotion(words.r)){return SpMotion(camera,0.0,P);}
1552
- let now=reflectionView.viewProj*vec4f(P,1.0);
1553
- if(now.w<=0.0){return SpMotion(camera,0.0,P);}
1554
-
1555
- let past=now.xy/now.w-decodeVector(words.r);
1556
- let jitter=reflectionView.jitter;
1557
- let at=sp.previous*vec4f(past-jitter.xy+jitter.zw,now.z/now.w-depthStepOf(words.g),1.0);
1558
- let before=at.xyz/at.w;
1559
- return SpMotion(past,length(P-before),before);
1560
- }
1561
- fn spStoodClip(motion:SpMotion,P:vec3f,clip:vec4f)->vec4f{
1562
- if(all(motion.before==P)){return clip;}
1563
- return reflectionView.radianceViewProj*vec4f(motion.before,1.0);
1564
- }`);var lv=f("REFLECTION_VECTORS_WGSL",[tt],`@group(0) @binding(${F.vectors}) var temporalVectors:texture_2d<u32>;
1565
- fn temporalVectorsAt(coord:vec2i)->vec4u{
1566
- let last=vec2i(textureDimensions(temporalVectors))-vec2i(1);
1567
- return textureLoad(temporalVectors,clamp(coord,vec2i(0),last),0);
1568
- }
1569
- fn reflectionMovesAt(S:vec2f)->bool{return hasOwnMotion(temporalVectorsAt(vec2i(S)).r);}`),Mh=(e,t=!1)=>f(`reflectionPastWgsl(${e},${t})`,[ne(e),Et(e,Le),Ge,lv,Bh],`@group(0) @binding(${F.depthHistory}) var reflectionDepthHistory:${t?`texture_storage_2d<${Qe},read>`:"texture_2d<f32>"};
1570
- @group(0) @binding(${F.depthKeep}) var reflectionDepthKeep:texture_storage_2d<${Qe},write>;
1571
- fn reflectionPast(hit:vec3f,S:vec2f,z:f32)->ScreenPast{return screenPast(temporalVectors,hit,S,z);}
1572
- fn reflectionPastTexel(past:ScreenPast)->vec2i{
1573
- let size=reflectionView.radiance.xy;
1574
- return vec2i(clamp(past.pixel,vec2f(0.5),size-vec2f(0.5)));
1575
- }
1576
-
1577
- fn reflectionKeptDepth(p:vec2i)->f32{return hizFrontDepth(p);}
1578
- /** Whether the device depth \`kept\` is the surface expected at the device depth \`expected\`: their linear depths lie apart by less than
1579
- * \`share\` of the expected one \u2014 the thickness is a share of the depth \u2014; under an orthographic view, whose depth is linear and whose
1580
- * thickness the projection scaled already (\`screenRelativeThickness\`), by less than \`share\` itself. */
1581
- fn reflectionSameDepth(kept:f32,expected:f32,share:f32)->bool{
1582
- let far=reflectionLinearOfDevice(expected);
1583
- return abs(reflectionLinearOfDevice(kept)-far)<share*select(1.0,far,slabPerspective(reflectionView.slab));
1584
- }
1585
- fn reflectionKeptAgrees(at:vec2i,place:vec2f,z:f32,slope:vec2f,noise:f32,thickness:f32)->bool{
1586
- let kept=select(reflectionKeptDepth(at),textureLoad(reflectionDepthHistory,at${t?"":",0"}).r,reflectionView.traced.y!=0u);
1587
-
1588
- let under=z+dot(vec2f(at)+vec2f(0.5)-place,slope);
1589
- return reflectionSameDepth(kept,under,thickness*mix(0.5,2.0,noise));
1590
- }
1591
- fn reflectionPastAgrees(past:ScreenPast,noise:f32,thickness:f32,slope:vec2f)->bool{
1592
- if(!past.valid){return false;}
1593
- return reflectionKeptAgrees(reflectionPastTexel(past),past.pixel,past.z,slope,noise,thickness);
1594
- }
1595
- struct ReflectionShown{texel:vec2i,shown:bool,}
1596
- fn reflectionPastShown(past:ScreenPast,noise:f32,thickness:f32,slope:vec2f)->ReflectionShown{
1597
- let at=reflectionPastTexel(past);
1598
- var found=ReflectionShown(at,reflectionPastAgrees(past,noise,thickness,slope));
1599
- if(found.shown||!past.valid){return found;}
1600
- let last=vec2i(reflectionView.radiance.xy)-vec2i(1);
1601
- var nearest=1e30;
1602
- for(var k=0;k<9;k++){
1603
- let n=at+vec2i(k%3-1,k/3-1);
1604
- if(k==4||any(n<vec2i(0))||any(n>last)){continue;}
1605
- let gap=vec2f(n)+vec2f(0.5)-past.pixel;
1606
- let d=dot(gap,gap);
1607
- if(d<nearest&&reflectionKeptAgrees(n,past.pixel,past.z,slope,noise,thickness)){
1608
- nearest=d;
1609
- found=ReflectionShown(n,true);
1610
- }
1611
- }
1612
- return found;
1613
- }
1614
-
1615
- @compute @workgroup_size(${J},${J})
1616
- fn keepDepth(@builtin(global_invocation_id) id:vec3u){
1617
- if(any(vec2f(id.xy)>=view.viewport.xy)){return;}
1618
- textureStore(reflectionDepthKeep,vec2i(id.xy),vec4f(reflectionKeptDepth(vec2i(id.xy)),0.0,0.0,0.0));
1619
- }`);var cv=`fn heightFogOver(rgb:vec3f,start:vec3f,along:vec3f)->vec3f{
1620
- if(directLights.fog[${T.color}].w<${fe.exponential-.5}){return rgb;}
1621
- let over=heightFogAlong(along,start.y,directLights.atmosphere[${Y.planet}].x!=0.0);
1622
- return rgb*over.a+over.rgb;
1623
- }`,fv=`fn reflectionFogged(rgb:vec3f,start:vec3f,along:vec3f)->vec3f{
1624
- if(!reflectionDone(REFLECTION_HEIGHT_FOG)){return rgb;}
1625
- return heightFogOver(rgb,start,along);
1626
- }`,uv=(e,t)=>f(`heightFogOverWgsl(${e},${t})`,[ve,uh({group:0,cubemap:e,sampler:t,fogSphere:!1,skyLight:!0})],cv),Pn=(e,t)=>f(`reflectionFogWgsl(${e},${t})`,[uv(e,t)],fv),hv=`/** Whether the light the ray's answer took from the lit image is that of a surface that moves by itself (\`reflectionMovesAt\`), which
1627
- * its fresh texel carries (\`freshPack\`): set by each read of the lit image a ray takes \u2014 a read that gives a light is taken, at its
1628
- * weight's share \u2014, the last one taken being the answer's (\`reflectionLitHolds\`, \`reflectionSeenAnswer\`). One ray a thread: it
1629
- * starts each ray false. */
1630
- var<private> reflectionMover:bool=false;
1631
-
1632
-
1633
- fn reflectionAnswerMoves(hit:bool)->bool{return hit&&reflectionMover;}
1634
- fn reflectionEdgeNoise(coord:vec2u)->f32{
1635
- return interleavedGradientNoise(vec2f(coord)+vec2f(0.5),f32(reflectionView.temporal.y));
1636
- }
1637
-
1638
- fn reflectionLitAt(texel:vec2i)->vec3f{
1639
- return max(makeFinite3(textureLoad(reflectionImage,texel,0).rgb),vec3f(0.0))*reflectionView.radiance.w;
1640
- }
1641
- fn reflectionHitVignette(S:vec2f,Q:vec2f)->f32{
1642
- return min(screenEdgeVignette(S/view.viewport.xy*2.0-1.0),screenEdgeVignette(Q/reflectionView.radiance.xy*2.0-1.0));
1643
- }
1644
- fn reflectionHeld(at:vec3f,N:vec3f,noise:f32)->vec4f{
1645
- if(!reflectionDone(REFLECTION_SCENE_COLOR)){return vec4f(0.0);}
1646
- return reflectionLitHolds(at,N,noise);
1647
- }
1648
- fn reflectionLitHolds(at:vec3f,N:vec3f,noise:f32)->vec4f{
1649
- let none=vec4f(0.0);
1650
- let size=view.viewport.xy;
1651
- if(reflectionView.traced.x==0u){return none;}
1652
- let clip=reflectionView.viewProj*vec4f(at,1.0);
1653
- if(clip.w<=0.0){return none;}
1654
- let S=clipToFramebuffer(clip,size);
1655
- if(any(S.xy<vec2f(0.0))||any(S.xy>=size)){return none;}
1656
- let cell=vec2i(S.xy);
1657
- let z=hizOpaqueDepth(cell);
1658
- let depth=surfaceLinearDepth(worldAt(vec2f(cell)+vec2f(0.5),z));
1659
- if(abs(reflectionLinearDepth(clip)-depth)>=reflectionView.light.y*max(depth,0.00001)){return none;}
1660
- if(dot(viewToEye(at),N)<reflectionView.light.z){return none;}
1661
-
1662
- let past=reflectionPast(worldAt(S.xy,z),S.xy,z);
1663
- if(!past.valid){return none;}
1664
- let weight=reflectionHitVignette(S.xy,past.pixel);
1665
- if(!(weight>0.0)){return none;}
1666
-
1667
-
1668
- let shown=reflectionPastShown(past,noise,reflectionView.light.y,vec2f(0.0));
1669
- if(!shown.shown){return none;}
1670
- reflectionMover=reflectionMovesAt(S.xy);
1671
- return vec4f(reflectionLitAt(shown.texel),weight);
1672
- }`,$n=f("REFLECTION_SKYLIGHT_LEAK_WGSL",[Rf],`fn reflectionSkylightLeak(N:vec3f)->vec3f{
1673
- let leak=reflectionView.leak.xyz*reflectionView.leak.w;
1674
- if(all(leak<=vec3f(0.0))||!skyLit()){return vec3f(0.0);}
1675
- return skyLightDiffuse(N)*leak;
1676
- }`),dv=`/** The point a ray's radiance is read from, the surface it leaves (reflectionSeenAt). */
1677
- var<private> reflectionOrigin:vec3f;
1678
- /** What a surface shows given the light radiance the cache gave it, fogged along the ray, and the lit image held (\`reflectionHeld\`),
1679
- * which the screen fogged already, blended by the lit image's weight \u2014 its vignette near the screen's border, none where it does not
1680
- * hold the point \u2014, the leaking added to either: never a coin toss between the two, which left a field of dots near the border. */
1681
- fn reflectionSeenFrom(radiance:vec3f,held:vec4f,at:vec3f,N:vec3f)->vec3f{
1682
- let leak=reflectionSkylightLeak(N);
1683
- let cached=reflectionFogged(radiance+leak,reflectionOrigin,at-reflectionOrigin);
1684
- return reflectionClampRay(mix(cached,held.rgb+leak,saturate(held.w)));
1685
- }
1686
- fn reflectionSeenAt(radiance:vec3f,at:vec3f,N:vec3f,coord:vec2u)->vec3f{
1687
- return reflectionSeenFrom(radiance,reflectionHeld(at,N,reflectionEdgeNoise(coord)),at,N);
1688
- }
1689
- /** The light a surface no imprint lights is taken to give, its face N: what a surface of the average albedo (ReflectionView.leak.w, the one the
1690
- * leaking sky light is reflected by) reflects of the light every surface takes whatever hides it, the deferred lighting's own two terms \u2014 the
1691
- * environment's irradiance over \u03C0 (\`environmentIrradiance\`, the law the deferred lighting and the imprints read) and the sky light's diffuse light
1692
- * where one shines. In a room no sky lights, an ambient or a sky over a ground lights it: a hit whose imprint is not there yet, or that the field
1693
- * holds and no imprint covers, shows that, never black. None only where neither lights the world. */
1694
- fn reflectionUncardedLight(N:vec3f)->vec3f{
1695
- var light=environmentIrradiance(N)*INVERSE_PI;
1696
- if(skyLit()){light+=skyLightDiffuse(N);}
1697
- return light*reflectionView.leak.w;
1698
- }
1699
-
1700
-
1701
- fn reflectionUncarded(at:vec3f,N:vec3f,coord:vec2u)->vec3f{
1702
- var held=vec4f(0.0);
1703
- if(reflectionDone(REFLECTION_SCREEN_TRACES)){held=reflectionLitHolds(at,N,reflectionEdgeNoise(coord));}
1704
- return reflectionSeenFrom(reflectionUncardedLight(N),held,at,N);
1705
- }
1706
- fn reflectionHitSpread(cone:f32)->f32{
1707
-
1708
-
1709
- return tan(min(reflectionView.eyeSpread+cone,1.5707963));
1710
- }`,My=(e,t=!1)=>f(`reflectionRayLightWgsl(${e},${t})`,[ne(e),Et(e,Le),ve,qc,go,Ge,Li,Mh(e,t),$n,ut,ou,Xc,ht,Pn(F.fogCubemap,F.fogSampler)],[hv,dv].join(`
1711
- `));var pv=f("REFLECTION_LOBE_RAY_WGSL",[],"struct ReflectionLobeRay{R:vec3f,axis:vec4f,alpha:f32,along:f32,}"),mv=f("REFLECTION_FRAME_WGSL",[mi,di],`struct ReflectionFrame{T:vec3f,B:vec3f,}
1712
- fn reflectionFrameOf(N:vec3f,axis:vec3f)->ReflectionFrame{
1713
- var T=vectorRejection(axis,N);
1714
- if(dot(T,T)<1e-12){T=tangentFallback(N);}
1715
- T=normalize(T);
1716
- return ReflectionFrame(T,cross(N,T));
1717
- }`),Vh=f("REFLECTION_SAMPLE_WGSL",[ne(Q),ve,Si,mv,de,pv],`fn reflectionSampleDirection(N:vec3f,V:vec3f,axis:vec3f,widths:vec2f,u:vec2f)->vec3f{
1718
- let f=reflectionFrameOf(N,axis);
1719
- let h=visibleGgxHalf(vec2f(u.x,u.y*(1.0-reflectionView.lobe.z)),widths,vec3f(dot(V,f.T),dot(V,f.B),max(dot(V,N),1e-4)));
1720
- return reflect(-V,normalize(h.x*f.T+h.y*f.B+h.z*N));
1721
- }
1722
- fn reflectionLobeRay(N:vec3f,V:vec3f,alpha:f32,lobe:vec4f,u:vec2f)->ReflectionLobeRay{
1723
- let R=reflectionSampleDirection(N,V,lobe.xyz,vec2f(lobe.w,alpha),u);
1724
- let thin=lobeAlpha(0.0);
1725
- return ReflectionLobeRay(R,vec4f(lobe.xyz,thin),alpha,lobe.w);
1726
- }`);var Dn=f("REFLECTION_SURFACES_WGSL",[yf(Q),ne(Q),ve,de,gi],`@group(0) @binding(${F.flags}) var surfaceFlags:texture_2d<u32>;
1727
- @group(0) @binding(${F.normals}) var surfaceNormals:texture_2d<f32>;
1728
- @group(0) @binding(${F.lobes}) var surfaceLobes:texture_2d<u32>;
1729
- @group(0) @binding(${F.rays}) var surfaceRays:texture_storage_2d_array<${yt},read_write>;
1730
- @group(0) @binding(${F.raysRead}) var surfaceRaysRead:texture_2d_array<u32>;
1731
-
1732
-
1733
-
1734
- const REFLECTION_RAY_DEPTH:i32=0;
1735
- const REFLECTION_RAY_DIRECTION:i32=1;
1736
- const REFLECTION_RAY_CONE:i32=2;
1737
- const REFLECTION_RAY_DISTANCE:i32=3;
1738
-
1739
- const REFLECTION_NO_RAY_DEPTH:f32=-1.0;
1740
-
1741
-
1742
- const REFLECTION_RAY_WHOLE:u32=1u;
1743
-
1744
-
1745
- const REFLECTION_RAY_OWN:u32=0xfffffffdu;
1746
- fn surfaceFlagsAt(coord:vec2i)->u32{return textureLoad(surfaceFlags,coord,0).r;}
1747
- fn surfaceNormalAt(coord:vec2i)->vec4f{return textureLoad(surfaceNormals,coord,0);}
1748
- fn surfaceLobesAt(coord:vec2i)->vec4u{return textureLoad(surfaceLobes,coord,0);}
1749
- fn surfaceDepthAt(layer:u32,coord:vec2i)->f32{
1750
- if(layer==0u){return textureLoad(hizDepth,coord,${Ac},0).r;}
1751
- return reflectionFrontDepth(coord);
1752
- }
1753
-
1754
- fn surfacePointAt(layer:u32,coord:vec2i)->vec3f{
1755
- return worldAt(vec2f(coord)+vec2f(0.5),surfaceDepthAt(layer,coord));
1756
- }
1757
-
1758
-
1759
- fn reflectionSmoothed(r:f32)->f32{
1760
- let bias=reflectionView.lobe.w;
1761
- if(!(bias>0.0)){return r;}
1762
- let x=saturate(r/bias);
1763
- return r*x*x*(3.0-2.0*x);
1764
- }
1765
-
1766
- fn surfaceLobeWordsAt(coord:vec2i,flags:u32)->vec4u{
1767
- if((flags&${pa}u)==0u){return vec4u(0u);}
1768
- return surfaceLobesAt(coord);
1769
- }
1770
-
1771
- fn surfaceCoatedAt(coord:vec2i,flags:u32)->bool{
1772
- return packedCoat(surfaceLobeWordsAt(coord,flags)).x>0.0;
1773
- }
1774
-
1775
-
1776
- fn surfaceTopOf(w:vec4u,normal:vec4f)->vec4f{
1777
- let coat=packedCoat(w);
1778
- if(coat.x>0.0){return vec4f(lobeOctDecode(w.y),coat.y);}
1779
- return vec4f(normalize(normal.xyz),normal.a);
1780
- }
1781
-
1782
- fn surfaceTopRawAt(coord:vec2i,flags:u32)->vec4f{
1783
- return surfaceTopOf(surfaceLobeWordsAt(coord,flags),surfaceNormalAt(coord));
1784
- }
1785
-
1786
- fn surfaceTopAt(coord:vec2i,flags:u32)->vec4f{
1787
- let top=surfaceTopRawAt(coord,flags);
1788
- return vec4f(top.xyz,reflectionSmoothed(top.w));
1789
- }
1790
- fn reflectionGridSize()->vec2u{return reflectionView.grid.xy;}
1791
- fn reflectionViewport()->vec2u{return vec2u(view.viewport.xy);}
1792
- fn reflectionBlockPixel(g:vec2u,k:u32)->vec2u{
1793
- let block=reflectionBlock();
1794
- return g*block+vec2u(k%block.x,k/block.x);
1795
- }
1796
- fn reflectionJitter(g:vec2u)->vec2u{
1797
- let block=reflectionBlock();
1798
- let turn=reflectionView.temporal.z;
1799
- if(block.x<2u){return vec2u(0u);}
1800
- if(block.y<2u){return vec2u((g.y+turn)%2u,0u);}
1801
- return fourRooksJitter(g,turn);
1802
- }
1803
-
1804
- fn reflectionPickedPixel(g:vec2u)->vec2u{
1805
- return min(g*reflectionBlock()+reflectionJitter(g),reflectionViewport()-vec2u(1u));
1806
- }
1807
-
1808
- fn reflectionRayOf(direction:u32,cone:u32)->vec4f{return vec4f(unpack2x16float(direction),unpack2x16float(cone));}
1809
-
1810
- fn reflectionRayWords(R:vec3f,cone:f32)->vec2u{return vec2u(pack2x16float(R.xy),pack2x16float(vec2f(R.z,cone)));}
1811
-
1812
- fn reflectionRayAt(g:vec2i)->vec4f{
1813
- return reflectionRayOf(textureLoad(surfaceRaysRead,g,REFLECTION_RAY_DIRECTION,0).r,textureLoad(surfaceRaysRead,g,REFLECTION_RAY_CONE,0).r);
1814
- }
1815
-
1816
- fn reflectionRayDepth(g:vec2i)->f32{return bitcast<f32>(textureLoad(surfaceRaysRead,g,REFLECTION_RAY_DEPTH,0).r);}
1817
-
1818
- fn reflectionPdfOfCone(cone:f32)->f32{return 1.0/abs(cone);}
1819
-
1820
- fn reflectionRayTraces(depth:f32)->bool{return depth>0.0;}
1821
-
1822
- fn reflectionRayWhole(depth:f32)->bool{return reflectionRayTraces(depth)&&(bitcast<u32>(depth)&REFLECTION_RAY_WHOLE)!=0u;}
1823
- /** Whether the other pixels of grid texel \`g\`'s block hold their own rays this image (\`REFLECTION_RAY_OWN\`), read sampled: its ray went whole to
1824
- * the triangles this image \u2014 the ray generation wrote its distance layer again \u2014 and its distance layer says so. A texel that casts no ray this
1825
- * image keeps the word an earlier image left there. */
1826
- fn reflectionBlockOwnRays(g:vec2i)->bool{
1827
- return reflectionRayWhole(reflectionRayDepth(g))&&textureLoad(surfaceRaysRead,g,REFLECTION_RAY_DISTANCE,0).r==REFLECTION_RAY_OWN;
1828
- }
1829
- /** The texel of the grid's textures that holds the own ray of the pixel \`p\` of the viewport, which is not its block's picked pixel: along
1830
- * each axis the pixels of the places before its own, \`place \xB7 \u230Aviewport / block\u230B + min(viewport mod block, place)\`, then its block's
1831
- * rank; a block's first pixel takes the place of its picked pixel, which holds no own ray. Every such pixel has a texel of its own inside
1832
- * the viewport, none of the grid's. */
1833
- fn reflectionOwnSlot(p:vec2u)->vec2u{
1834
- let block=reflectionBlock();
1835
- let g=p/block;
1836
- let s=p%block;
1837
- let place=select(s,reflectionPickedPixel(g)-g*block,all(s==vec2u(0u)));
1838
- let viewport=reflectionViewport();
1839
- return place*(viewport/block)+min(viewport%block,place)+g;
1840
- }
1841
-
1842
-
1843
- struct ReflectingPoint{P:vec3f,topN:vec3f,topRough:f32,}
1844
- fn reflectingPointAt(layer:u32,coord:vec2i)->ReflectingPoint{
1845
- let top=surfaceTopRawAt(coord,surfaceFlagsAt(coord));
1846
- return ReflectingPoint(surfacePointAt(layer,coord),top.xyz,reflectionSmoothed(top.a));
1847
- }`),Hh=f("REFLECTING_PIXEL_WGSL",[Dn,Jt,Wi],`struct ReflectingPixel{P:vec3f,N:vec3f,V:vec3f,rough:f32,topN:vec3f,top:f32,z:f32,flags:u32,}
1848
- fn reflectingPixelAt(layer:u32,coord:vec2i,flags:u32)->ReflectingPixel{
1849
- let z=surfaceDepthAt(layer,coord);
1850
- let P=worldAt(vec2f(coord)+vec2f(0.5),z);
1851
- let normal=surfaceNormalAt(coord);
1852
- let N=normalize(normal.xyz);
1853
- let V=viewToEye(P);
1854
- let w=surfaceLobeWordsAt(coord,flags);
1855
- lobes.on=false;
1856
- if((flags&${pa}u)!=0u){lobesAt(w,1.0,N,V,normal.a);}
1857
- let raw=surfaceTopOf(w,normal);
1858
- let top=vec4f(raw.xyz,reflectionSmoothed(raw.w));
1859
- if(lobes.on&&lobes.coat>0.0){
1860
-
1861
- // The pixel's lobes carry the biased roughness whole: the width the coat's light reads (\`coatAlpha\`, floored as \`setLobes\` floors it) follows it,
1862
- // the facing (\`coatNoV\`) does not depend on it.
1863
- lobes.coatRough=top.w;
1864
- let coatFloor=lobeRoughness(lobes.coatRough);lobes.coatAlpha=coatFloor*coatFloor;
1865
- }
1866
- return ReflectingPixel(P,N,V,normal.a,top.xyz,top.w,z,flags);
1867
- }`);var Uh=f("REFLECTION_STORED_RAY_WGSL",[Vh,de,Dn],`/** The ray of grid texel texel as the ray generation stored it, read as the storage it is written through: the lobe ray of its direction (unit again, the
1868
- * halves holding it to a thousandth, and read through the thin lobe lobeAlpha(0.0), the only part of the lobe a stage reads), its cone angle and
1869
- * whether its pixel is a first-person object's. The thread's own furthest distance and whether it reads the probe cache (reflectionLimit,
1870
- * reflectionCached) are the ones the texel's distance layer holds (REFLECTION_RAY_DISTANCE, probeCache/wgsl.ts): none for a ray the cache did not shorten. */
1871
- struct ReflectionStoredRay{ray:ReflectionLobeRay,cone:f32,firstPerson:bool,}
1872
- fn reflectionStoredRay(texel:vec2i)->ReflectionStoredRay{
1873
- let kept=bitcast<f32>(textureLoad(surfaceRays,texel,REFLECTION_RAY_DISTANCE).r);
1874
- reflectionLimit=abs(kept);
1875
- reflectionCached=kept<0.0;
1876
- let r=reflectionRayOf(textureLoad(surfaceRays,texel,REFLECTION_RAY_DIRECTION).r,textureLoad(surfaceRays,texel,REFLECTION_RAY_CONE).r);
1877
- return ReflectionStoredRay(ReflectionLobeRay(normalize(r.xyz),vec4f(0.0,0.0,0.0,lobeAlpha(0.0)),0.0,0.0),abs(r.w),r.w<0.0);
1878
- }`);var zh=A("weightedTonemap",[Ut],"fn weightedTonemap(c:vec3f,heavy:f32)->vec3f{return c/(1.0+heavy*luminance(c));}"),mO=A("weightedUntonemap",[Ut],"fn weightedUntonemap(c:vec3f,heavy:f32)->vec3f{return c/max(1.0-heavy*luminance(c),1e-4);}"),gO=A("youngShare",[],"fn youngShare(frames:f32,settled:f32)->f32{return 1.0-saturate(frames/settled);}"),vO=A("youngRadius",[],"fn youngRadius(tile:f32,frames:f32)->f32{return tile/sqrt(frames+1.0);}"),EO=A("youngTaps",[],"fn youngTaps(most:f32,least:f32,frames:f32)->u32{return u32(clamp(ceil(most/(frames+1.0)),least,most));}"),_O=A("edgeWeight",[],"fn edgeWeight(scale:f32,away:f32,across:f32)->f32{return exp2(scale*away*away)*across*across;}");var Yh=f("REFLECTION_TEXEL_WGSL",[hi,bi,Ut,zh,to,ve,Ge,ne(Q),_t(Q)],`/** The bit of \`y\` that tells a fresh texel's light is a mover's (\`freshMoves\`): the blue half's sign, which no light sets. */
1879
- const REFLECTION_FRESH_MOVER:u32=0x8000u;
1880
-
1881
- const REFLECTION_RESOLVED_LEFT:u32=0x8000u;
1882
-
1883
- const REFLECTION_RESOLVED_OWN:u32=0x80000000u;
1884
- fn texelRadiance(t:vec2u)->vec3f{return vec3f(unpack2x16float(t.x&~(REFLECTION_RESOLVED_LEFT|REFLECTION_RESOLVED_OWN)),unpack2x16float(t.y&~REFLECTION_FRESH_MOVER).x);}
1885
-
1886
-
1887
- fn texelWords(r:vec3f,high:u32)->vec4u{
1888
- let c=clamp(r,vec3f(0.0),vec3f(HALF_MAX));
1889
- return vec4u(pack2x16float(c.xy)&~(REFLECTION_RESOLVED_LEFT|REFLECTION_RESOLVED_OWN),(lowHalf(pack2x16float(vec2f(c.z,0.0)))&~REFLECTION_FRESH_MOVER)|(high<<16u),0u,0u);
1890
- }
1891
- fn resolvedLeft(t:vec2u)->bool{return (t.x&REFLECTION_RESOLVED_LEFT)!=0u;}
1892
- fn resolvedOwn(t:vec2u)->bool{return (t.x&REFLECTION_RESOLVED_OWN)!=0u;}
1893
- fn texelHalf(x:f32)->u32{return lowHalf(pack2x16float(vec2f(min(x,HALF_MAX),0.0)));}
1894
- fn texelHalfOf(w:u32)->f32{return unpack2x16float(lowHalf(w)).x;}
1895
- const REFLECTION_FRESH_VALID:u32=0x8000u;
1896
-
1897
- fn freshPack(r:vec3f,hit:f32,moves:bool)->vec4u{
1898
- let w=texelWords(r,texelHalf(min(hit,REFLECTION_DISTANCE_MAX))|REFLECTION_FRESH_VALID);
1899
- return vec4u(w.x,w.y|select(0u,REFLECTION_FRESH_MOVER,moves),0u,0u);
1900
- }
1901
- fn freshValid(t:vec2u)->bool{return ((t.y>>16u)&REFLECTION_FRESH_VALID)!=0u;}
1902
- fn freshMoves(t:vec2u)->bool{return (t.y&REFLECTION_FRESH_MOVER)!=0u;}
1903
- fn freshHit(t:vec2u)->f32{return texelHalfOf((t.y>>16u)&0x7fffu);}
1904
- fn historyPack(r:vec3f,depth:f32,moment:f32,count:f32,mover:bool,settled:u32)->vec4u{
1905
- let w=texelWords(r,texelHalf(depth));
1906
- return vec4u(w.xy,bitcast<u32>(moment),(texelHalf(count)&0x7fffu)|select(0u,0x8000u,mover)|(min(settled,0xffffu)<<16u));
1907
- }
1908
-
1909
-
1910
- fn historyValid(t:vec4u)->bool{return (t.y>>16u)!=0u;}
1911
- fn historyDepth(t:vec4u)->f32{return unpack2x16float(t.y>>16u).x;}
1912
- fn historyMoment(t:vec4u)->f32{return bitcast<f32>(t.z);}
1913
- fn historyCount(t:vec4u)->f32{return texelHalfOf(t.w&0x7fffu);}
1914
- fn historyMover(t:vec4u)->bool{return (t.w&0x8000u)!=0u;}
1915
- fn historySettled(t:vec4u)->u32{return t.w>>16u;}
1916
- fn reflectionToneScale()->f32{return select(0.0,view.preExposure.x/reflectionView.denoise.w,reflectionView.denoise.w>0.0);}
1917
- fn reflectionDenoised(c:vec3f)->vec3f{return weightedTonemap(c,reflectionToneScale());}
1918
- /** A radiance \`d\` of the denoiser's space turned back, the space holding no luminance past \`most\`, the brightest its rays bring
1919
- * back: a radiance of \`most\` lies at t = most\xB7s / (1 + most\xB7s) of the space's pole (s the tone scale), and a value at or past it \u2014 a
1920
- * resample's lobes may overshoot the brightest texel they weigh \u2014 turns back to a luminance of \`most\` exactly, its colour kept, never
1921
- * divided by the pole: the bound holds by construction, whatever reads it. */
1922
- fn reflectionLinearUnder(d:vec3f,most:f32)->vec3f{
1923
- let s=reflectionToneScale();
1924
- let t=luminance(d)*s;
1925
- let top=most*s/(1.0+most*s);
1926
- let k=select(1.0,top/t,t>top);
1927
- return d*k/(1.0-t*k);
1928
- }
1929
-
1930
- fn reflectionLinear(d:vec3f)->vec3f{return reflectionLinearUnder(d,reflectionView.light.x);}
1931
- /** The images a history of a lobe of roughness \`rough\` holds at most where it does not follow what a mirror shows (\`temporalMostImages\`):
1932
- * the setting's \`frames\`, lerped down to two as the roughness falls under \`REFLECTION_MIRROR_ROUGHNESS\` \u2014 never past the setting's: a
1933
- * setting of one image holds one. */
1934
- fn reflectionMaxFrames(frames:f32,rough:f32)->f32{return mix(min(2.0,frames),frames,saturate(rough/REFLECTION_MIRROR_ROUGHNESS));}
1935
- fn reflectionHistoryLaw(rough:f32,full:bool)->f32{
1936
- let most=reflectionView.denoise.x;
1937
- return select(most,reflectionMaxFrames(most,rough),full);
1938
- }
1939
- /** The tangent of the half angle of a lobe of roughness \`r\`: the angle that holds three quarters of the lobe's energy,
1940
- * r\xB2 \xB7 0.75 / 0.25. */
1941
- fn reflectionLobeTangent(r:f32)->f32{return 3.0*r*r;}
1942
-
1943
-
1944
- fn reflectionLobeFootprint(rough:f32,depth:f32,hit:f32)->f32{
1945
- let perspective=slabPerspective(reflectionView.slab);
1946
- return hit*reflectionLobeTangent(rough)/(reflectionView.slab.x*select(1.0,depth+hit,perspective));
1947
- }
1948
-
1949
-
1950
-
1951
- fn reflectionReuseRadius(rough:f32)->f32{
1952
- if(!(rough>REFLECTION_MIRROR_ROUGHNESS)||!reflectionDone(REFLECTION_RECONSTRUCTION)){return 0.0;}
1953
- let block=vec2f(reflectionBlock());
1954
- let radius=0.5*(block.x+block.y)*reflectionView.spread.x*saturate(rough*8.0);
1955
- return select(0.0,radius,radius>max(block.x,block.y));
1956
- }`);var qh={screen:[1,0,0],meshes:[0,1,0],scene:[0,0,1],cache:[0,1,1],distant:[1,1,1],nothing:[1,1,0],unsettled:[1,0,1]},Xh=Object.keys(qh),gv=e=>`REFLECTION_STAGE_${e.toUpperCase()}`,vv=Xh.reduce((e,t,r)=>e+(qh[t].reduce((o,a,n)=>o+a*2**n,0)<<3*r),0),Kh=f("REFLECTION_STAGE_VIEW_WGSL",[ve],`${D(Object.fromEntries(Xh.map((e,t)=>[gv(e),t])))}
1957
- const REFLECTION_STAGE_HUES:u32=${vv}u;
1958
- var<private> reflectionAnswered:u32=REFLECTION_STAGE_SCENE;
1959
- fn reflectionStageColour(stage:u32)->vec3f{
1960
- let hue=(REFLECTION_STAGE_HUES>>(3u*stage))&7u;
1961
- return vec3f(f32(hue&1u),f32((hue>>1u)&1u),f32((hue>>2u)&1u));
1962
- }
1963
- fn reflectionShownBy(radiance:vec3f,stage:u32)->vec3f{
1964
- if(!reflectionDone(REFLECTION_STAGE_VIEW)){return radiance;}
1965
- return reflectionStageColour(stage);
1966
- }`);var jh=$u({params:[62,"uniform"],bounceGrid:[63,"uniform"],cacheFinal:[65,"uint"],cacheRaw:[66,"uint"],cacheSky:[67,"float"]}),Zh=64,Ev="17u,59u",It=jh.at,Qh=e=>[...xf(jh.entries,It.cacheFinal,e),wu(Zh)],_v=f("PROBE_CACHE_COVERAGE_WGSL",[],`fn reflectionCacheCovered(P:vec3f,random:f32)->CacheCoverage{
1967
- let cover=cacheCoverage(P,random);
1968
- if(!cover.valid){return cover;}
1969
- let bottom=probeBottomCell(cover.level,P);
1970
- var held=true;
1971
- for(var lane=0u;lane<8u;lane++){
1972
- let cell=bottom+vec3i(vec3u(lane&1u,(lane>>1u)&1u,(lane>>2u)&1u));
1973
- if(cacheSlotOf(cover.level,cell)==0u){held=false;}
1974
- }
1975
- return CacheCoverage(cover.level,held,cover.minTrace);
1976
- }
1977
- fn reflectionStochasticProbe(random:f32){
1978
- var shares:array<f32,8>;
1979
- var held=0.0;
1980
- for(var lane=0u;lane<8u;lane++){
1981
- shares[lane]=select(spCacheShare(lane),0.0,cacheNow.corner[lane]==0u);
1982
- held+=shares[lane];
1983
- }
1984
- var sum=0.0;
1985
- var pick=7u;
1986
- for(var lane=0u;lane<8u;lane++){
1987
- sum+=shares[lane];
1988
- if(random*held<=sum&&shares[lane]>0.0){pick=lane;break;}
1989
- }
1990
- for(var lane=0u;lane<8u;lane++){
1991
- if(lane!=pick){cacheNow.corner[lane]=0u;}
1992
- }
1993
- cacheNow.alpha=vec3f(f32(pick&1u),f32((pick>>1u)&1u),f32((pick>>2u)&1u));
1994
- }`),Sv=f("probeCacheKernels",[],`fn cacheLimitsTexel(g:vec2u){
1995
- let texel=vec2i(g);
1996
- // A ray sent whole to the scene's triangles walks whole (\`reflectionRayWhole\`): what it meets is theirs alone to answer, never the cache's.
1997
- let depth=bitcast<f32>(textureLoad(surfaceRays,texel,REFLECTION_RAY_DEPTH).r);
1998
- if(!reflectionRayTraces(depth)||reflectionRayWhole(depth)){return;}
1999
- let coord=vec2i(reflectionPickedPixel(g));
2000
- let own=reflectingPixelAt(REFLECTION_LAYER,coord,surfaceFlagsAt(coord));
2001
- let bounds=reflectionView.cache;
2002
- let rough=own.top+blueNoiseScalar(g,reflectionView.temporal.x)*bounds.z;
2003
- if(rough<=bounds.x){return;}
2004
- let cover=reflectionCacheCovered(own.P,interleavedGradientNoise(vec2f(g),f32(reflectionView.temporal.z%8u)));
2005
- if(!cover.valid){return;}
2006
- let far=reflectionView.march.w;
2007
- let alpha=saturate((rough-bounds.x)/(bounds.y-bounds.x));
2008
- let reach=min(max(mix(reflectionView.cacheTrace.x,reflectionView.cacheTrace.y,alpha),cover.minTrace),far);
2009
- // The word's lowest bit is the scene stage's alone: set where the ray met nothing within its distance (\`traceSceneRay\`), it hands the ray to
2010
- // \`cacheReads\`. Kept clear here (the limit's last bit, a ten-millionth of it): left as the float's own, it was set at about one texel in two
2011
- // and the cache was laid over every such ray, whichever stage had met a surface on it \u2014 the wall at the foot of a rough plate read through
2012
-
2013
- textureStore(surfaceRays,texel,REFLECTION_RAY_DISTANCE,vec4u(bitcast<u32>(select(reach,-reach,reach<far*0.99))&~1u,0u,0u,0u));
2014
- }
2015
- fn cacheReadsTexel(g:vec2u){
2016
- sp=spBase;
2017
- // A reflection's ray reads each probe through the sphere of the reflections' own scale round it (\`ReflectionView.cache.w\`, the setting's
2018
- // \`reflectionProbeCacheReprojectionRadiusScale\`), not the view probes' (\`sp.cache.x\`, theirs).
2019
- sp.cache.x=reflectionView.cache.w;
2020
- let texel=vec2i(g);
2021
- if(!reflectionRayTraces(bitcast<f32>(textureLoad(surfaceRays,texel,REFLECTION_RAY_DEPTH).r))){return;}
2022
- let kept=textureLoad(surfaceRays,texel,REFLECTION_RAY_DISTANCE).r;
2023
- if((kept&0x80000001u)!=0x80000001u){return;}
2024
- let stored=reflectionStoredRay(texel);
2025
- let reach=reflectionLimit;
2026
- let coord=vec2i(reflectionPickedPixel(g));
2027
- let own=reflectingPixelAt(REFLECTION_LAYER,coord,surfaceFlagsAt(coord));
2028
- let R=stored.ray.R;
2029
- spCacheGatherFacing(own.P,own.N,interleavedGradientNoise(vec2f(g),f32(reflectionView.temporal.z%8u)));
2030
-
2031
-
2032
- if(reflectionView.cacheTrace.z!=0.0){reflectionStochasticProbe(blueNoiseScalar(g+vec2u(${Ev}),reflectionView.temporal.x));}
2033
- let size=1.0/sqrt(max(1.0-cos(stored.cone),1e-6));
2034
- let far=spFarOf(own.P,R,size);
2035
- let lit=far.radiance+reflectionSkylightLeak(vec3f(0.0));
2036
- textureStore(traceOut,texel,freshPack(reflectionShownBy(reflectionClampRay(reflectionFogged(lit,own.P,R*reach)),REFLECTION_STAGE_CACHE),reach,false));
2037
- }
2038
- @compute @workgroup_size(${J},${J})
2039
- fn cacheLimits(@builtin(workgroup_id) tile:vec3u,@builtin(num_workgroups) groups:vec3u,@builtin(local_invocation_id) local:vec3u){
2040
- let t=reflectionTileOf(tile,groups);
2041
- if(t==REFLECTION_NO_TILE){return;}
2042
- let id=reflectionTileOrigin(t)+local.xy;
2043
- if(all(id<reflectionGridSize())){cacheLimitsTexel(id);}
2044
- }
2045
- @compute @workgroup_size(${J},${J})
2046
- fn cacheReads(@builtin(workgroup_id) tile:vec3u,@builtin(num_workgroups) groups:vec3u,@builtin(local_invocation_id) local:vec3u){
2047
- let t=reflectionTileOf(tile,groups);
2048
- if(t==REFLECTION_NO_TILE){return;}
2049
- let id=reflectionTileOrigin(t)+local.xy;
2050
- if(all(id<reflectionGridSize())){cacheReadsTexel(id);}
2051
- }`),rR=e=>Dr(`@group(0) @binding(${F.lights}) var<storage,read> directLights:DirectLights;
2052
- @group(0) @binding(${F.traceOut}) var traceOut:texture_storage_2d<rg32uint,write>;
2053
- @group(0) @binding(${It.params}) var<uniform> spBase:ViewProbeParams;
2054
- var<private> sp:ViewProbeParams;`,[Sv,Of(),Qt,vu,Jt,_t(Q),Wu([1,1]),Ou(0,It.bounceGrid,Zh),Cu(It.cacheFinal,It.cacheRaw,It.cacheSky,"private",e),_v,ht,$c(0,F.blue,!0),Hh,Uh,Fh,Yh,Kh,go,$n,Pn(F.fogCubemap,F.fogSampler)]);var kn=w(e=>e.createBindGroupLayout({entries:xv(e)}));function xv(e){let t=mu(e),r=GPUShaderStage.FRAGMENT;return[...Zt(r,{depth:t?"pyramid":"level0",image:t,front:!1}).map(o=>o.binding===no||o.binding===io.params?{...o,visibility:GPUShaderStage.VERTEX|r}:o),...t?Qh(gu(e)).map(o=>({...o,visibility:r})):[]]}var Jh=(e,t)=>({format:j,writeMask:oo(e)?t&tf:t,blend:Ma[e]}),ed=(e,t,r,o=!1)=>[o&&au(e)?{...Jh(e,t),writeMask:0}:Jh(e,t),r?{format:st}:null,...o?rn(e):[null,null]],pR=()=>[{format:j,writeMask:0},{format:st}],Tv={color:ef,alpha:Ma.normal.alpha},wv=()=>[{format:j,blend:Tv}],mR=(e,t)=>[...wv(),e?{format:st}:null,...t?rn("normal"):[null,null]];var vR=(e,t,r=!1)=>e<<8|(r?128:0)|t;var Lo=["none","front","back"],bo=ni(Lo),rt=Lo.length,yo=Mr.length,Ct=e=>e%rt,td=e=>e*rt,rd=e=>Math.floor(e/rt),bv=ro.length*yo,Oo=(e,t)=>ro.indexOf(e)*yo+Mr.indexOf(t),Wn=e=>ro[Math.floor(e/yo)],Bn=e=>Mr[e%yo],yv=e=>Wn(rd(e)),wR=e=>Bn(rd(e)),LR=(e,t)=>td(Oo(e,t)),Mn=e=>oo(yv(e)),Vn=td(bv),Hn=e=>e>=Vn&&e<Un,od=(e,t)=>Vn+rt*(+e+2*+t),bR=e=>Hn(e)&&Math.floor((e-Vn)/rt)%2===1,yR=e=>e>=od(!1,!0)&&e<Un,Un=od(!1,!0)+2*rt,OR=e=>e>=Un,RR=e=>!!e.map||!!e.vertexColors||!!e.graph||e.baseColor[0]!==e.baseColor[1]||e.baseColor[1]!==e.baseColor[2],AR=e=>Ct(e&127),NR=A("planCull",[],`fn planCull(entry:u32)->u32{return (entry&${127}u)%${rt}u;}`);var Ov={translucency:e=>!Mn(e),modulation:Mn},ad=new WeakMap;function HR(e,t){let r=ad.get(e);return r||ad.set(e,r={}),r[t]??={at:(o,a)=>e.at(o,a),skips:o=>!!e.skips?.(o)||!Ov[t](o)}}var UR=1,re={view:so,depth:11,offsets:12,scene:13,sampler:14},zR=e=>Ll(e).dualSource;function YR(e,t,r,{entryPoint:o,writeMask:a},n,s=!1,i=!1){return Rv(e,l=>{let c=Wn(l),u=ed(c,a,n);return Ao(e,t,r,{module:t,entryPoint:o,constants:{...zr(n),...Qc(c),...Zl(Bn(l))},targets:s?u.slice(0,n?2:1):u},i,Ro(e))})}function Rv(e,t){let r=[],o=a=>r[a]??=t(a).map(n=>Re(e,n));return{at:(a,n)=>o(a)[n].get(),ask(a){for(let n of a)for(let s of o(n))s.ask()},async precompile(a){await Promise.all([...a].flatMap(n=>o(n).map(s=>s.prepare())))}}}var qR=e=>{let t=new Set;for(let r of e)t.add(r.transmissive?Oo("normal","forward"):Oo(r.surface.blending??"normal",Ql(r)));return[...t].sort((r,o)=>r-o)},Ro=(e,t)=>t?[kn(e),t]:[kn(e)];function Ao(e,t,r,o,a,n,s={format:Te,depthCompare:Il},i,l="vs"){let c=ii(e,[r,...n],i);return Lo.map(u=>({...i?{label:i}:{},layout:c,vertex:{module:t,entryPoint:l},fragment:o,primitive:{topology:"triangle-list",cullMode:u,frontFace:"ccw"},depthStencil:{...s,depthWriteEnabled:a}}))}var XR=(e,t,r,o,a,n,s)=>Ao(e,t,r,o,!1,a,void 0,n,s).map(i=>Re(e,i)),KR=(e,t)=>({at:r=>{let o=e()[Ct(r)];return o.start().ready?o.get():void 0},...t&&{skips:r=>!t(r)},start:()=>{for(let r of e())r.start()}}),jR=(e,t)=>({at:r=>e&&Hn(r)?e(r):t(r)});var Av=w(e=>e.createBindGroupLayout({label:"Trillion3D distortion accumulation",entries:[V(re.view,{},GPUShaderStage.FRAGMENT),N(re.depth,"depth","2d",GPUShaderStage.FRAGMENT)]})),nd=w(e=>e.createBindGroupLayout({label:"Trillion3D distortion apply",entries:[V(re.view,{},GPUShaderStage.FRAGMENT),N(re.offsets,"unfilterable-float","2d",GPUShaderStage.FRAGMENT),N(re.scene,"float","2d",GPUShaderStage.FRAGMENT),Tr(re.sampler,"filtering",GPUShaderStage.FRAGMENT)]})),No=w(e=>e.createBindGroupLayout({label:"Trillion3D empty",entries:[]})),n3=w(e=>e.createBindGroup({label:"Trillion3D empty",layout:No(e),entries:[]}));function sd(e,t,r,o,a=[]){let n=Tt();return(s,i,l)=>{let{identity:c}=n,{next:u}=c;if(u[0]=s,u[1]=i,u[2]=l,c.moved()||!n.group){let h=[{buffer:s},i,l];n.group=e.createBindGroup({label:t,layout:r(),entries:[...o.map((d,g)=>({binding:d,resource:h[g]})),...a]})}return n.group}}function s3(e,t,r){let o=sd(e,"Trillion3D distortion accumulation",()=>Av(e),[re.view,re.depth]),a=sd(e,"Trillion3D distortion apply",()=>nd(e),[re.view,re.offsets,re.scene],[{binding:re.sampler,resource:xr(e).clamped}]);return{apply:Re(e,li(e,t,[No(e),nd(e)],"fsDistortionApply",[{format:j}],"Trillion3D distortion apply",r)),distortionGroup:o,applyGroup:a}}var Ft=10,id={label:"Trillion3D water exclusion volumes",format:"rgba32uint",fields:{Texel:1},rowShift:8,layerShift:13},te=4,zn=()=>({binding:Ft,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"uint",viewDimension:"2d-array"}}),ur=w(e=>e.createBindGroupLayout({label:"Trillion3D water exclusion volumes",entries:[zn()]})),fr=4,Co=16,Io={allExceptListed:0,onlyListed:1},Nv=f("WATER_EXCLUSION_WGSL",[Pc(id,{name:"waterExclusions",group:nn,binding:Ft,access:"read"})],`fn waterExclusionRow(at:u32,p:vec4f)->f32{return dot(bitcast<vec4f>(waterExclusionsTexel(at,0u)),p);}
2055
- fn waterExcluded(P:vec3f,body:u32)->bool{
2056
- let head=waterExclusionsTexel(0u,0u);
2057
- let p=vec4f(P,1.0);
2058
- for(var v=0u;v<head.x;v++){
2059
- let at=${fr/te}u+v*${Co/te}u;
2060
- let local=vec3f(waterExclusionRow(at,p),waterExclusionRow(at+1u,p),waterExclusionRow(at+2u,p));
2061
- if(any(abs(local)>vec3f(0.5))){continue;}
2062
- let run=waterExclusionsTexel(at+3u,0u);
2063
- var listed=false;
2064
- let first=head.y+run.y;
2065
- let last=first+run.z;
2066
- for(var k=first;k<last;k++){
2067
- if(waterExclusionsTexel(k>>2u,0u)[k&3u]==body){listed=true;break;}
2068
- }
2069
- if(listed==(run.x==${Io.onlyListed}u)){return true;}
2070
- }
2071
- return false;
2072
- }
2073
- `),Iv=fr+4*Co,Fo=class{floats=new Float32Array(Iv);words=fa(this.floats);length=fr;revision=0;inverse=new xc;kept=[];inverses=new Float64Array(48);runs=[];seen=[];poses=new Float64Array(64);modes=[];listed=[];epoch=-1;unchanged(t,r){let{seen:o,poses:a,modes:n,listed:s}=this;if(r!==this.epoch||t.size!==o.length)return!1;let i=0;for(let l of t){if(ba(l),l!==o[i]||Io[l.mode]!==n[i])return!1;let c=l.matrixWorld.elements,u=l.bodies,h=s[i];for(let d=0;d<16;d++)if(c[d]!==a[i*16+d])return!1;if(u.length!==h.length)return!1;for(let d=0;d<h.length;d++)if(u[d]!==h[d])return!1;i++}return!0}note(t,r){this.seen[t]=r,this.poses.set(r.matrixWorld.elements,t*16),this.modes[t]=Io[r.mode],this.listed[t]=r.bodies.slice()}keepInverse(t,r){this.inverses=ue(this.inverses,12*(t+1));for(let o=0;o<3;o++)for(let a=0;a<4;a++)this.inverses[t*12+o*4+a]=r[a*4+o]}pack(t,r,o){if(this.unchanged(t,o))return!1;let{kept:a,inverse:n,runs:s}=this;a.length=s.length=this.seen.length=0,t.size*16>this.poses.length&&(this.poses=new Float64Array(t.size*32));let i=0,l=0;for(let y of t)if(ba(y),this.note(l++,y),n.copy(y.matrixWorld),n.determinant()!==0){n.invert(),this.keepInverse(a.length,n.elements),a.push(y);for(let z of y.bodies){let X=r(z);s.push(X),i+=X.length}}let c=fr+a.length*Co,u=c+i,h=m(u,te)*te;h>this.words.length&&(this.floats=new Float32Array(Math.max(h,this.words.length*2)),this.words=fa(this.floats));let{words:d,floats:g}=this;d.fill(0,0,h),this.length=u,d[0]=a.length,d[1]=c;let R=0,E=0;for(let y=0;y<a.length;y++){let z=a[y],X=fr+y*Co;for(let K=0;K<12;K++)g[X+K]=this.inverses[y*12+K];d[X+12]=Io[z.mode],d[X+13]=R;for(let K=0;K<z.bodies.length;K++)for(let oa of s[E++])d[c+R++]=oa;d[X+14]=R-d[X+13]}return this.epoch=o,this.revision++,!0}};function ld(e,t){let r=mc(e,id,m(t.length,te),GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC);return{records:r,sent:new Uint32Array(r.capacity*te)}}function cd(e,t){let{words:r,length:o}=t,{records:a}=e;if(!a.hold(m(o,te)))return;let n=e.sent=ue(e.sent,a.capacity*te),s=0,i=o-1;for(;s<o&&r[s]===n[s];)s++;if(s===o)return;for(;r[i]===n[i];)i--;let l=Math.floor(s/te),c=m(i+1,te);n.set(r.subarray(l*te,c*te),l*te);let u=r.byteOffset+l*te*4;a.writeTexels("Texel",l,c-l,r.buffer,u)}var Yn=e=>e==="texture",fd=e=>e==="foldedDepth",ud=e=>e==="folded"||e==="foldedDepth";function Go(e,t=!1){let{granted:r,spare:o}=we(e,t);return r.has("objectShadow")?"texture":o>=1?"packed":o>=0?"folded":t&&o>=-1?"foldedDepth":void 0}var S3=4096,x3=4096,T3=1,qn={atlas:53,packed:55},Cv=48,w3=Cv/4;var oe=ca("read-only-storage"),Xn=ca("uniform"),Fv=Ee("unfilterable-float","2d-array"),Kn={indices:["vertex",oe],positions:["vertex",oe],uvs:["vertex",oe],uniform:["both",Xn,"sized"],items:["vertex",oe],sampler:["fragment",{sampler:{type:"filtering"}}],normals:["vertex",Fv],directLights:["both",oe],planInstances:["vertex",oe],clusterSpans:["vertex",oe],shadowData:["fragment",oe],shadowAtlas:["fragment",oe],shadowSampler:["fragment",Xn],shadowPool:["fragment",oe],shadowView:["fragment",Xn],shadowNoise:["fragment",lt(Zr)],tileLights:["fragment",oe],frontTraced:["fragment",Ih],surfaceFlags:["fragment",lt(Kr)],fogCubemap:["both",Ee("float","cube")],fogVolume:["fragment",Ee("float","3d")],fogSampler:["both",{sampler:{type:"filtering"}}],fogTiles:["both",oe],lightPatternAtlas:["fragment",lt(Jf)],translucentLightVolume:["fragment",Ee("float","3d")],translucentBounce:["fragment",Ee("float","3d")],translucentBounceSampler:["fragment",{sampler:{type:"filtering"}}],lightProfileAtlas:["fragment",Ee("float","2d-array")],lightProfileSampler:["fragment",{sampler:{type:"filtering"}}],volumeCamera:["fragment",Ee("unfilterable-float","2d-array")],material:["both",{texture:{sampleType:"uint",viewDimension:"2d-array"}}],frame:["both",{buffer:{type:"uniform",minBindingSize:kc}}]},hd=Object.keys(Kn),dd=e=>ud(e)?hd.filter(t=>t!=="lightProfileAtlas"):hd;function pd(e,t=!1,r=!1,o,a=!1){let n={vertex:GPUShaderStage.VERTEX,fragment:GPUShaderStage.FRAGMENT,both:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT},s=t?n.both:n.fragment;return[...dd(o).map(i=>{let[l,c,u]=Kn[i],h=_[i],d=i==="sampler"&&t?n.both:n[l];return u?{binding:h,visibility:d,buffer:{...c.buffer,minBindingSize:e}}:{binding:h,visibility:d,...c}}),...Ga(_.color,s),...Ga(_.data),...r?tu(Ur,GPUShaderStage.FRAGMENT):[],...o?Gv(o):[],...a?[{binding:$a,visibility:n.fragment,...oe}]:[],...su(Pa,GPUShaderStage.VERTEX),...oi(Xt,GPUShaderStage.VERTEX)]}var Gv=e=>{let t=qn;return[...Yn(e)?[{binding:t.atlas,visibility:GPUShaderStage.FRAGMENT,...Ee("float","2d-array")}]:[],{binding:t.packed,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,...Ee("uint","2d-array")}]},Pv=(e,t)=>{let r=qn;return[...t?[me(r.atlas,()=>e.objectShadow?.atlas)]:[],me(r.packed,()=>e.objectShadow?.packed)]},$v=e=>{let t=Pa;return[Pe(t.block,()=>e.cloudShade?.block),me(t.map0,()=>e.cloudShade?.map),me(t.sampler,()=>e.cloudShade?.sampler)]},Dv=e=>{let t=Xt;return[Pe(t.block,()=>e.cloudFog?.block),me(t.colour,()=>e.cloudFog?.colour),me(t.depth,()=>e.cloudFog?.depth),me(t.sampler,()=>e.cloudFog?.sampler)]};function md(e,t=!1,r,o=!1){let a=()=>e.uniformSize;return[...dd(r).map(n=>{let[,s,i]=Kn[n],l=_[n];return s.buffer?Pe(l,()=>e[n],void 0,i?a:void 0):me(l,()=>e[n])}),...on(_.color,()=>e.textures?.color),...on(_.data,()=>e.textures?.data),...t?[me(Ur.atlas,()=>e.rectAtlas),me(Ur.sampler,()=>e.rectSampler)]:[],...r?Pv(e,Yn(r)):[],...o?[Pe($a,()=>e.shadowEdges)]:[],...$v(e),...Dv(e)]}var gd=e=>we(e).granted.has("pictures");var kv=10,vd=e=>qe(e,"vertex",kv);var _d=4,Y3=0,q3=1,X3=0,K3=1,j3=2,Z3=5,Q3=8,Sd=9,J3=256,e2=65504,t2=4294967295,r2=24,Wv=32,Bv=8,Mv=Wv*Bv,o2=0,a2=1,n2=2,s2=3,i2=4,Po=5,l2=5,xd=6,Vv=16,Zn=2+Vv*3,c2=4294967295,f2=2,Hv=8,Uv=1024,Ed=60,u2=(e,t,r,o,a)=>!!e&&e.pixels===t&&(r-e.frame<Ed||a&&o<Ed),h2=4,Qn=k("OitParams",[["pitch","u32"],["samples","u32"],["threshold","f32"],["pixels","u32"],["nodes","u32"],["cursor","u32"],["low","u32"]]),zv=e=>Math.max(Uv,m(e,Hv)),d2=(e,t)=>e*Math.max(0,Mv-t),p2=(e,t)=>_d+e*(Sd+t*Po),jn=(e,t,r,o)=>e*(t-r)*Po+o*xd+Zn,Yv=(e,t,r)=>{let o=r/4-_d-e*Sd;return o<0?-1:Math.min(t,Math.floor(o/(e*Po)))},Td=(e,t,r,o)=>Math.floor((o/4-e*(t-r)*Po-Zn)/xd),m2=(e,t,r)=>{for(let o=Math.floor(Math.sqrt(t));o>0;o--){let a=o*o,n=Yv(e,a,r);if(n>=0&&Td(e,a,n,r)>=zv(e))return a}return 0};function g2(e,t,r,o,a){return{draw:s=>{let i=As(Td(e,t,r,s),a,o);return{nodes:i,budgetBytes:s,allocatedBytes:jn(e,t,r,i)*4,clamp:i<=a?"minimum":null}},bytes:jn(e,t,r,Math.max(a,o))*4}}var v2=(e,t,r,o)=>(jn(e,t,r,o)-Zn)*4;function E2(e,t,r,o,a,n,s,i){let l=Qn.at;return e.u[l.pitch]=t,e.u[l.samples]=o,e.f[l.threshold]=s,e.u[l.pixels]=r,e.u[l.nodes]=n,e.u[l.cursor]=i,e.u[l.low]=a,e}var hr=10,qv=(e,t)=>we(e,!0).granted.has("collect")||t&&fd(Go(e,!0)),Xv=(e,t=!1)=>qe(e,"fragment",hr)&&qv(e,t),Kv=(e,t,r=!1)=>e&&!!t&&Xv(t,r);function b2(e,t,r=!1){let o=Kv(e,t,r);if(e&&t&&!o){let{bound:a,spare:n}=we(t,!0);jv(t,"device",qe(t,"fragment",hr)?`sortedTranslucentPixels asks ${a} sampled textures a fragment stage and the device binds ${a+n}: the layers stay blended in drawing order`:`sortedTranslucentPixels asks ${hr} storage buffers a fragment stage and the device binds ${Tf(t,"fragment")}: the layers stay blended in drawing order`)}return o}var wd={minBindingSize:Qn.words*4},y2=w(e=>{let t=e.createBindGroupLayout({label:"Trillion3D sorted translucency combine",entries:[v(0,"storage",GPUShaderStage.FRAGMENT),V(1,wd,GPUShaderStage.FRAGMENT),v(3,"storage",GPUShaderStage.FRAGMENT)]});return{collect:e.createBindGroupLayout({label:"Trillion3D sorted translucency collect",entries:[v(0,"storage",GPUShaderStage.FRAGMENT),V(1,wd,GPUShaderStage.FRAGMENT),N(2,"depth","2d",GPUShaderStage.FRAGMENT),v(3,"storage",GPUShaderStage.FRAGMENT)]}),combine:t,foldedCollect:t}}),Ld={samples:new WeakSet,memory:new WeakSet,device:new WeakSet};function jv(e,t,r){Ld[t].has(e)||(Ld[t].add(e),console.warn(`[trillion3d] sorted translucency: ${r}`))}var Zv=[["viewProj","mat4x4f"],["camPos","vec4f"],["viewRight","vec4f"],["viewUp","vec4f"],["clipW","vec4f"],["lightTiles","vec2f"],["viewFlags","u32"],["vertexShift","u32"],["feedback","u32"],["roughDiffuse","u32"],["shadingAccurate","u32"],["viewport","vec2f"],["eye","vec3f"],["pixelRatio","f32"],["mipBias","f32"],["exposure","f32"],["preExposure","f32"],["toneCurve","u32"],["pixelError","f32"],["time","f32"],["realTime","f32"],["coatLayerNormal","u32"],["clipPlane","vec4f"],["bake",{wgsl:kr.name,words:kr.words,align:kr.align}],["volumeCorner",Vt(2)],["volumeScale",Vt(2)],["volumeRead","vec4f"],["giGrid","vec4f"],["giZ","vec4f"],["holdout","u32"],["volumeCamera","u32"],["volumeCameraFactor","f32"],["normalCurvature","vec3f"],["reduced","vec2f"],["lightView","u32"],["frontLit","u32"]],Jn=k("BlendView",Zv),F2=Jn.at,$o=Jn.words*4,G2=wl("uni.preExposure"),P2=Rl("uni.preExposure*uni.exposure"),bd=f("BLEND_VIEW_WGSL",[yl],Jn.wgsl);var Qv=8,Od=(e,t)=>qe(e,"fragment",(t?hr:Qv)+1),Rd=new WeakSet,es=e=>!!e&&Rd.has(e),Ad=new WeakMap,ts=e=>Ad.get(e);function yd(e,t,r,o){let a=vd(e),n=pd($o,a,t,r,o),s=e.createBindGroupLayout({entries:n});return Ad.set(s,n),o&&Rd.add(s),s}function Nd(e,t,r){let o=yd(e,!0,t,r),a=gd(e);return{full:o,filtered:a?o:yd(e,!1,t,r),pictures:a}}var Jv=it((e,t)=>Nd(e,void 0,t)),eE=(e,t)=>Jv(e,t),tE=it((e,t)=>{let r=Go(e,t);if(r)return{...Nd(e,r,Od(e,t)),read:r}}),z2=(e,t,r=!1)=>(t?tE(e,r):void 0)??{...eE(e,Od(e,r)),read:void 0};var rE=4;function Do(e){let t=Ic(e.gpu),{viewGroups:r}=e.blendState,o=r.get(t);return o||r.set(t,o={identity:nu(rE),sharedGroups:[],filteredGroups:[],waterGroups:{shade:[],composite:[]},edges:!1}),o}function Id(e){return md(Df({indices:()=>e.gpu.cache?.buffer,positions:()=>e.vis.concatPos,uvs:()=>e.vis.concatUv,uniform:()=>e.blendState.viewBuffer,uniformSize:()=>$o,items:()=>e.blendState.itemBuffer,textures:()=>e.vis.textures,sampler:()=>e.vis.mapsSampler,normals:()=>e.vis.concatNrm,planInstances:()=>e.blendState.expandedBuffer??e.gpu.zeroUv,clusterSpans:()=>e.blendState.compaction?.spanBuffer??e.gpu.zeroUv,directLights:()=>e.blendState.lighting?.directLights,shadowData:()=>e.blendState.lighting?.shadowData,shadowAtlas:()=>e.blendState.lighting?.shadowAtlas,shadowSampler:()=>e.blendState.lighting?.shadowSampler,shadowPool:()=>e.blendState.lighting?.shadowPool,shadowView:()=>e.blendState.lighting?.shadowView,shadowNoise:()=>e.blendState.lighting?.shadowNoise,shadowEdges:()=>e.blendState.lighting?.shadowEdges,tileLights:()=>e.blendState.lighting?.tileLights,frontTraced:()=>e.blendState.lighting?.frontTraced,surfaceFlags:()=>e.blendState.lighting?.surfaceFlags,fogCubemap:()=>e.blendState.lighting?.fogCubemap,fogVolume:()=>e.blendState.lighting?.fogVolume,fogSampler:()=>e.blendState.lighting?.fogSampler,fogTiles:()=>e.blendState.lighting?.fogTiles,lightPatternAtlas:()=>e.blendState.lighting?.lightPatternAtlas,translucentLightVolume:()=>e.blendState.lighting?.translucentLightVolume,translucentBounce:()=>e.blendState.lighting?.translucentBounce,translucentBounceSampler:()=>e.blendState.lighting?.translucentBounceSampler,lightProfileAtlas:()=>e.blendState.lighting?.lightProfileAtlas,lightProfileSampler:()=>e.blendState.lighting?.lightProfileSampler,rectAtlas:()=>e.blendState.lighting?.rectAtlas,rectSampler:()=>e.blendState.lighting?.rectSampler,volumeCamera:()=>e.blendState.lighting?.volumeCamera,objectShadow:()=>e.blendState.lighting?.objectShadow,cloudShade:()=>e.blendState.lighting?.cloudShade,cloudFog:()=>e.blendState.lighting?.cloudFog,material:()=>e.vis.materialTable.view,frame:()=>e.gpu.device&&e.vis.graphFrame.bufferOn(e.gpu.device)}),!0,e.vis.blendPipelines?.objectShadowRead,es(e.vis.blendBindGroupLayout))}function Cd(e,t,r,o,a){let n=Do(e).identity.entries[0]??=Id(e);return t.createBindGroup({label:a,layout:r,entries:n.filter(o)})}function J2(e,t){let{vis:r,blendState:o}=e,a=Do(e),{identity:n,sharedGroups:s,filteredGroups:i,waterGroups:l}=a;o.lighting=t;let c=es(r.blendBindGroupLayout);if((a.read!==r.blendPipelines?.objectShadowRead||a.edges!==c)&&(a.read=r.blendPipelines?.objectShadowRead,a.edges=c,n.entries.length=0),n.entries[0]??=Id(e),!n.entriesMoved(r.blendBindGroupLayout))return;let{slot:u}=n;s[u]=void 0,i[u]=void 0,l.shade[u]=l.composite[u]=void 0}var oE=new Set([..._.color.lanes,_.color.pages,..._.data.lanes,_.data.pages]),aE=new Set([_.fogVolume,_.translucentLightVolume,_.volumeCamera]);function nE(e,t){if(e==="composite")return oE.has(t.binding)||t.visibility===GPUShaderStage.VERTEX?void 0:t;if(aE.has(t.binding))return;if(t.binding!==_.fogCubemap)return t;let r=t.visibility&GPUShaderStage.VERTEX;return r?{...t,visibility:r}:void 0}var Gd=(e,t)=>t.flatMap(r=>{let o=nE(e,r);return o?[o]:[]}),Fd=new WeakMap;function ko(e,t,r){let o=ts(t);if(!o)return t;let a=Fd.get(t);return a||Fd.set(t,a={}),a[r]??=e.createBindGroupLayout({label:`Trillion3D water ${r} blend`,entries:Gd(r,o)})}function aA(e,t,r){let{identity:o,waterGroups:a}=Do(e);return a[r][o.slot]??=sE(e,t,r)}function sE(e,t,r){let o=e.vis.blendBindGroupLayout,a=ts(o),n=a&&new Set(Gd(r,a).map(s=>s.binding));return Cd(e,t,ko(t,o,r),s=>!n||n.has(s.binding),`Trillion3D water ${r} blend`)}var Pd={exclusion:!1,objectShadow:!1},iE=Object.keys({exclusion:0,objectShadow:0,oit:0});function sA(e,t,r=!0){for(let o of iE)if((r||o!=="exclusion")&&!!e[o]!=!!t[o])return!1;return!0}var lE=()=>[{binding:L.params,visibility:pu,buffer:{type:"uniform"}},{binding:L.color,visibility:se.fragment,texture:{sampleType:"float"}},{binding:L.depth,visibility:se.fragment,texture:{sampleType:"unfilterable-float"}},{binding:L.mask,visibility:se.fragment,texture:{sampleType:"float"}},{binding:L.point,visibility:se.fragment,sampler:{type:"non-filtering"}},{binding:L.normals,visibility:se.fragment,texture:{sampleType:"float"}},{binding:L.specular,visibility:se.fragment,texture:{sampleType:"uint"}},{binding:L.waterDepth,visibility:se.fragment,texture:{sampleType:"depth"}},{binding:L.tiles,visibility:se.vertex,buffer:{type:"read-only-storage"}},{binding:L.sun,visibility:se.fragment,texture:{sampleType:"float"}}],cE={shade:new Set([L.params,L.color,L.depth,L.mask,L.point]),composite:new Set([L.params,L.depth,L.mask,L.point,L.normals,L.specular,L.waterDepth,L.tiles,L.sun])},rs=(e,t=!1)=>[...lE().filter(r=>cE[e].has(r.binding)),...e==="shade"&&t?[zn()]:[]],fE=w(e=>e.createBindGroupLayout({label:"Trillion3D water shade",entries:rs("shade")})),uE=w(e=>e.createBindGroupLayout({label:"Trillion3D water shade",entries:rs("shade",!0)})),hE=w(e=>e.createBindGroupLayout({label:"Trillion3D water composite",entries:rs("composite")})),Wo=(e,t,r=!1)=>t==="composite"?hE(e):(r?uE:fE)(e),dE=(e,t)=>[{format:j},e?{format:st}:null,{format:Lt},{format:Xe},...t?[{format:bt}]:[]];function pE(e,t,r){let o=ko(e,r,"composite"),a=[...Ro(e),Wo(e,"composite")],n={format:j,blend:{color:rf,alpha:Jc}},s=e.createPipelineLayout({bindGroupLayouts:[o,...a]});return[!1,!0].map(i=>Re(e,{label:"Trillion3D water composite",layout:s,vertex:{module:t,entryPoint:i?"waterTileVertex":"fullscreen"},fragment:{module:t,entryPoint:"fsWaterComposite",targets:[n]},primitive:{topology:"triangle-list"}}))}function mE(e,t,r,o,a,n=Pd){let{exclusion:s}=n,i=(E,y,z,X,K)=>Ao(e,t,X,{module:t,entryPoint:E,constants:zr(o),targets:y},z,K).map(oa=>Re(e,oa)),l=i("fsWaterDepth",[],!0,r,s?[No(e),ur(e)]:[]),c=dE(o,a),u=ko(e,r,"shade"),h=[...Ro(e),Wo(e,"shade",s)],d=[i("fsWater",c,!1,u,h),i("fsWater",c,!0,u,h)],g=pE(e,t,r),R=[...l,...d.flat(),...g];return{separate:a,exclusion:s,depth:E=>l[Ct(E)].get(),shade:(E,y)=>d[+y][Ct(E)].get(),composite:E=>g[+E].get(),programs:R,prepare:()=>Promise.all(R.map(E=>E.prepare()))}}function $d(e,t,r,o,a,n){let s=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,i={width:m(t,o),height:m(r,o)},l={width:t,height:r},c=(u,h,d,g=l)=>e.createTexture({label:`Trillion3D water ${u}`,size:g,format:h,usage:d});return{sceneColor:c("scene color",j,s,i),sceneDepth:c("scene depth",ho,s,i),waterDepth:c("depth",Te,s|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,a),mask:c("refraction mask",po,s),normals:c("normals",Lt,s),specular:c("specular",Xe,s),sun:n?c("sun",bt,s):void 0}}var Dd=e=>({sceneColor:e.sceneColor.createView(),sceneDepth:e.sceneDepth.createView(),waterDepth:e.waterDepth.createView({aspect:"depth-only"}),mask:e.mask.createView(),normals:e.normals.createView(),specular:e.specular.createView(),sun:e.sun?.createView()});function kd(e,t,r){let o=(u,h,d)=>e.createBuffer({label:`Trillion3D water ${u}`,size:Math.max(h,16),usage:d}),a=t*r,n=o("tile mask",m(a,32)*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST),s=o("tile list",a*4,GPUBufferUsage.STORAGE),i=o("tile arguments",16,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC);e.queue.writeBuffer(i,0,new Uint32Array([6,0,0,0]));let l=o("tile dispatch",12,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT),c=o("tile count",4,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST);return{tileMask:n,tileList:s,tileArgs:i,tileDispatch:l,tileCount:c}}var Bo=e=>e.context.waterGate?.drawn!==!1&&B(e,"thinWater");function gE(e,t,r,o,a,n){let s=$d(e,t,r,o,a,n),i=m(t,wt),l=m(r,wt),{tileMask:c,tileList:u,tileArgs:h,tileDispatch:d,tileCount:g}=kd(e,i,l),R=e.createBuffer({label:"Trillion3D water view",size:jt*4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),E=new Float32Array(jt),y=Dd(s),z={width:t,height:r,factor:o,tilesAcross:i,tilesDown:l,...s,views:y,tileMask:c,tileList:u,tileArgs:h,tileDispatch:d,tileCount:g,params:R,paramWords:E,paramInts:new Uint32Array(E.buffer),depthAheadFor:-1,written:!1,separate:!1,masked:!1,watch:Ws(gf)};return z.shadeGroup=os(e,z),z}var os=(e,t,r)=>e.createBindGroup({label:"Trillion3D water shade",layout:Wo(e,"shade",!!r),entries:[{binding:L.params,resource:{buffer:t.params}},{binding:L.color,resource:t.views.sceneColor},{binding:L.depth,resource:t.views.sceneDepth},{binding:L.mask,resource:t.views.mask},{binding:L.point,resource:xr(e).point},...r?[{binding:Ft,resource:r}]:[]]}),Wd=(e,t)=>{let{sceneColor:r,sceneDepth:o,waterDepth:a,mask:n,normals:s,specular:i,sun:l}=e;for(let c of[r,o,a,n,s,i])t(c);l&&t(l);for(let c of[e.tileMask,e.tileList,e.tileArgs,e.tileDispatch,e.tileCount,e.params])t(c)};function vE(e,t){let r=e.waterTargets;return r?(Wd(r,o=>Z(t,o)),e.waterTargets=void 0,!0):!1}function EE(e){e.waterTargets&&Wd(e.waterTargets,t=>t.destroy()),e.waterTargets=void 0,e.waterTable?.held.records.destroy(),e.waterTable=void 0}var We=e=>e.blendState.waterItems.length>0&&Bo(e),_E=e=>We(e)&&B(e,"thinWaterDepthPrepass"),Mo=e=>B(e,"thinWaterShadersSupportFieldShadow")||B(e,"thinWaterShadersSupportPagedShadowFiltering");function kA(e,t){let[r,o]=e.gpu.targetSize,a=B(e,"thinWaterRefractionDownsample"),{depthTexture:n}=e.gpu,s=e.blendState.waterTargets;if(s&&s.width===r&&s.height===o&&s.factor===a&&s.waterDepth.width===n.width&&s.waterDepth.height===n.height)return s;vE(e.blendState,t);let i={width:n.width,height:n.height};return e.blendState.waterTargets=gE(t,r,o,a,i,Mo(e))}function SE(e){let t=e.blendState.waterTargets;return t?.depthAheadFor===e.run.frame?t.views.waterDepth:void 0}var Vd=e=>!!e.retired||!!e.hidden||_a(e.placement),xE=e=>e[0]?.drawSource?.node,TE=e=>e.sources,wE=(e,t)=>e?.[t]??void 0,Be=e=>xE(e.pages)??(e.placement&&wE(TE(e.placement.rows),e.placement.index)),LE=e=>((e.mark??0)&(Ta|sl))===Ta;function Bd(e,t,r,o=!1,a){a?.note(t,e);let n=!!e.retired||!!e.hidden&&!LE(e)||_a(e.placement),s=n!==!!e.parked;return!s&&!o?!1:(e.parked=n,Ea(t),r?.(t,e),s)}var bE=e=>e.drawSource?.node,Gt=e=>bE(e)??e.placement?.rows.sources?.[e.placement.index]??void 0;function Md(e,t,r,o){let a,n=!1,s=o?.ranks,i=o?o.count:e.length;for(let l=0;l<i;l++){let c=s?s[l]:l,u=e[c],h=t(u);h&&(h!==a&&(a=h,n=!fl(h,null,!0)),n!==!!u.hidden&&(u.hidden=n,Ea(c),r(u,c)))}}function UA(e,t,r,o,a){Md(e,i=>i.placement?void 0:Be(i),(i,l)=>Bd(i,l,r,!1,a),o?.roots);let n=o?.roots.ranks,s=o?o.roots.count:e.length;for(let i=0;i<s;i++){let l=n?n[i]:i,c=e[l],u=Be(c);c.placement||!u||!cl(c,ll(u),l)||Bd(c,l,r,!0,a)}Md(t.entries,t.sourceOf,(i,l)=>t.flipped?.(i,l),o?.seeThrough)}var Hd=A("sceneVsOut",[],`fn sceneVsOut(raw:VSOut)->VSOut{
2074
- var scene=raw;
2075
- scene.position=vec4f(raw.position.xy/uni.reduced,raw.position.z,raw.position.w);
2076
- return scene;
2077
- }`),qA=(e,t,r="")=>`@fragment fn ${e}(in:VSOut,@builtin(front_facing) front:bool)->${t}{${r}return ${e}Body(sceneVsOut(in),front);}`,XA=(e,t)=>`fn ${e}Body(in:VSOut,front:bool)->${t}`;var yE=8*Cs*2**10,Ud=2**-4,Vo=3,dr=30,Pt=(1<<dr)-1,Ho=f("FACING_WGSL",[eo,jc,Qr,Bc,Mc],`
2078
- fn vertexFacing(cull:u32,world:mat4x4f,page:PageInfo,h:ClusterHeader,corners:vec3u)->u32{
2079
- var c:array<vec3f,3>;
2080
- var p:array<vec2f,3>;
2081
- var inside=true;
2082
- for(var k=0u;k<3u;k++){
2083
- let q=uni.viewProj*(world*vec4f(pagePosition(page,h,corners[k]),1.0));
2084
- c[k]=q.xyw;
2085
- p[k]=perspectiveDivide(q).xy*uni.viewport*uni.reduced*0.5;
2086
- inside=inside&&q.w>0.0&&all(abs(q.xy)<=vec2f(q.w))&&q.z>=0.0&&q.z<=q.w;
2087
- }
2088
- let t0=c[0].x*c[1].y*c[2].z;let t1=-c[0].x*c[2].y*c[1].z;let t2=-c[1].x*c[0].y*c[2].z;
2089
- let t3=c[1].x*c[2].y*c[0].z;let t4=c[2].x*c[0].y*c[1].z;let t5=-c[2].x*c[1].y*c[0].z;
2090
- let area=t0+t1+t2+t3+t4+t5;
2091
- let bound=abs(t0)+abs(t1)+abs(t2)+abs(t3)+abs(t4)+abs(t5);
2092
- let e1=p[1]-p[0];let e2=p[2]-p[0];
2093
- let pixels=abs(edgeFunction(p[0],p[1],p[2]));
2094
- let edges=abs(e1.x)+abs(e1.y)+abs(e2.x)+abs(e2.y);
2095
- if(!inside||!(abs(area)>${yE}*bound)||!(pixels>${Ud}*(2.0*edges+${8*Ud}))){return cull;}
2096
- if(cull==${bo.front}u){return select(0u,${Vo}u,area>=0.0);}
2097
- return select(0u,${Vo}u,area<0.0);
2098
- }
2099
- fn facingDiscarded(mode:u32,front:bool)->bool{return (mode==${bo.front}u&&front)||(mode==${bo.back}u&&!front);}
2100
- `);var zd=1<<28,Yd=1<<29,qd=1<<30,hN=zd|Yd|qd,OE=e=>(e.firstPerson?Zi:0)|(e.holdout?Ir:0)|(e.castContactShadow?0:Qi)|(e.castCapsuleIndirectShadow?el:0)|(e.mobility==="movable"?va:0)|Us(e.lightGroups)<<Ji|(e.ownerNoSee?Yd:0)|(e.onlyOwnerSee?qd:0)|(e.visibleInReflections?0:zd),RE={evaluate:!0,velocity:!0,disable:0,centre:[0,0,0],most:0,worn:!1,always:!1,cache:"auto",bits:0,markedDepth:0,order:0},AE={},NE=e=>e?.placedSwitches??al(e??AE),dN=e=>nl(e)||!!e.placedSwitches;function IE(e){for(let t=e;t;t=t.parent)if(wc(Tc(t)))return!0;return!1}function Xd(e,t,r,o=NE(e),a=IE(e)){return{evaluate:o.evaluate,velocity:o.writesVelocity,disable:o.disableDistance,centre:t,most:r?.most??0,worn:!!r,always:r?.always===!0,cache:o.shadowCache,bits:OE(o)|(a?va:0),markedDepth:ol(o.renderMarkedDepth,o.markedDepthStencilValue,o.markedDepthStencilWriteMask),order:e?.renderOrder??0}}function Kd(e,t,r,o,a,n=RE){let s=a.wpo!==0&&(n.evaluate||(a.wpo&dl)!==0);e[o+r.wpo]=s?a.wpo|(n.velocity?hl:0):0,t[o+r.wpoDisableSq]=s?n.disable*n.disable:0;for(let i=0;i<3;i++)t[o+r.wpoCentre+i]=s?n.centre[i]:0;t[o+r.wpoMost]=s?Math.max(n.most,a.wpoMost):0}function as(e,t,r){let o=e.sourceGeometry?.boundingBox;return e.pageBox?t.set(e.pageBox,r):o&&Lc(o,t,r),!!(e.pageBox||o)}function CE(e){let t=e.worldBox;if(t){if(!as(e,t,0)){e.bounds=void 0;return}Ds(t,0,t,0,e.matrix.elements),e.bounds=!Ps(t,0)&&Tl(t)?t:void 0}}function TN(e){let t=e.blendGpu,r=t.length,o=e.boxPosesHeld,a=e.planWindings=ue(e.planWindings,r),n=e.boxPoses=ue(e.boxPoses,r*16),s=e.keyStale=ue(e.keyStale,r),i=!1;for(let l=0;l<r;l++){let c=t[l];if(c.left)continue;let u=c.matrix.elements,h=l*16;if(c.worldBox&&l<o&&c.pageBox&&ks(n,u,h))continue;let d=+Ks(u);i||=d!==a[l],a[l]=d,c.worldBox&&(CE(c),Fs(n,u,h),s[l]=1)}return e.boxPosesHeld=r,i}var jd=[["world","mat4x4f"],["vertexBase","u32"],["flags","u32"],["deform","u32"],["material","u32"],["wpo","u32"],["wpoDisableSq","f32"],["wpoMost","f32"],["placement","u32"],["wpoCentre","vec3f"],["opacityClip","f32"]],is=k("BlendItem",jd),FE=[["random","f32"],["fade","u32"]],ls=k("BlendItem",[...jd,...FE]),G=ls.at,GE=is.words,UN=e=>e?ls.words:is.words,zN=G.flags,YN=G.material,qN=G.deform,XN=G.wpo,$t=4294967295,Yo=65535,mr=Math.log2(Yo+1),cs=1<<mr+Ht,fs=mr+Ht+1,qo={shift:28,mask:15},PE=({placement:e})=>{let t=$r(Gr(e));return _c(Ec.none,t)<<qo.shift>>>0},$E=(e,t)=>!!t?.get(e.sourceGeometry.attributes)?.hasExtraUv,Uo={lobed:1,responsive:2,channelled:4,passShift:3},DE=(e,t)=>{let r=Xr(e,void 0,t);return qr(r)&&Yt(r.compiled.uses.sets)!==0},kE=e=>e.drawSource?.node??e.placement?.rows.sources?.[e.placement.index]??void 0,ns=new Float64Array(6),pr=[0,0,0],ss={most:0,always:!1};function Zd(e){let t=e.surface,r=kE(e);if(pr[0]=pr[1]=pr[2]=0,as(e,ns,0))for(let o=0;o<3;o++)pr[o]=(ns[o]+ns[3+o])/2;return ss.most=Math.max(t.maxWorldPositionOffset??0,0),ss.always=t.alwaysEvaluateWorldPositionOffset===!0,Xd(r,pr,ss)}var WE=(e,t)=>Di(e)||ec(e,gt)!==0||DE(e,t);function KN(e,t,r,o,a,n=GE){let s=r*n,i=o.surface,l=WE(i,Cl(a));e.set(o.matrix.elements,s+G.world),t[s+G.vertexBase]=o.vertexBase??0;let c=a.materialTable.surface(i,a),{flags:u}=pc(c.row,o.geometry,a.textures),h=Nl(i)?u>>>El&Fr:0,d=Zd(o),g=tl(d.bits);t[s+G.flags]=o.flags|u&Yo|h<<mr|(d.bits&Ir?cs:0)|g<<fs|PE(o),t[s+G.deform]=a.deformation?.wordOfWorld(o.matrix)??0,t[s+G.placement]=a.deformation?.rankOfWorld(o.matrix,$t)??$t,t[s+G.material]=vc(c.rank,$E(o,a.geometryBlocks)),Kd(t,e,G,s,c.row,d);for(let E=0;E<3;E++)e[s+G.wpoCentre+E]=d.centre[E];let R=bc(i.translucencyPass);return e[s+G.opacityClip]=uc(i),(l?Uo.lobed:0)|(h?Uo.responsive:0)|(g?Uo.channelled:0)|R<<Uo.passShift}var zo=new Float32Array(3);function jN(e,t,r,o,a){let{placement:n}=o,s=Math.fround(Sa(n)),i=a[xa(n)]??0,l=t[r+G.fade]!==0,c=e[r+G.random]!==s||t[r+G.fade]!==i;if(e[r+G.random]=s,t[r+G.fade]=i,i)rl(n,zo);else if(l)zo.set(Zd(o).centre);else return c;for(let u=0;u<3;u++)c||=e[r+G.wpoCentre+u]!==zo[u],e[r+G.wpoCentre+u]=zo[u];return c}var ZN=({placement:e})=>Sa(e)!==0||xa(e)!==0,Qd=f("BLEND_ITEM_WGSL",[],is.wgsl),Jd=f("BLEND_COPY_ITEM_WGSL",[],ls.wgsl);var ep=(e,t)=>f(e,[bd,t,Fe(_.material),Wc(_.normals),Qr,Hc],`@group(0) @binding(${_.indices}) var<storage, read> indices:array<u32>;
2101
- @group(0) @binding(${_.positions}) var<storage, read> positions:array<f32>;
2102
- @group(0) @binding(${_.uvs}) var<storage, read> uvs:array<f32>;
2103
- @group(0) @binding(${_.uniform}) var<uniform> uni:BlendView;
2104
- @group(0) @binding(${_.items}) var<storage,read> items:array<BlendItem>;
2105
- `),tp=ep("VERTEX_READS_WGSL",Qd),rp=ep("VERTEX_READS_COPY_WGSL",Jd),op=f("VERTEX_LISTS_WGSL",[yc,Jl],`@group(0) @binding(${_.planInstances}) var<storage,read> planInstances:array<vec2u>;
2106
- @group(0) @binding(${_.clusterSpans}) var<storage,read> clusterSpans:array<vec4u>;
2107
- fn clusterIdentity(entry:u32)->u32{return clusterSpans[arrayLength(&clusterSpans)*4u/5u+(entry>>2u)][entry&3u];}
2108
- `),I={tri:"words.x",diagId:"words.y",material:"words.z"},mI="words.w",gr=16,us=gt.length,Ko=gr+us,jo=Ko+Vs,hs=jo+Ht,ds=hs+1,ap=Object.values(zt).reduce((e,t)=>e|t,0),Dt=e=>`(((in.${I.tri}>>${ds}u)&${zt[e]}u)!=0u)`,np=A("blendChannelsOf",[Ol],`fn blendChannelsOf(in:VSOut)->u32{return storedToChannels(in.${I.tri}>>${Ko}u);}`),sp=f("BLEND_RESPONSIVE_WGSL",[xl],`fn blendResponsive(in:VSOut,opacity:f32)->f32{
2109
- return select(0.0,responsiveMark(in.${I.tri}>>${jo}u),opacity>0.0&&opacity<1.0/255.0+bitcast<f32>(in.${I.diagId}));
2110
- }`),ip=13,Xo=(e,t,r,o,a)=>["@builtin(position) position:vec4f","@location(0) color:vec4f",`@location(1) uv:${e}`,"@location(2) view:vec3f","@location(3) normal:vec4f","@location(4) tangent:vec4f","@location(5) bitangent:vec4f",`@location(6) bary:${a?"vec4f":"vec3f"}`,`@location(7) @interpolate(flat) words:${o?"vec4u":"vec3u"}`,`@location(8) @interpolate(flat) ids:${t}`,"@location(9) @interpolate(flat) maps:vec4u","@location(10) @interpolate(flat) alphaAo:vec4f","@location(11) @interpolate(flat) pbr:vec4f","@location(12) @interpolate(flat) emissive:vec4f",...r.map((n,s)=>`@location(${ip+s}) ${n}:vec4f`)],lp=(e,t,r,o=[],a=!1,n=!1)=>f(`vsOutWgsl(${e}, ${t}${r==="distance"?", distance":""}${o.length?`, ${o.join("+")}`:""}${a?", ordered":""}${n?", copies":""})`,[Hd],`// What the vertex stage reads on the item's surface's record and the fragment stage re-reads
2111
-
2112
- // \`words\` holds three of them (\`WORDS\`): the triangle's rank, the diagnostic word and the rank of
2113
- // the item's surface record, which a transmissive fragment reads its volume from (\`materialAt\`);
2114
-
2115
- // \`alphaAo\` carries, after the alpha test and the occlusion strength, a dashed line's dash and gap.
2116
- struct VSOut{${Xo(e,t,o,a,n).join(",")},}${r==="distance"?`
2117
- ${Va("VSOut",Xo(e,t,o,a,n))}`:""}`),cp=(e,t,r,o=!1)=>{let a=Xo(e,t,[],!1,o).map(of),n=[...Xo(e,t,[],!1,o),`@location(${ip}) before:vec4f`],s=(i,l)=>a.map(c=>`${i}.${c}=${l}.${c};`).join("");return f(`vsMovedWgsl(${e}, ${t}${r==="distance"?", distance":""}${o?", copies":""})`,[],`struct VSMoved{${n.join(",")},}${r==="distance"?`
2118
- ${Va("VSMoved",n)}`:""}
2119
- fn vsMovedOf(o:VSOut,before:vec4f)->VSMoved{var m:VSMoved;${s("m","o")}m.before=before;return m;}
2120
- fn vsOutOfMoved(m:VSMoved)->VSOut{var o:VSOut;${s("o","m")}return o;}`)};var Zo=f("BLEND_TANGENT_FRAME_WGSL",[jr,he],"fn blendTangentFrame(in:VSOut)->CotangentFrame{return CotangentFrame(unitOrZero(in.tangent.xyz),unitOrZero(in.bitangent.xyz));}");var ps=f("BLEND_PHYSICAL_RECORD_WGSL",[sf("physicalSampled"),lf,Fe(_.material),Zo],`var<private> physicalSampled:bool;
2121
-
2122
-
2123
- fn blendPhysicalBegin(in:VSOut,g:BlendGrads){
2124
- let lobes=materialLobesOf(in.ids.w);
2125
- if(lobes==0u){return;}
2126
- physicalOn=true;
2127
- physicalSampled=(in.ids.y&${pt}u)!=0u;
2128
- physicalRecord=physicalAt(lobes);
2129
- physicalCoords[0]=PhysicalCoord(in.uv.xy,g.gradX,g.gradY,g.gradX,g.gradY);
2130
- // The set past the first the vertex carries (\`channelsAlt\`) stands for every one.
2131
- let alt=PhysicalCoord(in.uv.zw,g.uv1X,g.uv1Y,g.uv1X,g.uv1Y);
2132
- physicalCoords[1]=alt;physicalCoords[2]=alt;physicalCoords[3]=alt;
2133
- }
2134
-
2135
-
2136
- fn blendPhysicalValues(in:VSOut,front:bool,g:BlendGrads,s:BlendSurface)->PhysicalLobes{
2137
- let flags=in.ids.y;
2138
- let coatFace=select(1.0,select(-1.0,1.0,front),(flags&${_e}u)!=0u&&(flags&${Se}u)!=0u);
2139
-
2140
- var v=physicalValues(s.N,s.geometric,g.q0,g.q1,-1.0,coatFace,blendTangentFrame(in),(flags&${Ne}u)!=0u);
2141
- v.coatRough=max(v.coatRough,s.curvature);
2142
- return v;
2143
- }
2144
-
2145
- var<private> blendLobeValues:PhysicalLobes;
2146
-
2147
-
2148
- fn blendLobesRead(in:VSOut,front:bool,g:BlendGrads,s:BlendSurface)->BlendSurface{
2149
- if(physicalOn){blendLobeValues=blendPhysicalValues(in,front,g,s);}
2150
- return s;
2151
- }
2152
-
2153
-
2154
- struct BlendLobed{texel:vec4u,on:bool,}
2155
- fn blendLobedTexel(s:BlendSurface)->BlendLobed{
2156
- if(!physicalOn){return BlendLobed(vec4u(0u),false);}
2157
- let v=blendLobeValues;
2158
- if(physicalLobeless(v)){return BlendLobed(vec4u(0u),false);}
2159
- return BlendLobed(physicalTexel(v),true);
2160
- }`),AI=f("BLEND_PHYSICAL_WGSL",[ps,Qt,de],`/** The lobes of a lit fragment of surface \`s\`, seen along \`V\`, set for its lights at its
2161
- * roughness: those \`blendLobesRead\` read. */
2162
- fn blendLobes(in:VSOut,front:bool,g:BlendGrads,s:BlendSurface,V:vec3f,rough:f32){
2163
- if(!physicalOn){return;}
2164
- let v=blendLobeValues;
2165
- if(physicalLobeless(v)){return;}
2166
- let alpha=lobeAlpha(rough);
2167
- setLobes(lobeAxis(v.direction,v.strength,s.N,alpha),v.coat,v.coatRough,v.coatN,s.N,V,lobeAcross(v.strength,alpha));
2168
- setLobeBase(s.rgb,s.metal,rough);
2169
- if(v.cloth>0.0){setCloth(v.fuzz,v.cloth,s.N,V,rough);}
2170
- }`),NI=f("BLEND_LOBELESS_WGSL",[],`fn blendPhysicalBegin(in:VSOut,g:BlendGrads){}
2171
- fn blendLobes(in:VSOut,front:bool,g:BlendGrads,s:BlendSurface,V:vec3f,rough:f32){}`);var fp=e=>{let t=`(in.ids.y&${pt}u)!=0u`;return f(`blendRequestWgsl(${e})`,[fc,cc,...e?[ps]:[]],`/** The subsurface map's choice: one where the item's surface has the map, after the others. */
2172
- fn blendSubsurfaceChoices(in:VSOut)->u32{return select(0u,1u,in.emissive.w!=0.0);}
2173
-
2174
- fn blendPick(in:VSOut,p:RequestPick,missing:bool,g:BlendGrads)->u32{
2175
- ${e?`let first=MAP_CHOICES+blendSubsurfaceChoices(in);if(physicalOn&&p.sel>=first){return physicalRequest(p,missing,p.sel-first);}
2176
- `:""}if(p.sel==MAP_CHOICES){let c=blendUv(in,g,MAP_CHOICES);return colorRequestIndex(u32(in.emissive.w),c.uv,c.ddx,c.ddy,p.next,1u,false,${t},missing);}
2177
- let k=mapPick(p.sel,vec2u(in.ids.x,in.ids.z),in.maps);
2178
- let c=blendUv(in,g,k.map);
2179
- return pickRequest(p,missing,k,c.uv,c.ddx,c.ddy,${t});
2180
- }
2181
- ${Yr({head:"fn blendRequest(in:VSOut,g:BlendGrads)->u32",pos:"in.position.xy",word:"uni.feedback",choices:`MAP_CHOICES+blendSubsurfaceChoices(in)${e?`+select(0u,${Wr.length}u,physicalOn)`:""}`,pick:(r,o)=>`blendPick(in,${r},${o},g)`})}
2182
- `)};var up=e=>`fn blendGraphFlags(flags:u32,g:BlendGraph)->u32{
2183
- if((g.flags&${e}u)==0u){return flags;}
2184
- let number=select(${vt.defaultLit}u,u32(g.model),g.model>=0);
2185
- let out=shadingFlagsOfNumber(flags&~(${ql}u<<${Yl}u),number);
2186
- let lane=(out>>${ze}u)&${Fl}u;
2187
- let lightless=${Ia}u<<${ze}u;
2188
- if(${Xl("number")}){return select(out,out&~lightless,lane==${Ia}u);}
2189
- return select(out,out|lightless,lane==0u);
2190
- }
2191
- `;var hp=f("BLEND_COPY_LANE_WGSL",[rc],`fn blendCopyLane(it:BlendItem)->f32{
2192
- let fadeOut=mgInstanceFadeOut(it.fade,(it.world*vec4f(it.wpoCentre,1.0)).xyz,uni.eye);
2193
- return min(floor(saturate(it.random)*${Vr}.0),${Vr-1}.0)*1024.0+256.0+round(saturate(fadeOut)*511.0);
2194
- }`),dp=A("blendCopyOf",[],`fn blendCopyOf(lane:f32)->vec2f{
2195
- let part=floor(lane/1024.0);
2196
- return vec2f((part+0.5)/${Vr}.0,saturate((lane-part*1024.0-256.0)/511.0));
2197
- }`),ms=e=>e.some(t=>t.compiled.uses.instance),pp=(e,t=[])=>ms(t)?{...e,key:`${e.key}, copies`,copies:!0}:e;var le={normal:1,thin:2,refraction:4,water:8,layer:16,depth:32,model:64},BE=e=>e.some(t=>Ra.some(r=>t.compiled.functions[r])),gs=e=>e.some(t=>Aa.some(r=>t.compiled.functions[r])),vs=e=>e.some(t=>t.compiled.functions.pixelDepthOffset),ME=e=>e.some(t=>t.compiled.functions.shadingModel),VE=Ca.at.graph>>2,HE="xyzw"[Ca.at.graph&3],mp=(e,t,r)=>t&&e&&r===e?"in.uv.zw":"in.uv.xy";function UE({compiled:e},t){let r=Yt(e.uses.sets);return` var ctx:MgContext;
2198
- ctx.uvs=array<vec2f,8>(${Array.from({length:8},(a,n)=>mp(r,t,n)).join(",")});
2199
- ctx.world=in.view;ctx.eye=uni.eye.xyz;ctx.origin=vec3f(0.0);
2200
- ctx.viewForward=mgViewForward(uni.viewProj,uni.eye.xyz,in.view);
2201
- ctx.vertexNormal=unitOrZero(in.normal.xyz);ctx.pixelNormal=ctx.vertexNormal;
2202
- ${e.uses.colour?` ctx.vertexColor=in.color;
2203
- `:""}${e.uses.instance?` mgInstance=blendCopyOf(in.bary.w);
2204
- `:""} ctx.time=uni.time;ctx.realTime=uni.realTime;
2205
- `}function zE({compiled:e},t){if(!e.uses.textures)return"";let r=Yt(e.uses.sets),o=a=>Array.from({length:8},(n,s)=>{let i=mp(r,t,s);return`${i}+${a}(${i})`}).join(",");return` mgNeighbour[0]=ctx;mgNeighbour[1]=ctx;
2206
- mgNeighbour[0].uvs=array<vec2f,8>(${o("dpdx")});mgNeighbour[0].world=in.view+dpdx(in.view);
2207
- mgNeighbour[1].uvs=array<vec2f,8>(${o("dpdy")});mgNeighbour[1].world=in.view+dpdy(in.view);
2208
- `}function YE(e){let{compiled:t}=e;if(!t.reads)return{fn:"",call:"0u"};let r=`blendGraphAsk${t.suffix}`;return{fn:`${Yr({head:`fn ${r}(in:VSOut,ctx:MgContext,g:${t.values})->u32`,pos:"in.position.xy",word:"uni.feedback",choices:`${t.reads}u`,pick:(a,n)=>`${t.ask}(ctx,g,${a},${n})`})}
2209
- `,call:`${r}(in,ctx,g)`}}function qE({compiled:e},t,{water:r,layer:o,depth:a},n){let s=Ka(e,"ctx,g"),{functions:i}=e,l=[];i.normal&&l.push(`out.normal=${s("normal")};out.flags|=${le.normal}u;`),i.subsurfaceColor&&l.push(`out.thin=clamp(${s("subsurfaceColor")},vec3f(0.0),vec3f(1.0));out.flags|=${le.thin}u;`),i.refraction&&l.push(`out.refraction=${s("refraction")};out.flags|=${le.refraction}u;`),r&&Ra.some(u=>i[u])&&l.push(`out.scatter=max(${i.scatteringCoefficients?s("scatteringCoefficients"):"vec3f(0.0)"},vec3f(0.0));out.absorb=max(${i.absorptionCoefficients?s("absorptionCoefficients"):"vec3f(0.0)"},vec3f(0.0));out.phaseG=clamp(${i.phaseG?s("phaseG"):"0.0"},-1.0,1.0);out.colorScale=max(${i.colorScaleBehindWater?s("colorScaleBehindWater"):"vec3f(1.0)"},vec3f(0.0));out.flags|=${le.water}u;`),o&&Aa.some(u=>i[u])&&l.push(`out.layer=clamp(${i.transmittanceColor?s("transmittanceColor"):"vec3f(0.5)"},vec3f(0.0),vec3f(1.0));out.coverage=clamp(${i.surfaceCoverage?s("surfaceCoverage"):"1.0"},0.0,1.0);out.flags|=${le.layer}u;`),i.shadingModel&&l.push(`out.model=i32(round(${s("shadingModel")}));out.flags|=${le.model}u;`,`if(out.model==${vt.unlit}){out.rgb=${n.emission};out.emissive=vec3f(0.0);out.metal=0.0;out.ao=1.0;}`),a&&i.pixelDepthOffset&&l.push(`out.depth=${s("pixelDepthOffset")};out.flags|=${le.depth}u;`);let c=t?mf(e,s):void 0;return c&&l.push(c.prelude,`out.lobes=${c.lobes};out.law=${c.law};out.tangent=${c.tangent};`),l.map(u=>` ${u}
2210
- `).join("")}function XE(e,t,r){let{compiled:o}=e,a=YE(e),n=pf(o,Ka(o,"ctx,g"));return`${a.fn}@diagnostic(off,derivative_uniformity) fn blendGraph${o.suffix}(in:VSOut,first:u32)->BlendGraph{
2211
- var out:BlendGraph;
2212
- let g=mgLoad${o.suffix}(first);
2213
- ${UE(e,t)}${zE(e,t)} out.id=${e.id}u;
2214
- out.rgb=${n.rgb};
2215
- out.opacity=${n.opacity};
2216
- out.emissive=${n.emissive};
2217
- out.metal=${n.metallic};
2218
- out.rough=${n.roughness};
2219
- out.ao=${n.occlusion};
2220
- out.specular=${n.specular};
2221
- ${qE(e,t,r,n)} out.request=${a.call};
2222
- return out;
2223
- }`}function gp(e,t){let r={water:BE(e),layer:gs(e),depth:vs(e)},{water:o,layer:a,depth:n}=r,s=ME(e),i=`${e.map(h=>h.id).join(",")}:${t}${o?":water":""}${a?":layer":""}${n?":depth":""}${s?":model":""}`,l=_.material,c=e.map(h=>` case ${h.id}u:{return blendGraph${h.compiled.suffix}(in,first);}`).join(`
2224
- `),u=`/** What a fragment's graph gives: its outputs, the tile its textures ask, in \`flags\` whether it
2225
- * wires a normal (in tangent space), a thin transmission colour and a refraction, and, in a lobed
2226
- * module, the values of its lobes' record (\`law\` zero where it computes none). */
2227
- struct BlendGraph{id:u32,rgb:vec3f,opacity:f32,emissive:vec3f,metal:f32,rough:f32,ao:f32,specular:f32,normal:vec3f,thin:vec3f,flags:u32,request:u32,lobes:vec4f,tangent:vec3f,law:u32,refraction:f32,${s?"model:i32,":""}${o?"scatter:vec3f,absorb:vec3f,phaseG:f32,colorScale:vec3f,":""}${a?"layer:vec3f,coverage:f32,":""}${n?"depth:f32,":""}}
2228
- ${t?`/** The lobes the item's graph computes, set in the fragment's lobe record in place of the record's own
2229
- * (\`physicalWgsl.ts\`), where the item carries a lobe extension (\`physicalOn\`). */
2230
- fn blendGraphLobes(g:BlendGraph){
2231
- if(physicalOn&&g.law!=0u){physicalRecord.lobes=g.lobes;physicalRecord.maps=array<u32,${Wr.length}>();physicalRecord.law=g.law;physicalTangent=g.tangent;}
2232
- }
2233
- `:""}${s?up(le.model):`fn blendGraphFlags(flags:u32,g:BlendGraph)->u32{return flags;}
2234
- `}/** The record's word of the surface's graph: the first texel of its values plus one, zero without.
2235
- * \`word\` is the item's material word, whose facing mode (\`FACING_SHIFT\`) rides above its rank. */
2236
- fn materialGraphOf(word:u32)->u32{return materialTableRecord(word&${Pt}u,${VE}u).${HE};}
2237
- ${e.map(h=>XE(h,t,r)).join(`
2238
- `)}
2239
- @diagnostic(off,derivative_uniformity) fn blendGraphEval(in:VSOut)->BlendGraph{
2240
- var none:BlendGraph;
2241
- let word=materialGraphOf(in.${I.material});
2242
- if(word==0u){return none;}
2243
- let first=word-1u;
2244
- switch(materialGraphHead(word).x){
2245
- ${c}
2246
- default:{return none;}
2247
- }
2248
- }`;return{key:i,model:s,decl:f(`blendGraphs(${i})`,[he,...s?[Br]:[],...ms(e)?[dp]:[],oc,Fe(l),...e.flatMap(h=>[h.compiled.wgsl,Dc(h.compiled,l)])],u)}}function uC(e,t){let r=new Map;for(let{surface:o}of e){let a=Xr(o,void 0,t);qr(a)&&a.kind==="blend"&&r.set(a.id,a)}return[...r.values()].sort((o,a)=>o.id-a.id)}var KE=e=>e.compiled.uses,hC=e=>tc(e,KE);var vp=A("blendLit",[],`fn blendLit(flags:u32)->bool{return (flags&${pl}u)!=0u&&(flags&${gl|Cr}u)==0u;}`),Ep=A("blendShadingFlags",[Kl,Br],"fn blendShadingFlags(flags:u32,model:u32)->u32{return shadingFlagsOfNumber(flags,shadingNumberOfModel(model));}"),$C=f("BLEND_TO_EYE_WGSL",[],"fn blendToEye(in:VSOut)->vec3f{return normalize(uni.camPos.xyz-in.view*uni.camPos.w);}"),jE=f("BLEND_SURFACE_NORMAL_WGSL",[he],`/** The normal before any normal map: the vertex attribute, turned on the back of a two-sided
2249
- * material, or the face's own from screen derivatives \`q0\`, \`q1\` of the point: what the blend
2250
- * stage bends by its map (\`blendSurface\`). */
2251
- fn blendGeometricNormal(in:VSOut,front:bool,q0:vec3f,q1:vec3f)->vec3f{
2252
-
2253
- // ordinary surface, a null vector \u2014 and not NaN \u2014 on a collapsed face, whose a NaN would win
2254
-
2255
-
2256
-
2257
-
2258
- // the back of a two-sided material \u2014 flipping it too would send the geometric one opposite the
2259
-
2260
-
2261
- let flags=in.ids.y;
2262
- var N=unitOrZero(-cross(q0,q1));
2263
- if((flags&${Se}u)!=0u){
2264
- N=unitOrZero(in.normal.xyz);
2265
- let face=select(-1.0,1.0,front);
2266
- if((flags&${_e}u)!=0u){N*=face;}
2267
- }
2268
- return N;
2269
- }`),ZE=` if((g.graph.flags&${le.normal}u)!=0u){
2270
- let c=blendUv(in,g,${Ie.base}u);
2271
- let frame=cotangentFrame(N,g.q0,g.q1,c.ddx,c.ddy);
2272
- var T=-frame.T;var B=-frame.B;
2273
- if((flags&${Ne}u)!=0u){let stored=blendTangentFrame(in);T=stored.T;B=stored.B;}
2274
- let flip=select(1.0,face,(flags&${_e|Se}u)==${_e|Se}u);
2275
- N=bendNormal(N,T,B,flip,g.graph.normal);
2276
- }
2277
- `,Es="in.uv.xy",QE=(e,t)=>`struct BlendGrads{gradX:vec2f,gradY:vec2f,q0:vec3f,q1:vec3f,nX:vec3f,nY:vec3f,${e?"uv1X:vec2f,uv1Y:vec2f,channels:u32,":""}${t?"graph:BlendGraph,":""}}
2278
- fn blendGrads(in:VSOut)->BlendGrads{let unitNormal=unitOrZero(in.normal.xyz);return BlendGrads(dpdx(${Es}),dpdy(${Es}),dpdx(in.view),dpdy(in.view),dpdx(unitNormal),dpdy(unitNormal)${e?`,dpdx(in.uv.zw),dpdy(in.uv.zw),extractBits(in.${I.tri},${gr}u,${us}u)`:""}${t?",blendGraphEval(in)":""});}
2279
- fn blendSampled(in:VSOut)->bool{return (in.ids.y&${pt}u)!=0u;}
2280
- `,JE=e=>`/** The coordinate and screen derivatives map \`i\` (\`SURFACE_MAP_FIELDS\` order) is read at: the
2281
- * set past the first where the record's \`channels\` word says it reads one, in a program that
2282
- * carries it (\`channelsRead\`). */
2283
- struct BlendUv{uv:vec2f,ddx:vec2f,ddy:vec2f,}
2284
- fn blendUv(in:VSOut,g:BlendGrads,i:u32)->BlendUv{
2285
- ${e?"if(bitIsSet(g.channels,i)){return BlendUv(in.uv.zw,g.uv1X,g.uv1Y);}":""}
2286
- return BlendUv(${Es},g.gradX,g.gradY);
2287
- }
2288
- `,e_=`fn blendTint(in:VSOut)->vec4f{return select(in.color,vec4f(1.0),materialGraphOf(in.${I.material})!=0u);}`,t_=e=>`/** The base map's sample: the colour, and the alpha the coverage test reads. */
2289
- fn blendBase(in:VSOut,g:BlendGrads)->vec4f{${e?"if(g.graph.id!=0u){return vec4f(g.graph.rgb,g.graph.opacity);}":""}let c=blendUv(in,g,${Ie.base}u);return colorSample(in.ids.x,c.uv,c.ddx,c.ddy,blendSampled(in));}
2290
- ${e?`${e_}
2291
- `:""}/** The fragment's opacity: what the alpha test compares and the stage writes. */
2292
- fn blendAlpha(in:VSOut,base:vec4f)->f32{return base.w*${e?"blendTint(in)":"in.color"}.w;}
2293
- fn blendKeeps(in:VSOut,base:vec4f,front:bool)->bool{
2294
- return !(blendAlpha(in,base)<in.alphaAo.x||facingDiscarded(in.${I.material}>>${dr}u,front));
2295
- }
2296
- ${e?`/** The tile the fragment asks: its graph's where the item wears one, else its maps'. */
2297
- fn blendRequestOf(in:VSOut,g:BlendGrads)->u32{if(g.graph.id!=0u){return g.graph.request;}return blendRequest(in,g);}
2298
- `:""}`,r_=` if(in.maps.z!=0u){
2299
- let c=blendUv(in,g,${Ie.normal}u);
2300
- let scale=vec3f(in.pbr.z,in.pbr.w,1.0);
2301
- let mapN=unitToSigned3(dataSample(in.maps.z,c.uv,c.ddx,c.ddy,sampled).xyz)*scale;
2302
- // The frame of the opaque resolve through the map's UV transform (\`dataMapFrame\`), on screen
2303
-
2304
-
2305
- let stored=(flags&${Ne}u)!=0u;
2306
- var tangents:CotangentFrame;
2307
- if(stored){tangents=blendTangentFrame(in);}
2308
- let frame=dataMapFrame(in.maps.z,sampled,N,g.q0,g.q1,c.ddx,c.ddy,tangents,stored);
2309
- let turn=select(-1.0,1.0,stored);
2310
- let flip=select(1.0,face,(flags&${_e|Se}u)==${_e|Se}u);
2311
- N=bendNormal(N,frame.T*turn,frame.B*turn,flip,mapN);
2312
- }
2313
- `,o_=` if(g.graph.id!=0u&&(g.graph.flags&${le.model}u)!=0u&&g.graph.model==${vt.unlit}){rgb=g.graph.rgb;}
2314
- `,a_=e=>`struct BlendSurface{rgb:vec3f,alpha:f32,N:vec3f,rough:f32,metal:f32,ao:f32,emissive:vec3f,request:u32,subsurface:vec3f,geometric:vec3f,curvature:f32,${e?"specular:f32,":""}}
2315
- fn blendSurface(in:VSOut,front:bool,g:BlendGrads,base:vec4f)->BlendSurface{
2316
- let flags=in.ids.y;
2317
- let sampled=blendSampled(in);
2318
- let request=${e?"blendRequestOf":"blendRequest"}(in,g);
2319
- let geometric=blendGeometricNormal(in,front,g.q0,g.q1);
2320
- var N=geometric;
2321
- let face=select(-1.0,1.0,front);
2322
-
2323
- let alpha=select(blendAlpha(in,base),1.0,${Dt("sky")});
2324
- ${e?.model?"var":"let"} rgb=${e?"blendTint(in)":"in.color"}.xyz*base.xyz;
2325
- ${e?.model?o_:""} var roughTexel=1.0;var metalTexel=1.0;var aoTexel=1.0;
2326
- if(in.maps.x!=0u){let c=blendUv(in,g,${Ie.rough}u);roughTexel=dataSample(in.maps.x,c.uv,c.ddx,c.ddy,sampled).g;}
2327
- if(in.maps.y!=0u){let c=blendUv(in,g,${Ie.metal}u);metalTexel=dataSample(in.maps.y,c.uv,c.ddx,c.ddy,sampled).b;}
2328
- if(in.maps.w!=0u){let c=blendUv(in,g,${Ie.ao}u);aoTexel=dataSample(in.maps.w,c.uv,c.ddx,c.ddy,sampled).r;}
2329
- ${e?` if(g.graph.id!=0u){roughTexel=g.graph.rough;metalTexel=g.graph.metal;aoTexel=g.graph.ao;}
2330
- `:""} var rough=ormRoughness(in.pbr.x,roughTexel);let metal=ormMetalness(in.pbr.y,metalTexel);let ao=ormOcclusion(in.alphaAo.y,aoTexel);
2331
- `,n_=(e,t)=>`${t?ZE:""} var curvature=0.0;
2332
- if((flags&${Ml}u)!=0u){let curved=normalCurvatureApply(rough,g.nX,g.nY,uni.normalCurvature);rough=curved.x;curvature=curved.y;}
2333
- var emissive=in.emissive.xyz;
2334
- if(in.ids.z!=0u){let c=blendUv(in,g,${Ie.emissive}u);emissive*=colorSample(in.ids.z,c.uv,c.ddx,c.ddy,sampled).rgb;}
2335
- ${t?` if(g.graph.id!=0u){emissive=g.graph.emissive;}
2336
- `:""} var thin=clamp(vec3f(in.normal.w,in.tangent.w,in.bitangent.w),vec3f(0.0),vec3f(1.0));
2337
- if(in.emissive.w!=0.0){let c=blendUv(in,g,${Ul}u);thin*=colorSample(u32(in.emissive.w),c.uv,c.ddx,c.ddy,sampled).rgb;}
2338
- ${t?` if((g.graph.flags&${le.thin}u)!=0u){thin=g.graph.thin;}
2339
- `:""} let surface=BlendSurface(rgb,alpha,N,rough,metal,ao,emissive,request,thin,geometric,curvature${t?",select(0.5,g.graph.specular,g.graph.id!=0u)":""});
2340
- return ${e?"blendLobesRead(in,front,g,surface)":"surface"};
2341
- }
2342
- `,_p=(e,t)=>f(`blendSurfaceWgsl(${e}${t?`, ${t.key}`:""})`,[he,Yi,Fc,jr,Gc,Zo,jE,ic,lc,Ho,fp(e),wi,...e||t?[Fe(_.material)]:[],...t?[t.decl]:[]],`
2343
- ${QE(e,t)}${JE(e)}${t_(t)}${a_(t)}${r_}${n_(e,t)}`);function Qo(e){let t={},r=[],o=4;for(let{name:a,lanes:n}of e){if(a in t)throw new Error(`The vertex extra '${a}' is asked for twice`);o+n>4&&(r.push(`extras${r.length}`),o=0),t[a]={member:r[r.length-1],lane:o,lanes:n},o+=n}return{places:t,members:r}}var _s="xyzw",ot=(e,t="in")=>`${t}.${e.member}${e.lanes===4?"":`.${_s.slice(e.lane,e.lane+e.lanes)}`}`,vr=(e,t,r="out")=>e.lanes===4?`${r}.${e.member}=${t};`:Array.from({length:e.lanes},(o,a)=>{let n=_s[e.lane+a];return`${r}.${e.member}.${n}=${t}${e.lanes===1?"":`.${_s[a]}`};`}).join("");var XC={clouds:!1,fog:!1},Jo={key:"",declared:[],extras:[],vertexLanes:"",entry:"",apply:"",cloudOver:""},s_=e=>f("CLOUD_FOG_FRAGMENT",[],`fn cloudFogLayer(v:VSOut)->vec4f{return ${e};}
2344
- fn cloudFogged(rgb:vec3f,v:VSOut)->vec3f{
2345
- let layer=cloudFogLayer(v);
2346
- return rgb*layer.a+layer.rgb;
2347
- }`),Lp=f("VOLUME_CAMERA_FOG",[Cc(_.volumeCamera)],`fn blendVolumeFog(in:VSOut,fog:vec4f)->vec4f{
2348
- if(uni.volumeCamera==0u){return fog;}
2349
- return dvCameraFog(fog,in.view,uni.eye.xyz,in.position.xy,uni.volumeCameraFactor,uni.preExposure);
2350
- }`),i_=e=>f("FOG_VERTEX_FRAGMENT",[Lp],`fn fogVertexed(in:VSOut)->bool{return !(${Dt("fogPerPixel")});}
2351
- fn blendFog(in:VSOut)->vec4f{
2352
- if(!fogVertexed(in)){return blendVolumeFog(in,fogOver(in.view,uni.eye.xyz,in.position.xy));}
2353
- return blendVolumeFog(in,fogVolumeOver(${e},in.view,uni.eye.xyz));
2354
- }`),Sp=f("FOG_PIXEL_FRAGMENT",[Lp],`fn fogVertexed(in:VSOut)->bool{return false;}
2355
- fn blendFog(in:VSOut)->vec4f{return blendVolumeFog(in,fogOver(in.view,uni.eye.xyz,in.position.xy));}`),xp=(e,t)=>`var fogLayer=vec4f(0.0,0.0,0.0,1.0);
2356
- ${`if(!(${Pl("m.model")})){
2357
- ${e?`if((m.flags&${zt.fogPerPixel}u)==0u){fogLayer=fogStack(fogLocalVertex(out.view,uni.eye.xyz),fogLaidFar(out.view,uni.eye.xyz,true));}
2358
- `:""}${t?`if(${$l("m.model")}){fogLayer=fogStack(cloudFogOver(out.position,out.view,uni.eye.xyz),fogLayer);}
2359
- `:""}}`}
2360
- `,Tp=`(flags&${Gl<<ze}u)!=0u&&!fogVertexed(in)`,Ss=({clouds:e,fog:t})=>e||t?[{name:"fogLayer",lanes:4},...e?[{name:"shade",lanes:1}]:[]]:[],wp=new Map;function bp({clouds:e,fog:t}){let r=`${e?", cloudVertex":""}${t?", fogVertex":", fogPixel"}`,o=wp.get(r);return o||wp.set(r,o=l_(e,t,r)),o}function l_(e,t,r){if(!e&&!t)return{...Jo,key:r,declared:[Sp]};let o=Qo(Ss({clouds:e,fog:t})),a=ot(o.places.fogLayer),n=vr(o.places.fogLayer,"fogLayer"),s=t?i_(a):Sp;if(!e)return{...Jo,key:r,declared:[s],extras:o.members,vertexLanes:`${xp(t,!1)}${n}
2361
- `};let i=o.places.shade;return{key:r,declared:[s_(ot(o.places.fogLayer,"v")),ai(Xt),vp,s],extras:o.members,vertexLanes:`${xp(t,!0)}${n}
2362
- var cloudShade=1.0;
2363
- if(blendLit(flags)){cloudShade=cloudShadeAt(out.view);}
2364
- ${vr(i,"cloudShade")}
2365
- `,entry:`cloudShadeVertex=${ot(i)};`,apply:`if(${Tp}){rgb=cloudFogged(rgb,in);}`,cloudOver:` if(!fogFree&&${Tp}){fog=fogStack(cloudFogLayer(in),fog);}
2366
- `}}var yp=new WeakMap,c_=[];function f_(e){this.seen.get(e)!==this.gather&&(this.seen.set(e,this.gather),this.found[this.count++]=e)}function u_(e){let{volumes:t,found:r,count:o}=e,a=o===t.size;for(let n=0;a&&n<o;n++)a=t.has(r[n]);if(!a){t.size&&t.clear();for(let n=0;n<o;n++)t.add(r[n])}r.length!==o&&(r.length=o)}function Rp(e){let{blendState:t,run:r}=e,o=yp.get(e);if(!o){let l=new Map;o={frame:-1,plan:-1,volumes:new Set,found:[],count:0,gather:0,seen:new WeakMap,ranks:l,rankOf:u=>l.get(u)??c_},yp.set(e,o)}if(o.frame===r.frame&&o.plan===t.planPass)return o;o.frame=r.frame;let{ranks:a}=o,n=o.plan!==t.planPass;n&&(o.plan=t.planPass,a.clear()),o.gather++,o.count=0;let{waterItems:s,waterRanks:i}=t;for(let l=0;l<s.length;l++){let c=Gt(s[l]);if(!c||(uo(c)?.forEach(f_,o),!n))continue;let u=a.get(c);u?u.push(i[l]):a.set(c,[i[l]])}return u_(o),o}function xs(e,t){let{volumes:r,rankOf:o,plan:a}=Rp(e),{blendState:n}=e,s=n.waterTable?.table??new Fo,i=s.pack(r,o,a),l=n.waterTable;if(!l){let u=ld(t,s),{view:h}=u.records;l=n.waterTable={table:s,held:u,view:h,group:Op(t,h)}}i&&cd(l.held,s);let{view:c}=l.held.records;return l.view!==c&&(l.view=c,l.group=Op(t,c)),l}var Op=(e,t)=>e.createBindGroup({label:"Trillion3D water exclusion volumes",layout:ur(e),entries:[{binding:Ft,resource:t}]});function eF(e,t,r){let{view:o,group:a}=xs(e,t),n=r.exclusionShade;return n?.view!==o&&(r.exclusionShade=n={view:o,table:a,shade:os(t,r,o)}),n.table=a,n}var h_=(e,t)=>xs(e,t).group,d_=(e,t)=>xs(e,t).table.revision;var Ap=e=>{let t=B(e,"thinWaterReflection");return Bo(e)&&t!=="disabled"&&t!=="captures"},Me={block:[1,1],reconstruction:!1,temporal:!1,bilateral:!1,sceneTraces:!0,distantTraces:!0},p_=e=>{let t=n=>B(e,n),r=t("thinWaterReflection")==="screenSpace",o=r?1:t("thinWaterReflectionDownsample"),a=t("thinWaterReflectionDenoising");return Me.block[0]=o,Me.block[1]=!r&&t("thinWaterReflectionCheckerboard")?1:o,Me.reconstruction=!r&&t("thinWaterReflectionReconstruction"),Me.temporal=r?t("thinWaterReflectionTemporal"):a,Me.bilateral=!r&&a,Me.sceneTraces=!r,Me.distantTraces=!r,Me},m_=(e,t=!1)=>(t||e.blendState.waterItems.length>0)&&Ap(e)?p_(e):void 0;function g_(e,t,r){if(!We(e))return 0;let o=B(e,"thinWaterRefractionDownsample"),a=m(t,o)*m(r,o),n=t*r,s=m(t,wt)*m(r,wt),i=l=>M(l);return a*(i(j)+i(ho))+n*(i(Te)+i(po)+i(Lt)+i(Xe)+(Mo(e)?i(bt):0))+m(s,32)*4+s*4+16+jt*4}var v_=["entryCount","groupCount","runCount","instanceBase","argsBase","maxVertexWords","vertexShift","orderBase","runsBase","exclude","required"],Ts=k("Uni",[...v_.map(e=>[e,"u32"]),["pad0","u32"]]),pF=Ts.words,ce=Ts.at,mF=()=>f("expandUniformWgsl",[],Ts.wgsl);var ws=30,ea=(1<<ws)-1,xF=(e,t,r)=>r?e+t+1:e;function TF(e,t,r,o,a){let n=0,s=-1;for(let i=0;i<t.length;i++){let l=e[t[i]]>>>8;r&&l!==s&&(a[n++]=-1),a[n]=i,o[i]=n++,s=l}return r&&(a[n++]=-1),n}function wF(e,t,r,o,a){return e[ce.entryCount]=t.entries,e[ce.groupCount]=zs(t.entries,qt),e[ce.runCount]=t.runs,e[ce.instanceBase]=a.instanceBase,e[ce.argsBase]=a.argsBase,e[ce.maxVertexWords]=o.maxVertexWords,e[ce.vertexShift]=o.vertexShift,e[ce.orderBase]=r.order,e[ce.runsBase]=r.runs,e[ce.exclude]=a.exclude,e[ce.required]=a.require,e}var E_={name:"waterBody",lanes:1},__={name:"selfShadow",lanes:1},Np=(e,t,r)=>[...Ss(e),...t?[__]:[],...r?[E_]:[]];function S_(e,t,r){let o=Qo(Np(t,r,!0)),a=o.places.waterBody;return{...e,key:`${e.key}, waterBody`,declared:[...e.declared,f(`WATER_BODY_RANK_WGSL(${ot(a)})`,[],`fn waterBodyRank(in:VSOut)->u32{return u32(round(${ot(a)}));}`)],extras:o.members,vertexLanes:`${e.vertexLanes}${vr(a,`f32(slot.x&${ea}u)`)}
2367
- `}}var Ip=new Int32Array(0),ta=[],Er=new Int32Array(0);function x_({first:e,nodes:t,length:r}){for(let o=0;o<r;o++){let a=t[o];a&&(e[a.index]=0,t[o]=void 0)}return t}function T_(e,t){let{nodes:r,length:o}=e,a=e.first=ue(e.first,t),n=e.next=ue(e.next,o);Er=ue(Er,o);for(let s=0;s<o;s++){n[s]=0;let i=r[s];if(!i)continue;let l=a[i.index]-1;l>=0&&r[l]===i?(n[Er[l]]=s+1,Er[l]=s):(a[i.index]=s+1,Er[s]=s)}}function w_(e,t,r){let o=0,a=0;try{for(;a<e.length;a++){let n=t(e[a]),s=n&&ka._treeOf(n)===r?n:void 0;ta[a]=s,s&&s.index>=o&&(o=s.index+1)}}catch(n){throw ta.fill(void 0,0,a),n}return o}function L_(e,t,r,o){let{held:a,revision:n}=o,{length:s}=e;if(a?.tree===r&&a.length===s&&a.revision===n)return a;let i=w_(e,t,r),l=ta;ta=a?x_(a):[];let c=a??{tree:r,length:s,revision:n,first:Ip,next:Ip,nodes:l};return c.tree=r,c.length=s,c.revision=n,c.nodes=l,T_(c,i),o.held=c}function b_(e,t,r,o,a,n){let s=ka._treeOf(r),i=r.index;if(!(s.flags[i]&16))return a;let{first:l,next:c,nodes:u}=L_(e,t,s,n),h=a;for(let d=i;d>=0;d=Bs(s,d,i)){let g=d<l.length?l[d]:0;if(!(!g||!u[g-1]._alive))for(;g;g=c[g-1])o[h++]=g-1}return h}var Ls=(e,t,r,o)=>b_(e.selectionRoots,Be,t,r,o,e.rootIndex);var bs=(e,t)=>!t||e===!0?!0:e?(e.nodes.push(t.node),e):{anchor:t.anchor,nodes:[t.node],under:void 0};function y_(e){let t;for(let r of e){if("isObject3D"in r)continue;let o=(t??=new Map).get(r.graph);o||t.set(r.graph,o={placements:new Map,runs:[]});let{placement:a,placements:n=1,keeps:s}=r,i=n===1?void 0:o.runs.find(l=>l.first===a);n===1?o.placements.set(a,bs(o.placements.get(a),s)):i?i.kept=bs(i.kept,s):o.runs.push({first:a,count:n,kept:bs(void 0,s)})}return t}function Cp(e,t){if(e===!0)return!0;if(!e||!t)return!1;let r=e.anchor(t);if(r===void 0)return!1;if(!e.under){let o=e.under=new Set;for(let a of e.nodes)a.traverse(n=>void o.add(n))}return e.under.has(r)}function O_({placements:e,runs:t},r){let o=Pr(r);if(Cp(e.get(o),r))return!0;for(let{first:a,count:n,kept:s}of t)if(o>=a&&o<a+n&&Cp(s,r))return!0;return!1}function ys(e,t,r,o){for(let n of t)"isObject3D"in n&&(o=Ls(e,n,r,o));let a=y_(t);if(!a)return o;for(let[n,s]of a){let i=o;o=Ls(e,n,r,o);let l=i;for(let c=i;c<o;c++)O_(s,e.selectionRoots[r[c]].placement)&&(r[l++]=r[c]);o=l}return o}var kF=(e,t,r,o,a)=>ys(e,t?t.of([r]):[r],o,a),WF=(e,t)=>e+(t?.revision??0);function Fp(e,t){let r=[];return r.length=ys(e,t,r,0),qs(r),r}function Gp(e,t={},r){let o=i=>r?r.of(i):i,a=Fp(e,o(t.skip??[]));if(!t.objects)return{ranks:a,include:!1};let n=new Set(a);return{ranks:Fp(e,o(t.objects)).filter(i=>!n.has(i)),include:!0}}var Pp=Dr(`${D({RQ_TREE_STEPS:Bf,RQ_RAY_WORDS:H.words,RQ_HIT_WORDS:U.words,RQ_FOUND:Yf,RQ_CUT:qf})}
2368
-
2369
- fn rqRay(k:u32)->RqRay{
2370
- let at=params.rayWord+k*RQ_RAY_WORDS;
2371
- let d=at+${H.at.direction}u;
2372
- return RqRay(
2373
- vec4u(query[at+${H.at.eyeXY}u],query[at+${H.at.eyeXY+1}u],query[at+${H.at.eyeXY+2}u],query[at+${H.at.eyeXY+3}u]),
2374
- vec2u(query[at+${H.at.eyeZ}u],query[at+${H.at.eyeZ+1}u]),
2375
- query[at+${H.at.filterFirst}u],
2376
- query[at+${H.at.filterWord}u],
2377
- bitcast<vec3f>(vec3u(query[d],query[d+1u],query[d+2u])),
2378
- bitcast<f32>(query[at+${H.at.reach}u]),
2379
- bitcast<f32>(query[at+${H.at.lineReach}u]),
2380
- bitcast<f32>(query[at+${H.at.lineSlope}u]));
2381
- }
2382
-
2383
-
2384
- fn rqAnswer(k:u32,best:RqHit){
2385
- let at=params.hitWord+k*RQ_HIT_WORDS;
2386
- query[at+${U.at.flags}u]=select(0u,RQ_FOUND,best.found)|select(0u,RQ_CUT,rqCut);
2387
- if(!best.found){return;}
2388
- let normal=unitOrZero(inverseTranspose3(worldsLinear(best.placement),best.normal));
2389
- query[at+${U.at.placement}u]=best.placement;
2390
- query[at+${U.at.page}u]=best.page;
2391
- query[at+${U.at.triangle}u]=best.triangle;
2392
- query[at+${U.at.normal}u]=bitcast<u32>(normal.x);
2393
- query[at+${U.at.normal+1}u]=bitcast<u32>(normal.y);
2394
- query[at+${U.at.normal+2}u]=bitcast<u32>(normal.z);
2395
- // The walk compared the measures its coplanar layers made (\`rqLift\`): the hit's own distance is written.
2396
- query[at+${U.at.distance}u]=bitcast<u32>(best.distance/best.lift);
2397
- }
2398
- @compute @workgroup_size(WORKGROUP_THREADS) fn traceRays(@builtin(global_invocation_id) g:vec3u,@builtin(num_workgroups) n:vec3u){
2399
- let k=flatIndex(g,n,WORKGROUP_THREADS);
2400
- if(k>=params.rays){return;}
2401
- let ray=rqRay(k);
2402
- rqCut=false;
2403
- // The reach in the walks' measure (\`rqLift\`): a hit on no layer is met within it.
2404
- var best=RqHit(ray.reach/rqLowest(),1.0,0u,0u,0u,vec3f(0.0),false);
2405
- ${Vf({eyeXY:"ray.eyeXY",eyeZ:"ray.eyeZ",direction:"ray.direction",placements:"params.placements",root:"params.treeRoot",table:"tree",enter:"best=rqEnter(w,ray,best);",stop:"",visit:"",steps:"RQ_TREE_STEPS",cut:"rqCut=true;",grow:(e,t)=>`rqGrowth(${e},${t},ray.lineReach,vec4f(origin,ray.lineSlope))`})}
2406
- rqAnswer(k,best);
2407
- }`,[Hr,ac,Mf,jf,Ri,he]);var xe="Trillion3D ray query",R_={label:xe},$p=ua(xe,Pp,"traceRays"),Dp=ua(xe,Hf,"indexDeformed");function kp(e,t,r){let o=[$p(e),Dp(e)];return o.every(a=>a.ready)?!0:(Promise.all(o.map(a=>a.prepare())).then(t,r),!1)}function Wp(){let e={},t=(s,i)=>Pe(s,()=>e[i]),r=Pe(0,()=>e.params,void 0,()=>xt.words*4),o=Tt(),a=Tt(),n=Tt();return o.identity.entries[0]=[r,t(1,"query"),t(2,"pageTable"),t(3,"entries"),t(4,"spans"),t(5,"visible")],a.identity.entries[0]=kf(()=>e.views),n.identity.entries[0]=[r,t(1,"query"),t(2,"geometry"),t(3,"positions"),t(4,"placements")],{bound:e,index:o,tables:a,trace:n}}function Bp(e,t,r,o){let a=$p(e).get(),n=Dp(e).get(),s=nc(e.limits),{groups:i}=o,{bound:l}=i;if(l.params=o.params,l.query=o.buffer,l.pageTable=r.pageTable,l.visible=r.visible,l.entries=r.entries,l.spans=r.spans,l.geometry=r.geometry,l.positions=r.positions,l.placements=r.placements,l.views=r.tables.views,!a||!n)return;let c=t.beginComputePass(R_),u=r.rows+r.entryCount;u>0&&(c.setPipeline(n),fo(e,i.index,n),c.setBindGroup(0,i.index.group),Fa(c,m(u,qt),1,s)),c.setPipeline(a),fo(e,i.tables,a),c.setBindGroup(0,i.tables.group),fo(e,i.trace,a,1),c.setBindGroup(1,i.trace.group),Fa(c,m(o.rays,qt),1,s),c.end()}function A_({records:e,rows:t,entryCount:r},o){let a=e.words.length,n=a+o.words.length,s=sa(n+o.rays*U.words,co),i=Math.max(32,Ys(t+r));return{rayWord:a,hitWord:n,hashWord:s,slots:i,words:s+co*i}}function Mp(e){let t=new Uint32Array(xt.words),r=Wp(),o,a,n,s=()=>a??=e.createBuffer({label:xe,size:sa(xt.words*4,16),usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});return{compiled:(i,l)=>kp(e,i,l),encode(i,l,c){let u=l.records.sync(l.tables),h=A_(l,c),d=o=lu(e,o,h.words*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,xe);return N_(e,l.records,d,u||d!==n),n=d,e.queue.writeBuffer(d,h.rayWord*4,c.words),I_(t,l,c,h),e.queue.writeBuffer(s(),0,t),i.clearBuffer(d,h.hashWord*4,h.slots*co*4),Bp(e,i,l,{buffer:d,params:s(),rays:c.rays,groups:r}),{buffer:d,offset:h.hitWord*4,bytes:c.rays*U.words*4}},dispose(){a?.destroy(),o?.destroy()}}}function N_(e,t,r,o){let a=t.takeDirty(),{words:n}=t;if(o)return e.queue.writeBuffer(r,0,n);gc(e,r,a,a.length,n,Uf)}function I_(e,{tables:t,rows:r,entryCount:o,records:a,placedLayer:n},{rays:s,filterWord:i},l){let c=xt.at;e[c.rays]=s,e[c.rayWord]=l.rayWord,e[c.hitWord]=l.hitWord,e[c.filterWord]=l.rayWord+i,e[c.recordWord]=0,e[c.hashWord]=l.hashWord,e[c.hashMask]=l.slots-1,e[c.rows]=r,e[c.entries]=o,e[c.treeRoot]=t.treeRoot,e[c.placements]=t.placements,e[c.liftUnits]=Math.min(a.deepestUnits+na(n),na(15))}function Vp(e,t){let{run:r,gpu:o,vis:a,blendState:n}=e,s=r.gpuSelection,i=s?.cutTables(),l=a.pageTable,c=o.cache?.buffer,u=a.zeroRows,h=a.concatPos??u,d=n.compaction,g=d?.entriesBuffer??u,R=d?.spanBuffer??u,E=a.placementGpu?.buffer??u;if(r.lost||!s||!i||!l||!c||!h||!g||!R||!E)return;let y=d?n.table?.length??0:0;return{tables:i,records:t,pageTable:l,visible:s.visible,rows:s.visibleCap,entries:g,spans:R,entryCount:y,geometry:c,positions:h,placements:E,placedLayer:a.coplanar?.layers.deepest??0}}var Hp=1024,C_=3;function F_(e){let t=e.length*H.words,r=e.reduce((s,i)=>s+i.ranks.length,0),o=new Uint32Array(t+Math.max(1,r)),a=new Float32Array(o.buffer),n=0;return e.forEach((s,i)=>{o.set(s.ranks,t+n);let l={filterFirst:n,filterCount:s.ranks.length,include:s.include};Xf(o,a,i*H.words,{...s,...l}),n+=s.ranks.length}),{words:o,rays:e.length,filterWord:t}}function G_(e,t,r){let o=r&&e.layout.selectionRoots[r.placement],a=o&&Be(o);if(!r||!a)return null;let[n,s,i]=[t.origin,t.direction,r.distance],l=Gr(o.placement);return{object:a,point:new mt(n[0]+s[0]*i,n[1]+s[1]*i,n[2]+s[2]*i),normal:new mt(r.normal[0],r.normal[1],r.normal[2]),distance:i,face:r.page*2**ul+r.triangle,placement:Pr(o.placement),source:l?l.source??-1:void 0,hlod:P_(o,l,r.page)}}function P_(e,t,r){if(iu(e)){let o=r-(e.packedBase??0),a=e.hlod.cells[o];return a===void 0||a<0?void 0:{cell:a,level:e.pages[o].hlodLayer}}return t&&t.hlod>=0?{cell:t.hlod,level:$r(t)}:void 0}function at(e,t,r){let o=r&&new Uint32Array(r),a=r&&new Float32Array(r);t.forEach((n,s)=>n.settle(o?G_(e,n,Kf(o,a,s*U.words)):null))}function $_(e,t,r,o){return fi(t,{label:"Trillion3D ray hits",bytes:Hp*U.words*4,count:C_,chain:(a,n)=>void n.judged.then(a).catch(()=>at(e,n.asks)).finally(()=>(r.delete(n),o()))},(a,n,s)=>at(e,s.asks,s.refused?void 0:a))}function D_(e,t){la.error(`${xe} kernels refused:`,t),at(e.rt,e.asks.splice(0))}function k_(e,t,r,o,a){let{rt:n,device:s,query:i,ring:l,flying:c,schedule:u}=e;si(s,()=>{let h=s.createCommandEncoder({label:xe}),d=i.encode(h,o,F_(t.asks));h.copyBufferToBuffer(d.buffer,d.offset,r,0,d.bytes),s.queue.submit([h.finish()]),c.add(t),l.submitted(r),u()}).then(({error:h})=>{t.refused=h!==null,h&&la.error(`${xe} refused: ${h.message}`)},()=>{t.refused=!0,l.dropped(r),at(n,t.asks)}).finally(a)}function W_(e){let{rt:t,asks:r,query:o,records:a,ring:n}=e;if(!r.length)return;let s=Vp(t,a);if(!s)return at(t,r.splice(0));if(!o.compiled(e.schedule,e.refused))return;let{promise:i,resolve:l}=ei(),c={asks:r.splice(0,Hp),judged:i,refused:!1},u=n.take(c,c.asks.length*U.words*4);if(!u)return void ci(r,0,0,c.asks);k_(e,c,u,s,l)}function Up(e,t){let r=[],o=new Set,a=js(()=>W_(s)),n=()=>{r.length&&a.schedule()},s={rt:e,device:t,asks:r,flying:o,query:Mp(t),records:zf(e),ring:$_(e,t,o,n),schedule:n,refused:i=>D_(s,i)};return{cast(i,l,{reach:c=tn,lineReach:u=0,lineSlope:h=0}={}){let{ranks:d,include:g}=Gp(e.layout,l,e.context.placedTargets);if(g&&!d.length)return Promise.resolve(null);let{origin:R,direction:E}=i;return new Promise(y=>{r.push({origin:[R.x,R.y,R.z],direction:[E.x,E.y,E.z],reach:Math.min(c,tn),lineReach:Math.max(0,u),lineSlope:Math.max(0,h),ranks:d,include:g,settle:y}),n()})},moved:s.records.moved,dispose(){at(e,r.splice(0));for(let i of o)at(e,i.asks);o.clear(),s.ring.destroy(),s.query.dispose()}}}async function zp(e,...[t,r,o]){let a=e.gpu.device;return!a||e.run.lost?null:(e.rays??=Up(e,a)).cast(t,r,o)}var Yp=new WeakMap,B_=1,M_=50,V_=8,H_=3,U_=new mt(0,-1,0),qp=new mt,kt=Ve([]);function z_(e,t){let r=0;kt[r++]=t;let o=e.blendState.blendGpu;for(let n=0;n<o.length;n++){let s=Gt(o[n]);s&&(kt[r++]=s)}let a=e.layout.selectionRoots;for(let n=0;n<a.length;n++){let s=a[n];if(!s.deformation&&((s.mark??0)&il)===0)continue;let i=Be(s);i&&(kt[r++]=i)}return kt.length!==r&&(kt.length=r),kt}function Y_(e,t,r,o,a){t.pending=!0,t.answered=!1,t.x=a[0],t.z=a[2],t.frame=e.run.frame;let n=++t.serial,s=i=>{n===t.serial&&(t.y=i,t.pending=!1,t.answered=!0,t.misses=i===void 0?t.misses+1:0)};qp.set(a[0],o,a[2]),zp(e,new cu(qp,U_),{skip:z_(e,r)}).then(i=>s(i?.point.y),()=>s(void 0))}function q_(e,t,r,o,a){if(!t)return;let n=B(e,"thinWaterUnderwaterTraceDistance");if(a[0]<r[0]-n||a[0]>r[3]+n||a[2]<r[2]-n||a[2]>r[5]+n||a[1]>o+n)return;let s=Yp.get(t);s||Yp.set(t,s={x:NaN,z:NaN,y:void 0,answered:!1,pending:!1,serial:0,frame:-1/0,misses:0});let i=Math.max(Math.abs(a[0]-s.x),Math.abs(a[2]-s.z)),l=!(i<=B_),c=e.run.frame-s.frame>=V_,u=s.answered&&s.y===void 0&&s.misses<=H_;return(i>M_||!s.pending&&c&&(l||u))&&(l&&(s.misses=0),Y_(e,s,t,o,a)),s.answered&&!l?s.y:void 0}var Xp=new WeakMap;function Kp(e){let t=Xp.get(e);return t||Xp.set(e,t=(r,o,a,n)=>q_(e,r,o,a,n)),t}var X_=.01,Os=.1,Wt=Ve([]),jp=Ve([]);function K_(e,t,r,o){let a=jp[t]??(jp[t]={item:e,node:void 0,waves:void 0,underwater:!0,priority:0,depth:void 0,level:0,crest:0,surface:0,volume:new Float64Array(6)}),n=Gt(e),s=e.bounds;a.item=e,a.node=n,a.waves=n?.waves??void 0;let i=n?.waterBody;a.underwater=i?.underwaterPostProcess??!0,a.priority=i?.overlapPriority??0,a.depth=i?.depth,a.level=a.waves?.level??s[4],a.crest=a.waves?.crest??0,a.surface=a.level+a.crest;let l=a.volume;l[0]=s[0];let c=a.depth;return l[1]=Math.min(s[1],c!==void 0?a.level-c:o?.(n,s,a.level,r)??s[1]),l[2]=s[2],l[3]=s[3],l[4]=Math.max(s[4],a.surface),l[5]=s[5],a}var Zp=(e,t,r)=>e.waves?.height(t,r)??e.level;function j_(e,t,r,o){let a=e.volume,n=Math.max(a[0]-t[0],0,t[0]-a[3]),s=Math.max(a[2]-t[2],0,t[2]-a[5]),i=Math.max(t[1]-a[4],a[1]-(t[1]+o),0);return n*n+s*s+i*i<=r*r}function Z_(e){let t=1/e.projection[0],r=1/e.projection[5];return Gs(t,r)*(e.perspective?e.near:1)}var Q_=e=>!Vd(e)&&!!e.bounds;function J_(e,t){let r=!!e.waves;return r===!!t.waves?t.priority-e.priority:r?-1:1}var Qp=new Float64Array(6);function eS(e,t){let r=uo(e.node);if(!r)return!1;for(let o of r)if(!(!o.encompasses(t[0],t[1],t[2])||!o.excludes(e.node))&&(o.worldBounds(Qp),$s(e.volume,0,Qp,0)))return!0;return!1}var nt=Ve([]),ra=Ve([]);function Jp(e,t,r,o){let a=0;for(let n=0;n<Wt.length;n++)j_(Wt[n],t,r,o)&&(e[a++]=Wt[n]);e.length!==a&&(e.length=a)}function tm(e){return e.intersection="outside",e.depth=-1,e}function tS(e,t,r,o,a,n,s){tm(e);let i=0;for(let g=0;g<t.length;g++)Q_(t[g])&&(Wt[i]=K_(t[g],i,r,s),i++);if(Wt.length!==i&&(Wt.length=i),Jp(nt,r,a,a),!nt.length)return e;nt.length>1&&nt.sort(J_);let l=!1;for(let g of nt)l||=g.level+X_>r[1];l&&Jp(nt,r,n,0);let c=-1/0,u=0;for(let g of nt)!g.underwater||eS(g,r)||g.surface<=c||(c=g.surface,ra[u++]=g);ra.length!==u&&(ra.length=u);let h=!1,d=!1;for(let g of ra){let R=g.level-r[1];h||=R-o>g.crest,d||=Math.abs(R)-o<=g.crest;let E=Zp(g,r[0],r[2])-r[1],y=g.item.bounds,z=aa(r[0],y[0],y[3]),X=aa(r[2],y[2],y[5]),K=Math.abs(z-r[0])<=Os&&Math.abs(X-r[2])<=Os&&Math.abs(Zp(g,z,X)-r[1])<=Math.max(g.crest,Os);if(E>=0||K){e.depth=Math.max(E,e.depth);break}}return e.intersection=d?"possibly":h?"inside":"outside",e}var em=new WeakMap;function rS(e){let t=em.get(e);if(t||em.set(e,t={frame:-1,intersection:"outside",depth:-1,stage:"none"}),t.frame===e.run.frame)return t;if(t.frame=e.run.frame,tm(t),!We(e))return t.stage="none",t;if(B(e,"thinWaterUnderwaterTest")){let r=e.run.gate.cam,o=B(e,"thinWaterUnderwaterTraceDistance");tS(t,e.blendState.waterItems,r.eye,Z_(r),o,B(e,"thinWaterUnderwaterPreciseTraceDistance"),Kp(e))}return t.stage=t.depth>0?"before":"after",t}var rP={family:"water",points:["markedLayers","inTransparents"],wanted:We};var Rs=1,Bt={view:90,worlds:91,previous:92},aS=192,_P=4,om="vsMoved",SP={format:Al,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"zero",dstFactor:"one"}}},am=f("LAYER_MOTION_WGSL",[Ja("worlds",{group:Rs,binding:Bt.worlds,access:"read"}),Ja("previous",{group:Rs,binding:Bt.previous,access:"read"}),Wf],`
2408
- struct LayerMotionView{now:mat4x4f,before:mat4x4f,render:vec4f,eye:vec4f,exactEye:array<vec4u,2>}
2409
- @group(${Rs}) @binding(${Bt.view}) var<uniform> layerMotionView:LayerMotionView;
2410
- fn layerBefore(placement:u32,view:vec3f)->vec4f{
2411
- if(placement==${$t}u){return vec4f(0.0);}
2412
- let step=placementMotionAtEye(placement,layerMotionView.exactEye[0],layerMotionView.exactEye[1]);
2413
- return layerMotionView.before*(step*vec4f(view-layerMotionView.eye.xyz,1.0));
2414
- }
2415
- fn layerMotionOf(view:vec3f,before:vec4f)->vec2f{
2416
- if(before.w<=0.0){return vec2f(${65504}.0);}
2417
- let now=layerMotionView.now*vec4f(view-layerMotionView.eye.xyz,1.0);
2418
- return (now.xy/now.w-before.xy/before.w)*vec2f(0.5,-0.5)*layerMotionView.render.xy;
2419
- }`),rm={texture:{sampleType:"uint",viewDimension:"2d-array"}},xP=w(e=>e.createBindGroupLayout({label:"Trillion3D layers motion",entries:[{binding:Bt.view,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform",minBindingSize:aS}},{binding:Bt.worlds,visibility:GPUShaderStage.VERTEX,...rm},{binding:Bt.previous,visibility:GPUShaderStage.VERTEX,...rm}]}));var nS=Gi(_.surfaceFlags,Kr,"contactFlags"),nm=`contactAsked=contactShadowsAsked(in);contactMaterial=in.${I.material}&${Pt}u;`,sm=f("BLEND_CONTACT_SCENE_WGSL",[Et(Q,Le),ao,Hl],`${nS.wgsl}
2420
- var<private> contactAsked:bool=false;
2421
- var<private> contactMaterial:u32=0u;
2422
- fn contactSceneDepth(pixel:vec2i)->f32{return hizOpaqueDepth(pixel);}
2423
- fn contactSceneFlags(pixel:vec2i)->u32{return textureLoad(contactFlags,pixel).r;}
2424
- fn contactShadowsAsked(in:VSOut)->bool{return ${Dt("contactShadows")};}
2425
- fn contactOpacity(material:u32)->f32{return subsurfaceOpacityOfModel(materialAt(material).model);}`);var MP=(e,t,r,o,a=!1)=>{let n=!!t?.length;return{lit:e,graphs:n,shade:pp(bp(r),t),marks:o,sampledFront:a,depth:n&&vs(t),layer:n&&gs(t)}},VP=({lit:e})=>!e.lobeless,HP=(e,t)=>_p(e,t?.length?gp(t,e):void 0),UP=e=>`${hu(e.lit)}, ${e.graphs}${e.shade.key}${e.marks?", surface shadow marks":""}${e.sampledFront?", sampled front light":""}${e.depth?", pushed depth":""}${e.layer?", layer":""}`,sS=["roughDiffuse=uni.roughDiffuse!=0u;","shadingAccurate=uni.shadingAccurate!=0u;"],iS="surfaceChannels=blendChannelsOf(in);",zP=({lit:e},t,r="blend")=>[...sS,...e.contactless||r==="water"?[]:[nm],...e.channelless?[]:[iS]].join(`
2426
- ${t}`),YP=({lit:e})=>[...e.contactless?[]:[sm],...e.channelless?[]:[np]];var im=A("litFromFlags",[],`fn litFromFlags(model:u32)->u32{
2427
- let mode=(model>>${Bl}u)&3u;
2428
- return ((mode&1u)<<${ya}u)|(((mode>>1u)&1u)<<${Oa}u);
2429
- }`),lS=A("litFromCodeOf",[],`fn litFromCodeOf(flags:u32)->u32{
2430
- return ((flags>>${ya}u)&1u)|(((flags>>${Oa}u)&1u)<<1u);
2431
- }`),ZP=A("translucencyMedium",[lS],`fn translucencyMedium(flags:u32)->bool{
2432
- let mode=litFromCodeOf(flags);
2433
- return mode==${Ye.volumeMedium}u||mode==${Ye.volumeAmbient}u;
2434
- }`),QP=f("LIT_FROM_CODES_WGSL",[],`const LIT_LIGHTS:u32=${Ye.lights}u;
2435
- const LIT_VOLUME_SURFACE:u32=${Ye.volumeSurface}u;
2436
- const LIT_VOLUME_MEDIUM:u32=${Ye.volumeMedium}u;
2437
- const LIT_VOLUME_AMBIENT:u32=${Ye.volumeAmbient}u;`);var cS=~(La<<wa)>>>0,fS=f("BLEND_DIAGNOSTIC_CODE_WGSL",[],`fn blendDiagnosticCode(flags:u32)->u32{return (flags>>${wa}u)&${La}u;}`),uS=A("channelsAlt",[za],`fn channelsAlt(channels:u32)->u32{
2438
- var alt=0u;
2439
- for(var i=${nf}u;i>0u;i--){
2440
- let s=mapChannel(channels,i-1u);
2441
- if(s!=0u){alt=s;}
2442
- }
2443
- return alt;
2444
- }`),hS=A("channelsRead",[za],`fn channelsRead(channels:u32)->u32{
2445
- var read=0u;
2446
- for(var i=0u;i<${gt.length}u;i++){
2447
- if(mapChannel(channels,i)!=0u){read|=1u<<i;}
2448
- }
2449
- return read;
2450
- }`),dS=`let uv0=pageUv(page,h,v);var uv1=uv0;
2451
- var alt=channelsAlt(m.channels);
2452
- if(alt==0u&&m.lobes!=0u){alt=channelsAlt(physicalAt(m.lobes).channels);}
2453
- if(alt!=0u&&pageHasUvSet(page,h,alt)){uv1=pageUvSet(page,h,v,alt,normalTexels());}
2454
- out.uv=vec4f(uv0,uv1);out.${I.tri}|=channelsRead(m.channels)<<${gr}u;`,pS={lobed:{uv:"vec4f",ids:"vec4u",word:",it.material",page:"page.material=it.material;",read:[fu,uS,hS],write:dS},lobeless:{uv:"vec2f",ids:"vec3u",word:"",page:"",read:[],write:"out.uv=pageUv(page,h,v);"}},A1=(e,t,r=Jo,o=hc,a=!1,n=!1)=>{let s=pS[e?"lobed":"lobeless"],i=r.copies===!0,l=o.programs.length>0,c=u=>SS(s,t,r,l?vS(s.page,o,i):"",a,i,u);return f(`blendVertexWgsl(${e}${t?`, ${t}`:""}${r.key}${l?`, offsets ${dc(o)}`:""}${a?", graphs":""}${n?", motion":""})`,[Vc,Vi,he,i?rp:tp,...s.read,op,lp(s.uv,s.ids,t,r.extras,r.ordered,i),Sc,fS,sp,Ho,Oi,yi,im,Ep,jl,Vl,Ti,Zc,...r.declared,...t?[pi]:[],...l?[uu(o)]:[],...i?[hp]:[],...n?[cp(s.uv,s.ids,t,i),am]:[]],`${c(mS)}${n?`
2455
- ${c(gS)}`:""}${t==="pixel"?xS:""}`)},mS={name:"vs",struct:"VSOut",value:()=>"out",lanes:!0},gS={name:om,struct:"VSMoved",value:e=>`vsMovedOf(out,${e?"vec4f(0.0)":`layerBefore(select(it.placement,${$t}u,it.deform!=0u||it.wpo!=0u),out.view)`})`,lanes:!1},vS=(e,t,r)=>`page.world=it.world;page.wpo=it.wpo;page.wpoDisableSq=it.wpoDisableSq;page.wpoCentre=it.wpoCentre;page.wpoMost=it.wpoMost;${e?"":"page.material=it.material;"}${r&&t.programs.some(o=>o.uses.instance)?"page.random=it.random;page.fade=it.fade;":""}`,ES=` let span=clusterSpans[slot.y];
2456
- page.pageOffset=span.x;page.deformOutput=span.z;page.deformCount=span.w;
2457
- let count=span.y;
2458
-
2459
- var h:ClusterHeader;
2460
- var corners=vec3u(0u);var facing=0u;
2461
- if(local<count){
2462
- h=pageHeader(page);
2463
- corners=pageTriangle(page,h,local/3u);
2464
- if(cull!=0u){facing=vertexFacing(cull,it.world,page,h,corners);}
2465
- }
2466
- out.${I.material}=(it.material&${Pt}u)|(facing<<${dr}u);`,_S=(e,t)=>` let v=corners[local%3u];
2467
-
2468
- if((flags&${vl}u)!=0u){out.color*=pageColor(page,h,v);}
2469
- let p=pagePosition(page,h,v);
2470
- let world=it.world*vec4f(p,1.0);
2471
- out.position=uni.viewProj*world;out.view=world.xyz;
2472
- // A line quad widens on screen (\`lineClip\`), along the direction its corner's normal carries.
2473
- if(m.lineWidth>0.0){out.position=lineClip(out.position,uni.viewProj*(it.world*vec4f(pageNormal(page,h,v),0.0)),m.lineWidth,uni.viewport,uni.pixelRatio);}
2474
- // A sprite's quad turns to face the camera (\`spriteAt\`), about its origin.
2475
- if(m.sprite.y!=0.0){let s=spriteAt(uni.viewProj,it.world,p.xy,m.sprite);out.position=uni.viewProj*s;out.view=s.xyz;}
2476
- // The triangle's rank, and above it the item's light groups (\`TRI_LIGHT_GROUPS_SHIFT\`), its responsiveness code (\`TRI_RESPONSIVE_SHIFT\`),
2477
- // whether its object is held out and the flags of its material (\`TRI_MATERIAL_SHIFT\`).
2478
- out.${I.tri}=(local/3u)|(((it.flags>>${fs}u)&${Hs}u)<<${Ko}u)|(((it.flags>>${mr}u)&${Fr}u)<<${jo}u)|(select(0u,1u,(it.flags&${cs}u)!=0u)<<${hs}u)|((m.flags&${ap}u)<<${ds}u);
2479
- // The item's opacity clip (\`blendResponsive\`), in the word the diagnostic views' cluster word takes.
2480
- out.${I.diagId}=bitcast<u32>(it.opacityClip);
2481
- // The diagnostic views' cluster word and triangle (\`diagnosticColor\`), the opaque resolve's:
2482
-
2483
-
2484
- if((uni.viewFlags&${Cr}u)!=0u){
2485
- out.${I.diagId}=clusterIdentity(slot.y);
2486
- // The HLOD view's word, of a placement drawn as an HLOD level (\`ITEM_HLOD\`).
2487
- if(blendDiagnosticCode(uni.viewFlags)==${ia.hlod.code}u){out.${I.diagId}=diagnosticDrawnAs(out.${I.diagId},(it.flags>>${qo.shift}u)&${qo.mask}u);}
2488
- if(blendDiagnosticCode(uni.viewFlags)==${ia["screen-error"].code}u){out.${I.diagId}=bitcast<u32>(diagnosticWorldError(out.${I.diagId},it.world));}
2489
- }
2490
- ${e}out.bary=${t?"vec4f(cornerBarycentric(local%3u),blendCopyLane(it))":"cornerBarycentric(local%3u)"};
2491
- out.normal=vec4f(vec3f(0.0),out.normal.w);
2492
- if((flags&${Se}u)!=0u){out.normal=vec4f(xformNormal(it.world,pageNormal(page,h,v)),out.normal.w);}
2493
- out.tangent=vec4f(vec3f(0.0),out.tangent.w);out.bitangent=vec4f(vec3f(0.0),out.bitangent.w);
2494
- // A two-sided item's mirrored placement turns the vertex normal and tangent: the hardware \`front\`
2495
-
2496
- let turned=((flags&${ml}u)!=0u)!=((flags&${_e}u)!=0u&&!windingKept(worldMatrix3(it.world)));
2497
- if(turned){out.normal=vec4f(-out.normal.xyz,out.normal.w);}
2498
- // An item that reads a tangent reads its page's stored one or its source's floats (\`pageTangent\`);
2499
- // one without carries no flag (\`prepare.ts\`), its frame rebuilt from the screen (\`shaderSurface.ts\`).
2500
- if((flags&${Ne}u)!=0u){
2501
- let t=pageTangent(page,h,v);
2502
- out.tangent=vec4f(unitOrZero((it.world*vec4f(t.xyz,0.0)).xyz),out.tangent.w);
2503
- if(turned){out.tangent=vec4f(-out.tangent.xyz,out.tangent.w);}
2504
- out.bitangent=vec4f(unitOrZero(cross(out.normal.xyz,out.tangent.xyz)*t.w*select(1.0,-1.0,turned)),out.bitangent.w);
2505
- }`,SS=({ids:e,word:t,page:r,write:o},a,n,s,i,l,{name:c,struct:u,value:h,lanes:d})=>`@vertex fn ${c}(@builtin(vertex_index) vertexIndex:u32,@builtin(instance_index) instance:u32)->${af(u,a)}{
2506
- var out:VSOut;
2507
- let slot=planInstances[(vertexIndex>>uni.vertexShift)+instance];
2508
- let it=items[slot.x&${ea}u];
2509
- let cull=slot.x>>${ws}u;
2510
- let local=vertexIndex&lowBits(uni.vertexShift);
2511
- let flags=(it.flags&${Yo}u)|(uni.viewFlags&${cS}u);
2512
- var page:PageInfo;
2513
- page.flags=flags;page.vertexBase=it.vertexBase;page.deform=it.deform;${r}${s}
2514
- ${ES}
2515
- // A padding or dropped lane leaves the clip volume; every output but \`material\` and the normal stays zero, as declared.
2516
- if(local>=count||facing==${Vo}u){out.position=vec4f(0.0,0.0,2.0,1.0);out.normal=vec4f(0.0,0.0,1.0,0.0);return ${Ha(u,a,h(!0),"1.0")};}
2517
- // Its surface's record (\`materialAt\`): its factors, maps, model and fog, read once a drawn
2518
-
2519
- let m=materialAt(it.material);
2520
- // The unlit shading model shows its emission alone: no base colour, and the lit flag cleared (\`blendShadingFlags\`).${i?" A graph item carries its vertex colour alone (white where its row has none), which its graph reads (`blendTint`).":""}
2521
- out.color=${i?"select(":""}vec4f(select(m.baseColor,vec3f(0.0),shadingUnlitOfModel(m.model)),m.opacity)${i?",vec4f(1.0),m.graph!=0u)":""};
2522
- out.ids=${e}(m.mapIndex,blendShadingFlags(flags,m.model)|((m.model&${Dl}u)<<${ze}u)|(((m.model>>${kl}u)&7u)<<${Wl}u)|litFromFlags(m.model)|normalCurvatureFlag(m.model),m.emissiveIndex${t});
2523
- out.maps=vec4u(m.roughnessIndex,m.metalnessIndex,m.normalIndex,m.aoIndex);
2524
- out.alphaAo=vec4f(m.alphaTest,m.aoIntensity,m.dash);
2525
- // The second normal factor of the frame the item's normal map is read in (\`frameNormalScaleY\`).
2526
- out.pbr=vec4f(m.roughness,m.metalness,m.normalScale,select(m.normalScaleY,m.tangentNormalScaleY,(it.flags&${Ne}u)!=0u));
2527
- out.emissive=vec4f(m.emissive,f32(m.subsurfaceMap));
2528
- out.normal.w=m.subsurface.x;out.tangent.w=m.subsurface.y;out.bitangent.w=m.subsurface.z;
2529
- ${_S(d?n.vertexLanes:"",l)}
2530
- ${o}
2531
- return ${Ha(u,a,h(!1),"planeDistance(uni.clipPlane,out.view)")};
2532
- }`,xS=`
2533
- fn blendClipped(in:VSOut)->bool{return planeDistance(uni.clipPlane,in.view)<0.0;}
2534
- `,N1=(e,t)=>Ua(Ua(e,"VSOut","if(blendClipped(in)){discard;}",t),"VSMoved","if(blendClipped(vsOutOfMoved(in))){discard;}",t);var P1=f("BLEND_MAPS_WGSL",[],`${Da(_.color,"color")}
2535
- @group(0) @binding(${_.sampler}) var mapsSampler:sampler;
2536
- ${Da(_.data,"data")}`);export{hT as a,mm as b,dT as c,pT as d,pn as e,mT as f,gT as g,vT as h,ET as i,_T as j,vm as k,Em as l,Au as m,_m as n,ST as o,mn as p,xT as q,TT as r,Vd as s,xE as t,TE as u,wE as v,Be as w,LE as x,Bd as y,bE as z,UA as A,F2 as B,$o as C,G2 as D,P2 as E,zd as F,Yd as G,qd as H,hN as I,OE as J,NE as K,dN as L,IE as M,Xd as N,CE as O,TN as P,GE as Q,UN as R,zN as S,YN as T,qN as U,XN as V,Yo as W,qo as X,PE as Y,Uo as Z,kE as _,WE as $,KN as aa,jN as ba,ZN as ca,lS as da,ZP as ea,QP as fa,Cw as ga,Mu as ha,J as ia,ve as ja,KL as ka,hh as la,jL as ma,dh as na,ZL as oa,QL as pa,JL as qa,eb as ra,wg as sa,tb as ta,ph as ua,lb as va,mh as wa,gh as xa,bg as ya,Ze as za,yt as Aa,or as Ba,Qe as Ca,nr as Da,xb as Ea,Ke as Fa,wh as Ga,Ot as Ha,je as Ia,Ng as Ja,wb as Ka,Lb as La,bb as Ma,bh as Na,Nb as Oa,yh as Pa,Oh as Qa,Pg as Ra,Ib as Sa,At as Ta,xo as Ua,$g as Va,Yb as Wa,qb as Xa,Xb as Ya,vR as Za,bo as _a,Ct as $a,rd as ab,Oo as bb,Wn as cb,Bn as db,yv as eb,wR as fb,LR as gb,Mn as hb,Hn as ib,od as jb,bR as kb,yR as lb,Un as mb,OR as nb,RR as ob,AR as pb,NR as qb,dr as rb,Pt as sb,qA as tb,XA as ub,I as vb,mI as wb,gr as xb,hs as yb,Dt as zb,_u as Ab,Qt as Bb,Tx as Cb,wx as Db,Lx as Eb,bx as Fb,Jt as Gb,yx as Hb,Ox as Ib,ps as Jb,AI as Kb,NI as Lb,fp as Mb,ms as Nb,pp as Ob,le as Pb,BE as Qb,gp as Rb,uC as Sb,hC as Tb,vp as Ub,$C as Vb,_p as Wb,Qo as Xb,ot as Yb,vr as Zb,XC as _b,Jo as $b,lm as ac,TS as bc,wS as cc,LS as dc,nn as ec,L as fc,RS as gc,AS as hc,NS as ic,IS as jc,wt as kc,Lt as lc,Xe as mc,CS as nc,FS as oc,GS as pc,ho as qc,po as rc,bt as sc,se as tc,pu as uc,mu as vc,gu as wc,US as xc,zS as yc,YS as zc,jS as Ac,vu as Bc,xu as Cc,Tu as Dc,fn as Ec,cn as Fc,fm as Gc,Gx as Hc,Px as Ic,wu as Jc,mo as Kc,um as Lc,Mx as Mc,jx as Nc,yu as Oc,dm as Pc,Ou as Qc,tT as Rc,go as Sc,hn as Tc,rT as Uc,oT as Vc,aT as Wc,Iu as Xc,GT as Yc,PT as Zc,$T as _c,DT as $c,gn as ad,kT as bd,Cu as cd,QT as dd,JT as ed,$u as fd,Am as gd,ew as hd,Nm as id,Fu as jd,tw as kd,Cm as ld,Du as md,vn as nd,rw as od,ow as pd,aw as qd,nw as rd,sw as sd,Gu as td,Pu as ud,iw as vd,lw as wd,cw as xd,Fm as yd,fw as zd,uw as Ad,ku as Bd,hw as Cd,dw as Dd,pw as Ed,Ow as Fd,En as Gd,Rw as Hd,Aw as Id,Bm as Jd,Wu as Kd,Vm as Ld,Hm as Md,Vu as Nd,Hu as Od,_n as Pd,Xu as Qd,Mw as Rd,qm as Sd,Vw as Td,ju as Ud,Hw as Vd,Uw as Wd,zw as Xd,Ju as Yd,rr as Zd,eh as _d,$e as $d,C as ae,Sn as be,tL as ce,be as de,OL as ee,BL as fe,lg as ge,uh as he,Zb as ie,Ch as je,Qb as ke,S0 as le,F as me,qg as ne,x0 as oe,lr as pe,Xg as qe,T0 as re,w0 as se,L0 as te,Fh as ue,In as ve,b0 as we,y0 as xe,av as ye,O0 as ze,R0 as Ae,A0 as Be,N0 as Ce,I0 as De,C0 as Ee,D0 as Fe,Dh as Ge,k0 as He,W0 as Ie,B0 as Je,M0 as Ke,V0 as Le,H0 as Me,Q0 as Ne,tt as Oe,J0 as Pe,ey as Qe,ty as Re,ry as Se,oy as Te,ay as Ue,ny as Ve,sy as We,iy as Xe,kh as Ye,Wh as Ze,ly as _e,sv as $e,iv as af,Bh as bf,dy as cf,lv as df,Mh as ef,uv as ff,Pn as gf,My as hf,pv as if,mv as jf,Vh as kf,Dn as lf,Hh as mf,Uh as nf,zh as of,mO as pf,gO as qf,vO as rf,EO as sf,_O as tf,Yh as uf,Kh as vf,jh as wf,Zh as xf,Qh as yf,_v as zf,rR as Af,kn as Bf,ed as Cf,pR as Df,wv as Ef,mR as Ff,HR as Gf,UR as Hf,re as If,zR as Jf,YR as Kf,Rv as Lf,qR as Mf,Ro as Nf,Ao as Of,XR as Pf,KR as Qf,jR as Rf,Av as Sf,No as Tf,n3 as Uf,s3 as Vf,ur as Wf,Nv as Xf,Yn as Yf,fd as Zf,ud as _f,S3 as $f,x3 as ag,T3 as bg,qn as cg,Cv as dg,w3 as eg,pd as fg,gd as gg,vd as hg,_d as ig,Y3 as jg,q3 as kg,X3 as lg,K3 as mg,j3 as ng,Z3 as og,Q3 as pg,Sd as qg,J3 as rg,e2 as sg,t2 as tg,r2 as ug,Wv as vg,Bv as wg,Mv as xg,o2 as yg,a2 as zg,n2 as Ag,s2 as Bg,i2 as Cg,Po as Dg,l2 as Eg,xd as Fg,Vv as Gg,Zn as Hg,c2 as Ig,f2 as Jg,Uv as Kg,u2 as Lg,h2 as Mg,Qn as Ng,zv as Og,d2 as Pg,p2 as Qg,jn as Rg,Yv as Sg,Td as Tg,m2 as Ug,g2 as Vg,v2 as Wg,E2 as Xg,Kv as Yg,b2 as Zg,y2 as _g,jv as $g,es as ah,z2 as bh,Do as ch,Id as dh,Cd as eh,J2 as fh,aA as gh,Pd as hh,sA as ih,Wo as jh,mE as kh,vE as lh,EE as mh,We as nh,_E as oh,Mo as ph,kA as qh,SE as rh,g_ as sh,pF as th,mF as uh,ws as vh,ea as wh,xF as xh,TF as yh,wF as zh,Np as Ah,S_ as Bh,Rp as Ch,eF as Dh,h_ as Eh,d_ as Fh,Ap as Gh,m_ as Hh,b_ as Ih,Ls as Jh,ys as Kh,kF as Lh,WF as Mh,zp as Nh,rS as Oh,rP as Ph,Rs as Qh,Bt as Rh,aS as Sh,_P as Th,om as Uh,SP as Vh,xP as Wh,A1 as Xh,N1 as Yh,P1 as Zh,MP as _h,VP as $h,HP as ai,UP as bi,zP as ci,YP as di};
2537
- //# sourceMappingURL=trillion3d-chunk-TLVZXCTJ.js.map