@babylonjs/lite 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +51 -0
  3. package/THIRD_PARTY_NOTICES.txt +318 -0
  4. package/{_mat4-storage-f64-BW9sTaVh.js → _mat4-storage-f64-WeexU-hd.js} +2 -2
  5. package/{_mat4-storage-f64-BW9sTaVh.js.map → _mat4-storage-f64-WeexU-hd.js.map} +1 -1
  6. package/{alpha-test-fragment-eUG971h3.js → alpha-test-fragment-x2mnjLgC.js} +2 -2
  7. package/{alpha-test-fragment-eUG971h3.js.map → alpha-test-fragment-x2mnjLgC.js.map} +1 -1
  8. package/{background-dds-skybox-BwG0kYQP.js → background-dds-skybox-BpcDr-9c.js} +3 -3
  9. package/{background-dds-skybox-BwG0kYQP.js.map → background-dds-skybox-BpcDr-9c.js.map} +1 -1
  10. package/{background-ground-DiFpKJzF.js → background-ground-Bm6gjWqx.js} +2 -2
  11. package/{background-ground-DiFpKJzF.js.map → background-ground-Bm6gjWqx.js.map} +1 -1
  12. package/{background-hdr-skybox-DIgJhvfj.js → background-hdr-skybox-CSFo8RX6.js} +3 -3
  13. package/{background-hdr-skybox-DIgJhvfj.js.map → background-hdr-skybox-CSFo8RX6.js.map} +1 -1
  14. package/{background-solid-skybox--fqHdan_.js → background-solid-skybox-DOOBeDIz.js} +2 -2
  15. package/{background-solid-skybox--fqHdan_.js.map → background-solid-skybox-DOOBeDIz.js.map} +1 -1
  16. package/{billboard-renderable-HY2XCd52.js → billboard-renderable-IJfCpeDS.js} +2 -2
  17. package/{billboard-renderable-HY2XCd52.js.map → billboard-renderable-IJfCpeDS.js.map} +1 -1
  18. package/{clamp-block-XHdUk2Va.js → clamp-block-BD_t8I89.js} +2 -2
  19. package/{clamp-block-XHdUk2Va.js.map → clamp-block-BD_t8I89.js.map} +1 -1
  20. package/{clearcoat-fragment-CHYw8MPB.js → clearcoat-fragment-Dj7vGX2u.js} +2 -2
  21. package/{clearcoat-fragment-CHYw8MPB.js.map → clearcoat-fragment-Dj7vGX2u.js.map} +1 -1
  22. package/{create-skeleton-9tdiUjRP.js → create-skeleton-s0hjrC3A.js} +2 -2
  23. package/{create-skeleton-9tdiUjRP.js.map → create-skeleton-s0hjrC3A.js.map} +1 -1
  24. package/{cubemap-skybox-material-DqQ0dyz8.js → cubemap-skybox-material-8lzbgi7K.js} +2 -2
  25. package/{cubemap-skybox-material-DqQ0dyz8.js.map → cubemap-skybox-material-8lzbgi7K.js.map} +1 -1
  26. package/{curve-block-S27sXrJQ.js → curve-block-Ditr4R7V.js} +2 -2
  27. package/{curve-block-S27sXrJQ.js.map → curve-block-Ditr4R7V.js.map} +1 -1
  28. package/{emissive-fragment-CZMQ0_bF.js → emissive-fragment-BOAezkfk.js} +2 -2
  29. package/{emissive-fragment-CZMQ0_bF.js.map → emissive-fragment-BOAezkfk.js.map} +1 -1
  30. package/{esm-shadow-view-Cl36rOrK.js → esm-shadow-view-DRpyRAfa.js} +2 -2
  31. package/{esm-shadow-view-Cl36rOrK.js.map → esm-shadow-view-DRpyRAfa.js.map} +1 -1
  32. package/{esm-shadow-view-CUwxbnMR.js → esm-shadow-view-DmIORQGZ.js} +2 -2
  33. package/{esm-shadow-view-CUwxbnMR.js.map → esm-shadow-view-DmIORQGZ.js.map} +1 -1
  34. package/{esm-shadow-view-DKQ-FSoV.js → esm-shadow-view-JCPaOOi7.js} +2 -2
  35. package/{esm-shadow-view-DKQ-FSoV.js.map → esm-shadow-view-JCPaOOi7.js.map} +1 -1
  36. package/{gaussian-splatting-pipeline-sh-DDo7QQ8l.js → gaussian-splatting-pipeline-sh-B30Mu56i.js} +2 -2
  37. package/{gaussian-splatting-pipeline-sh-DDo7QQ8l.js.map → gaussian-splatting-pipeline-sh-B30Mu56i.js.map} +1 -1
  38. package/{geometry-texture-output-BmuAquio.js → geometry-texture-output-DURiaJ_n.js} +2 -2
  39. package/{geometry-texture-output-BmuAquio.js.map → geometry-texture-output-DURiaJ_n.js.map} +1 -1
  40. package/{geometry-view-xWZmq799.js → geometry-view-DRrscyWU.js} +4 -4
  41. package/{geometry-view-xWZmq799.js.map → geometry-view-DRrscyWU.js.map} +1 -1
  42. package/{gltf-animation-Bq7k_5HA.js → gltf-animation-BjnXkop6.js} +2 -2
  43. package/{gltf-animation-Bq7k_5HA.js.map → gltf-animation-BjnXkop6.js.map} +1 -1
  44. package/{gltf-ext-basisu-C5teqxzQ.js → gltf-ext-basisu-DtzVV1Xx.js} +2 -2
  45. package/{gltf-ext-basisu-C5teqxzQ.js.map → gltf-ext-basisu-DtzVV1Xx.js.map} +1 -1
  46. package/{gltf-ext-node-visibility-DnGTKkMf.js → gltf-ext-node-visibility-BhX0DmiP.js} +2 -2
  47. package/{gltf-ext-node-visibility-DnGTKkMf.js.map → gltf-ext-node-visibility-BhX0DmiP.js.map} +1 -1
  48. package/{gltf-ext-quantization-DheC7FhB.js → gltf-ext-quantization-DaymajCR.js} +2 -2
  49. package/{gltf-ext-quantization-DheC7FhB.js.map → gltf-ext-quantization-DaymajCR.js.map} +1 -1
  50. package/{gltf-ext-uv-transform-DljdVllE.js → gltf-ext-uv-transform-DFmNJ8kA.js} +2 -2
  51. package/{gltf-ext-uv-transform-DljdVllE.js.map → gltf-ext-uv-transform-DFmNJ8kA.js.map} +1 -1
  52. package/{gltf-feature-animation-pointer-DVhymFLK.js → gltf-feature-animation-pointer-C40tqOhL.js} +3 -3
  53. package/{gltf-feature-animation-pointer-DVhymFLK.js.map → gltf-feature-animation-pointer-C40tqOhL.js.map} +1 -1
  54. package/{gltf-feature-animations-hxC3y3bJ.js → gltf-feature-animations-v0S_yb4T.js} +2 -2
  55. package/{gltf-feature-animations-hxC3y3bJ.js.map → gltf-feature-animations-v0S_yb4T.js.map} +1 -1
  56. package/{gltf-feature-draco-B7Q_cMUv.js → gltf-feature-draco-CljWrsna.js} +2 -2
  57. package/{gltf-feature-draco-B7Q_cMUv.js.map → gltf-feature-draco-CljWrsna.js.map} +1 -1
  58. package/{gltf-feature-gpu-instancing-C7sRzWv7.js → gltf-feature-gpu-instancing-BoeSm6Tn.js} +2 -2
  59. package/{gltf-feature-gpu-instancing-C7sRzWv7.js.map → gltf-feature-gpu-instancing-BoeSm6Tn.js.map} +1 -1
  60. package/{gltf-feature-lights-punctual-DF7kya14.js → gltf-feature-lights-punctual-BCTwgyi_.js} +5 -5
  61. package/{gltf-feature-lights-punctual-DF7kya14.js.map → gltf-feature-lights-punctual-BCTwgyi_.js.map} +1 -1
  62. package/{gltf-feature-meshopt-DRG9hEqT.js → gltf-feature-meshopt-DItMkOMt.js} +2 -2
  63. package/{gltf-feature-meshopt-DRG9hEqT.js.map → gltf-feature-meshopt-DItMkOMt.js.map} +1 -1
  64. package/{gltf-feature-morph-DZydYgWp.js → gltf-feature-morph-Cv0mEYIq.js} +3 -3
  65. package/{gltf-feature-morph-DZydYgWp.js.map → gltf-feature-morph-Cv0mEYIq.js.map} +1 -1
  66. package/{gltf-feature-registry-DeYdy3DV.js → gltf-feature-registry-wNbt6UC-.js} +15 -15
  67. package/{gltf-feature-registry-DeYdy3DV.js.map → gltf-feature-registry-wNbt6UC-.js.map} +1 -1
  68. package/{gltf-feature-skeleton-B9och1W0.js → gltf-feature-skeleton-Deh2UBAn.js} +3 -3
  69. package/{gltf-feature-skeleton-B9och1W0.js.map → gltf-feature-skeleton-Deh2UBAn.js.map} +1 -1
  70. package/{gltf-feature-variants-CY_Qft7f.js → gltf-feature-variants-DGSdFNJq.js} +2 -2
  71. package/{gltf-feature-variants-CY_Qft7f.js.map → gltf-feature-variants-DGSdFNJq.js.map} +1 -1
  72. package/{gltf-glb-parser-CqOeXFOz.js → gltf-glb-parser-DSQWsT4r.js} +2 -2
  73. package/{gltf-glb-parser-CqOeXFOz.js.map → gltf-glb-parser-DSQWsT4r.js.map} +1 -1
  74. package/{gltf-interleave-DWf27t-h.js → gltf-interleave-OBqmlu-h.js} +11 -4
  75. package/gltf-interleave-OBqmlu-h.js.map +1 -0
  76. package/{gltf-normals-b2h74380.js → gltf-normals-D_P0KA4b.js} +10 -2
  77. package/gltf-normals-D_P0KA4b.js.map +1 -0
  78. package/{gltf-pbr-builder-ext-DvFxuOqN.js → gltf-pbr-builder-ext-3imk8Tev.js} +2 -2
  79. package/{gltf-pbr-builder-ext-DvFxuOqN.js.map → gltf-pbr-builder-ext-3imk8Tev.js.map} +1 -1
  80. package/{gltf-variants-CUvzYGYX.js → gltf-variants-Dyr54wwg.js} +4 -4
  81. package/{gltf-variants-CUvzYGYX.js.map → gltf-variants-Dyr54wwg.js.map} +1 -1
  82. package/{gpu-task-timer-Dgkff80h.js → gpu-task-timer-DVBNZfq5.js} +2 -2
  83. package/{gpu-task-timer-Dgkff80h.js.map → gpu-task-timer-DVBNZfq5.js.map} +1 -1
  84. package/{gs-picking-pipeline-55sM5LzV.js → gs-picking-pipeline-CERN-Trj.js} +2 -2
  85. package/{gs-picking-pipeline-55sM5LzV.js.map → gs-picking-pipeline-CERN-Trj.js.map} +1 -1
  86. package/{havok-floating-origin-5xp32P-C.js → havok-floating-origin-VVdJRUYc.js} +2 -2
  87. package/{havok-floating-origin-5xp32P-C.js.map → havok-floating-origin-VVdJRUYc.js.map} +1 -1
  88. package/{index-CYZDclhF.js → index-7Bk-uLSM.js} +2 -2
  89. package/{index-CYZDclhF.js.map → index-7Bk-uLSM.js.map} +1 -1
  90. package/{index-C-tEgwbZ.js → index-BgY3QEzL.js} +2817 -1166
  91. package/index-BgY3QEzL.js.map +1 -0
  92. package/{index-SMJ67XwT.js → index-Dr5LK2tg.js} +2 -2
  93. package/{index-SMJ67XwT.js.map → index-Dr5LK2tg.js.map} +1 -1
  94. package/index.d.ts +572 -18
  95. package/index.js +499 -464
  96. package/{input-block-DbRYCnet.js → input-block-DjdlndCL.js} +2 -2
  97. package/{input-block-DbRYCnet.js.map → input-block-DjdlndCL.js.map} +1 -1
  98. package/{iridescence-fragment-S3Ko1jvC.js → iridescence-fragment-kfsCs8lN.js} +2 -2
  99. package/{iridescence-fragment-S3Ko1jvC.js.map → iridescence-fragment-kfsCs8lN.js.map} +1 -1
  100. package/{light-block-CAqWkucp.js → light-block-qjCrz3de.js} +2 -2
  101. package/{light-block-CAqWkucp.js.map → light-block-qjCrz3de.js.map} +1 -1
  102. package/{loop-block-ch-biPFY.js → loop-block-C8vkQ2bz.js} +2 -2
  103. package/{loop-block-ch-biPFY.js.map → loop-block-C8vkQ2bz.js.map} +1 -1
  104. package/{manifold-AS8POaOr.js → manifold-DeXMNgxT.js} +3 -3
  105. package/{manifold-AS8POaOr.js.map → manifold-DeXMNgxT.js.map} +1 -1
  106. package/{morph-fragment-D9he3Ksk.js → morph-fragment-NpZYyIIU.js} +2 -2
  107. package/{morph-fragment-D9he3Ksk.js.map → morph-fragment-NpZYyIIU.js.map} +1 -1
  108. package/{multilight-wgsl-74aXpcJG.js → multilight-wgsl-I5SncF0q.js} +2 -2
  109. package/{multilight-wgsl-74aXpcJG.js.map → multilight-wgsl-I5SncF0q.js.map} +1 -1
  110. package/{node-env-B2bjGcMS.js → node-env-D7Aee08u.js} +2 -2
  111. package/{node-env-B2bjGcMS.js.map → node-env-D7Aee08u.js.map} +1 -1
  112. package/{node-geometry-view-CSXlEAhG.js → node-geometry-view-DfKXWNfV.js} +3 -3
  113. package/{node-geometry-view-CSXlEAhG.js.map → node-geometry-view-DfKXWNfV.js.map} +1 -1
  114. package/{node-registry-extra-compat-BEQH_ksg.js → node-registry-extra-compat-CDLeBR1P.js} +2 -2
  115. package/{node-registry-extra-compat-BEQH_ksg.js.map → node-registry-extra-compat-CDLeBR1P.js.map} +1 -1
  116. package/{node-registry-extra-math-Bm32WBAa.js → node-registry-extra-math-BA8_l4lB.js} +2 -2
  117. package/{node-registry-extra-math-Bm32WBAa.js.map → node-registry-extra-math-BA8_l4lB.js.map} +1 -1
  118. package/{node-renderable-BMHny4tC.js → node-renderable-EwLLnaL1.js} +2 -2
  119. package/{node-renderable-BMHny4tC.js.map → node-renderable-EwLLnaL1.js.map} +1 -1
  120. package/{node-shadow-BRiz7CT1.js → node-shadow-CeTmT6g4.js} +2 -2
  121. package/{node-shadow-BRiz7CT1.js.map → node-shadow-CeTmT6g4.js.map} +1 -1
  122. package/{normal-map-fragment-sE3TjF4U.js → normal-map-fragment-BHImLyM-.js} +2 -2
  123. package/{normal-map-fragment-sE3TjF4U.js.map → normal-map-fragment-BHImLyM-.js.map} +1 -1
  124. package/package.json +10 -3
  125. package/{parse-camera-CmZBS423.js → parse-camera-5IGdctAS.js} +2 -2
  126. package/{parse-camera-CmZBS423.js.map → parse-camera-5IGdctAS.js.map} +1 -1
  127. package/{pbr-geometry-view-T3vMABM8.js → pbr-geometry-view-Dthf9Aut.js} +3 -3
  128. package/{pbr-geometry-view-T3vMABM8.js.map → pbr-geometry-view-Dthf9Aut.js.map} +1 -1
  129. package/{pbr-metallic-roughness-block-full-CHC8w-Uv.js → pbr-metallic-roughness-block-full-DD6zI_Lx.js} +2 -2
  130. package/{pbr-metallic-roughness-block-full-CHC8w-Uv.js.map → pbr-metallic-roughness-block-full-DD6zI_Lx.js.map} +1 -1
  131. package/{pbr-metallic-roughness-block-DbozMlHU.js → pbr-metallic-roughness-block-g7wjzwN_.js} +2 -2
  132. package/{pbr-metallic-roughness-block-DbozMlHU.js.map → pbr-metallic-roughness-block-g7wjzwN_.js.map} +1 -1
  133. package/{pbr-mr-helper-core-DGRgbRXl.js → pbr-mr-helper-core-CWROQ7OA.js} +2 -2
  134. package/{pbr-mr-helper-core-DGRgbRXl.js.map → pbr-mr-helper-core-CWROQ7OA.js.map} +1 -1
  135. package/{pbr-refraction-CquDP9JO.js → pbr-refraction-Dxsm_gii.js} +2 -2
  136. package/{pbr-refraction-CquDP9JO.js.map → pbr-refraction-Dxsm_gii.js.map} +1 -1
  137. package/{pbr-renderable-CaHKHU0g.js → pbr-renderable-CuKWalEM.js} +22 -22
  138. package/{pbr-renderable-CaHKHU0g.js.map → pbr-renderable-CuKWalEM.js.map} +1 -1
  139. package/{pbr-shadow-fragment-DmnNe6yz.js → pbr-shadow-fragment-waeIBQUq.js} +2 -2
  140. package/{pbr-shadow-fragment-DmnNe6yz.js.map → pbr-shadow-fragment-waeIBQUq.js.map} +1 -1
  141. package/{pbr-tracking-Bo7RTANK.js → pbr-tracking-CdeqbBrh.js} +2 -2
  142. package/{pbr-tracking-Bo7RTANK.js.map → pbr-tracking-CdeqbBrh.js.map} +1 -1
  143. package/{pbr-transmission-ext-CoGcJBGE.js → pbr-transmission-ext-BNiXngZc.js} +2 -2
  144. package/{pbr-transmission-ext-CoGcJBGE.js.map → pbr-transmission-ext-BNiXngZc.js.map} +1 -1
  145. package/{recast-navigation.wasm-DG_0AFuk.js → recast-navigation.wasm-VC4lGlEe.js} +3 -3
  146. package/{recast-navigation.wasm-DG_0AFuk.js.map → recast-navigation.wasm-VC4lGlEe.js.map} +1 -1
  147. package/{recast-navigation.wasm-compat-C-Bf2ylB.js → recast-navigation.wasm-compat-CTwYOzRz.js} +3 -3
  148. package/{recast-navigation.wasm-compat-C-Bf2ylB.js.map → recast-navigation.wasm-compat-CTwYOzRz.js.map} +1 -1
  149. package/{reflectance-fragment-CExe6qDY.js → reflectance-fragment-BQFZ_pgy.js} +2 -2
  150. package/{reflectance-fragment-CExe6qDY.js.map → reflectance-fragment-BQFZ_pgy.js.map} +1 -1
  151. package/{rgbd-decode-DkiiiIlt.js → rgbd-decode-duTlXMWd.js} +2 -2
  152. package/{rgbd-decode-DkiiiIlt.js.map → rgbd-decode-duTlXMWd.js.map} +1 -1
  153. package/{screenshot-readback-avr_tYGZ.js → screenshot-readback-DnxR4rhp.js} +2 -2
  154. package/{screenshot-readback-avr_tYGZ.js.map → screenshot-readback-DnxR4rhp.js.map} +1 -1
  155. package/{shader-composer-CZagsJDS.js → shader-composer-CBy2i8nU.js} +2 -2
  156. package/{shader-composer-CZagsJDS.js.map → shader-composer-CBy2i8nU.js.map} +1 -1
  157. package/{shader-renderable-D5sbgzxt.js → shader-renderable-DVMVD6zP.js} +4 -4
  158. package/{shader-renderable-D5sbgzxt.js.map → shader-renderable-DVMVD6zP.js.map} +1 -1
  159. package/{shader-thin-instance-CkQ8rrfH.js → shader-thin-instance-CsDo3ULk.js} +2 -2
  160. package/{shader-thin-instance-CkQ8rrfH.js.map → shader-thin-instance-CsDo3ULk.js.map} +1 -1
  161. package/{sheen-fragment-BEigjpTX.js → sheen-fragment-B_Jd7wrr.js} +2 -2
  162. package/{sheen-fragment-BEigjpTX.js.map → sheen-fragment-B_Jd7wrr.js.map} +1 -1
  163. package/{singlelight-directional-wgsl-Ccsk-ys3.js → singlelight-directional-wgsl-Bw84txva.js} +2 -2
  164. package/{singlelight-directional-wgsl-Ccsk-ys3.js.map → singlelight-directional-wgsl-Bw84txva.js.map} +1 -1
  165. package/{singlelight-hemispheric-wgsl-DL-jpc97.js → singlelight-hemispheric-wgsl-DjxhgI8r.js} +2 -2
  166. package/{singlelight-hemispheric-wgsl-DL-jpc97.js.map → singlelight-hemispheric-wgsl-DjxhgI8r.js.map} +1 -1
  167. package/{singlelight-point-wgsl-hYmiP6ys.js → singlelight-point-wgsl-iA1aRkXA.js} +2 -2
  168. package/{singlelight-point-wgsl-hYmiP6ys.js.map → singlelight-point-wgsl-iA1aRkXA.js.map} +1 -1
  169. package/{singlelight-spot-wgsl-DSjp1p1C.js → singlelight-spot-wgsl-MDdTdstF.js} +2 -2
  170. package/{singlelight-spot-wgsl-DSjp1p1C.js.map → singlelight-spot-wgsl-MDdTdstF.js.map} +1 -1
  171. package/{skeleton-fragment-B__bUbPK.js → skeleton-fragment-COdHWFcK.js} +2 -2
  172. package/{skeleton-fragment-B__bUbPK.js.map → skeleton-fragment-COdHWFcK.js.map} +1 -1
  173. package/{skybox-renderable-BH6uUkal.js → skybox-renderable-DJYkfw32.js} +2 -2
  174. package/{skybox-renderable-BH6uUkal.js.map → skybox-renderable-DJYkfw32.js.map} +1 -1
  175. package/{splat-ply-compressed-BGNK6dnh.js → splat-ply-compressed-SxMlsKNK.js} +2 -2
  176. package/{splat-ply-compressed-BGNK6dnh.js.map → splat-ply-compressed-SxMlsKNK.js.map} +1 -1
  177. package/{standard-pipeline-BvFynkwL.js → standard-pipeline-DXFOUqU_.js} +3 -3
  178. package/{standard-pipeline-BvFynkwL.js.map → standard-pipeline-DXFOUqU_.js.map} +1 -1
  179. package/{standard-renderable-1Q3zemys.js → standard-renderable-BAc-i-ig.js} +3 -3
  180. package/{standard-renderable-1Q3zemys.js.map → standard-renderable-BAc-i-ig.js.map} +1 -1
  181. package/{std-ambient-fragment-__F1KTEu.js → std-ambient-fragment-P8dHZ4An.js} +2 -2
  182. package/{std-ambient-fragment-__F1KTEu.js.map → std-ambient-fragment-P8dHZ4An.js.map} +1 -1
  183. package/{std-cube-reflection-fragment-DidM0byH.js → std-cube-reflection-fragment-CF03MuQt.js} +2 -2
  184. package/{std-cube-reflection-fragment-DidM0byH.js.map → std-cube-reflection-fragment-CF03MuQt.js.map} +1 -1
  185. package/{std-emissive-fragment-Bj62X4Np.js → std-emissive-fragment-P8yJGclx.js} +2 -2
  186. package/{std-emissive-fragment-Bj62X4Np.js.map → std-emissive-fragment-P8yJGclx.js.map} +1 -1
  187. package/{std-lightmap-fragment-DXvfWvKc.js → std-lightmap-fragment-CymEG79z.js} +9 -6
  188. package/std-lightmap-fragment-CymEG79z.js.map +1 -0
  189. package/{std-opacity-fragment-BzMMb1K_.js → std-opacity-fragment-DLa1zV06.js} +2 -2
  190. package/{std-opacity-fragment-BzMMb1K_.js.map → std-opacity-fragment-DLa1zV06.js.map} +1 -1
  191. package/{std-reflection-fragment-DC9Kvu1C.js → std-reflection-fragment-BLySsYos.js} +2 -2
  192. package/{std-reflection-fragment-DC9Kvu1C.js.map → std-reflection-fragment-BLySsYos.js.map} +1 -1
  193. package/{std-shadow-fragment-BnMHeF1-.js → std-shadow-fragment-C_q27Mdi.js} +2 -2
  194. package/{std-shadow-fragment-BnMHeF1-.js.map → std-shadow-fragment-C_q27Mdi.js.map} +1 -1
  195. package/{std-specular-fragment-Bio681OG.js → std-specular-fragment-CaBXyAWY.js} +2 -2
  196. package/{std-specular-fragment-Bio681OG.js.map → std-specular-fragment-CaBXyAWY.js.map} +1 -1
  197. package/{std-tracking-BTcrry2o.js → std-tracking-Bw61Dv98.js} +2 -2
  198. package/{std-tracking-BTcrry2o.js.map → std-tracking-Bw61Dv98.js.map} +1 -1
  199. package/{subsurface-fragment-DpKib445.js → subsurface-fragment-BNQoG9gr.js} +2 -2
  200. package/{subsurface-fragment-DpKib445.js.map → subsurface-fragment-BNQoG9gr.js.map} +1 -1
  201. package/{thin-instance-cull-binding-DwZi7mlE.js → thin-instance-cull-binding-BNC5JiGw.js} +3 -3
  202. package/{thin-instance-cull-binding-DwZi7mlE.js.map → thin-instance-cull-binding-BNC5JiGw.js.map} +1 -1
  203. package/{thin-instance-gpu-uY2NOv0J.js → thin-instance-gpu-C1DGstap.js} +2 -2
  204. package/{thin-instance-gpu-uY2NOv0J.js.map → thin-instance-gpu-C1DGstap.js.map} +1 -1
  205. package/{tracking-primitives-Ck5bgCuo.js → tracking-primitives-CMBWLxGr.js} +2 -2
  206. package/{tracking-primitives-Ck5bgCuo.js.map → tracking-primitives-CMBWLxGr.js.map} +1 -1
  207. package/{unlit-fragment-nc6hu3Mw.js → unlit-fragment-BsHrS9XX.js} +2 -2
  208. package/{unlit-fragment-nc6hu3Mw.js.map → unlit-fragment-BsHrS9XX.js.map} +1 -1
  209. package/gltf-interleave-DWf27t-h.js.map +0 -1
  210. package/gltf-normals-b2h74380.js.map +0 -1
  211. package/index-C-tEgwbZ.js.map +0 -1
  212. package/std-lightmap-fragment-DXvfWvKc.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"normal-map-fragment-sE3TjF4U.js","sources":["../src/material/standard/fragments/normal-map-fragment.ts"],"sourcesContent":["/**\n * Normal Map Fragment (Cotangent Frame)\n *\n * Shared cotangent-frame bump mapping for Standard materials.\n * Uses screen-space derivatives to construct the TBN frame without\n * requiring explicit tangent vertex attributes.\n */\n\nimport type { ShaderFragment } from \"../../../shader/fragment-types.js\";\nimport type { StandardMaterialProps } from \"../standard-material.js\";\nimport type { Texture2D } from \"../../../texture/texture-2d.js\";\nimport type { StdExt } from \"../standard-flags.js\";\nimport { HAS_BUMP_TEXTURE } from \"../standard-flags.js\";\nimport { WGSL_PERTURB_NORMAL } from \"../../../shader/wgsl-helpers.js\";\n\nconst STAGE_FRAGMENT = 0x2;\n\n/**\n * Create a bump/normal map fragment for Standard material.\n * @param bumpLevel - The bump level (1.0 = default). bumpScale = 1/bumpLevel.\n */\nexport function createNormalMapFragment(): ShaderFragment {\n return {\n _id: \"normal-map\",\n\n _bindings: [\n { _name: \"bT\", _type: { _kind: \"texture\", _textureType: \"texture_2d<f32>\" }, _visibility: STAGE_FRAGMENT },\n { _name: \"bS\", _type: { _kind: \"sampler\", _samplerType: \"sampler\" }, _visibility: STAGE_FRAGMENT },\n ],\n\n _helperFunctions: WGSL_PERTURB_NORMAL,\n\n _fragmentSlots: {\n AC: `normalW = perturbNormal(input.vn, input.vp, input.vu, mat.bs);`,\n },\n };\n}\n\nexport const bumpStdExt: StdExt = {\n _id: \"normal-map\",\n _phase: \"mesh\",\n _feature: HAS_BUMP_TEXTURE,\n _frag: createNormalMapFragment,\n _bind(mat: StandardMaterialProps, entries: GPUBindGroupEntry[], b: number): number {\n const tex = mat.bumpTexture!;\n entries.push({ binding: b++, resource: tex.texture.createView() });\n entries.push({ binding: b++, resource: tex.sampler });\n return b;\n },\n _textures(mat: StandardMaterialProps, out: Texture2D[]): void {\n if (mat.bumpTexture) {\n out.push(mat.bumpTexture);\n }\n },\n};\n"],"names":[],"mappings":";;AAeA,MAAM,iBAAiB;AAMhB,SAAS,0BAA0C;AACtD,SAAO;AAAA,IACH,KAAK;AAAA,IAEL,WAAW;AAAA,MACP,EAAE,OAAO,MAAM,OAAO,EAAE,OAAO,WAAW,cAAc,kBAAA,GAAqB,aAAa,eAAA;AAAA,MAC1F,EAAE,OAAO,MAAM,OAAO,EAAE,OAAO,WAAW,cAAc,aAAa,aAAa,eAAA;AAAA,IAAe;AAAA,IAGrG,kBAAkB;AAAA,IAElB,gBAAgB;AAAA,MACZ,IAAI;AAAA,IAAA;AAAA,EACR;AAER;AAEO,MAAM,aAAqB;AAAA,EAC9B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM,KAA4B,SAA8B,GAAmB;AAC/E,UAAM,MAAM,IAAI;AAChB,YAAQ,KAAK,EAAE,SAAS,KAAK,UAAU,IAAI,QAAQ,WAAA,GAAc;AACjE,YAAQ,KAAK,EAAE,SAAS,KAAK,UAAU,IAAI,SAAS;AACpD,WAAO;AAAA,EACX;AAAA,EACA,UAAU,KAA4B,KAAwB;AAC1D,QAAI,IAAI,aAAa;AACjB,UAAI,KAAK,IAAI,WAAW;AAAA,IAC5B;AAAA,EACJ;AACJ;"}
