@babylonjs/lite 0.1.1

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 (417) hide show
  1. package/_math-factory-C-QqW-Wi.js +55 -0
  2. package/_math-factory-C-QqW-Wi.js.map +1 -0
  3. package/add-block-CikX5gWy.js +6 -0
  4. package/add-block-CikX5gWy.js.map +1 -0
  5. package/alpha-test-fragment-CUiHCw7W.js +22 -0
  6. package/alpha-test-fragment-CUiHCw7W.js.map +1 -0
  7. package/ambient-occlusion-block-DForhWL3.js +77 -0
  8. package/ambient-occlusion-block-DForhWL3.js.map +1 -0
  9. package/anisotropy-block-D5fXH_OY.js +12 -0
  10. package/anisotropy-block-D5fXH_OY.js.map +1 -0
  11. package/anisotropy-fragment-HgasXS7l.js +89 -0
  12. package/anisotropy-fragment-HgasXS7l.js.map +1 -0
  13. package/arc-tan2-block-d8sWt_x0.js +12 -0
  14. package/arc-tan2-block-d8sWt_x0.js.map +1 -0
  15. package/assets/splat-sort-worker-Crg3CaCc.js.map +1 -0
  16. package/background-dds-skybox-yHTqabU3.js +221 -0
  17. package/background-dds-skybox-yHTqabU3.js.map +1 -0
  18. package/background-ground-DIw6D3qf.js +235 -0
  19. package/background-ground-DIw6D3qf.js.map +1 -0
  20. package/background-hdr-skybox-c4uuTmkP.js +179 -0
  21. package/background-hdr-skybox-c4uuTmkP.js.map +1 -0
  22. package/background-solid-skybox-DPGBpPbm.js +235 -0
  23. package/background-solid-skybox-DPGBpPbm.js.map +1 -0
  24. package/bake-local-matrix-Dfpd3b06.js +28 -0
  25. package/bake-local-matrix-Dfpd3b06.js.map +1 -0
  26. package/billboard-renderable-D8mlVGCd.js +242 -0
  27. package/billboard-renderable-D8mlVGCd.js.map +1 -0
  28. package/biplanar-block-DZnKuV81.js +115 -0
  29. package/biplanar-block-DZnKuV81.js.map +1 -0
  30. package/bones-block-D6IhqUVV.js +31 -0
  31. package/bones-block-D6IhqUVV.js.map +1 -0
  32. package/clamp-block-BdII67hT.js +21 -0
  33. package/clamp-block-BdII67hT.js.map +1 -0
  34. package/clearcoat-block-BGML4npi.js +12 -0
  35. package/clearcoat-block-BGML4npi.js.map +1 -0
  36. package/clearcoat-fragment-LCiG98Rf.js +256 -0
  37. package/clearcoat-fragment-LCiG98Rf.js.map +1 -0
  38. package/clip-planes-block-BPfFJrbf.js +26 -0
  39. package/clip-planes-block-BPfFJrbf.js.map +1 -0
  40. package/cloud-block-BeVrangc.js +90 -0
  41. package/cloud-block-BeVrangc.js.map +1 -0
  42. package/color-converter-block-CvwKiW4k.js +123 -0
  43. package/color-converter-block-CvwKiW4k.js.map +1 -0
  44. package/color-merger-CCu21ZII.js +57 -0
  45. package/color-merger-CCu21ZII.js.map +1 -0
  46. package/color-splitter-CGn1G4ow.js +33 -0
  47. package/color-splitter-CGn1G4ow.js.map +1 -0
  48. package/conditional-block-Cd2pbejI.js +51 -0
  49. package/conditional-block-Cd2pbejI.js.map +1 -0
  50. package/create-skeleton-C9JdIJnb.js +44 -0
  51. package/create-skeleton-C9JdIJnb.js.map +1 -0
  52. package/cross-block-DCrLwCpt.js +12 -0
  53. package/cross-block-DCrLwCpt.js.map +1 -0
  54. package/cubemap-skybox-material-DvXMVc4k.js +79 -0
  55. package/cubemap-skybox-material-DvXMVc4k.js.map +1 -0
  56. package/curve-block-BlJpXVYv.js +89 -0
  57. package/curve-block-BlJpXVYv.js.map +1 -0
  58. package/debug-block-D2pg4Yf6.js +14 -0
  59. package/debug-block-D2pg4Yf6.js.map +1 -0
  60. package/derivative-block-B8KjtaWs.js +20 -0
  61. package/derivative-block-B8KjtaWs.js.map +1 -0
  62. package/desaturate-block-C1RghNSB.js +15 -0
  63. package/desaturate-block-C1RghNSB.js.map +1 -0
  64. package/discard-block-B2jKjaEL.js +21 -0
  65. package/discard-block-B2jKjaEL.js.map +1 -0
  66. package/distance-block-3NkgFZ3f.js +16 -0
  67. package/distance-block-3NkgFZ3f.js.map +1 -0
  68. package/divide-block-ZyepIg_-.js +6 -0
  69. package/divide-block-ZyepIg_-.js.map +1 -0
  70. package/dot-block-VlfAC6cD.js +16 -0
  71. package/dot-block-VlfAC6cD.js.map +1 -0
  72. package/elbow-block-NEOiIxzO.js +10 -0
  73. package/elbow-block-NEOiIxzO.js.map +1 -0
  74. package/emissive-fragment-BnNvbBCw.js +39 -0
  75. package/emissive-fragment-BnNvbBCw.js.map +1 -0
  76. package/esm-shadow-view-DGKdF1NI.js +18 -0
  77. package/esm-shadow-view-DGKdF1NI.js.map +1 -0
  78. package/esm-shadow-view-DN9HIaM4.js +15 -0
  79. package/esm-shadow-view-DN9HIaM4.js.map +1 -0
  80. package/esm-shadow-view-Dk9NFtLq.js +15 -0
  81. package/esm-shadow-view-Dk9NFtLq.js.map +1 -0
  82. package/fog-block-DJ9hEolm.js +41 -0
  83. package/fog-block-DJ9hEolm.js.map +1 -0
  84. package/frag-coord-block-DzXfFgfV.js +25 -0
  85. package/frag-coord-block-DzXfFgfV.js.map +1 -0
  86. package/frag-depth-block-UQbeKP2D.js +34 -0
  87. package/frag-depth-block-UQbeKP2D.js.map +1 -0
  88. package/fragment-output-BOphkIeh.js +26 -0
  89. package/fragment-output-BOphkIeh.js.map +1 -0
  90. package/fresnel-block-DefHWeO-.js +20 -0
  91. package/fresnel-block-DefHWeO-.js.map +1 -0
  92. package/front-facing-0d6aiyrv.js +11 -0
  93. package/front-facing-0d6aiyrv.js.map +1 -0
  94. package/gaussian-splatting-pipeline-sh-DgJl7l56.js +500 -0
  95. package/gaussian-splatting-pipeline-sh-DgJl7l56.js.map +1 -0
  96. package/gltf-animation-D7uyTyO3.js +245 -0
  97. package/gltf-animation-D7uyTyO3.js.map +1 -0
  98. package/gltf-ext-anisotropy-CknJiJK8.js +22 -0
  99. package/gltf-ext-anisotropy-CknJiJK8.js.map +1 -0
  100. package/gltf-ext-basisu-CPg5kPrx.js +452 -0
  101. package/gltf-ext-basisu-CPg5kPrx.js.map +1 -0
  102. package/gltf-ext-clearcoat-CLH2SVph.js +31 -0
  103. package/gltf-ext-clearcoat-CLH2SVph.js.map +1 -0
  104. package/gltf-ext-dielectric-qHzlnvdl.js +105 -0
  105. package/gltf-ext-dielectric-qHzlnvdl.js.map +1 -0
  106. package/gltf-ext-emissive-strength-nzGZXZVK.js +19 -0
  107. package/gltf-ext-emissive-strength-nzGZXZVK.js.map +1 -0
  108. package/gltf-ext-iridescence-C6bq7jiM.js +26 -0
  109. package/gltf-ext-iridescence-C6bq7jiM.js.map +1 -0
  110. package/gltf-ext-node-visibility-MafA9ot2.js +25 -0
  111. package/gltf-ext-node-visibility-MafA9ot2.js.map +1 -0
  112. package/gltf-ext-orm-CT18G_vQ.js +33 -0
  113. package/gltf-ext-orm-CT18G_vQ.js.map +1 -0
  114. package/gltf-ext-quantization-CpZyLDIz.js +94 -0
  115. package/gltf-ext-quantization-CpZyLDIz.js.map +1 -0
  116. package/gltf-ext-sheen-BgIxUzyZ.js +25 -0
  117. package/gltf-ext-sheen-BgIxUzyZ.js.map +1 -0
  118. package/gltf-ext-spec-gloss-D0LJLBUM.js +24 -0
  119. package/gltf-ext-spec-gloss-D0LJLBUM.js.map +1 -0
  120. package/gltf-ext-unlit-D2ANui0V.js +16 -0
  121. package/gltf-ext-unlit-D2ANui0V.js.map +1 -0
  122. package/gltf-ext-uv-transform-CE_-T1Tr.js +38 -0
  123. package/gltf-ext-uv-transform-CE_-T1Tr.js.map +1 -0
  124. package/gltf-feature-animation-pointer-BjpwOOqo.js +88 -0
  125. package/gltf-feature-animation-pointer-BjpwOOqo.js.map +1 -0
  126. package/gltf-feature-animations-CCizegp8.js +15 -0
  127. package/gltf-feature-animations-CCizegp8.js.map +1 -0
  128. package/gltf-feature-draco-yGSMGTE3.js +124 -0
  129. package/gltf-feature-draco-yGSMGTE3.js.map +1 -0
  130. package/gltf-feature-gpu-instancing-2e_CFQnl.js +151 -0
  131. package/gltf-feature-gpu-instancing-2e_CFQnl.js.map +1 -0
  132. package/gltf-feature-lights-punctual-DDDg4j0U.js +71 -0
  133. package/gltf-feature-lights-punctual-DDDg4j0U.js.map +1 -0
  134. package/gltf-feature-meshopt-Des96YFI.js +84 -0
  135. package/gltf-feature-meshopt-Des96YFI.js.map +1 -0
  136. package/gltf-feature-morph-CKCw6tkX.js +29 -0
  137. package/gltf-feature-morph-CKCw6tkX.js.map +1 -0
  138. package/gltf-feature-skeleton-D8hWLqi2.js +36 -0
  139. package/gltf-feature-skeleton-D8hWLqi2.js.map +1 -0
  140. package/gltf-feature-variants-Ds6v9byg.js +17 -0
  141. package/gltf-feature-variants-Ds6v9byg.js.map +1 -0
  142. package/gltf-feature-xmp-BUfq_IVG.js +15 -0
  143. package/gltf-feature-xmp-BUfq_IVG.js.map +1 -0
  144. package/gltf-glb-parser-D6UZWFuC.js +27 -0
  145. package/gltf-glb-parser-D6UZWFuC.js.map +1 -0
  146. package/gltf-interleave-DGnUlz28.js +241 -0
  147. package/gltf-interleave-DGnUlz28.js.map +1 -0
  148. package/gltf-pbr-builder-ext-BFOxOCnQ.js +85 -0
  149. package/gltf-pbr-builder-ext-BFOxOCnQ.js.map +1 -0
  150. package/gltf-variants-DFbr8EES.js +88 -0
  151. package/gltf-variants-DFbr8EES.js.map +1 -0
  152. package/gradient-block-DL_60sDc.js +50 -0
  153. package/gradient-block-DL_60sDc.js.map +1 -0
  154. package/gs-picking-pipeline-DzfMASL9.js +280 -0
  155. package/gs-picking-pipeline-DzfMASL9.js.map +1 -0
  156. package/height-to-normal-block-DhPHkDFg.js +65 -0
  157. package/height-to-normal-block-DhPHkDFg.js.map +1 -0
  158. package/ibl-fragment-DqQVi8k0.js +91 -0
  159. package/ibl-fragment-DqQVi8k0.js.map +1 -0
  160. package/ibl-skybox-wgsl-DCah0kWV.js +13 -0
  161. package/ibl-skybox-wgsl-DCah0kWV.js.map +1 -0
  162. package/image-processing-block-DwrhhmuF.js +40 -0
  163. package/image-processing-block-DwrhhmuF.js.map +1 -0
  164. package/image-source-BuMJgd9-.js +17 -0
  165. package/image-source-BuMJgd9-.js.map +1 -0
  166. package/index-C8HOR2sB.js +19222 -0
  167. package/index-C8HOR2sB.js.map +1 -0
  168. package/index.d.ts +4611 -0
  169. package/index.js +309 -0
  170. package/index.js.map +1 -0
  171. package/input-block-DgAJBzN_.js +109 -0
  172. package/input-block-DgAJBzN_.js.map +1 -0
  173. package/instances-block-BaSSiz8m.js +12 -0
  174. package/instances-block-BaSSiz8m.js.map +1 -0
  175. package/iridescence-block-B0pRFoOU.js +67 -0
  176. package/iridescence-block-B0pRFoOU.js.map +1 -0
  177. package/iridescence-fragment-Gymp7or5.js +243 -0
  178. package/iridescence-fragment-Gymp7or5.js.map +1 -0
  179. package/length-block-ChOkeiHR.js +11 -0
  180. package/length-block-ChOkeiHR.js.map +1 -0
  181. package/lerp-block-DjI2SfmI.js +18 -0
  182. package/lerp-block-DjI2SfmI.js.map +1 -0
  183. package/light-block-B11ew7FA.js +123 -0
  184. package/light-block-B11ew7FA.js.map +1 -0
  185. package/light-information-VJbW0jbs.js +19 -0
  186. package/light-information-VJbW0jbs.js.map +1 -0
  187. package/loop-block-Bb23EOMb.js +71 -0
  188. package/loop-block-Bb23EOMb.js.map +1 -0
  189. package/manifold-AS8POaOr.js +3022 -0
  190. package/manifold-AS8POaOr.js.map +1 -0
  191. package/manifold-RCa7RkKz.js +5 -0
  192. package/manifold-RCa7RkKz.js.map +1 -0
  193. package/matrix-blocks-acWn_V6g.js +51 -0
  194. package/matrix-blocks-acWn_V6g.js.map +1 -0
  195. package/max-block-CjFgljZ7.js +6 -0
  196. package/max-block-CjFgljZ7.js.map +1 -0
  197. package/mesh-attribute-exists-block-BfK8UiSL.js +44 -0
  198. package/mesh-attribute-exists-block-BfK8UiSL.js.map +1 -0
  199. package/mesh-features-BLENkYVt.js +341 -0
  200. package/mesh-features-BLENkYVt.js.map +1 -0
  201. package/min-block-CHtBngNl.js +6 -0
  202. package/min-block-CHtBngNl.js.map +1 -0
  203. package/mod-block-Ceizv8Y7.js +6 -0
  204. package/mod-block-Ceizv8Y7.js.map +1 -0
  205. package/morph-fragment-DOVo70gP.js +59 -0
  206. package/morph-fragment-DOVo70gP.js.map +1 -0
  207. package/morph-targets-55z342ZB.js +35 -0
  208. package/morph-targets-55z342ZB.js.map +1 -0
  209. package/multilight-wgsl-BGyiIOp3.js +112 -0
  210. package/multilight-wgsl-BGyiIOp3.js.map +1 -0
  211. package/multiply-block-DaXLJ7Ud.js +6 -0
  212. package/multiply-block-DaXLJ7Ud.js.map +1 -0
  213. package/negate-block-9CSLc5pM.js +6 -0
  214. package/negate-block-9CSLc5pM.js.map +1 -0
  215. package/nlerp-block-BNK1adIb.js +21 -0
  216. package/nlerp-block-BNK1adIb.js.map +1 -0
  217. package/node-env-BPZXZzBf.js +39 -0
  218. package/node-env-BPZXZzBf.js.map +1 -0
  219. package/node-registry-DwgC4yth.js +190 -0
  220. package/node-registry-DwgC4yth.js.map +1 -0
  221. package/node-registry-extra-advanced-2DJVt67-.js +45 -0
  222. package/node-registry-extra-advanced-2DJVt67-.js.map +1 -0
  223. package/node-registry-extra-compat-Dhrw8fDQ.js +41 -0
  224. package/node-registry-extra-compat-Dhrw8fDQ.js.map +1 -0
  225. package/node-registry-extra-math-CsAHvIZo.js +49 -0
  226. package/node-registry-extra-math-CsAHvIZo.js.map +1 -0
  227. package/node-registry-extra-procedural-5pLQ3Bhz.js +45 -0
  228. package/node-registry-extra-procedural-5pLQ3Bhz.js.map +1 -0
  229. package/node-renderable-DlLIdBmd.js +269 -0
  230. package/node-renderable-DlLIdBmd.js.map +1 -0
  231. package/node-shadow-DKrcqmNg.js +122 -0
  232. package/node-shadow-DKrcqmNg.js.map +1 -0
  233. package/node-snippet-DUMm9qEO.js +22 -0
  234. package/node-snippet-DUMm9qEO.js.map +1 -0
  235. package/normal-blend-block-BfH_nBoj.js +29 -0
  236. package/normal-blend-block-BfH_nBoj.js.map +1 -0
  237. package/normal-map-fragment-DpsIXrJf.js +38 -0
  238. package/normal-map-fragment-DpsIXrJf.js.map +1 -0
  239. package/normalize-block-F2bLNj9K.js +6 -0
  240. package/normalize-block-F2bLNj9K.js.map +1 -0
  241. package/oneminus-block-BP9x4Dc3.js +6 -0
  242. package/oneminus-block-BP9x4Dc3.js.map +1 -0
  243. package/opposite-block-Cnqmm-lH.js +6 -0
  244. package/opposite-block-Cnqmm-lH.js.map +1 -0
  245. package/package.json +26 -0
  246. package/panner-block-BwMQq-6Y.js +13 -0
  247. package/panner-block-BwMQq-6Y.js.map +1 -0
  248. package/parse-camera-DM3oJJeT.js +23 -0
  249. package/parse-camera-DM3oJJeT.js.map +1 -0
  250. package/pbr-aces-wgsl-HpiQHGN_.js +13 -0
  251. package/pbr-aces-wgsl-HpiQHGN_.js.map +1 -0
  252. package/pbr-metallic-roughness-block-full-6vMm1Jk6.js +763 -0
  253. package/pbr-metallic-roughness-block-full-6vMm1Jk6.js.map +1 -0
  254. package/pbr-metallic-roughness-block-h_KAOZrW.js +104 -0
  255. package/pbr-metallic-roughness-block-h_KAOZrW.js.map +1 -0
  256. package/pbr-mr-helper-core-CIwm-T1G.js +237 -0
  257. package/pbr-mr-helper-core-CIwm-T1G.js.map +1 -0
  258. package/pbr-refraction-DGmMSa2v.js +17 -0
  259. package/pbr-refraction-DGmMSa2v.js.map +1 -0
  260. package/pbr-renderable-BJxUtPBb.js +961 -0
  261. package/pbr-renderable-BJxUtPBb.js.map +1 -0
  262. package/pbr-shadow-fragment-LO9SlbJj.js +14 -0
  263. package/pbr-shadow-fragment-LO9SlbJj.js.map +1 -0
  264. package/pbr-template-ext-8q7BcTDf.js +88 -0
  265. package/pbr-template-ext-8q7BcTDf.js.map +1 -0
  266. package/pbr-tracking-B3alzn91.js +31 -0
  267. package/pbr-tracking-B3alzn91.js.map +1 -0
  268. package/pbr-transmission-ext-BxW4CEGu.js +581 -0
  269. package/pbr-transmission-ext-BxW4CEGu.js.map +1 -0
  270. package/perturb-normal-0Q8EM9ig.js +39 -0
  271. package/perturb-normal-0Q8EM9ig.js.map +1 -0
  272. package/posterize-block-DfdKsbEf.js +28 -0
  273. package/posterize-block-DfdKsbEf.js.map +1 -0
  274. package/pow-block-DI5ICzhc.js +13 -0
  275. package/pow-block-DI5ICzhc.js.map +1 -0
  276. package/random-number-block-2OyRYljF.js +15 -0
  277. package/random-number-block-2OyRYljF.js.map +1 -0
  278. package/reciprocal-block-Ck3CW-j-.js +14 -0
  279. package/reciprocal-block-Ck3CW-j-.js.map +1 -0
  280. package/reflect-block-CizpzrX4.js +12 -0
  281. package/reflect-block-CizpzrX4.js.map +1 -0
  282. package/reflectance-fragment-BCrgPmrt.js +143 -0
  283. package/reflectance-fragment-BCrgPmrt.js.map +1 -0
  284. package/reflection-block-DqcwyYqr.js +12 -0
  285. package/reflection-block-DqcwyYqr.js.map +1 -0
  286. package/reflection-texture-base-block-1xmJ0HDj.js +10 -0
  287. package/reflection-texture-base-block-1xmJ0HDj.js.map +1 -0
  288. package/reflection-texture-block-C3QtzoV8.js +60 -0
  289. package/reflection-texture-block-C3QtzoV8.js.map +1 -0
  290. package/refract-block-HHiAk-7U.js +13 -0
  291. package/refract-block-HHiAk-7U.js.map +1 -0
  292. package/refraction-block-U8y6XiXs.js +11 -0
  293. package/refraction-block-U8y6XiXs.js.map +1 -0
  294. package/refraction-dispersion-wgsl-DdQCyyO1.js +16 -0
  295. package/refraction-dispersion-wgsl-DdQCyyO1.js.map +1 -0
  296. package/remap-block-DxK1W1vp.js +27 -0
  297. package/remap-block-DxK1W1vp.js.map +1 -0
  298. package/replace-color-block-1m--hiru.js +17 -0
  299. package/replace-color-block-1m--hiru.js.map +1 -0
  300. package/rgbd-decode-DCvzUYeI.js +110 -0
  301. package/rgbd-decode-DCvzUYeI.js.map +1 -0
  302. package/rotate2d-block-nEe1N2MJ.js +15 -0
  303. package/rotate2d-block-nEe1N2MJ.js.map +1 -0
  304. package/scale-block-C5Z8159G.js +13 -0
  305. package/scale-block-C5Z8159G.js.map +1 -0
  306. package/scene-material-swap-C2ykv55W.js +34 -0
  307. package/scene-material-swap-C2ykv55W.js.map +1 -0
  308. package/screen-size-block-BVNnOvE8.js +21 -0
  309. package/screen-size-block-BVNnOvE8.js.map +1 -0
  310. package/screen-space-block-CwaxdfSe.js +28 -0
  311. package/screen-space-block-CwaxdfSe.js.map +1 -0
  312. package/shader-renderable-D-6796KR.js +531 -0
  313. package/shader-renderable-D-6796KR.js.map +1 -0
  314. package/shadow-fragment-core-DHN2G6FI.js +110 -0
  315. package/shadow-fragment-core-DHN2G6FI.js.map +1 -0
  316. package/shadow-map-CQNQC-Fw.js +13 -0
  317. package/shadow-map-CQNQC-Fw.js.map +1 -0
  318. package/sheen-block-BugfJqK3.js +12 -0
  319. package/sheen-block-BugfJqK3.js.map +1 -0
  320. package/sheen-fragment-Dze2f7XJ.js +215 -0
  321. package/sheen-fragment-Dze2f7XJ.js.map +1 -0
  322. package/simplex-perlin-3d-block-CcMtofzV.js +58 -0
  323. package/simplex-perlin-3d-block-CcMtofzV.js.map +1 -0
  324. package/singlelight-directional-wgsl-CmUDZxwz.js +39 -0
  325. package/singlelight-directional-wgsl-CmUDZxwz.js.map +1 -0
  326. package/singlelight-hemispheric-wgsl-t-83IP_s.js +40 -0
  327. package/singlelight-hemispheric-wgsl-t-83IP_s.js.map +1 -0
  328. package/singlelight-point-wgsl-CLzULIYV.js +45 -0
  329. package/singlelight-point-wgsl-CLzULIYV.js.map +1 -0
  330. package/singlelight-spot-wgsl-DEEUrfVM.js +47 -0
  331. package/singlelight-spot-wgsl-DEEUrfVM.js.map +1 -0
  332. package/skeleton-fragment-B_XlFbtx.js +71 -0
  333. package/skeleton-fragment-B_XlFbtx.js.map +1 -0
  334. package/skybox-renderable-DDwzu-PT.js +92 -0
  335. package/skybox-renderable-DDwzu-PT.js.map +1 -0
  336. package/skybox.vertex-DJgi072W.js +5 -0
  337. package/skybox.vertex-DJgi072W.js.map +1 -0
  338. package/smoothstep-block-Di4t37x-.js +15 -0
  339. package/smoothstep-block-Di4t37x-.js.map +1 -0
  340. package/splat-ply-compressed-BahdBG1r.js +394 -0
  341. package/splat-ply-compressed-BahdBG1r.js.map +1 -0
  342. package/standard-renderable-GjxL9xSf.js +636 -0
  343. package/standard-renderable-GjxL9xSf.js.map +1 -0
  344. package/std-ambient-fragment-BoUsD06w.js +37 -0
  345. package/std-ambient-fragment-BoUsD06w.js.map +1 -0
  346. package/std-cube-reflection-fragment-ulqc3bsP.js +31 -0
  347. package/std-cube-reflection-fragment-ulqc3bsP.js.map +1 -0
  348. package/std-emissive-fragment-DNGj1HdQ.js +40 -0
  349. package/std-emissive-fragment-DNGj1HdQ.js.map +1 -0
  350. package/std-lightmap-fragment-Bqj89aIe.js +37 -0
  351. package/std-lightmap-fragment-Bqj89aIe.js.map +1 -0
  352. package/std-opacity-fragment-KuPh5N2Z.js +37 -0
  353. package/std-opacity-fragment-KuPh5N2Z.js.map +1 -0
  354. package/std-reflection-fragment-BA5Ghn_M.js +57 -0
  355. package/std-reflection-fragment-BA5Ghn_M.js.map +1 -0
  356. package/std-shadow-fragment-FNQfrJuC.js +8 -0
  357. package/std-shadow-fragment-FNQfrJuC.js.map +1 -0
  358. package/std-specular-fragment-CE-6scqd.js +37 -0
  359. package/std-specular-fragment-CE-6scqd.js.map +1 -0
  360. package/std-tracking-CNKZ-hJN.js +15 -0
  361. package/std-tracking-CNKZ-hJN.js.map +1 -0
  362. package/step-block-BkywzTYm.js +13 -0
  363. package/step-block-BkywzTYm.js.map +1 -0
  364. package/storage-read-block-BdzhJfln.js +25 -0
  365. package/storage-read-block-BdzhJfln.js.map +1 -0
  366. package/storage-write-block-DjLKZ0Ro.js +11 -0
  367. package/storage-write-block-DjLKZ0Ro.js.map +1 -0
  368. package/subsurface-block-CBhxT9ui.js +12 -0
  369. package/subsurface-block-CBhxT9ui.js.map +1 -0
  370. package/subsurface-fragment-liM3y2-P.js +158 -0
  371. package/subsurface-fragment-liM3y2-P.js.map +1 -0
  372. package/subtract-block-NPfKvzQP.js +6 -0
  373. package/subtract-block-NPfKvzQP.js.map +1 -0
  374. package/swapchain-overlay-DcCSFDp7.js +35 -0
  375. package/swapchain-overlay-DcCSFDp7.js.map +1 -0
  376. package/tbn-block-ByOI6Y43.js +43 -0
  377. package/tbn-block-ByOI6Y43.js.map +1 -0
  378. package/teleport-in-block-BMa17cqq.js +10 -0
  379. package/teleport-in-block-BMa17cqq.js.map +1 -0
  380. package/teleport-out-block-5AkB25H6.js +19 -0
  381. package/teleport-out-block-5AkB25H6.js.map +1 -0
  382. package/texture-block-rr21KIL_.js +70 -0
  383. package/texture-block-rr21KIL_.js.map +1 -0
  384. package/thin-instance-fragment-hsv-RyDs.js +69 -0
  385. package/thin-instance-fragment-hsv-RyDs.js.map +1 -0
  386. package/thin-instance-gpu-C9Gv_Z1w.js +62 -0
  387. package/thin-instance-gpu-C9Gv_Z1w.js.map +1 -0
  388. package/tracking-primitives-wgdBY85t.js +82 -0
  389. package/tracking-primitives-wgdBY85t.js.map +1 -0
  390. package/transform-block-DbRph9JI.js +32 -0
  391. package/transform-block-DbRph9JI.js.map +1 -0
  392. package/trigonometry-block-BYQcTHiD.js +36 -0
  393. package/trigonometry-block-BYQcTHiD.js.map +1 -0
  394. package/triplanar-block-BZHkD9hX.js +148 -0
  395. package/triplanar-block-BZHkD9hX.js.map +1 -0
  396. package/twirl-block-78WtdiBd.js +39 -0
  397. package/twirl-block-78WtdiBd.js.map +1 -0
  398. package/unlit-fragment-BIlhJpz6.js +43 -0
  399. package/unlit-fragment-BIlhJpz6.js.map +1 -0
  400. package/uv-transform-fragment-hYujGpZg.js +47 -0
  401. package/uv-transform-fragment-hYujGpZg.js.map +1 -0
  402. package/vector-merger-CrW-ONB0.js +43 -0
  403. package/vector-merger-CrW-ONB0.js.map +1 -0
  404. package/vector-splitter-BoJuHrAU.js +34 -0
  405. package/vector-splitter-BoJuHrAU.js.map +1 -0
  406. package/vertex-output-Cvft64y0.js +14 -0
  407. package/vertex-output-Cvft64y0.js.map +1 -0
  408. package/view-direction-CWVucfnT.js +12 -0
  409. package/view-direction-CWVucfnT.js.map +1 -0
  410. package/voronoi-noise-block-iNQxa_Ls.js +43 -0
  411. package/voronoi-noise-block-iNQxa_Ls.js.map +1 -0
  412. package/wave-block-CY_mk1ec.js +41 -0
  413. package/wave-block-CY_mk1ec.js.map +1 -0
  414. package/wgsl-helpers-DyzNzCeE.js +48 -0
  415. package/wgsl-helpers-DyzNzCeE.js.map +1 -0
  416. package/worley-noise-3d-block-CyR2-k4s.js +58 -0
  417. package/worley-noise-3d-block-CyR2-k4s.js.map +1 -0