1
+ {"version":3,"file":"normal-map-fragment-BHImLyM-.js","sources":["../src/material/standard/fragments/normal-map-fragment.ts"],"sourcesContent":["/**\n * Normal Map Fragment (Cotangent Frame)\n *\n * Shared cotangent-frame bump mapping for Standard materials.\n * Uses screen-space derivatives to construct the TBN frame without\n * requiring explicit tangent vertex attributes.\n */\n\nimport type { ShaderFragment } from \"../../../shader/fragment-types.js\";\nimport type { StandardMaterialProps } from \"../standard-material.js\";\nimport type { Texture2D } from \"../../../texture/texture-2d.js\";\nimport type { StdExt } from \"../standard-flags.js\";\nimport { HAS_BUMP_TEXTURE } from \"../standard-flags.js\";\nimport { WGSL_PERTURB_NORMAL } from \"../../../shader/wgsl-helpers.js\";\n\nconst STAGE_FRAGMENT = 0x2;\n\n/**\n * Create a bump/normal map fragment for Standard material.\n * @param bumpLevel - The bump level (1.0 = default). bumpScale = 1/bumpLevel.\n */\nexport function createNormalMapFragment(): ShaderFragment {\n return {\n _id: \"normal-map\",\n\n _bindings: [\n { _name: \"bT\", _type: { _kind: \"texture\", _textureType: \"texture_2d<f32>\" }, _visibility: STAGE_FRAGMENT },\n { _name: \"bS\", _type: { _kind: \"sampler\", _samplerType: \"sampler\" }, _visibility: STAGE_FRAGMENT },\n ],\n\n _helperFunctions: WGSL_PERTURB_NORMAL,\n\n _fragmentSlots: {\n AC: `normalW = perturbNormal(input.vn, input.vp, input.vu, mat.bs);`,\n },\n };\n}\n\nexport const bumpStdExt: StdExt = {\n _id: \"normal-map\",\n _phase: \"mesh\",\n _feature: HAS_BUMP_TEXTURE,\n _frag: createNormalMapFragment,\n _bind(mat: StandardMaterialProps, entries: GPUBindGroupEntry[], b: number): number {\n const tex = mat.bumpTexture!;\n entries.push({ binding: b++, resource: tex.texture.createView() });\n entries.push({ binding: b++, resource: tex.sampler });\n return b;\n },\n _textures(mat: StandardMaterialProps, out: Texture2D[]): void {\n if (mat.bumpTexture) {\n out.push(mat.bumpTexture);\n }\n },\n};\n"],"names":[],"mappings":";;AAeA,MAAM,iBAAiB;AAMhB,SAAS,0BAA0C;AACtD,SAAO;AAAA,IACH,KAAK;AAAA,IAEL,WAAW;AAAA,MACP,EAAE,OAAO,MAAM,OAAO,EAAE,OAAO,WAAW,cAAc,kBAAA,GAAqB,aAAa,eAAA;AAAA,MAC1F,EAAE,OAAO,MAAM,OAAO,EAAE,OAAO,WAAW,cAAc,aAAa,aAAa,eAAA;AAAA,IAAe;AAAA,IAGrG,kBAAkB;AAAA,IAElB,gBAAgB;AAAA,MACZ,IAAI;AAAA,IAAA;AAAA,EACR;AAER;AAEO,MAAM,aAAqB;AAAA,EAC9B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM,KAA4B,SAA8B,GAAmB;AAC/E,UAAM,MAAM,IAAI;AAChB,YAAQ,KAAK,EAAE,SAAS,KAAK,UAAU,IAAI,QAAQ,WAAA,GAAc;AACjE,YAAQ,KAAK,EAAE,SAAS,KAAK,UAAU,IAAI,SAAS;AACpD,WAAO;AAAA,EACX;AAAA,EACA,UAAU,KAA4B,KAAwB;AAC1D,QAAI,IAAI,aAAa;AACjB,UAAI,KAAK,IAAI,WAAW;AAAA,IAC5B;AAAA,EACJ;AACJ;"}
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "@babylonjs/lite",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
+ "description": "A lightweight, tree-shakable, WebGPU-first rendering library derived from Babylon.js.",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://doc.babylonjs.com/lite/",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/BabylonJS/Babylon-Lite.git"
10
+ },
4
11
  "type": "module",