@@ -0,0 +1,961 @@
1
+ import { b3 as _getPbrExtsSorted, at as PBR2_HAS_UV2, aL as PBR_HAS_EMISSIVE, b4 as PBR_HAS_SPEC_GLOSS, U as PBR2_ESM_SHADOW_OUTPUT, D as targetSignatureKey, F as getSceneBindGroupLayout, b5 as REVERSE_DEPTH_COMPARE, b6 as PBR_HAS_NORMAL_MAP, b7 as PBR2_NO_COLOR_OUTPUT, V as PBR_HAS_ALPHA_BLEND, b8 as PBR_HAS_DOUBLE_SIDED, b9 as appendMeshLightUboFields, ba as meshLightIndexWGSL, bb as _getPbrExts, bc as PBR2_HAS_UV_TRANSFORM, bd as PBR_HAS_ANISOTROPY, be as PBR_HAS_SKYBOX, bf as PBR_HAS_SPECULAR_AA, bg as PBR_HAS_ENV, bh as PBR_HAS_OCCLUSION, bi as PBR2_HAS_BASE_COLOR_FACTOR, bj as PBR_HAS_GAMMA_ALBEDO, bk as PBR_HAS_TONEMAP, aK as PBR_HAS_EMISSIVE_COLOR, aq as PBR_HAS_METALLIC_REFLECTANCE_MAP, ar as PBR_HAS_REFLECTANCE_MAP, as as PBR2_HAS_REFLECTANCE_FACTORS, a as writeMeshLightSelection, bl as _registerPbrExt, bm as clearSamplerCache, bn as _computePbrMaterialFeatures, aY as createUniformBuffer, bo as PBR2_HAS_REFRACTION, bp as collectPbrBoundTextures, aU as acquireTexture, b1 as releaseTexture } from "./index-C8HOR2sB.js";
2
+ import { c as MSH_HAS_UV2, d as MSH_HAS_TANGENTS, e as composeShader, f as MSH_RECEIVE_SHADOWS, g as MSH_HAS_THIN_INSTANCES, h as MSH_HAS_VERTEX_COLOR, i as MSH_HAS_INSTANCE_COLOR, b as MSH_HAS_MORPH_TARGETS, _ as _computeMeshFeatures } from "./mesh-features-BLENkYVt.js";
3
+ const _bindingsCache = /* @__PURE__ */ new Map();
4
+ let _cachedDevice = null;
5
+ function ensureDevice(engine) {
6
+ if (_cachedDevice !== engine._device) {
7
+ _bindingsCache.clear();
8
+ _cachedDevice = engine._device;
9
+ }
10
+ }
11
+ function clearPbrPipelineCache() {
12
+ _bindingsCache.clear();
13
+ _cachedDevice = null;
14
+ }
15
+ function getOrCreatePbrBindings(engine, features, features2, meshFeatures, sceneFeatures, composed, shaderKey = "") {
16
+ ensureDevice(engine);
17
+ const key = `${features}:${features2}:${meshFeatures}:${sceneFeatures}:${shaderKey}`;
18
+ const cached = _bindingsCache.get(key);
19
+ if (cached) {
20
+ return cached;
21
+ }
22
+ const device = engine._device;
23
+ const meshBGL = device.createBindGroupLayout(composed._meshBGLDescriptor);
24
+ let shadowBGL = null;
25
+ if (composed._shadowBGLDescriptor) {
26
+ shadowBGL = device.createBindGroupLayout(composed._shadowBGLDescriptor);
27
+ }
28
+ const bindings = {
29
+ _features: features,
30
+ _features2: features2,
31
+ _meshFeatures: meshFeatures,
32
+ _meshBGL: meshBGL,
33
+ _shadowBGL: shadowBGL,
34
+ _composed: composed,
35
+ _pipelines: /* @__PURE__ */ new Map()
36
+ };
37
+ _bindingsCache.set(key, bindings);
38
+ return bindings;
39
+ }
40
+ function getOrCreatePbrPipeline(engine, sig, bindings) {
41
+ ensureDevice(engine);
42
+ const key = targetSignatureKey(sig);
43
+ const cached = bindings._pipelines.get(key);
44
+ if (cached) {
45
+ return cached;
46
+ }
47
+ const device = engine._device;
48
+ const { _features: features, _features2: features2, _composed: composed } = bindings;
49
+ const esmShadowOutput = (features2 & PBR2_ESM_SHADOW_OUTPUT) !== 0;
50
+ const hasAlpha = !esmShadowOutput && (features & PBR_HAS_ALPHA_BLEND) !== 0;
51
+ const hasDoubleSided = (features & PBR_HAS_DOUBLE_SIDED) !== 0;
52
+ const sceneBGL = getSceneBindGroupLayout(engine);
53
+ const bgls = bindings._shadowBGL ? [sceneBGL, bindings._meshBGL, bindings._shadowBGL] : [sceneBGL, bindings._meshBGL];
54
+ const vertModule = device.createShaderModule({ code: composed._vertexWGSL });
55
+ const noColorOutput = (features2 & PBR2_NO_COLOR_OUTPUT) !== 0;
56
+ const fragModule = !sig._colorFormat && !noColorOutput ? null : device.createShaderModule({ code: composed._fragmentWGSL });
57
+ const fragTarget = noColorOutput ? null : { format: sig._colorFormat, writeMask: GPUColorWrite.ALL };
58
+ if (hasAlpha && fragTarget) {
59
+ fragTarget.blend = {
60
+ color: { srcFactor: "src-alpha", dstFactor: "one-minus-src-alpha", operation: "add" },
61
+ alpha: { srcFactor: "one", dstFactor: "one", operation: "add" }
62
+ };
63
+ }
64
+ const pipeline = device.createRenderPipeline({
65
+ layout: device.createPipelineLayout({ bindGroupLayouts: bgls }),
66
+ vertex: { module: vertModule, entryPoint: "main", buffers: composed._vertexBufferLayouts },
67
+ ...fragModule ? { fragment: { module: fragModule, entryPoint: "main", targets: fragTarget ? [fragTarget] : [] } } : {},
68
+ ...sig._depthStencilFormat ? {
69
+ depthStencil: {
70
+ format: sig._depthStencilFormat,
71
+ depthCompare: sig._depthCompare ?? REVERSE_DEPTH_COMPARE,
72
+ depthWriteEnabled: noColorOutput || esmShadowOutput || !hasAlpha
73
+ }
74
+ } : {},
75
+ multisample: { count: sig._sampleCount },
76
+ primitive: { topology: "triangle-list", cullMode: hasDoubleSided ? "none" : "back", frontFace: sig._flipY ? "cw" : "ccw" }
77
+ });
78
+ bindings._pipelines.set(key, pipeline);
79
+ return pipeline;
80
+ }
81
+ function createPbrMeshBindGroup(engine, bindings, composed, meshUBO, materialUBO, material, env, meshCtx, refractionTexture) {
82
+ const device = engine._device;
83
+ const features = bindings._features;
84
+ const features2 = bindings._features2;
85
+ const meshFeatures = bindings._meshFeatures;
86
+ const hasNormal = (features & PBR_HAS_NORMAL_MAP) !== 0 && (meshFeatures & MSH_HAS_TANGENTS) !== 0;
87
+ const hasCotangentNormal = (features & PBR_HAS_NORMAL_MAP) !== 0 && (meshFeatures & MSH_HAS_TANGENTS) === 0;
88
+ const hasAnyNormal = hasNormal || hasCotangentNormal;
89
+ const hasEmissive = (features & PBR_HAS_EMISSIVE) !== 0;
90
+ const hasSpecGloss = (features & PBR_HAS_SPEC_GLOSS) !== 0;
91
+ const esmShadowOutput = (features2 & PBR2_ESM_SHADOW_OUTPUT) !== 0;
92
+ const entries = [];
93
+ let b = 0;
94
+ const addTex = (t) => {
95
+ entries.push({ binding: b++, resource: t.view });
96
+ entries.push({ binding: b++, resource: t.sampler });
97
+ };
98
+ const ctx = {
99
+ _engine: engine,
100
+ _features: features,
101
+ _features2: features2,
102
+ _meshFeatures: meshFeatures,
103
+ _material: material,
104
+ _mesh: meshCtx ?? void 0,
105
+ _env: env,
106
+ _refractionTexture: refractionTexture
107
+ };
108
+ const sortedExts = _getPbrExtsSorted();
109
+ const fragIds = composed._fragmentKey ? composed._fragmentKey.split("|").filter((s) => s.length > 0) : [];
110
+ entries.push({ binding: b++, resource: { buffer: meshUBO } });
111
+ entries.push({ binding: b++, resource: { buffer: materialUBO } });
112
+ for (const ext of sortedExts) {
113
+ if (ext.phase === "vertex" && ext.bind) {
114
+ b = ext.bind(ctx, entries, b);
115
+ }
116
+ }
117
+ addTex(material.baseColorTexture);
118
+ if (hasAnyNormal) {
119
+ addTex(material.normalTexture);
120
+ }
121
+ addTex(material.ormTexture);
122
+ if ((features2 & PBR2_HAS_UV2) !== 0 && (meshFeatures & MSH_HAS_UV2) !== 0 && material.occlusionTexture) {
123
+ addTex(material.occlusionTexture);
124
+ }
125
+ if (hasEmissive) {
126
+ addTex(material.emissiveTexture);
127
+ }
128
+ if (hasSpecGloss) {
129
+ addTex(material.specGlossTexture);
130
+ }
131
+ if (esmShadowOutput) {
132
+ entries.push({
133
+ binding: b++,
134
+ resource: { buffer: material._esmShadowParamsUBO }
135
+ });
136
+ }
137
+ const seenExts = [];
138
+ for (const fid of fragIds) {
139
+ const ext = sortedExts.find((e) => e.id === fid || fid.startsWith(e.id + "-"));
140
+ if (!ext || ext.phase === "vertex" || !ext.bind || seenExts.includes(ext)) {
141
+ continue;
142
+ }
143
+ seenExts.push(ext);
144
+ b = ext.bind(ctx, entries, b);
145
+ }
146
+ return device.createBindGroup({ layout: bindings._meshBGL, entries });
147
+ }
148
+ const STAGE_FRAGMENT = 2;
149
+ const BRDF_FUNCTIONS = `
150
+ const PI:f32=3.14159265358979323846;
151
+ fn distributionGGX(NdotH:f32,alphaG:f32)->f32{
152
+ let a2=alphaG*alphaG;
153
+ let d=NdotH*NdotH*(a2-1.0)+1.0;
154
+ return a2/(PI*d*d);
155
+ }
156
+ fn geometrySmithGGX(NdotL:f32,NdotV:f32,alphaG:f32)->f32{
157
+ let a2=alphaG*alphaG;
158
+ let gl=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);
159
+ let gv=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);
160
+ return 0.5/(gl+gv);
161
+ }
162
+ fn fresnelSchlick(cosTheta:f32,F0:vec3<f32>,F90:vec3<f32>)->vec3<f32>{
163
+ let t=1.0-cosTheta;
164
+ let t2=t*t;
165
+ return F0+(F90-F0)*(t2*t2*t);
166
+ }
167
+ `;
168
+ function createPbrTemplate(config) {
169
+ var _a, _b, _c, _d;
170
+ const {
171
+ _hasSingleLight = false,
172
+ _hasMultiLight = false,
173
+ _singleLightWGSL = "",
174
+ _singleLightBlock = "",
175
+ _multiLightWGSL = "",
176
+ _multiLightLoop = "",
177
+ _normalMode = "none",
178
+ _hasEmissiveTexture = false,
179
+ _hasSpecGloss = false,
180
+ _hasDoubleSided = false,
181
+ _hasTonemap = false,
182
+ _acesHelpers = "",
183
+ _acesTonemapCall = "",
184
+ _hasAlphaBlend = false,
185
+ _hasSpecularAA = false,
186
+ _hasGammaAlbedo = false,
187
+ _hasBaseColorFactor = false,
188
+ _hasMorph = false,
189
+ _hasOcclusion = false,
190
+ _hasEmissiveColor = false,
191
+ _hasReflectanceExt = false,
192
+ _hasIbl = false,
193
+ _hasAnisotropy = false,
194
+ _anisoBrdfFunctions = "",
195
+ _anisoTBBlock = "",
196
+ _ext,
197
+ _noColorOutput = false,
198
+ _esmShadowOutput = false,
199
+ _esmShadowDepthCode = "",
200
+ _vbStrides
201
+ } = config;
202
+ const hasNormal = _normalMode === "tangent";
203
+ const hasCotangentNormal = _normalMode === "cotangent";
204
+ const hasAnyNormal = hasNormal || hasCotangentNormal;
205
+ const _baseVertexAttributes = [
206
+ { _name: "position", _type: "vec3<f32>", _gpuFormat: "float32x3", _arrayStride: ((_a = _vbStrides == null ? void 0 : _vbStrides._p) == null ? void 0 : _a._stride) ?? 12 },
207
+ { _name: "normal", _type: "vec3<f32>", _gpuFormat: "float32x3", _arrayStride: ((_b = _vbStrides == null ? void 0 : _vbStrides._n) == null ? void 0 : _b._stride) ?? 12 }
208
+ ];
209
+ if (hasNormal) {
210
+ _baseVertexAttributes.push({ _name: "tangent", _type: "vec4<f32>", _gpuFormat: "float32x4", _arrayStride: ((_c = _vbStrides == null ? void 0 : _vbStrides._t) == null ? void 0 : _c._stride) ?? 16 });
211
+ }
212
+ _baseVertexAttributes.push({ _name: "uv", _type: "vec2<f32>", _gpuFormat: "float32x2", _arrayStride: ((_d = _vbStrides == null ? void 0 : _vbStrides._u) == null ? void 0 : _d._stride) ?? 8 });
213
+ if (_ext) {
214
+ _baseVertexAttributes.push(..._ext.extraVertexAttributes);
215
+ }
216
+ const _baseVaryings = [
217
+ { _name: "worldPos", _type: "vec3<f32>" },
218
+ { _name: "worldNormal", _type: "vec3<f32>" }
219
+ ];
220
+ if (hasNormal) {
221
+ _baseVaryings.push({ _name: "worldTangent", _type: "vec3<f32>" }, { _name: "worldBitangent", _type: "vec3<f32>" });
222
+ }
223
+ _baseVaryings.push({ _name: "uv", _type: "vec2<f32>" });
224
+ if (_ext) {
225
+ _baseVaryings.push(..._ext.extraVaryings);
226
+ }
227
+ const _baseMeshUboFields = [{ _name: "world", _type: "mat4x4<f32>" }];
228
+ appendMeshLightUboFields(_baseMeshUboFields);
229
+ const _baseMaterialUboFields = [
230
+ { _name: "environmentIntensity", _type: "f32" },
231
+ { _name: "directIntensity", _type: "f32" },
232
+ { _name: "reflectance", _type: "f32" },
233
+ { _name: "materialAlpha", _type: "f32" },
234
+ ..._hasBaseColorFactor ? [{ _name: "baseColorFactor", _type: "vec4<f32>" }] : [],
235
+ // glTF metallicFactor / roughnessFactor (default 1.0) — applied over MR texture channels.
236
+ { _name: "metallicFactor", _type: "f32" },
237
+ { _name: "roughnessFactor", _type: "f32" },
238
+ { _name: "normalScale", _type: "f32" },
239
+ { _name: "lightFalloffMode", _type: "f32" },
240
+ // Anisotropy UBO field stays on the base template because anisotropy is
241
+ // template-only (no ShaderFragment) — the anisotropyExt just writes its
242
+ // slice through the unified ext.writeUbo hook.
243
+ ..._hasAnisotropy ? [{ _name: "anisotropyParams", _type: "vec4<f32>" }] : [],
244
+ // ── Extension fields (per-texture UV transforms, etc.) ─
245
+ ..._ext ? _ext.extraMaterialUboFields : []
246
+ ];
247
+ const tex2d = (name, sampler) => [
248
+ { _name: name, _type: { _kind: "texture", _textureType: "texture_2d<f32>" }, _visibility: STAGE_FRAGMENT },
249
+ { _name: sampler, _type: { _kind: "sampler", _samplerType: "sampler" }, _visibility: STAGE_FRAGMENT }
250
+ ];
251
+ const _baseBindings = tex2d("baseColorTexture", "baseColorSampler");
252
+ if (hasAnyNormal) {
253
+ _baseBindings.push(...tex2d("normalTexture", "normalSampler_"));
254
+ }
255
+ _baseBindings.push(...tex2d("ormTexture", "ormSampler"));
256
+ if (_ext) {
257
+ _baseBindings.push(..._ext.extraBindings);
258
+ }
259
+ if (_hasEmissiveTexture) {
260
+ _baseBindings.push(...tex2d("emissiveTexture", "emissiveSampler"));
261
+ }
262
+ if (_hasSpecGloss) {
263
+ _baseBindings.push(...tex2d("specGlossTexture", "specGlossSampler"));
264
+ }
265
+ if (_esmShadowOutput) {
266
+ _baseBindings.push({ _name: "shadowParams", _type: { _kind: "uniform-buffer" }, _visibility: STAGE_FRAGMENT });
267
+ }
268
+ const posVar = _hasMorph ? "morphedPos" : "position";
269
+ const normVar = _hasMorph ? "morphedNorm" : "normal";
270
+ const tangentBlock = hasNormal ? `let N_local=normalize(${normVar});
271
+ let T_local=normalize(tangent.xyz);
272
+ let B_local=cross(N_local,T_local)*tangent.w;
273
+ out.worldTangent=(finalWorld*vec4<f32>(T_local,0.0)).xyz;
274
+ out.worldBitangent=(finalWorld*vec4<f32>(B_local,0.0)).xyz;` : "";
275
+ const _vertexTemplate = `/*SU*/
276
+ /*MU*/
277
+ @group(1) @binding(0) var<uniform> mesh: MeshUniforms;
278
+ /*VH*/
279
+ /*VD*/
280
+ /*VO*/
281
+ @vertex fn main(
282
+ /*VP*/
283
+ ) -> VertexOutput {
284
+ var out: VertexOutput;
285
+ /*VR*/
286
+ var finalWorld = mesh.world;
287
+ /*VW*/
288
+ let worldPos4 = finalWorld * vec4<f32>(${posVar}, 1.0);
289
+ out.worldPos = worldPos4.xyz;
290
+ out.clipPos = scene.viewProjection * worldPos4;
291
+ out.worldNormal = (finalWorld * vec4<f32>(normalize(${normVar}), 0.0)).xyz;
292
+ ${tangentBlock}
293
+ out.uv = uv;
294
+ ${_ext ? _ext.vertexBodyExtra : ""}/*VB*/
295
+ return out;
296
+ }`;
297
+ const normalUV = (_ext == null ? void 0 : _ext.uvForNormal) ?? "input.uv";
298
+ const normalScaleMod = (_ext == null ? void 0 : _ext.normalScaleMod) ?? "";
299
+ const normalRef = (_ext == null ? void 0 : _ext.normalScaleMod) ? "scaledNormal" : "normalMapRaw";
300
+ const normalRefCt = (_ext == null ? void 0 : _ext.normalScaleMod) ? "scaledNormalCT" : "normalMapSample";
301
+ let normalBlock;
302
+ if (hasNormal) {
303
+ normalBlock = `let normalMapRaw=textureSample(normalTexture,normalSampler_,${normalUV}).rgb*2.0-1.0;
304
+ ${normalScaleMod}let normalMapNorm=normalize(${normalRef});
305
+ let N_geom=normalize(input.worldNormal);
306
+ let TBN=mat3x3<f32>(input.worldTangent,input.worldBitangent,input.worldNormal);
307
+ var N=normalize(TBN*normalMapNorm);`;
308
+ } else if (hasCotangentNormal) {
309
+ normalBlock = `let normalMapSample=textureSample(normalTexture,normalSampler_,${normalUV}).rgb*2.0-1.0;
310
+ ${normalScaleMod.replace(/normalMapRaw/g, "normalMapSample").replace(/scaledNormal/g, "scaledNormalCT")}let N_geom=normalize(input.worldNormal);
311
+ let dp1=dpdx(input.worldPos);
312
+ let dp2=dpdy(input.worldPos);
313
+ let duv1=dpdx(${normalUV});
314
+ let duv2=dpdy(${normalUV});
315
+ let dp2perp=cross(dp2,N_geom);
316
+ let dp1perp=cross(N_geom,dp1);
317
+ let tangent_ct=dp2perp*duv1.x+dp1perp*duv2.x;
318
+ let bitangent_ct=-(dp2perp*duv1.y+dp1perp*duv2.y);
319
+ let det=max(dot(tangent_ct,tangent_ct),dot(bitangent_ct,bitangent_ct));
320
+ let invmax=select(inverseSqrt(det),0.0,det==0.0);
321
+ let cotangentFrame=mat3x3<f32>(tangent_ct*invmax,bitangent_ct*invmax,N_geom);
322
+ var N=normalize(cotangentFrame*normalize(${normalRefCt}));`;
323
+ } else {
324
+ normalBlock = `let N_geom=normalize(input.worldNormal);
325
+ var N=N_geom;`;
326
+ }
327
+ const anisotropyTBBlock = _hasAnisotropy ? _anisoTBBlock : "";
328
+ const vertexColorMod = (_ext == null ? void 0 : _ext.baseColorMod) ?? "";
329
+ const baseColorFactorRgb = _hasBaseColorFactor ? "*material.baseColorFactor.rgb" : "";
330
+ const baseColorFactorAlpha = _hasBaseColorFactor ? "*material.baseColorFactor.a" : "";
331
+ const baseColorDecode = _hasGammaAlbedo ? `var baseColor=pow(baseColorSample.rgb,vec3<f32>(2.2))${baseColorFactorRgb};
332
+ var alpha=baseColorSample.a${baseColorFactorAlpha};${vertexColorMod}` : `var baseColor=baseColorSample.rgb${baseColorFactorRgb};
333
+ var alpha=baseColorSample.a${baseColorFactorAlpha};${vertexColorMod}`;
334
+ const specGlossUV = (_ext == null ? void 0 : _ext.uvForSpecGloss) ?? "input.uv";
335
+ const roughnessMetallic = _hasSpecGloss ? `let specGloss=textureSample(specGlossTexture,specGlossSampler,${specGlossUV});
336
+ let roughness=clamp(1.0-specGloss.a,0.0,1.0);
337
+ let metallic=0.0;` : `let roughness=clamp(orm.g*material.roughnessFactor,0.0,1.0);
338
+ let metallic=orm.b*material.metallicFactor;`;
339
+ const emissiveUV = (_ext == null ? void 0 : _ext.uvForEmissive) ?? "input.uv";
340
+ const emissiveDefault = _hasEmissiveColor ? `` : _hasEmissiveTexture ? `let emissive=textureSample(emissiveTexture,emissiveSampler,${emissiveUV}).rgb;` : `let emissive=vec3<f32>(0.0);`;
341
+ const occlusionDefault = _hasReflectanceExt ? `` : (_ext == null ? void 0 : _ext.occlusionOverride) ? _ext.occlusionOverride : _hasOcclusion ? `let occlusion=orm.r;` : `let occlusion=1.0;`;
342
+ const f0Default = _hasReflectanceExt ? `` : _hasSpecGloss ? `var colorF0=specGloss.rgb;
343
+ let colorF90=vec3<f32>(1.0);
344
+ let maxSpecular=max(colorF0.r,max(colorF0.g,colorF0.b));
345
+ let surfaceAlbedo=baseColor*(1.0-maxSpecular);` : `let dielectricF0=material.reflectance;
346
+ var colorF0=mix(vec3<f32>(dielectricF0),baseColor,metallic);
347
+ let colorF90=vec3<f32>(1.0);
348
+ let surfaceAlbedo=baseColor*(1.0-dielectricF0)*(1.0-metallic);`;
349
+ const specularAABlock = _hasSpecularAA || hasAnyNormal ? `var AA_factor_x=0.0;
350
+ var AA_factor_y=0.0;
351
+ {let nDfdx_AA=dpdx(N);
352
+ let nDfdy_AA=dpdy(N);
353
+ let slopeSquare_AA=max(dot(nDfdx_AA,nDfdx_AA),dot(nDfdy_AA,nDfdy_AA));
354
+ AA_factor_x=pow(saturate(slopeSquare_AA),0.333);
355
+ AA_factor_y=sqrt(slopeSquare_AA)*0.75;
356
+ alphaG+=AA_factor_y;}` : `var AA_factor_x=0.0;
357
+ var AA_factor_y=0.0;`;
358
+ const directLightBlock = _hasMultiLight ? _multiLightLoop : _hasSingleLight ? _singleLightBlock : `var directDiffuse=vec3<f32>(0.0);
359
+ var directSpecular=vec3<f32>(0.0);
360
+ /*BL*/`;
361
+ const useAces = _hasTonemap && _acesTonemapCall !== "";
362
+ const acesBlock = useAces ? _acesHelpers : "";
363
+ const tonemapBlock = _hasTonemap ? useAces ? _acesTonemapCall : `color*=scene.vImageInfos.x;
364
+ color=1.0-exp2(-1.590579*color);` : `color*=scene.vImageInfos.x;`;
365
+ const alphaBlock = _noColorOutput ? "" : _hasAlphaBlend ? `var finalAlpha=alpha*material.materialAlpha;
366
+ var luminanceOverAlpha=0.0;
367
+ /*BA*/
368
+ luminanceOverAlpha+=dot(${_hasIbl ? "finalSpecularScaled" : "directSpecular"},vec3<f32>(0.2126,0.7152,0.0722));
369
+ finalAlpha=saturate(finalAlpha+luminanceOverAlpha*luminanceOverAlpha);
370
+ return vec4<f32>(color,finalAlpha);` : `return vec4<f32>(color,alpha*material.materialAlpha);`;
371
+ const doubleSidedEntry = _hasDoubleSided ? `@fragment fn main(input: FragmentInput, @builtin(front_facing) frontFacing: bool)${_noColorOutput ? "" : " -> @location(0) vec4<f32>"} {` : `@fragment fn main(input: FragmentInput)${_noColorOutput ? "" : " -> @location(0) vec4<f32>"} {`;
372
+ const doubleSidedFlip = _hasDoubleSided ? `if (!frontFacing) { N = -N; }` : "";
373
+ const lightDecls = _hasMultiLight ? _multiLightWGSL : _hasSingleLight ? _singleLightWGSL : "";
374
+ const lightBindingDecl = _hasSingleLight || _hasMultiLight ? `@group(0) @binding(1) var<uniform> lights: lightsUniforms;` : "";
375
+ const meshLightIndexHelper = _hasSingleLight || _hasMultiLight ? meshLightIndexWGSL("mesh") : "";
376
+ const anisoBrdfBlock = _hasAnisotropy ? _anisoBrdfFunctions : "";
377
+ const fragmentHelpers = (_ext == null ? void 0 : _ext.fragmentHelpers) ?? "";
378
+ const fragmentPrelude = (_ext == null ? void 0 : _ext.fragmentPrelude) ?? "";
379
+ const baseColorUV = (_ext == null ? void 0 : _ext.uvForBaseColor) ?? "input.uv";
380
+ const ormUV = (_ext == null ? void 0 : _ext.uvForOrm) ?? "input.uv";
381
+ const _fragmentTemplate = `/*SU*/
382
+ ${_esmShadowOutput ? "struct shadowParamsUniforms { biasAndScale: vec4<f32>, depthValues: vec4<f32>, }" : ""}
383
+ /*MU*/
384
+ @group(1) @binding(0) var<uniform> mesh: MeshUniforms;
385
+ /*HF*/
386
+ /*FB*/
387
+ /*FI*/
388
+ ${BRDF_FUNCTIONS}
389
+ ${acesBlock}
390
+ ${anisoBrdfBlock}
391
+ ${lightDecls}
392
+ ${lightBindingDecl}
393
+ ${meshLightIndexHelper}
394
+ ${fragmentHelpers}
395
+ ${doubleSidedEntry}
396
+ ${fragmentPrelude}/*SV*/
397
+ let baseColorSample=textureSample(baseColorTexture,baseColorSampler,${baseColorUV});
398
+ ${baseColorDecode}
399
+ let orm=textureSample(ormTexture,ormSampler,${ormUV}).rgb;
400
+ ${occlusionDefault}
401
+ ${roughnessMetallic}
402
+ ${emissiveDefault}
403
+ /*AT*/
404
+ ${_noColorOutput ? "return;" : _esmShadowOutput ? _esmShadowDepthCode : ""}
405
+ ${normalBlock}
406
+ ${doubleSidedFlip}
407
+ ${anisotropyTBBlock}
408
+ /*AC*/
409
+ let V=normalize(scene.vEyePosition.xyz-input.worldPos);
410
+ let NdotVUnclamped=dot(N,V);
411
+ let NdotV=abs(NdotVUnclamped)+0.0000001;
412
+ ${f0Default}
413
+ /*MF*/
414
+ var alphaG=roughness*roughness+0.0005;
415
+ ${specularAABlock}
416
+ ${directLightBlock}
417
+ var color=directDiffuse+directSpecular+emissive;
418
+ /*AI*/
419
+ /*NI*/
420
+ ${tonemapBlock}
421
+ color=pow(color,vec3<f32>(1.0/2.2));
422
+ color=clamp(color,vec3<f32>(0.0),vec3<f32>(1.0));
423
+ let highContrast=color*color*(3.0-2.0*color);
424
+ if(scene.vImageInfos.y<1.0){color=mix(vec3<f32>(0.5),color,scene.vImageInfos.y);}
425
+ else{color=mix(color,highContrast,scene.vImageInfos.y-1.0);}
426
+ color=max(color,vec3<f32>(0.0));
427
+ /*BC*/
428
+ ${alphaBlock}
429
+ }`;
430
+ return {
431
+ _vertexTemplate,
432
+ _fragmentTemplate,
433
+ _baseMeshUboFields,
434
+ _baseMaterialUboFields,
435
+ _baseVertexAttributes,
436
+ _baseVaryings,
437
+ _baseBindings
438
+ };
439
+ }
440
+ function createPbrComposer(deps) {
441
+ const cache = /* @__PURE__ */ new Map();
442
+ const {
443
+ _singleLightWGSL,
444
+ _getSingleLightBlock,
445
+ _multiLightWGSL,
446
+ _multiLightLoop,
447
+ _acesHelpers,
448
+ _acesTonemapCall,
449
+ _createPbrTemplateExt,
450
+ _anisoExt,
451
+ _iblSkyboxCalc,
452
+ _createPbrShadowFragment,
453
+ _shadowLights,
454
+ _createThinInstanceFragment
455
+ } = deps;
456
+ return function composePbr(features, features2 = 0, meshFeatures = 0, sceneFeatures = 0, lightMode = 0, singleLightType = "", _esmShadowDepthCode = "", vbStrides, vbKey = "") {
457
+ const ckey = `${features}:${features2}:${meshFeatures}:${sceneFeatures}:${lightMode}:${singleLightType}${vbKey}`;
458
+ const cached = cache.get(ckey);
459
+ if (cached) {
460
+ return cached;
461
+ }
462
+ const has = (bit) => (features & bit) !== 0;
463
+ const hasMesh = (bit) => (meshFeatures & bit) !== 0;
464
+ const hasScene = (bit) => (sceneFeatures & bit) !== 0;
465
+ const hasNormal = has(PBR_HAS_NORMAL_MAP) && hasMesh(MSH_HAS_TANGENTS);
466
+ const hasCotangent = has(PBR_HAS_NORMAL_MAP) && !hasMesh(MSH_HAS_TANGENTS);
467
+ const _hasAnyNormal = hasNormal || hasCotangent;
468
+ const _hasReflectanceExt = has(PBR_HAS_METALLIC_REFLECTANCE_MAP | PBR_HAS_REFLECTANCE_MAP) || (features2 & PBR2_HAS_REFLECTANCE_FACTORS) !== 0;
469
+ const _hasIbl = hasScene(PBR_HAS_ENV);
470
+ const _hasMorph = hasMesh(MSH_HAS_MORPH_TARGETS);
471
+ const hasShadow = hasMesh(MSH_RECEIVE_SHADOWS);
472
+ const _hasAnisotropy = has(PBR_HAS_ANISOTROPY);
473
+ const _hasEmissiveColor = has(PBR_HAS_EMISSIVE_COLOR);
474
+ const _hasEmissiveTexture = has(PBR_HAS_EMISSIVE);
475
+ const hasTI = hasMesh(MSH_HAS_THIN_INSTANCES);
476
+ const _hasUvTransform = (features2 & PBR2_HAS_UV_TRANSFORM) !== 0;
477
+ const _hasVertexColor = hasMesh(MSH_HAS_VERTEX_COLOR);
478
+ const _hasUv2 = (features2 & PBR2_HAS_UV2) !== 0 && hasMesh(MSH_HAS_UV2);
479
+ const needsExt = _hasUvTransform || _hasVertexColor || _hasUv2;
480
+ const _hasSpecularAA = has(PBR_HAS_SPECULAR_AA);
481
+ const _ext = needsExt && _createPbrTemplateExt ? _createPbrTemplateExt({
482
+ _hasUvTransform,
483
+ _hasVertexColor,
484
+ _hasUv2,
485
+ _hasOcclusionUv2: _hasUv2,
486
+ _hasAnyNormal,
487
+ _hasEmissiveTexture,
488
+ _hasSpecGloss: has(PBR_HAS_SPEC_GLOSS)
489
+ }) : void 0;
490
+ const template = createPbrTemplate({
491
+ _hasSingleLight: lightMode === 1,
492
+ _hasMultiLight: lightMode === 2,
493
+ _singleLightWGSL,
494
+ _singleLightBlock: lightMode === 1 && _getSingleLightBlock ? _getSingleLightBlock(singleLightType) : "",
495
+ _multiLightWGSL,
496
+ _multiLightLoop,
497
+ _normalMode: hasNormal ? "tangent" : hasCotangent ? "cotangent" : "none",
498
+ _hasEmissiveTexture,
499
+ _hasSpecGloss: has(PBR_HAS_SPEC_GLOSS),
500
+ _hasDoubleSided: has(PBR_HAS_DOUBLE_SIDED),
501
+ _hasTonemap: hasScene(PBR_HAS_TONEMAP),
502
+ _acesHelpers,
503
+ _acesTonemapCall,
504
+ _hasAlphaBlend: has(PBR_HAS_ALPHA_BLEND),
505
+ _hasSpecularAA,
506
+ _hasGammaAlbedo: has(PBR_HAS_GAMMA_ALBEDO),
507
+ _hasBaseColorFactor: (features2 & PBR2_HAS_BASE_COLOR_FACTOR) !== 0,
508
+ _hasMorph,
509
+ _hasOcclusion: has(PBR_HAS_OCCLUSION) && !_hasReflectanceExt,
510
+ _hasEmissiveColor,
511
+ _hasReflectanceExt,
512
+ _hasIbl,
513
+ _hasAnisotropy,
514
+ _anisoBrdfFunctions: _hasAnisotropy && _anisoExt ? _anisoExt.ANISO_BRDF_FUNCTIONS : "",
515
+ _anisoTBBlock: _hasAnisotropy && _anisoExt ? _anisoExt.makeAnisotropyTBBlock(hasNormal) : "",
516
+ _ext,
517
+ _noColorOutput: (features2 & PBR2_NO_COLOR_OUTPUT) !== 0,
518
+ _esmShadowOutput: (features2 & PBR2_ESM_SHADOW_OUTPUT) !== 0,
519
+ _esmShadowDepthCode,
520
+ _vbStrides: vbStrides
521
+ });
522
+ const frags = [];
523
+ const fragCtx = {
524
+ _features: features,
525
+ _features2: features2,
526
+ _meshFeatures: meshFeatures,
527
+ _hasIbl,
528
+ _hasAnyNormal,
529
+ _hasSpecularAA,
530
+ _anisoBentNormalCode: _hasAnisotropy && _anisoExt ? _anisoExt.ANISO_BENT_NORMAL : "",
531
+ _iblSkyboxCalc: has(PBR_HAS_SKYBOX) ? _iblSkyboxCalc : ""
532
+ };
533
+ for (const regExt of _getPbrExts().values()) {
534
+ if (regExt.frag) {
535
+ const fr = regExt.frag(fragCtx);
536
+ if (fr) {
537
+ frags.push(fr);
538
+ }
539
+ }
540
+ }
541
+ if (hasShadow && _createPbrShadowFragment) {
542
+ const slots = _shadowLights.map((sl) => ({ lightIndex: sl.lightIndex, shadowType: sl.shadowType }));
543
+ frags.push(_createPbrShadowFragment(slots));
544
+ }
545
+ if (hasTI && _createThinInstanceFragment) {
546
+ frags.push(_createThinInstanceFragment(hasMesh(MSH_HAS_INSTANCE_COLOR)));
547
+ }
548
+ const composed = composeShader(template, frags);
549
+ cache.set(ckey, composed);
550
+ return composed;
551
+ };
552
+ }
553
+ async function buildPbrRenderables(scene, meshes, envTextures) {
554
+ var _a, _b, _c, _d, _e, _f, _g;
555
+ const engine = scene.engine;
556
+ const device = engine._device;
557
+ const materialScratch = /* @__PURE__ */ new Map();
558
+ const hasEnv = !!envTextures;
559
+ const shadowLights = [];
560
+ for (let i = 0; i < scene.lights.length; i++) {
561
+ const sg = scene.lights[i].shadowGenerator;
562
+ if (sg) {
563
+ shadowLights.push({ lightIndex: i, shadowType: sg._shadowType, gen: sg });
564
+ }
565
+ }
566
+ const hasSomeShadows = shadowLights.length > 0;
567
+ let hasAnyAffectedLight = false;
568
+ let needsSingleLightPath = false;
569
+ let needsMultiLightPath = false;
570
+ const singleLightTypes = [];
571
+ for (const mesh of meshes) {
572
+ const lr = writeMeshLightSelection(mesh, scene.lights);
573
+ const affectedCount = lr > 0 ? 1 : -lr;
574
+ hasAnyAffectedLight || (hasAnyAffectedLight = affectedCount > 0);
575
+ if (affectedCount === 1 && !(mesh.receiveShadows && hasSomeShadows)) {
576
+ needsSingleLightPath = true;
577
+ const type = getPackedSingleLightType(scene.lights, lr - 1);
578
+ if (!singleLightTypes.includes(type)) {
579
+ singleLightTypes.push(type);
580
+ }
581
+ } else if (affectedCount > 0) {
582
+ needsMultiLightPath = true;
583
+ }
584
+ }
585
+ let hasSkybox = false;
586
+ let hasMetallicReflectance = false;
587
+ let hasClearcoat = false;
588
+ let hasSheen = false;
589
+ let hasIridescence = false;
590
+ let hasAnyAnisotropy = false;
591
+ let hasAnySubsurface = false;
592
+ let hasAlphaTest = false;
593
+ let hasTransmissionRefraction = false;
594
+ let needsEmissiveColor = false;
595
+ let hasSomeSkeletons = false;
596
+ let hasSomeMorphs = false;
597
+ let hasSomeThinInstances = false;
598
+ let hasAnyUnlit = false;
599
+ let hasAnyUvTransform = false;
600
+ let hasAnyUv2 = false;
601
+ let hasAnyVertexColor = false;
602
+ for (let i = 0; i < meshes.length; i++) {
603
+ const m = meshes[i];
604
+ const mat = m.material;
605
+ const refractionIntensity = ((_b = (_a = mat.subsurface) == null ? void 0 : _a.refraction) == null ? void 0 : _b.intensity) ?? 0;
606
+ hasSkybox || (hasSkybox = !!mat.skyboxMode);
607
+ hasMetallicReflectance || (hasMetallicReflectance = !!(mat.metallicReflectanceTexture || mat.reflectanceTexture || mat._hasReflExt));
608
+ hasClearcoat || (hasClearcoat = !!((_c = mat.clearCoat) == null ? void 0 : _c.isEnabled));
609
+ hasSheen || (hasSheen = !!((_d = mat.sheen) == null ? void 0 : _d.isEnabled));
610
+ hasIridescence || (hasIridescence = !!((_e = mat.iridescence) == null ? void 0 : _e.isEnabled));
611
+ hasAnyAnisotropy || (hasAnyAnisotropy = !!((_f = mat.anisotropy) == null ? void 0 : _f.isEnabled));
612
+ hasAnySubsurface || (hasAnySubsurface = !!((_g = mat.subsurface) == null ? void 0 : _g.translucency));
613
+ hasAlphaTest || (hasAlphaTest = mat.alphaCutOff > 0);
614
+ hasTransmissionRefraction || (hasTransmissionRefraction = refractionIntensity > 0 && !!mat.transmissive);
615
+ needsEmissiveColor || (needsEmissiveColor = !!mat.emissiveColor);
616
+ hasSomeSkeletons || (hasSomeSkeletons = !!m.skeleton);
617
+ hasSomeMorphs || (hasSomeMorphs = !!m.morphTargets);
618
+ hasSomeThinInstances || (hasSomeThinInstances = !!m.thinInstances);
619
+ hasAnyUnlit || (hasAnyUnlit = !!mat.unlit);
620
+ hasAnyUvTransform || (hasAnyUvTransform = !!mat._hasUvTx);
621
+ hasAnyUv2 || (hasAnyUv2 = !!m._gpu.uv2Buffer && mat.occlusionTexCoord === 1);
622
+ hasAnyVertexColor || (hasAnyVertexColor = !!m._gpu.colorBuffer);
623
+ }
624
+ let _iblSkyboxCalc = "";
625
+ if (hasEnv) {
626
+ const mod = await import("./ibl-fragment-DqQVi8k0.js");
627
+ _registerPbrExt(mod.pbrExt);
628
+ if (hasSkybox) {
629
+ const sky = await import("./ibl-skybox-wgsl-DCah0kWV.js");
630
+ _iblSkyboxCalc = sky.IBL_SKYBOX_CALCULATION;
631
+ }
632
+ }
633
+ let _createPbrShadowFragment = null;
634
+ let _singleLightWGSL = "";
635
+ let _getSingleLightBlock = null;
636
+ const singleLightBlocks = {};
637
+ let _multiLightWGSL = "";
638
+ let _multiLightLoop = "";
639
+ if (needsSingleLightPath) {
640
+ for (const type of singleLightTypes) {
641
+ const single = await importSingleLightWgsl(type);
642
+ _singleLightWGSL = single.SINGLE_LIGHT_STRUCTS;
643
+ singleLightBlocks[type] = single.getSingleLightBlock;
644
+ }
645
+ _getSingleLightBlock = (type) => {
646
+ var _a2;
647
+ return ((_a2 = singleLightBlocks[toSingleLightType(type)]) == null ? void 0 : _a2.call(singleLightBlocks)) ?? "";
648
+ };
649
+ }
650
+ if (needsMultiLightPath) {
651
+ const wgslMod = await import("./multilight-wgsl-BGyiIOp3.js");
652
+ _multiLightWGSL = wgslMod.MULTI_LIGHT_STRUCTS() + wgslMod.COMPUTE_PBR_LIGHT;
653
+ _multiLightLoop = wgslMod.getMultiLightLoop();
654
+ }
655
+ if (hasAnyAffectedLight && hasSomeShadows) {
656
+ const shadowMod = await import("./pbr-shadow-fragment-LO9SlbJj.js");
657
+ _createPbrShadowFragment = shadowMod.createPbrShadowFragment;
658
+ }
659
+ const _drainPbrExts = async (loaders) => {
660
+ for (const [flag, load] of loaders) {
661
+ if (flag) {
662
+ _registerPbrExt((await load()).pbrExt);
663
+ }
664
+ }
665
+ };
666
+ await _drainPbrExts([
667
+ [hasAlphaTest, () => import("./alpha-test-fragment-CUiHCw7W.js")],
668
+ [hasMetallicReflectance, () => import("./reflectance-fragment-BCrgPmrt.js")],
669
+ [hasClearcoat, () => import("./clearcoat-fragment-LCiG98Rf.js")],
670
+ [hasSheen, () => import("./sheen-fragment-Dze2f7XJ.js")],
671
+ [hasIridescence, () => import("./iridescence-fragment-Gymp7or5.js")],
672
+ [hasAnySubsurface, () => import("./subsurface-fragment-liM3y2-P.js")]
673
+ ]);
674
+ if (hasTransmissionRefraction) {
675
+ const mod = await import("./pbr-refraction-DGmMSa2v.js");
676
+ await mod.registerPbrRefraction(scene, engine, _registerPbrExt);
677
+ }
678
+ await _drainPbrExts([
679
+ [needsEmissiveColor, () => import("./emissive-fragment-BnNvbBCw.js")],
680
+ [hasAnyUnlit, () => import("./unlit-fragment-BIlhJpz6.js")],
681
+ [hasSomeSkeletons, () => import("./skeleton-fragment-B_XlFbtx.js")],
682
+ [hasSomeMorphs, () => import("./morph-fragment-DOVo70gP.js")],
683
+ [hasAnyUvTransform, () => import("./uv-transform-fragment-hYujGpZg.js")]
684
+ ]);
685
+ let _anisoExt = null;
686
+ if (hasAnyAnisotropy) {
687
+ _anisoExt = await import("./anisotropy-fragment-HgasXS7l.js");
688
+ _registerPbrExt(_anisoExt.pbrExt);
689
+ }
690
+ let _createPbrTemplateExt = null;
691
+ if (hasAnyUvTransform || hasAnyVertexColor || hasAnyUv2) {
692
+ const extMod = await import("./pbr-template-ext-8q7BcTDf.js");
693
+ _createPbrTemplateExt = extMod.createPbrTemplateExt;
694
+ }
695
+ let _createThinInstanceFragment = null;
696
+ let _syncThinInstanceBuffers = null;
697
+ if (hasSomeThinInstances) {
698
+ const mod = await import("./thin-instance-fragment-hsv-RyDs.js");
699
+ _createThinInstanceFragment = mod.createThinInstanceFragment;
700
+ const gpuMod = await import("./thin-instance-gpu-C9Gv_Z1w.js");
701
+ _syncThinInstanceBuffers = gpuMod.syncThinInstanceBuffers;
702
+ }
703
+ let _acesHelpers = "";
704
+ let _acesTonemapCall = "";
705
+ const hasTonemap = scene.imageProcessing.toneMappingEnabled;
706
+ if (hasTonemap && scene.imageProcessing.toneMappingType === "aces") {
707
+ const acesMod = await import("./pbr-aces-wgsl-HpiQHGN_.js");
708
+ _acesHelpers = acesMod.ACES_HELPERS_WGSL;
709
+ _acesTonemapCall = acesMod.ACES_TONEMAP_CALL_WGSL;
710
+ }
711
+ const composePbr = createPbrComposer({
712
+ _singleLightWGSL,
713
+ _getSingleLightBlock,
714
+ _multiLightWGSL,
715
+ _multiLightLoop,
716
+ _acesHelpers,
717
+ _acesTonemapCall,
718
+ _createPbrTemplateExt,
719
+ _anisoExt,
720
+ _iblSkyboxCalc,
721
+ _createPbrShadowFragment,
722
+ _shadowLights: shadowLights,
723
+ _createThinInstanceFragment
724
+ });
725
+ const sceneFeatures = (hasEnv ? PBR_HAS_ENV : 0) | (hasTonemap ? PBR_HAS_TONEMAP : 0);
726
+ const shadowBGCache = /* @__PURE__ */ new Map();
727
+ const syncThinInstanceBuffers = _syncThinInstanceBuffers;
728
+ const rebuildSingle = (s, mesh, materialOverride) => {
729
+ const materialInput = materialOverride ?? mesh.material;
730
+ const mat = materialInput;
731
+ const renderFeatures = mat._renderFeatures ?? (mat._renderFeatures = _computePbrMaterialFeatures(mat));
732
+ const isOverride = materialOverride != null;
733
+ const mi = mesh;
734
+ const lr = writeMeshLightSelection(mesh, s.lights);
735
+ const lightCount = lr > 0 ? 1 : -lr;
736
+ const features = renderFeatures.features;
737
+ const features2 = renderFeatures.features2 ?? 0;
738
+ const shadowOutput = (features2 & (PBR2_NO_COLOR_OUTPUT | PBR2_ESM_SHADOW_OUTPUT)) !== 0;
739
+ const receiveShadows = !shadowOutput && mesh.receiveShadows && hasSomeShadows;
740
+ const lightMode = lightCount === 0 ? 0 : lightCount === 1 && !receiveShadows ? 1 : 2;
741
+ const singleLightType = lightMode === 1 ? getPackedSingleLightType(s.lights, lr - 1) : "";
742
+ const meshFeatures = _computeMeshFeatures(mesh, receiveShadows);
743
+ const esmShadowDepthCode = (features2 & PBR2_ESM_SHADOW_OUTPUT) !== 0 ? mat._esmShadowDepthCode : "";
744
+ const vbLayout = mi._gpu._vbLayout;
745
+ const vbKey = mi._gpu._vbKey ?? "";
746
+ const composed = composePbr(features, features2, meshFeatures, sceneFeatures, lightMode, singleLightType, esmShadowDepthCode, vbLayout, vbKey);
747
+ const bindings = getOrCreatePbrBindings(engine, features, features2, meshFeatures, sceneFeatures, composed, `${lightMode}:${singleLightType}${vbKey}`);
748
+ const meshUboData = new Float32Array(composed._meshUboSpec._totalBytes / 4);
749
+ meshUboData.set(mesh.worldMatrix, 0);
750
+ writeMeshLightSelection(mesh, s.lights, meshUboData);
751
+ const meshUBO = createUniformBuffer(engine, meshUboData);
752
+ const materialSpec = composed._materialUboSpec;
753
+ const matInitData = new Float32Array(materialSpec._totalBytes / 4);
754
+ writeMaterialData(matInitData, mat, materialSpec);
755
+ const materialUBO = createUniformBuffer(engine, matInitData);
756
+ const needsTaskRefraction = !!mat.transmissive && (features2 & PBR2_HAS_REFRACTION) !== 0;
757
+ const materialBindGroupStatic = needsTaskRefraction ? null : createPbrMeshBindGroup(engine, bindings, composed, meshUBO, materialUBO, mat, envTextures ?? null, mesh);
758
+ let shadowBindGroup = null;
759
+ const meshShadowLights = receiveShadows ? shadowLights : [];
760
+ if (meshShadowLights.length > 0 && bindings._shadowBGL) {
761
+ let cached = shadowBGCache.get(bindings._shadowBGL);
762
+ if (!cached) {
763
+ const entries = [];
764
+ let b = 0;
765
+ for (const sl of meshShadowLights) {
766
+ const sg = sl.gen;
767
+ entries.push({ binding: b++, resource: sg._depthTexture.createView() });
768
+ entries.push({ binding: b++, resource: sg._depthSampler });
769
+ entries.push({ binding: b++, resource: { buffer: sg._shadowUBO } });
770
+ }
771
+ cached = device.createBindGroup({ layout: bindings._shadowBGL, entries });
772
+ shadowBGCache.set(bindings._shadowBGL, cached);
773
+ }
774
+ shadowBindGroup = cached;
775
+ }
776
+ const boundTextures = collectPbrBoundTextures(mat);
777
+ for (const t of boundTextures) {
778
+ acquireTexture(t);
779
+ }
780
+ s._meshDisposables.set(mesh, [
781
+ () => {
782
+ meshUBO.destroy();
783
+ materialUBO.destroy();
784
+ },
785
+ () => {
786
+ for (const t of boundTextures) {
787
+ releaseTexture(t);
788
+ }
789
+ }
790
+ ]);
791
+ const isTransparent = (features2 & (PBR2_NO_COLOR_OUTPUT | PBR2_ESM_SHADOW_OUTPUT)) === 0 && (features & PBR_HAS_ALPHA_BLEND) !== 0;
792
+ const order = mesh.renderOrder ?? (isTransparent || needsTaskRefraction ? 150 : 100);
793
+ const hasNormalMap = (features & PBR_HAS_NORMAL_MAP) !== 0;
794
+ const hasUV2 = (features2 & PBR2_HAS_UV2) !== 0 && (meshFeatures & MSH_HAS_UV2) !== 0;
795
+ const hasVertexColor = (meshFeatures & MSH_HAS_VERTEX_COLOR) !== 0;
796
+ const hasTI = (meshFeatures & MSH_HAS_THIN_INSTANCES) !== 0;
797
+ const hasTIColor = (meshFeatures & MSH_HAS_INSTANCE_COLOR) !== 0;
798
+ let _lastWorldVersion = -1;
799
+ let _lastLightsCount = s.lights.length;
800
+ const sortCenter = isTransparent || needsTaskRefraction ? [mesh.worldMatrix[12], mesh.worldMatrix[13], mesh.worldMatrix[14]] : null;
801
+ const update = () => {
802
+ const worldVersion = mesh.worldMatrixVersion;
803
+ if (worldVersion !== _lastWorldVersion || s.lights.length !== _lastLightsCount) {
804
+ if (sortCenter) {
805
+ sortCenter[0] = mesh.worldMatrix[12];
806
+ sortCenter[1] = mesh.worldMatrix[13];
807
+ sortCenter[2] = mesh.worldMatrix[14];
808
+ }
809
+ meshUboData.set(mesh.worldMatrix, 0);
810
+ writeMeshLightSelection(mesh, s.lights, meshUboData);
811
+ device.queue.writeBuffer(meshUBO, 0, meshUboData);
812
+ _lastWorldVersion = worldVersion;
813
+ _lastLightsCount = s.lights.length;
814
+ }
815
+ const uboVersion = mat._uboVersion;
816
+ if (uboVersion !== _lastUboVersion) {
817
+ _lastUboVersion = uboVersion;
818
+ let data = materialScratch.get(materialSpec._totalBytes);
819
+ if (!data) {
820
+ data = new Float32Array(materialSpec._totalBytes / 4);
821
+ materialScratch.set(materialSpec._totalBytes, data);
822
+ } else {
823
+ data.fill(0);
824
+ }
825
+ writeMaterialData(data, mat, materialSpec);
826
+ device.queue.writeBuffer(materialUBO, 0, data.buffer, 0, data.byteLength);
827
+ }
828
+ };
829
+ const drawWith = (pass, materialBindGroup) => {
830
+ var _a2, _b2, _c2, _d2, _e2, _f2;
831
+ if (!isOverride && mesh.material !== materialInput) {
832
+ return 0;
833
+ }
834
+ const gpu = mi._gpu;
835
+ pass.setBindGroup(1, materialBindGroup);
836
+ if (shadowBindGroup) {
837
+ pass.setBindGroup(2, shadowBindGroup);
838
+ }
839
+ let slot = 0;
840
+ const vb = gpu._vbLayout;
841
+ pass.setVertexBuffer(slot++, gpu.positionBuffer, (_a2 = vb == null ? void 0 : vb._p) == null ? void 0 : _a2._offset);
842
+ pass.setVertexBuffer(slot++, gpu.normalBuffer, (_b2 = vb == null ? void 0 : vb._n) == null ? void 0 : _b2._offset);
843
+ if (hasNormalMap && gpu.tangentBuffer) {
844
+ pass.setVertexBuffer(slot++, gpu.tangentBuffer, (_c2 = vb == null ? void 0 : vb._t) == null ? void 0 : _c2._offset);
845
+ }
846
+ pass.setVertexBuffer(slot++, gpu.uvBuffer, (_d2 = vb == null ? void 0 : vb._u) == null ? void 0 : _d2._offset);
847
+ if (hasUV2 && gpu.uv2Buffer) {
848
+ pass.setVertexBuffer(slot++, gpu.uv2Buffer, (_e2 = vb == null ? void 0 : vb._u2) == null ? void 0 : _e2._offset);
849
+ }
850
+ if (hasVertexColor && gpu.colorBuffer) {
851
+ pass.setVertexBuffer(slot++, gpu.colorBuffer, (_f2 = vb == null ? void 0 : vb._c) == null ? void 0 : _f2._offset);
852
+ }
853
+ if (mesh.skeleton) {
854
+ pass.setVertexBuffer(slot++, mesh.skeleton.jointsBuffer);
855
+ pass.setVertexBuffer(slot++, mesh.skeleton.weightsBuffer);
856
+ if (mesh.skeleton.joints1Buffer && mesh.skeleton.weights1Buffer) {
857
+ pass.setVertexBuffer(slot++, mesh.skeleton.joints1Buffer);
858
+ pass.setVertexBuffer(slot++, mesh.skeleton.weights1Buffer);
859
+ }
860
+ }
861
+ const ti = hasTI ? mesh.thinInstances : null;
862
+ if (ti && syncThinInstanceBuffers) {
863
+ slot = syncThinInstanceBuffers(engine, ti, pass, slot, hasTIColor);
864
+ }
865
+ pass.setIndexBuffer(gpu.indexBuffer, gpu.indexFormat);
866
+ if (ti && ti.count > 0) {
867
+ pass.drawIndexed(gpu.indexCount, ti.count);
868
+ } else {
869
+ pass.drawIndexed(gpu.indexCount);
870
+ }
871
+ return 1;
872
+ };
873
+ const draw = (pass) => drawWith(pass, materialBindGroupStatic);
874
+ const r = {
875
+ order,
876
+ isTransparent,
877
+ _transmissive: needsTaskRefraction,
878
+ mesh,
879
+ bind(eng, sig) {
880
+ const pipeline = getOrCreatePbrPipeline(eng, sig, bindings);
881
+ const materialBindGroup = needsTaskRefraction ? createPbrMeshBindGroup(engine, bindings, composed, meshUBO, materialUBO, mat, envTextures ?? null, mesh, sig._transmissionTexture) : materialBindGroupStatic;
882
+ return {
883
+ renderable: r,
884
+ pipeline,
885
+ update,
886
+ draw: needsTaskRefraction ? (pass) => drawWith(pass, materialBindGroup) : draw
887
+ };
888
+ }
889
+ };
890
+ if (sortCenter) {
891
+ r._worldCenter = sortCenter;
892
+ }
893
+ let _lastUboVersion = mat._uboVersion;
894
+ return r;
895
+ };
896
+ const renderables = meshes.map((m) => rebuildSingle(scene, m));
897
+ scene._disposables.push(
898
+ () => clearPbrPipelineCache(),
899
+ () => clearSamplerCache(engine)
900
+ );
901
+ return { renderables, rebuildSingle };
902
+ }
903
+ function toSingleLightType(type) {
904
+ return type === "hemispheric" || type === "directional" || type === "spot" ? type : "point";
905
+ }
906
+ function getPackedSingleLightType(lights, packedIndex) {
907
+ let packed = 0;
908
+ for (const light of lights) {
909
+ if (!light._writeLightUbo) {
910
+ continue;
911
+ }
912
+ if (packed === packedIndex) {
913
+ return toSingleLightType(light.lightType);
914
+ }
915
+ packed++;
916
+ }
917
+ return "point";
918
+ }
919
+ async function importSingleLightWgsl(type) {
920
+ if (type === "hemispheric") {
921
+ return import("./singlelight-hemispheric-wgsl-t-83IP_s.js");
922
+ }
923
+ if (type === "directional") {
924
+ return import("./singlelight-directional-wgsl-CmUDZxwz.js");
925
+ }
926
+ if (type === "spot") {
927
+ return import("./singlelight-spot-wgsl-DEEUrfVM.js");
928
+ }
929
+ return import("./singlelight-point-wgsl-CLzULIYV.js");
930
+ }
931
+ function writeMaterialData(data, material, spec) {
932
+ data[0] = material.environmentIntensity ?? 1;
933
+ data[1] = material.directIntensity ?? 1;
934
+ data[2] = material.reflectance ?? 0.04;
935
+ data[3] = material.alpha ?? 1;
936
+ const baseColorFactorOffset = spec._offsets.get("baseColorFactor");
937
+ if (baseColorFactorOffset !== void 0) {
938
+ const off = baseColorFactorOffset / 4;
939
+ const factor = material.baseColorFactor;
940
+ data[off] = factor ? factor[0] : 1;
941
+ data[off + 1] = factor ? factor[1] : 1;
942
+ data[off + 2] = factor ? factor[2] : 1;
943
+ data[off + 3] = factor ? factor[3] : 1;
944
+ }
945
+ if (spec._offsets.has("metallicFactor")) {
946
+ const off = spec._offsets.get("metallicFactor") / 4;
947
+ data[off] = material.metallicFactor ?? 1;
948
+ data[off + 1] = material.roughnessFactor ?? 1;
949
+ data[off + 2] = material.normalTextureScale ?? 1;
950
+ data[off + 3] = material.usePhysicalLightFalloff === false ? 0 : 1;
951
+ }
952
+ for (const ext of _getPbrExts().values()) {
953
+ if (ext.writeUbo) {
954
+ ext.writeUbo(data, material, spec._offsets);
955
+ }
956
+ }
957
+ }
958
+ export {
959
+ buildPbrRenderables
960
+ };
961
+ //# sourceMappingURL=pbr-renderable-BJxUtPBb.js.map