5
12
  "main": "./index.js",
6
13
  "module": "./index.js",
@@ -13,7 +20,7 @@
13
20
  },
14
21
  "sideEffects": false,
15
22
  "babylonLiteRelease": {
16
- "azureBuildId": "54828",
17
- "sourceVersion": "2d0102a8b0e6e6425171fc9d5dda33d0ccfe08b6"
23
+ "azureBuildId": "54972",
24
+ "sourceVersion": "f72483fa587933830d87a2804dcdfa01a0d982ad"
18
25
  }
19
26
  }
@@ -1,4 +1,4 @@
1
- import { x as createFreeCamera } from "./index-C-tEgwbZ.js";
1
+ import { x as createFreeCamera } from "./index-BgY3QEzL.js";
2
2
  function parseBabylonCamera(cd) {
3
3
  var _a, _b;
4
4
  const p = cd.position;
@@ -20,4 +20,4 @@ function parseBabylonCamera(cd) {
20
20
  export {
21
21
  parseBabylonCamera
22
22
  };
23
- //# sourceMappingURL=parse-camera-CmZBS423.js.map
23
+ //# sourceMappingURL=parse-camera-5IGdctAS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-camera-CmZBS423.js","sources":["../src/loader-babylon/parse-camera.ts"],"sourcesContent":["/** Parse a FreeCamera from .babylon camera data. Dynamically imported by load-babylon.ts. */\nimport { createFreeCamera } from \"../camera/free-camera.js\";\nimport type { FreeCamera } from \"../camera/free-camera.js\";\n\nexport function parseBabylonCamera(cd: { position: number[]; rotation?: number[]; fov?: number; minZ?: number; maxZ?: number }): FreeCamera {\n const p = cd.position;\n const pitch = cd.rotation?.[0] ?? 0;\n const yaw = cd.rotation?.[1] ?? 0;\n const cp = Math.cos(pitch);\n const cam = createFreeCamera({ x: p[0]!, y: p[1]!, z: p[2]! }, { x: p[0]! + cp * Math.sin(yaw), y: p[1]! - Math.sin(pitch), z: p[2]! + cp * Math.cos(yaw) });\n if (cd.fov != null) {\n cam.fov = cd.fov;\n }\n if (cd.minZ != null) {\n cam.nearPlane = cd.minZ;\n }\n if (cd.maxZ != null) {\n cam.farPlane = cd.maxZ;\n }\n return cam;\n}\n"],"names":[],"mappings":";AAIO,SAAS,mBAAmB,IAAyG;;AACxI,QAAM,IAAI,GAAG;AACb,QAAM,UAAQ,QAAG,aAAH,mBAAc,OAAM;AAClC,QAAM,QAAM,QAAG,aAAH,mBAAc,OAAM;AAChC,QAAM,KAAK,KAAK,IAAI,KAAK;AACzB,QAAM,MAAM,iBAAiB,EAAE,GAAG,EAAE,CAAC,GAAI,GAAG,EAAE,CAAC,GAAI,GAAG,EAAE,CAAC,EAAA,GAAM,EAAE,GAAG,EAAE,CAAC,IAAK,KAAK,KAAK,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC,IAAK,KAAK,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC,IAAK,KAAK,KAAK,IAAI,GAAG,GAAG;AAC3J,MAAI,GAAG,OAAO,MAAM;AAChB,QAAI,MAAM,GAAG;AAAA,EACjB;AACA,MAAI,GAAG,QAAQ,MAAM;AACjB,QAAI,YAAY,GAAG;AAAA,EACvB;AACA,MAAI,GAAG,QAAQ,MAAM;AACjB,QAAI,WAAW,GAAG;AAAA,EACtB;AACA,SAAO;AACX;"}
1
+ {"version":3,"file":"parse-camera-5IGdctAS.js","sources":["../src/loader-babylon/parse-camera.ts"],"sourcesContent":["/** Parse a FreeCamera from .babylon camera data. Dynamically imported by load-babylon.ts. */\nimport { createFreeCamera } from \"../camera/free-camera.js\";\nimport type { FreeCamera } from \"../camera/free-camera.js\";\n\nexport function parseBabylonCamera(cd: { position: number[]; rotation?: number[]; fov?: number; minZ?: number; maxZ?: number }): FreeCamera {\n const p = cd.position;\n const pitch = cd.rotation?.[0] ?? 0;\n const yaw = cd.rotation?.[1] ?? 0;\n const cp = Math.cos(pitch);\n const cam = createFreeCamera({ x: p[0]!, y: p[1]!, z: p[2]! }, { x: p[0]! + cp * Math.sin(yaw), y: p[1]! - Math.sin(pitch), z: p[2]! + cp * Math.cos(yaw) });\n if (cd.fov != null) {\n cam.fov = cd.fov;\n }\n if (cd.minZ != null) {\n cam.nearPlane = cd.minZ;\n }\n if (cd.maxZ != null) {\n cam.farPlane = cd.maxZ;\n }\n return cam;\n}\n"],"names":[],"mappings":";AAIO,SAAS,mBAAmB,IAAyG;;AACxI,QAAM,IAAI,GAAG;AACb,QAAM,UAAQ,QAAG,aAAH,mBAAc,OAAM;AAClC,QAAM,QAAM,QAAG,aAAH,mBAAc,OAAM;AAChC,QAAM,KAAK,KAAK,IAAI,KAAK;AACzB,QAAM,MAAM,iBAAiB,EAAE,GAAG,EAAE,CAAC,GAAI,GAAG,EAAE,CAAC,GAAI,GAAG,EAAE,CAAC,EAAA,GAAM,EAAE,GAAG,EAAE,CAAC,IAAK,KAAK,KAAK,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC,IAAK,KAAK,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC,IAAK,KAAK,KAAK,IAAI,GAAG,GAAG;AAC3J,MAAI,GAAG,OAAO,MAAM;AAChB,QAAI,MAAM,GAAG;AAAA,EACjB;AACA,MAAI,GAAG,QAAQ,MAAM;AACjB,QAAI,YAAY,GAAG;AAAA,EACvB;AACA,MAAI,GAAG,QAAQ,MAAM;AACjB,QAAI,WAAW,GAAG;AAAA,EACtB;AACA,SAAO;AACX;"}
@@ -1,5 +1,5 @@
1
- import { c3 as _registerPbrExt, c4 as PBR2_GEOMETRY_OUTPUT, G as GeometryTextureType, W as PBR_HAS_ALPHA_BLEND, c5 as PBR_HAS_ENV, c6 as _computePbrMaterialFeatures, b as writeMeshLightSelection, au as _computeMeshFeatures, a as F32, p as packMat4IntoF32, aw as createUniformBuffer, c7 as collectPbrBoundTextures, ay as acquireTexture, az as releaseTexture, A as getSceneBindGroupLayout, y as targetSignatureKey, bL as REVERSE_DEPTH_COMPARE, c8 as PBR_HAS_NORMAL_MAP, c9 as MSH_HAS_TANGENTS, aN as PBR2_HAS_UV2, ca as MSH_HAS_UV2, cb as MSH_HAS_VERTEX_COLOR, aE as MSH_HAS_THIN_INSTANCES, aC as MSH_HAS_INSTANCE_COLOR, cc as PBR_HAS_DOUBLE_SIDED, P as createMaterialView } from "./index-C-tEgwbZ.js";
2
- import { c as createPbrMeshBindGroup, _ as _writeMaterialData } from "./pbr-renderable-CaHKHU0g.js";
1
+ import { c5 as _registerPbrExt, c6 as PBR2_GEOMETRY_OUTPUT, G as GeometryTextureType, W as PBR_HAS_ALPHA_BLEND, c7 as PBR_HAS_ENV, c8 as _computePbrMaterialFeatures, b as writeMeshLightSelection, aw as _computeMeshFeatures, a as F32, p as packMat4IntoF32, ay as createUniformBuffer, c9 as collectPbrBoundTextures, aA as acquireTexture, aB as releaseTexture, A as getSceneBindGroupLayout, y as targetSignatureKey, bN as REVERSE_DEPTH_COMPARE, ca as PBR_HAS_NORMAL_MAP, cb as MSH_HAS_TANGENTS, aP as PBR2_HAS_UV2, cc as MSH_HAS_UV2, cd as MSH_HAS_VERTEX_COLOR, aG as MSH_HAS_THIN_INSTANCES, aE as MSH_HAS_INSTANCE_COLOR, ce as PBR_HAS_DOUBLE_SIDED, P as createMaterialView } from "./index-BgY3QEzL.js";
2
+ import { c as createPbrMeshBindGroup, _ as _writeMaterialData } from "./pbr-renderable-CuKWalEM.js";
3
3
  const STAGE_FRAGMENT = 2;
4
4
  const STAGE_VERTEX = 1;
5
5
  function needsGpUbo(attachments) {
@@ -488,4 +488,4 @@ export {
488
488
  _setActivePbrGeometryAttachments,
489
489
  createPbrGeometryMaterialView
490
490
  };
491
- //# sourceMappingURL=pbr-geometry-view-T3vMABM8.js.map
491
+ //# sourceMappingURL=pbr-geometry-view-Dthf9Aut.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pbr-geometry-view-T3vMABM8.js","sources":["../src/material/pbr/pbr-geometry-output-shader.ts","../src/material/pbr/pbr-geometry-renderable.ts","../src/material/pbr/pbr-geometry-view.ts"],"sourcesContent":["/** PBR geometry-output shader composer.\n *\n * Builds the WGSL for a {@link createPbrGeometryMaterialView}-wrapped PBR\n * material that targets the geometry-renderer MRT pass.\n *\n * Design — *zero bundle impact* on PBR scenes that never load the\n * geometry-renderer task:\n *\n * 1. Reuse the per-scene {@link composePbr} captured on the scene context.\n * The composer already wires every PBR feature (IBL, shadows, lights,\n * clearcoat, sheen, iridescence, anisotropy, subsurface, alpha-test,\n * emissive, tonemap, …); none of it needs re-implementing for the\n * real-colour attachment.\n * 2. Register a PBR extension that, only when `PBR2_GEOMETRY_OUTPUT` is on,\n * contributes a small `geometry-params` ShaderFragment carrying the\n * `gp` UBO + per-attachment varyings (vCurrentClip / vPreviousClip /\n * vLocalPos). Off otherwise — no impact on regular PBR composes.\n * 3. Post-process the composed fragment WGSL: change the entry signature\n * to return a `FragmentOutput` MRT struct, inject the struct\n * declaration, and replace the alpha-block `return …` with code that\n * writes each requested geometry attachment from the in-scope PBR\n * intermediates (`N`, `surfaceAlbedo`, `colorF0`, `roughness`,\n * `microSurface`, `finalIrradiance`, `input.worldPos`, …).\n *\n * The lighting / tonemap / gamma pipeline still runs in full, producing\n * the lit `color` written to the optional real-colour attachment. */\n\nimport type { ComposedShader, ShaderFragment, Varying } from \"../../shader/fragment-types.js\";\nimport { GeometryTextureType } from \"../../frame-graph/geometry-types.js\";\nimport { PBR_HAS_ALPHA_BLEND, PBR_HAS_ENV, PBR2_GEOMETRY_OUTPUT, _registerPbrExt, type _PbrBindCtx, type _PbrFragCtx, type PbrExt } from \"./pbr-flags.js\";\nimport type { createPbrComposer, PbrLightMode } from \"./pbr-compose.js\";\nimport type { MeshVbLayout } from \"../../mesh/mesh.js\";\n\nconst STAGE_FRAGMENT = 0x2;\nconst STAGE_VERTEX = 0x1;\n\n// ─── PBR extension contributing the geometry-params fragment ──────────\n\nfunction needsGpUbo(attachments: readonly GeometryTextureType[]): boolean {\n for (const t of attachments) {\n if (t === GeometryTextureType.NORMALIZED_VIEW_DEPTH || t === GeometryTextureType.LINEAR_VELOCITY) {\n return true;\n }\n }\n return false;\n}\n\nfunction needsVelocity(attachments: readonly GeometryTextureType[]): boolean {\n return attachments.includes(GeometryTextureType.LINEAR_VELOCITY);\n}\n\nfunction needsLocalPos(attachments: readonly GeometryTextureType[]): boolean {\n return attachments.includes(GeometryTextureType.LOCAL_POSITION);\n}\n\n/** ShaderFragment contributing the `gp` UBO + (optionally) velocity / local-pos varyings.\n * PBR-specific: world-position varying is `out.worldPos`. */\nfunction createPbrGeometryParamsFragment(needsParamsUbo: boolean, needsVelocityVaryings: boolean, needsLocalPosVarying: boolean): ShaderFragment {\n const bindings = needsParamsUbo ? [{ _name: \"gp\", _type: { _kind: \"uniform-buffer\" as const }, _visibility: STAGE_FRAGMENT | STAGE_VERTEX }] : [];\n const helpers = needsParamsUbo ? `struct gpUniforms { previousViewProjection: mat4x4<f32>, cameraNearFar: vec4<f32>, };` : \"\";\n const varyings: Varying[] = [];\n if (needsVelocityVaryings) {\n varyings.push({ _name: \"vCurrentClip\", _type: \"vec4<f32>\" }, { _name: \"vPreviousClip\", _type: \"vec4<f32>\" });\n }\n if (needsLocalPosVarying) {\n varyings.push({ _name: \"vLocalPos\", _type: \"vec3<f32>\" });\n }\n const vbParts: string[] = [];\n if (needsVelocityVaryings) {\n vbParts.push(`out.vCurrentClip = scene.viewProjection * vec4<f32>(out.worldPos, 1.0);`);\n vbParts.push(`out.vPreviousClip = gp.previousViewProjection * vec4<f32>(out.worldPos, 1.0);`);\n }\n if (needsLocalPosVarying) {\n vbParts.push(`out.vLocalPos = position;`);\n }\n const slots: ShaderFragment[\"_vertexSlots\"] = vbParts.length > 0 ? { VB: vbParts.join(\"\\n\") } : {};\n return {\n _id: \"pbr-geometry-params\",\n _bindings: bindings,\n _helperFunctions: helpers,\n _vertexHelperFunctions: helpers,\n _varyings: varyings,\n _vertexSlots: slots,\n };\n}\n\n/** PBR extension that wires the geometry-params fragment + gp UBO bind entry.\n * Off-path for any scene that doesn't request `PBR2_GEOMETRY_OUTPUT`. */\nlet _pbrGeomExtRegistered = false;\n\n/** @internal Registers (idempotent) the PBR extension that wires up the\n * geometry-output `gp` UBO and varyings. Called by the geometry view at\n * first use so non-geometry PBR scenes pay zero bytes. */\nexport function _ensurePbrGeometryExt(getAttachments: () => readonly GeometryTextureType[] | undefined): void {\n if (_pbrGeomExtRegistered) {\n return;\n }\n _pbrGeomExtRegistered = true;\n const ext: PbrExt = {\n id: \"pbr-geometry-params\",\n // Fragment-phase so bind entry is appended after all other PBR exts.\n phase: \"fragment\",\n frag(ctx: _PbrFragCtx): ShaderFragment | null {\n if ((ctx._features2 & PBR2_GEOMETRY_OUTPUT) === 0) {\n return null;\n }\n const att = getAttachments() ?? [];\n const wantsGp = needsGpUbo(att);\n const wantsVelocity = needsVelocity(att);\n const wantsLocalPos = needsLocalPos(att);\n if (!wantsGp && !wantsVelocity && !wantsLocalPos) {\n return null;\n }\n return createPbrGeometryParamsFragment(wantsGp, wantsVelocity, wantsLocalPos);\n },\n bind(ctx: _PbrBindCtx, entries: GPUBindGroupEntry[], b: number): number {\n if ((ctx._features2 & PBR2_GEOMETRY_OUTPUT) === 0) {\n return b;\n }\n const view = ctx._material as { _gpUBO?: GPUBuffer | null };\n if (view._gpUBO) {\n entries.push({ binding: b++, resource: { buffer: view._gpUBO } });\n }\n return b;\n },\n };\n _registerPbrExt(ext);\n}\n\n// ─── Per-attachment WGSL expressions ──────────────────────────────────\n\n/** Per-attachment WGSL output expression. Symbols are resolved against the\n * in-scope PBR fragment vars at the BC slot location (after tonemap +\n * gamma + contrast; same scope as the alpha-block).\n * @internal */\nfunction attachmentExpr(type: GeometryTextureType, wg: string, hasIbl: boolean): string {\n switch (type) {\n case GeometryTextureType.IRRADIANCE:\n // BJS PREPASS_IRRADIANCE (pbrBlockPrePass.fx): `finalDiffuse + finalIrradiance`\n // — direct-light diffuse plus the IBL diffuse contribution (already multiplied\n // by surfaceAlbedo / occlusion), NOT the raw SH irradiance. Lite's equivalents\n // are `directDiffuse` (direct) and `finalIrradiance` (= environmentIrradiance *\n // surfaceAlbedo * occlusion, ibl-fragment.ts). Both are pre-tonemap, matching BJS.\n return hasIbl ? `vec4<f32>(directDiffuse + finalIrradiance, ${wg})` : `vec4<f32>(directDiffuse, ${wg})`;\n case GeometryTextureType.WORLD_POSITION:\n return `vec4<f32>(input.worldPos, ${wg})`;\n case GeometryTextureType.LOCAL_POSITION:\n return `vec4<f32>(input.vLocalPos, ${wg})`;\n case GeometryTextureType.REFLECTIVITY:\n // BJS PREPASS_REFLECTIVITY (pbrBlockPrePass.fx): `vec4(specularEnvironmentR0, microSurface)`\n // — LINEAR F0 reflectance (no gamma) in RGB, microSurface (= 1 - roughness) in A,\n // the whole vec4 masked by writeGeometryInfo. Lite's `colorF0` is the F0 reflectance.\n return `vec4<f32>(colorF0, 1.0 - roughness) * ${wg}`;\n case GeometryTextureType.VIEW_DEPTH:\n return `vec4<f32>((scene.view * vec4<f32>(input.worldPos, 1.0)).z, 0.0, 0.0, ${wg})`;\n case GeometryTextureType.NORMALIZED_VIEW_DEPTH:\n return `vec4<f32>(((scene.view * vec4<f32>(input.worldPos, 1.0)).z - gp.cameraNearFar.x) / (gp.cameraNearFar.y - gp.cameraNearFar.x), 0.0, 0.0, ${wg})`;\n case GeometryTextureType.SCREENSPACE_DEPTH:\n return `vec4<f32>(input.clipPos.z, 0.0, 0.0, ${wg})`;\n case GeometryTextureType.VIEW_NORMAL:\n return `vec4<f32>(normalize((scene.view * vec4<f32>(N, 0.0)).xyz), ${wg})`;\n case GeometryTextureType.WORLD_NORMAL:\n return `vec4<f32>(N * 0.5 + vec3<f32>(0.5), ${wg})`;\n case GeometryTextureType.ALBEDO:\n // BJS uses `surfaceAlbedo` for PBR (post diffuse / metallic split).\n return `vec4<f32>(surfaceAlbedo, ${wg})`;\n case GeometryTextureType.LINEAR_VELOCITY: {\n const cur = `(input.vCurrentClip.xy / input.vCurrentClip.w)`;\n const prev = `(input.vPreviousClip.xy / input.vPreviousClip.w)`;\n return `vec4<f32>(0.5 * (${prev} - ${cur}), 0.0, ${wg})`;\n }\n }\n}\n\n// ─── Composer entry ────────────────────────────────────────────────────\n\n/** Compose a PBR geometry-output shader by reusing the per-scene composer\n * and post-patching the resulting WGSL into MRT form. */\nexport function composePbrGeometryShader(\n composePbr: ReturnType<typeof createPbrComposer>,\n features: number,\n features2: number,\n meshFeatures: number,\n sceneFeatures: number,\n lightMode: PbrLightMode,\n singleLightType: string,\n esmShadowDepthCode: string,\n vbStrides: MeshVbLayout | undefined,\n vbKey: string,\n attachments: readonly GeometryTextureType[],\n emitColor: boolean\n): ComposedShader {\n // Strip PBR_HAS_ALPHA_BLEND: the template's alpha-blend branch returns\n // `finalAlpha = saturate(alpha + luminanceOverAlpha²)` which we don't need\n // — we drive blending per attachment via the geometry pipeline state and\n // gate writes via the `writeGeometryInfo` mask. Stripping yields the\n // simple `return vec4<f32>(color,alpha*material.materialAlpha);` alpha\n // block which is easier to pattern-match for the replacement.\n const geomFeatures = features & ~PBR_HAS_ALPHA_BLEND;\n // Tag the cache key with PBR2_GEOMETRY_OUTPUT so the geometry composed\n // shader doesn't collide with the regular non-geometry one in composePbr's\n // internal cache.\n const geomFeatures2 = features2 | PBR2_GEOMETRY_OUTPUT;\n\n const base = composePbr(\n geomFeatures,\n geomFeatures2,\n meshFeatures,\n sceneFeatures,\n lightMode,\n singleLightType,\n esmShadowDepthCode,\n vbStrides,\n `${vbKey}:geom:${attachments.join(\",\")}:${emitColor ? \"c\" : \"\"}`\n );\n\n const hasIbl = (sceneFeatures & PBR_HAS_ENV) !== 0;\n\n // ── Post-process the fragment WGSL ────────────────────────────────────\n\n // 1) Swap the entry signature.\n const fragmentSignatureFrom = \"-> @location(0) vec4<f32>\";\n const fragmentSignatureTo = \"-> FragmentOutput\";\n if (!base._fragmentWGSL.includes(fragmentSignatureFrom)) {\n throw new Error(\"composePbrGeometryShader: PBR fragment signature mismatch — _noColorOutput/_esmShadowOutput should be off\");\n }\n let frag = base._fragmentWGSL.replace(fragmentSignatureFrom, fragmentSignatureTo);\n\n // 2) Inject FragmentOutput struct before `@fragment fn main`. When\n // `emitColor` is true, append an extra slot at @location(N) for the\n // real lit colour (matches BJS `targetTexture`).\n const colorSlot = attachments.length;\n const extraColorLine = emitColor ? `\\n@location(${colorSlot}) color: vec4<f32>,` : \"\";\n const outputStruct = `struct FragmentOutput {\n${attachments.map((_, i) => `@location(${i}) f${i}: vec4<f32>,`).join(\"\\n\")}${extraColorLine}\n};\n`;\n frag = frag.replace(\"@fragment fn main\", `${outputStruct}@fragment fn main`);\n\n // 3) Replace the alpha-block return with MRT writes. With ALPHA_BLEND\n // stripped, the template emits the simpler return form.\n const wg = `select(0.0, 1.0, alpha > 0.4)`;\n const writes = attachments.map((type, i) => `out.f${i} = ${attachmentExpr(type, wg, hasIbl)};`).join(\"\\n\");\n const extraColorWrite = emitColor ? `\\nout.color = vec4<f32>(color, alpha * material.materialAlpha);` : \"\";\n const replacement = `var out: FragmentOutput;\n${writes}${extraColorWrite}\nreturn out;`;\n const returnPattern = \"return vec4<f32>(color,alpha*material.materialAlpha);\";\n if (!frag.includes(returnPattern)) {\n throw new Error(\"composePbrGeometryShader: alpha-block return statement not found — template changed?\");\n }\n frag = frag.replace(returnPattern, replacement);\n\n return { ...base, _fragmentWGSL: frag };\n}\n","/** PBR geometry-MRT renderable factory.\n *\n * Builds a {@link Renderable} that draws a single mesh through a\n * {@link createPbrGeometryMaterialView} into the geometry renderer task's\n * multi-attachment render target. Mirrors the regular PBR per-mesh\n * rebuildSingle closure (mesh UBO, material UBO, mesh bind group with env +\n * shadows, draw closure) but swaps the single-target pipeline for a\n * multi-color-attachment one built from the geometry-output shader.\n *\n * Per-(view, mesh-feature-variant) shared state — composed shader, mesh\n * BGL, pipeline cache — is cached on `view._geometry` keyed by the\n * shader-relevant mesh-feature bits + (features, features2, sceneFeatures,\n * lightMode, singleLightType). Per-mesh state (UBOs, bind group, sort\n * centre) lives in the closure returned by {@link buildPbrGeometryRenderable}.\n *\n * This module is imported only by {@link createPbrGeometryMaterialView} —\n * PBR scenes that don't use the geometry renderer task pay zero bytes for\n * it. */\n\nimport { F32 } from \"../../engine/typed-arrays.js\";\nimport type { EngineContext } from \"../../engine/engine.js\";\nimport type { RenderTargetSignature } from \"../../engine/render-target.js\";\nimport type { Mesh } from \"../../mesh/mesh.js\";\nimport type { MeshGroupBuilder, Renderable } from \"../../render/renderable.js\";\nimport { writeMeshLightSelection } from \"../../render/lights-ubo.js\";\nimport type { SceneContext } from \"../../scene/scene-core.js\";\nimport { createUniformBuffer } from \"../../resource/gpu-buffers.js\";\nimport { acquireTexture, releaseTexture } from \"../../resource/gpu-pool.js\";\nimport type { ComposedShader } from \"../../shader/fragment-types.js\";\nimport { targetSignatureKey, REVERSE_DEPTH_COMPARE } from \"../../engine/render-target.js\";\nimport { packMat4IntoF32 } from \"../../math/pack-mat4-into-f32.js\";\nimport { _computeMeshFeatures, MSH_HAS_INSTANCE_COLOR, MSH_HAS_THIN_INSTANCES, MSH_HAS_TANGENTS, MSH_HAS_UV2, MSH_HAS_VERTEX_COLOR } from \"../mesh-features.js\";\nimport type { Material } from \"../material.js\";\nimport { getSceneBindGroupLayout } from \"../../render/scene-helpers.js\";\n\nimport type { PbrMaterialProps } from \"./pbr-material.js\";\nimport { collectPbrBoundTextures } from \"./pbr-material.js\";\nimport { _computePbrMaterialFeatures } from \"./pbr-material.js\";\nimport { PBR_HAS_ALPHA_BLEND, PBR_HAS_DOUBLE_SIDED, PBR_HAS_NORMAL_MAP, PBR2_HAS_UV2 } from \"./pbr-flags.js\";\nimport { createPbrMeshBindGroup } from \"./pbr-pipeline.js\";\nimport type { _PbrGeometryContext } from \"./pbr-renderable.js\";\nimport { _writeMaterialData } from \"./pbr-renderable.js\";\nimport type { PbrGeometryMaterialView } from \"./pbr-geometry-view.js\";\nimport { composePbrGeometryShader, _ensurePbrGeometryExt } from \"./pbr-geometry-output-shader.js\";\nimport { _setActivePbrGeometryAttachments } from \"./pbr-geometry-view.js\";\n\n/** Singleton {@link MeshGroupBuilder} that geometry views point at via their\n * overridden `_buildGroup`. The async builder body is unreachable —\n * geometry views are dispatched per-mesh via `_rebuildSingle` directly. */\nexport const pbrGeometryGroupBuilder: MeshGroupBuilder = (async () => {\n throw new Error(\"pbr-geometry view does not support scene group building\");\n}) as MeshGroupBuilder;\npbrGeometryGroupBuilder._rebuildSingle = (scene: SceneContext, mesh: Mesh, materialOverride?: Material): Renderable => {\n const view = (materialOverride ?? mesh.material) as PbrGeometryMaterialView;\n return buildPbrGeometryRenderable(scene, mesh, view);\n};\npbrGeometryGroupBuilder._materialFamily = \"pbr\";\n\ninterface PbrGeometryViewResources {\n _composed: ComposedShader;\n _features: number;\n _features2: number;\n _meshFeatures: number;\n _sceneFeatures: number;\n _meshBGL: GPUBindGroupLayout;\n _shadowBGL: GPUBindGroupLayout | null;\n _pipelineLayout: GPUPipelineLayout;\n _vertModule: GPUShaderModule;\n _fragModule: GPUShaderModule;\n _pipelines: Map<string, GPURenderPipeline>;\n _alphaBlend: boolean;\n}\n\nfunction _variantKey(meshFeatures: number, lightMode: number, singleLightType: string): string {\n return `${meshFeatures}:${lightMode}:${singleLightType}`;\n}\n\n/** Build a {@link Renderable} for one mesh drawn through a PBR geometry view. */\nexport function buildPbrGeometryRenderable(scene: SceneContext, mesh: Mesh, view: PbrGeometryMaterialView): Renderable {\n const engine = scene.surface.engine;\n const device = engine._device;\n\n const ctx = (scene as SceneContext & { _pbrGeomContext?: _PbrGeometryContext })._pbrGeomContext;\n if (!ctx) {\n throw new Error(\"buildPbrGeometryRenderable: scene has no PBR context. Ensure regular PBR meshes have been built before recording the geometry task.\");\n }\n\n const source = view.source as PbrMaterialProps;\n if (!source._renderFeatures) {\n source._renderFeatures = _computePbrMaterialFeatures(source);\n }\n\n // Light selection mirrors regular PBR rebuildSingle, gated by the same\n // shadow rules so the geometry-pass real-color attachment receives the\n // same lighting as the regular PBR pass would have produced.\n const lr = writeMeshLightSelection(mesh, scene.lights);\n const lightCount = lr > 0 ? 1 : -lr;\n const hasSomeShadows = ctx._shadowLights.length > 0;\n const receiveShadows = mesh.receiveShadows && hasSomeShadows;\n const lightMode: 0 | 1 | 2 = lightCount === 0 ? 0 : lightCount === 1 && !receiveShadows ? 1 : 2;\n const singleLightType = lightMode === 1 ? _getPackedSingleLightType(scene.lights, lr - 1) : \"\";\n const meshFeatures = _computeMeshFeatures(mesh, receiveShadows);\n\n const variantKey = _variantKey(meshFeatures, lightMode, singleLightType);\n const res = _ensureViewResources(view, engine, ctx, meshFeatures, lightMode, singleLightType, variantKey);\n\n const features = res._features;\n const features2 = res._features2;\n const composed = res._composed;\n\n // ── Mesh UBO ───────────────────────────────────────────────────────\n const meshUboData = new F32(composed._meshUboSpec._totalBytes / 4);\n const _packMeshWorld = engine._makePackMeshWorld?.(scene) ?? packMat4IntoF32;\n _packMeshWorld(meshUboData, mesh.worldMatrix, 0, 0);\n writeMeshLightSelection(mesh, scene.lights, meshUboData);\n const meshUBO = createUniformBuffer(engine, meshUboData);\n\n // ── Material UBO ───────────────────────────────────────────────────\n const materialSpec = composed._materialUboSpec!;\n const matInitData = new F32(materialSpec._totalBytes / 4);\n // Use the per-scene writer captured on the geometry context.\n _writePbrMaterialData(matInitData, source, materialSpec);\n const materialUBO = createUniformBuffer(engine, matInitData);\n\n // ── Mesh bind group (group 1). Pass the VIEW as the \"material\" so the\n // PBR geometry ext can read `view._gpUBO`. The view inherits all\n // source fields via its prototype chain, so other ext bind callbacks\n // that look at source.* still resolve correctly.\n //\n // Bind during a scope where `_activeAttachments` is set so that any\n // composePbr cache miss inside `createPbrMeshBindGroup` (none expected\n // here, but defensive) sees the right attachments.\n const prev = _setActivePbrGeometryAttachments(view._geometryAttachments);\n let materialBindGroupStatic: GPUBindGroup;\n try {\n materialBindGroupStatic = createPbrMeshBindGroup(engine, _wrapBindings(res), composed, meshUBO, materialUBO, view as unknown as PbrMaterialProps, ctx._envTextures, mesh);\n } finally {\n _setActivePbrGeometryAttachments(prev);\n }\n\n // ── Shadow bind group (group 2) ────────────────────────────────────\n let shadowBindGroup: GPUBindGroup | null = null;\n if (receiveShadows && res._shadowBGL) {\n const entries: GPUBindGroupEntry[] = [];\n let b = 0;\n for (const sl of ctx._shadowLights) {\n const sg = sl.gen;\n entries.push({ binding: b++, resource: sg._depthTexture.createView() });\n entries.push({ binding: b++, resource: sg._depthSampler });\n entries.push({ binding: b++, resource: { buffer: sg._shadowUBO } });\n }\n shadowBindGroup = device.createBindGroup({ layout: res._shadowBGL, entries });\n }\n\n // ── Texture acquire/release lifecycle ──────────────────────────────\n const boundTextures = collectPbrBoundTextures(source);\n for (const t of boundTextures) {\n acquireTexture(t);\n }\n const prevDisposables = scene._meshDisposables.get(mesh) ?? [];\n scene._meshDisposables.set(mesh, [\n ...prevDisposables,\n () => {\n meshUBO.destroy();\n materialUBO.destroy();\n },\n () => {\n for (const t of boundTextures) {\n releaseTexture(t);\n }\n },\n ]);\n\n const hasNormalMap = (features & PBR_HAS_NORMAL_MAP) !== 0 && (meshFeatures & MSH_HAS_TANGENTS) !== 0;\n const hasUV2 = (features2 & PBR2_HAS_UV2) !== 0 && (meshFeatures & MSH_HAS_UV2) !== 0;\n const hasVertexColor = (meshFeatures & MSH_HAS_VERTEX_COLOR) !== 0;\n const hasTI = (meshFeatures & MSH_HAS_THIN_INSTANCES) !== 0;\n const hasTIColor = (meshFeatures & MSH_HAS_INSTANCE_COLOR) !== 0;\n const syncThinInstanceBuffers = ctx._syncThinInstanceBuffers;\n const isAlphaBlend = res._alphaBlend;\n const sortCenter = [mesh.worldMatrix[12]!, mesh.worldMatrix[13]!, mesh.worldMatrix[14]!] as [number, number, number];\n\n let _lastWorldVersion = mesh.worldMatrixVersion;\n let _lastLightsCount = scene.lights.length;\n let _lastUboVersion = source._uboVersion;\n const matScratch = new F32(materialSpec._totalBytes / 4);\n\n const _baseUpdate = (): void => {\n if (mesh.worldMatrixVersion !== _lastWorldVersion || scene.lights.length !== _lastLightsCount) {\n sortCenter[0] = mesh.worldMatrix[12]!;\n sortCenter[1] = mesh.worldMatrix[13]!;\n sortCenter[2] = mesh.worldMatrix[14]!;\n _packMeshWorld(meshUboData, mesh.worldMatrix, 0, 0);\n writeMeshLightSelection(mesh, scene.lights, meshUboData);\n device.queue.writeBuffer(meshUBO, 0, meshUboData as Float32Array<ArrayBuffer>);\n _lastWorldVersion = mesh.worldMatrixVersion;\n _lastLightsCount = scene.lights.length;\n }\n if (source._uboVersion !== _lastUboVersion) {\n _lastUboVersion = source._uboVersion;\n matScratch.fill(0);\n _writePbrMaterialData(matScratch, source, materialSpec);\n device.queue.writeBuffer(materialUBO, 0, matScratch.buffer, 0, matScratch.byteLength);\n }\n };\n const _invalidate = (): void => {\n _lastWorldVersion = -1;\n };\n const update = engine._wrapRenderableForFO?.(_baseUpdate, scene, _invalidate) ?? _baseUpdate;\n\n const draw = (pass: GPURenderPassEncoder | GPURenderBundleEncoder): number => {\n if (mesh.visible === false) {\n return 0;\n }\n const gpu = mesh._gpu;\n pass.setBindGroup(1, materialBindGroupStatic);\n if (shadowBindGroup) {\n pass.setBindGroup(2, shadowBindGroup);\n }\n let slot = 0;\n const vb = gpu._vbLayout;\n pass.setVertexBuffer(slot++, gpu.positionBuffer, vb?._p?._offset);\n pass.setVertexBuffer(slot++, gpu.normalBuffer, vb?._n?._offset);\n if (hasNormalMap && gpu.tangentBuffer) {\n pass.setVertexBuffer(slot++, gpu.tangentBuffer, vb?._t?._offset);\n }\n pass.setVertexBuffer(slot++, gpu.uvBuffer, vb?._u?._offset);\n if (hasUV2 && gpu.uv2Buffer) {\n pass.setVertexBuffer(slot++, gpu.uv2Buffer, vb?._u2?._offset);\n }\n if (hasVertexColor && gpu.colorBuffer) {\n pass.setVertexBuffer(slot++, gpu.colorBuffer, vb?._c?._offset);\n }\n // Skinning vertex buffers: live skeleton OR baked VAT (same field names, mutually exclusive).\n // Mirrors the main PBR renderable — without the VAT branch, VAT-animated thin instances leave the\n // pipeline's joint/weight vertex slots unbound (invalid command buffer, black frame).\n const skin = mesh.skeleton ?? mesh.vat;\n if (skin) {\n pass.setVertexBuffer(slot++, skin.jointsBuffer);\n pass.setVertexBuffer(slot++, skin.weightsBuffer);\n if (skin.joints1Buffer && skin.weights1Buffer) {\n pass.setVertexBuffer(slot++, skin.joints1Buffer);\n pass.setVertexBuffer(slot++, skin.weights1Buffer);\n }\n }\n const ti = hasTI ? mesh.thinInstances : null;\n if (ti && syncThinInstanceBuffers) {\n slot = syncThinInstanceBuffers(engine, ti, pass, slot, hasTIColor);\n }\n pass.setIndexBuffer(gpu.indexBuffer, gpu.indexFormat);\n if (ti && ti.count > 0) {\n pass.drawIndexed(gpu.indexCount, ti.count);\n } else {\n pass.drawIndexed(gpu.indexCount);\n }\n return 1;\n };\n\n const r: Renderable = {\n order: mesh.renderOrder ?? (isAlphaBlend ? 200 : 100),\n isTransparent: isAlphaBlend,\n mesh,\n bind(eng: EngineContext, sig: RenderTargetSignature) {\n return {\n renderable: r,\n pipeline: _getOrCreateGeometryPipeline(eng as EngineContext, sig, view, res),\n update,\n draw,\n };\n },\n };\n r._worldCenter = sortCenter;\n return r;\n}\n\n// ─── Shared per-view resources ─────────────────────────────────────────\n\nfunction _ensureViewResources(\n view: PbrGeometryMaterialView,\n engine: EngineContext,\n ctx: _PbrGeometryContext,\n meshFeatures: number,\n lightMode: 0 | 1 | 2,\n singleLightType: string,\n variantKey: string\n): PbrGeometryViewResources {\n let cache = view._geometry as Map<string, PbrGeometryViewResources> | undefined;\n if (!cache) {\n cache = new Map();\n Object.defineProperty(view, \"_geometry\", { value: cache, enumerable: false, configurable: true });\n }\n const cached = cache.get(variantKey);\n if (cached) {\n return cached;\n }\n // Ensure the PBR geometry ext is registered (idempotent) before composePbr is called.\n _ensurePbrGeometryExt(() => view._geometryAttachments);\n\n const features = view._renderFeatures.features;\n const features2 = view._renderFeatures.features2 ?? 0;\n const sceneFeatures = ctx._sceneFeatures;\n const source = view.source as PbrMaterialProps;\n const vbLayout = (source as unknown as { _vbLayout?: import(\"../../mesh/mesh.js\").MeshVbLayout })._vbLayout;\n const vbKey = \"\";\n\n // Compose with the active-attachment scope set so the registered ext\n // sees the right list when contributing the geometry-params fragment.\n const prev = _setActivePbrGeometryAttachments(view._geometryAttachments);\n let composed: ComposedShader;\n try {\n composed = composePbrGeometryShader(\n ctx._composePbr,\n features,\n features2,\n meshFeatures,\n sceneFeatures,\n lightMode,\n singleLightType,\n \"\",\n vbLayout,\n vbKey,\n view._geometryAttachments,\n view._emitColor\n );\n } finally {\n _setActivePbrGeometryAttachments(prev);\n }\n\n const device = engine._device;\n const meshBGL = device.createBindGroupLayout(composed._meshBGLDescriptor);\n const shadowBGL = composed._shadowBGLDescriptor ? device.createBindGroupLayout(composed._shadowBGLDescriptor) : null;\n const sceneBGL = (engine as unknown as { _getSceneBGL: () => GPUBindGroupLayout })._getSceneBGL?.() ?? _getSceneBindGroupLayoutLocal(engine, composed);\n const bgls: GPUBindGroupLayout[] = shadowBGL ? [sceneBGL, meshBGL, shadowBGL] : [sceneBGL, meshBGL];\n const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: bgls });\n const vertModule = device.createShaderModule({ code: composed._vertexWGSL });\n const fragModule = device.createShaderModule({ code: composed._fragmentWGSL });\n\n // The view's features have PBR_HAS_ALPHA_BLEND already stripped. Detect\n // alpha-blend from the SOURCE so transparent meshes get the right blend\n // pipeline state below.\n const sourceFeatures = source._renderFeatures?.features ?? 0;\n const alphaBlend = (sourceFeatures & PBR_HAS_ALPHA_BLEND) !== 0;\n\n const res: PbrGeometryViewResources = {\n _composed: composed,\n _features: features,\n _features2: features2,\n _meshFeatures: meshFeatures,\n _sceneFeatures: sceneFeatures,\n _meshBGL: meshBGL,\n _shadowBGL: shadowBGL,\n _pipelineLayout: pipelineLayout,\n _vertModule: vertModule,\n _fragModule: fragModule,\n _pipelines: new Map(),\n _alphaBlend: alphaBlend,\n };\n cache.set(variantKey, res);\n return res;\n}\n\n/** Adapter so `createPbrMeshBindGroup` (which takes `_PbrShaderBindings`) can\n * consume our view resources. Only the fields it touches matter. */\nfunction _wrapBindings(res: PbrGeometryViewResources): Parameters<typeof createPbrMeshBindGroup>[1] {\n return {\n _features: res._features,\n _features2: res._features2,\n _meshFeatures: res._meshFeatures,\n _meshBGL: res._meshBGL,\n _shadowBGL: res._shadowBGL,\n _composed: res._composed,\n _pipelines: res._pipelines,\n } as Parameters<typeof createPbrMeshBindGroup>[1];\n}\n\n/** Local fallback used when the engine does not expose a centralised scene BGL\n * cache helper. Matches the layout produced by `getSceneBindGroupLayout`. */\nfunction _getSceneBindGroupLayoutLocal(engine: EngineContext, _composed: ComposedShader): GPUBindGroupLayout {\n return getSceneBindGroupLayout(engine);\n}\n\nfunction _getOrCreateGeometryPipeline(engine: EngineContext, sig: RenderTargetSignature, view: PbrGeometryMaterialView, res: PbrGeometryViewResources): GPURenderPipeline {\n const key = targetSignatureKey(sig);\n const cached = res._pipelines.get(key);\n if (cached) {\n return cached;\n }\n const device = engine._device;\n const formats = (sig as RenderTargetSignature & { _colorFormats?: readonly GPUTextureFormat[] })._colorFormats ?? (sig._colorFormat ? [sig._colorFormat] : []);\n if (formats.length === 0) {\n throw new Error(\"pbr-geometry: render target has no color attachments\");\n }\n const alphaBlend = res._alphaBlend;\n const blendState: GPUBlendState | undefined = alphaBlend\n ? {\n color: { srcFactor: \"src-alpha\", dstFactor: \"one-minus-src-alpha\", operation: \"add\" },\n alpha: { srcFactor: \"src-alpha\", dstFactor: \"one-minus-src-alpha\", operation: \"add\" },\n }\n : undefined;\n const colorTargets: GPUColorTargetState[] = formats.map((fmt) => (blendState ? { format: fmt, blend: blendState } : { format: fmt }));\n const sourceFeatures = (view.source as PbrMaterialProps)._renderFeatures?.features ?? 0;\n const hasDoubleSided = (sourceFeatures & PBR_HAS_DOUBLE_SIDED) !== 0;\n const cullMode = hasDoubleSided ? \"none\" : view._reverseCulling ? \"front\" : \"back\";\n const pipeline = device.createRenderPipeline({\n layout: res._pipelineLayout,\n vertex: { module: res._vertModule, entryPoint: \"main\", buffers: res._composed._vertexBufferLayouts },\n fragment: { module: res._fragModule, entryPoint: \"main\", targets: colorTargets },\n depthStencil: sig._depthStencilFormat\n ? {\n format: sig._depthStencilFormat,\n depthCompare: sig._depthCompare ?? REVERSE_DEPTH_COMPARE,\n // Disable depth-write for alpha-blended meshes so background\n // depth survives partially-transparent pixels. Matches the\n // Standard geometry-renderable behaviour.\n depthWriteEnabled: !alphaBlend,\n }\n : undefined,\n multisample: { count: sig._sampleCount },\n primitive: { topology: \"triangle-list\", cullMode, frontFace: \"ccw\" },\n });\n res._pipelines.set(key, pipeline);\n return pipeline;\n}\n\n// ─── Helpers cribbed from pbr-renderable (no static cycle) ─────────────\n\nfunction _getPackedSingleLightType(lights: SceneContext[\"lights\"], packedIndex: number): \"hemispheric\" | \"directional\" | \"spot\" | \"point\" {\n let packed = 0;\n for (const light of lights) {\n if (!light._writeLightUbo) {\n continue;\n }\n if (packed === packedIndex) {\n const t = light.lightType;\n return t === \"hemispheric\" || t === \"directional\" || t === \"spot\" ? t : \"point\";\n }\n packed++;\n }\n return \"point\";\n}\n\n/** Writes material UBO via the helper exported from pbr-renderable. */\nfunction _writePbrMaterialData(data: Float32Array, mat: PbrMaterialProps, spec: import(\"../../shader/fragment-types.js\").UboSpec): void {\n _writeMaterialData(data, mat, spec);\n}\n","/** PBR material view helper that targets geometry-rendering MRT output.\n *\n * The geometry renderer task wraps each PBR caster material in a\n * `PbrGeometryMaterialView`. The view carries the per-task attachment\n * list, target-texture intent, optional `gp` UBO (shared across the task's\n * materials), and reverse-culling flag. The view also shadows\n * {@link Material._buildGroup} with {@link pbrGeometryGroupBuilder} so that\n * the geometry renderer task materialises a {@link Renderable} through the\n * PBR geometry renderable infrastructure — no view-aware branching needed\n * in core render-task.\n *\n * The geometry-output WGSL itself is produced by post-processing the regular\n * per-scene composed PBR shader (reused via the `_pbrGeomContext` stash) in\n * `./pbr-geometry-output-shader.ts`. */\n\nimport { createMaterialView } from \"../material-view.js\";\nimport type { MaterialView } from \"../material.js\";\nimport type { GeometryTextureType } from \"../../frame-graph/geometry-types.js\";\nimport { PBR_HAS_ALPHA_BLEND, PBR2_GEOMETRY_OUTPUT } from \"./pbr-flags.js\";\nimport type { PbrMaterialProps } from \"./pbr-material.js\";\nimport { pbrGeometryGroupBuilder } from \"./pbr-geometry-renderable.js\";\nimport { _ensurePbrGeometryExt } from \"./pbr-geometry-output-shader.js\";\n\n/** Per-task ordered attachment list driving the geometry template. The array\n * index is the MRT color-attachment slot used in `@location(i)`. */\nexport type PbrGeometryAttachments = readonly GeometryTextureType[];\n\n/** Per-(task, material) PBR geometry view configuration. All fields are owned\n * by the geometry renderer task; the view captures them so per-mesh renderables\n * pick up the same pipeline state and bindings. */\nexport interface PbrGeometryViewConfig {\n /** Ordered MRT attachment list — index = `@location(i)`. */\n readonly attachments: PbrGeometryAttachments;\n /** When true, the composed fragment emits the real (lit) material color\n * at `@location(N)` (N = attachments.length). The target texture is\n * added to the pipeline color-target list at the same slot. */\n readonly emitColor: boolean;\n /** Per-task previous-VP + camera-near-far UBO. Required when\n * {@link attachments} contains `NORMALIZED_VIEW_DEPTH` or\n * `LINEAR_VELOCITY`; ignored otherwise. */\n readonly gpUBO?: GPUBuffer | null;\n /** Flip culling direction. */\n readonly reverseCulling?: boolean;\n}\n\n/** PBR material view that emits geometry textures instead of shaded colour. */\nexport interface PbrGeometryMaterialView extends MaterialView {\n /** @internal Ordered MRT attachment list — index = `@location(i)`. */\n readonly _geometryAttachments: PbrGeometryAttachments;\n /** @internal Geometry pipeline carries an extra `@location(N)` color attachment. */\n readonly _emitColor: boolean;\n /** @internal Optional per-task geometry-params UBO shared with the composer's\n * `geometry-params` fragment. */\n readonly _gpUBO: GPUBuffer | null;\n /** @internal */\n readonly _reverseCulling: boolean;\n /** @internal Shared per-view resources cache populated lazily by the renderable\n * factory. Opaque to callers. */\n _geometry?: unknown;\n}\n\n// Snapshot of the currently-building view's attachments so the registered\n// PBR geometry extension can read them from `frag(ctx)`. The extension is\n// invoked synchronously during composePbr inside `buildPbrGeometryRenderable`;\n// the snapshot is set right before that call and cleared after.\nlet _activeAttachments: readonly GeometryTextureType[] | undefined;\n\n/** @internal Used by the geometry renderable to scope attachment access for\n * the PBR ext during a composePbr call. Returns the previous value so the\n * caller can restore it (avoids global leakage in nested scenarios). */\nexport function _setActivePbrGeometryAttachments(att: readonly GeometryTextureType[] | undefined): readonly GeometryTextureType[] | undefined {\n const prev = _activeAttachments;\n _activeAttachments = att;\n return prev;\n}\n\n/** Wrap a PBR material as a geometry-output view.\n * - Sets the `PBR2_GEOMETRY_OUTPUT` features2 bit.\n * - Clears `PBR_HAS_ALPHA_BLEND`: the geometry pipeline drives blending per\n * attachment via the pipeline color-target state, not via the PBR\n * fragment's source-over color output.\n * - Shadows `_buildGroup` with {@link pbrGeometryGroupBuilder} so the\n * natural `material._buildGroup._rebuildSingle` dispatch in\n * `resolvePendingMeshes` builds a geometry-MRT renderable for this view.\n * - Registers the PBR geometry extension (idempotent) so subsequent\n * composePbr calls pick up the `gp` UBO + geometry varyings when\n * `PBR2_GEOMETRY_OUTPUT` is set. */\nexport function createPbrGeometryMaterialView(source: PbrMaterialProps, config: PbrGeometryViewConfig): PbrGeometryMaterialView {\n _ensurePbrGeometryExt(() => _activeAttachments);\n const baseFeatures = source._renderFeatures?.features ?? 0;\n const baseFeatures2 = source._renderFeatures?.features2 ?? 0;\n const view = createMaterialView(source, {\n features: baseFeatures & ~PBR_HAS_ALPHA_BLEND,\n features2: baseFeatures2 | PBR2_GEOMETRY_OUTPUT,\n }) as PbrGeometryMaterialView;\n Object.defineProperty(view, \"_geometryAttachments\", { value: config.attachments, enumerable: false });\n Object.defineProperty(view, \"_emitColor\", { value: config.emitColor, enumerable: false });\n Object.defineProperty(view, \"_gpUBO\", { value: config.gpUBO ?? null, enumerable: false });\n Object.defineProperty(view, \"_reverseCulling\", { value: config.reverseCulling ?? false, enumerable: false });\n Object.defineProperty(view, \"_buildGroup\", { value: pbrGeometryGroupBuilder, enumerable: false });\n return view;\n}\n"],"names":["_a","_b"],"mappings":";;AAiCA,MAAM,iBAAiB;AACvB,MAAM,eAAe;AAIrB,SAAS,WAAW,aAAsD;AACtE,aAAW,KAAK,aAAa;AACzB,QAAI,MAAM,oBAAoB,yBAAyB,MAAM,oBAAoB,iBAAiB;AAC9F,aAAO;AAAA,IACX;AAAA,EACJ;AACA,SAAO;AACX;AAEA,SAAS,cAAc,aAAsD;AACzE,SAAO,YAAY,SAAS,oBAAoB,eAAe;AACnE;AAEA,SAAS,cAAc,aAAsD;AACzE,SAAO,YAAY,SAAS,oBAAoB,cAAc;AAClE;AAIA,SAAS,gCAAgC,gBAAyB,uBAAgC,sBAA+C;AAC7I,QAAM,WAAW,iBAAiB,CAAC,EAAE,OAAO,MAAM,OAAO,EAAE,OAAO,iBAAA,GAA6B,aAAa,iBAAiB,aAAA,CAAc,IAAI,CAAA;AAC/I,QAAM,UAAU,iBAAiB,0FAA0F;AAC3H,QAAM,WAAsB,CAAA;AAC5B,MAAI,uBAAuB;AACvB,aAAS,KAAK,EAAE,OAAO,gBAAgB,OAAO,YAAA,GAAe,EAAE,OAAO,iBAAiB,OAAO,YAAA,CAAa;AAAA,EAC/G;AACA,MAAI,sBAAsB;AACtB,aAAS,KAAK,EAAE,OAAO,aAAa,OAAO,aAAa;AAAA,EAC5D;AACA,QAAM,UAAoB,CAAA;AAC1B,MAAI,uBAAuB;AACvB,YAAQ,KAAK,yEAAyE;AACtF,YAAQ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AC5H,wBAAsB,MAAM,kBAAkB;AAC9C,QAAM,iBAAe,YAAO,oBAAP,mBAAwB,aAAY;AACzD,QAAM,kBAAgB,YAAO,oBAAP,mBAAwB,cAAa;AAC3D,QAAM,OAAO,mBAAmB,QAAQ;AAAA,IACpC,UAAU,eAAe,CAAC;AAAA,IAC1B,WAAW,gBAAgB;AAAA,EAAA,CAC9B;AACD,SAAO,eAAe,MAAM,wBAAwB,EAAE,OAAO,OAAO,aAAa,YAAY,OAAO;AACpG,SAAO,eAAe,MAAM,cAAc,EAAE,OAAO,OAAO,WAAW,YAAY,OAAO;AACxF,SAAO,eAAe,MAAM,UAAU,EAAE,OAAO,OAAO,SAAS,MAAM,YAAY,MAAA,CAAO;AACxF,SAAO,eAAe,MAAM,mBAAmB,EAAE,OAAO,OAAO,kBAAkB,OAAO,YAAY,MAAA,CAAO;AAC3G,SAAO,eAAe,MAAM,eAAe,EAAE,OAAO,yBAAyB,YAAY,OAAO;AAChG,SAAO;AACX;"}
1
+ {"version":3,"file":"pbr-geometry-view-Dthf9Aut.js","sources":["../src/material/pbr/pbr-geometry-output-shader.ts","../src/material/pbr/pbr-geometry-renderable.ts","../src/material/pbr/pbr-geometry-view.ts"],"sourcesContent":["/** PBR geometry-output shader composer.\n *\n * Builds the WGSL for a {@link createPbrGeometryMaterialView}-wrapped PBR\n * material that targets the geometry-renderer MRT pass.\n *\n * Design — *zero bundle impact* on PBR scenes that never load the\n * geometry-renderer task:\n *\n * 1. Reuse the per-scene {@link composePbr} captured on the scene context.\n * The composer already wires every PBR feature (IBL, shadows, lights,\n * clearcoat, sheen, iridescence, anisotropy, subsurface, alpha-test,\n * emissive, tonemap, …); none of it needs re-implementing for the\n * real-colour attachment.\n * 2. Register a PBR extension that, only when `PBR2_GEOMETRY_OUTPUT` is on,\n * contributes a small `geometry-params` ShaderFragment carrying the\n * `gp` UBO + per-attachment varyings (vCurrentClip / vPreviousClip /\n * vLocalPos). Off otherwise — no impact on regular PBR composes.\n * 3. Post-process the composed fragment WGSL: change the entry signature\n * to return a `FragmentOutput` MRT struct, inject the struct\n * declaration, and replace the alpha-block `return …` with code that\n * writes each requested geometry attachment from the in-scope PBR\n * intermediates (`N`, `surfaceAlbedo`, `colorF0`, `roughness`,\n * `microSurface`, `finalIrradiance`, `input.worldPos`, …).\n *\n * The lighting / tonemap / gamma pipeline still runs in full, producing\n * the lit `color` written to the optional real-colour attachment. */\n\nimport type { ComposedShader, ShaderFragment, Varying } from \"../../shader/fragment-types.js\";\nimport { GeometryTextureType } from \"../../frame-graph/geometry-types.js\";\nimport { PBR_HAS_ALPHA_BLEND, PBR_HAS_ENV, PBR2_GEOMETRY_OUTPUT, _registerPbrExt, type _PbrBindCtx, type _PbrFragCtx, type PbrExt } from \"./pbr-flags.js\";\nimport type { createPbrComposer, PbrLightMode } from \"./pbr-compose.js\";\nimport type { MeshVbLayout } from \"../../mesh/mesh.js\";\n\nconst STAGE_FRAGMENT = 0x2;\nconst STAGE_VERTEX = 0x1;\n\n// ─── PBR extension contributing the geometry-params fragment ──────────\n\nfunction needsGpUbo(attachments: readonly GeometryTextureType[]): boolean {\n for (const t of attachments) {\n if (t === GeometryTextureType.NORMALIZED_VIEW_DEPTH || t === GeometryTextureType.LINEAR_VELOCITY) {\n return true;\n }\n }\n return false;\n}\n\nfunction needsVelocity(attachments: readonly GeometryTextureType[]): boolean {\n return attachments.includes(GeometryTextureType.LINEAR_VELOCITY);\n}\n\nfunction needsLocalPos(attachments: readonly GeometryTextureType[]): boolean {\n return attachments.includes(GeometryTextureType.LOCAL_POSITION);\n}\n\n/** ShaderFragment contributing the `gp` UBO + (optionally) velocity / local-pos varyings.\n * PBR-specific: world-position varying is `out.worldPos`. */\nfunction createPbrGeometryParamsFragment(needsParamsUbo: boolean, needsVelocityVaryings: boolean, needsLocalPosVarying: boolean): ShaderFragment {\n const bindings = needsParamsUbo ? [{ _name: \"gp\", _type: { _kind: \"uniform-buffer\" as const }, _visibility: STAGE_FRAGMENT | STAGE_VERTEX }] : [];\n const helpers = needsParamsUbo ? `struct gpUniforms { previousViewProjection: mat4x4<f32>, cameraNearFar: vec4<f32>, };` : \"\";\n const varyings: Varying[] = [];\n if (needsVelocityVaryings) {\n varyings.push({ _name: \"vCurrentClip\", _type: \"vec4<f32>\" }, { _name: \"vPreviousClip\", _type: \"vec4<f32>\" });\n }\n if (needsLocalPosVarying) {\n varyings.push({ _name: \"vLocalPos\", _type: \"vec3<f32>\" });\n }\n const vbParts: string[] = [];\n if (needsVelocityVaryings) {\n vbParts.push(`out.vCurrentClip = scene.viewProjection * vec4<f32>(out.worldPos, 1.0);`);\n vbParts.push(`out.vPreviousClip = gp.previousViewProjection * vec4<f32>(out.worldPos, 1.0);`);\n }\n if (needsLocalPosVarying) {\n vbParts.push(`out.vLocalPos = position;`);\n }\n const slots: ShaderFragment[\"_vertexSlots\"] = vbParts.length > 0 ? { VB: vbParts.join(\"\\n\") } : {};\n return {\n _id: \"pbr-geometry-params\",\n _bindings: bindings,\n _helperFunctions: helpers,\n _vertexHelperFunctions: helpers,\n _varyings: varyings,\n _vertexSlots: slots,\n };\n}\n\n/** PBR extension that wires the geometry-params fragment + gp UBO bind entry.\n * Off-path for any scene that doesn't request `PBR2_GEOMETRY_OUTPUT`. */\nlet _pbrGeomExtRegistered = false;\n\n/** @internal Registers (idempotent) the PBR extension that wires up the\n * geometry-output `gp` UBO and varyings. Called by the geometry view at\n * first use so non-geometry PBR scenes pay zero bytes. */\nexport function _ensurePbrGeometryExt(getAttachments: () => readonly GeometryTextureType[] | undefined): void {\n if (_pbrGeomExtRegistered) {\n return;\n }\n _pbrGeomExtRegistered = true;\n const ext: PbrExt = {\n id: \"pbr-geometry-params\",\n // Fragment-phase so bind entry is appended after all other PBR exts.\n phase: \"fragment\",\n frag(ctx: _PbrFragCtx): ShaderFragment | null {\n if ((ctx._features2 & PBR2_GEOMETRY_OUTPUT) === 0) {\n return null;\n }\n const att = getAttachments() ?? [];\n const wantsGp = needsGpUbo(att);\n const wantsVelocity = needsVelocity(att);\n const wantsLocalPos = needsLocalPos(att);\n if (!wantsGp && !wantsVelocity && !wantsLocalPos) {\n return null;\n }\n return createPbrGeometryParamsFragment(wantsGp, wantsVelocity, wantsLocalPos);\n },\n bind(ctx: _PbrBindCtx, entries: GPUBindGroupEntry[], b: number): number {\n if ((ctx._features2 & PBR2_GEOMETRY_OUTPUT) === 0) {\n return b;\n }\n const view = ctx._material as { _gpUBO?: GPUBuffer | null };\n if (view._gpUBO) {\n entries.push({ binding: b++, resource: { buffer: view._gpUBO } });\n }\n return b;\n },\n };\n _registerPbrExt(ext);\n}\n\n// ─── Per-attachment WGSL expressions ──────────────────────────────────\n\n/** Per-attachment WGSL output expression. Symbols are resolved against the\n * in-scope PBR fragment vars at the BC slot location (after tonemap +\n * gamma + contrast; same scope as the alpha-block).\n * @internal */\nfunction attachmentExpr(type: GeometryTextureType, wg: string, hasIbl: boolean): string {\n switch (type) {\n case GeometryTextureType.IRRADIANCE:\n // BJS PREPASS_IRRADIANCE (pbrBlockPrePass.fx): `finalDiffuse + finalIrradiance`\n // — direct-light diffuse plus the IBL diffuse contribution (already multiplied\n // by surfaceAlbedo / occlusion), NOT the raw SH irradiance. Lite's equivalents\n // are `directDiffuse` (direct) and `finalIrradiance` (= environmentIrradiance *\n // surfaceAlbedo * occlusion, ibl-fragment.ts). Both are pre-tonemap, matching BJS.\n return hasIbl ? `vec4<f32>(directDiffuse + finalIrradiance, ${wg})` : `vec4<f32>(directDiffuse, ${wg})`;\n case GeometryTextureType.WORLD_POSITION:\n return `vec4<f32>(input.worldPos, ${wg})`;\n case GeometryTextureType.LOCAL_POSITION:\n return `vec4<f32>(input.vLocalPos, ${wg})`;\n case GeometryTextureType.REFLECTIVITY:\n // BJS PREPASS_REFLECTIVITY (pbrBlockPrePass.fx): `vec4(specularEnvironmentR0, microSurface)`\n // — LINEAR F0 reflectance (no gamma) in RGB, microSurface (= 1 - roughness) in A,\n // the whole vec4 masked by writeGeometryInfo. Lite's `colorF0` is the F0 reflectance.\n return `vec4<f32>(colorF0, 1.0 - roughness) * ${wg}`;\n case GeometryTextureType.VIEW_DEPTH:\n return `vec4<f32>((scene.view * vec4<f32>(input.worldPos, 1.0)).z, 0.0, 0.0, ${wg})`;\n case GeometryTextureType.NORMALIZED_VIEW_DEPTH:\n return `vec4<f32>(((scene.view * vec4<f32>(input.worldPos, 1.0)).z - gp.cameraNearFar.x) / (gp.cameraNearFar.y - gp.cameraNearFar.x), 0.0, 0.0, ${wg})`;\n case GeometryTextureType.SCREENSPACE_DEPTH:\n return `vec4<f32>(input.clipPos.z, 0.0, 0.0, ${wg})`;\n case GeometryTextureType.VIEW_NORMAL:\n return `vec4<f32>(normalize((scene.view * vec4<f32>(N, 0.0)).xyz), ${wg})`;\n case GeometryTextureType.WORLD_NORMAL:\n return `vec4<f32>(N * 0.5 + vec3<f32>(0.5), ${wg})`;\n case GeometryTextureType.ALBEDO:\n // BJS uses `surfaceAlbedo` for PBR (post diffuse / metallic split).\n return `vec4<f32>(surfaceAlbedo, ${wg})`;\n case GeometryTextureType.LINEAR_VELOCITY: {\n const cur = `(input.vCurrentClip.xy / input.vCurrentClip.w)`;\n const prev = `(input.vPreviousClip.xy / input.vPreviousClip.w)`;\n return `vec4<f32>(0.5 * (${prev} - ${cur}), 0.0, ${wg})`;\n }\n }\n}\n\n// ─── Composer entry ────────────────────────────────────────────────────\n\n/** Compose a PBR geometry-output shader by reusing the per-scene composer\n * and post-patching the resulting WGSL into MRT form. */\nexport function composePbrGeometryShader(\n composePbr: ReturnType<typeof createPbrComposer>,\n features: number,\n features2: number,\n meshFeatures: number,\n sceneFeatures: number,\n lightMode: PbrLightMode,\n singleLightType: string,\n esmShadowDepthCode: string,\n vbStrides: MeshVbLayout | undefined,\n vbKey: string,\n attachments: readonly GeometryTextureType[],\n emitColor: boolean\n): ComposedShader {\n // Strip PBR_HAS_ALPHA_BLEND: the template's alpha-blend branch returns\n // `finalAlpha = saturate(alpha + luminanceOverAlpha²)` which we don't need\n // — we drive blending per attachment via the geometry pipeline state and\n // gate writes via the `writeGeometryInfo` mask. Stripping yields the\n // simple `return vec4<f32>(color,alpha*material.materialAlpha);` alpha\n // block which is easier to pattern-match for the replacement.\n const geomFeatures = features & ~PBR_HAS_ALPHA_BLEND;\n // Tag the cache key with PBR2_GEOMETRY_OUTPUT so the geometry composed\n // shader doesn't collide with the regular non-geometry one in composePbr's\n // internal cache.\n const geomFeatures2 = features2 | PBR2_GEOMETRY_OUTPUT;\n\n const base = composePbr(\n geomFeatures,\n geomFeatures2,\n meshFeatures,\n sceneFeatures,\n lightMode,\n singleLightType,\n esmShadowDepthCode,\n vbStrides,\n `${vbKey}:geom:${attachments.join(\",\")}:${emitColor ? \"c\" : \"\"}`\n );\n\n const hasIbl = (sceneFeatures & PBR_HAS_ENV) !== 0;\n\n // ── Post-process the fragment WGSL ────────────────────────────────────\n\n // 1) Swap the entry signature.\n const fragmentSignatureFrom = \"-> @location(0) vec4<f32>\";\n const fragmentSignatureTo = \"-> FragmentOutput\";\n if (!base._fragmentWGSL.includes(fragmentSignatureFrom)) {\n throw new Error(\"composePbrGeometryShader: PBR fragment signature mismatch — _noColorOutput/_esmShadowOutput should be off\");\n }\n let frag = base._fragmentWGSL.replace(fragmentSignatureFrom, fragmentSignatureTo);\n\n // 2) Inject FragmentOutput struct before `@fragment fn main`. When\n // `emitColor` is true, append an extra slot at @location(N) for the\n // real lit colour (matches BJS `targetTexture`).\n const colorSlot = attachments.length;\n const extraColorLine = emitColor ? `\\n@location(${colorSlot}) color: vec4<f32>,` : \"\";\n const outputStruct = `struct FragmentOutput {\n${attachments.map((_, i) => `@location(${i}) f${i}: vec4<f32>,`).join(\"\\n\")}${extraColorLine}\n};\n`;\n frag = frag.replace(\"@fragment fn main\", `${outputStruct}@fragment fn main`);\n\n // 3) Replace the alpha-block return with MRT writes. With ALPHA_BLEND\n // stripped, the template emits the simpler return form.\n const wg = `select(0.0, 1.0, alpha > 0.4)`;\n const writes = attachments.map((type, i) => `out.f${i} = ${attachmentExpr(type, wg, hasIbl)};`).join(\"\\n\");\n const extraColorWrite = emitColor ? `\\nout.color = vec4<f32>(color, alpha * material.materialAlpha);` : \"\";\n const replacement = `var out: FragmentOutput;\n${writes}${extraColorWrite}\nreturn out;`;\n const returnPattern = \"return vec4<f32>(color,alpha*material.materialAlpha);\";\n if (!frag.includes(returnPattern)) {\n throw new Error(\"composePbrGeometryShader: alpha-block return statement not found — template changed?\");\n }\n frag = frag.replace(returnPattern, replacement);\n\n return { ...base, _fragmentWGSL: frag };\n}\n","/** PBR geometry-MRT renderable factory.\n *\n * Builds a {@link Renderable} that draws a single mesh through a\n * {@link createPbrGeometryMaterialView} into the geometry renderer task's\n * multi-attachment render target. Mirrors the regular PBR per-mesh\n * rebuildSingle closure (mesh UBO, material UBO, mesh bind group with env +\n * shadows, draw closure) but swaps the single-target pipeline for a\n * multi-color-attachment one built from the geometry-output shader.\n *\n * Per-(view, mesh-feature-variant) shared state — composed shader, mesh\n * BGL, pipeline cache — is cached on `view._geometry` keyed by the\n * shader-relevant mesh-feature bits + (features, features2, sceneFeatures,\n * lightMode, singleLightType). Per-mesh state (UBOs, bind group, sort\n * centre) lives in the closure returned by {@link buildPbrGeometryRenderable}.\n *\n * This module is imported only by {@link createPbrGeometryMaterialView} —\n * PBR scenes that don't use the geometry renderer task pay zero bytes for\n * it. */\n\nimport { F32 } from \"../../engine/typed-arrays.js\";\nimport type { EngineContext } from \"../../engine/engine.js\";\nimport type { RenderTargetSignature } from \"../../engine/render-target.js\";\nimport type { Mesh } from \"../../mesh/mesh.js\";\nimport type { MeshGroupBuilder, Renderable } from \"../../render/renderable.js\";\nimport { writeMeshLightSelection } from \"../../render/lights-ubo.js\";\nimport type { SceneContext } from \"../../scene/scene-core.js\";\nimport { createUniformBuffer } from \"../../resource/gpu-buffers.js\";\nimport { acquireTexture, releaseTexture } from \"../../resource/gpu-pool.js\";\nimport type { ComposedShader } from \"../../shader/fragment-types.js\";\nimport { targetSignatureKey, REVERSE_DEPTH_COMPARE } from \"../../engine/render-target.js\";\nimport { packMat4IntoF32 } from \"../../math/pack-mat4-into-f32.js\";\nimport { _computeMeshFeatures, MSH_HAS_INSTANCE_COLOR, MSH_HAS_THIN_INSTANCES, MSH_HAS_TANGENTS, MSH_HAS_UV2, MSH_HAS_VERTEX_COLOR } from \"../mesh-features.js\";\nimport type { Material } from \"../material.js\";\nimport { getSceneBindGroupLayout } from \"../../render/scene-helpers.js\";\n\nimport type { PbrMaterialProps } from \"./pbr-material.js\";\nimport { collectPbrBoundTextures } from \"./pbr-material.js\";\nimport { _computePbrMaterialFeatures } from \"./pbr-material.js\";\nimport { PBR_HAS_ALPHA_BLEND, PBR_HAS_DOUBLE_SIDED, PBR_HAS_NORMAL_MAP, PBR2_HAS_UV2 } from \"./pbr-flags.js\";\nimport { createPbrMeshBindGroup } from \"./pbr-pipeline.js\";\nimport type { _PbrGeometryContext } from \"./pbr-renderable.js\";\nimport { _writeMaterialData } from \"./pbr-renderable.js\";\nimport type { PbrGeometryMaterialView } from \"./pbr-geometry-view.js\";\nimport { composePbrGeometryShader, _ensurePbrGeometryExt } from \"./pbr-geometry-output-shader.js\";\nimport { _setActivePbrGeometryAttachments } from \"./pbr-geometry-view.js\";\n\n/** Singleton {@link MeshGroupBuilder} that geometry views point at via their\n * overridden `_buildGroup`. The async builder body is unreachable —\n * geometry views are dispatched per-mesh via `_rebuildSingle` directly. */\nexport const pbrGeometryGroupBuilder: MeshGroupBuilder = (async () => {\n throw new Error(\"pbr-geometry view does not support scene group building\");\n}) as MeshGroupBuilder;\npbrGeometryGroupBuilder._rebuildSingle = (scene: SceneContext, mesh: Mesh, materialOverride?: Material): Renderable => {\n const view = (materialOverride ?? mesh.material) as PbrGeometryMaterialView;\n return buildPbrGeometryRenderable(scene, mesh, view);\n};\npbrGeometryGroupBuilder._materialFamily = \"pbr\";\n\ninterface PbrGeometryViewResources {\n _composed: ComposedShader;\n _features: number;\n _features2: number;\n _meshFeatures: number;\n _sceneFeatures: number;\n _meshBGL: GPUBindGroupLayout;\n _shadowBGL: GPUBindGroupLayout | null;\n _pipelineLayout: GPUPipelineLayout;\n _vertModule: GPUShaderModule;\n _fragModule: GPUShaderModule;\n _pipelines: Map<string, GPURenderPipeline>;\n _alphaBlend: boolean;\n}\n\nfunction _variantKey(meshFeatures: number, lightMode: number, singleLightType: string): string {\n return `${meshFeatures}:${lightMode}:${singleLightType}`;\n}\n\n/** Build a {@link Renderable} for one mesh drawn through a PBR geometry view. */\nexport function buildPbrGeometryRenderable(scene: SceneContext, mesh: Mesh, view: PbrGeometryMaterialView): Renderable {\n const engine = scene.surface.engine;\n const device = engine._device;\n\n const ctx = (scene as SceneContext & { _pbrGeomContext?: _PbrGeometryContext })._pbrGeomContext;\n if (!ctx) {\n throw new Error(\"buildPbrGeometryRenderable: scene has no PBR context. Ensure regular PBR meshes have been built before recording the geometry task.\");\n }\n\n const source = view.source as PbrMaterialProps;\n if (!source._renderFeatures) {\n source._renderFeatures = _computePbrMaterialFeatures(source);\n }\n\n // Light selection mirrors regular PBR rebuildSingle, gated by the same\n // shadow rules so the geometry-pass real-color attachment receives the\n // same lighting as the regular PBR pass would have produced.\n const lr = writeMeshLightSelection(mesh, scene.lights);\n const lightCount = lr > 0 ? 1 : -lr;\n const hasSomeShadows = ctx._shadowLights.length > 0;\n const receiveShadows = mesh.receiveShadows && hasSomeShadows;\n const lightMode: 0 | 1 | 2 = lightCount === 0 ? 0 : lightCount === 1 && !receiveShadows ? 1 : 2;\n const singleLightType = lightMode === 1 ? _getPackedSingleLightType(scene.lights, lr - 1) : \"\";\n const meshFeatures = _computeMeshFeatures(mesh, receiveShadows);\n\n const variantKey = _variantKey(meshFeatures, lightMode, singleLightType);\n const res = _ensureViewResources(view, engine, ctx, meshFeatures, lightMode, singleLightType, variantKey);\n\n const features = res._features;\n const features2 = res._features2;\n const composed = res._composed;\n\n // ── Mesh UBO ───────────────────────────────────────────────────────\n const meshUboData = new F32(composed._meshUboSpec._totalBytes / 4);\n const _packMeshWorld = engine._makePackMeshWorld?.(scene) ?? packMat4IntoF32;\n _packMeshWorld(meshUboData, mesh.worldMatrix, 0, 0);\n writeMeshLightSelection(mesh, scene.lights, meshUboData);\n const meshUBO = createUniformBuffer(engine, meshUboData);\n\n // ── Material UBO ───────────────────────────────────────────────────\n const materialSpec = composed._materialUboSpec!;\n const matInitData = new F32(materialSpec._totalBytes / 4);\n // Use the per-scene writer captured on the geometry context.\n _writePbrMaterialData(matInitData, source, materialSpec);\n const materialUBO = createUniformBuffer(engine, matInitData);\n\n // ── Mesh bind group (group 1). Pass the VIEW as the \"material\" so the\n // PBR geometry ext can read `view._gpUBO`. The view inherits all\n // source fields via its prototype chain, so other ext bind callbacks\n // that look at source.* still resolve correctly.\n //\n // Bind during a scope where `_activeAttachments` is set so that any\n // composePbr cache miss inside `createPbrMeshBindGroup` (none expected\n // here, but defensive) sees the right attachments.\n const prev = _setActivePbrGeometryAttachments(view._geometryAttachments);\n let materialBindGroupStatic: GPUBindGroup;\n try {\n materialBindGroupStatic = createPbrMeshBindGroup(engine, _wrapBindings(res), composed, meshUBO, materialUBO, view as unknown as PbrMaterialProps, ctx._envTextures, mesh);\n } finally {\n _setActivePbrGeometryAttachments(prev);\n }\n\n // ── Shadow bind group (group 2) ────────────────────────────────────\n let shadowBindGroup: GPUBindGroup | null = null;\n if (receiveShadows && res._shadowBGL) {\n const entries: GPUBindGroupEntry[] = [];\n let b = 0;\n for (const sl of ctx._shadowLights) {\n const sg = sl.gen;\n entries.push({ binding: b++, resource: sg._depthTexture.createView() });\n entries.push({ binding: b++, resource: sg._depthSampler });\n entries.push({ binding: b++, resource: { buffer: sg._shadowUBO } });\n }\n shadowBindGroup = device.createBindGroup({ layout: res._shadowBGL, entries });\n }\n\n // ── Texture acquire/release lifecycle ──────────────────────────────\n const boundTextures = collectPbrBoundTextures(source);\n for (const t of boundTextures) {\n acquireTexture(t);\n }\n const prevDisposables = scene._meshDisposables.get(mesh) ?? [];\n scene._meshDisposables.set(mesh, [\n ...prevDisposables,\n () => {\n meshUBO.destroy();\n materialUBO.destroy();\n },\n () => {\n for (const t of boundTextures) {\n releaseTexture(t);\n }\n },\n ]);\n\n const hasNormalMap = (features & PBR_HAS_NORMAL_MAP) !== 0 && (meshFeatures & MSH_HAS_TANGENTS) !== 0;\n const hasUV2 = (features2 & PBR2_HAS_UV2) !== 0 && (meshFeatures & MSH_HAS_UV2) !== 0;\n const hasVertexColor = (meshFeatures & MSH_HAS_VERTEX_COLOR) !== 0;\n const hasTI = (meshFeatures & MSH_HAS_THIN_INSTANCES) !== 0;\n const hasTIColor = (meshFeatures & MSH_HAS_INSTANCE_COLOR) !== 0;\n const syncThinInstanceBuffers = ctx._syncThinInstanceBuffers;\n const isAlphaBlend = res._alphaBlend;\n const sortCenter = [mesh.worldMatrix[12]!, mesh.worldMatrix[13]!, mesh.worldMatrix[14]!] as [number, number, number];\n\n let _lastWorldVersion = mesh.worldMatrixVersion;\n let _lastLightsCount = scene.lights.length;\n let _lastUboVersion = source._uboVersion;\n const matScratch = new F32(materialSpec._totalBytes / 4);\n\n const _baseUpdate = (): void => {\n if (mesh.worldMatrixVersion !== _lastWorldVersion || scene.lights.length !== _lastLightsCount) {\n sortCenter[0] = mesh.worldMatrix[12]!;\n sortCenter[1] = mesh.worldMatrix[13]!;\n sortCenter[2] = mesh.worldMatrix[14]!;\n _packMeshWorld(meshUboData, mesh.worldMatrix, 0, 0);\n writeMeshLightSelection(mesh, scene.lights, meshUboData);\n device.queue.writeBuffer(meshUBO, 0, meshUboData as Float32Array<ArrayBuffer>);\n _lastWorldVersion = mesh.worldMatrixVersion;\n _lastLightsCount = scene.lights.length;\n }\n if (source._uboVersion !== _lastUboVersion) {\n _lastUboVersion = source._uboVersion;\n matScratch.fill(0);\n _writePbrMaterialData(matScratch, source, materialSpec);\n device.queue.writeBuffer(materialUBO, 0, matScratch.buffer, 0, matScratch.byteLength);\n }\n };\n const _invalidate = (): void => {\n _lastWorldVersion = -1;\n };\n const update = engine._wrapRenderableForFO?.(_baseUpdate, scene, _invalidate) ?? _baseUpdate;\n\n const draw = (pass: GPURenderPassEncoder | GPURenderBundleEncoder): number => {\n if (mesh.visible === false) {\n return 0;\n }\n const gpu = mesh._gpu;\n pass.setBindGroup(1, materialBindGroupStatic);\n if (shadowBindGroup) {\n pass.setBindGroup(2, shadowBindGroup);\n }\n let slot = 0;\n const vb = gpu._vbLayout;\n pass.setVertexBuffer(slot++, gpu.positionBuffer, vb?._p?._offset);\n pass.setVertexBuffer(slot++, gpu.normalBuffer, vb?._n?._offset);\n if (hasNormalMap && gpu.tangentBuffer) {\n pass.setVertexBuffer(slot++, gpu.tangentBuffer, vb?._t?._offset);\n }\n pass.setVertexBuffer(slot++, gpu.uvBuffer, vb?._u?._offset);\n if (hasUV2 && gpu.uv2Buffer) {\n pass.setVertexBuffer(slot++, gpu.uv2Buffer, vb?._u2?._offset);\n }\n if (hasVertexColor && gpu.colorBuffer) {\n pass.setVertexBuffer(slot++, gpu.colorBuffer, vb?._c?._offset);\n }\n // Skinning vertex buffers: live skeleton OR baked VAT (same field names, mutually exclusive).\n // Mirrors the main PBR renderable — without the VAT branch, VAT-animated thin instances leave the\n // pipeline's joint/weight vertex slots unbound (invalid command buffer, black frame).\n const skin = mesh.skeleton ?? mesh.vat;\n if (skin) {\n pass.setVertexBuffer(slot++, skin.jointsBuffer);\n pass.setVertexBuffer(slot++, skin.weightsBuffer);\n if (skin.joints1Buffer && skin.weights1Buffer) {\n pass.setVertexBuffer(slot++, skin.joints1Buffer);\n pass.setVertexBuffer(slot++, skin.weights1Buffer);\n }\n }\n const ti = hasTI ? mesh.thinInstances : null;\n if (ti && syncThinInstanceBuffers) {\n slot = syncThinInstanceBuffers(engine, ti, pass, slot, hasTIColor);\n }\n pass.setIndexBuffer(gpu.indexBuffer, gpu.indexFormat);\n if (ti && ti.count > 0) {\n pass.drawIndexed(gpu.indexCount, ti.count);\n } else {\n pass.drawIndexed(gpu.indexCount);\n }\n return 1;\n };\n\n const r: Renderable = {\n order: mesh.renderOrder ?? (isAlphaBlend ? 200 : 100),\n isTransparent: isAlphaBlend,\n mesh,\n bind(eng: EngineContext, sig: RenderTargetSignature) {\n return {\n renderable: r,\n pipeline: _getOrCreateGeometryPipeline(eng as EngineContext, sig, view, res),\n update,\n draw,\n };\n },\n };\n r._worldCenter = sortCenter;\n return r;\n}\n\n// ─── Shared per-view resources ─────────────────────────────────────────\n\nfunction _ensureViewResources(\n view: PbrGeometryMaterialView,\n engine: EngineContext,\n ctx: _PbrGeometryContext,\n meshFeatures: number,\n lightMode: 0 | 1 | 2,\n singleLightType: string,\n variantKey: string\n): PbrGeometryViewResources {\n let cache = view._geometry as Map<string, PbrGeometryViewResources> | undefined;\n if (!cache) {\n cache = new Map();\n Object.defineProperty(view, \"_geometry\", { value: cache, enumerable: false, configurable: true });\n }\n const cached = cache.get(variantKey);\n if (cached) {\n return cached;\n }\n // Ensure the PBR geometry ext is registered (idempotent) before composePbr is called.\n _ensurePbrGeometryExt(() => view._geometryAttachments);\n\n const features = view._renderFeatures.features;\n const features2 = view._renderFeatures.features2 ?? 0;\n const sceneFeatures = ctx._sceneFeatures;\n const source = view.source as PbrMaterialProps;\n const vbLayout = (source as unknown as { _vbLayout?: import(\"../../mesh/mesh.js\").MeshVbLayout })._vbLayout;\n const vbKey = \"\";\n\n // Compose with the active-attachment scope set so the registered ext\n // sees the right list when contributing the geometry-params fragment.\n const prev = _setActivePbrGeometryAttachments(view._geometryAttachments);\n let composed: ComposedShader;\n try {\n composed = composePbrGeometryShader(\n ctx._composePbr,\n features,\n features2,\n meshFeatures,\n sceneFeatures,\n lightMode,\n singleLightType,\n \"\",\n vbLayout,\n vbKey,\n view._geometryAttachments,\n view._emitColor\n );\n } finally {\n _setActivePbrGeometryAttachments(prev);\n }\n\n const device = engine._device;\n const meshBGL = device.createBindGroupLayout(composed._meshBGLDescriptor);\n const shadowBGL = composed._shadowBGLDescriptor ? device.createBindGroupLayout(composed._shadowBGLDescriptor) : null;\n const sceneBGL = (engine as unknown as { _getSceneBGL: () => GPUBindGroupLayout })._getSceneBGL?.() ?? _getSceneBindGroupLayoutLocal(engine, composed);\n const bgls: GPUBindGroupLayout[] = shadowBGL ? [sceneBGL, meshBGL, shadowBGL] : [sceneBGL, meshBGL];\n const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: bgls });\n const vertModule = device.createShaderModule({ code: composed._vertexWGSL });\n const fragModule = device.createShaderModule({ code: composed._fragmentWGSL });\n\n // The view's features have PBR_HAS_ALPHA_BLEND already stripped. Detect\n // alpha-blend from the SOURCE so transparent meshes get the right blend\n // pipeline state below.\n const sourceFeatures = source._renderFeatures?.features ?? 0;\n const alphaBlend = (sourceFeatures & PBR_HAS_ALPHA_BLEND) !== 0;\n\n const res: PbrGeometryViewResources = {\n _composed: composed,\n _features: features,\n _features2: features2,\n _meshFeatures: meshFeatures,\n _sceneFeatures: sceneFeatures,\n _meshBGL: meshBGL,\n _shadowBGL: shadowBGL,\n _pipelineLayout: pipelineLayout,\n _vertModule: vertModule,\n _fragModule: fragModule,\n _pipelines: new Map(),\n _alphaBlend: alphaBlend,\n };\n cache.set(variantKey, res);\n return res;\n}\n\n/** Adapter so `createPbrMeshBindGroup` (which takes `_PbrShaderBindings`) can\n * consume our view resources. Only the fields it touches matter. */\nfunction _wrapBindings(res: PbrGeometryViewResources): Parameters<typeof createPbrMeshBindGroup>[1] {\n return {\n _features: res._features,\n _features2: res._features2,\n _meshFeatures: res._meshFeatures,\n _meshBGL: res._meshBGL,\n _shadowBGL: res._shadowBGL,\n _composed: res._composed,\n _pipelines: res._pipelines,\n } as Parameters<typeof createPbrMeshBindGroup>[1];\n}\n\n/** Local fallback used when the engine does not expose a centralised scene BGL\n * cache helper. Matches the layout produced by `getSceneBindGroupLayout`. */\nfunction _getSceneBindGroupLayoutLocal(engine: EngineContext, _composed: ComposedShader): GPUBindGroupLayout {\n return getSceneBindGroupLayout(engine);\n}\n\nfunction _getOrCreateGeometryPipeline(engine: EngineContext, sig: RenderTargetSignature, view: PbrGeometryMaterialView, res: PbrGeometryViewResources): GPURenderPipeline {\n const key = targetSignatureKey(sig);\n const cached = res._pipelines.get(key);\n if (cached) {\n return cached;\n }\n const device = engine._device;\n const formats = (sig as RenderTargetSignature & { _colorFormats?: readonly GPUTextureFormat[] })._colorFormats ?? (sig._colorFormat ? [sig._colorFormat] : []);\n if (formats.length === 0) {\n throw new Error(\"pbr-geometry: render target has no color attachments\");\n }\n const alphaBlend = res._alphaBlend;\n const blendState: GPUBlendState | undefined = alphaBlend\n ? {\n color: { srcFactor: \"src-alpha\", dstFactor: \"one-minus-src-alpha\", operation: \"add\" },\n alpha: { srcFactor: \"src-alpha\", dstFactor: \"one-minus-src-alpha\", operation: \"add\" },\n }\n : undefined;\n const colorTargets: GPUColorTargetState[] = formats.map((fmt) => (blendState ? { format: fmt, blend: blendState } : { format: fmt }));\n const sourceFeatures = (view.source as PbrMaterialProps)._renderFeatures?.features ?? 0;\n const hasDoubleSided = (sourceFeatures & PBR_HAS_DOUBLE_SIDED) !== 0;\n const cullMode = hasDoubleSided ? \"none\" : view._reverseCulling ? \"front\" : \"back\";\n const pipeline = device.createRenderPipeline({\n layout: res._pipelineLayout,\n vertex: { module: res._vertModule, entryPoint: \"main\", buffers: res._composed._vertexBufferLayouts },\n fragment: { module: res._fragModule, entryPoint: \"main\", targets: colorTargets },\n depthStencil: sig._depthStencilFormat\n ? {\n format: sig._depthStencilFormat,\n depthCompare: sig._depthCompare ?? REVERSE_DEPTH_COMPARE,\n // Disable depth-write for alpha-blended meshes so background\n // depth survives partially-transparent pixels. Matches the\n // Standard geometry-renderable behaviour.\n depthWriteEnabled: !alphaBlend,\n }\n : undefined,\n multisample: { count: sig._sampleCount },\n primitive: { topology: \"triangle-list\", cullMode, frontFace: \"ccw\" },\n });\n res._pipelines.set(key, pipeline);\n return pipeline;\n}\n\n// ─── Helpers cribbed from pbr-renderable (no static cycle) ─────────────\n\nfunction _getPackedSingleLightType(lights: SceneContext[\"lights\"], packedIndex: number): \"hemispheric\" | \"directional\" | \"spot\" | \"point\" {\n let packed = 0;\n for (const light of lights) {\n if (!light._writeLightUbo) {\n continue;\n }\n if (packed === packedIndex) {\n const t = light.lightType;\n return t === \"hemispheric\" || t === \"directional\" || t === \"spot\" ? t : \"point\";\n }\n packed++;\n }\n return \"point\";\n}\n\n/** Writes material UBO via the helper exported from pbr-renderable. */\nfunction _writePbrMaterialData(data: Float32Array, mat: PbrMaterialProps, spec: import(\"../../shader/fragment-types.js\").UboSpec): void {\n _writeMaterialData(data, mat, spec);\n}\n","/** PBR material view helper that targets geometry-rendering MRT output.\n *\n * The geometry renderer task wraps each PBR caster material in a\n * `PbrGeometryMaterialView`. The view carries the per-task attachment\n * list, target-texture intent, optional `gp` UBO (shared across the task's\n * materials), and reverse-culling flag. The view also shadows\n * {@link Material._buildGroup} with {@link pbrGeometryGroupBuilder} so that\n * the geometry renderer task materialises a {@link Renderable} through the\n * PBR geometry renderable infrastructure — no view-aware branching needed\n * in core render-task.\n *\n * The geometry-output WGSL itself is produced by post-processing the regular\n * per-scene composed PBR shader (reused via the `_pbrGeomContext` stash) in\n * `./pbr-geometry-output-shader.ts`. */\n\nimport { createMaterialView } from \"../material-view.js\";\nimport type { MaterialView } from \"../material.js\";\nimport type { GeometryTextureType } from \"../../frame-graph/geometry-types.js\";\nimport { PBR_HAS_ALPHA_BLEND, PBR2_GEOMETRY_OUTPUT } from \"./pbr-flags.js\";\nimport type { PbrMaterialProps } from \"./pbr-material.js\";\nimport { pbrGeometryGroupBuilder } from \"./pbr-geometry-renderable.js\";\nimport { _ensurePbrGeometryExt } from \"./pbr-geometry-output-shader.js\";\n\n/** Per-task ordered attachment list driving the geometry template. The array\n * index is the MRT color-attachment slot used in `@location(i)`. */\nexport type PbrGeometryAttachments = readonly GeometryTextureType[];\n\n/** Per-(task, material) PBR geometry view configuration. All fields are owned\n * by the geometry renderer task; the view captures them so per-mesh renderables\n * pick up the same pipeline state and bindings. */\nexport interface PbrGeometryViewConfig {\n /** Ordered MRT attachment list — index = `@location(i)`. */\n readonly attachments: PbrGeometryAttachments;\n /** When true, the composed fragment emits the real (lit) material color\n * at `@location(N)` (N = attachments.length). The target texture is\n * added to the pipeline color-target list at the same slot. */\n readonly emitColor: boolean;\n /** Per-task previous-VP + camera-near-far UBO. Required when\n * {@link attachments} contains `NORMALIZED_VIEW_DEPTH` or\n * `LINEAR_VELOCITY`; ignored otherwise. */\n readonly gpUBO?: GPUBuffer | null;\n /** Flip culling direction. */\n readonly reverseCulling?: boolean;\n}\n\n/** PBR material view that emits geometry textures instead of shaded colour. */\nexport interface PbrGeometryMaterialView extends MaterialView {\n /** @internal Ordered MRT attachment list — index = `@location(i)`. */\n readonly _geometryAttachments: PbrGeometryAttachments;\n /** @internal Geometry pipeline carries an extra `@location(N)` color attachment. */\n readonly _emitColor: boolean;\n /** @internal Optional per-task geometry-params UBO shared with the composer's\n * `geometry-params` fragment. */\n readonly _gpUBO: GPUBuffer | null;\n /** @internal */\n readonly _reverseCulling: boolean;\n /** @internal Shared per-view resources cache populated lazily by the renderable\n * factory. Opaque to callers. */\n _geometry?: unknown;\n}\n\n// Snapshot of the currently-building view's attachments so the registered\n// PBR geometry extension can read them from `frag(ctx)`. The extension is\n// invoked synchronously during composePbr inside `buildPbrGeometryRenderable`;\n// the snapshot is set right before that call and cleared after.\nlet _activeAttachments: readonly GeometryTextureType[] | undefined;\n\n/** @internal Used by the geometry renderable to scope attachment access for\n * the PBR ext during a composePbr call. Returns the previous value so the\n * caller can restore it (avoids global leakage in nested scenarios). */\nexport function _setActivePbrGeometryAttachments(att: readonly GeometryTextureType[] | undefined): readonly GeometryTextureType[] | undefined {\n const prev = _activeAttachments;\n _activeAttachments = att;\n return prev;\n}\n\n/** Wrap a PBR material as a geometry-output view.\n * - Sets the `PBR2_GEOMETRY_OUTPUT` features2 bit.\n * - Clears `PBR_HAS_ALPHA_BLEND`: the geometry pipeline drives blending per\n * attachment via the pipeline color-target state, not via the PBR\n * fragment's source-over color output.\n * - Shadows `_buildGroup` with {@link pbrGeometryGroupBuilder} so the\n * natural `material._buildGroup._rebuildSingle` dispatch in\n * `resolvePendingMeshes` builds a geometry-MRT renderable for this view.\n * - Registers the PBR geometry extension (idempotent) so subsequent\n * composePbr calls pick up the `gp` UBO + geometry varyings when\n * `PBR2_GEOMETRY_OUTPUT` is set. */\nexport function createPbrGeometryMaterialView(source: PbrMaterialProps, config: PbrGeometryViewConfig): PbrGeometryMaterialView {\n _ensurePbrGeometryExt(() => _activeAttachments);\n const baseFeatures = source._renderFeatures?.features ?? 0;\n const baseFeatures2 = source._renderFeatures?.features2 ?? 0;\n const view = createMaterialView(source, {\n features: baseFeatures & ~PBR_HAS_ALPHA_BLEND,\n features2: baseFeatures2 | PBR2_GEOMETRY_OUTPUT,\n }) as PbrGeometryMaterialView;\n Object.defineProperty(view, \"_geometryAttachments\", { value: config.attachments, enumerable: false });\n Object.defineProperty(view, \"_emitColor\", { value: config.emitColor, enumerable: false });\n Object.defineProperty(view, \"_gpUBO\", { value: config.gpUBO ?? null, enumerable: false });\n Object.defineProperty(view, \"_reverseCulling\", { value: config.reverseCulling ?? false, enumerable: false });\n Object.defineProperty(view, \"_buildGroup\", { value: pbrGeometryGroupBuilder, enumerable: false });\n return view;\n}\n"],"names":["_a","_b"],"mappings":";;AAiCA,MAAM,iBAAiB;AACvB,MAAM,eAAe;AAIrB,SAAS,WAAW,aAAsD;AACtE,aAAW,KAAK,aAAa;AACzB,QAAI,MAAM,oBAAoB,yBAAyB,MAAM,oBAAoB,iBAAiB;AAC9F,aAAO;AAAA,IACX;AAAA,EACJ;AACA,SAAO;AACX;AAEA,SAAS,cAAc,aAAsD;AACzE,SAAO,YAAY,SAAS,oBAAoB,eAAe;AACnE;AAEA,SAAS,cAAc,aAAsD;AACzE,SAAO,YAAY,SAAS,oBAAoB,cAAc;AAClE;AAIA,SAAS,gCAAgC,gBAAyB,uBAAgC,sBAA+C;AAC7I,Q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
3
  if (!useClearcoat) {
4
4
  return "";
@@ -760,4 +760,4 @@ const emitter = {
760
760
  export {
761
761
  emitter
762
762
  };
763
- //# sourceMappingURL=pbr-metallic-roughness-block-full-CHC8w-Uv.js.map
763
+ //# sourceMappingURL=pbr-metallic-roughness-block-full-DD6zI_Lx.js.map