@babylonjs/lite 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_mat4-storage-f64-CjDoht2w.js → _mat4-storage-f64-BW9sTaVh.js} +2 -2
- package/{_mat4-storage-f64-CjDoht2w.js.map → _mat4-storage-f64-BW9sTaVh.js.map} +1 -1
- package/{alpha-test-fragment-B7DjSnF7.js → alpha-test-fragment-eUG971h3.js} +2 -2
- package/{alpha-test-fragment-B7DjSnF7.js.map → alpha-test-fragment-eUG971h3.js.map} +1 -1
- package/{background-dds-skybox-BEX309u3.js → background-dds-skybox-BwG0kYQP.js} +3 -3
- package/{background-dds-skybox-BEX309u3.js.map → background-dds-skybox-BwG0kYQP.js.map} +1 -1
- package/{background-ground-BU0HOcM4.js → background-ground-DiFpKJzF.js} +2 -2
- package/{background-ground-BU0HOcM4.js.map → background-ground-DiFpKJzF.js.map} +1 -1
- package/{background-hdr-skybox--RRRic_K.js → background-hdr-skybox-DIgJhvfj.js} +3 -3
- package/{background-hdr-skybox--RRRic_K.js.map → background-hdr-skybox-DIgJhvfj.js.map} +1 -1
- package/{background-solid-skybox-BrH2fXSu.js → background-solid-skybox--fqHdan_.js} +2 -2
- package/{background-solid-skybox-BrH2fXSu.js.map → background-solid-skybox--fqHdan_.js.map} +1 -1
- package/{billboard-renderable-BHWryAeC.js → billboard-renderable-HY2XCd52.js} +2 -2
- package/{billboard-renderable-BHWryAeC.js.map → billboard-renderable-HY2XCd52.js.map} +1 -1
- package/{clamp-block-DqbwnQGW.js → clamp-block-XHdUk2Va.js} +2 -2
- package/{clamp-block-DqbwnQGW.js.map → clamp-block-XHdUk2Va.js.map} +1 -1
- package/{clearcoat-fragment-D6FSCie1.js → clearcoat-fragment-CHYw8MPB.js} +2 -2
- package/{clearcoat-fragment-D6FSCie1.js.map → clearcoat-fragment-CHYw8MPB.js.map} +1 -1
- package/{create-skeleton-D_uplboC.js → create-skeleton-9tdiUjRP.js} +2 -2
- package/{create-skeleton-D_uplboC.js.map → create-skeleton-9tdiUjRP.js.map} +1 -1
- package/{cubemap-skybox-material-DQcMMdf-.js → cubemap-skybox-material-DqQ0dyz8.js} +2 -2
- package/{cubemap-skybox-material-DQcMMdf-.js.map → cubemap-skybox-material-DqQ0dyz8.js.map} +1 -1
- package/{curve-block-21rT0JjG.js → curve-block-S27sXrJQ.js} +2 -2
- package/{curve-block-21rT0JjG.js.map → curve-block-S27sXrJQ.js.map} +1 -1
- package/{emissive-fragment-C5FtBs3y.js → emissive-fragment-CZMQ0_bF.js} +2 -2
- package/{emissive-fragment-C5FtBs3y.js.map → emissive-fragment-CZMQ0_bF.js.map} +1 -1
- package/{esm-shadow-view-Gtd1LWRP.js → esm-shadow-view-CUwxbnMR.js} +2 -2
- package/{esm-shadow-view-Gtd1LWRP.js.map → esm-shadow-view-CUwxbnMR.js.map} +1 -1
- package/{esm-shadow-view-c5YV4Eg9.js → esm-shadow-view-Cl36rOrK.js} +2 -2
- package/{esm-shadow-view-c5YV4Eg9.js.map → esm-shadow-view-Cl36rOrK.js.map} +1 -1
- package/{esm-shadow-view-Cl3rPGof.js → esm-shadow-view-DKQ-FSoV.js} +2 -2
- package/{esm-shadow-view-Cl3rPGof.js.map → esm-shadow-view-DKQ-FSoV.js.map} +1 -1
- package/{gaussian-splatting-pipeline-sh-7J31V23x.js → gaussian-splatting-pipeline-sh-DDo7QQ8l.js} +2 -2
- package/{gaussian-splatting-pipeline-sh-7J31V23x.js.map → gaussian-splatting-pipeline-sh-DDo7QQ8l.js.map} +1 -1
- package/{geometry-texture-output-dXk4E9uu.js → geometry-texture-output-BmuAquio.js} +2 -2
- package/{geometry-texture-output-dXk4E9uu.js.map → geometry-texture-output-BmuAquio.js.map} +1 -1
- package/{geometry-view-BsFJpBJa.js → geometry-view-xWZmq799.js} +4 -4
- package/{geometry-view-BsFJpBJa.js.map → geometry-view-xWZmq799.js.map} +1 -1
- package/{gltf-animation-K_zZxj_d.js → gltf-animation-Bq7k_5HA.js} +2 -2
- package/{gltf-animation-K_zZxj_d.js.map → gltf-animation-Bq7k_5HA.js.map} +1 -1
- package/{gltf-ext-basisu-CDbPclzZ.js → gltf-ext-basisu-C5teqxzQ.js} +2 -202
- package/gltf-ext-basisu-C5teqxzQ.js.map +1 -0
- package/{gltf-ext-node-visibility-DXCJEYr6.js → gltf-ext-node-visibility-DnGTKkMf.js} +2 -2
- package/{gltf-ext-node-visibility-DXCJEYr6.js.map → gltf-ext-node-visibility-DnGTKkMf.js.map} +1 -1
- package/{gltf-ext-quantization-CvHI_0Vg.js → gltf-ext-quantization-DheC7FhB.js} +2 -2
- package/{gltf-ext-quantization-CvHI_0Vg.js.map → gltf-ext-quantization-DheC7FhB.js.map} +1 -1
- package/{gltf-ext-uv-transform-DgYazJBs.js → gltf-ext-uv-transform-DljdVllE.js} +2 -2
- package/{gltf-ext-uv-transform-DgYazJBs.js.map → gltf-ext-uv-transform-DljdVllE.js.map} +1 -1
- package/{gltf-feature-animation-pointer-D1RJRFBw.js → gltf-feature-animation-pointer-DVhymFLK.js} +3 -3
- package/{gltf-feature-animation-pointer-D1RJRFBw.js.map → gltf-feature-animation-pointer-DVhymFLK.js.map} +1 -1
- package/{gltf-feature-animations-Cmc1uoIu.js → gltf-feature-animations-hxC3y3bJ.js} +2 -2
- package/{gltf-feature-animations-Cmc1uoIu.js.map → gltf-feature-animations-hxC3y3bJ.js.map} +1 -1
- package/{gltf-feature-draco-CKKzT5E3.js → gltf-feature-draco-B7Q_cMUv.js} +2 -2
- package/{gltf-feature-draco-CKKzT5E3.js.map → gltf-feature-draco-B7Q_cMUv.js.map} +1 -1
- package/{gltf-feature-gpu-instancing-n87SO6Vh.js → gltf-feature-gpu-instancing-C7sRzWv7.js} +2 -2
- package/{gltf-feature-gpu-instancing-n87SO6Vh.js.map → gltf-feature-gpu-instancing-C7sRzWv7.js.map} +1 -1
- package/{gltf-feature-lights-punctual-Ckm3ciL8.js → gltf-feature-lights-punctual-DF7kya14.js} +5 -5
- package/{gltf-feature-lights-punctual-Ckm3ciL8.js.map → gltf-feature-lights-punctual-DF7kya14.js.map} +1 -1
- package/{gltf-feature-meshopt-DLC4SF1E.js → gltf-feature-meshopt-DRG9hEqT.js} +2 -2
- package/{gltf-feature-meshopt-DLC4SF1E.js.map → gltf-feature-meshopt-DRG9hEqT.js.map} +1 -1
- package/{gltf-feature-morph-Cjtu7hYa.js → gltf-feature-morph-DZydYgWp.js} +3 -3
- package/{gltf-feature-morph-Cjtu7hYa.js.map → gltf-feature-morph-DZydYgWp.js.map} +1 -1
- package/{gltf-feature-registry-C63Hjp9w.js → gltf-feature-registry-DeYdy3DV.js} +15 -15
- package/{gltf-feature-registry-C63Hjp9w.js.map → gltf-feature-registry-DeYdy3DV.js.map} +1 -1
- package/{gltf-feature-skeleton-DKbOGidp.js → gltf-feature-skeleton-B9och1W0.js} +3 -3
- package/{gltf-feature-skeleton-DKbOGidp.js.map → gltf-feature-skeleton-B9och1W0.js.map} +1 -1
- package/{gltf-feature-variants-Cmzu0O0e.js → gltf-feature-variants-CY_Qft7f.js} +2 -2
- package/{gltf-feature-variants-Cmzu0O0e.js.map → gltf-feature-variants-CY_Qft7f.js.map} +1 -1
- package/{gltf-glb-parser-Cj5MHS-v.js → gltf-glb-parser-CqOeXFOz.js} +2 -2
- package/{gltf-glb-parser-Cj5MHS-v.js.map → gltf-glb-parser-CqOeXFOz.js.map} +1 -1
- package/{gltf-interleave-gHf9_t0i.js → gltf-interleave-DWf27t-h.js} +2 -3
- package/{gltf-interleave-gHf9_t0i.js.map → gltf-interleave-DWf27t-h.js.map} +1 -1
- package/{gltf-pbr-builder-ext-edNcjwPf.js → gltf-pbr-builder-ext-DvFxuOqN.js} +2 -2
- package/{gltf-pbr-builder-ext-edNcjwPf.js.map → gltf-pbr-builder-ext-DvFxuOqN.js.map} +1 -1
- package/{gltf-variants-CPxNdtP4.js → gltf-variants-CUvzYGYX.js} +4 -4
- package/{gltf-variants-CPxNdtP4.js.map → gltf-variants-CUvzYGYX.js.map} +1 -1
- package/gpu-task-timer-Dgkff80h.js +236 -0
- package/gpu-task-timer-Dgkff80h.js.map +1 -0
- package/gpu-timer-CUpqT_hK.js +55 -0
- package/gpu-timer-CUpqT_hK.js.map +1 -0
- package/{gs-picking-pipeline-DYaW_Lg3.js → gs-picking-pipeline-55sM5LzV.js} +2 -2
- package/{gs-picking-pipeline-DYaW_Lg3.js.map → gs-picking-pipeline-55sM5LzV.js.map} +1 -1
- package/{havok-floating-origin-Dr-18Nds.js → havok-floating-origin-5xp32P-C.js} +2 -2
- package/{havok-floating-origin-Dr-18Nds.js.map → havok-floating-origin-5xp32P-C.js.map} +1 -1
- package/{index-CLElg2Bo.js → index-C-tEgwbZ.js} +2712 -865
- package/index-C-tEgwbZ.js.map +1 -0
- package/index.d.ts +486 -6
- package/index.js +473 -444
- package/{input-block-DqEedWF2.js → input-block-DbRYCnet.js} +2 -2
- package/{input-block-DqEedWF2.js.map → input-block-DbRYCnet.js.map} +1 -1
- package/{iridescence-fragment-BHU59-gQ.js → iridescence-fragment-S3Ko1jvC.js} +2 -2
- package/{iridescence-fragment-BHU59-gQ.js.map → iridescence-fragment-S3Ko1jvC.js.map} +1 -1
- package/{light-block-Bv37V8vl.js → light-block-CAqWkucp.js} +2 -2
- package/{light-block-Bv37V8vl.js.map → light-block-CAqWkucp.js.map} +1 -1
- package/{loop-block-qTg8vb99.js → loop-block-ch-biPFY.js} +2 -2
- package/{loop-block-qTg8vb99.js.map → loop-block-ch-biPFY.js.map} +1 -1
- package/{morph-fragment-BRCUr2wQ.js → morph-fragment-D9he3Ksk.js} +2 -2
- package/{morph-fragment-BRCUr2wQ.js.map → morph-fragment-D9he3Ksk.js.map} +1 -1
- package/{multilight-wgsl-DMeppAdZ.js → multilight-wgsl-74aXpcJG.js} +2 -2
- package/{multilight-wgsl-DMeppAdZ.js.map → multilight-wgsl-74aXpcJG.js.map} +1 -1
- package/{node-env-Bc559GmY.js → node-env-B2bjGcMS.js} +2 -2
- package/{node-env-Bc559GmY.js.map → node-env-B2bjGcMS.js.map} +1 -1
- package/{node-geometry-view-COmWsRXK.js → node-geometry-view-CSXlEAhG.js} +3 -3
- package/{node-geometry-view-COmWsRXK.js.map → node-geometry-view-CSXlEAhG.js.map} +1 -1
- package/{node-registry-extra-compat-dWrv7gpS.js → node-registry-extra-compat-BEQH_ksg.js} +2 -2
- package/{node-registry-extra-compat-dWrv7gpS.js.map → node-registry-extra-compat-BEQH_ksg.js.map} +1 -1
- package/{node-registry-extra-math-Bn854sX9.js → node-registry-extra-math-Bm32WBAa.js} +2 -2
- package/{node-registry-extra-math-Bn854sX9.js.map → node-registry-extra-math-Bm32WBAa.js.map} +1 -1
- package/{node-renderable-B5G8WcdH.js → node-renderable-BMHny4tC.js} +2 -2
- package/{node-renderable-B5G8WcdH.js.map → node-renderable-BMHny4tC.js.map} +1 -1
- package/{node-shadow-CVIUlNf0.js → node-shadow-BRiz7CT1.js} +2 -2
- package/{node-shadow-CVIUlNf0.js.map → node-shadow-BRiz7CT1.js.map} +1 -1
- package/{normal-map-fragment-CQSxhjCy.js → normal-map-fragment-sE3TjF4U.js} +2 -2
- package/{normal-map-fragment-CQSxhjCy.js.map → normal-map-fragment-sE3TjF4U.js.map} +1 -1
- package/package.json +3 -3
- package/{parse-camera-pBRT_6i5.js → parse-camera-CmZBS423.js} +2 -2
- package/{parse-camera-pBRT_6i5.js.map → parse-camera-CmZBS423.js.map} +1 -1
- package/{pbr-geometry-view-NiZY_juX.js → pbr-geometry-view-T3vMABM8.js} +3 -3
- package/{pbr-geometry-view-NiZY_juX.js.map → pbr-geometry-view-T3vMABM8.js.map} +1 -1
- package/{pbr-metallic-roughness-block-JBSi-tQN.js → pbr-metallic-roughness-block-DbozMlHU.js} +2 -2
- package/{pbr-metallic-roughness-block-JBSi-tQN.js.map → pbr-metallic-roughness-block-DbozMlHU.js.map} +1 -1
- package/{pbr-metallic-roughness-block-full-Ta9lR2cz.js → pbr-metallic-roughness-block-full-CHC8w-Uv.js} +2 -2
- package/{pbr-metallic-roughness-block-full-Ta9lR2cz.js.map → pbr-metallic-roughness-block-full-CHC8w-Uv.js.map} +1 -1
- package/{pbr-mr-helper-core-BVWNR08D.js → pbr-mr-helper-core-DGRgbRXl.js} +2 -2
- package/{pbr-mr-helper-core-BVWNR08D.js.map → pbr-mr-helper-core-DGRgbRXl.js.map} +1 -1
- package/{pbr-refraction-C9FvFmAp.js → pbr-refraction-CquDP9JO.js} +2 -2
- package/{pbr-refraction-C9FvFmAp.js.map → pbr-refraction-CquDP9JO.js.map} +1 -1
- package/{pbr-renderable-DzUF2QIk.js → pbr-renderable-CaHKHU0g.js} +22 -22
- package/{pbr-renderable-DzUF2QIk.js.map → pbr-renderable-CaHKHU0g.js.map} +1 -1
- package/{pbr-shadow-fragment-CnqnbGYS.js → pbr-shadow-fragment-DmnNe6yz.js} +2 -2
- package/{pbr-shadow-fragment-CnqnbGYS.js.map → pbr-shadow-fragment-DmnNe6yz.js.map} +1 -1
- package/{pbr-tracking-3tU1kqea.js → pbr-tracking-Bo7RTANK.js} +2 -2
- package/{pbr-tracking-3tU1kqea.js.map → pbr-tracking-Bo7RTANK.js.map} +1 -1
- package/{pbr-transmission-ext-BcLjRxfB.js → pbr-transmission-ext-CoGcJBGE.js} +2 -2
- package/{pbr-transmission-ext-BcLjRxfB.js.map → pbr-transmission-ext-CoGcJBGE.js.map} +1 -1
- package/{reflectance-fragment-Dbpgw3Jt.js → reflectance-fragment-CExe6qDY.js} +2 -2
- package/{reflectance-fragment-Dbpgw3Jt.js.map → reflectance-fragment-CExe6qDY.js.map} +1 -1
- package/{rgbd-decode-DoyUquy3.js → rgbd-decode-DkiiiIlt.js} +2 -2
- package/{rgbd-decode-DoyUquy3.js.map → rgbd-decode-DkiiiIlt.js.map} +1 -1
- package/{scene-material-swap-nNUH4nGn.js → scene-material-swap-4qM0tpBK.js} +1 -2
- package/scene-material-swap-4qM0tpBK.js.map +1 -0
- package/{screenshot-readback-D0Sj9qq3.js → screenshot-readback-avr_tYGZ.js} +2 -2
- package/{screenshot-readback-D0Sj9qq3.js.map → screenshot-readback-avr_tYGZ.js.map} +1 -1
- package/{shader-composer-BUD_pSX4.js → shader-composer-CZagsJDS.js} +2 -2
- package/{shader-composer-BUD_pSX4.js.map → shader-composer-CZagsJDS.js.map} +1 -1
- package/{shader-renderable-D7-RyVxa.js → shader-renderable-D5sbgzxt.js} +41 -9
- package/shader-renderable-D5sbgzxt.js.map +1 -0
- package/{shader-thin-instance-DuBotxDO.js → shader-thin-instance-CkQ8rrfH.js} +2 -2
- package/{shader-thin-instance-DuBotxDO.js.map → shader-thin-instance-CkQ8rrfH.js.map} +1 -1
- package/{sheen-fragment-1MkEMcbc.js → sheen-fragment-BEigjpTX.js} +2 -2
- package/{sheen-fragment-1MkEMcbc.js.map → sheen-fragment-BEigjpTX.js.map} +1 -1
- package/{singlelight-directional-wgsl-BsV8G456.js → singlelight-directional-wgsl-Ccsk-ys3.js} +2 -2
- package/{singlelight-directional-wgsl-BsV8G456.js.map → singlelight-directional-wgsl-Ccsk-ys3.js.map} +1 -1
- package/{singlelight-hemispheric-wgsl-Bo0jKlW5.js → singlelight-hemispheric-wgsl-DL-jpc97.js} +2 -2
- package/{singlelight-hemispheric-wgsl-Bo0jKlW5.js.map → singlelight-hemispheric-wgsl-DL-jpc97.js.map} +1 -1
- package/{singlelight-point-wgsl-DV39UP5Y.js → singlelight-point-wgsl-hYmiP6ys.js} +2 -2
- package/{singlelight-point-wgsl-DV39UP5Y.js.map → singlelight-point-wgsl-hYmiP6ys.js.map} +1 -1
- package/{singlelight-spot-wgsl-yg3od6vL.js → singlelight-spot-wgsl-DSjp1p1C.js} +2 -2
- package/{singlelight-spot-wgsl-yg3od6vL.js.map → singlelight-spot-wgsl-DSjp1p1C.js.map} +1 -1
- package/{skeleton-fragment-DdxYG6kv.js → skeleton-fragment-B__bUbPK.js} +2 -2
- package/{skeleton-fragment-DdxYG6kv.js.map → skeleton-fragment-B__bUbPK.js.map} +1 -1
- package/{skybox-renderable-CJD4XmX5.js → skybox-renderable-BH6uUkal.js} +2 -2
- package/{skybox-renderable-CJD4XmX5.js.map → skybox-renderable-BH6uUkal.js.map} +1 -1
- package/{splat-ply-compressed-DHjyiVmI.js → splat-ply-compressed-BGNK6dnh.js} +2 -2
- package/{splat-ply-compressed-DHjyiVmI.js.map → splat-ply-compressed-BGNK6dnh.js.map} +1 -1
- package/{standard-pipeline-XTbHL7MY.js → standard-pipeline-BvFynkwL.js} +3 -3
- package/{standard-pipeline-XTbHL7MY.js.map → standard-pipeline-BvFynkwL.js.map} +1 -1
- package/{standard-renderable-CREWLNHI.js → standard-renderable-1Q3zemys.js} +3 -3
- package/{standard-renderable-CREWLNHI.js.map → standard-renderable-1Q3zemys.js.map} +1 -1
- package/{std-ambient-fragment-Bjx3VFrr.js → std-ambient-fragment-__F1KTEu.js} +2 -2
- package/{std-ambient-fragment-Bjx3VFrr.js.map → std-ambient-fragment-__F1KTEu.js.map} +1 -1
- package/{std-cube-reflection-fragment-y9WWdXUt.js → std-cube-reflection-fragment-DidM0byH.js} +2 -2
- package/{std-cube-reflection-fragment-y9WWdXUt.js.map → std-cube-reflection-fragment-DidM0byH.js.map} +1 -1
- package/{std-emissive-fragment-C8Lnmojh.js → std-emissive-fragment-Bj62X4Np.js} +2 -2
- package/{std-emissive-fragment-C8Lnmojh.js.map → std-emissive-fragment-Bj62X4Np.js.map} +1 -1
- package/{std-lightmap-fragment-DFxGcoA5.js → std-lightmap-fragment-DXvfWvKc.js} +2 -2
- package/{std-lightmap-fragment-DFxGcoA5.js.map → std-lightmap-fragment-DXvfWvKc.js.map} +1 -1
- package/{std-opacity-fragment-EXzFWiSp.js → std-opacity-fragment-BzMMb1K_.js} +2 -2
- package/{std-opacity-fragment-EXzFWiSp.js.map → std-opacity-fragment-BzMMb1K_.js.map} +1 -1
- package/{std-reflection-fragment-BoJORqpG.js → std-reflection-fragment-DC9Kvu1C.js} +2 -2
- package/{std-reflection-fragment-BoJORqpG.js.map → std-reflection-fragment-DC9Kvu1C.js.map} +1 -1
- package/{std-shadow-fragment-Bq-Wc8UJ.js → std-shadow-fragment-BnMHeF1-.js} +2 -2
- package/{std-shadow-fragment-Bq-Wc8UJ.js.map → std-shadow-fragment-BnMHeF1-.js.map} +1 -1
- package/{std-specular-fragment-CM5R5j2g.js → std-specular-fragment-Bio681OG.js} +2 -2
- package/{std-specular-fragment-CM5R5j2g.js.map → std-specular-fragment-Bio681OG.js.map} +1 -1
- package/{std-tracking-Cif_wXeT.js → std-tracking-BTcrry2o.js} +2 -2
- package/{std-tracking-Cif_wXeT.js.map → std-tracking-BTcrry2o.js.map} +1 -1
- package/{subsurface-fragment-BEaAXYXz.js → subsurface-fragment-DpKib445.js} +2 -2
- package/{subsurface-fragment-BEaAXYXz.js.map → subsurface-fragment-DpKib445.js.map} +1 -1
- package/{thin-instance-cull-binding-DWKUt5ZN.js → thin-instance-cull-binding-DwZi7mlE.js} +3 -3
- package/{thin-instance-cull-binding-DWKUt5ZN.js.map → thin-instance-cull-binding-DwZi7mlE.js.map} +1 -1
- package/{thin-instance-gpu-BDdRcNAh.js → thin-instance-gpu-uY2NOv0J.js} +2 -2
- package/{thin-instance-gpu-BDdRcNAh.js.map → thin-instance-gpu-uY2NOv0J.js.map} +1 -1
- package/{tracking-primitives-CglRNTlX.js → tracking-primitives-Ck5bgCuo.js} +2 -2
- package/{tracking-primitives-CglRNTlX.js.map → tracking-primitives-Ck5bgCuo.js.map} +1 -1
- package/{unlit-fragment-kxfZWlnp.js → unlit-fragment-nc6hu3Mw.js} +2 -2
- package/{unlit-fragment-kxfZWlnp.js.map → unlit-fragment-nc6hu3Mw.js.map} +1 -1
- package/gltf-ext-basisu-CDbPclzZ.js.map +0 -1
- package/index-CLElg2Bo.js.map +0 -1
- package/scene-material-swap-nNUH4nGn.js.map +0 -1
- package/shader-renderable-D7-RyVxa.js.map +0 -1
|
@@ -221,7 +221,7 @@ async function createEngine(canvas, options) {
|
|
|
221
221
|
if (adapter.features.has("float32-filterable")) {
|
|
222
222
|
features.push("float32-filterable");
|
|
223
223
|
}
|
|
224
|
-
for (const f of ["texture-compression-astc", "texture-compression-bc", "texture-compression-etc2"]) {
|
|
224
|
+
for (const f of ["texture-compression-astc", "texture-compression-bc", "texture-compression-etc2", "timestamp-query"]) {
|
|
225
225
|
if (adapter.features.has(f)) {
|
|
226
226
|
features.push(f);
|
|
227
227
|
}
|
|
@@ -238,7 +238,7 @@ async function createEngine(canvas, options) {
|
|
|
238
238
|
throw new Error("Babylon Lite: useFloatingOrigin requires useHighPrecisionMatrix on the engine.");
|
|
239
239
|
}
|
|
240
240
|
if (useHpm) {
|
|
241
|
-
const { allocateF64Mat4 } = await import("./_mat4-storage-f64-
|
|
241
|
+
const { allocateF64Mat4 } = await import("./_mat4-storage-f64-BW9sTaVh.js");
|
|
242
242
|
_setHpmAllocator(allocateF64Mat4);
|
|
243
243
|
}
|
|
244
244
|
let _wrapRenderableForFO;
|
|
@@ -267,6 +267,7 @@ async function createEngine(canvas, options) {
|
|
|
267
267
|
_surfaces: surfaces,
|
|
268
268
|
_device: device,
|
|
269
269
|
drawCallCount: 0,
|
|
270
|
+
gpuFrameTimeMs: 0,
|
|
270
271
|
useHighPrecisionMatrix: useHpm,
|
|
271
272
|
useFloatingOrigin: useFO,
|
|
272
273
|
_animFrameId: 0,
|
|
@@ -333,7 +334,7 @@ function disposeEngine(engine) {
|
|
|
333
334
|
engine._device.destroy();
|
|
334
335
|
}
|
|
335
336
|
function renderFrame(engine, delta) {
|
|
336
|
-
var _a, _b2;
|
|
337
|
+
var _a, _b2, _c, _d, _e;
|
|
337
338
|
const surfaces = engine.surfaces;
|
|
338
339
|
let total = 0;
|
|
339
340
|
for (let i = 0; i < surfaces.length; i++) {
|
|
@@ -345,10 +346,11 @@ function renderFrame(engine, delta) {
|
|
|
345
346
|
const encoder = engine._device.createCommandEncoder({ label: "frame" });
|
|
346
347
|
engine._currentEncoder = encoder;
|
|
347
348
|
engine._currentDelta = delta;
|
|
349
|
+
(_a = engine._gpuTimerBegin) == null ? void 0 : _a.call(engine, encoder);
|
|
348
350
|
let drawCalls = 0;
|
|
349
351
|
for (let i = 0; i < surfaces.length; i++) {
|
|
350
352
|
const surface = surfaces[i];
|
|
351
|
-
(
|
|
353
|
+
(_b2 = surface._capturePreFrame) == null ? void 0 : _b2.call(surface, surface);
|
|
352
354
|
_refreshScRT(surface);
|
|
353
355
|
const ctxs = surface._renderingContexts;
|
|
354
356
|
for (let j = 0; j < ctxs.length; j++) {
|
|
@@ -361,18 +363,115 @@ function renderFrame(engine, delta) {
|
|
|
361
363
|
const finalEncoder = engine._currentEncoder;
|
|
362
364
|
for (let i = 0; i < surfaces.length; i++) {
|
|
363
365
|
const surface = surfaces[i];
|
|
364
|
-
(
|
|
366
|
+
(_c = surface._captureService) == null ? void 0 : _c.call(surface, surface, finalEncoder);
|
|
365
367
|
}
|
|
368
|
+
(_d = engine._gpuTimerEnd) == null ? void 0 : _d.call(engine, finalEncoder);
|
|
366
369
|
engine._cbs[0] = finalEncoder.finish();
|
|
367
370
|
engine._device.queue.submit(engine._cbs);
|
|
368
371
|
engine.drawCallCount = drawCalls;
|
|
372
|
+
(_e = engine._gpuTimerResolve) == null ? void 0 : _e.call(engine);
|
|
373
|
+
}
|
|
374
|
+
function isGpuTimingSupported(engine) {
|
|
375
|
+
return engine._device.features.has("timestamp-query");
|
|
376
|
+
}
|
|
377
|
+
function setGpuTimingEnabled(engine, enabled) {
|
|
378
|
+
if (!enabled) {
|
|
379
|
+
engine._gpuTimerWanted = false;
|
|
380
|
+
engine.gpuFrameTimeMs = 0;
|
|
381
|
+
engine._gpuTimerBegin = void 0;
|
|
382
|
+
engine._gpuTimerEnd = void 0;
|
|
383
|
+
engine._gpuTimerResolve = engine._gpuTaskTimerResolve;
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (!isGpuTimingSupported(engine)) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
engine._gpuTimerWanted = true;
|
|
390
|
+
void import("./gpu-timer-CUpqT_hK.js").then(({ createGpuFrameTimer, gpuFrameTimerBegin, gpuFrameTimerEnd, gpuFrameTimerResolve }) => {
|
|
391
|
+
if (engine._gpuTimer === void 0) {
|
|
392
|
+
engine._gpuTimer = createGpuFrameTimer(engine._device);
|
|
393
|
+
}
|
|
394
|
+
const timer = engine._gpuTimer;
|
|
395
|
+
if (timer && engine._gpuTimerWanted) {
|
|
396
|
+
engine._gpuTimerBegin = (encoder) => gpuFrameTimerBegin(timer, encoder);
|
|
397
|
+
engine._gpuTimerEnd = (encoder) => gpuFrameTimerEnd(timer, encoder);
|
|
398
|
+
engine._gpuTimerResolve = () => {
|
|
399
|
+
var _a;
|
|
400
|
+
gpuFrameTimerResolve(timer);
|
|
401
|
+
engine.gpuFrameTimeMs = timer.lastMs;
|
|
402
|
+
(_a = engine._gpuTaskTimerResolve) == null ? void 0 : _a.call(engine);
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
function isRenderTaskGpuTimingSupported(engine) {
|
|
408
|
+
return engine._device.features.has("timestamp-query");
|
|
409
|
+
}
|
|
410
|
+
function getRenderTaskGpuTimings(engine) {
|
|
411
|
+
if (!isRenderTaskGpuTimingSupported(engine)) {
|
|
412
|
+
return makeTimingSnapshot("unsupported", false, false, 0, [], 0);
|
|
413
|
+
}
|
|
414
|
+
const snapshot = engine._gpuTaskTimingResult;
|
|
415
|
+
if (snapshot) {
|
|
416
|
+
return snapshot;
|
|
417
|
+
}
|
|
418
|
+
if (engine._gpuTaskTimerWanted) {
|
|
419
|
+
return makeTimingSnapshot("pending", true, true, 0, [], 0);
|
|
420
|
+
}
|
|
421
|
+
return makeTimingSnapshot("disabled", true, false, 0, [], 0);
|
|
422
|
+
}
|
|
423
|
+
async function setRenderTaskGpuTimingEnabled(engine, enabled) {
|
|
424
|
+
var _a;
|
|
425
|
+
if (!enabled) {
|
|
426
|
+
engine._gpuTaskTimerEpoch = (engine._gpuTaskTimerEpoch ?? 0) + 1;
|
|
427
|
+
engine._gpuTaskTimerWanted = false;
|
|
428
|
+
(_a = engine._gpuTaskTimerDisable) == null ? void 0 : _a.call(engine);
|
|
429
|
+
engine._gpuTaskTimerDisable = void 0;
|
|
430
|
+
const supported = isRenderTaskGpuTimingSupported(engine);
|
|
431
|
+
engine._gpuTaskTimingResult = makeTimingSnapshot(supported ? "disabled" : "unsupported", supported, false, 0, [], 0);
|
|
432
|
+
return engine._gpuTaskTimingResult;
|
|
433
|
+
}
|
|
434
|
+
if (!isRenderTaskGpuTimingSupported(engine)) {
|
|
435
|
+
engine._gpuTaskTimerWanted = false;
|
|
436
|
+
engine._gpuTaskTimingResult = makeTimingSnapshot("unsupported", false, false, 0, [], 0);
|
|
437
|
+
return engine._gpuTaskTimingResult;
|
|
438
|
+
}
|
|
439
|
+
if (engine._gpuTaskTimerWanted) {
|
|
440
|
+
return getRenderTaskGpuTimings(engine);
|
|
441
|
+
}
|
|
442
|
+
const epoch = (engine._gpuTaskTimerEpoch ?? 0) + 1;
|
|
443
|
+
engine._gpuTaskTimerEpoch = epoch;
|
|
444
|
+
engine._gpuTaskTimerWanted = true;
|
|
445
|
+
engine._gpuTaskTimingResult = makeTimingSnapshot("pending", true, true, 0, [], 0);
|
|
446
|
+
const { createGpuTaskTimer, installGpuTaskTimer } = await import("./gpu-task-timer-Dgkff80h.js");
|
|
447
|
+
if (!engine._gpuTaskTimerWanted || engine._gpuTaskTimerEpoch !== epoch) {
|
|
448
|
+
return getRenderTaskGpuTimings(engine);
|
|
449
|
+
}
|
|
450
|
+
if (engine._gpuTaskTimer === void 0) {
|
|
451
|
+
engine._gpuTaskTimer = createGpuTaskTimer(engine._device);
|
|
452
|
+
}
|
|
453
|
+
const timer = engine._gpuTaskTimer;
|
|
454
|
+
if (!timer) {
|
|
455
|
+
engine._gpuTaskTimerWanted = false;
|
|
456
|
+
engine._gpuTaskTimingResult = makeTimingSnapshot("unsupported", false, false, 0, [], 0);
|
|
457
|
+
return engine._gpuTaskTimingResult;
|
|
458
|
+
}
|
|
459
|
+
engine._gpuTaskTimerDisable = installGpuTaskTimer(timer, engine, (snapshot) => {
|
|
460
|
+
if (engine._gpuTaskTimerWanted && engine._gpuTaskTimerEpoch === epoch) {
|
|
461
|
+
engine._gpuTaskTimingResult = snapshot;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
return getRenderTaskGpuTimings(engine);
|
|
465
|
+
}
|
|
466
|
+
function makeTimingSnapshot(status, supported, enabled, frameIndex, tasks, droppedTaskCount, error) {
|
|
467
|
+
return { status, supported, enabled, frameIndex, tasks, droppedTaskCount, error };
|
|
369
468
|
}
|
|
370
469
|
function captureScreenshot(surface) {
|
|
371
470
|
const promise = new Promise((resolve, reject) => {
|
|
372
471
|
(surface._captureQueue ?? (surface._captureQueue = [])).push({ resolve, reject });
|
|
373
472
|
});
|
|
374
473
|
if (!surface._captureService) {
|
|
375
|
-
void import("./screenshot-readback-
|
|
474
|
+
void import("./screenshot-readback-avr_tYGZ.js").then(({ createCaptureService, createCapturePreFrame }) => {
|
|
376
475
|
surface._captureService ?? (surface._captureService = createCaptureService());
|
|
377
476
|
surface._capturePreFrame ?? (surface._capturePreFrame = createCapturePreFrame());
|
|
378
477
|
});
|
|
@@ -403,6 +502,56 @@ function disposeMeshGpu(mesh) {
|
|
|
403
502
|
mesh.morphTargets.weightsBuffer.destroy();
|
|
404
503
|
}
|
|
405
504
|
}
|
|
505
|
+
let _meshScenes = null;
|
|
506
|
+
function enqueueMaterialSwap(scene, mesh) {
|
|
507
|
+
if (scene._materialSwapQueue.indexOf(mesh) >= 0) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
scene._materialSwapQueue.push(mesh);
|
|
511
|
+
if (!scene._processSwaps) {
|
|
512
|
+
void import("./scene-material-swap-4qM0tpBK.js").then((m2) => {
|
|
513
|
+
scene._processSwaps = m2.processMaterialSwaps;
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function installMaterialSetter(mesh) {
|
|
518
|
+
let _mat = mesh.material;
|
|
519
|
+
Object.defineProperty(mesh, "material", {
|
|
520
|
+
get() {
|
|
521
|
+
return _mat;
|
|
522
|
+
},
|
|
523
|
+
set(v) {
|
|
524
|
+
if (v !== _mat) {
|
|
525
|
+
_mat = v;
|
|
526
|
+
const scenes = _meshScenes == null ? void 0 : _meshScenes.get(mesh);
|
|
527
|
+
if (scenes) {
|
|
528
|
+
for (const scene of scenes) {
|
|
529
|
+
enqueueMaterialSwap(scene, mesh);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
configurable: true,
|
|
535
|
+
enumerable: true
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function registerMeshScene(scene, mesh) {
|
|
539
|
+
const map = _meshScenes ?? (_meshScenes = /* @__PURE__ */ new WeakMap());
|
|
540
|
+
let scenes = map.get(mesh);
|
|
541
|
+
if (!scenes) {
|
|
542
|
+
map.set(mesh, scenes = /* @__PURE__ */ new Set());
|
|
543
|
+
installMaterialSetter(mesh);
|
|
544
|
+
}
|
|
545
|
+
scenes.add(scene);
|
|
546
|
+
}
|
|
547
|
+
function unregisterMeshScene(scene, mesh) {
|
|
548
|
+
const scenes = _meshScenes == null ? void 0 : _meshScenes.get(mesh);
|
|
549
|
+
if (!scenes) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
scenes.delete(scene);
|
|
553
|
+
return scenes.size === 0;
|
|
554
|
+
}
|
|
406
555
|
function createFrameGraph(_engine) {
|
|
407
556
|
const fg = {
|
|
408
557
|
_tasks: [],
|
|
@@ -553,13 +702,13 @@ function getEffectiveAspectRatio(camera, targetWidth, targetHeight) {
|
|
|
553
702
|
return targetWidth / targetHeight * (v ? v.width / v.height : 1);
|
|
554
703
|
}
|
|
555
704
|
let _cachedSceneBGL = null;
|
|
556
|
-
let _cachedDevice$
|
|
705
|
+
let _cachedDevice$3 = null;
|
|
557
706
|
function getSceneBindGroupLayout(engine) {
|
|
558
707
|
const device = engine._device;
|
|
559
|
-
if (_cachedSceneBGL && _cachedDevice$
|
|
708
|
+
if (_cachedSceneBGL && _cachedDevice$3 === device) {
|
|
560
709
|
return _cachedSceneBGL;
|
|
561
710
|
}
|
|
562
|
-
_cachedDevice$
|
|
711
|
+
_cachedDevice$3 = device;
|
|
563
712
|
_cachedSceneBGL = device.createBindGroupLayout({
|
|
564
713
|
label: "scene",
|
|
565
714
|
entries: [
|
|
@@ -571,7 +720,7 @@ function getSceneBindGroupLayout(engine) {
|
|
|
571
720
|
}
|
|
572
721
|
function clearSceneBGLCache() {
|
|
573
722
|
_cachedSceneBGL = null;
|
|
574
|
-
_cachedDevice$
|
|
723
|
+
_cachedDevice$3 = null;
|
|
575
724
|
}
|
|
576
725
|
function createDefaultPipelineDescriptor(opts) {
|
|
577
726
|
const target = opts._blend ? { format: opts._format, blend: opts._blend } : { format: opts._format };
|
|
@@ -1156,35 +1305,6 @@ function drawList$1(enc, list, engine) {
|
|
|
1156
1305
|
}
|
|
1157
1306
|
return draws;
|
|
1158
1307
|
}
|
|
1159
|
-
function enqueueMaterialSwap(scene, mesh) {
|
|
1160
|
-
const mi = mesh;
|
|
1161
|
-
if (mi._materialDirty) {
|
|
1162
|
-
return;
|
|
1163
|
-
}
|
|
1164
|
-
mi._materialDirty = true;
|
|
1165
|
-
scene._materialSwapQueue.push(mesh);
|
|
1166
|
-
if (!scene._processSwaps) {
|
|
1167
|
-
void import("./scene-material-swap-nNUH4nGn.js").then((m2) => {
|
|
1168
|
-
scene._processSwaps = m2.processMaterialSwaps;
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
function installMaterialSetter(scene, mesh) {
|
|
1173
|
-
let _mat = mesh.material;
|
|
1174
|
-
Object.defineProperty(mesh, "material", {
|
|
1175
|
-
get() {
|
|
1176
|
-
return _mat;
|
|
1177
|
-
},
|
|
1178
|
-
set(v) {
|
|
1179
|
-
if (v !== _mat) {
|
|
1180
|
-
_mat = v;
|
|
1181
|
-
enqueueMaterialSwap(scene, mesh);
|
|
1182
|
-
}
|
|
1183
|
-
},
|
|
1184
|
-
configurable: true,
|
|
1185
|
-
enumerable: true
|
|
1186
|
-
});
|
|
1187
|
-
}
|
|
1188
1308
|
function createSceneContext(surface, options) {
|
|
1189
1309
|
const eng = surface.engine;
|
|
1190
1310
|
const ctxLocal = {
|
|
@@ -1305,7 +1425,7 @@ function addToScene(scene, entity) {
|
|
|
1305
1425
|
if ("_gpu" in entity && "material" in entity) {
|
|
1306
1426
|
const mesh = entity;
|
|
1307
1427
|
ctx.meshes.push(mesh);
|
|
1308
|
-
|
|
1428
|
+
registerMeshScene(ctx, mesh);
|
|
1309
1429
|
const build = mesh.material ? mesh.material._buildGroup : void 0;
|
|
1310
1430
|
if (build) {
|
|
1311
1431
|
let group = ctx._groups.get(build);
|
|
@@ -1349,7 +1469,9 @@ function disposeScene(scene) {
|
|
|
1349
1469
|
}
|
|
1350
1470
|
ctx._meshDisposables.clear();
|
|
1351
1471
|
for (const mesh of ctx.meshes) {
|
|
1352
|
-
|
|
1472
|
+
if (unregisterMeshScene(ctx, mesh)) {
|
|
1473
|
+
disposeMeshGpu(mesh);
|
|
1474
|
+
}
|
|
1353
1475
|
}
|
|
1354
1476
|
ctx.meshes.length = 0;
|
|
1355
1477
|
ctx._renderables.length = 0;
|
|
@@ -1372,9 +1494,6 @@ async function buildScene(scene) {
|
|
|
1372
1494
|
ctx._deferredBuilders = [];
|
|
1373
1495
|
await Promise.all(builders.map(async (b) => b()));
|
|
1374
1496
|
}
|
|
1375
|
-
for (const mesh of ctx._materialSwapQueue) {
|
|
1376
|
-
mesh._materialDirty = false;
|
|
1377
|
-
}
|
|
1378
1497
|
ctx._materialSwapQueue.length = 0;
|
|
1379
1498
|
ctx._renderableVersion++;
|
|
1380
1499
|
ctx._built = true;
|
|
@@ -1807,14 +1926,15 @@ function removeFromScene(scene, mesh) {
|
|
|
1807
1926
|
if (qi >= 0) {
|
|
1808
1927
|
scene._materialSwapQueue.splice(qi, 1);
|
|
1809
1928
|
}
|
|
1810
|
-
mesh._materialDirty = false;
|
|
1811
1929
|
mesh.parent = null;
|
|
1812
1930
|
for (const task of scene._frameGraph._tasks) {
|
|
1813
1931
|
if ("_renderables" in task) {
|
|
1814
1932
|
removeMeshFromTask(task, mesh);
|
|
1815
1933
|
}
|
|
1816
1934
|
}
|
|
1817
|
-
|
|
1935
|
+
if (unregisterMeshScene(scene, mesh)) {
|
|
1936
|
+
disposeMeshGpu(mesh);
|
|
1937
|
+
}
|
|
1818
1938
|
}
|
|
1819
1939
|
function setSubtreeVisible(node, v) {
|
|
1820
1940
|
cascade(node, v);
|
|
@@ -2927,7 +3047,7 @@ function createGeometryRendererTask(config, engine, scene) {
|
|
|
2927
3047
|
if (hasStandard) {
|
|
2928
3048
|
loads.push(
|
|
2929
3049
|
(async () => {
|
|
2930
|
-
const [viewMod, matMod] = await Promise.all([import("./geometry-view-
|
|
3050
|
+
const [viewMod, matMod] = await Promise.all([import("./geometry-view-xWZmq799.js"), Promise.resolve().then(() => standardMaterial)]);
|
|
2931
3051
|
task._createStandardGeometryView = viewMod.createStandardGeometryMaterialView;
|
|
2932
3052
|
task._computeStandardFeatures = matMod._computeStandardMaterialFeatures;
|
|
2933
3053
|
})()
|
|
@@ -2936,7 +3056,7 @@ function createGeometryRendererTask(config, engine, scene) {
|
|
|
2936
3056
|
if (hasPbr) {
|
|
2937
3057
|
loads.push(
|
|
2938
3058
|
(async () => {
|
|
2939
|
-
const [viewMod, matMod] = await Promise.all([import("./pbr-geometry-view-
|
|
3059
|
+
const [viewMod, matMod] = await Promise.all([import("./pbr-geometry-view-T3vMABM8.js"), Promise.resolve().then(() => pbrMaterial)]);
|
|
2940
3060
|
task._createPbrGeometryView = viewMod.createPbrGeometryMaterialView;
|
|
2941
3061
|
task._computePbrFeatures = matMod._computePbrMaterialFeatures;
|
|
2942
3062
|
})()
|
|
@@ -2945,7 +3065,7 @@ function createGeometryRendererTask(config, engine, scene) {
|
|
|
2945
3065
|
if (hasNode) {
|
|
2946
3066
|
loads.push(
|
|
2947
3067
|
(async () => {
|
|
2948
|
-
const viewMod = await import("./node-geometry-view-
|
|
3068
|
+
const viewMod = await import("./node-geometry-view-CSXlEAhG.js");
|
|
2949
3069
|
task._createNodeGeometryView = viewMod.createNodeGeometryMaterialView;
|
|
2950
3070
|
})()
|
|
2951
3071
|
);
|
|
@@ -3477,6 +3597,7 @@ function enableSceneTransmission(scene, engine) {
|
|
|
3477
3597
|
function enableRenderTaskTransmission(task, engine, options) {
|
|
3478
3598
|
var _a, _b2;
|
|
3479
3599
|
const linear = (options == null ? void 0 : options.linear) !== false;
|
|
3600
|
+
applyTransmissionOptions(task, options);
|
|
3480
3601
|
const grab = {
|
|
3481
3602
|
get texture() {
|
|
3482
3603
|
return task._targetSignature._transmissionTexture ?? null;
|
|
@@ -3559,9 +3680,9 @@ function inverseImageProcessedColor(color, exposure, contrast, toneMapping) {
|
|
|
3559
3680
|
};
|
|
3560
3681
|
}
|
|
3561
3682
|
function inverseImageProcessedChannel(value, exposure, contrast, toneMapping) {
|
|
3562
|
-
let c2 = clamp01$
|
|
3683
|
+
let c2 = clamp01$2(value);
|
|
3563
3684
|
if (contrast < 1) {
|
|
3564
|
-
c2 = contrast > 0 ? clamp01$
|
|
3685
|
+
c2 = contrast > 0 ? clamp01$2((c2 - 0.5 * (1 - contrast)) / contrast) : 0.5;
|
|
3565
3686
|
} else if (contrast > 1) {
|
|
3566
3687
|
const mixAmount = contrast - 1;
|
|
3567
3688
|
let lo = 0;
|
|
@@ -3584,7 +3705,7 @@ function inverseImageProcessedChannel(value, exposure, contrast, toneMapping) {
|
|
|
3584
3705
|
}
|
|
3585
3706
|
return exposure > 0 ? c2 / exposure : c2;
|
|
3586
3707
|
}
|
|
3587
|
-
function clamp01$
|
|
3708
|
+
function clamp01$2(v) {
|
|
3588
3709
|
return Math.min(Math.max(v, 0), 1);
|
|
3589
3710
|
}
|
|
3590
3711
|
function markPbrMaterialsLinear(scene) {
|
|
@@ -3601,12 +3722,13 @@ function createRenderTaskTransmission(task, engine) {
|
|
|
3601
3722
|
const width = 1024;
|
|
3602
3723
|
const height = 1024;
|
|
3603
3724
|
const format = "rgba16float";
|
|
3604
|
-
const
|
|
3725
|
+
const mipLevelCount2 = transmissionMipLevelCount(task._config.transmission, width, height);
|
|
3726
|
+
const generateMipmaps2 = mipLevelCount2 > 1;
|
|
3605
3727
|
const texture = engine._device.createTexture({
|
|
3606
3728
|
label: task.name,
|
|
3607
3729
|
size: { width, height },
|
|
3608
3730
|
format,
|
|
3609
|
-
mipLevelCount:
|
|
3731
|
+
mipLevelCount: mipLevelCount2,
|
|
3610
3732
|
usage: TU.RENDER_ATTACHMENT | TU.TEXTURE_BINDING | TU.COPY_DST
|
|
3611
3733
|
});
|
|
3612
3734
|
const tex = {
|
|
@@ -3852,8 +3974,37 @@ function normalizeCopyCount(cfg) {
|
|
|
3852
3974
|
const count = (cfg == null ? void 0 : cfg.copyCount) ?? 1;
|
|
3853
3975
|
return count === Infinity ? 0 : Math.max(0, count | 0);
|
|
3854
3976
|
}
|
|
3855
|
-
function
|
|
3856
|
-
|
|
3977
|
+
function applyTransmissionOptions(task, options) {
|
|
3978
|
+
if (!options) {
|
|
3979
|
+
return;
|
|
3980
|
+
}
|
|
3981
|
+
let next = task._config.transmission;
|
|
3982
|
+
let changed = false;
|
|
3983
|
+
const set = (key, value) => {
|
|
3984
|
+
if (value === void 0) {
|
|
3985
|
+
return;
|
|
3986
|
+
}
|
|
3987
|
+
next = { ...next, [key]: value };
|
|
3988
|
+
changed = true;
|
|
3989
|
+
};
|
|
3990
|
+
set("copyCount", options.copyCount);
|
|
3991
|
+
set("generateMipmaps", options.generateMipmaps);
|
|
3992
|
+
set("mipLevelCount", options.mipLevelCount);
|
|
3993
|
+
if (changed) {
|
|
3994
|
+
task._config.transmission = next;
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
function transmissionMipLevelCount(cfg, width, height) {
|
|
3998
|
+
if ((cfg == null ? void 0 : cfg.generateMipmaps) === false) {
|
|
3999
|
+
return 1;
|
|
4000
|
+
}
|
|
4001
|
+
const full = Math.floor(Math.log2(Math.max(width, height))) + 1;
|
|
4002
|
+
const defaultCount = biasedMipLevelCount(width, height, REFRACTION_LOD_BIAS);
|
|
4003
|
+
const requested = cfg == null ? void 0 : cfg.mipLevelCount;
|
|
4004
|
+
if (requested === void 0) {
|
|
4005
|
+
return Math.min(full, defaultCount);
|
|
4006
|
+
}
|
|
4007
|
+
return Math.min(full, Math.max(1, requested | 0));
|
|
3857
4008
|
}
|
|
3858
4009
|
const DEFAULT_VERTEX_WGSL$1 = `struct EffectVertexOutput{@builtin(position) position:vec4<f32>,@location(0) uv:vec2<f32>};
|
|
3859
4010
|
@vertex fn effectFullscreenVertex(@builtin(vertex_index) vertexIndex:u32)->EffectVertexOutput{var positions=array<vec2<f32>,3>(vec2<f32>(-1.0,-1.0),vec2<f32>(3.0,-1.0),vec2<f32>(-1.0,3.0));let p=positions[vertexIndex];var out:EffectVertexOutput;out.position=vec4<f32>(p,0.0,1.0);out.uv=p*0.5+vec2<f32>(0.5,0.5);return out;}`;
|
|
@@ -6234,12 +6385,12 @@ function computeLocalBasis(worldPos, refEast, refNorth, refUp) {
|
|
|
6234
6385
|
refUp.x = worldPos.x / upLen;
|
|
6235
6386
|
refUp.y = worldPos.y / upLen;
|
|
6236
6387
|
refUp.z = worldPos.z / upLen;
|
|
6237
|
-
cross(refUp, WORLD_NORTH, refEast);
|
|
6388
|
+
cross$1(refUp, WORLD_NORTH, refEast);
|
|
6238
6389
|
if (lengthSq(refEast) < GEO_EPSILON) {
|
|
6239
|
-
cross(refUp, WORLD_RIGHT, refEast);
|
|
6390
|
+
cross$1(refUp, WORLD_RIGHT, refEast);
|
|
6240
6391
|
}
|
|
6241
6392
|
normalizeInPlace(refEast);
|
|
6242
|
-
cross(refEast, refUp, refNorth);
|
|
6393
|
+
cross$1(refEast, refUp, refNorth);
|
|
6243
6394
|
normalizeInPlace(refNorth);
|
|
6244
6395
|
}
|
|
6245
6396
|
function computeLookAtFromYawPitch(yaw, pitch, center, result) {
|
|
@@ -6352,15 +6503,15 @@ function createGeospatialCamera(options) {
|
|
|
6352
6503
|
computeLocalBasis(center, east, north, up);
|
|
6353
6504
|
computeLookAtFromYawPitch(scalars.yaw, scalars.pitch, center, lookAt);
|
|
6354
6505
|
const right = { x: 0, y: 0, z: 0 };
|
|
6355
|
-
cross(up, lookAt, right);
|
|
6506
|
+
cross$1(up, lookAt, right);
|
|
6356
6507
|
if (lengthSq(right) < GEO_EPSILON) {
|
|
6357
6508
|
const cy = Math.cos(scalars.yaw);
|
|
6358
6509
|
const sy = Math.sin(scalars.yaw);
|
|
6359
6510
|
const horiz = { x: north.x * cy + east.x * sy, y: north.y * cy + east.y * sy, z: north.z * cy + east.z * sy };
|
|
6360
|
-
cross(horiz, lookAt, right);
|
|
6511
|
+
cross$1(horiz, lookAt, right);
|
|
6361
6512
|
}
|
|
6362
6513
|
normalizeInPlace(right);
|
|
6363
|
-
cross(lookAt, right, upVector);
|
|
6514
|
+
cross$1(lookAt, right, upVector);
|
|
6364
6515
|
normalizeInPlace(upVector);
|
|
6365
6516
|
position.x = center.x - lookAt.x * scalars.radius;
|
|
6366
6517
|
position.y = center.y - lookAt.y * scalars.radius;
|
|
@@ -6428,7 +6579,7 @@ function createGeospatialCamera(options) {
|
|
|
6428
6579
|
applyOrientation(0, 0, restingRadius, center);
|
|
6429
6580
|
return cam;
|
|
6430
6581
|
}
|
|
6431
|
-
function cross(a, b, out) {
|
|
6582
|
+
function cross$1(a, b, out) {
|
|
6432
6583
|
const x = a.y * b.z - a.z * b.y;
|
|
6433
6584
|
const y = a.z * b.x - a.x * b.z;
|
|
6434
6585
|
const z = a.x * b.y - a.y * b.x;
|
|
@@ -6523,6 +6674,41 @@ function unprojectPoint(invVP, ndcX, ndcY, depth) {
|
|
|
6523
6674
|
return [x * invW, y * invW, z * invW];
|
|
6524
6675
|
}
|
|
6525
6676
|
const REFERENCE_FRAME_RATE = 60;
|
|
6677
|
+
const REFERENCE_FRAME_MS = 1e3 / REFERENCE_FRAME_RATE;
|
|
6678
|
+
function frameDecay(inertia, effMs, referenceFrameMs = REFERENCE_FRAME_MS) {
|
|
6679
|
+
return Math.pow(inertia, effMs / referenceFrameMs);
|
|
6680
|
+
}
|
|
6681
|
+
function integrateInertialVelocity(velocity, pixelDelta, inertia, effMs, hasActiveInput) {
|
|
6682
|
+
if (effMs === 0) {
|
|
6683
|
+
return velocity;
|
|
6684
|
+
}
|
|
6685
|
+
const decay = frameDecay(inertia, effMs);
|
|
6686
|
+
let v = velocity * decay;
|
|
6687
|
+
if (pixelDelta !== 0 || hasActiveInput) {
|
|
6688
|
+
const oneMinus = 1 - inertia;
|
|
6689
|
+
const inputScale = oneMinus > 0 ? (1 - decay) / oneMinus : 1;
|
|
6690
|
+
v += pixelDelta / effMs * inputScale;
|
|
6691
|
+
} else if (Math.abs(v) < 1e-6) {
|
|
6692
|
+
v = 0;
|
|
6693
|
+
}
|
|
6694
|
+
return v;
|
|
6695
|
+
}
|
|
6696
|
+
function clamp01$1(v) {
|
|
6697
|
+
return v < 0 ? 0 : v > 1 ? 1 : v;
|
|
6698
|
+
}
|
|
6699
|
+
function computePanSpeedMultiplier(center, position) {
|
|
6700
|
+
const centerRadius = Math.hypot(center.x, center.y, center.z);
|
|
6701
|
+
const currentRadius = Math.hypot(position.x, position.y, position.z);
|
|
6702
|
+
const sinLat = centerRadius > 0 ? center.z / centerRadius : 0;
|
|
6703
|
+
const cosLat = Math.sqrt(1 - Math.min(1, sinLat * sinLat));
|
|
6704
|
+
const latDamp = Math.sqrt(Math.abs(cosLat));
|
|
6705
|
+
const height = Math.max(currentRadius - centerRadius, GEO_EPSILON);
|
|
6706
|
+
const altitudeScale = Math.max(1, centerRadius / height);
|
|
6707
|
+
return clamp01$1(altitudeScale * latDamp);
|
|
6708
|
+
}
|
|
6709
|
+
function computeZoomSpeedMultiplier(distanceToTarget) {
|
|
6710
|
+
return distanceToTarget * 0.01;
|
|
6711
|
+
}
|
|
6526
6712
|
function attachGeospatialControls(camera, canvas, scene, options) {
|
|
6527
6713
|
const zoomToCursor = (options == null ? void 0 : options.zoomToCursor) ?? true;
|
|
6528
6714
|
const checkCollisions = (options == null ? void 0 : options.checkCollisions) ?? false;
|
|
@@ -6559,6 +6745,13 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
6559
6745
|
let lastX = 0;
|
|
6560
6746
|
let lastY = 0;
|
|
6561
6747
|
const keysDown = /* @__PURE__ */ new Set();
|
|
6748
|
+
const activeTouches = /* @__PURE__ */ new Map();
|
|
6749
|
+
let pinchPrevDist = 0;
|
|
6750
|
+
let pinchStartCentroidX = 0;
|
|
6751
|
+
let pinchStartCentroidY = 0;
|
|
6752
|
+
let pinchPanning = false;
|
|
6753
|
+
const PINCH_PAN_THRESHOLD = 20;
|
|
6754
|
+
const PINCH_ZOOM_SCALE = 0.05;
|
|
6562
6755
|
function rectSize() {
|
|
6563
6756
|
const r = canvas.getBoundingClientRect();
|
|
6564
6757
|
return { width: r.width || canvas.width, height: r.height || canvas.height };
|
|
@@ -6815,26 +7008,8 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
6815
7008
|
}
|
|
6816
7009
|
return 1e3 / REFERENCE_FRAME_RATE;
|
|
6817
7010
|
}
|
|
6818
|
-
function frameDecay(inertia, dt) {
|
|
6819
|
-
const eff = effectiveDeltaMs(dt);
|
|
6820
|
-
const refMs = 1e3 / REFERENCE_FRAME_RATE;
|
|
6821
|
-
return Math.pow(inertia, eff / refMs);
|
|
6822
|
-
}
|
|
6823
7011
|
function nextVelocity(vel, pixelDelta, inertia, dt) {
|
|
6824
|
-
|
|
6825
|
-
if (eff === 0) {
|
|
6826
|
-
return vel;
|
|
6827
|
-
}
|
|
6828
|
-
const decay = frameDecay(inertia, dt);
|
|
6829
|
-
let v = vel * decay;
|
|
6830
|
-
if (pixelDelta !== 0 || activeInput) {
|
|
6831
|
-
const oneMinus = 1 - inertia;
|
|
6832
|
-
const inputScale = oneMinus > 0 ? (1 - decay) / oneMinus : 1;
|
|
6833
|
-
v += pixelDelta / eff * inputScale;
|
|
6834
|
-
} else if (Math.abs(v) < 1e-6) {
|
|
6835
|
-
v = 0;
|
|
6836
|
-
}
|
|
6837
|
-
return v;
|
|
7012
|
+
return integrateInertialVelocity(vel, pixelDelta, inertia, effectiveDeltaMs(dt), activeInput);
|
|
6838
7013
|
}
|
|
6839
7014
|
function isDragging() {
|
|
6840
7015
|
return hitPointRadius !== void 0;
|
|
@@ -6842,14 +7017,7 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
6842
7017
|
function computeFrameDeltas(dt) {
|
|
6843
7018
|
const center = camera.center;
|
|
6844
7019
|
if (panAccumulated.x !== 0 || panAccumulated.y !== 0 || panAccumulated.z !== 0) {
|
|
6845
|
-
|
|
6846
|
-
const currentRadius = Math.hypot(camera.position.x, camera.position.y, camera.position.z);
|
|
6847
|
-
const upZ = centerRadius > 0 ? center.z / centerRadius : 0;
|
|
6848
|
-
const cosLat = Math.sqrt(1 - Math.min(1, upZ * upZ));
|
|
6849
|
-
const latDamp = Math.sqrt(Math.abs(cosLat));
|
|
6850
|
-
const height = Math.max(currentRadius - centerRadius, GEO_EPSILON);
|
|
6851
|
-
const latDampScale = Math.max(1, centerRadius / height);
|
|
6852
|
-
panSpeedMultiplier = clampNum(latDampScale * latDamp, 0, 1);
|
|
7020
|
+
panSpeedMultiplier = computePanSpeedMultiplier(center, camera.position);
|
|
6853
7021
|
} else {
|
|
6854
7022
|
panSpeedMultiplier = 1;
|
|
6855
7023
|
}
|
|
@@ -6858,7 +7026,7 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
6858
7026
|
zoomVelocity = 0;
|
|
6859
7027
|
} else {
|
|
6860
7028
|
const target = computedZoomPickPoint ? dist(camera.position, computedZoomPickPoint) : dist(camera.position, center);
|
|
6861
|
-
zoomSpeedMultiplier = target
|
|
7029
|
+
zoomSpeedMultiplier = computeZoomSpeedMultiplier(target);
|
|
6862
7030
|
}
|
|
6863
7031
|
const eff = effectiveDeltaMs(dt);
|
|
6864
7032
|
panVelocity.x = nextVelocity(panVelocity.x, panAccumulated.x, panInertia, dt);
|
|
@@ -6912,39 +7080,45 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
6912
7080
|
const rotateStep = 6;
|
|
6913
7081
|
const zoomStep = 4;
|
|
6914
7082
|
const panStep = camera.radius * 15e-4;
|
|
6915
|
-
|
|
6916
|
-
rotationAccumulated.y -= rotateStep;
|
|
6917
|
-
}
|
|
6918
|
-
if (keysDown.has("ArrowRight")) {
|
|
6919
|
-
rotationAccumulated.y += rotateStep;
|
|
6920
|
-
}
|
|
6921
|
-
if (keysDown.has("ArrowUp")) {
|
|
6922
|
-
rotationAccumulated.x += rotateStep;
|
|
6923
|
-
}
|
|
6924
|
-
if (keysDown.has("ArrowDown")) {
|
|
6925
|
-
rotationAccumulated.x -= rotateStep;
|
|
6926
|
-
}
|
|
7083
|
+
const ctrl = keysDown.has("ControlLeft") || keysDown.has("ControlRight");
|
|
6927
7084
|
if (keysDown.has("Equal") || keysDown.has("NumpadAdd")) {
|
|
6928
7085
|
zoomAccumulated += zoomStep;
|
|
7086
|
+
computedZoomPickPoint = null;
|
|
6929
7087
|
}
|
|
6930
7088
|
if (keysDown.has("Minus") || keysDown.has("NumpadSubtract")) {
|
|
6931
7089
|
zoomAccumulated -= zoomStep;
|
|
7090
|
+
computedZoomPickPoint = null;
|
|
7091
|
+
}
|
|
7092
|
+
if (ctrl) {
|
|
7093
|
+
if (keysDown.has("ArrowLeft")) {
|
|
7094
|
+
rotationAccumulated.y -= rotateStep;
|
|
7095
|
+
}
|
|
7096
|
+
if (keysDown.has("ArrowRight")) {
|
|
7097
|
+
rotationAccumulated.y += rotateStep;
|
|
7098
|
+
}
|
|
7099
|
+
if (keysDown.has("ArrowUp")) {
|
|
7100
|
+
rotationAccumulated.x += rotateStep;
|
|
7101
|
+
}
|
|
7102
|
+
if (keysDown.has("ArrowDown")) {
|
|
7103
|
+
rotationAccumulated.x -= rotateStep;
|
|
7104
|
+
}
|
|
7105
|
+
return;
|
|
6932
7106
|
}
|
|
6933
7107
|
const east = { x: 0, y: 0, z: 0 };
|
|
6934
7108
|
const north = { x: 0, y: 0, z: 0 };
|
|
6935
7109
|
const up = { x: 0, y: 0, z: 0 };
|
|
6936
7110
|
let dn = 0;
|
|
6937
7111
|
let de = 0;
|
|
6938
|
-
if (keysDown.has("
|
|
7112
|
+
if (keysDown.has("ArrowUp")) {
|
|
6939
7113
|
dn += 1;
|
|
6940
7114
|
}
|
|
6941
|
-
if (keysDown.has("
|
|
7115
|
+
if (keysDown.has("ArrowDown")) {
|
|
6942
7116
|
dn -= 1;
|
|
6943
7117
|
}
|
|
6944
|
-
if (keysDown.has("
|
|
7118
|
+
if (keysDown.has("ArrowRight")) {
|
|
6945
7119
|
de += 1;
|
|
6946
7120
|
}
|
|
6947
|
-
if (keysDown.has("
|
|
7121
|
+
if (keysDown.has("ArrowLeft")) {
|
|
6948
7122
|
de -= 1;
|
|
6949
7123
|
}
|
|
6950
7124
|
if (dn !== 0 || de !== 0) {
|
|
@@ -6972,6 +7146,9 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
6972
7146
|
const dy = e.clientY - lastY;
|
|
6973
7147
|
lastX = e.clientX;
|
|
6974
7148
|
lastY = e.clientY;
|
|
7149
|
+
if (activeTouches.size >= 2) {
|
|
7150
|
+
return;
|
|
7151
|
+
}
|
|
6975
7152
|
if (mode === "none") {
|
|
6976
7153
|
return;
|
|
6977
7154
|
}
|
|
@@ -7004,6 +7181,86 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
7004
7181
|
function onKeyUp(e) {
|
|
7005
7182
|
keysDown.delete(e.code);
|
|
7006
7183
|
}
|
|
7184
|
+
function firstTwoTouches() {
|
|
7185
|
+
const it = activeTouches.values();
|
|
7186
|
+
const a = it.next().value;
|
|
7187
|
+
const b = it.next().value;
|
|
7188
|
+
return [a, b];
|
|
7189
|
+
}
|
|
7190
|
+
function onTouchStart(e) {
|
|
7191
|
+
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
7192
|
+
const t = e.changedTouches[i];
|
|
7193
|
+
activeTouches.set(t.identifier, { x: t.clientX, y: t.clientY });
|
|
7194
|
+
}
|
|
7195
|
+
if (activeTouches.size >= 2) {
|
|
7196
|
+
e.preventDefault();
|
|
7197
|
+
if (mode === "pan") {
|
|
7198
|
+
stopDrag();
|
|
7199
|
+
}
|
|
7200
|
+
mode = "none";
|
|
7201
|
+
const [p0, p1] = firstTwoTouches();
|
|
7202
|
+
pinchPrevDist = Math.hypot(p1.x - p0.x, p1.y - p0.y);
|
|
7203
|
+
pinchStartCentroidX = (p0.x + p1.x) / 2;
|
|
7204
|
+
pinchStartCentroidY = (p0.y + p1.y) / 2;
|
|
7205
|
+
pinchPanning = false;
|
|
7206
|
+
}
|
|
7207
|
+
}
|
|
7208
|
+
function onTouchMove(e) {
|
|
7209
|
+
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
7210
|
+
const t = e.changedTouches[i];
|
|
7211
|
+
if (activeTouches.has(t.identifier)) {
|
|
7212
|
+
activeTouches.set(t.identifier, { x: t.clientX, y: t.clientY });
|
|
7213
|
+
}
|
|
7214
|
+
}
|
|
7215
|
+
if (activeTouches.size < 2) {
|
|
7216
|
+
return;
|
|
7217
|
+
}
|
|
7218
|
+
e.preventDefault();
|
|
7219
|
+
activeInput = true;
|
|
7220
|
+
const [p0, p1] = firstTwoTouches();
|
|
7221
|
+
const dist2 = Math.hypot(p1.x - p0.x, p1.y - p0.y);
|
|
7222
|
+
const centroidClientX = (p0.x + p1.x) / 2;
|
|
7223
|
+
const centroidClientY = (p0.y + p1.y) / 2;
|
|
7224
|
+
const rect = canvas.getBoundingClientRect();
|
|
7225
|
+
pointerX = centroidClientX - rect.left;
|
|
7226
|
+
pointerY = centroidClientY - rect.top;
|
|
7227
|
+
const centroidDrift = Math.hypot(centroidClientX - pinchStartCentroidX, centroidClientY - pinchStartCentroidY);
|
|
7228
|
+
if (!pinchPanning && centroidDrift > PINCH_PAN_THRESHOLD) {
|
|
7229
|
+
pinchPanning = true;
|
|
7230
|
+
startDrag(pointerX, pointerY);
|
|
7231
|
+
}
|
|
7232
|
+
if (pinchPanning) {
|
|
7233
|
+
handleDrag(pointerX, pointerY);
|
|
7234
|
+
} else if (pinchPrevDist > 0) {
|
|
7235
|
+
const dDist = dist2 - pinchPrevDist;
|
|
7236
|
+
if (dDist !== 0) {
|
|
7237
|
+
zoomAccumulated += dDist * PINCH_ZOOM_SCALE;
|
|
7238
|
+
const pick = pickScreen(pointerX, pointerY);
|
|
7239
|
+
computedZoomPickPoint = pick.hit && pick.point && zoomToCursor ? pick.point : pickAlongVector(camera._lookAt);
|
|
7240
|
+
}
|
|
7241
|
+
}
|
|
7242
|
+
pinchPrevDist = dist2;
|
|
7243
|
+
}
|
|
7244
|
+
function onTouchEnd(e) {
|
|
7245
|
+
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
7246
|
+
activeTouches.delete(e.changedTouches[i].identifier);
|
|
7247
|
+
}
|
|
7248
|
+
if (activeTouches.size < 2) {
|
|
7249
|
+
if (pinchPanning) {
|
|
7250
|
+
stopDrag();
|
|
7251
|
+
pinchPanning = false;
|
|
7252
|
+
}
|
|
7253
|
+
pinchPrevDist = 0;
|
|
7254
|
+
}
|
|
7255
|
+
if (activeTouches.size === 1) {
|
|
7256
|
+
const p3 = activeTouches.values().next().value;
|
|
7257
|
+
lastX = p3.x;
|
|
7258
|
+
lastY = p3.y;
|
|
7259
|
+
}
|
|
7260
|
+
}
|
|
7261
|
+
function onGesture(e) {
|
|
7262
|
+
e.preventDefault();
|
|
7263
|
+
}
|
|
7007
7264
|
scene._beforeRender.push(onBeforeRenderTick);
|
|
7008
7265
|
const listeners = [
|
|
7009
7266
|
[canvas, "pointerdown", onPointerDown],
|
|
@@ -7011,6 +7268,12 @@ function attachGeospatialControls(camera, canvas, scene, options) {
|
|
|
7011
7268
|
[canvas, "pointerup", onPointerUp],
|
|
7012
7269
|
[canvas, "wheel", onWheel, { passive: false }],
|
|
7013
7270
|
[canvas, "contextmenu", onContextMenu],
|
|
7271
|
+
[canvas, "touchstart", onTouchStart, { passive: false }],
|
|
7272
|
+
[canvas, "touchmove", onTouchMove, { passive: false }],
|
|
7273
|
+
[canvas, "touchend", onTouchEnd],
|
|
7274
|
+
[canvas, "gesturestart", onGesture, { passive: false }],
|
|
7275
|
+
[canvas, "gesturechange", onGesture, { passive: false }],
|
|
7276
|
+
[canvas, "gestureend", onGesture, { passive: false }],
|
|
7014
7277
|
[window, "keydown", onKeyDown],
|
|
7015
7278
|
[window, "keyup", onKeyUp]
|
|
7016
7279
|
];
|
|
@@ -8951,6 +9214,117 @@ function createCylinderData(options = {}) {
|
|
|
8951
9214
|
indices: new U32(indices)
|
|
8952
9215
|
};
|
|
8953
9216
|
}
|
|
9217
|
+
function createCapsuleData(options = {}) {
|
|
9218
|
+
const subdivisions = Math.max(options.subdivisions ? options.subdivisions : 2, 1) | 0;
|
|
9219
|
+
const tessellation = Math.max(options.tessellation ? options.tessellation : 16, 3) | 0;
|
|
9220
|
+
const height = Math.max(options.height ? options.height : 1, 0);
|
|
9221
|
+
const radius = Math.max(options.radius ? options.radius : 0.25, 0);
|
|
9222
|
+
const capDetail = Math.max(options.capSubdivisions ? options.capSubdivisions : 6, 1) | 0;
|
|
9223
|
+
const radialSegments = tessellation;
|
|
9224
|
+
const heightSegments = subdivisions;
|
|
9225
|
+
const radiusTop = Math.max(options.radiusTop ? options.radiusTop : radius, 0);
|
|
9226
|
+
const radiusBottom = Math.max(options.radiusBottom ? options.radiusBottom : radius, 0);
|
|
9227
|
+
const heightMinusCaps = height - (radiusTop + radiusBottom);
|
|
9228
|
+
const thetaStart = 0;
|
|
9229
|
+
const thetaLength = 2 * Math.PI;
|
|
9230
|
+
const capsTopSegments = Math.max(options.topCapSubdivisions ? options.topCapSubdivisions : capDetail, 1);
|
|
9231
|
+
const capsBottomSegments = Math.max(options.bottomCapSubdivisions ? options.bottomCapSubdivisions : capDetail, 1);
|
|
9232
|
+
const alpha = Math.acos((radiusBottom - radiusTop) / height);
|
|
9233
|
+
let indices = [];
|
|
9234
|
+
const vertices = [];
|
|
9235
|
+
const normals = [];
|
|
9236
|
+
const uvs = [];
|
|
9237
|
+
let index = 0;
|
|
9238
|
+
const indexArray = [];
|
|
9239
|
+
const halfHeight = heightMinusCaps * 0.5;
|
|
9240
|
+
const pi2 = Math.PI * 0.5;
|
|
9241
|
+
let x;
|
|
9242
|
+
let y;
|
|
9243
|
+
const cosAlpha = Math.cos(alpha);
|
|
9244
|
+
const sinAlpha = Math.sin(alpha);
|
|
9245
|
+
const coneLengthX = radiusTop * sinAlpha - radiusBottom * sinAlpha;
|
|
9246
|
+
const coneLengthY = halfHeight + radiusTop * cosAlpha - (-halfHeight + radiusBottom * cosAlpha);
|
|
9247
|
+
const coneLength = Math.sqrt(coneLengthX * coneLengthX + coneLengthY * coneLengthY);
|
|
9248
|
+
const vl = radiusTop * alpha + coneLength + radiusBottom * (pi2 - alpha);
|
|
9249
|
+
let v = 0;
|
|
9250
|
+
for (y = 0; y <= capsTopSegments; y++) {
|
|
9251
|
+
const indexRow = [];
|
|
9252
|
+
const a = pi2 - alpha * (y / capsTopSegments);
|
|
9253
|
+
v += radiusTop * alpha / capsTopSegments;
|
|
9254
|
+
const cosA = Math.cos(a);
|
|
9255
|
+
const sinA = Math.sin(a);
|
|
9256
|
+
const ringRadius = cosA * radiusTop;
|
|
9257
|
+
for (x = 0; x <= radialSegments; x++) {
|
|
9258
|
+
const u = x / radialSegments;
|
|
9259
|
+
const theta = u * thetaLength + thetaStart;
|
|
9260
|
+
const sinTheta = Math.sin(theta);
|
|
9261
|
+
const cosTheta = Math.cos(theta);
|
|
9262
|
+
vertices.push(ringRadius * sinTheta, halfHeight + sinA * radiusTop, ringRadius * cosTheta);
|
|
9263
|
+
normals.push(cosA * sinTheta, sinA, cosA * cosTheta);
|
|
9264
|
+
uvs.push(u, 1 - v / vl);
|
|
9265
|
+
indexRow.push(index);
|
|
9266
|
+
index++;
|
|
9267
|
+
}
|
|
9268
|
+
indexArray.push(indexRow);
|
|
9269
|
+
}
|
|
9270
|
+
const coneHeight = height - radiusTop - radiusBottom + cosAlpha * radiusTop - cosAlpha * radiusBottom;
|
|
9271
|
+
const slope = sinAlpha * (radiusBottom - radiusTop) / coneHeight;
|
|
9272
|
+
for (y = 1; y <= heightSegments; y++) {
|
|
9273
|
+
const indexRow = [];
|
|
9274
|
+
v += coneLength / heightSegments;
|
|
9275
|
+
const ringRadius = sinAlpha * (y * (radiusBottom - radiusTop) / heightSegments + radiusTop);
|
|
9276
|
+
for (x = 0; x <= radialSegments; x++) {
|
|
9277
|
+
const u = x / radialSegments;
|
|
9278
|
+
const theta = u * thetaLength + thetaStart;
|
|
9279
|
+
const sinTheta = Math.sin(theta);
|
|
9280
|
+
const cosTheta = Math.cos(theta);
|
|
9281
|
+
vertices.push(ringRadius * sinTheta, halfHeight + cosAlpha * radiusTop - y * coneHeight / heightSegments, ringRadius * cosTheta);
|
|
9282
|
+
const inv = 1 / Math.sqrt(sinTheta * sinTheta + slope * slope + cosTheta * cosTheta);
|
|
9283
|
+
normals.push(sinTheta * inv, slope * inv, cosTheta * inv);
|
|
9284
|
+
uvs.push(u, 1 - v / vl);
|
|
9285
|
+
indexRow.push(index);
|
|
9286
|
+
index++;
|
|
9287
|
+
}
|
|
9288
|
+
indexArray.push(indexRow);
|
|
9289
|
+
}
|
|
9290
|
+
for (y = 1; y <= capsBottomSegments; y++) {
|
|
9291
|
+
const indexRow = [];
|
|
9292
|
+
const a = pi2 - alpha - (Math.PI - alpha) * (y / capsBottomSegments);
|
|
9293
|
+
v += radiusBottom * alpha / capsBottomSegments;
|
|
9294
|
+
const cosA = Math.cos(a);
|
|
9295
|
+
const sinA = Math.sin(a);
|
|
9296
|
+
const ringRadius = cosA * radiusBottom;
|
|
9297
|
+
for (x = 0; x <= radialSegments; x++) {
|
|
9298
|
+
const u = x / radialSegments;
|
|
9299
|
+
const theta = u * thetaLength + thetaStart;
|
|
9300
|
+
const sinTheta = Math.sin(theta);
|
|
9301
|
+
const cosTheta = Math.cos(theta);
|
|
9302
|
+
vertices.push(ringRadius * sinTheta, -halfHeight + sinA * radiusBottom, ringRadius * cosTheta);
|
|
9303
|
+
normals.push(cosA * sinTheta, sinA, cosA * cosTheta);
|
|
9304
|
+
uvs.push(u, 1 - v / vl);
|
|
9305
|
+
indexRow.push(index);
|
|
9306
|
+
index++;
|
|
9307
|
+
}
|
|
9308
|
+
indexArray.push(indexRow);
|
|
9309
|
+
}
|
|
9310
|
+
for (x = 0; x < radialSegments; x++) {
|
|
9311
|
+
for (y = 0; y < capsTopSegments + heightSegments + capsBottomSegments; y++) {
|
|
9312
|
+
const i1 = indexArray[y][x];
|
|
9313
|
+
const i22 = indexArray[y + 1][x];
|
|
9314
|
+
const i3 = indexArray[y + 1][x + 1];
|
|
9315
|
+
const i42 = indexArray[y][x + 1];
|
|
9316
|
+
indices.push(i1, i22, i42);
|
|
9317
|
+
indices.push(i22, i3, i42);
|
|
9318
|
+
}
|
|
9319
|
+
}
|
|
9320
|
+
indices = indices.reverse();
|
|
9321
|
+
return {
|
|
9322
|
+
positions: new F32(vertices),
|
|
9323
|
+
normals: new F32(normals),
|
|
9324
|
+
uvs: new F32(uvs),
|
|
9325
|
+
indices: new U32(indices)
|
|
9326
|
+
};
|
|
9327
|
+
}
|
|
8954
9328
|
function createPlaneData(options = {}) {
|
|
8955
9329
|
const size = options.size ?? 1;
|
|
8956
9330
|
const width = options.width ?? size;
|
|
@@ -9686,7 +10060,7 @@ function crossVec3(a, b) {
|
|
|
9686
10060
|
function lengthVec3(v) {
|
|
9687
10061
|
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
|
9688
10062
|
}
|
|
9689
|
-
function normalizeVec3$
|
|
10063
|
+
function normalizeVec3$2(v) {
|
|
9690
10064
|
const len2 = lengthVec3(v);
|
|
9691
10065
|
if (len2 < 1e-10) {
|
|
9692
10066
|
return { x: 0, y: 0, z: 0 };
|
|
@@ -9741,7 +10115,7 @@ function normalVector(vt, va) {
|
|
|
9741
10115
|
const c2 = crossVec3(vt, va);
|
|
9742
10116
|
n3 = crossVec3(c2, vt);
|
|
9743
10117
|
}
|
|
9744
|
-
return normalizeVec3$
|
|
10118
|
+
return normalizeVec3$2(n3);
|
|
9745
10119
|
}
|
|
9746
10120
|
function computePath3D(curve, firstNormal = null) {
|
|
9747
10121
|
const l = curve.length;
|
|
@@ -9752,18 +10126,18 @@ function computePath3D(curve, firstNormal = null) {
|
|
|
9752
10126
|
if (l < 2) {
|
|
9753
10127
|
return { tangents, normals, binormals, distances };
|
|
9754
10128
|
}
|
|
9755
|
-
tangents[0] = normalizeVec3$
|
|
9756
|
-
tangents[l - 1] = normalizeVec3$
|
|
9757
|
-
const pp0 = normalizeVec3$
|
|
10129
|
+
tangents[0] = normalizeVec3$2(getFirstNonNullVector(curve, 0));
|
|
10130
|
+
tangents[l - 1] = normalizeVec3$2(subVec3(curve[l - 1], curve[l - 2]));
|
|
10131
|
+
const pp0 = normalizeVec3$2(normalVector(tangents[0], firstNormal));
|
|
9758
10132
|
normals[0] = pp0;
|
|
9759
|
-
binormals[0] = normalizeVec3$
|
|
10133
|
+
binormals[0] = normalizeVec3$2(crossVec3(tangents[0], normals[0]));
|
|
9760
10134
|
distances[0] = 0;
|
|
9761
10135
|
for (let i = 1; i < l; i++) {
|
|
9762
10136
|
const prev = getLastNonNullVector(curve, i);
|
|
9763
10137
|
if (i < l - 1) {
|
|
9764
10138
|
const cur = getFirstNonNullVector(curve, i);
|
|
9765
10139
|
const sum = { x: prev.x + cur.x, y: prev.y + cur.y, z: prev.z + cur.z };
|
|
9766
|
-
tangents[i] = normalizeVec3$
|
|
10140
|
+
tangents[i] = normalizeVec3$2(sum);
|
|
9767
10141
|
}
|
|
9768
10142
|
distances[i] = distances[i - 1] + lengthVec3(subVec3(curve[i], curve[i - 1]));
|
|
9769
10143
|
const curTang = tangents[i];
|
|
@@ -9773,10 +10147,10 @@ function computePath3D(curve, firstNormal = null) {
|
|
|
9773
10147
|
const prevN = normals[i - 1];
|
|
9774
10148
|
n3 = { x: prevN.x, y: prevN.y, z: prevN.z };
|
|
9775
10149
|
} else {
|
|
9776
|
-
n3 = normalizeVec3$
|
|
10150
|
+
n3 = normalizeVec3$2(n3);
|
|
9777
10151
|
}
|
|
9778
10152
|
normals[i] = n3;
|
|
9779
|
-
binormals[i] = normalizeVec3$
|
|
10153
|
+
binormals[i] = normalizeVec3$2(crossVec3(curTang, n3));
|
|
9780
10154
|
}
|
|
9781
10155
|
return { tangents, normals, binormals, distances };
|
|
9782
10156
|
}
|
|
@@ -9936,7 +10310,6 @@ function createMeshFromData(engine, name, positions, normals, indices, uvs, uvs2
|
|
|
9936
10310
|
receiveShadows: false,
|
|
9937
10311
|
boundMin: isFinite(min[0]) ? min : void 0,
|
|
9938
10312
|
boundMax: isFinite(max[0]) ? max : void 0,
|
|
9939
|
-
_materialDirty: false,
|
|
9940
10313
|
_gpu: uploadMeshToGPU(engine, positions, normals, indices, uvs, uvs2, tangents, colors)
|
|
9941
10314
|
};
|
|
9942
10315
|
initMeshTransform(mesh);
|
|
@@ -10055,6 +10428,10 @@ function createCylinder(engine, options) {
|
|
|
10055
10428
|
const data = createCylinderData(options);
|
|
10056
10429
|
return createMeshFromData(engine, "cylinder", data.positions, data.normals, data.indices, data.uvs);
|
|
10057
10430
|
}
|
|
10431
|
+
function createCapsule(engine, options) {
|
|
10432
|
+
const data = createCapsuleData(options);
|
|
10433
|
+
return createMeshFromData(engine, "capsule", data.positions, data.normals, data.indices, data.uvs);
|
|
10434
|
+
}
|
|
10058
10435
|
function createPlane(engine, options) {
|
|
10059
10436
|
const data = createPlaneData(options);
|
|
10060
10437
|
return createMeshFromData(engine, "plane", data.positions, data.normals, data.indices, data.uvs);
|
|
@@ -10079,7 +10456,7 @@ function createExtrudeShape(engine, options) {
|
|
|
10079
10456
|
const data = createExtrudeShapeData(options);
|
|
10080
10457
|
return createMeshFromData(engine, "extrude", data.positions, data.normals, data.indices, data.uvs);
|
|
10081
10458
|
}
|
|
10082
|
-
function normalizeVec3(x, y, z, epsilon = 1e-10) {
|
|
10459
|
+
function normalizeVec3$1(x, y, z, epsilon = 1e-10) {
|
|
10083
10460
|
const len2 = Math.hypot(x, y, z);
|
|
10084
10461
|
if (len2 <= epsilon) {
|
|
10085
10462
|
return [0, 1, 0];
|
|
@@ -10226,7 +10603,7 @@ function planeFromVertices(a, b, c2) {
|
|
|
10226
10603
|
const cax = c2.x - a.x;
|
|
10227
10604
|
const cay = c2.y - a.y;
|
|
10228
10605
|
const caz = c2.z - a.z;
|
|
10229
|
-
const [nx, ny, nz] = normalizeVec3(cay * baz - caz * bay, caz * bax - cax * baz, cax * bay - cay * bax, 1e-20);
|
|
10606
|
+
const [nx, ny, nz] = normalizeVec3$1(cay * baz - caz * bay, caz * bax - cax * baz, cax * bay - cay * bax, 1e-20);
|
|
10230
10607
|
return new CsgPlane(nx, ny, nz, nx * a.x + ny * a.y + nz * a.z);
|
|
10231
10608
|
}
|
|
10232
10609
|
function triangleArea2(a, b, c2) {
|
|
@@ -10245,7 +10622,7 @@ function interpolateVertex(a, b, t) {
|
|
|
10245
10622
|
const nx = a.nx + (b.nx - a.nx) * t;
|
|
10246
10623
|
const ny = a.ny + (b.ny - a.ny) * t;
|
|
10247
10624
|
const nz = a.nz + (b.nz - a.nz) * t;
|
|
10248
|
-
const [nnx, nny, nnz] = normalizeVec3(nx, ny, nz, 1e-20);
|
|
10625
|
+
const [nnx, nny, nnz] = normalizeVec3$1(nx, ny, nz, 1e-20);
|
|
10249
10626
|
return {
|
|
10250
10627
|
x: a.x + (b.x - a.x) * t,
|
|
10251
10628
|
y: a.y + (b.y - a.y) * t,
|
|
@@ -10321,9 +10698,9 @@ function transformPoint$1(m2, x, y, z) {
|
|
|
10321
10698
|
}
|
|
10322
10699
|
function transformNormal$1(m2, inv, x, y, z) {
|
|
10323
10700
|
if (inv) {
|
|
10324
|
-
return normalizeVec3(inv[0] * x + inv[1] * y + inv[2] * z, inv[4] * x + inv[5] * y + inv[6] * z, inv[8] * x + inv[9] * y + inv[10] * z, 1e-20);
|
|
10701
|
+
return normalizeVec3$1(inv[0] * x + inv[1] * y + inv[2] * z, inv[4] * x + inv[5] * y + inv[6] * z, inv[8] * x + inv[9] * y + inv[10] * z, 1e-20);
|
|
10325
10702
|
}
|
|
10326
|
-
return normalizeVec3(m2[0] * x + m2[4] * y + m2[8] * z, m2[1] * x + m2[5] * y + m2[9] * z, m2[2] * x + m2[6] * y + m2[10] * z, 1e-20);
|
|
10703
|
+
return normalizeVec3$1(m2[0] * x + m2[4] * y + m2[8] * z, m2[1] * x + m2[5] * y + m2[9] * z, m2[2] * x + m2[6] * y + m2[10] * z, 1e-20);
|
|
10327
10704
|
}
|
|
10328
10705
|
function requireCpuGeometry$1(mesh) {
|
|
10329
10706
|
if (!mesh._cpuPositions) {
|
|
@@ -10473,9 +10850,9 @@ function transformPoint(m2, x, y, z) {
|
|
|
10473
10850
|
}
|
|
10474
10851
|
function transformNormal(m2, inv, x, y, z) {
|
|
10475
10852
|
if (inv) {
|
|
10476
|
-
return normalizeVec3(inv[0] * x + inv[1] * y + inv[2] * z, inv[4] * x + inv[5] * y + inv[6] * z, inv[8] * x + inv[9] * y + inv[10] * z, 1e-20);
|
|
10853
|
+
return normalizeVec3$1(inv[0] * x + inv[1] * y + inv[2] * z, inv[4] * x + inv[5] * y + inv[6] * z, inv[8] * x + inv[9] * y + inv[10] * z, 1e-20);
|
|
10477
10854
|
}
|
|
10478
|
-
return normalizeVec3(m2[0] * x + m2[4] * y + m2[8] * z, m2[1] * x + m2[5] * y + m2[9] * z, m2[2] * x + m2[6] * y + m2[10] * z, 1e-20);
|
|
10855
|
+
return normalizeVec3$1(m2[0] * x + m2[4] * y + m2[8] * z, m2[1] * x + m2[5] * y + m2[9] * z, m2[2] * x + m2[6] * y + m2[10] * z, 1e-20);
|
|
10479
10856
|
}
|
|
10480
10857
|
function requireCpuGeometry(mesh) {
|
|
10481
10858
|
if (!mesh._cpuPositions) {
|
|
@@ -10919,7 +11296,7 @@ function parseKtx1(buffer) {
|
|
|
10919
11296
|
}
|
|
10920
11297
|
return { format, width, height, mips };
|
|
10921
11298
|
}
|
|
10922
|
-
function uploadCompressed(engine, parsed, opts) {
|
|
11299
|
+
function uploadCompressed$1(engine, parsed, opts) {
|
|
10923
11300
|
const device = engine._device;
|
|
10924
11301
|
const fmt = parsed.format;
|
|
10925
11302
|
const texture = device.createTexture({
|
|
@@ -10985,7 +11362,7 @@ async function loadKtxTexture2D(engine, baseUrl, suffixes, opts = {}) {
|
|
|
10985
11362
|
throw new Error(`KTX fetch failed: ${resp.status}`);
|
|
10986
11363
|
}
|
|
10987
11364
|
const parsed = parseKtx1(await resp.arrayBuffer());
|
|
10988
|
-
return uploadCompressed(engine, parsed, opts);
|
|
11365
|
+
return uploadCompressed$1(engine, parsed, opts);
|
|
10989
11366
|
} catch (e) {
|
|
10990
11367
|
console.warn(`KTX load failed for suffix "${suffix}":`, e);
|
|
10991
11368
|
}
|
|
@@ -11177,6 +11554,222 @@ async function loadBasisTexture2D(engine, url, opts = {}) {
|
|
|
11177
11554
|
file.delete();
|
|
11178
11555
|
}
|
|
11179
11556
|
}
|
|
11557
|
+
let _ktx2DecoderUrl = "https://cdn.babylonjs.com/babylon.ktx2Decoder.js";
|
|
11558
|
+
let _ktx2WasmUrls = null;
|
|
11559
|
+
function setKtx2DecoderUrl(url, wasmUrls) {
|
|
11560
|
+
_ktx2DecoderUrl = url;
|
|
11561
|
+
_ktx2WasmUrls = wasmUrls ?? null;
|
|
11562
|
+
}
|
|
11563
|
+
let _ktx2DecoderPromise = null;
|
|
11564
|
+
const GL_RGBA8 = 32856;
|
|
11565
|
+
const GL_R8 = 33321;
|
|
11566
|
+
const GL_RG8 = 33323;
|
|
11567
|
+
const RGBA_CAPS = { astc: false, bptc: false, s3tc: false, pvrtc: false, etc2: false, etc1: false };
|
|
11568
|
+
function loadKtx2Decoder() {
|
|
11569
|
+
if (_ktx2DecoderPromise) {
|
|
11570
|
+
return _ktx2DecoderPromise;
|
|
11571
|
+
}
|
|
11572
|
+
_ktx2DecoderPromise = new Promise((resolve, reject) => {
|
|
11573
|
+
const w = globalThis;
|
|
11574
|
+
const init = () => {
|
|
11575
|
+
const mod = w.KTX2DECODER;
|
|
11576
|
+
if (!mod) {
|
|
11577
|
+
reject(new Error("KTX2: decoder global KTX2DECODER not found after script load"));
|
|
11578
|
+
return;
|
|
11579
|
+
}
|
|
11580
|
+
mod.MSCTranscoder.UseFromWorkerThread = false;
|
|
11581
|
+
mod.WASMMemoryManager.LoadBinariesFromCurrentThread = true;
|
|
11582
|
+
if (_ktx2WasmUrls) {
|
|
11583
|
+
const m2 = mod;
|
|
11584
|
+
for (const tName of Object.keys(_ktx2WasmUrls)) {
|
|
11585
|
+
const t = m2[tName];
|
|
11586
|
+
if (t) {
|
|
11587
|
+
for (const prop of Object.keys(_ktx2WasmUrls[tName])) {
|
|
11588
|
+
t[prop] = _ktx2WasmUrls[tName][prop];
|
|
11589
|
+
}
|
|
11590
|
+
}
|
|
11591
|
+
}
|
|
11592
|
+
}
|
|
11593
|
+
resolve(new mod.KTX2Decoder());
|
|
11594
|
+
};
|
|
11595
|
+
if (w.KTX2DECODER) {
|
|
11596
|
+
init();
|
|
11597
|
+
return;
|
|
11598
|
+
}
|
|
11599
|
+
const script = document.createElement("script");
|
|
11600
|
+
script.src = _ktx2DecoderUrl;
|
|
11601
|
+
script.async = true;
|
|
11602
|
+
script.onload = init;
|
|
11603
|
+
script.onerror = () => reject(new Error(`KTX2: failed to load ${script.src}`));
|
|
11604
|
+
document.head.appendChild(script);
|
|
11605
|
+
});
|
|
11606
|
+
_ktx2DecoderPromise.catch(() => {
|
|
11607
|
+
_ktx2DecoderPromise = null;
|
|
11608
|
+
});
|
|
11609
|
+
return _ktx2DecoderPromise;
|
|
11610
|
+
}
|
|
11611
|
+
function srgbFormat(format) {
|
|
11612
|
+
switch (format) {
|
|
11613
|
+
case "rgba8unorm":
|
|
11614
|
+
return "rgba8unorm-srgb";
|
|
11615
|
+
case "bc1-rgba-unorm":
|
|
11616
|
+
return "bc1-rgba-unorm-srgb";
|
|
11617
|
+
case "bc2-rgba-unorm":
|
|
11618
|
+
return "bc2-rgba-unorm-srgb";
|
|
11619
|
+
case "bc3-rgba-unorm":
|
|
11620
|
+
return "bc3-rgba-unorm-srgb";
|
|
11621
|
+
case "bc7-rgba-unorm":
|
|
11622
|
+
return "bc7-rgba-unorm-srgb";
|
|
11623
|
+
case "etc2-rgb8unorm":
|
|
11624
|
+
return "etc2-rgb8unorm-srgb";
|
|
11625
|
+
case "etc2-rgb8a1unorm":
|
|
11626
|
+
return "etc2-rgb8a1unorm-srgb";
|
|
11627
|
+
case "etc2-rgba8unorm":
|
|
11628
|
+
return "etc2-rgba8unorm-srgb";
|
|
11629
|
+
case "astc-4x4-unorm":
|
|
11630
|
+
return "astc-4x4-unorm-srgb";
|
|
11631
|
+
case "astc-5x4-unorm":
|
|
11632
|
+
return "astc-5x4-unorm-srgb";
|
|
11633
|
+
case "astc-5x5-unorm":
|
|
11634
|
+
return "astc-5x5-unorm-srgb";
|
|
11635
|
+
case "astc-6x5-unorm":
|
|
11636
|
+
return "astc-6x5-unorm-srgb";
|
|
11637
|
+
case "astc-6x6-unorm":
|
|
11638
|
+
return "astc-6x6-unorm-srgb";
|
|
11639
|
+
case "astc-8x5-unorm":
|
|
11640
|
+
return "astc-8x5-unorm-srgb";
|
|
11641
|
+
case "astc-8x6-unorm":
|
|
11642
|
+
return "astc-8x6-unorm-srgb";
|
|
11643
|
+
case "astc-8x8-unorm":
|
|
11644
|
+
return "astc-8x8-unorm-srgb";
|
|
11645
|
+
case "astc-10x5-unorm":
|
|
11646
|
+
return "astc-10x5-unorm-srgb";
|
|
11647
|
+
case "astc-10x6-unorm":
|
|
11648
|
+
return "astc-10x6-unorm-srgb";
|
|
11649
|
+
case "astc-10x8-unorm":
|
|
11650
|
+
return "astc-10x8-unorm-srgb";
|
|
11651
|
+
case "astc-10x10-unorm":
|
|
11652
|
+
return "astc-10x10-unorm-srgb";
|
|
11653
|
+
case "astc-12x10-unorm":
|
|
11654
|
+
return "astc-12x10-unorm-srgb";
|
|
11655
|
+
case "astc-12x12-unorm":
|
|
11656
|
+
return "astc-12x12-unorm-srgb";
|
|
11657
|
+
default:
|
|
11658
|
+
return format;
|
|
11659
|
+
}
|
|
11660
|
+
}
|
|
11661
|
+
function uncompressedInfo(glFormat) {
|
|
11662
|
+
switch (glFormat) {
|
|
11663
|
+
case GL_RGBA8:
|
|
11664
|
+
return { format: "rgba8unorm", bytesPerPixel: 4 };
|
|
11665
|
+
case GL_R8:
|
|
11666
|
+
return { format: "r8unorm", bytesPerPixel: 1 };
|
|
11667
|
+
case GL_RG8:
|
|
11668
|
+
return { format: "rg8unorm", bytesPerPixel: 2 };
|
|
11669
|
+
default:
|
|
11670
|
+
return null;
|
|
11671
|
+
}
|
|
11672
|
+
}
|
|
11673
|
+
function validateDecoded(decoded) {
|
|
11674
|
+
var _a;
|
|
11675
|
+
if (decoded.errors) {
|
|
11676
|
+
throw new Error(`KTX2: ${decoded.errors}`);
|
|
11677
|
+
}
|
|
11678
|
+
if (!decoded.mipmaps.length) {
|
|
11679
|
+
throw new Error("KTX2: decoder produced no mipmaps");
|
|
11680
|
+
}
|
|
11681
|
+
for (let i = 0; i < decoded.mipmaps.length; i++) {
|
|
11682
|
+
if (!((_a = decoded.mipmaps[i]) == null ? void 0 : _a.data)) {
|
|
11683
|
+
throw new Error(`KTX2: decoder produced an empty mip ${i}`);
|
|
11684
|
+
}
|
|
11685
|
+
}
|
|
11686
|
+
return decoded.mipmaps;
|
|
11687
|
+
}
|
|
11688
|
+
function makeSampler(engine, mipCount) {
|
|
11689
|
+
return getOrCreateSampler(engine, {
|
|
11690
|
+
addressModeU: "repeat",
|
|
11691
|
+
addressModeV: "repeat",
|
|
11692
|
+
minFilter: "linear",
|
|
11693
|
+
magFilter: "linear",
|
|
11694
|
+
mipmapFilter: mipCount > 1 ? "linear" : "nearest",
|
|
11695
|
+
maxAnisotropy: mipCount > 1 ? 4 : 1
|
|
11696
|
+
});
|
|
11697
|
+
}
|
|
11698
|
+
function uploadCompressed(engine, mips, format, sRGB) {
|
|
11699
|
+
if (!engine._device.features.has(format.feature)) {
|
|
11700
|
+
throw new Error(`KTX2: device does not support ${format.feature}`);
|
|
11701
|
+
}
|
|
11702
|
+
const width = mips[0].width;
|
|
11703
|
+
const height = mips[0].height;
|
|
11704
|
+
const texture = engine._device.createTexture({
|
|
11705
|
+
size: { width, height },
|
|
11706
|
+
format: sRGB ? srgbFormat(format.gpuFormat) : format.gpuFormat,
|
|
11707
|
+
mipLevelCount: mips.length,
|
|
11708
|
+
usage: TU.TEXTURE_BINDING | TU.COPY_DST
|
|
11709
|
+
});
|
|
11710
|
+
for (let level = 0; level < mips.length; level++) {
|
|
11711
|
+
const mip = mips[level];
|
|
11712
|
+
const blocksPerRow = Math.ceil(mip.width / format.blockW);
|
|
11713
|
+
const rowBytes = blocksPerRow * format.blockBytes;
|
|
11714
|
+
const copyW = blocksPerRow * format.blockW;
|
|
11715
|
+
const copyH = Math.ceil(mip.height / format.blockH) * format.blockH;
|
|
11716
|
+
engine._device.queue.writeTexture({ texture, mipLevel: level }, mip.data, { bytesPerRow: rowBytes }, { width: copyW, height: copyH });
|
|
11717
|
+
}
|
|
11718
|
+
const tex2d = { texture, view: texture.createView(), sampler: makeSampler(engine, mips.length), width, height, invertY: true };
|
|
11719
|
+
acquireTexture(tex2d);
|
|
11720
|
+
return tex2d;
|
|
11721
|
+
}
|
|
11722
|
+
function uploadUncompressed(engine, mips, info, sRGB) {
|
|
11723
|
+
const width = mips[0].width;
|
|
11724
|
+
const height = mips[0].height;
|
|
11725
|
+
const texture = engine._device.createTexture({
|
|
11726
|
+
size: { width, height },
|
|
11727
|
+
format: sRGB ? srgbFormat(info.format) : info.format,
|
|
11728
|
+
mipLevelCount: mips.length,
|
|
11729
|
+
usage: TU.TEXTURE_BINDING | TU.COPY_DST
|
|
11730
|
+
});
|
|
11731
|
+
for (let level = 0; level < mips.length; level++) {
|
|
11732
|
+
const mip = mips[level];
|
|
11733
|
+
const expected = mip.width * mip.height * info.bytesPerPixel;
|
|
11734
|
+
if (mip.data.length !== expected) {
|
|
11735
|
+
throw new Error(`KTX2: uncompressed mip ${level} has ${mip.data.length} bytes, expected ${expected}`);
|
|
11736
|
+
}
|
|
11737
|
+
engine._device.queue.writeTexture(
|
|
11738
|
+
{ texture, mipLevel: level },
|
|
11739
|
+
mip.data,
|
|
11740
|
+
{ bytesPerRow: mip.width * info.bytesPerPixel },
|
|
11741
|
+
{ width: mip.width, height: mip.height }
|
|
11742
|
+
);
|
|
11743
|
+
}
|
|
11744
|
+
const tex2d = { texture, view: texture.createView(), sampler: makeSampler(engine, mips.length), width, height, invertY: true };
|
|
11745
|
+
acquireTexture(tex2d);
|
|
11746
|
+
return tex2d;
|
|
11747
|
+
}
|
|
11748
|
+
async function uploadKtx2Texture2D(engine, buffer, sRGB) {
|
|
11749
|
+
const decoder = await loadKtx2Decoder();
|
|
11750
|
+
const decoded = await decoder.decode(new U8(buffer), RGBA_CAPS, { forceRGBA: true });
|
|
11751
|
+
const mips = validateDecoded(decoded);
|
|
11752
|
+
const compressed = getCompressedFormat(decoded.transcodedFormat);
|
|
11753
|
+
if (compressed) {
|
|
11754
|
+
return uploadCompressed(engine, mips, compressed, sRGB);
|
|
11755
|
+
}
|
|
11756
|
+
const uncompressed = uncompressedInfo(decoded.transcodedFormat);
|
|
11757
|
+
if (uncompressed) {
|
|
11758
|
+
return uploadUncompressed(engine, mips, uncompressed, sRGB);
|
|
11759
|
+
}
|
|
11760
|
+
throw new Error(`KTX2: unsupported transcoded format 0x${decoded.transcodedFormat.toString(16)}`);
|
|
11761
|
+
}
|
|
11762
|
+
async function decodeKtx2ImageBitmapFromBuffer(buffer) {
|
|
11763
|
+
const decoder = await loadKtx2Decoder();
|
|
11764
|
+
const decoded = await decoder.decode(new U8(buffer), RGBA_CAPS, { forceRGBA: true });
|
|
11765
|
+
const mip0 = validateDecoded(decoded)[0];
|
|
11766
|
+
if (mip0.data.length !== mip0.width * mip0.height * 4) {
|
|
11767
|
+
throw new Error("KTX2: RGBA decode size does not match image dimensions");
|
|
11768
|
+
}
|
|
11769
|
+
const pixels = new U8C(mip0.data.length);
|
|
11770
|
+
pixels.set(mip0.data);
|
|
11771
|
+
return createImageBitmap(new ImageData(pixels, mip0.width, mip0.height));
|
|
11772
|
+
}
|
|
11180
11773
|
const HAS_DIFFUSE_TEXTURE = 1 << 0;
|
|
11181
11774
|
const HAS_EMISSIVE_TEXTURE = 1 << 1;
|
|
11182
11775
|
const HAS_BUMP_TEXTURE = 1 << 2;
|
|
@@ -11217,14 +11810,14 @@ function _getStdExtsSorted() {
|
|
|
11217
11810
|
const NEEDS_UV = HAS_DIFFUSE_TEXTURE | HAS_EMISSIVE_TEXTURE | HAS_BUMP_TEXTURE | HAS_SPECULAR_TEXTURE | HAS_AMBIENT_TEXTURE | HAS_LIGHTMAP_TEXTURE | HAS_OPACITY_TEXTURE;
|
|
11218
11811
|
const NEEDS_UV2 = LIGHTMAP_USES_UV2 | AMBIENT_USES_UV2 | DIFFUSE_USES_UV2 | SPECULAR_USES_UV2;
|
|
11219
11812
|
const _STD_MAT_EXTS = [
|
|
11220
|
-
["bumpTexture", () => import("./normal-map-fragment-
|
|
11221
|
-
["emissiveTexture", () => import("./std-emissive-fragment-
|
|
11222
|
-
["specularTexture", () => import("./std-specular-fragment-
|
|
11223
|
-
["ambientTexture", () => import("./std-ambient-fragment-
|
|
11224
|
-
["lightmapTexture", () => import("./std-lightmap-fragment-
|
|
11225
|
-
["opacityTexture", () => import("./std-opacity-fragment-
|
|
11226
|
-
["reflectionTexture", () => import("./std-reflection-fragment-
|
|
11227
|
-
["reflectionCubeTexture", () => import("./std-cube-reflection-fragment-
|
|
11813
|
+
["bumpTexture", () => import("./normal-map-fragment-sE3TjF4U.js"), "bumpStdExt"],
|
|
11814
|
+
["emissiveTexture", () => import("./std-emissive-fragment-Bj62X4Np.js"), "stdEmissiveExt"],
|
|
11815
|
+
["specularTexture", () => import("./std-specular-fragment-Bio681OG.js"), "stdSpecularExt"],
|
|
11816
|
+
["ambientTexture", () => import("./std-ambient-fragment-__F1KTEu.js"), "stdAmbientExt"],
|
|
11817
|
+
["lightmapTexture", () => import("./std-lightmap-fragment-DXvfWvKc.js"), "stdLightmapExt"],
|
|
11818
|
+
["opacityTexture", () => import("./std-opacity-fragment-BzMMb1K_.js"), "stdOpacityExt"],
|
|
11819
|
+
["reflectionTexture", () => import("./std-reflection-fragment-DC9Kvu1C.js"), "stdReflectionExt"],
|
|
11820
|
+
["reflectionCubeTexture", () => import("./std-cube-reflection-fragment-DidM0byH.js"), "stdCubeReflectionExt"]
|
|
11228
11821
|
];
|
|
11229
11822
|
const standardGroupBuilder = async (scene, meshes) => {
|
|
11230
11823
|
const hasTI = meshes.some((m2) => !!m2.thinInstances);
|
|
@@ -11240,7 +11833,7 @@ const standardGroupBuilder = async (scene, meshes) => {
|
|
|
11240
11833
|
const imports = [];
|
|
11241
11834
|
if (hasTI) {
|
|
11242
11835
|
imports.push(
|
|
11243
|
-
import("./thin-instance-gpu-
|
|
11836
|
+
import("./thin-instance-gpu-uY2NOv0J.js").then((m2) => {
|
|
11244
11837
|
tiSync = m2.syncThinInstanceBuffers;
|
|
11245
11838
|
}),
|
|
11246
11839
|
import("./thin-instance-fragment-hsv-RyDs.js").then((m2) => {
|
|
@@ -11249,7 +11842,7 @@ const standardGroupBuilder = async (scene, meshes) => {
|
|
|
11249
11842
|
);
|
|
11250
11843
|
if (hasCulling) {
|
|
11251
11844
|
imports.push(
|
|
11252
|
-
import("./thin-instance-cull-binding-
|
|
11845
|
+
import("./thin-instance-cull-binding-DwZi7mlE.js").then((m2) => {
|
|
11253
11846
|
cull = m2;
|
|
11254
11847
|
})
|
|
11255
11848
|
);
|
|
@@ -11257,7 +11850,7 @@ const standardGroupBuilder = async (scene, meshes) => {
|
|
|
11257
11850
|
}
|
|
11258
11851
|
if (hasShadow) {
|
|
11259
11852
|
imports.push(
|
|
11260
|
-
import("./std-shadow-fragment-
|
|
11853
|
+
import("./std-shadow-fragment-BnMHeF1-.js").then((m2) => {
|
|
11261
11854
|
shadowFragment = m2.createStdShadowFragment;
|
|
11262
11855
|
})
|
|
11263
11856
|
);
|
|
@@ -11270,7 +11863,7 @@ const standardGroupBuilder = async (scene, meshes) => {
|
|
|
11270
11863
|
if (imports.length > 0) {
|
|
11271
11864
|
await Promise.all(imports);
|
|
11272
11865
|
}
|
|
11273
|
-
const renderableMod = await import("./standard-renderable-
|
|
11866
|
+
const renderableMod = await import("./standard-renderable-1Q3zemys.js");
|
|
11274
11867
|
const result = renderableMod.buildStandardMeshRenderables(scene, meshes, { tiSync, tiFragment, shadowFragment, cull });
|
|
11275
11868
|
standardGroupBuilder._rebuildSingle = result.rebuildSingle;
|
|
11276
11869
|
return result;
|
|
@@ -11322,7 +11915,7 @@ const noColorView$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defin
|
|
|
11322
11915
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
11323
11916
|
const pbrGroupBuilder = async (scene, meshes) => {
|
|
11324
11917
|
const envTex = scene._envTextures;
|
|
11325
|
-
const renderableMod = await import("./pbr-renderable-
|
|
11918
|
+
const renderableMod = await import("./pbr-renderable-CaHKHU0g.js").then((n3) => n3.p);
|
|
11326
11919
|
const result = await renderableMod.buildPbrRenderables(scene, meshes, envTex);
|
|
11327
11920
|
pbrGroupBuilder._rebuildSingle = result.rebuildSingle;
|
|
11328
11921
|
return result;
|
|
@@ -11407,7 +12000,7 @@ const pbrMaterial = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
11407
12000
|
pbrGroupBuilder
|
|
11408
12001
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
11409
12002
|
const shaderGroupBuilder = async (scene, meshes) => {
|
|
11410
|
-
const { buildShaderGroup } = await import("./shader-renderable-
|
|
12003
|
+
const { buildShaderGroup } = await import("./shader-renderable-D5sbgzxt.js");
|
|
11411
12004
|
const result = await buildShaderGroup(scene, meshes);
|
|
11412
12005
|
shaderGroupBuilder._rebuildSingle = result.rebuildSingle;
|
|
11413
12006
|
return result;
|
|
@@ -11485,6 +12078,14 @@ function createShaderMaterial(options) {
|
|
|
11485
12078
|
samplerDecls.push(decl);
|
|
11486
12079
|
textureSlots.set(decl.name, { decl, current: null });
|
|
11487
12080
|
}
|
|
12081
|
+
const storageBufferDecls = [];
|
|
12082
|
+
const storageBufferSlots = /* @__PURE__ */ new Map();
|
|
12083
|
+
for (const opt of options.storageBuffers ?? []) {
|
|
12084
|
+
assertIdentifier("storage buffer", opt.name);
|
|
12085
|
+
assertUniqueName(usedNames, "storage buffer", opt.name);
|
|
12086
|
+
storageBufferDecls.push(opt);
|
|
12087
|
+
storageBufferSlots.set(opt.name, { decl: opt, current: null });
|
|
12088
|
+
}
|
|
11488
12089
|
const defines = [];
|
|
11489
12090
|
for (const [name, value] of Object.entries(options.defines ?? {})) {
|
|
11490
12091
|
assertIdentifier("define", name);
|
|
@@ -11505,6 +12106,7 @@ function createShaderMaterial(options) {
|
|
|
11505
12106
|
attributes,
|
|
11506
12107
|
uniformDecls,
|
|
11507
12108
|
samplerDecls,
|
|
12109
|
+
storageBufferDecls,
|
|
11508
12110
|
defines,
|
|
11509
12111
|
needAlphaBlending: options.needAlphaBlending ?? false,
|
|
11510
12112
|
blendMode: options.blendMode ?? "alpha",
|
|
@@ -11513,12 +12115,14 @@ function createShaderMaterial(options) {
|
|
|
11513
12115
|
backFaceCulling: options.backFaceCulling ?? true,
|
|
11514
12116
|
depthWrite: options.depthWrite ?? true,
|
|
11515
12117
|
depthCompare: options.depthCompare ?? "greater-equal",
|
|
12118
|
+
depthOnlyFragment: options.depthOnlyFragment ?? false,
|
|
11516
12119
|
depthBias: options.depthBias ?? 0,
|
|
11517
12120
|
depthBiasSlopeScale: options.depthBiasSlopeScale ?? 0,
|
|
11518
12121
|
_buildGroup: shaderGroupBuilder,
|
|
11519
12122
|
_uboVersion: 0,
|
|
11520
12123
|
_uniformValues: uniformValues,
|
|
11521
12124
|
_textureSlots: textureSlots,
|
|
12125
|
+
_storageBufferSlots: storageBufferSlots,
|
|
11522
12126
|
_uniformVersion: 0,
|
|
11523
12127
|
_resourceVersion: 0
|
|
11524
12128
|
};
|
|
@@ -11603,6 +12207,14 @@ function setShaderTexture(material, name, texture) {
|
|
|
11603
12207
|
slot.current = texture;
|
|
11604
12208
|
material._resourceVersion++;
|
|
11605
12209
|
}
|
|
12210
|
+
function setShaderStorageBuffer(material, name, buffer) {
|
|
12211
|
+
const slot = material._storageBufferSlots.get(name);
|
|
12212
|
+
if (!slot) {
|
|
12213
|
+
throw new Error(`ShaderMaterial: storage buffer "${name}" was not declared.`);
|
|
12214
|
+
}
|
|
12215
|
+
slot.current = buffer;
|
|
12216
|
+
material._resourceVersion++;
|
|
12217
|
+
}
|
|
11606
12218
|
function setShaderFloat(material, name, value) {
|
|
11607
12219
|
setShaderUniform(material, name, value);
|
|
11608
12220
|
}
|
|
@@ -12073,11 +12685,11 @@ const SENTINEL_FRONT_FACING = "_NME_FRONT_FACING_";
|
|
|
12073
12685
|
const SENTINEL_FRAG_COORD = "_NME_FRAG_COORD_";
|
|
12074
12686
|
const SENTINEL_SCREEN_SIZE = "_NME_SCREEN_SIZE_";
|
|
12075
12687
|
let _cache$2 = null;
|
|
12076
|
-
let _cachedDevice$
|
|
12688
|
+
let _cachedDevice$2 = null;
|
|
12077
12689
|
function getCache(engine) {
|
|
12078
|
-
if (!_cache$2 || _cachedDevice$
|
|
12690
|
+
if (!_cache$2 || _cachedDevice$2 !== engine._device) {
|
|
12079
12691
|
_cache$2 = /* @__PURE__ */ new Map();
|
|
12080
|
-
_cachedDevice$
|
|
12692
|
+
_cachedDevice$2 = engine._device;
|
|
12081
12693
|
}
|
|
12082
12694
|
return _cache$2;
|
|
12083
12695
|
}
|
|
@@ -12435,12 +13047,12 @@ async function parseNodeMaterialFromSnippet(engine, snippetId, options = {}) {
|
|
|
12435
13047
|
let envHelpers = null;
|
|
12436
13048
|
let _envEmitter;
|
|
12437
13049
|
if (state.usesEnv) {
|
|
12438
|
-
envHelpers = await import("./node-env-
|
|
13050
|
+
envHelpers = await import("./node-env-B2bjGcMS.js");
|
|
12439
13051
|
_envEmitter = envHelpers.emitEnv;
|
|
12440
13052
|
}
|
|
12441
13053
|
let _shadowEmitter;
|
|
12442
13054
|
if (options.shadowGenerators && options.shadowGenerators.length > 0) {
|
|
12443
|
-
_shadowEmitter = (await import("./node-shadow-
|
|
13055
|
+
_shadowEmitter = (await import("./node-shadow-BRiz7CT1.js")).emitShadow;
|
|
12444
13056
|
}
|
|
12445
13057
|
const compile = compileNodePipeline(state, vertexWgsl, fragmentWgsl, {
|
|
12446
13058
|
_engine: engine,
|
|
@@ -12529,7 +13141,7 @@ async function parseNodeMaterialFromSnippet(engine, snippetId, options = {}) {
|
|
|
12529
13141
|
inputs[tb._name] = handle;
|
|
12530
13142
|
}
|
|
12531
13143
|
const _buildGroup = async (scene, meshes) => {
|
|
12532
|
-
const { buildNodeMeshRenderables } = await import("./node-renderable-
|
|
13144
|
+
const { buildNodeMeshRenderables } = await import("./node-renderable-BMHny4tC.js");
|
|
12533
13145
|
const result = buildNodeMeshRenderables(scene, meshes);
|
|
12534
13146
|
_buildGroup._rebuildSingle = result.rebuildSingle;
|
|
12535
13147
|
return result;
|
|
@@ -12569,7 +13181,7 @@ async function resolvePbrMrHelpers(state) {
|
|
|
12569
13181
|
if (state.pbrMrHelperRequests.some((request) => !isCorePbrMrRequest(request))) {
|
|
12570
13182
|
throw new Error("NodeMaterial: advanced PBR-MR helper request must be emitted by the full PBR-MR block");
|
|
12571
13183
|
}
|
|
12572
|
-
const core = await import("./pbr-mr-helper-core-
|
|
13184
|
+
const core = await import("./pbr-mr-helper-core-DGRgbRXl.js");
|
|
12573
13185
|
for (const request of state.pbrMrHelperRequests) {
|
|
12574
13186
|
state.fragment.helpers.set(request.key, core.buildPbrMrHelperCore(request));
|
|
12575
13187
|
}
|
|
@@ -12687,7 +13299,7 @@ function hasBlockEmitter(key) {
|
|
|
12687
13299
|
function baseBlockLoader(key) {
|
|
12688
13300
|
switch (key) {
|
|
12689
13301
|
case "InputBlock":
|
|
12690
|
-
return () => import("./input-block-
|
|
13302
|
+
return () => import("./input-block-DbRYCnet.js");
|
|
12691
13303
|
case "VectorMergerBlock":
|
|
12692
13304
|
return () => import("./vector-merger-CrW-ONB0.js");
|
|
12693
13305
|
case "FragmentOutputBlock":
|
|
@@ -12719,7 +13331,7 @@ function baseBlockLoader(key) {
|
|
|
12719
13331
|
case "LerpBlock":
|
|
12720
13332
|
return () => import("./lerp-block-DjI2SfmI.js");
|
|
12721
13333
|
case "ClampBlock":
|
|
12722
|
-
return () => import("./clamp-block-
|
|
13334
|
+
return () => import("./clamp-block-XHdUk2Va.js");
|
|
12723
13335
|
case "SmoothStepBlock":
|
|
12724
13336
|
return () => import("./smoothstep-block-Di4t37x-.js");
|
|
12725
13337
|
case "RemapBlock":
|
|
@@ -12743,7 +13355,7 @@ function baseBlockLoader(key) {
|
|
|
12743
13355
|
case "ViewDirectionBlock":
|
|
12744
13356
|
return () => import("./view-direction-CWVucfnT.js");
|
|
12745
13357
|
case "LightBlock":
|
|
12746
|
-
return () => import("./light-block-
|
|
13358
|
+
return () => import("./light-block-CAqWkucp.js");
|
|
12747
13359
|
case "LightInformationBlock":
|
|
12748
13360
|
return () => import("./light-information-VJbW0jbs.js");
|
|
12749
13361
|
case "FogBlock":
|
|
@@ -12763,9 +13375,9 @@ function baseBlockLoader(key) {
|
|
|
12763
13375
|
case "ReflectionTextureBlock":
|
|
12764
13376
|
return () => import("./reflection-texture-block-C3QtzoV8.js");
|
|
12765
13377
|
case "PBRMetallicRoughnessBlock":
|
|
12766
|
-
return () => import("./pbr-metallic-roughness-block-
|
|
13378
|
+
return () => import("./pbr-metallic-roughness-block-DbozMlHU.js");
|
|
12767
13379
|
case "PBRMetallicRoughnessBlock__full":
|
|
12768
|
-
return () => import("./pbr-metallic-roughness-block-full-
|
|
13380
|
+
return () => import("./pbr-metallic-roughness-block-full-CHC8w-Uv.js");
|
|
12769
13381
|
case "ReflectionBlock":
|
|
12770
13382
|
return () => import("./reflection-block-DqcwyYqr.js");
|
|
12771
13383
|
case "ClearCoatBlock":
|
|
@@ -12807,7 +13419,7 @@ function extraRegistryLoader(key) {
|
|
|
12807
13419
|
case "CurveBlock":
|
|
12808
13420
|
case "WaveBlock":
|
|
12809
13421
|
case "RandomNumberBlock":
|
|
12810
|
-
return () => import("./node-registry-extra-math-
|
|
13422
|
+
return () => import("./node-registry-extra-math-Bm32WBAa.js");
|
|
12811
13423
|
case "ColorMergerBlock":
|
|
12812
13424
|
case "ColorConverterBlock":
|
|
12813
13425
|
case "DesaturateBlock":
|
|
@@ -12850,7 +13462,7 @@ function extraRegistryLoader(key) {
|
|
|
12850
13462
|
case "LoopBlock":
|
|
12851
13463
|
case "StorageReadBlock":
|
|
12852
13464
|
case "StorageWriteBlock":
|
|
12853
|
-
return () => import("./node-registry-extra-compat-
|
|
13465
|
+
return () => import("./node-registry-extra-compat-BEQH_ksg.js");
|
|
12854
13466
|
default:
|
|
12855
13467
|
return null;
|
|
12856
13468
|
}
|
|
@@ -12862,7 +13474,7 @@ const nodeRegistry = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
12862
13474
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
12863
13475
|
async function loadNodeBlockEmitterWithGeometry(className) {
|
|
12864
13476
|
if (className === "GeometryTextureOutputBlock") {
|
|
12865
|
-
return (await import("./geometry-texture-output-
|
|
13477
|
+
return (await import("./geometry-texture-output-BmuAquio.js")).emitter;
|
|
12866
13478
|
}
|
|
12867
13479
|
return loadBlockEmitter(className);
|
|
12868
13480
|
}
|
|
@@ -13300,10 +13912,10 @@ function enableMaterialPlugins(scene) {
|
|
|
13300
13912
|
async function enableMaterialTracking(material) {
|
|
13301
13913
|
const source = getMaterialSource(material);
|
|
13302
13914
|
if ("specularPower" in source) {
|
|
13303
|
-
const { installStdTracking } = await import("./std-tracking-
|
|
13915
|
+
const { installStdTracking } = await import("./std-tracking-BTcrry2o.js");
|
|
13304
13916
|
installStdTracking(source);
|
|
13305
13917
|
} else {
|
|
13306
|
-
const { installPbrTracking } = await import("./pbr-tracking-
|
|
13918
|
+
const { installPbrTracking } = await import("./pbr-tracking-Bo7RTANK.js");
|
|
13307
13919
|
installPbrTracking(source);
|
|
13308
13920
|
}
|
|
13309
13921
|
}
|
|
@@ -13311,6 +13923,9 @@ function createTransformNode(name, px2 = 0, py = 0, pz = 0, qx2 = 0, qy = 0, qz
|
|
|
13311
13923
|
return createSceneNode(name, px2, py, pz, qx2, qy, qz, qw, sx, sy, sz);
|
|
13312
13924
|
}
|
|
13313
13925
|
function cloneTransformNode(src) {
|
|
13926
|
+
if ("_gpu" in src) {
|
|
13927
|
+
return cloneMeshNode(src);
|
|
13928
|
+
}
|
|
13314
13929
|
const clone = src._localMatrix ? createSceneNodeFromMatrix(src.name + "_clone", src._localMatrix) : createTransformNode(
|
|
13315
13930
|
src.name + "_clone",
|
|
13316
13931
|
src.position.x,
|
|
@@ -13325,32 +13940,10 @@ function cloneTransformNode(src) {
|
|
|
13325
13940
|
src.scaling.z
|
|
13326
13941
|
);
|
|
13327
13942
|
for (const child of src.children) {
|
|
13328
|
-
if (!("
|
|
13943
|
+
if (!("lightType" in child)) {
|
|
13329
13944
|
const childClone = cloneTransformNode(child);
|
|
13330
13945
|
childClone.parent = clone;
|
|
13331
13946
|
clone.children.push(childClone);
|
|
13332
|
-
} else if ("_gpu" in child) {
|
|
13333
|
-
const mesh = child;
|
|
13334
|
-
const meshClone = {
|
|
13335
|
-
...mesh,
|
|
13336
|
-
name: mesh.name + "_clone",
|
|
13337
|
-
_materialDirty: false,
|
|
13338
|
-
_gpu: { ...mesh._gpu }
|
|
13339
|
-
};
|
|
13340
|
-
initMeshTransform(
|
|
13341
|
-
meshClone,
|
|
13342
|
-
mesh.position.x,
|
|
13343
|
-
mesh.position.y,
|
|
13344
|
-
mesh.position.z,
|
|
13345
|
-
mesh.rotation.x,
|
|
13346
|
-
mesh.rotation.y,
|
|
13347
|
-
mesh.rotation.z,
|
|
13348
|
-
mesh.scaling.x,
|
|
13349
|
-
mesh.scaling.y,
|
|
13350
|
-
mesh.scaling.z
|
|
13351
|
-
);
|
|
13352
|
-
meshClone.parent = clone;
|
|
13353
|
-
clone.children.push(meshClone);
|
|
13354
13947
|
} else {
|
|
13355
13948
|
const childClone = { ...child, name: child.name + "_clone", children: [] };
|
|
13356
13949
|
childClone.parent = clone;
|
|
@@ -13359,6 +13952,23 @@ function cloneTransformNode(src) {
|
|
|
13359
13952
|
}
|
|
13360
13953
|
return clone;
|
|
13361
13954
|
}
|
|
13955
|
+
function cloneMeshNode(mesh) {
|
|
13956
|
+
const meshClone = {
|
|
13957
|
+
...mesh,
|
|
13958
|
+
name: mesh.name + "_clone",
|
|
13959
|
+
children: [],
|
|
13960
|
+
_gpu: { ...mesh._gpu }
|
|
13961
|
+
};
|
|
13962
|
+
initMeshTransform(meshClone, mesh.position.x, mesh.position.y, mesh.position.z, 0, 0, 0, mesh.scaling.x, mesh.scaling.y, mesh.scaling.z);
|
|
13963
|
+
const rq = mesh.rotationQuaternion;
|
|
13964
|
+
meshClone.rotationQuaternion.set(rq.x, rq.y, rq.z, rq.w);
|
|
13965
|
+
for (const child of mesh.children) {
|
|
13966
|
+
const childClone = cloneTransformNode(child);
|
|
13967
|
+
childClone.parent = meshClone;
|
|
13968
|
+
meshClone.children.push(childClone);
|
|
13969
|
+
}
|
|
13970
|
+
return meshClone;
|
|
13971
|
+
}
|
|
13362
13972
|
let _tmpLocal = null;
|
|
13363
13973
|
let _tmpAnim = null;
|
|
13364
13974
|
let _tmpInstance = null;
|
|
@@ -13669,14 +14279,14 @@ async function runMatExts(mat, exts, ctx) {
|
|
|
13669
14279
|
}
|
|
13670
14280
|
let _interleavePromise;
|
|
13671
14281
|
function loadInterleave() {
|
|
13672
|
-
return _interleavePromise ?? (_interleavePromise = import("./gltf-interleave-
|
|
14282
|
+
return _interleavePromise ?? (_interleavePromise = import("./gltf-interleave-DWf27t-h.js"));
|
|
13673
14283
|
}
|
|
13674
14284
|
async function loadGltf(engine, url) {
|
|
13675
14285
|
var _a;
|
|
13676
14286
|
const { json, binChunk, baseUrl } = await fetchGltfAsset(url);
|
|
13677
14287
|
const parentMap = buildParentMap(json);
|
|
13678
14288
|
const worldMatrixCache = /* @__PURE__ */ new Map();
|
|
13679
|
-
const features = assetUsesGltfFeatures(json) ? await (await import("./gltf-feature-registry-
|
|
14289
|
+
const features = assetUsesGltfFeatures(json) ? await (await import("./gltf-feature-registry-DeYdy3DV.js")).loadGltfFeatures(json) : [];
|
|
13680
14290
|
let activeBin = binChunk;
|
|
13681
14291
|
for (const f of features) {
|
|
13682
14292
|
if (f.preParse) {
|
|
@@ -13725,7 +14335,7 @@ async function fetchGltfAsset(url) {
|
|
|
13725
14335
|
const baseUrl = url.substring(0, url.lastIndexOf("/") + 1);
|
|
13726
14336
|
if (url.toLowerCase().endsWith(".glb")) {
|
|
13727
14337
|
const buffer = await fetch(url).then((r) => r.arrayBuffer());
|
|
13728
|
-
const { parseGlbContainer } = await import("./gltf-glb-parser-
|
|
14338
|
+
const { parseGlbContainer } = await import("./gltf-glb-parser-CqOeXFOz.js");
|
|
13729
14339
|
const { json: json2, binChunk: binChunk2 } = parseGlbContainer(buffer);
|
|
13730
14340
|
return { json: json2, binChunk: binChunk2, baseUrl };
|
|
13731
14341
|
}
|
|
@@ -13934,7 +14544,7 @@ async function uploadMeshes(meshDatas, features, ctx) {
|
|
|
13934
14544
|
}
|
|
13935
14545
|
}
|
|
13936
14546
|
let _pbrExtPromise = null;
|
|
13937
|
-
const _ensurePbrExt = () => _pbrExtPromise ?? (_pbrExtPromise = import("./gltf-pbr-builder-ext-
|
|
14547
|
+
const _ensurePbrExt = () => _pbrExtPromise ?? (_pbrExtPromise = import("./gltf-pbr-builder-ext-DvFxuOqN.js"));
|
|
13938
14548
|
const builtMaterialCache = /* @__PURE__ */ new Map();
|
|
13939
14549
|
async function buildPbrFromGltfMat(mat) {
|
|
13940
14550
|
let cached = builtMaterialCache.get(mat);
|
|
@@ -13982,7 +14592,6 @@ async function uploadMeshes(meshDatas, features, ctx) {
|
|
|
13982
14592
|
boundMax,
|
|
13983
14593
|
skeleton: null,
|
|
13984
14594
|
morphTargets: null,
|
|
13985
|
-
_materialDirty: false,
|
|
13986
14595
|
_gpu: gpu
|
|
13987
14596
|
};
|
|
13988
14597
|
initMeshTransform(mesh);
|
|
@@ -14292,7 +14901,6 @@ async function loadBabylon(engine, url, opts = {}) {
|
|
|
14292
14901
|
id: md.id,
|
|
14293
14902
|
material: mat,
|
|
14294
14903
|
receiveShadows: false,
|
|
14295
|
-
_materialDirty: false,
|
|
14296
14904
|
_gpu: gpu
|
|
14297
14905
|
};
|
|
14298
14906
|
mesh._cpuPositions = positions;
|
|
@@ -14373,7 +14981,7 @@ async function loadBabylon(engine, url, opts = {}) {
|
|
|
14373
14981
|
}
|
|
14374
14982
|
}
|
|
14375
14983
|
const camData = opts.loadCamera !== false && ((_v = data.cameras) == null ? void 0 : _v.length) ? (data.activeCameraID ? data.cameras.find((c2) => c2.id === data.activeCameraID) : null) ?? data.cameras[0] : null;
|
|
14376
|
-
const camera = camData ? (await import("./parse-camera-
|
|
14984
|
+
const camera = camData ? (await import("./parse-camera-CmZBS423.js")).parseBabylonCamera(camData) : void 0;
|
|
14377
14985
|
const rootMeshes = allMeshes.filter((m2) => !childNodeIds.has(m2.id));
|
|
14378
14986
|
const rootTransformNodes = [];
|
|
14379
14987
|
for (const [id, node] of nodeMap) {
|
|
@@ -14470,7 +15078,7 @@ async function loadEnvironment(scene, url, options) {
|
|
|
14470
15078
|
const envBuffer = await envPromise;
|
|
14471
15079
|
const { faceBlobs, irradianceSH, width, mipCount } = parseEnvFile(envBuffer);
|
|
14472
15080
|
const faceImages = await Promise.all(faceBlobs.map((blob2) => createImageBitmap(blob2, { premultiplyAlpha: "none", colorSpaceConversion: "none" })));
|
|
14473
|
-
const { uploadCubemapRGBD, decodeBrdfPng } = await import("./rgbd-decode-
|
|
15081
|
+
const { uploadCubemapRGBD, decodeBrdfPng } = await import("./rgbd-decode-DkiiiIlt.js");
|
|
14474
15082
|
const specularCube = uploadCubemapRGBD(engine, faceImages, width, mipCount);
|
|
14475
15083
|
for (const img of faceImages) {
|
|
14476
15084
|
img.close();
|
|
@@ -14504,19 +15112,19 @@ async function loadEnvironment(scene, url, options) {
|
|
|
14504
15112
|
const { groundSize, skyboxSize: autoSkyboxSize, rootPosition } = computeSceneSize(scene, options == null ? void 0 : options.skyboxSize);
|
|
14505
15113
|
const skyHalfSize = autoSkyboxSize / 2;
|
|
14506
15114
|
if (!bgOptions.skipSkybox) {
|
|
14507
|
-
const { buildSolidSkyboxRenderable } = await import("./background-solid-skybox
|
|
15115
|
+
const { buildSolidSkyboxRenderable } = await import("./background-solid-skybox--fqHdan_.js");
|
|
14508
15116
|
scene._renderables.push(buildSolidSkyboxRenderable(scene, textures, skyHalfSize, rootPosition, primaryColor));
|
|
14509
15117
|
}
|
|
14510
15118
|
if (!bgOptions.skipGround) {
|
|
14511
|
-
const { buildGroundRenderable } = await import("./background-ground-
|
|
15119
|
+
const { buildGroundRenderable } = await import("./background-ground-DiFpKJzF.js");
|
|
14512
15120
|
scene._renderables.push(await buildGroundRenderable(engine, groundSize, rootPosition, primaryColor, groundUrl, groundTexPromise));
|
|
14513
15121
|
}
|
|
14514
15122
|
if (skyboxIsDds) {
|
|
14515
|
-
const { buildDdsSkyboxRenderable } = await import("./background-dds-skybox-
|
|
15123
|
+
const { buildDdsSkyboxRenderable } = await import("./background-dds-skybox-BwG0kYQP.js");
|
|
14516
15124
|
scene._renderables.push(await buildDdsSkyboxRenderable(scene, skyHalfSize, rootPosition, primaryColor, skyboxUrl));
|
|
14517
15125
|
}
|
|
14518
15126
|
if (skyboxIsEnv) {
|
|
14519
|
-
const { buildHdrSkyboxRenderable } = await import("./background-hdr-skybox
|
|
15127
|
+
const { buildHdrSkyboxRenderable } = await import("./background-hdr-skybox-DIgJhvfj.js");
|
|
14520
15128
|
scene._renderables.push(buildHdrSkyboxRenderable(scene, textures, skyHalfSize, rootPosition, primaryColor));
|
|
14521
15129
|
}
|
|
14522
15130
|
});
|
|
@@ -14920,7 +15528,7 @@ async function loadHdrEnvironment(scene, url, options) {
|
|
|
14920
15528
|
const { computeSceneSize: computeSceneSize2 } = await Promise.resolve().then(() => sceneSize);
|
|
14921
15529
|
const { skyboxSize: autoSkyboxSize, rootPosition } = computeSceneSize2(scene, options == null ? void 0 : options.skyboxSize);
|
|
14922
15530
|
const primaryColor = scene.environmentPrimaryColor ?? [0.08697355964132344, 0.08697355964132344, 0.2122208331110881];
|
|
14923
|
-
const { buildHdrSkyboxRenderable } = await import("./background-hdr-skybox
|
|
15531
|
+
const { buildHdrSkyboxRenderable } = await import("./background-hdr-skybox-DIgJhvfj.js");
|
|
14924
15532
|
scene._renderables.push(buildHdrSkyboxRenderable(scene, textures, autoSkyboxSize / 2, rootPosition, primaryColor));
|
|
14925
15533
|
}
|
|
14926
15534
|
if (!useHdr || !skipGround) {
|
|
@@ -14928,11 +15536,11 @@ async function loadHdrEnvironment(scene, url, options) {
|
|
|
14928
15536
|
const { computeSceneSize: computeSceneSize2 } = await Promise.resolve().then(() => sceneSize);
|
|
14929
15537
|
const { groundSize, skyboxSize: autoSkyboxSize, rootPosition } = computeSceneSize2(scene, options == null ? void 0 : options.skyboxSize);
|
|
14930
15538
|
if (!useHdr) {
|
|
14931
|
-
const { buildSolidSkyboxRenderable } = await import("./background-solid-skybox
|
|
15539
|
+
const { buildSolidSkyboxRenderable } = await import("./background-solid-skybox--fqHdan_.js");
|
|
14932
15540
|
scene._renderables.push(buildSolidSkyboxRenderable(scene, textures, autoSkyboxSize / 2, rootPosition, primaryColor));
|
|
14933
15541
|
}
|
|
14934
15542
|
if (!skipGround) {
|
|
14935
|
-
const { buildGroundRenderable } = await import("./background-ground-
|
|
15543
|
+
const { buildGroundRenderable } = await import("./background-ground-DiFpKJzF.js");
|
|
14936
15544
|
scene._renderables.push(await buildGroundRenderable(engine, groundSize, rootPosition, primaryColor));
|
|
14937
15545
|
}
|
|
14938
15546
|
}
|
|
@@ -15013,7 +15621,7 @@ async function loadSkybox(scene, baseUrl, ext, size = 100) {
|
|
|
15013
15621
|
idxCount: boxData.indices.length,
|
|
15014
15622
|
worldMatrix: world
|
|
15015
15623
|
};
|
|
15016
|
-
const { buildSkyboxRenderable } = await import("./skybox-renderable-
|
|
15624
|
+
const { buildSkyboxRenderable } = await import("./skybox-renderable-BH6uUkal.js");
|
|
15017
15625
|
scene._renderables.push(buildSkyboxRenderable(scene, skyboxData));
|
|
15018
15626
|
}
|
|
15019
15627
|
const SH_C0$2 = 0.28209479177387814;
|
|
@@ -15766,7 +16374,7 @@ async function attachParsedSplat(scene, name, parsed, fragments) {
|
|
|
15766
16374
|
const eng = scene.surface.engine;
|
|
15767
16375
|
const mesh = createGaussianSplattingMesh(eng, name, geom, worker, parsed);
|
|
15768
16376
|
if (parsed.sh && parsed.shDegree && parsed.shDegree > 0) {
|
|
15769
|
-
const { attachGaussianSplattingMeshSH } = await import("./gaussian-splatting-pipeline-sh-
|
|
16377
|
+
const { attachGaussianSplattingMeshSH } = await import("./gaussian-splatting-pipeline-sh-DDo7QQ8l.js");
|
|
15770
16378
|
attachGaussianSplattingMeshSH(scene, mesh, parsed.sh, fragments);
|
|
15771
16379
|
} else {
|
|
15772
16380
|
attachGaussianSplattingMesh(scene, mesh, fragments);
|
|
@@ -15782,7 +16390,7 @@ async function loadSplat(scene, url, fragments) {
|
|
|
15782
16390
|
let parsed;
|
|
15783
16391
|
if (isPly(data)) {
|
|
15784
16392
|
if (isPlyCompressedOrSH(data)) {
|
|
15785
|
-
const { convertCompressedPlyToParsedSplat } = await import("./splat-ply-compressed-
|
|
16393
|
+
const { convertCompressedPlyToParsedSplat } = await import("./splat-ply-compressed-BGNK6dnh.js");
|
|
15786
16394
|
parsed = convertCompressedPlyToParsedSplat(data);
|
|
15787
16395
|
} else {
|
|
15788
16396
|
parsed = convertPlyToSplat(data);
|
|
@@ -16611,21 +17219,21 @@ async function preloadEsmShadowTaskState(casterMeshes) {
|
|
|
16611
17219
|
}
|
|
16612
17220
|
if (needsStandard && !createStandardEsmShadowMaterialView) {
|
|
16613
17221
|
loads.push(
|
|
16614
|
-
import("./esm-shadow-view-
|
|
17222
|
+
import("./esm-shadow-view-CUwxbnMR.js").then((module) => {
|
|
16615
17223
|
createStandardEsmShadowMaterialView = module.createStandardEsmShadowMaterialView;
|
|
16616
17224
|
})
|
|
16617
17225
|
);
|
|
16618
17226
|
}
|
|
16619
17227
|
if (needsPbr && !createPbrEsmShadowMaterialView) {
|
|
16620
17228
|
loads.push(
|
|
16621
|
-
import("./esm-shadow-view-
|
|
17229
|
+
import("./esm-shadow-view-Cl36rOrK.js").then((module) => {
|
|
16622
17230
|
createPbrEsmShadowMaterialView = module.createPbrEsmShadowMaterialView;
|
|
16623
17231
|
})
|
|
16624
17232
|
);
|
|
16625
17233
|
}
|
|
16626
17234
|
if (needsNode && !createNodeEsmShadowMaterialView) {
|
|
16627
17235
|
loads.push(
|
|
16628
|
-
import("./esm-shadow-view-
|
|
17236
|
+
import("./esm-shadow-view-DKQ-FSoV.js").then((module) => {
|
|
16629
17237
|
createNodeEsmShadowMaterialView = module.createNodeEsmShadowMaterialView;
|
|
16630
17238
|
})
|
|
16631
17239
|
);
|
|
@@ -19792,12 +20400,33 @@ function createEmptyPickingInfo() {
|
|
|
19792
20400
|
ray: null
|
|
19793
20401
|
};
|
|
19794
20402
|
}
|
|
20403
|
+
const PICK_SHARED = (
|
|
20404
|
+
/* wgsl */
|
|
20405
|
+
`
|
|
20406
|
+
fn pickClipOne(wp: vec3f, a: vec4f, b: vec4f, c: vec4f) -> bool {
|
|
20407
|
+
let q = wp.xz - a.xy;
|
|
20408
|
+
let ds = dot(q, a.zw);
|
|
20409
|
+
let dp = dot(q, vec2f(-a.w, a.z));
|
|
20410
|
+
if (abs(dp) > c.y) { return false; }
|
|
20411
|
+
let y = wp.y - b.x;
|
|
20412
|
+
let outerHW = b.y + c.x;
|
|
20413
|
+
if (c.z > 0.5) { return y <= b.z + c.x && abs(ds) <= outerHW; }
|
|
20414
|
+
if (y <= b.z) { return abs(ds) <= outerHW; }
|
|
20415
|
+
let outerRise = b.w + c.x;
|
|
20416
|
+
if (y > b.z + outerRise || outerRise <= 0.0) { return false; }
|
|
20417
|
+
let ex = ds / max(outerHW, 0.001);
|
|
20418
|
+
let ey = (y - b.z) / max(outerRise, 0.001);
|
|
20419
|
+
return ex * ex + ey * ey <= 1.0;
|
|
20420
|
+
}
|
|
20421
|
+
`
|
|
20422
|
+
);
|
|
19795
20423
|
const PICK_FS = (
|
|
19796
20424
|
/* wgsl */
|
|
19797
20425
|
`
|
|
19798
|
-
struct VsOut { @builtin(position) position: vec4f, @location(0) @interpolate(flat) pickId: u32 };
|
|
20426
|
+
struct VsOut { @builtin(position) position: vec4f, @location(0) @interpolate(flat) pickId: u32, @location(1) worldPos: vec3f, @location(2) clipSkip: f32 };
|
|
19799
20427
|
struct FsOut { @location(0) color: vec4f, @location(1) depth: vec4f };
|
|
19800
20428
|
@fragment fn fs(input: VsOut) -> FsOut {
|
|
20429
|
+
if (input.clipSkip < 0.5 && pickClipHit(input.worldPos)) { discard; }
|
|
19801
20430
|
let id = input.pickId;
|
|
19802
20431
|
let r = f32((id >> 16u) & 0xFFu) / 255.0;
|
|
19803
20432
|
let g = f32((id >> 8u) & 0xFFu) / 255.0;
|
|
@@ -19810,14 +20439,30 @@ const pickingShaderSource = (
|
|
|
19810
20439
|
/* wgsl */
|
|
19811
20440
|
`
|
|
19812
20441
|
struct SceneUniforms { viewProjection: mat4x4f };
|
|
19813
|
-
struct MeshUniforms {
|
|
20442
|
+
struct MeshUniforms {
|
|
20443
|
+
world: mat4x4f,
|
|
20444
|
+
pickId: u32,
|
|
20445
|
+
};
|
|
19814
20446
|
@group(0) @binding(0) var<uniform> scene: SceneUniforms;
|
|
19815
20447
|
@group(1) @binding(0) var<uniform> mesh: MeshUniforms;
|
|
20448
|
+
@group(1) @binding(1) var<storage, read> clipData: array<vec4f>;
|
|
20449
|
+
${PICK_SHARED}
|
|
20450
|
+
fn pickClipHit(wp: vec3f) -> bool {
|
|
20451
|
+
let n = i32(clipData[0].x);
|
|
20452
|
+
for (var i = 0; i < n; i = i + 1) {
|
|
20453
|
+
let base = 1 + i * 3;
|
|
20454
|
+
if (pickClipOne(wp, clipData[base], clipData[base + 1], clipData[base + 2])) { return true; }
|
|
20455
|
+
}
|
|
20456
|
+
return false;
|
|
20457
|
+
}
|
|
19816
20458
|
${PICK_FS}
|
|
19817
20459
|
@vertex fn vs(@location(0) position: vec3f) -> VsOut {
|
|
19818
20460
|
var out: VsOut;
|
|
19819
|
-
|
|
20461
|
+
let wp = (mesh.world * vec4f(position, 1.0)).xyz;
|
|
20462
|
+
out.position = scene.viewProjection * vec4f(wp, 1.0);
|
|
19820
20463
|
out.pickId = mesh.pickId;
|
|
20464
|
+
out.worldPos = wp;
|
|
20465
|
+
out.clipSkip = 0.0;
|
|
19821
20466
|
return out;
|
|
19822
20467
|
}
|
|
19823
20468
|
`
|
|
@@ -19826,10 +20471,22 @@ const pickingThinInstanceShaderSource = (
|
|
|
19826
20471
|
/* wgsl */
|
|
19827
20472
|
`
|
|
19828
20473
|
struct SceneUniforms { viewProjection: mat4x4f };
|
|
19829
|
-
struct TIMeshUniforms {
|
|
20474
|
+
struct TIMeshUniforms {
|
|
20475
|
+
baseMeshPickId: u32,
|
|
20476
|
+
};
|
|
19830
20477
|
@group(0) @binding(0) var<uniform> scene: SceneUniforms;
|
|
19831
20478
|
@group(1) @binding(0) var<uniform> tiMesh: TIMeshUniforms;
|
|
19832
20479
|
@group(1) @binding(1) var<storage, read> instances: array<mat4x4f>;
|
|
20480
|
+
@group(1) @binding(2) var<storage, read> clipData: array<vec4f>;
|
|
20481
|
+
${PICK_SHARED}
|
|
20482
|
+
fn pickClipHit(wp: vec3f) -> bool {
|
|
20483
|
+
let n = i32(clipData[0].x);
|
|
20484
|
+
for (var i = 0; i < n; i = i + 1) {
|
|
20485
|
+
let base = 1 + i * 3;
|
|
20486
|
+
if (pickClipOne(wp, clipData[base], clipData[base + 1], clipData[base + 2])) { return true; }
|
|
20487
|
+
}
|
|
20488
|
+
return false;
|
|
20489
|
+
}
|
|
19833
20490
|
${PICK_FS}
|
|
19834
20491
|
@vertex fn vs(@location(0) position: vec3f, @builtin(instance_index) instanceIndex: u32) -> VsOut {
|
|
19835
20492
|
let m = instances[instanceIndex];
|
|
@@ -19845,8 +20502,11 @@ vec4f(m[2].xyz, 0.0),
|
|
|
19845
20502
|
vec4f(m[3].xyz, 1.0),
|
|
19846
20503
|
);
|
|
19847
20504
|
var out: VsOut;
|
|
19848
|
-
|
|
20505
|
+
let wp = (world * vec4f(position, 1.0)).xyz;
|
|
20506
|
+
out.position = scene.viewProjection * vec4f(wp, 1.0);
|
|
19849
20507
|
out.pickId = tiMesh.baseMeshPickId + instanceIndex;
|
|
20508
|
+
out.worldPos = wp;
|
|
20509
|
+
out.clipSkip = clamp(floor(max(m[2].w, 0.0) * 0.25), 0.0, 1.0);
|
|
19850
20510
|
return out;
|
|
19851
20511
|
}
|
|
19852
20512
|
`
|
|
@@ -19857,21 +20517,21 @@ function createSingleUniformBGL(engine, label, visibility) {
|
|
|
19857
20517
|
entries: [{ binding: 0, visibility, buffer: { type: "uniform" } }]
|
|
19858
20518
|
});
|
|
19859
20519
|
}
|
|
19860
|
-
let _cachedDevice = null;
|
|
20520
|
+
let _cachedDevice$1 = null;
|
|
19861
20521
|
let _pipeline = null;
|
|
19862
20522
|
let _tiPipeline = null;
|
|
19863
20523
|
let _sceneBGL = null;
|
|
19864
|
-
let _meshBGL = null;
|
|
20524
|
+
let _meshBGL$1 = null;
|
|
19865
20525
|
let _tiMeshBGL = null;
|
|
19866
20526
|
function invalidateIfNeeded(engine) {
|
|
19867
20527
|
const device = engine._device;
|
|
19868
|
-
if (device !== _cachedDevice) {
|
|
20528
|
+
if (device !== _cachedDevice$1) {
|
|
19869
20529
|
_pipeline = null;
|
|
19870
20530
|
_tiPipeline = null;
|
|
19871
20531
|
_sceneBGL = null;
|
|
19872
|
-
_meshBGL = null;
|
|
20532
|
+
_meshBGL$1 = null;
|
|
19873
20533
|
_tiMeshBGL = null;
|
|
19874
|
-
_cachedDevice = device;
|
|
20534
|
+
_cachedDevice$1 = device;
|
|
19875
20535
|
}
|
|
19876
20536
|
}
|
|
19877
20537
|
function getPickingSceneBGL(engine) {
|
|
@@ -19883,10 +20543,16 @@ function getPickingSceneBGL(engine) {
|
|
|
19883
20543
|
}
|
|
19884
20544
|
function getPickingMeshBGL(engine) {
|
|
19885
20545
|
invalidateIfNeeded(engine);
|
|
19886
|
-
if (!_meshBGL) {
|
|
19887
|
-
_meshBGL =
|
|
20546
|
+
if (!_meshBGL$1) {
|
|
20547
|
+
_meshBGL$1 = engine._device.createBindGroupLayout({
|
|
20548
|
+
label: "picking-mesh-bgl",
|
|
20549
|
+
entries: [
|
|
20550
|
+
{ binding: 0, visibility: SS.VERTEX | SS.FRAGMENT, buffer: { type: "uniform" } },
|
|
20551
|
+
{ binding: 1, visibility: SS.FRAGMENT, buffer: { type: "read-only-storage" } }
|
|
20552
|
+
]
|
|
20553
|
+
});
|
|
19888
20554
|
}
|
|
19889
|
-
return _meshBGL;
|
|
20555
|
+
return _meshBGL$1;
|
|
19890
20556
|
}
|
|
19891
20557
|
function getPickingTIMeshBGL(engine) {
|
|
19892
20558
|
const device = engine._device;
|
|
@@ -19904,6 +20570,11 @@ function getPickingTIMeshBGL(engine) {
|
|
|
19904
20570
|
binding: 1,
|
|
19905
20571
|
visibility: SS.VERTEX,
|
|
19906
20572
|
buffer: { type: "read-only-storage" }
|
|
20573
|
+
},
|
|
20574
|
+
{
|
|
20575
|
+
binding: 2,
|
|
20576
|
+
visibility: SS.FRAGMENT,
|
|
20577
|
+
buffer: { type: "read-only-storage" }
|
|
19907
20578
|
}
|
|
19908
20579
|
]
|
|
19909
20580
|
});
|
|
@@ -19976,11 +20647,30 @@ function getPickingTIPipeline(engine) {
|
|
|
19976
20647
|
}
|
|
19977
20648
|
const _pickVP = new F32(16);
|
|
19978
20649
|
const _gsPickMatrix = new F32(16);
|
|
19979
|
-
const
|
|
19980
|
-
const
|
|
19981
|
-
const
|
|
20650
|
+
const PICK_MESH_UBO_BYTES = 80;
|
|
20651
|
+
const PICK_TI_UBO_BYTES = 16;
|
|
20652
|
+
const _uboScratch = new ArrayBuffer(PICK_MESH_UBO_BYTES);
|
|
20653
|
+
const _uboF32 = new F32(_uboScratch);
|
|
20654
|
+
const _uboU32 = new U32(_uboScratch);
|
|
19982
20655
|
const _uboView = new U8(_uboScratch);
|
|
19983
|
-
const _tiUboScratch = new
|
|
20656
|
+
const _tiUboScratch = new ArrayBuffer(PICK_TI_UBO_BYTES);
|
|
20657
|
+
const _tiUboU32 = new U32(_tiUboScratch);
|
|
20658
|
+
const _tiUboView = new U8(_tiUboScratch);
|
|
20659
|
+
function createPickClipBuffer(engine, mesh, tempBuffers) {
|
|
20660
|
+
const clips = mesh.pickingClipVolumes;
|
|
20661
|
+
const count = (clips == null ? void 0 : clips.length) ?? 0;
|
|
20662
|
+
const data = new F32((1 + count * 3) * 4);
|
|
20663
|
+
data[0] = count;
|
|
20664
|
+
for (let i = 0; i < count; i++) {
|
|
20665
|
+
const off = 4 + i * 12;
|
|
20666
|
+
data.set(clips[i].a, off);
|
|
20667
|
+
data.set(clips[i].b, off + 4);
|
|
20668
|
+
data.set(clips[i].c, off + 8);
|
|
20669
|
+
}
|
|
20670
|
+
const buf = createMappedBuffer(engine, data, BU.STORAGE);
|
|
20671
|
+
tempBuffers.push(buf);
|
|
20672
|
+
return buf;
|
|
20673
|
+
}
|
|
19984
20674
|
function createGpuPicker(scene) {
|
|
19985
20675
|
return {
|
|
19986
20676
|
_detailedPick: null,
|
|
@@ -20040,6 +20730,7 @@ function computePickVP(out, vp, px2, py, w, h) {
|
|
|
20040
20730
|
async function pickAsync(picker, x, y, options) {
|
|
20041
20731
|
const scene = picker._scene;
|
|
20042
20732
|
const pickFilter = (options == null ? void 0 : options.filter) ?? null;
|
|
20733
|
+
const debugLabel = options == null ? void 0 : options.debugLabel;
|
|
20043
20734
|
const engine = scene.surface.engine;
|
|
20044
20735
|
const device = engine._device;
|
|
20045
20736
|
const canvas = scene.surface.canvas;
|
|
@@ -20068,6 +20759,7 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20068
20759
|
const py = Math.max(0, Math.min(Math.floor(pickY - viewport.y), h - 1));
|
|
20069
20760
|
const aspect = w / h;
|
|
20070
20761
|
const vp = getViewProjectionMatrix(camera, aspect);
|
|
20762
|
+
const debugRay = debugLabel ? createPickingRay(px2, py, vp, w, h) : null;
|
|
20071
20763
|
computePickVP(_pickVP, vp, px2, py, w, h);
|
|
20072
20764
|
const rt = ensureTargets(engine, picker);
|
|
20073
20765
|
const sceneUbo = ensureSceneUbo(engine, picker);
|
|
@@ -20106,9 +20798,13 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20106
20798
|
}
|
|
20107
20799
|
const gpu = mesh._gpu;
|
|
20108
20800
|
const ti = mesh.thinInstances;
|
|
20109
|
-
if (ti
|
|
20110
|
-
|
|
20111
|
-
|
|
20801
|
+
if (ti) {
|
|
20802
|
+
if (ti.count <= 0 || !ti._gpuBuffer) {
|
|
20803
|
+
continue;
|
|
20804
|
+
}
|
|
20805
|
+
_tiUboU32[0] = nextId;
|
|
20806
|
+
const tiUbo = createUniformBuffer$1(engine, _tiUboView);
|
|
20807
|
+
const clipBuffer = createPickClipBuffer(engine, mesh, tempBuffers);
|
|
20112
20808
|
tempBuffers.push(tiUbo);
|
|
20113
20809
|
pass.setPipeline(tiPipeline);
|
|
20114
20810
|
pass.setBindGroup(0, picker._sceneBG);
|
|
@@ -20118,7 +20814,8 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20118
20814
|
layout: tiMeshBGL,
|
|
20119
20815
|
entries: [
|
|
20120
20816
|
{ binding: 0, resource: { buffer: tiUbo } },
|
|
20121
|
-
{ binding: 1, resource: { buffer: ti._gpuBuffer } }
|
|
20817
|
+
{ binding: 1, resource: { buffer: ti._gpuBuffer } },
|
|
20818
|
+
{ binding: 2, resource: { buffer: clipBuffer } }
|
|
20122
20819
|
]
|
|
20123
20820
|
})
|
|
20124
20821
|
);
|
|
@@ -20127,9 +20824,10 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20127
20824
|
pass.drawIndexed(gpu.indexCount, ti.count);
|
|
20128
20825
|
nextId += ti.count;
|
|
20129
20826
|
} else {
|
|
20130
|
-
_uboF32.set(mesh.worldMatrix);
|
|
20131
|
-
_uboU32[
|
|
20827
|
+
_uboF32.set(mesh.worldMatrix, 0);
|
|
20828
|
+
_uboU32[16] = nextId;
|
|
20132
20829
|
const meshUbo = createUniformBuffer$1(engine, _uboView);
|
|
20830
|
+
const clipBuffer = createPickClipBuffer(engine, mesh, tempBuffers);
|
|
20133
20831
|
tempBuffers.push(meshUbo);
|
|
20134
20832
|
let positionBuffer = gpu.positionBuffer;
|
|
20135
20833
|
if (deformedGeometry$1 && (mesh.morphTargets || mesh.skeleton) && mesh._cpuPositions) {
|
|
@@ -20141,7 +20839,16 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20141
20839
|
}
|
|
20142
20840
|
pass.setPipeline(regularPipeline);
|
|
20143
20841
|
pass.setBindGroup(0, picker._sceneBG);
|
|
20144
|
-
pass.setBindGroup(
|
|
20842
|
+
pass.setBindGroup(
|
|
20843
|
+
1,
|
|
20844
|
+
device.createBindGroup({
|
|
20845
|
+
layout: meshBGL,
|
|
20846
|
+
entries: [
|
|
20847
|
+
{ binding: 0, resource: { buffer: meshUbo } },
|
|
20848
|
+
{ binding: 1, resource: { buffer: clipBuffer } }
|
|
20849
|
+
]
|
|
20850
|
+
})
|
|
20851
|
+
);
|
|
20145
20852
|
pass.setVertexBuffer(0, positionBuffer);
|
|
20146
20853
|
pass.setIndexBuffer(gpu.indexBuffer, gpu.indexFormat);
|
|
20147
20854
|
pass.drawIndexed(gpu.indexCount);
|
|
@@ -20152,7 +20859,7 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20152
20859
|
const gsMeshCount = gsMeshes.length;
|
|
20153
20860
|
const gsNextIdStart = nextId;
|
|
20154
20861
|
if (gsMeshCount > 0) {
|
|
20155
|
-
const gsModule = await import("./gs-picking-pipeline-
|
|
20862
|
+
const gsModule = await import("./gs-picking-pipeline-55sM5LzV.js");
|
|
20156
20863
|
gsModule.computeGsPickMatrix(_gsPickMatrix, px2, py, w, h);
|
|
20157
20864
|
gsModule.gsPickWritePickMatrixAndBind(pass, engine, _gsPickMatrix);
|
|
20158
20865
|
const resMap = picker._gsMeshResources ?? (picker._gsMeshResources = /* @__PURE__ */ new Map());
|
|
@@ -20181,6 +20888,16 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20181
20888
|
tempBuffers[i].destroy();
|
|
20182
20889
|
}
|
|
20183
20890
|
if (pickId === 0) {
|
|
20891
|
+
if (debugLabel) {
|
|
20892
|
+
console.trace("pick-debug", {
|
|
20893
|
+
label: debugLabel,
|
|
20894
|
+
input: { x, y, pickX, pickY, px: px2, py, backingWidth, backingHeight, clientWidth, clientHeight, viewport },
|
|
20895
|
+
ray: debugRay,
|
|
20896
|
+
pickId,
|
|
20897
|
+
depth,
|
|
20898
|
+
hit: false
|
|
20899
|
+
});
|
|
20900
|
+
}
|
|
20184
20901
|
return createEmptyPickingInfo();
|
|
20185
20902
|
}
|
|
20186
20903
|
let hitMesh = null;
|
|
@@ -20196,7 +20913,10 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20196
20913
|
continue;
|
|
20197
20914
|
}
|
|
20198
20915
|
const ti = mesh.thinInstances;
|
|
20199
|
-
if (ti
|
|
20916
|
+
if (ti) {
|
|
20917
|
+
if (ti.count <= 0 || !ti._gpuBuffer) {
|
|
20918
|
+
continue;
|
|
20919
|
+
}
|
|
20200
20920
|
if (pickId >= scanId && pickId < scanId + ti.count) {
|
|
20201
20921
|
hitMesh = mesh;
|
|
20202
20922
|
hitThinIdx = pickId - scanId;
|
|
@@ -20219,6 +20939,17 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20219
20939
|
}
|
|
20220
20940
|
}
|
|
20221
20941
|
if (!hitMesh) {
|
|
20942
|
+
if (debugLabel) {
|
|
20943
|
+
console.trace("pick-debug", {
|
|
20944
|
+
label: debugLabel,
|
|
20945
|
+
input: { x, y, pickX, pickY, px: px2, py, backingWidth, backingHeight, clientWidth, clientHeight, viewport },
|
|
20946
|
+
ray: debugRay,
|
|
20947
|
+
pickId,
|
|
20948
|
+
depth,
|
|
20949
|
+
hit: false,
|
|
20950
|
+
unresolved: true
|
|
20951
|
+
});
|
|
20952
|
+
}
|
|
20222
20953
|
return createEmptyPickingInfo();
|
|
20223
20954
|
}
|
|
20224
20955
|
const info = createEmptyPickingInfo();
|
|
@@ -20248,6 +20979,20 @@ async function pickAsync(picker, x, y, options) {
|
|
|
20248
20979
|
await picker._detailedPick(info, ray);
|
|
20249
20980
|
}
|
|
20250
20981
|
}
|
|
20982
|
+
if (debugLabel) {
|
|
20983
|
+
console.trace("pick-debug", {
|
|
20984
|
+
label: debugLabel,
|
|
20985
|
+
input: { x, y, pickX, pickY, px: px2, py, backingWidth, backingHeight, clientWidth, clientHeight, viewport },
|
|
20986
|
+
ray: info.ray ?? debugRay,
|
|
20987
|
+
pickId,
|
|
20988
|
+
depth,
|
|
20989
|
+
hit: true,
|
|
20990
|
+
mesh: hitMesh.name ?? "(unnamed)",
|
|
20991
|
+
thinInstanceIndex: hitThinIdx,
|
|
20992
|
+
pickedPoint: info.pickedPoint,
|
|
20993
|
+
distance: info.distance
|
|
20994
|
+
});
|
|
20995
|
+
}
|
|
20251
20996
|
return info;
|
|
20252
20997
|
}
|
|
20253
20998
|
function disposePicker(picker) {
|
|
@@ -20265,7 +21010,7 @@ function disposePicker(picker) {
|
|
|
20265
21010
|
picker._sceneBG = null;
|
|
20266
21011
|
}
|
|
20267
21012
|
if (picker._gsMeshResources) {
|
|
20268
|
-
void import("./gs-picking-pipeline-
|
|
21013
|
+
void import("./gs-picking-pipeline-55sM5LzV.js").then((m2) => {
|
|
20269
21014
|
if (!picker._gsMeshResources) {
|
|
20270
21015
|
return;
|
|
20271
21016
|
}
|
|
@@ -20496,12 +21241,12 @@ async function detailedPick(info, ray) {
|
|
|
20496
21241
|
const i12 = indices[closestFace * 3 + 1];
|
|
20497
21242
|
const i222 = indices[closestFace * 3 + 2];
|
|
20498
21243
|
const bw = 1 - info.bu - info.bv;
|
|
20499
|
-
const localNormal = normalizeVec3(
|
|
21244
|
+
const localNormal = normalizeVec3$1(
|
|
20500
21245
|
info.bu * normals[i02 * 3] + info.bv * normals[i12 * 3] + bw * normals[i222 * 3],
|
|
20501
21246
|
info.bu * normals[i02 * 3 + 1] + info.bv * normals[i12 * 3 + 1] + bw * normals[i222 * 3 + 1],
|
|
20502
21247
|
info.bu * normals[i02 * 3 + 2] + info.bv * normals[i12 * 3 + 2] + bw * normals[i222 * 3 + 2]
|
|
20503
21248
|
);
|
|
20504
|
-
const worldNormal = normalizeVec3(
|
|
21249
|
+
const worldNormal = normalizeVec3$1(
|
|
20505
21250
|
worldMatrix[0] * localNormal[0] + worldMatrix[4] * localNormal[1] + worldMatrix[8] * localNormal[2],
|
|
20506
21251
|
worldMatrix[1] * localNormal[0] + worldMatrix[5] * localNormal[1] + worldMatrix[9] * localNormal[2],
|
|
20507
21252
|
worldMatrix[2] * localNormal[0] + worldMatrix[6] * localNormal[1] + worldMatrix[10] * localNormal[2]
|
|
@@ -20522,12 +21267,12 @@ async function detailedPick(info, ray) {
|
|
|
20522
21267
|
const cx = positions[i22 * 3];
|
|
20523
21268
|
const cy = positions[i22 * 3 + 1];
|
|
20524
21269
|
const cz = positions[i22 * 3 + 2];
|
|
20525
|
-
const faceNormal = normalizeVec3(
|
|
21270
|
+
const faceNormal = normalizeVec3$1(
|
|
20526
21271
|
(by - ay) * (cz - az) - (bz - az) * (cy - ay),
|
|
20527
21272
|
(bz - az) * (cx - ax2) - (bx2 - ax2) * (cz - az),
|
|
20528
21273
|
(bx2 - ax2) * (cy - ay) - (by - ay) * (cx - ax2)
|
|
20529
21274
|
);
|
|
20530
|
-
const faceWorldNormal = normalizeVec3(
|
|
21275
|
+
const faceWorldNormal = normalizeVec3$1(
|
|
20531
21276
|
worldMatrix[0] * faceNormal[0] + worldMatrix[4] * faceNormal[1] + worldMatrix[8] * faceNormal[2],
|
|
20532
21277
|
worldMatrix[1] * faceNormal[0] + worldMatrix[5] * faceNormal[1] + worldMatrix[9] * faceNormal[2],
|
|
20533
21278
|
worldMatrix[2] * faceNormal[0] + worldMatrix[6] * faceNormal[1] + worldMatrix[10] * faceNormal[2]
|
|
@@ -20596,12 +21341,12 @@ function getPickedNormal(info, useWorldCoordinates = false) {
|
|
|
20596
21341
|
const nx = info.bu * normals[i0 * 3] + info.bv * normals[i1 * 3] + bw * normals[i22 * 3];
|
|
20597
21342
|
const ny = info.bu * normals[i0 * 3 + 1] + info.bv * normals[i1 * 3 + 1] + bw * normals[i22 * 3 + 1];
|
|
20598
21343
|
const nz = info.bu * normals[i0 * 3 + 2] + info.bv * normals[i1 * 3 + 2] + bw * normals[i22 * 3 + 2];
|
|
20599
|
-
const localNormal = normalizeVec3(nx, ny, nz);
|
|
21344
|
+
const localNormal = normalizeVec3$1(nx, ny, nz);
|
|
20600
21345
|
const wm = mi.worldMatrix;
|
|
20601
21346
|
const wnx = wm[0] * localNormal[0] + wm[4] * localNormal[1] + wm[8] * localNormal[2];
|
|
20602
21347
|
const wny = wm[1] * localNormal[0] + wm[5] * localNormal[1] + wm[9] * localNormal[2];
|
|
20603
21348
|
const wnz = wm[2] * localNormal[0] + wm[6] * localNormal[1] + wm[10] * localNormal[2];
|
|
20604
|
-
const worldNormal = normalizeVec3(wnx, wny, wnz);
|
|
21349
|
+
const worldNormal = normalizeVec3$1(wnx, wny, wnz);
|
|
20605
21350
|
const flip = info.ray ? worldNormal[0] * info.ray.direction[0] + worldNormal[1] * info.ray.direction[1] + worldNormal[2] * info.ray.direction[2] > 0 : false;
|
|
20606
21351
|
if (!useWorldCoordinates) {
|
|
20607
21352
|
return flip ? [-localNormal[0], -localNormal[1], -localNormal[2]] : localNormal;
|
|
@@ -20650,7 +21395,7 @@ function disposeUtilityLayer(utility) {
|
|
|
20650
21395
|
function dotVec3(a, b) {
|
|
20651
21396
|
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
20652
21397
|
}
|
|
20653
|
-
const normalizeVec3Obj = normalizeVec3$
|
|
21398
|
+
const normalizeVec3Obj = normalizeVec3$2;
|
|
20654
21399
|
function rayPlaneIntersect(rayOrigin, rayDir, planePoint, planeNormal) {
|
|
20655
21400
|
const denom = dotVec3(rayDir, planeNormal);
|
|
20656
21401
|
if (Math.abs(denom) < 1e-6) {
|
|
@@ -20729,7 +21474,7 @@ function transformDirectionByWorld(wm, dir) {
|
|
|
20729
21474
|
const x = wm[0] * dir.x + wm[4] * dir.y + wm[8] * dir.z;
|
|
20730
21475
|
const y = wm[1] * dir.x + wm[5] * dir.y + wm[9] * dir.z;
|
|
20731
21476
|
const z = wm[2] * dir.x + wm[6] * dir.y + wm[10] * dir.z;
|
|
20732
|
-
return normalizeVec3$
|
|
21477
|
+
return normalizeVec3$2({ x, y, z });
|
|
20733
21478
|
}
|
|
20734
21479
|
function worldDeltaToLocal(node, dx, dy, dz) {
|
|
20735
21480
|
const parent = node.parent;
|
|
@@ -25214,7 +25959,7 @@ function isBillboardSpriteHandleAlive(handle) {
|
|
|
25214
25959
|
}
|
|
25215
25960
|
function addBillboardSystem(scene, system) {
|
|
25216
25961
|
addDeferredSceneRenderables(scene, async (engine) => {
|
|
25217
|
-
const { buildBillboardRenderable } = await import("./billboard-renderable-
|
|
25962
|
+
const { buildBillboardRenderable } = await import("./billboard-renderable-HY2XCd52.js");
|
|
25218
25963
|
const built = buildBillboardRenderable(engine, system);
|
|
25219
25964
|
return { renderables: [built.renderable], dispose: built.dispose };
|
|
25220
25965
|
});
|
|
@@ -37867,6 +38612,26 @@ var PhysicsMotionType = /* @__PURE__ */ ((PhysicsMotionType2) => {
|
|
|
37867
38612
|
PhysicsMotionType2[PhysicsMotionType2["DYNAMIC"] = 2] = "DYNAMIC";
|
|
37868
38613
|
return PhysicsMotionType2;
|
|
37869
38614
|
})(PhysicsMotionType || {});
|
|
38615
|
+
var PhysicsConstraintType = /* @__PURE__ */ ((PhysicsConstraintType2) => {
|
|
38616
|
+
PhysicsConstraintType2[PhysicsConstraintType2["BALL_AND_SOCKET"] = 1] = "BALL_AND_SOCKET";
|
|
38617
|
+
PhysicsConstraintType2[PhysicsConstraintType2["DISTANCE"] = 2] = "DISTANCE";
|
|
38618
|
+
PhysicsConstraintType2[PhysicsConstraintType2["HINGE"] = 3] = "HINGE";
|
|
38619
|
+
PhysicsConstraintType2[PhysicsConstraintType2["SLIDER"] = 4] = "SLIDER";
|
|
38620
|
+
PhysicsConstraintType2[PhysicsConstraintType2["LOCK"] = 5] = "LOCK";
|
|
38621
|
+
PhysicsConstraintType2[PhysicsConstraintType2["PRISMATIC"] = 6] = "PRISMATIC";
|
|
38622
|
+
PhysicsConstraintType2[PhysicsConstraintType2["SIX_DOF"] = 7] = "SIX_DOF";
|
|
38623
|
+
return PhysicsConstraintType2;
|
|
38624
|
+
})(PhysicsConstraintType || {});
|
|
38625
|
+
var PhysicsConstraintAxis = /* @__PURE__ */ ((PhysicsConstraintAxis2) => {
|
|
38626
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_X"] = 0] = "LINEAR_X";
|
|
38627
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_Y"] = 1] = "LINEAR_Y";
|
|
38628
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_Z"] = 2] = "LINEAR_Z";
|
|
38629
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_X"] = 3] = "ANGULAR_X";
|
|
38630
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_Y"] = 4] = "ANGULAR_Y";
|
|
38631
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_Z"] = 5] = "ANGULAR_Z";
|
|
38632
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_DISTANCE"] = 6] = "LINEAR_DISTANCE";
|
|
38633
|
+
return PhysicsConstraintAxis2;
|
|
38634
|
+
})(PhysicsConstraintAxis || {});
|
|
37870
38635
|
function createHavokWorld(scene, hknp, gravity) {
|
|
37871
38636
|
const hkWorld = hknp.HP_World_Create()[1];
|
|
37872
38637
|
const g = gravity ?? { x: 0, y: -9.81, z: 0 };
|
|
@@ -37884,7 +38649,7 @@ function createHavokWorld(scene, hknp, gravity) {
|
|
|
37884
38649
|
return world;
|
|
37885
38650
|
}
|
|
37886
38651
|
async function enableHavokFloatingOrigin(world, floatingOriginWorldRadius = 1e5) {
|
|
37887
|
-
const fo = await import("./havok-floating-origin-
|
|
38652
|
+
const fo = await import("./havok-floating-origin-5xp32P-C.js");
|
|
37888
38653
|
world._fo = fo.createHavokFloatingOriginContext(world._hkWorld, world._gravity, floatingOriginWorldRadius);
|
|
37889
38654
|
}
|
|
37890
38655
|
function _stepWorld(world, deltaMs) {
|
|
@@ -37899,7 +38664,7 @@ function _stepWorld(world, deltaMs) {
|
|
|
37899
38664
|
}
|
|
37900
38665
|
for (let i = 0; i < bodies.length; i++) {
|
|
37901
38666
|
const b = bodies[i];
|
|
37902
|
-
if (b.motionType === 1) {
|
|
38667
|
+
if (b.motionType === 1 || b._preStep) {
|
|
37903
38668
|
_syncNodeToBody(hknp, b);
|
|
37904
38669
|
}
|
|
37905
38670
|
}
|
|
@@ -37910,6 +38675,15 @@ function _stepWorld(world, deltaMs) {
|
|
|
37910
38675
|
_syncBodyToNode(hknp, b);
|
|
37911
38676
|
}
|
|
37912
38677
|
}
|
|
38678
|
+
if (world._afterStep) {
|
|
38679
|
+
const cbs = world._afterStep;
|
|
38680
|
+
for (let i = 0; i < cbs.length; i++) {
|
|
38681
|
+
cbs[i](world._timestep);
|
|
38682
|
+
}
|
|
38683
|
+
}
|
|
38684
|
+
}
|
|
38685
|
+
function onPhysicsAfterStep(world, cb2) {
|
|
38686
|
+
(world._afterStep ?? (world._afterStep = [])).push(cb2);
|
|
37913
38687
|
}
|
|
37914
38688
|
function _syncBodyToNode(hknp, body) {
|
|
37915
38689
|
const t = hknp.HP_Body_GetQTransform(body._hkBody)[1];
|
|
@@ -37967,6 +38741,9 @@ function createPhysicsBody(world, node, motionType, startsAsleep = false) {
|
|
|
37967
38741
|
hknp.HP_Body_SetMotionType(hkBody, hkMotion);
|
|
37968
38742
|
const body = {
|
|
37969
38743
|
_hkBody: hkBody,
|
|
38744
|
+
_shape: null,
|
|
38745
|
+
_preStep: false,
|
|
38746
|
+
_world: world,
|
|
37970
38747
|
node,
|
|
37971
38748
|
motionType
|
|
37972
38749
|
};
|
|
@@ -37984,48 +38761,331 @@ function createPhysicsBody(world, node, motionType, startsAsleep = false) {
|
|
|
37984
38761
|
world._bodies.push(body);
|
|
37985
38762
|
return body;
|
|
37986
38763
|
}
|
|
38764
|
+
function setPhysicsBodyPreStep(body, enabled) {
|
|
38765
|
+
body._preStep = enabled;
|
|
38766
|
+
}
|
|
38767
|
+
function applyPhysicsBodyImpulse(body, impulse, location) {
|
|
38768
|
+
const hknp = body._world._hknp;
|
|
38769
|
+
hknp.HP_Body_ApplyImpulse(body._hkBody, [location.x, location.y, location.z], [impulse.x, impulse.y, impulse.z]);
|
|
38770
|
+
}
|
|
38771
|
+
function applyPhysicsBodyForce(world, body, force, location) {
|
|
38772
|
+
applyPhysicsBodyImpulse(body, { x: force.x * world._timestep, y: force.y * world._timestep, z: force.z * world._timestep }, location);
|
|
38773
|
+
}
|
|
38774
|
+
function createPhysicsConstraint(world, bodyA, bodyB, type, options = {}, limits = []) {
|
|
38775
|
+
const hknp = world._hknp;
|
|
38776
|
+
const joint = hknp.HP_Constraint_Create()[1];
|
|
38777
|
+
hknp.HP_Constraint_SetParentBody(joint, bodyA._hkBody);
|
|
38778
|
+
hknp.HP_Constraint_SetChildBody(joint, bodyB._hkBody);
|
|
38779
|
+
const pivotA = options.pivotA ?? ZERO_VEC3;
|
|
38780
|
+
const pivotB = options.pivotB ?? ZERO_VEC3;
|
|
38781
|
+
const axisA = options.axisA ?? X_AXIS;
|
|
38782
|
+
const axisB = options.axisB ?? X_AXIS;
|
|
38783
|
+
const perpAxisA = options.perpAxisA ?? normalTo$1(axisA);
|
|
38784
|
+
const perpAxisB = options.perpAxisB ?? normalTo$1(axisB);
|
|
38785
|
+
hknp.HP_Constraint_SetAnchorInParent(joint, vec3Array(pivotA), vec3Array(axisA), vec3Array(perpAxisA));
|
|
38786
|
+
hknp.HP_Constraint_SetAnchorInChild(joint, vec3Array(pivotB), vec3Array(axisB), vec3Array(perpAxisB));
|
|
38787
|
+
configureConstraintAxes(hknp, joint, type, options, limits);
|
|
38788
|
+
hknp.HP_Constraint_SetCollisionsEnabled(joint, !!options.collision);
|
|
38789
|
+
hknp.HP_Constraint_SetEnabled(joint, true);
|
|
38790
|
+
return { _hkConstraint: joint, bodyA, bodyB, type, options: { ...options, axisA, axisB, perpAxisA, perpAxisB }, limits };
|
|
38791
|
+
}
|
|
38792
|
+
function setPhysicsShapeFilterMembershipMask(world, shape, membershipMask) {
|
|
38793
|
+
const info = world._hknp.HP_Shape_GetFilterInfo(shape._hkShape)[1];
|
|
38794
|
+
world._hknp.HP_Shape_SetFilterInfo(shape._hkShape, [membershipMask, info[1]]);
|
|
38795
|
+
}
|
|
38796
|
+
function setPhysicsShapeFilterCollideMask(world, shape, collideMask) {
|
|
38797
|
+
const info = world._hknp.HP_Shape_GetFilterInfo(shape._hkShape)[1];
|
|
38798
|
+
world._hknp.HP_Shape_SetFilterInfo(shape._hkShape, [info[0], collideMask]);
|
|
38799
|
+
}
|
|
38800
|
+
const ZERO_VEC3 = { x: 0, y: 0, z: 0 };
|
|
38801
|
+
const X_AXIS = { x: 1, y: 0, z: 0 };
|
|
38802
|
+
function vec3Array(v) {
|
|
38803
|
+
return [v.x, v.y, v.z];
|
|
38804
|
+
}
|
|
38805
|
+
function normalTo$1(axis) {
|
|
38806
|
+
const ax2 = Math.abs(axis.x);
|
|
38807
|
+
const ay = Math.abs(axis.y);
|
|
38808
|
+
const az = Math.abs(axis.z);
|
|
38809
|
+
if (ax2 <= ay && ax2 <= az) {
|
|
38810
|
+
return normalizeVec3({ x: 0, y: -axis.z, z: axis.y });
|
|
38811
|
+
}
|
|
38812
|
+
if (ay <= ax2 && ay <= az) {
|
|
38813
|
+
return normalizeVec3({ x: -axis.z, y: 0, z: axis.x });
|
|
38814
|
+
}
|
|
38815
|
+
return normalizeVec3({ x: -axis.y, y: axis.x, z: 0 });
|
|
38816
|
+
}
|
|
38817
|
+
function normalizeVec3(v) {
|
|
38818
|
+
const inv = 1 / Math.max(1e-8, Math.hypot(v.x, v.y, v.z));
|
|
38819
|
+
return { x: v.x * inv, y: v.y * inv, z: v.z * inv };
|
|
38820
|
+
}
|
|
38821
|
+
function configureConstraintAxes(hknp, joint, type, options, limits) {
|
|
38822
|
+
const axis = hknp.ConstraintAxis;
|
|
38823
|
+
const mode = hknp.ConstraintAxisLimitMode;
|
|
38824
|
+
const lock = (a) => hknp.HP_Constraint_SetAxisMode(joint, a, mode.LOCKED);
|
|
38825
|
+
const limit = (a, min, max) => {
|
|
38826
|
+
hknp.HP_Constraint_SetAxisMode(joint, a, mode.LIMITED);
|
|
38827
|
+
hknp.HP_Constraint_SetAxisMinLimit(joint, a, min);
|
|
38828
|
+
hknp.HP_Constraint_SetAxisMaxLimit(joint, a, max);
|
|
38829
|
+
};
|
|
38830
|
+
switch (type) {
|
|
38831
|
+
case 5:
|
|
38832
|
+
lock(axis.LINEAR_X);
|
|
38833
|
+
lock(axis.LINEAR_Y);
|
|
38834
|
+
lock(axis.LINEAR_Z);
|
|
38835
|
+
lock(axis.ANGULAR_X);
|
|
38836
|
+
lock(axis.ANGULAR_Y);
|
|
38837
|
+
lock(axis.ANGULAR_Z);
|
|
38838
|
+
break;
|
|
38839
|
+
case 2: {
|
|
38840
|
+
const d = options.maxDistance ?? 0;
|
|
38841
|
+
limit(axis.LINEAR_DISTANCE, d, d);
|
|
38842
|
+
break;
|
|
38843
|
+
}
|
|
38844
|
+
case 3:
|
|
38845
|
+
lock(axis.LINEAR_X);
|
|
38846
|
+
lock(axis.LINEAR_Y);
|
|
38847
|
+
lock(axis.LINEAR_Z);
|
|
38848
|
+
lock(axis.ANGULAR_Y);
|
|
38849
|
+
lock(axis.ANGULAR_Z);
|
|
38850
|
+
break;
|
|
38851
|
+
case 6:
|
|
38852
|
+
lock(axis.LINEAR_Y);
|
|
38853
|
+
lock(axis.LINEAR_Z);
|
|
38854
|
+
lock(axis.ANGULAR_X);
|
|
38855
|
+
lock(axis.ANGULAR_Y);
|
|
38856
|
+
lock(axis.ANGULAR_Z);
|
|
38857
|
+
break;
|
|
38858
|
+
case 4:
|
|
38859
|
+
lock(axis.LINEAR_Y);
|
|
38860
|
+
lock(axis.LINEAR_Z);
|
|
38861
|
+
lock(axis.ANGULAR_Y);
|
|
38862
|
+
lock(axis.ANGULAR_Z);
|
|
38863
|
+
break;
|
|
38864
|
+
case 1:
|
|
38865
|
+
lock(axis.LINEAR_X);
|
|
38866
|
+
lock(axis.LINEAR_Y);
|
|
38867
|
+
lock(axis.LINEAR_Z);
|
|
38868
|
+
break;
|
|
38869
|
+
case 7:
|
|
38870
|
+
for (const l of limits) {
|
|
38871
|
+
const nativeAxis = constraintAxisToNative(axis, l.axis);
|
|
38872
|
+
if ((l.minLimit ?? -1) === 0 && (l.maxLimit ?? -1) === 0) {
|
|
38873
|
+
lock(nativeAxis);
|
|
38874
|
+
} else {
|
|
38875
|
+
if (l.minLimit !== void 0 || l.maxLimit !== void 0) {
|
|
38876
|
+
hknp.HP_Constraint_SetAxisMode(joint, nativeAxis, mode.LIMITED);
|
|
38877
|
+
}
|
|
38878
|
+
if (l.minLimit !== void 0) {
|
|
38879
|
+
hknp.HP_Constraint_SetAxisMinLimit(joint, nativeAxis, l.minLimit);
|
|
38880
|
+
}
|
|
38881
|
+
if (l.maxLimit !== void 0) {
|
|
38882
|
+
hknp.HP_Constraint_SetAxisMaxLimit(joint, nativeAxis, l.maxLimit);
|
|
38883
|
+
}
|
|
38884
|
+
}
|
|
38885
|
+
if (l.stiffness !== void 0) {
|
|
38886
|
+
hknp.HP_Constraint_SetAxisStiffness(joint, nativeAxis, l.stiffness);
|
|
38887
|
+
}
|
|
38888
|
+
if (l.damping !== void 0) {
|
|
38889
|
+
hknp.HP_Constraint_SetAxisDamping(joint, nativeAxis, l.damping);
|
|
38890
|
+
}
|
|
38891
|
+
}
|
|
38892
|
+
break;
|
|
38893
|
+
}
|
|
38894
|
+
}
|
|
38895
|
+
function constraintAxisToNative(axis, value) {
|
|
38896
|
+
switch (value) {
|
|
38897
|
+
case 0:
|
|
38898
|
+
return axis.LINEAR_X;
|
|
38899
|
+
case 1:
|
|
38900
|
+
return axis.LINEAR_Y;
|
|
38901
|
+
case 2:
|
|
38902
|
+
return axis.LINEAR_Z;
|
|
38903
|
+
case 3:
|
|
38904
|
+
return axis.ANGULAR_X;
|
|
38905
|
+
case 4:
|
|
38906
|
+
return axis.ANGULAR_Y;
|
|
38907
|
+
case 5:
|
|
38908
|
+
return axis.ANGULAR_Z;
|
|
38909
|
+
case 6:
|
|
38910
|
+
return axis.LINEAR_DISTANCE;
|
|
38911
|
+
}
|
|
38912
|
+
}
|
|
38913
|
+
class MeshAccumulator {
|
|
38914
|
+
constructor(collectIndices) {
|
|
38915
|
+
__publicField(this, "_vertices", []);
|
|
38916
|
+
__publicField(this, "_indices", []);
|
|
38917
|
+
__publicField(this, "_collectIndices");
|
|
38918
|
+
this._collectIndices = collectIndices;
|
|
38919
|
+
}
|
|
38920
|
+
addNodeMeshes(root, includeChildren) {
|
|
38921
|
+
const invRoot = mat4Invert(root.worldMatrix);
|
|
38922
|
+
if (!invRoot) {
|
|
38923
|
+
throw new Error("Cannot create physics mesh shape from a singular root transform.");
|
|
38924
|
+
}
|
|
38925
|
+
const rootScale = mat4Scale(root.scaling.x, root.scaling.y, root.scaling.z);
|
|
38926
|
+
const rootToBody = mat4Multiply(rootScale, invRoot);
|
|
38927
|
+
this._addNodeMesh(root, rootToBody);
|
|
38928
|
+
if (includeChildren) {
|
|
38929
|
+
for (const child of root.children) {
|
|
38930
|
+
this._addDescendantMeshes(child, rootToBody);
|
|
38931
|
+
}
|
|
38932
|
+
}
|
|
38933
|
+
if (this._vertices.length === 0) {
|
|
38934
|
+
throw new Error("Cannot create physics mesh shape without vertex positions.");
|
|
38935
|
+
}
|
|
38936
|
+
if (this._collectIndices && this._indices.length === 0) {
|
|
38937
|
+
throw new Error("Cannot create physics mesh shape without triangle indices.");
|
|
38938
|
+
}
|
|
38939
|
+
}
|
|
38940
|
+
getVertices(hknp) {
|
|
38941
|
+
const numObjects = this._vertices.length;
|
|
38942
|
+
const offset = hknp._malloc(numObjects * 4);
|
|
38943
|
+
new Float32Array(hknp.HEAPU8.buffer, offset, numObjects).set(this._vertices);
|
|
38944
|
+
return { offset, numObjects };
|
|
38945
|
+
}
|
|
38946
|
+
getTriangles(hknp) {
|
|
38947
|
+
const numObjects = this._indices.length;
|
|
38948
|
+
const offset = hknp._malloc(numObjects * 4);
|
|
38949
|
+
new Int32Array(hknp.HEAPU8.buffer, offset, numObjects).set(this._indices);
|
|
38950
|
+
return { offset, numObjects };
|
|
38951
|
+
}
|
|
38952
|
+
freeBuffer(hknp, buffer) {
|
|
38953
|
+
hknp._free(buffer.offset);
|
|
38954
|
+
}
|
|
38955
|
+
_addDescendantMeshes(node, rootToBody) {
|
|
38956
|
+
this._addNodeMesh(node, rootToBody);
|
|
38957
|
+
for (const child of node.children) {
|
|
38958
|
+
this._addDescendantMeshes(child, rootToBody);
|
|
38959
|
+
}
|
|
38960
|
+
}
|
|
38961
|
+
_addNodeMesh(node, rootToBody) {
|
|
38962
|
+
if (!isMesh(node)) {
|
|
38963
|
+
return;
|
|
38964
|
+
}
|
|
38965
|
+
const positions = node._cpuPositions;
|
|
38966
|
+
if (!positions || positions.length === 0) {
|
|
38967
|
+
return;
|
|
38968
|
+
}
|
|
38969
|
+
const meshToBody = mat4Multiply(rootToBody, node.worldMatrix);
|
|
38970
|
+
const indexOffset = this._vertices.length / 3;
|
|
38971
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
38972
|
+
transformPositionInto(this._vertices, meshToBody, positions[i], positions[i + 1], positions[i + 2]);
|
|
38973
|
+
}
|
|
38974
|
+
if (!this._collectIndices) {
|
|
38975
|
+
return;
|
|
38976
|
+
}
|
|
38977
|
+
const indices = node._cpuIndices;
|
|
38978
|
+
if (!indices) {
|
|
38979
|
+
return;
|
|
38980
|
+
}
|
|
38981
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
38982
|
+
const a = indices[i] + indexOffset;
|
|
38983
|
+
const b = indices[i + 1] + indexOffset;
|
|
38984
|
+
const c2 = indices[i + 2] + indexOffset;
|
|
38985
|
+
this._indices.push(c2, b, a);
|
|
38986
|
+
}
|
|
38987
|
+
}
|
|
38988
|
+
}
|
|
38989
|
+
function isMesh(node) {
|
|
38990
|
+
return "_gpu" in node && "_cpuPositions" in node;
|
|
38991
|
+
}
|
|
38992
|
+
function transformPositionInto(dst, m2, x, y, z) {
|
|
38993
|
+
dst.push(m2[0] * x + m2[4] * y + m2[8] * z + m2[12], m2[1] * x + m2[5] * y + m2[9] * z + m2[13], m2[2] * x + m2[6] * y + m2[10] * z + m2[14]);
|
|
38994
|
+
}
|
|
37987
38995
|
function createPhysicsShape(world, options) {
|
|
37988
38996
|
const { _hknp: hknp } = world;
|
|
37989
38997
|
const params = options.parameters ?? {};
|
|
37990
38998
|
let hkShape;
|
|
38999
|
+
const primitiveShape = createPrimitivePhysicsShapeHandle(hknp, options.type, params);
|
|
39000
|
+
if (primitiveShape !== null) {
|
|
39001
|
+
return { _hkShape: primitiveShape, _type: options.type };
|
|
39002
|
+
}
|
|
37991
39003
|
switch (options.type) {
|
|
39004
|
+
case 5: {
|
|
39005
|
+
hkShape = hknp.HP_Shape_CreateContainer()[1];
|
|
39006
|
+
break;
|
|
39007
|
+
}
|
|
39008
|
+
case 4:
|
|
39009
|
+
case 6: {
|
|
39010
|
+
if (!options.mesh) {
|
|
39011
|
+
throw new Error("Physics mesh shapes require a mesh or transform hierarchy.");
|
|
39012
|
+
}
|
|
39013
|
+
const collectIndices = options.type === 6;
|
|
39014
|
+
const accum = new MeshAccumulator(collectIndices);
|
|
39015
|
+
accum.addNodeMeshes(options.mesh, options.includeChildMeshes ?? false);
|
|
39016
|
+
const positions = accum.getVertices(hknp);
|
|
39017
|
+
const numVec3s = positions.numObjects / 3;
|
|
39018
|
+
if (options.type === 4) {
|
|
39019
|
+
hkShape = hknp.HP_Shape_CreateConvexHull(positions.offset, numVec3s)[1];
|
|
39020
|
+
} else {
|
|
39021
|
+
const triangles = accum.getTriangles(hknp);
|
|
39022
|
+
const numTriangles = triangles.numObjects / 3;
|
|
39023
|
+
hkShape = hknp.HP_Shape_CreateMesh(positions.offset, numVec3s, triangles.offset, numTriangles)[1];
|
|
39024
|
+
accum.freeBuffer(hknp, triangles);
|
|
39025
|
+
}
|
|
39026
|
+
accum.freeBuffer(hknp, positions);
|
|
39027
|
+
break;
|
|
39028
|
+
}
|
|
39029
|
+
default:
|
|
39030
|
+
throw new Error(`Unsupported shape type: ${options.type}`);
|
|
39031
|
+
}
|
|
39032
|
+
return { _hkShape: hkShape, _type: options.type };
|
|
39033
|
+
}
|
|
39034
|
+
function createPrimitivePhysicsShapeHandle(hknp, type, params) {
|
|
39035
|
+
switch (type) {
|
|
37992
39036
|
case 0: {
|
|
37993
39037
|
const c2 = params.center ?? { x: 0, y: 0, z: 0 };
|
|
37994
39038
|
const r = params.radius ?? 0.5;
|
|
37995
|
-
|
|
37996
|
-
break;
|
|
39039
|
+
return hknp.HP_Shape_CreateSphere([c2.x, c2.y, c2.z], r)[1];
|
|
37997
39040
|
}
|
|
37998
39041
|
case 3: {
|
|
37999
39042
|
const c2 = params.center ?? { x: 0, y: 0, z: 0 };
|
|
38000
39043
|
const q = params.rotation ?? { x: 0, y: 0, z: 0, w: 1 };
|
|
38001
39044
|
const e = params.extents ?? { x: 1, y: 1, z: 1 };
|
|
38002
|
-
|
|
38003
|
-
break;
|
|
39045
|
+
return hknp.HP_Shape_CreateBox([c2.x, c2.y, c2.z], [q.x, q.y, q.z, q.w], [e.x, e.y, e.z])[1];
|
|
38004
39046
|
}
|
|
38005
39047
|
case 1: {
|
|
38006
39048
|
const a = params.pointA ?? { x: 0, y: 0, z: 0 };
|
|
38007
39049
|
const b = params.pointB ?? { x: 0, y: 1, z: 0 };
|
|
38008
39050
|
const r = params.radius ?? 0.5;
|
|
38009
|
-
|
|
38010
|
-
break;
|
|
39051
|
+
return hknp.HP_Shape_CreateCapsule([a.x, a.y, a.z], [b.x, b.y, b.z], r)[1];
|
|
38011
39052
|
}
|
|
38012
39053
|
case 2: {
|
|
38013
39054
|
const a = params.pointA ?? { x: 0, y: 0, z: 0 };
|
|
38014
39055
|
const b = params.pointB ?? { x: 0, y: 1, z: 0 };
|
|
38015
39056
|
const r = params.radius ?? 0.5;
|
|
38016
|
-
|
|
38017
|
-
break;
|
|
39057
|
+
return hknp.HP_Shape_CreateCylinder([a.x, a.y, a.z], [b.x, b.y, b.z], r)[1];
|
|
38018
39058
|
}
|
|
38019
39059
|
default:
|
|
38020
|
-
|
|
39060
|
+
return null;
|
|
38021
39061
|
}
|
|
38022
|
-
return { _hkShape: hkShape };
|
|
38023
39062
|
}
|
|
38024
39063
|
function setPhysicsBodyShape(world, body, shape) {
|
|
38025
39064
|
world._hknp.HP_Body_SetShape(body._hkBody, shape._hkShape);
|
|
39065
|
+
body._shape = shape;
|
|
39066
|
+
}
|
|
39067
|
+
function addPhysicsShapeChild(world, container, child, translation, rotation, scale) {
|
|
39068
|
+
const t = translation ?? { x: 0, y: 0, z: 0 };
|
|
39069
|
+
const r = rotation ?? { x: 0, y: 0, z: 0, w: 1 };
|
|
39070
|
+
const s = scale ?? { x: 1, y: 1, z: 1 };
|
|
39071
|
+
world._hknp.HP_Shape_AddChild(container._hkShape, child._hkShape, [
|
|
39072
|
+
[t.x, t.y, t.z],
|
|
39073
|
+
[r.x, r.y, r.z, r.w],
|
|
39074
|
+
[s.x, s.y, s.z]
|
|
39075
|
+
]);
|
|
39076
|
+
}
|
|
39077
|
+
function addPhysicsShapeChildFromParent(world, container, parentNode, child, childNode) {
|
|
39078
|
+
const invParent = mat4Invert(parentNode.worldMatrix);
|
|
39079
|
+
if (!invParent) {
|
|
39080
|
+
throw new Error("Cannot add physics child shape from a singular parent transform.");
|
|
39081
|
+
}
|
|
39082
|
+
const childToParent = mat4Multiply(invParent, childNode.worldMatrix);
|
|
39083
|
+
const transform = decomposeMatrix(childToParent);
|
|
39084
|
+
addPhysicsShapeChild(world, container, child, transform.translation, transform.rotation, transform.scale);
|
|
38026
39085
|
}
|
|
38027
39086
|
function setPhysicsShapeMaterial(world, shape, friction, restitution) {
|
|
38028
|
-
const
|
|
39087
|
+
const combines = world._hknp.MaterialCombine;
|
|
39088
|
+
const material = [friction, friction, restitution, combines.MINIMUM, combines.MAXIMUM];
|
|
38029
39089
|
world._hknp.HP_Shape_SetMaterial(shape._hkShape, material);
|
|
38030
39090
|
}
|
|
38031
39091
|
function setPhysicsBodyMass(world, body, mass, centerOfMass) {
|
|
@@ -38033,6 +39093,88 @@ function setPhysicsBodyMass(world, body, mass, centerOfMass) {
|
|
|
38033
39093
|
const massProps = [[com.x, com.y, com.z], mass, [mass, mass, mass], [0, 0, 0, 1]];
|
|
38034
39094
|
world._hknp.HP_Body_SetMassProperties(body._hkBody, massProps);
|
|
38035
39095
|
}
|
|
39096
|
+
function setPhysicsBodyMassProperties(world, body, properties) {
|
|
39097
|
+
const massProps = buildMassProperties(world, body);
|
|
39098
|
+
if (properties.centerOfMass) {
|
|
39099
|
+
massProps[0] = [properties.centerOfMass.x, properties.centerOfMass.y, properties.centerOfMass.z];
|
|
39100
|
+
}
|
|
39101
|
+
if (properties.mass !== void 0) {
|
|
39102
|
+
massProps[1] = properties.mass;
|
|
39103
|
+
}
|
|
39104
|
+
if (properties.inertia) {
|
|
39105
|
+
massProps[2] = [properties.inertia.x, properties.inertia.y, properties.inertia.z];
|
|
39106
|
+
}
|
|
39107
|
+
if (properties.inertiaOrientation) {
|
|
39108
|
+
massProps[3] = [properties.inertiaOrientation.x, properties.inertiaOrientation.y, properties.inertiaOrientation.z, properties.inertiaOrientation.w];
|
|
39109
|
+
}
|
|
39110
|
+
world._hknp.HP_Body_SetMassProperties(body._hkBody, massProps);
|
|
39111
|
+
}
|
|
39112
|
+
function buildMassProperties(world, body) {
|
|
39113
|
+
var _a;
|
|
39114
|
+
const hknp = world._hknp;
|
|
39115
|
+
const ok = ((_a = hknp.Result) == null ? void 0 : _a.RESULT_OK) ?? 0;
|
|
39116
|
+
const shape = hknp.HP_Body_GetShape(body._hkBody);
|
|
39117
|
+
if (shape[0] === ok) {
|
|
39118
|
+
const shapeMass = hknp.HP_Shape_BuildMassProperties(shape[1]);
|
|
39119
|
+
if (shapeMass[0] === ok) {
|
|
39120
|
+
return shapeMass[1];
|
|
39121
|
+
}
|
|
39122
|
+
}
|
|
39123
|
+
return [[0, 0, 0], 1, [1, 1, 1], [0, 0, 0, 1]];
|
|
39124
|
+
}
|
|
39125
|
+
function decomposeMatrix(m2) {
|
|
39126
|
+
const sx = Math.hypot(m2[0], m2[1], m2[2]);
|
|
39127
|
+
const sy = Math.hypot(m2[4], m2[5], m2[6]);
|
|
39128
|
+
const sz = Math.hypot(m2[8], m2[9], m2[10]);
|
|
39129
|
+
const invSx = sx > 1e-8 ? 1 / sx : 0;
|
|
39130
|
+
const invSy = sy > 1e-8 ? 1 / sy : 0;
|
|
39131
|
+
const invSz = sz > 1e-8 ? 1 / sz : 0;
|
|
39132
|
+
const r00 = m2[0] * invSx;
|
|
39133
|
+
const r01 = m2[4] * invSy;
|
|
39134
|
+
const r02 = m2[8] * invSz;
|
|
39135
|
+
const r10 = m2[1] * invSx;
|
|
39136
|
+
const r11 = m2[5] * invSy;
|
|
39137
|
+
const r12 = m2[9] * invSz;
|
|
39138
|
+
const r20 = m2[2] * invSx;
|
|
39139
|
+
const r21 = m2[6] * invSy;
|
|
39140
|
+
const r22 = m2[10] * invSz;
|
|
39141
|
+
let x;
|
|
39142
|
+
let y;
|
|
39143
|
+
let z;
|
|
39144
|
+
let w;
|
|
39145
|
+
const trace = r00 + r11 + r22;
|
|
39146
|
+
if (trace > 0) {
|
|
39147
|
+
const s = Math.sqrt(trace + 1) * 2;
|
|
39148
|
+
w = 0.25 * s;
|
|
39149
|
+
x = (r21 - r12) / s;
|
|
39150
|
+
y = (r02 - r20) / s;
|
|
39151
|
+
z = (r10 - r01) / s;
|
|
39152
|
+
} else if (r00 > r11 && r00 > r22) {
|
|
39153
|
+
const s = Math.sqrt(1 + r00 - r11 - r22) * 2;
|
|
39154
|
+
w = (r21 - r12) / s;
|
|
39155
|
+
x = 0.25 * s;
|
|
39156
|
+
y = (r01 + r10) / s;
|
|
39157
|
+
z = (r02 + r20) / s;
|
|
39158
|
+
} else if (r11 > r22) {
|
|
39159
|
+
const s = Math.sqrt(1 + r11 - r00 - r22) * 2;
|
|
39160
|
+
w = (r02 - r20) / s;
|
|
39161
|
+
x = (r01 + r10) / s;
|
|
39162
|
+
y = 0.25 * s;
|
|
39163
|
+
z = (r12 + r21) / s;
|
|
39164
|
+
} else {
|
|
39165
|
+
const s = Math.sqrt(1 + r22 - r00 - r11) * 2;
|
|
39166
|
+
w = (r10 - r01) / s;
|
|
39167
|
+
x = (r02 + r20) / s;
|
|
39168
|
+
y = (r12 + r21) / s;
|
|
39169
|
+
z = 0.25 * s;
|
|
39170
|
+
}
|
|
39171
|
+
const invLen = 1 / Math.hypot(x, y, z, w);
|
|
39172
|
+
return {
|
|
39173
|
+
translation: { x: m2[12], y: m2[13], z: m2[14] },
|
|
39174
|
+
rotation: { x: x * invLen, y: y * invLen, z: z * invLen, w: w * invLen },
|
|
39175
|
+
scale: { x: sx, y: sy, z: sz }
|
|
39176
|
+
};
|
|
39177
|
+
}
|
|
38036
39178
|
function applyPhysicsImpulse(world, body, impulse, point) {
|
|
38037
39179
|
const hknp = world._hknp;
|
|
38038
39180
|
let loc = point;
|
|
@@ -38081,13 +39223,20 @@ function releasePhysicsShape(world, shape) {
|
|
|
38081
39223
|
}
|
|
38082
39224
|
function createPhysicsAggregate(world, node, type, options) {
|
|
38083
39225
|
const motionType = options.mass === 0 ? 0 : 2;
|
|
38084
|
-
|
|
38085
|
-
|
|
38086
|
-
|
|
38087
|
-
|
|
38088
|
-
|
|
39226
|
+
let shape = options.shape;
|
|
39227
|
+
if (!shape) {
|
|
39228
|
+
const shapeParams = _buildShapeParams(node, type, options);
|
|
39229
|
+
const hkShape = createPrimitivePhysicsShapeHandle(world._hknp, type, shapeParams);
|
|
39230
|
+
if (hkShape === null) {
|
|
39231
|
+
throw new Error("createPhysicsAggregate supports only primitive physics shapes.");
|
|
39232
|
+
}
|
|
39233
|
+
shape = { _hkShape: hkShape, _type: type };
|
|
39234
|
+
}
|
|
38089
39235
|
const body = createPhysicsBody(world, node, motionType, options.startAsleep);
|
|
38090
39236
|
setPhysicsBodyShape(world, body, shape);
|
|
39237
|
+
const friction = options.friction ?? 0.2;
|
|
39238
|
+
const restitution = options.restitution ?? 0.2;
|
|
39239
|
+
setPhysicsShapeMaterial(world, shape, friction, restitution);
|
|
38091
39240
|
if (options.mass > 0) {
|
|
38092
39241
|
setPhysicsBodyMass(world, body, options.mass);
|
|
38093
39242
|
}
|
|
@@ -38151,6 +39300,26 @@ function _boundingRadius(mesh) {
|
|
|
38151
39300
|
}
|
|
38152
39301
|
return 0.5;
|
|
38153
39302
|
}
|
|
39303
|
+
function getPhysicsBodyDebugGeometry(world, body) {
|
|
39304
|
+
var _a;
|
|
39305
|
+
const hknp = world._hknp;
|
|
39306
|
+
const shapeResult = hknp.HP_Body_GetShape(body._hkBody);
|
|
39307
|
+
const ok = ((_a = hknp.Result) == null ? void 0 : _a.RESULT_OK) ?? 0;
|
|
39308
|
+
if (shapeResult[0] !== ok || !shapeResult[1]) {
|
|
39309
|
+
return { positions: new Float32Array(0), indices: new Uint32Array(0) };
|
|
39310
|
+
}
|
|
39311
|
+
const geometryResult = hknp.HP_Shape_CreateDebugDisplayGeometry(shapeResult[1]);
|
|
39312
|
+
if (geometryResult[0] !== ok) {
|
|
39313
|
+
return { positions: new Float32Array(0), indices: new Uint32Array(0) };
|
|
39314
|
+
}
|
|
39315
|
+
const geometryInfo = hknp.HP_DebugGeometry_GetInfo(geometryResult[1])[1];
|
|
39316
|
+
const positionsInPlugin = new Float32Array(hknp.HEAPU8.buffer, geometryInfo[0], geometryInfo[1] * 3);
|
|
39317
|
+
const indicesInPlugin = new Uint32Array(hknp.HEAPU8.buffer, geometryInfo[2], geometryInfo[3] * 3);
|
|
39318
|
+
const positions = positionsInPlugin.slice(0);
|
|
39319
|
+
const indices = indicesInPlugin.slice(0);
|
|
39320
|
+
hknp.HP_DebugGeometry_Release(geometryResult[1]);
|
|
39321
|
+
return { positions, indices };
|
|
39322
|
+
}
|
|
38154
39323
|
function disposePhysics(world) {
|
|
38155
39324
|
if (world._fo) {
|
|
38156
39325
|
world._fo.dispose(world);
|
|
@@ -38165,6 +39334,653 @@ function disposePhysics(world) {
|
|
|
38165
39334
|
bodies.length = 0;
|
|
38166
39335
|
hknp.HP_World_Release(hkWorld);
|
|
38167
39336
|
}
|
|
39337
|
+
function createHeightFieldShape(world, options) {
|
|
39338
|
+
const { _hknp: hknp } = world;
|
|
39339
|
+
const resolved = options.groundMesh ? optionsFromGroundMesh(options.groundMesh) : resolveExplicit(options);
|
|
39340
|
+
const { numX, numZ, sizeX, sizeZ, data } = resolved;
|
|
39341
|
+
const totalNumHeights = numX * numZ;
|
|
39342
|
+
const bufferBegin = hknp._malloc(totalNumHeights * 4);
|
|
39343
|
+
const heightBuffer = new Float32Array(hknp.HEAPU8.buffer, bufferBegin, totalNumHeights);
|
|
39344
|
+
for (let x = 0; x < numX; x++) {
|
|
39345
|
+
for (let z = 0; z < numZ; z++) {
|
|
39346
|
+
const hkIndex = z * numX + x;
|
|
39347
|
+
const bjsIndex = (numX - 1 - x) * numZ + z;
|
|
39348
|
+
heightBuffer[hkIndex] = data[bjsIndex];
|
|
39349
|
+
}
|
|
39350
|
+
}
|
|
39351
|
+
const scaleX = sizeX / (numX - 1);
|
|
39352
|
+
const scaleZ = sizeZ / (numZ - 1);
|
|
39353
|
+
const hkShape = hknp.HP_Shape_CreateHeightField(numX, numZ, [scaleX, 1, scaleZ], bufferBegin)[1];
|
|
39354
|
+
hknp._free(bufferBegin);
|
|
39355
|
+
return { _hkShape: hkShape, _type: PhysicsShapeType.HEIGHTFIELD };
|
|
39356
|
+
}
|
|
39357
|
+
function resolveExplicit(options) {
|
|
39358
|
+
if (options.numHeightFieldSamplesX === void 0 || options.numHeightFieldSamplesZ === void 0 || options.heightFieldSizeX === void 0 || options.heightFieldSizeZ === void 0 || options.heightFieldData === void 0) {
|
|
39359
|
+
throw new Error("createHeightFieldShape requires either a groundMesh or full explicit heightfield parameters.");
|
|
39360
|
+
}
|
|
39361
|
+
return {
|
|
39362
|
+
numX: options.numHeightFieldSamplesX,
|
|
39363
|
+
numZ: options.numHeightFieldSamplesZ,
|
|
39364
|
+
sizeX: options.heightFieldSizeX,
|
|
39365
|
+
sizeZ: options.heightFieldSizeZ,
|
|
39366
|
+
data: options.heightFieldData
|
|
39367
|
+
};
|
|
39368
|
+
}
|
|
39369
|
+
function optionsFromGroundMesh(mesh) {
|
|
39370
|
+
const localPositions = mesh._cpuPositions;
|
|
39371
|
+
if (!localPositions || localPositions.length === 0) {
|
|
39372
|
+
throw new Error("createHeightFieldShape ground mesh has no vertex positions.");
|
|
39373
|
+
}
|
|
39374
|
+
const world = mesh.worldMatrix;
|
|
39375
|
+
const vertexCount = localPositions.length / 3;
|
|
39376
|
+
const pos = new Float32Array(localPositions.length);
|
|
39377
|
+
let minX = Infinity;
|
|
39378
|
+
let minY = Infinity;
|
|
39379
|
+
let minZ = Infinity;
|
|
39380
|
+
let maxX = -Infinity;
|
|
39381
|
+
let maxZ = -Infinity;
|
|
39382
|
+
for (let i = 0; i < localPositions.length; i += 3) {
|
|
39383
|
+
const lx = localPositions[i];
|
|
39384
|
+
const ly = localPositions[i + 1];
|
|
39385
|
+
const lz = localPositions[i + 2];
|
|
39386
|
+
const wx = world[0] * lx + world[4] * ly + world[8] * lz + world[12];
|
|
39387
|
+
const wy = world[1] * lx + world[5] * ly + world[9] * lz + world[13];
|
|
39388
|
+
const wz = world[2] * lx + world[6] * ly + world[10] * lz + world[14];
|
|
39389
|
+
pos[i] = wx;
|
|
39390
|
+
pos[i + 1] = wy;
|
|
39391
|
+
pos[i + 2] = wz;
|
|
39392
|
+
if (wx < minX) {
|
|
39393
|
+
minX = wx;
|
|
39394
|
+
}
|
|
39395
|
+
if (wy < minY) {
|
|
39396
|
+
minY = wy;
|
|
39397
|
+
}
|
|
39398
|
+
if (wz < minZ) {
|
|
39399
|
+
minZ = wz;
|
|
39400
|
+
}
|
|
39401
|
+
if (wx > maxX) {
|
|
39402
|
+
maxX = wx;
|
|
39403
|
+
}
|
|
39404
|
+
if (wz > maxZ) {
|
|
39405
|
+
maxZ = wz;
|
|
39406
|
+
}
|
|
39407
|
+
}
|
|
39408
|
+
const sideSamples = Math.sqrt(vertexCount);
|
|
39409
|
+
if (!Number.isInteger(sideSamples) || sideSamples < 2) {
|
|
39410
|
+
throw new Error(
|
|
39411
|
+
`createHeightFieldShape requires a regular (N+1)×(N+1) grid mesh (e.g. from createGroundFromHeightMap); got ${vertexCount} vertices, which is not the square of an integer ≥ 2.`
|
|
39412
|
+
);
|
|
39413
|
+
}
|
|
39414
|
+
const arraySize = sideSamples - 1;
|
|
39415
|
+
const extendX = (maxX - minX) / 2;
|
|
39416
|
+
const extendZ = (maxZ - minZ) / 2;
|
|
39417
|
+
const dim = Math.min(extendX, extendZ);
|
|
39418
|
+
if (dim <= 0) {
|
|
39419
|
+
throw new Error("createHeightFieldShape ground mesh has zero extent in X or Z; cannot build a heightfield.");
|
|
39420
|
+
}
|
|
39421
|
+
const elementSize = dim * 2 / arraySize;
|
|
39422
|
+
const samples = arraySize + 1;
|
|
39423
|
+
const matrix = new Float32Array(samples * samples);
|
|
39424
|
+
matrix.fill(minY);
|
|
39425
|
+
for (let i = 0; i < pos.length; i += 3) {
|
|
39426
|
+
const x = Math.round((pos[i] - minX) / elementSize);
|
|
39427
|
+
const z = arraySize - Math.round((pos[i + 2] - minZ) / elementSize);
|
|
39428
|
+
const y = pos[i + 1] - minY;
|
|
39429
|
+
matrix[z * samples + x] = y;
|
|
39430
|
+
}
|
|
39431
|
+
return {
|
|
39432
|
+
numX: samples,
|
|
39433
|
+
numZ: samples,
|
|
39434
|
+
sizeX: extendX * 2,
|
|
39435
|
+
sizeZ: extendZ * 2,
|
|
39436
|
+
data: matrix
|
|
39437
|
+
};
|
|
39438
|
+
}
|
|
39439
|
+
const IGNORE_NONE = [BigInt(0)];
|
|
39440
|
+
function getCollector(world) {
|
|
39441
|
+
if (!world._queryCollector) {
|
|
39442
|
+
world._queryCollector = world._hknp.HP_QueryCollector_Create(1)[1];
|
|
39443
|
+
}
|
|
39444
|
+
return world._queryCollector;
|
|
39445
|
+
}
|
|
39446
|
+
function hitVec(slot) {
|
|
39447
|
+
return { x: slot[0], y: slot[1], z: slot[2] };
|
|
39448
|
+
}
|
|
39449
|
+
function shapeProximity(world, query) {
|
|
39450
|
+
const hknp = world._hknp;
|
|
39451
|
+
const collector = getCollector(world);
|
|
39452
|
+
const { position: p3, rotation: r } = query;
|
|
39453
|
+
const hkQuery = [query.shape._hkShape, [p3.x, p3.y, p3.z], [r.x, r.y, r.z, r.w], query.maxDistance, query.shouldHitTriggers ?? false, IGNORE_NONE];
|
|
39454
|
+
hknp.HP_World_ShapeProximityWithCollector(world._hkWorld, collector, hkQuery);
|
|
39455
|
+
if (hknp.HP_QueryCollector_GetNumHits(collector)[1] > 0) {
|
|
39456
|
+
const [distance, hitInputData, hitShapeData] = hknp.HP_QueryCollector_GetShapeProximityResult(collector, 0)[1];
|
|
39457
|
+
return {
|
|
39458
|
+
hasHit: true,
|
|
39459
|
+
distance,
|
|
39460
|
+
inputHitPoint: hitVec(hitInputData[3]),
|
|
39461
|
+
hitPoint: hitVec(hitShapeData[3]),
|
|
39462
|
+
inputHitNormal: hitVec(hitInputData[4]),
|
|
39463
|
+
hitNormal: hitVec(hitShapeData[4])
|
|
39464
|
+
};
|
|
39465
|
+
}
|
|
39466
|
+
return emptyResult();
|
|
39467
|
+
}
|
|
39468
|
+
function shapeCast(world, query) {
|
|
39469
|
+
const hknp = world._hknp;
|
|
39470
|
+
const collector = getCollector(world);
|
|
39471
|
+
const { rotation: r, startPosition: s, endPosition: e } = query;
|
|
39472
|
+
const hkQuery = [query.shape._hkShape, [r.x, r.y, r.z, r.w], [s.x, s.y, s.z], [e.x, e.y, e.z], query.shouldHitTriggers ?? false, IGNORE_NONE];
|
|
39473
|
+
hknp.HP_World_ShapeCastWithCollector(world._hkWorld, collector, hkQuery);
|
|
39474
|
+
if (hknp.HP_QueryCollector_GetNumHits(collector)[1] > 0) {
|
|
39475
|
+
const [fraction, hitInputData, hitShapeData] = hknp.HP_QueryCollector_GetShapeCastResult(collector, 0)[1];
|
|
39476
|
+
return {
|
|
39477
|
+
hasHit: true,
|
|
39478
|
+
fraction,
|
|
39479
|
+
inputHitPoint: hitVec(hitInputData[3]),
|
|
39480
|
+
hitPoint: hitVec(hitShapeData[3]),
|
|
39481
|
+
inputHitNormal: hitVec(hitInputData[4]),
|
|
39482
|
+
hitNormal: hitVec(hitShapeData[4])
|
|
39483
|
+
};
|
|
39484
|
+
}
|
|
39485
|
+
return emptyResult();
|
|
39486
|
+
}
|
|
39487
|
+
function emptyResult() {
|
|
39488
|
+
const zero = () => ({ x: 0, y: 0, z: 0 });
|
|
39489
|
+
return {
|
|
39490
|
+
hasHit: false,
|
|
39491
|
+
distance: 0,
|
|
39492
|
+
fraction: 0,
|
|
39493
|
+
inputHitPoint: zero(),
|
|
39494
|
+
hitPoint: zero(),
|
|
39495
|
+
inputHitNormal: zero(),
|
|
39496
|
+
hitNormal: zero()
|
|
39497
|
+
};
|
|
39498
|
+
}
|
|
39499
|
+
const LINE_WGSL = `
|
|
39500
|
+
struct SceneUniforms { viewProjection: mat4x4<f32>, };
|
|
39501
|
+
struct MeshUniforms { world: mat4x4<f32>, };
|
|
39502
|
+
struct MaterialUniforms { color: vec4<f32>, };
|
|
39503
|
+
@group(0) @binding(0) var<uniform> scene: SceneUniforms;
|
|
39504
|
+
@group(1) @binding(0) var<uniform> mesh: MeshUniforms;
|
|
39505
|
+
@group(1) @binding(1) var<uniform> mat: MaterialUniforms;
|
|
39506
|
+
struct VertexOutput { @builtin(position) clipPos: vec4<f32>, };
|
|
39507
|
+
@vertex fn vsMain(@location(0) position: vec3<f32>) -> VertexOutput {
|
|
39508
|
+
var out: VertexOutput;
|
|
39509
|
+
out.clipPos = scene.viewProjection * mesh.world * vec4<f32>(position, 1.0);
|
|
39510
|
+
return out;
|
|
39511
|
+
}
|
|
39512
|
+
@fragment fn fsMain() -> @location(0) vec4<f32> {
|
|
39513
|
+
return mat.color;
|
|
39514
|
+
}`;
|
|
39515
|
+
let _cachedDevice = null;
|
|
39516
|
+
let _meshBGL = null;
|
|
39517
|
+
let _pipelineCache = null;
|
|
39518
|
+
function ensureDevice(engine) {
|
|
39519
|
+
if (_cachedDevice !== engine._device) {
|
|
39520
|
+
_cachedDevice = engine._device;
|
|
39521
|
+
_meshBGL = null;
|
|
39522
|
+
_pipelineCache = null;
|
|
39523
|
+
}
|
|
39524
|
+
}
|
|
39525
|
+
function getMeshBindGroupLayout(engine) {
|
|
39526
|
+
ensureDevice(engine);
|
|
39527
|
+
if (!_meshBGL) {
|
|
39528
|
+
_meshBGL = engine._device.createBindGroupLayout({
|
|
39529
|
+
label: "physics-debug-line-mesh",
|
|
39530
|
+
entries: [
|
|
39531
|
+
{ binding: 0, visibility: SS.VERTEX, buffer: { type: "uniform" } },
|
|
39532
|
+
{ binding: 1, visibility: SS.FRAGMENT, buffer: { type: "uniform" } }
|
|
39533
|
+
]
|
|
39534
|
+
});
|
|
39535
|
+
}
|
|
39536
|
+
return _meshBGL;
|
|
39537
|
+
}
|
|
39538
|
+
function getPipelineCache() {
|
|
39539
|
+
if (!_pipelineCache) {
|
|
39540
|
+
_pipelineCache = /* @__PURE__ */ new Map();
|
|
39541
|
+
}
|
|
39542
|
+
return _pipelineCache;
|
|
39543
|
+
}
|
|
39544
|
+
function getOrCreateLinePipeline(engine, sig) {
|
|
39545
|
+
ensureDevice(engine);
|
|
39546
|
+
const key = targetSignatureKey(sig);
|
|
39547
|
+
const cache = getPipelineCache();
|
|
39548
|
+
const cached = cache.get(key);
|
|
39549
|
+
if (cached) {
|
|
39550
|
+
return cached;
|
|
39551
|
+
}
|
|
39552
|
+
if (!sig._colorFormat) {
|
|
39553
|
+
throw new Error("Physics debug lines require a color render target.");
|
|
39554
|
+
}
|
|
39555
|
+
const device = engine._device;
|
|
39556
|
+
const module = device.createShaderModule({ code: LINE_WGSL });
|
|
39557
|
+
const pipeline = device.createRenderPipeline({
|
|
39558
|
+
layout: device.createPipelineLayout({ bindGroupLayouts: [getSceneBindGroupLayout(engine), getMeshBindGroupLayout(engine)] }),
|
|
39559
|
+
vertex: {
|
|
39560
|
+
module,
|
|
39561
|
+
entryPoint: "vsMain",
|
|
39562
|
+
buffers: [
|
|
39563
|
+
{
|
|
39564
|
+
arrayStride: 12,
|
|
39565
|
+
attributes: [{ shaderLocation: 0, offset: 0, format: "float32x3" }]
|
|
39566
|
+
}
|
|
39567
|
+
]
|
|
39568
|
+
},
|
|
39569
|
+
fragment: {
|
|
39570
|
+
module,
|
|
39571
|
+
entryPoint: "fsMain",
|
|
39572
|
+
targets: [{ format: sig._colorFormat }]
|
|
39573
|
+
},
|
|
39574
|
+
depthStencil: sig._depthStencilFormat ? {
|
|
39575
|
+
format: sig._depthStencilFormat,
|
|
39576
|
+
depthCompare: "always",
|
|
39577
|
+
depthWriteEnabled: false
|
|
39578
|
+
} : void 0,
|
|
39579
|
+
multisample: { count: sig._sampleCount },
|
|
39580
|
+
primitive: { topology: "line-list" }
|
|
39581
|
+
});
|
|
39582
|
+
cache.set(key, pipeline);
|
|
39583
|
+
return pipeline;
|
|
39584
|
+
}
|
|
39585
|
+
function clearPhysicsDebugLinePipelineCache() {
|
|
39586
|
+
_pipelineCache = null;
|
|
39587
|
+
_meshBGL = null;
|
|
39588
|
+
_cachedDevice = null;
|
|
39589
|
+
}
|
|
39590
|
+
function buildLineRenderable(scene, mesh, materialOverride) {
|
|
39591
|
+
const engine = scene.surface.engine;
|
|
39592
|
+
const material = materialOverride ?? mesh.material;
|
|
39593
|
+
const meshData = new F32(16);
|
|
39594
|
+
packMat4IntoF32(meshData, mesh.worldMatrix);
|
|
39595
|
+
const meshUBO = createUniformBuffer$1(engine, meshData);
|
|
39596
|
+
const materialData = new F32(4);
|
|
39597
|
+
materialData.set(material.color);
|
|
39598
|
+
const materialUBO = createUniformBuffer$1(engine, materialData);
|
|
39599
|
+
const bindGroup = engine._device.createBindGroup({
|
|
39600
|
+
layout: getMeshBindGroupLayout(engine),
|
|
39601
|
+
entries: [
|
|
39602
|
+
{ binding: 0, resource: { buffer: meshUBO } },
|
|
39603
|
+
{ binding: 1, resource: { buffer: materialUBO } }
|
|
39604
|
+
]
|
|
39605
|
+
});
|
|
39606
|
+
let lastWorldVersion = mesh.worldMatrixVersion;
|
|
39607
|
+
const update = () => {
|
|
39608
|
+
if (mesh.worldMatrixVersion !== lastWorldVersion) {
|
|
39609
|
+
packMat4IntoF32(meshData, mesh.worldMatrix);
|
|
39610
|
+
engine._device.queue.writeBuffer(meshUBO, 0, meshData);
|
|
39611
|
+
lastWorldVersion = mesh.worldMatrixVersion;
|
|
39612
|
+
}
|
|
39613
|
+
};
|
|
39614
|
+
const renderable = {
|
|
39615
|
+
order: mesh.renderOrder ?? 1e3,
|
|
39616
|
+
isTransparent: false,
|
|
39617
|
+
_direct: true,
|
|
39618
|
+
mesh,
|
|
39619
|
+
bind(eng, sig) {
|
|
39620
|
+
return {
|
|
39621
|
+
renderable,
|
|
39622
|
+
pipeline: getOrCreateLinePipeline(eng, sig),
|
|
39623
|
+
update,
|
|
39624
|
+
draw(pass) {
|
|
39625
|
+
const gpu = mesh._gpu;
|
|
39626
|
+
pass.setVertexBuffer(0, gpu.positionBuffer);
|
|
39627
|
+
pass.setIndexBuffer(gpu.indexBuffer, gpu.indexFormat);
|
|
39628
|
+
pass.setBindGroup(1, bindGroup);
|
|
39629
|
+
pass.drawIndexed(gpu.indexCount);
|
|
39630
|
+
return 1;
|
|
39631
|
+
}
|
|
39632
|
+
};
|
|
39633
|
+
}
|
|
39634
|
+
};
|
|
39635
|
+
renderable._worldCenter = [mesh.worldMatrix[12], mesh.worldMatrix[13], mesh.worldMatrix[14]];
|
|
39636
|
+
return renderable;
|
|
39637
|
+
}
|
|
39638
|
+
const physicsDebugLineGroupBuilder = async (scene, meshes) => {
|
|
39639
|
+
const rebuildSingle = (s, mesh, materialOverride) => buildLineRenderable(s, mesh, materialOverride);
|
|
39640
|
+
physicsDebugLineGroupBuilder._rebuildSingle = rebuildSingle;
|
|
39641
|
+
scene._disposables.push(clearPhysicsDebugLinePipelineCache);
|
|
39642
|
+
return {
|
|
39643
|
+
renderables: meshes.map((mesh) => rebuildSingle(scene, mesh)),
|
|
39644
|
+
rebuildSingle
|
|
39645
|
+
};
|
|
39646
|
+
};
|
|
39647
|
+
function createPhysicsDebugLineMaterial(color) {
|
|
39648
|
+
return {
|
|
39649
|
+
_buildGroup: physicsDebugLineGroupBuilder,
|
|
39650
|
+
_uboVersion: 0,
|
|
39651
|
+
color: [color[0], color[1], color[2], color[3]]
|
|
39652
|
+
};
|
|
39653
|
+
}
|
|
39654
|
+
const CONSTRAINT_BALL_AND_SOCKET = 1;
|
|
39655
|
+
const CONSTRAINT_DISTANCE = 2;
|
|
39656
|
+
const CONSTRAINT_HINGE = 3;
|
|
39657
|
+
const CONSTRAINT_SLIDER = 4;
|
|
39658
|
+
const CONSTRAINT_LOCK = 5;
|
|
39659
|
+
const CONSTRAINT_PRISMATIC = 6;
|
|
39660
|
+
const CONSTRAINT_SIX_DOF = 7;
|
|
39661
|
+
function createPhysicsViewer(scene, world, options = {}) {
|
|
39662
|
+
const viewer = {
|
|
39663
|
+
scene,
|
|
39664
|
+
world,
|
|
39665
|
+
_bodies: [],
|
|
39666
|
+
_meshes: [],
|
|
39667
|
+
_constraintMeshes: [],
|
|
39668
|
+
_constraintLines: [],
|
|
39669
|
+
_constraintDisks: [],
|
|
39670
|
+
_constraintArrowheads: [],
|
|
39671
|
+
_color: options.color ?? [1, 1, 1, 1],
|
|
39672
|
+
_registered: false,
|
|
39673
|
+
_update: () => {
|
|
39674
|
+
updatePhysicsViewer(viewer);
|
|
39675
|
+
}
|
|
39676
|
+
};
|
|
39677
|
+
return viewer;
|
|
39678
|
+
}
|
|
39679
|
+
function showPhysicsConstraint(viewer, constraint) {
|
|
39680
|
+
const axisLen = 0.4;
|
|
39681
|
+
const diskRadius = 0.6;
|
|
39682
|
+
const axisA = constraint.axisA ?? { x: 1, y: 0, z: 0 };
|
|
39683
|
+
const axisB = constraint.axisB ?? { x: 1, y: 0, z: 0 };
|
|
39684
|
+
const perpAxisA = constraint.perpAxisA ?? normalTo(axisA);
|
|
39685
|
+
const perpAxisB = constraint.perpAxisB ?? normalTo(axisB);
|
|
39686
|
+
const thirdAxisA = normalize(cross(axisA, perpAxisA));
|
|
39687
|
+
const thirdAxisB = normalize(cross(axisB, perpAxisB));
|
|
39688
|
+
const meshes = [
|
|
39689
|
+
createConstraintAxisMesh(viewer, constraint.bodyA, constraint.pivotA, axisA, axisLen, [1, 0, 0, 1], "constraintAxisAX"),
|
|
39690
|
+
createConstraintAxisMesh(viewer, constraint.bodyA, constraint.pivotA, perpAxisA, axisLen, [0, 1, 0, 1], "constraintAxisAY"),
|
|
39691
|
+
createConstraintAxisMesh(viewer, constraint.bodyA, constraint.pivotA, thirdAxisA, axisLen, [0, 0.35, 1, 1], "constraintAxisAZ"),
|
|
39692
|
+
createConstraintAxisMesh(viewer, constraint.bodyB, constraint.pivotB, axisB, axisLen, [1, 0, 0, 1], "constraintAxisBX"),
|
|
39693
|
+
createConstraintAxisMesh(viewer, constraint.bodyB, constraint.pivotB, perpAxisB, axisLen, [0, 1, 0, 1], "constraintAxisBY"),
|
|
39694
|
+
createConstraintAxisMesh(viewer, constraint.bodyB, constraint.pivotB, thirdAxisB, axisLen, [0, 0.35, 1, 1], "constraintAxisBZ")
|
|
39695
|
+
];
|
|
39696
|
+
const diskAxes = [axisB, perpAxisB, thirdAxisB];
|
|
39697
|
+
const diskColors = [
|
|
39698
|
+
[1, 0, 0, 1],
|
|
39699
|
+
[0, 1, 0, 1],
|
|
39700
|
+
[0, 0.35, 1, 1]
|
|
39701
|
+
];
|
|
39702
|
+
for (const axisIndex of angularDiskAxes(constraint.type)) {
|
|
39703
|
+
const color = diskColors[axisIndex];
|
|
39704
|
+
meshes.push(
|
|
39705
|
+
createConstraintDiskMesh(
|
|
39706
|
+
viewer,
|
|
39707
|
+
constraint.bodyB,
|
|
39708
|
+
constraint.pivotB,
|
|
39709
|
+
diskAxes[axisIndex],
|
|
39710
|
+
diskRadius,
|
|
39711
|
+
[color[0], color[1], color[2], color[3]],
|
|
39712
|
+
`constraintAngle${axisIndex}`
|
|
39713
|
+
)
|
|
39714
|
+
);
|
|
39715
|
+
}
|
|
39716
|
+
for (const mesh of meshes) {
|
|
39717
|
+
viewer._constraintMeshes.push(mesh);
|
|
39718
|
+
addToScene(viewer.scene, mesh);
|
|
39719
|
+
}
|
|
39720
|
+
registerViewerUpdate(viewer);
|
|
39721
|
+
return meshes;
|
|
39722
|
+
}
|
|
39723
|
+
function showPhysicsBody(viewer, body) {
|
|
39724
|
+
for (let i = 0; i < viewer._bodies.length; i++) {
|
|
39725
|
+
if (viewer._bodies[i] === body) {
|
|
39726
|
+
return null;
|
|
39727
|
+
}
|
|
39728
|
+
}
|
|
39729
|
+
const geometry = getPhysicsBodyDebugGeometry(viewer.world, body);
|
|
39730
|
+
if (geometry.positions.length === 0 || geometry.indices.length === 0) {
|
|
39731
|
+
return null;
|
|
39732
|
+
}
|
|
39733
|
+
const lineIndices = createLineListIndices(geometry.indices);
|
|
39734
|
+
const normals = new Float32Array(geometry.positions.length);
|
|
39735
|
+
const debugMesh = createMeshFromData(viewer.scene.surface.engine, "physicsBodyDebug", geometry.positions, normals, lineIndices);
|
|
39736
|
+
debugMesh.material = createPhysicsDebugLineMaterial(viewer._color);
|
|
39737
|
+
debugMesh.pickable = false;
|
|
39738
|
+
debugMesh.renderOrder = 1e3;
|
|
39739
|
+
copyBodyTransform(body, debugMesh);
|
|
39740
|
+
viewer._bodies.push(body);
|
|
39741
|
+
viewer._meshes.push(debugMesh);
|
|
39742
|
+
addToScene(viewer.scene, debugMesh);
|
|
39743
|
+
registerViewerUpdate(viewer);
|
|
39744
|
+
return debugMesh;
|
|
39745
|
+
}
|
|
39746
|
+
function hidePhysicsBody(viewer, body) {
|
|
39747
|
+
const index = viewer._bodies.indexOf(body);
|
|
39748
|
+
if (index < 0) {
|
|
39749
|
+
return false;
|
|
39750
|
+
}
|
|
39751
|
+
const mesh = viewer._meshes[index];
|
|
39752
|
+
viewer._bodies.splice(index, 1);
|
|
39753
|
+
viewer._meshes.splice(index, 1);
|
|
39754
|
+
removeFromScene(viewer.scene, mesh);
|
|
39755
|
+
unregisterViewerUpdateIfEmpty(viewer);
|
|
39756
|
+
return true;
|
|
39757
|
+
}
|
|
39758
|
+
function disposePhysicsViewer(viewer) {
|
|
39759
|
+
while (viewer._bodies.length > 0) {
|
|
39760
|
+
hidePhysicsBody(viewer, viewer._bodies[0]);
|
|
39761
|
+
}
|
|
39762
|
+
while (viewer._constraintMeshes.length > 0) {
|
|
39763
|
+
removeFromScene(viewer.scene, viewer._constraintMeshes.pop());
|
|
39764
|
+
}
|
|
39765
|
+
viewer._constraintLines.length = 0;
|
|
39766
|
+
viewer._constraintDisks.length = 0;
|
|
39767
|
+
viewer._constraintArrowheads.length = 0;
|
|
39768
|
+
unregisterViewerUpdate(viewer);
|
|
39769
|
+
}
|
|
39770
|
+
function registerViewerUpdate(viewer) {
|
|
39771
|
+
if (viewer._registered) {
|
|
39772
|
+
return;
|
|
39773
|
+
}
|
|
39774
|
+
viewer.scene._beforeRender.push(viewer._update);
|
|
39775
|
+
viewer._registered = true;
|
|
39776
|
+
}
|
|
39777
|
+
function unregisterViewerUpdateIfEmpty(viewer) {
|
|
39778
|
+
if (viewer._bodies.length === 0 && viewer._constraintLines.length === 0 && viewer._constraintDisks.length === 0 && viewer._constraintArrowheads.length === 0) {
|
|
39779
|
+
unregisterViewerUpdate(viewer);
|
|
39780
|
+
}
|
|
39781
|
+
}
|
|
39782
|
+
function unregisterViewerUpdate(viewer) {
|
|
39783
|
+
if (!viewer._registered) {
|
|
39784
|
+
return;
|
|
39785
|
+
}
|
|
39786
|
+
const index = viewer.scene._beforeRender.indexOf(viewer._update);
|
|
39787
|
+
if (index >= 0) {
|
|
39788
|
+
viewer.scene._beforeRender.splice(index, 1);
|
|
39789
|
+
}
|
|
39790
|
+
viewer._registered = false;
|
|
39791
|
+
}
|
|
39792
|
+
function updatePhysicsViewer(viewer) {
|
|
39793
|
+
for (let i = 0; i < viewer._bodies.length; i++) {
|
|
39794
|
+
copyBodyTransform(viewer._bodies[i], viewer._meshes[i]);
|
|
39795
|
+
}
|
|
39796
|
+
for (let i = 0; i < viewer._constraintLines.length; i++) {
|
|
39797
|
+
updateConstraintLine(viewer, viewer._constraintLines[i]);
|
|
39798
|
+
}
|
|
39799
|
+
for (let i = 0; i < viewer._constraintDisks.length; i++) {
|
|
39800
|
+
updateConstraintDisk(viewer._constraintDisks[i]);
|
|
39801
|
+
}
|
|
39802
|
+
for (let i = 0; i < viewer._constraintArrowheads.length; i++) {
|
|
39803
|
+
updateConstraintArrowhead(viewer._constraintArrowheads[i]);
|
|
39804
|
+
}
|
|
39805
|
+
}
|
|
39806
|
+
function copyBodyTransform(body, mesh) {
|
|
39807
|
+
const node = body.node;
|
|
39808
|
+
mesh.position.set(node.position.x, node.position.y, node.position.z);
|
|
39809
|
+
mesh.rotationQuaternion.set(node.rotationQuaternion.x, node.rotationQuaternion.y, node.rotationQuaternion.z, node.rotationQuaternion.w);
|
|
39810
|
+
mesh.scaling.set(1, 1, 1);
|
|
39811
|
+
}
|
|
39812
|
+
function createLineListIndices(triangleIndices) {
|
|
39813
|
+
const lines = new Uint32Array(triangleIndices.length * 2);
|
|
39814
|
+
let o3 = 0;
|
|
39815
|
+
for (let i = 0; i < triangleIndices.length; i += 3) {
|
|
39816
|
+
const a = triangleIndices[i];
|
|
39817
|
+
const b = triangleIndices[i + 1];
|
|
39818
|
+
const c2 = triangleIndices[i + 2];
|
|
39819
|
+
lines[o3++] = a;
|
|
39820
|
+
lines[o3++] = b;
|
|
39821
|
+
lines[o3++] = b;
|
|
39822
|
+
lines[o3++] = c2;
|
|
39823
|
+
lines[o3++] = c2;
|
|
39824
|
+
lines[o3++] = a;
|
|
39825
|
+
}
|
|
39826
|
+
return lines;
|
|
39827
|
+
}
|
|
39828
|
+
function createConstraintAxisMesh(viewer, body, pivot, axis, len2, color, name) {
|
|
39829
|
+
const tip = { body, pivot, axis, axisLength: len2 };
|
|
39830
|
+
const line = createConstraintLineMesh(viewer, color, name, { body, pivot }, tip);
|
|
39831
|
+
const head = createConstraintArrowheadMesh(viewer, color, `${name}Head`, tip);
|
|
39832
|
+
viewer._constraintMeshes.push(head);
|
|
39833
|
+
addToScene(viewer.scene, head);
|
|
39834
|
+
return line;
|
|
39835
|
+
}
|
|
39836
|
+
function createConstraintArrowheadMesh(viewer, color, name, endpoint) {
|
|
39837
|
+
const mesh = createCylinder(viewer.scene.surface.engine, { height: 0.13, diameterTop: 0, diameterBottom: 0.08, tessellation: 12 });
|
|
39838
|
+
mesh.name = name;
|
|
39839
|
+
const material = createStandardMaterial();
|
|
39840
|
+
material.disableLighting = true;
|
|
39841
|
+
material.emissiveColor = [color[0], color[1], color[2]];
|
|
39842
|
+
material.diffuseColor = [color[0], color[1], color[2]];
|
|
39843
|
+
mesh.material = material;
|
|
39844
|
+
mesh.pickable = false;
|
|
39845
|
+
mesh.renderOrder = 1001;
|
|
39846
|
+
const arrowhead = { mesh, endpoint };
|
|
39847
|
+
updateConstraintArrowhead(arrowhead);
|
|
39848
|
+
viewer._constraintArrowheads.push(arrowhead);
|
|
39849
|
+
return mesh;
|
|
39850
|
+
}
|
|
39851
|
+
function createConstraintDiskMesh(viewer, body, pivot, axis, radius, color, name) {
|
|
39852
|
+
const mesh = createDisc(viewer.scene.surface.engine, { radius, tessellation: 48 });
|
|
39853
|
+
mesh.name = name;
|
|
39854
|
+
const material = createStandardMaterial();
|
|
39855
|
+
material.disableLighting = true;
|
|
39856
|
+
material.emissiveColor = [color[0], color[1], color[2]];
|
|
39857
|
+
material.diffuseColor = [color[0], color[1], color[2]];
|
|
39858
|
+
mesh.material = material;
|
|
39859
|
+
mesh.pickable = false;
|
|
39860
|
+
mesh.renderOrder = 999;
|
|
39861
|
+
const disk = { mesh, endpoint: { body, pivot }, axis };
|
|
39862
|
+
updateConstraintDisk(disk);
|
|
39863
|
+
viewer._constraintDisks.push(disk);
|
|
39864
|
+
return mesh;
|
|
39865
|
+
}
|
|
39866
|
+
function createConstraintLineMesh(viewer, color, name, a, b) {
|
|
39867
|
+
const positions = new Float32Array(6);
|
|
39868
|
+
writeEndpoint(positions, 0, a);
|
|
39869
|
+
writeEndpoint(positions, 3, b);
|
|
39870
|
+
const normals = new Float32Array(positions.length);
|
|
39871
|
+
const indices = new Uint32Array([0, 1]);
|
|
39872
|
+
const mesh = createMeshFromData(viewer.scene.surface.engine, name, positions, normals, indices);
|
|
39873
|
+
mesh.material = createPhysicsDebugLineMaterial(color);
|
|
39874
|
+
mesh.pickable = false;
|
|
39875
|
+
mesh.renderOrder = 1e3;
|
|
39876
|
+
viewer._constraintLines.push({ mesh, positions, a, b });
|
|
39877
|
+
return mesh;
|
|
39878
|
+
}
|
|
39879
|
+
function updateConstraintLine(viewer, line) {
|
|
39880
|
+
writeEndpoint(line.positions, 0, line.a);
|
|
39881
|
+
writeEndpoint(line.positions, 3, line.b);
|
|
39882
|
+
updateMeshPositions(viewer.scene.surface.engine, line.mesh, line.positions);
|
|
39883
|
+
}
|
|
39884
|
+
function updateConstraintDisk(disk) {
|
|
39885
|
+
const p3 = localToWorld(disk.endpoint.body.node.worldMatrix, disk.endpoint.pivot);
|
|
39886
|
+
const axis = normalize(transformDirection(disk.endpoint.body.node.worldMatrix, disk.axis));
|
|
39887
|
+
disk.mesh.position.set(p3.x, p3.y, p3.z);
|
|
39888
|
+
const q = quatFromZTo(axis);
|
|
39889
|
+
disk.mesh.rotationQuaternion.set(q.x, q.y, q.z, q.w);
|
|
39890
|
+
}
|
|
39891
|
+
function updateConstraintArrowhead(arrowhead) {
|
|
39892
|
+
const tip = endpointWorld(arrowhead.endpoint);
|
|
39893
|
+
const axis = arrowhead.endpoint.axis ? normalize(transformDirection(arrowhead.endpoint.body.node.worldMatrix, arrowhead.endpoint.axis)) : { x: 0, y: 1, z: 0 };
|
|
39894
|
+
arrowhead.mesh.position.set(tip.x, tip.y, tip.z);
|
|
39895
|
+
const q = quatFromYTo(axis);
|
|
39896
|
+
arrowhead.mesh.rotationQuaternion.set(q.x, q.y, q.z, q.w);
|
|
39897
|
+
}
|
|
39898
|
+
function writeEndpoint(out, offset, endpoint) {
|
|
39899
|
+
const p3 = endpointWorld(endpoint);
|
|
39900
|
+
out[offset] = p3.x;
|
|
39901
|
+
out[offset + 1] = p3.y;
|
|
39902
|
+
out[offset + 2] = p3.z;
|
|
39903
|
+
}
|
|
39904
|
+
function endpointWorld(endpoint) {
|
|
39905
|
+
const pivot = endpoint.axis ? {
|
|
39906
|
+
x: endpoint.pivot.x + endpoint.axis.x * (endpoint.axisLength ?? 1),
|
|
39907
|
+
y: endpoint.pivot.y + endpoint.axis.y * (endpoint.axisLength ?? 1),
|
|
39908
|
+
z: endpoint.pivot.z + endpoint.axis.z * (endpoint.axisLength ?? 1)
|
|
39909
|
+
} : endpoint.pivot;
|
|
39910
|
+
return localToWorld(endpoint.body.node.worldMatrix, pivot);
|
|
39911
|
+
}
|
|
39912
|
+
function localToWorld(m2, p3) {
|
|
39913
|
+
return {
|
|
39914
|
+
x: m2[0] * p3.x + m2[4] * p3.y + m2[8] * p3.z + m2[12],
|
|
39915
|
+
y: m2[1] * p3.x + m2[5] * p3.y + m2[9] * p3.z + m2[13],
|
|
39916
|
+
z: m2[2] * p3.x + m2[6] * p3.y + m2[10] * p3.z + m2[14]
|
|
39917
|
+
};
|
|
39918
|
+
}
|
|
39919
|
+
function transformDirection(m2, v) {
|
|
39920
|
+
return {
|
|
39921
|
+
x: m2[0] * v.x + m2[4] * v.y + m2[8] * v.z,
|
|
39922
|
+
y: m2[1] * v.x + m2[5] * v.y + m2[9] * v.z,
|
|
39923
|
+
z: m2[2] * v.x + m2[6] * v.y + m2[10] * v.z
|
|
39924
|
+
};
|
|
39925
|
+
}
|
|
39926
|
+
function quatFromZTo(axis) {
|
|
39927
|
+
const target = normalize(axis);
|
|
39928
|
+
if (target.z < -0.999999) {
|
|
39929
|
+
return { x: 1, y: 0, z: 0, w: 0 };
|
|
39930
|
+
}
|
|
39931
|
+
const x = -target.y;
|
|
39932
|
+
const y = target.x;
|
|
39933
|
+
const z = 0;
|
|
39934
|
+
const w = 1 + target.z;
|
|
39935
|
+
const inv = 1 / Math.max(1e-8, Math.hypot(x, y, z, w));
|
|
39936
|
+
return { x: x * inv, y: y * inv, z: z * inv, w: w * inv };
|
|
39937
|
+
}
|
|
39938
|
+
function quatFromYTo(axis) {
|
|
39939
|
+
const target = normalize(axis);
|
|
39940
|
+
if (target.y < -0.999999) {
|
|
39941
|
+
return { x: 0, y: 0, z: 1, w: 0 };
|
|
39942
|
+
}
|
|
39943
|
+
const x = target.z;
|
|
39944
|
+
const y = 0;
|
|
39945
|
+
const z = -target.x;
|
|
39946
|
+
const w = 1 + target.y;
|
|
39947
|
+
const inv = 1 / Math.max(1e-8, Math.hypot(x, y, z, w));
|
|
39948
|
+
return { x: x * inv, y: y * inv, z: z * inv, w: w * inv };
|
|
39949
|
+
}
|
|
39950
|
+
function cross(a, b) {
|
|
39951
|
+
return { x: a.y * b.z - a.z * b.y, y: a.z * b.x - a.x * b.z, z: a.x * b.y - a.y * b.x };
|
|
39952
|
+
}
|
|
39953
|
+
function normalize(v) {
|
|
39954
|
+
const inv = 1 / Math.max(1e-8, Math.hypot(v.x, v.y, v.z));
|
|
39955
|
+
return { x: v.x * inv, y: v.y * inv, z: v.z * inv };
|
|
39956
|
+
}
|
|
39957
|
+
function normalTo(axis) {
|
|
39958
|
+
const ax2 = Math.abs(axis.x);
|
|
39959
|
+
const ay = Math.abs(axis.y);
|
|
39960
|
+
const az = Math.abs(axis.z);
|
|
39961
|
+
if (ax2 <= ay && ax2 <= az) {
|
|
39962
|
+
return normalize({ x: 0, y: -axis.z, z: axis.y });
|
|
39963
|
+
}
|
|
39964
|
+
if (ay <= ax2 && ay <= az) {
|
|
39965
|
+
return normalize({ x: -axis.z, y: 0, z: axis.x });
|
|
39966
|
+
}
|
|
39967
|
+
return normalize({ x: -axis.y, y: axis.x, z: 0 });
|
|
39968
|
+
}
|
|
39969
|
+
function angularDiskAxes(type) {
|
|
39970
|
+
switch (type) {
|
|
39971
|
+
case CONSTRAINT_LOCK:
|
|
39972
|
+
case CONSTRAINT_PRISMATIC:
|
|
39973
|
+
return [];
|
|
39974
|
+
case CONSTRAINT_HINGE:
|
|
39975
|
+
case CONSTRAINT_SLIDER:
|
|
39976
|
+
return [0];
|
|
39977
|
+
case CONSTRAINT_BALL_AND_SOCKET:
|
|
39978
|
+
case CONSTRAINT_DISTANCE:
|
|
39979
|
+
case CONSTRAINT_SIX_DOF:
|
|
39980
|
+
default:
|
|
39981
|
+
return [0, 1, 2];
|
|
39982
|
+
}
|
|
39983
|
+
}
|
|
38168
39984
|
let _coreModule = null;
|
|
38169
39985
|
let _generatorsModule = null;
|
|
38170
39986
|
let _initPromise = null;
|
|
@@ -38571,627 +40387,658 @@ function _assertTileCache(plugin) {
|
|
|
38571
40387
|
}
|
|
38572
40388
|
}
|
|
38573
40389
|
export {
|
|
38574
|
-
|
|
38575
|
-
|
|
40390
|
+
createEmptyUniformBuffer as $,
|
|
40391
|
+
getSceneBindGroupLayout as A,
|
|
38576
40392
|
BU as B,
|
|
38577
|
-
|
|
40393
|
+
disposeGaussianSplattingMesh as C,
|
|
38578
40394
|
DV$1 as D,
|
|
38579
|
-
|
|
40395
|
+
applyGsFragments as E,
|
|
38580
40396
|
F64 as F,
|
|
38581
40397
|
GeometryTextureType as G,
|
|
38582
|
-
|
|
38583
|
-
|
|
38584
|
-
|
|
38585
|
-
|
|
38586
|
-
|
|
40398
|
+
CW$1 as H,
|
|
40399
|
+
getRenderTargetSize as I,
|
|
40400
|
+
getViewMatrix as J,
|
|
40401
|
+
getProjectionMatrix as K,
|
|
40402
|
+
getCameraPosition as L,
|
|
38587
40403
|
MAX_LIGHTS as M,
|
|
38588
40404
|
NODE_ESM_SHADOW_OUTPUT as N,
|
|
38589
|
-
|
|
38590
|
-
|
|
38591
|
-
|
|
38592
|
-
|
|
40405
|
+
U8C as O,
|
|
40406
|
+
createMaterialView as P,
|
|
40407
|
+
ESM_SHADOW_OUTPUT as Q,
|
|
40408
|
+
MATERIAL_ALPHA_BLEND as R,
|
|
38593
40409
|
SS as S,
|
|
38594
40410
|
TU as T,
|
|
38595
40411
|
U32 as U,
|
|
38596
|
-
|
|
38597
|
-
|
|
38598
|
-
|
|
38599
|
-
|
|
38600
|
-
|
|
38601
|
-
|
|
40412
|
+
PBR2_ESM_SHADOW_OUTPUT as V,
|
|
40413
|
+
PBR_HAS_ALPHA_BLEND as W,
|
|
40414
|
+
encodeIdToColor as X,
|
|
40415
|
+
getPickingSceneBGL as Y,
|
|
40416
|
+
gsGpuPickingFragment as Z,
|
|
40417
|
+
BILLBOARD_INDEX_DATA as _,
|
|
38602
40418
|
F32 as a,
|
|
38603
|
-
|
|
38604
|
-
|
|
38605
|
-
|
|
38606
|
-
|
|
38607
|
-
|
|
38608
|
-
|
|
38609
|
-
|
|
38610
|
-
|
|
38611
|
-
|
|
38612
|
-
|
|
38613
|
-
|
|
38614
|
-
|
|
38615
|
-
|
|
38616
|
-
|
|
38617
|
-
|
|
38618
|
-
|
|
38619
|
-
|
|
38620
|
-
|
|
38621
|
-
|
|
38622
|
-
|
|
38623
|
-
|
|
38624
|
-
|
|
38625
|
-
|
|
38626
|
-
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38630
|
-
|
|
38631
|
-
|
|
38632
|
-
|
|
38633
|
-
|
|
38634
|
-
|
|
38635
|
-
|
|
38636
|
-
|
|
38637
|
-
|
|
38638
|
-
|
|
38639
|
-
|
|
38640
|
-
|
|
38641
|
-
|
|
38642
|
-
|
|
38643
|
-
|
|
38644
|
-
|
|
38645
|
-
|
|
38646
|
-
|
|
38647
|
-
|
|
38648
|
-
|
|
38649
|
-
|
|
38650
|
-
|
|
38651
|
-
|
|
38652
|
-
|
|
38653
|
-
|
|
38654
|
-
|
|
38655
|
-
|
|
38656
|
-
|
|
38657
|
-
|
|
38658
|
-
|
|
38659
|
-
|
|
38660
|
-
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
|
|
38664
|
-
|
|
38665
|
-
|
|
38666
|
-
|
|
40419
|
+
PBR_HAS_THICKNESS_MAP as a$,
|
|
40420
|
+
BILLBOARD_SYSTEM_UBO_BYTES as a0,
|
|
40421
|
+
createBillboardInstanceBuffer as a1,
|
|
40422
|
+
_getBillboardFxHook as a2,
|
|
40423
|
+
createBillboardInstanceSortScratch as a3,
|
|
40424
|
+
getOrCreateBillboardPipeline as a4,
|
|
40425
|
+
createBillboardSystemBindGroup as a5,
|
|
40426
|
+
resetBillboardPipelineCache as a6,
|
|
40427
|
+
ensureBillboardInstanceBuffer as a7,
|
|
40428
|
+
uploadSortedBillboardInstances as a8,
|
|
40429
|
+
uploadBillboardInstances as a9,
|
|
40430
|
+
NO_COLOR_OUTPUT as aA,
|
|
40431
|
+
NEEDS_UV as aB,
|
|
40432
|
+
MSH_HAS_INSTANCE_COLOR as aC,
|
|
40433
|
+
NEEDS_UV2 as aD,
|
|
40434
|
+
MSH_HAS_THIN_INSTANCES as aE,
|
|
40435
|
+
MSH_RECEIVE_SHADOWS as aF,
|
|
40436
|
+
_standardShaderVariantKey as aG,
|
|
40437
|
+
WGSL$1 as aH,
|
|
40438
|
+
getCsmPbrReceiverFactory as aI,
|
|
40439
|
+
PBR_HAS_ALPHA_TEST as aJ,
|
|
40440
|
+
PBR_HAS_METALLIC_REFLECTANCE_MAP as aK,
|
|
40441
|
+
PBR_HAS_REFLECTANCE_MAP as aL,
|
|
40442
|
+
PBR2_HAS_REFLECTANCE_FACTORS as aM,
|
|
40443
|
+
PBR2_HAS_UV2 as aN,
|
|
40444
|
+
PBR_HAS_USE_ALPHA_ONLY_MR as aO,
|
|
40445
|
+
PBR_HAS_CLEARCOAT as aP,
|
|
40446
|
+
PBR2_CC_INT_MAP as aQ,
|
|
40447
|
+
PBR2_CC_ROUGH_MAP as aR,
|
|
40448
|
+
PBR2_CC_NORMAL_MAP as aS,
|
|
40449
|
+
PBR2_CC_F0_REMAP_OFF as aT,
|
|
40450
|
+
PBR_HAS_SHEEN_TEXTURE as aU,
|
|
40451
|
+
PBR_HAS_SHEEN as aV,
|
|
40452
|
+
PBR2_HAS_SHEEN_UV_TX as aW,
|
|
40453
|
+
PBR_HAS_SHEEN_ALBEDO_SCALING as aX,
|
|
40454
|
+
PBR2_HAS_IRIDESCENCE_MAP as aY,
|
|
40455
|
+
PBR2_HAS_IRIDESCENCE_THICKNESS_MAP as aZ,
|
|
40456
|
+
PBR2_HAS_IRIDESCENCE as a_,
|
|
40457
|
+
buildBillboardSystemUbo as aa,
|
|
40458
|
+
writeBillboardSystemUboIfDirty as ab,
|
|
40459
|
+
createBillboardPipelineCache as ac,
|
|
40460
|
+
PhysicsMotionType as ad,
|
|
40461
|
+
HAS_BUMP_TEXTURE as ae,
|
|
40462
|
+
HAS_EMISSIVE_TEXTURE as af,
|
|
40463
|
+
HAS_DEPTH_EMISSIVE_TEXTURE as ag,
|
|
40464
|
+
HAS_SPECULAR_TEXTURE as ah,
|
|
40465
|
+
SPECULAR_USES_UV2 as ai,
|
|
40466
|
+
HAS_AMBIENT_TEXTURE as aj,
|
|
40467
|
+
AMBIENT_USES_UV2 as ak,
|
|
40468
|
+
HAS_LIGHTMAP_TEXTURE as al,
|
|
40469
|
+
LIGHTMAP_USES_UV2 as am,
|
|
40470
|
+
HAS_OPACITY_TEXTURE as an,
|
|
40471
|
+
OPACITY_FROM_RGB as ao,
|
|
40472
|
+
HAS_REFLECTION_TEXTURE as ap,
|
|
40473
|
+
HAS_CUBE_REFLECTION as aq,
|
|
40474
|
+
getCsmStdReceiverFactory as ar,
|
|
40475
|
+
clearSamplerCache as as,
|
|
40476
|
+
_computeStandardMaterialFeatures as at,
|
|
40477
|
+
_computeMeshFeatures as au,
|
|
40478
|
+
_getStdExts as av,
|
|
40479
|
+
createUniformBuffer$1 as aw,
|
|
40480
|
+
collectStdBoundTextures as ax,
|
|
40481
|
+
acquireTexture as ay,
|
|
40482
|
+
releaseTexture as az,
|
|
38667
40483
|
writeMeshLightSelection as b,
|
|
38668
|
-
|
|
38669
|
-
|
|
38670
|
-
|
|
38671
|
-
|
|
38672
|
-
|
|
38673
|
-
|
|
38674
|
-
|
|
38675
|
-
|
|
38676
|
-
|
|
38677
|
-
|
|
38678
|
-
|
|
38679
|
-
|
|
38680
|
-
|
|
38681
|
-
|
|
38682
|
-
|
|
38683
|
-
|
|
38684
|
-
|
|
38685
|
-
|
|
38686
|
-
|
|
38687
|
-
|
|
38688
|
-
|
|
38689
|
-
|
|
38690
|
-
|
|
38691
|
-
|
|
38692
|
-
|
|
38693
|
-
|
|
38694
|
-
|
|
38695
|
-
|
|
38696
|
-
|
|
38697
|
-
|
|
38698
|
-
|
|
38699
|
-
|
|
38700
|
-
|
|
38701
|
-
|
|
38702
|
-
|
|
38703
|
-
|
|
38704
|
-
|
|
38705
|
-
|
|
38706
|
-
|
|
38707
|
-
|
|
38708
|
-
|
|
38709
|
-
|
|
38710
|
-
|
|
38711
|
-
|
|
38712
|
-
|
|
38713
|
-
|
|
38714
|
-
|
|
38715
|
-
|
|
38716
|
-
|
|
38717
|
-
|
|
38718
|
-
|
|
38719
|
-
|
|
38720
|
-
|
|
38721
|
-
|
|
38722
|
-
|
|
38723
|
-
|
|
38724
|
-
|
|
38725
|
-
|
|
38726
|
-
|
|
38727
|
-
|
|
38728
|
-
|
|
38729
|
-
|
|
38730
|
-
|
|
38731
|
-
|
|
40484
|
+
PBR2_HAS_DISPERSION as b$,
|
|
40485
|
+
PBR_HAS_SUBSURFACE as b0,
|
|
40486
|
+
PBR2_HAS_THICKNESS_GLTF_CHANNEL as b1,
|
|
40487
|
+
PBR_HAS_EMISSIVE_COLOR as b2,
|
|
40488
|
+
PBR_HAS_EMISSIVE as b3,
|
|
40489
|
+
PBR2_HAS_UNLIT as b4,
|
|
40490
|
+
MSH_HAS_SKELETON as b5,
|
|
40491
|
+
MSH_HAS_SKELETON_8 as b6,
|
|
40492
|
+
MSH_HAS_MORPH_TARGETS as b7,
|
|
40493
|
+
uploadKtx2Texture2D as b8,
|
|
40494
|
+
decodeKtx2ImageBitmapFromBuffer as b9,
|
|
40495
|
+
sanitize as bA,
|
|
40496
|
+
bjsTypeToNodeType as bB,
|
|
40497
|
+
extractDefault as bC,
|
|
40498
|
+
floatCount as bD,
|
|
40499
|
+
NODE_GEOMETRY_OUTPUT as bE,
|
|
40500
|
+
appendMeshLightUboFields as bF,
|
|
40501
|
+
meshLightIndexWGSL as bG,
|
|
40502
|
+
clearSceneBGLCache as bH,
|
|
40503
|
+
_getStdExtsSorted as bI,
|
|
40504
|
+
_standardFeatureKey as bJ,
|
|
40505
|
+
HAS_DIFFUSE_TEXTURE as bK,
|
|
40506
|
+
REVERSE_DEPTH_COMPARE as bL,
|
|
40507
|
+
DOUBLE_SIDED as bM,
|
|
40508
|
+
DISABLE_LIGHTING as bN,
|
|
40509
|
+
DIFFUSE_USES_UV2 as bO,
|
|
40510
|
+
createSingleUniformBGL as bP,
|
|
40511
|
+
getViewProjectionMatrix as bQ,
|
|
40512
|
+
_isShaderSystemUniform as bR,
|
|
40513
|
+
getEffectiveAspectRatio as bS,
|
|
40514
|
+
I32 as bT,
|
|
40515
|
+
I8 as bU,
|
|
40516
|
+
I16 as bV,
|
|
40517
|
+
PATH_POINTER as bW,
|
|
40518
|
+
PBR2_HAS_REFRACTION as bX,
|
|
40519
|
+
PBR2_HAS_REFRACTION_MAP as bY,
|
|
40520
|
+
getTrilinearAnisotropicSampler as bZ,
|
|
40521
|
+
PBR2_LINEAR_IMAGE_PROCESSING as b_,
|
|
40522
|
+
setMaxLights as ba,
|
|
40523
|
+
computeNodeWorldMatrix as bb,
|
|
40524
|
+
setSubtreeVisible as bc,
|
|
40525
|
+
mat4Invert as bd,
|
|
40526
|
+
mat4Identity as be,
|
|
40527
|
+
getLoaderTmpAnim as bf,
|
|
40528
|
+
mat4MultiplyInto as bg,
|
|
40529
|
+
INTERP_CUBICSPLINE as bh,
|
|
40530
|
+
INTERP_STEP as bi,
|
|
40531
|
+
INTERP_LINEAR as bj,
|
|
40532
|
+
PATH_WEIGHTS as bk,
|
|
40533
|
+
PATH_SCALE as bl,
|
|
40534
|
+
PATH_ROTATION as bm,
|
|
40535
|
+
PATH_TRANSLATION as bn,
|
|
40536
|
+
findParent as bo,
|
|
40537
|
+
setThinInstances as bp,
|
|
40538
|
+
mat4ComposeInto as bq,
|
|
40539
|
+
getLoaderTmpInstance as br,
|
|
40540
|
+
mat4Multiply as bs,
|
|
40541
|
+
identityTexWrap as bt,
|
|
40542
|
+
getOrCreateSampler as bu,
|
|
40543
|
+
assembleMaterial as bv,
|
|
40544
|
+
runMatExts as bw,
|
|
40545
|
+
makeImageFetcher as bx,
|
|
40546
|
+
findBlockByClassName as by,
|
|
40547
|
+
emitGraph as bz,
|
|
38732
40548
|
compileNodePipeline as c,
|
|
38733
|
-
|
|
38734
|
-
|
|
38735
|
-
|
|
38736
|
-
|
|
38737
|
-
|
|
38738
|
-
|
|
38739
|
-
|
|
38740
|
-
|
|
38741
|
-
|
|
38742
|
-
|
|
38743
|
-
|
|
38744
|
-
|
|
38745
|
-
|
|
38746
|
-
|
|
38747
|
-
|
|
38748
|
-
|
|
38749
|
-
|
|
38750
|
-
|
|
38751
|
-
|
|
38752
|
-
|
|
38753
|
-
|
|
38754
|
-
|
|
38755
|
-
|
|
38756
|
-
|
|
38757
|
-
|
|
38758
|
-
|
|
38759
|
-
|
|
38760
|
-
|
|
38761
|
-
|
|
38762
|
-
|
|
38763
|
-
|
|
38764
|
-
|
|
38765
|
-
|
|
38766
|
-
|
|
38767
|
-
|
|
38768
|
-
|
|
38769
|
-
|
|
38770
|
-
|
|
38771
|
-
|
|
38772
|
-
|
|
38773
|
-
|
|
38774
|
-
|
|
38775
|
-
|
|
38776
|
-
|
|
38777
|
-
|
|
38778
|
-
|
|
38779
|
-
|
|
38780
|
-
|
|
38781
|
-
|
|
38782
|
-
|
|
38783
|
-
|
|
38784
|
-
|
|
38785
|
-
|
|
38786
|
-
|
|
38787
|
-
|
|
38788
|
-
|
|
38789
|
-
|
|
38790
|
-
|
|
38791
|
-
|
|
38792
|
-
|
|
38793
|
-
|
|
38794
|
-
|
|
38795
|
-
|
|
38796
|
-
|
|
40549
|
+
addTextRendererLayer as c$,
|
|
40550
|
+
PBR2_HAS_VOLUME as c0,
|
|
40551
|
+
enableSceneTransmission as c1,
|
|
40552
|
+
GEOMETRY_OUTPUT as c2,
|
|
40553
|
+
_registerPbrExt as c3,
|
|
40554
|
+
PBR2_GEOMETRY_OUTPUT as c4,
|
|
40555
|
+
PBR_HAS_ENV as c5,
|
|
40556
|
+
_computePbrMaterialFeatures as c6,
|
|
40557
|
+
collectPbrBoundTextures as c7,
|
|
40558
|
+
PBR_HAS_NORMAL_MAP as c8,
|
|
40559
|
+
MSH_HAS_TANGENTS as c9,
|
|
40560
|
+
PhysicsShapeType as cA,
|
|
40561
|
+
VERSION as cB,
|
|
40562
|
+
addAgent as cC,
|
|
40563
|
+
addAnimationGroup as cD,
|
|
40564
|
+
addAnimationGroups as cE,
|
|
40565
|
+
addAnimationTask as cF,
|
|
40566
|
+
addAxisLockedBillboardSystem as cG,
|
|
40567
|
+
addBillboardSprite as cH,
|
|
40568
|
+
addBillboardSpriteIndex as cI,
|
|
40569
|
+
addBoxObstacle as cJ,
|
|
40570
|
+
addClusteredLightContainer as cK,
|
|
40571
|
+
addCylinderObstacle as cL,
|
|
40572
|
+
addDepthHostedSpriteLayer as cM,
|
|
40573
|
+
addFacingBillboardSystem as cN,
|
|
40574
|
+
addPassDependencies as cO,
|
|
40575
|
+
addPhysicsShapeChild as cP,
|
|
40576
|
+
addPhysicsShapeChildFromParent as cQ,
|
|
40577
|
+
addRenderPass as cR,
|
|
40578
|
+
addSprite2D as cS,
|
|
40579
|
+
addSprite2DIndex as cT,
|
|
40580
|
+
addSpriteAnimation as cU,
|
|
40581
|
+
addSpriteAnimationManager as cV,
|
|
40582
|
+
addSpriteRendererLayer as cW,
|
|
40583
|
+
addTask as cX,
|
|
40584
|
+
addTaskAtStart as cY,
|
|
40585
|
+
addTaskBefore as cZ,
|
|
40586
|
+
addTextRenderable as c_,
|
|
40587
|
+
MSH_HAS_UV2 as ca,
|
|
40588
|
+
MSH_HAS_VERTEX_COLOR as cb,
|
|
40589
|
+
PBR_HAS_DOUBLE_SIDED as cc,
|
|
40590
|
+
getBilinearSampler as cd,
|
|
40591
|
+
_getPbrExtsSorted as ce,
|
|
40592
|
+
PBR_HAS_SPEC_GLOSS as cf,
|
|
40593
|
+
PBR2_NO_COLOR_OUTPUT as cg,
|
|
40594
|
+
_getPbrExts as ch,
|
|
40595
|
+
PBR2_HAS_UV_TRANSFORM as ci,
|
|
40596
|
+
PBR_HAS_ANISOTROPY as cj,
|
|
40597
|
+
PBR_HAS_SKYBOX as ck,
|
|
40598
|
+
PBR_HAS_SPECULAR_AA as cl,
|
|
40599
|
+
PBR_HAS_FOG as cm,
|
|
40600
|
+
PBR_HAS_OCCLUSION as cn,
|
|
40601
|
+
PBR2_HAS_BASE_COLOR_FACTOR as co,
|
|
40602
|
+
PBR_HAS_GAMMA_ALBEDO as cp,
|
|
40603
|
+
PBR_HAS_TONEMAP as cq,
|
|
40604
|
+
CAP_ALL as cr,
|
|
40605
|
+
CAP_END as cs,
|
|
40606
|
+
CAP_NONE as ct,
|
|
40607
|
+
CAP_START as cu,
|
|
40608
|
+
DepthOfFieldBlurLevel as cv,
|
|
40609
|
+
ObservableQuat as cw,
|
|
40610
|
+
ObservableVec3 as cx,
|
|
40611
|
+
PhysicsConstraintAxis as cy,
|
|
40612
|
+
PhysicsConstraintType as cz,
|
|
38797
40613
|
NODE_NO_COLOR_OUTPUT as d,
|
|
38798
|
-
|
|
38799
|
-
|
|
38800
|
-
|
|
38801
|
-
|
|
38802
|
-
|
|
38803
|
-
|
|
38804
|
-
|
|
38805
|
-
|
|
38806
|
-
|
|
38807
|
-
|
|
38808
|
-
|
|
38809
|
-
|
|
38810
|
-
|
|
38811
|
-
|
|
38812
|
-
|
|
38813
|
-
|
|
38814
|
-
|
|
38815
|
-
|
|
38816
|
-
|
|
38817
|
-
|
|
38818
|
-
|
|
38819
|
-
|
|
38820
|
-
|
|
38821
|
-
|
|
38822
|
-
|
|
38823
|
-
|
|
38824
|
-
|
|
38825
|
-
|
|
38826
|
-
|
|
38827
|
-
|
|
38828
|
-
|
|
38829
|
-
|
|
38830
|
-
|
|
38831
|
-
|
|
38832
|
-
|
|
38833
|
-
|
|
38834
|
-
|
|
38835
|
-
|
|
38836
|
-
|
|
38837
|
-
|
|
38838
|
-
|
|
38839
|
-
|
|
38840
|
-
|
|
38841
|
-
|
|
38842
|
-
|
|
38843
|
-
|
|
38844
|
-
|
|
38845
|
-
|
|
38846
|
-
|
|
38847
|
-
|
|
38848
|
-
|
|
38849
|
-
|
|
38850
|
-
|
|
38851
|
-
|
|
38852
|
-
|
|
38853
|
-
|
|
38854
|
-
|
|
38855
|
-
|
|
38856
|
-
|
|
38857
|
-
|
|
38858
|
-
|
|
38859
|
-
|
|
38860
|
-
|
|
40614
|
+
createClusteredLightContainer as d$,
|
|
40615
|
+
addThinInstance as d0,
|
|
40616
|
+
addToScene as d1,
|
|
40617
|
+
agentGoto as d2,
|
|
40618
|
+
appendSpriteAtlasFrames as d3,
|
|
40619
|
+
applyPhysicsBodyForce as d4,
|
|
40620
|
+
applyPhysicsBodyImpulse as d5,
|
|
40621
|
+
applyPhysicsImpulse as d6,
|
|
40622
|
+
attachAxisDragGizmoToNode as d7,
|
|
40623
|
+
attachAxisScaleGizmoToNode as d8,
|
|
40624
|
+
attachBoundingBoxGizmoToNode as d9,
|
|
40625
|
+
clearSprite2DLayer as dA,
|
|
40626
|
+
clearSpriteAnimations as dB,
|
|
40627
|
+
cloneTransformNode as dC,
|
|
40628
|
+
computeLocalBasis as dD,
|
|
40629
|
+
computeLookAtFromYawPitch as dE,
|
|
40630
|
+
computePath as dF,
|
|
40631
|
+
computeYawPitchFromLookAt as dG,
|
|
40632
|
+
createAnaglyphPostProcessTask as dH,
|
|
40633
|
+
createAnimationController as dI,
|
|
40634
|
+
createAnimationGroups as dJ,
|
|
40635
|
+
createAnimationManager as dK,
|
|
40636
|
+
createAnimationTask as dL,
|
|
40637
|
+
createArcRotateCamera as dM,
|
|
40638
|
+
createAxisDragGizmo as dN,
|
|
40639
|
+
createAxisLockedBillboardSystem as dO,
|
|
40640
|
+
createAxisScaleGizmo as dP,
|
|
40641
|
+
createBillboardCustomShader as dQ,
|
|
40642
|
+
createBlackAndWhitePostProcessTask as dR,
|
|
40643
|
+
createBloomPostProcessTask as dS,
|
|
40644
|
+
createBlurPostProcessTask as dT,
|
|
40645
|
+
createBoundingBoxGizmo as dU,
|
|
40646
|
+
createBox as dV,
|
|
40647
|
+
createCameraGizmo as dW,
|
|
40648
|
+
createCapsule as dX,
|
|
40649
|
+
createCapsuleData as dY,
|
|
40650
|
+
createChromaticAberrationPostProcessTask as dZ,
|
|
40651
|
+
createCircleOfConfusionPostProcessTask as d_,
|
|
40652
|
+
attachCameraGizmoToCamera as da,
|
|
40653
|
+
attachControl as db,
|
|
40654
|
+
attachFreeControl as dc,
|
|
40655
|
+
attachGeospatialControls as dd,
|
|
40656
|
+
attachLightGizmoToLight as de,
|
|
40657
|
+
attachPlaneDragGizmoToNode as df,
|
|
40658
|
+
attachPlaneRotationGizmoToNode as dg,
|
|
40659
|
+
attachPositionGizmoToNode as dh,
|
|
40660
|
+
attachRotationGizmoToNode as di,
|
|
40661
|
+
attachScaleGizmoToNode as dj,
|
|
40662
|
+
attachSpriteAnimationsToRenderer as dk,
|
|
40663
|
+
attachSpriteAnimationsToScene as dl,
|
|
40664
|
+
attachVat as dm,
|
|
40665
|
+
bakeCurrentTransformIntoVertices as dn,
|
|
40666
|
+
bakeTransformIntoVertices as dp,
|
|
40667
|
+
bakeVat as dq,
|
|
40668
|
+
billboardBlendAdditive as dr,
|
|
40669
|
+
billboardBlendAlpha as ds,
|
|
40670
|
+
billboardBlendCutout as dt,
|
|
40671
|
+
billboardBlendPremultiplied as du,
|
|
40672
|
+
captureScreenshot as dv,
|
|
40673
|
+
clampCenterFromPoles as dw,
|
|
40674
|
+
clampZoomDistance as dx,
|
|
40675
|
+
clearAnimationManager as dy,
|
|
40676
|
+
clearBillboardSprites as dz,
|
|
38861
40677
|
U8 as e,
|
|
38862
|
-
|
|
38863
|
-
|
|
38864
|
-
|
|
38865
|
-
|
|
38866
|
-
|
|
38867
|
-
|
|
38868
|
-
|
|
38869
|
-
|
|
38870
|
-
|
|
38871
|
-
|
|
38872
|
-
|
|
38873
|
-
|
|
38874
|
-
|
|
38875
|
-
|
|
38876
|
-
|
|
38877
|
-
|
|
38878
|
-
|
|
38879
|
-
|
|
38880
|
-
|
|
38881
|
-
|
|
38882
|
-
|
|
38883
|
-
|
|
38884
|
-
|
|
38885
|
-
|
|
38886
|
-
|
|
38887
|
-
|
|
38888
|
-
|
|
38889
|
-
|
|
38890
|
-
|
|
38891
|
-
|
|
38892
|
-
|
|
38893
|
-
|
|
38894
|
-
|
|
38895
|
-
|
|
38896
|
-
|
|
38897
|
-
|
|
38898
|
-
|
|
38899
|
-
|
|
38900
|
-
|
|
38901
|
-
|
|
38902
|
-
|
|
38903
|
-
|
|
38904
|
-
|
|
38905
|
-
|
|
38906
|
-
|
|
38907
|
-
|
|
38908
|
-
|
|
38909
|
-
|
|
38910
|
-
|
|
38911
|
-
|
|
38912
|
-
|
|
38913
|
-
|
|
38914
|
-
|
|
38915
|
-
|
|
38916
|
-
|
|
38917
|
-
|
|
38918
|
-
|
|
38919
|
-
|
|
38920
|
-
|
|
38921
|
-
|
|
38922
|
-
|
|
38923
|
-
|
|
38924
|
-
|
|
38925
|
-
|
|
38926
|
-
|
|
38927
|
-
|
|
38928
|
-
|
|
38929
|
-
|
|
38930
|
-
|
|
38931
|
-
|
|
38932
|
-
|
|
38933
|
-
|
|
38934
|
-
|
|
38935
|
-
|
|
38936
|
-
|
|
38937
|
-
|
|
38938
|
-
|
|
38939
|
-
|
|
38940
|
-
|
|
38941
|
-
|
|
38942
|
-
|
|
38943
|
-
|
|
38944
|
-
|
|
38945
|
-
|
|
38946
|
-
|
|
38947
|
-
|
|
38948
|
-
|
|
38949
|
-
|
|
38950
|
-
|
|
38951
|
-
|
|
38952
|
-
|
|
38953
|
-
|
|
38954
|
-
|
|
38955
|
-
|
|
38956
|
-
|
|
38957
|
-
|
|
38958
|
-
|
|
38959
|
-
|
|
38960
|
-
|
|
38961
|
-
|
|
38962
|
-
|
|
38963
|
-
|
|
38964
|
-
|
|
38965
|
-
|
|
38966
|
-
|
|
38967
|
-
|
|
38968
|
-
|
|
38969
|
-
|
|
38970
|
-
|
|
38971
|
-
|
|
38972
|
-
|
|
38973
|
-
|
|
38974
|
-
|
|
38975
|
-
|
|
38976
|
-
|
|
38977
|
-
|
|
38978
|
-
|
|
38979
|
-
|
|
38980
|
-
|
|
38981
|
-
|
|
38982
|
-
|
|
38983
|
-
|
|
38984
|
-
|
|
38985
|
-
|
|
38986
|
-
|
|
38987
|
-
|
|
38988
|
-
|
|
38989
|
-
|
|
38990
|
-
|
|
38991
|
-
|
|
38992
|
-
|
|
38993
|
-
|
|
38994
|
-
|
|
38995
|
-
|
|
38996
|
-
|
|
38997
|
-
|
|
38998
|
-
|
|
38999
|
-
|
|
39000
|
-
|
|
39001
|
-
|
|
39002
|
-
|
|
39003
|
-
|
|
39004
|
-
|
|
39005
|
-
|
|
39006
|
-
|
|
39007
|
-
|
|
39008
|
-
|
|
39009
|
-
|
|
39010
|
-
|
|
39011
|
-
|
|
39012
|
-
|
|
39013
|
-
|
|
39014
|
-
|
|
39015
|
-
|
|
39016
|
-
|
|
39017
|
-
|
|
39018
|
-
|
|
39019
|
-
|
|
39020
|
-
|
|
39021
|
-
|
|
39022
|
-
|
|
39023
|
-
|
|
39024
|
-
|
|
39025
|
-
|
|
39026
|
-
|
|
39027
|
-
|
|
39028
|
-
|
|
39029
|
-
|
|
39030
|
-
|
|
39031
|
-
|
|
39032
|
-
|
|
39033
|
-
|
|
39034
|
-
|
|
39035
|
-
|
|
39036
|
-
|
|
39037
|
-
|
|
39038
|
-
|
|
39039
|
-
|
|
39040
|
-
|
|
39041
|
-
|
|
39042
|
-
|
|
39043
|
-
|
|
39044
|
-
|
|
39045
|
-
|
|
39046
|
-
|
|
39047
|
-
|
|
39048
|
-
|
|
39049
|
-
|
|
39050
|
-
|
|
39051
|
-
|
|
39052
|
-
|
|
39053
|
-
|
|
39054
|
-
|
|
39055
|
-
|
|
39056
|
-
|
|
39057
|
-
|
|
39058
|
-
|
|
39059
|
-
|
|
39060
|
-
|
|
39061
|
-
|
|
39062
|
-
|
|
39063
|
-
|
|
39064
|
-
|
|
39065
|
-
|
|
39066
|
-
|
|
39067
|
-
|
|
39068
|
-
|
|
39069
|
-
|
|
39070
|
-
|
|
39071
|
-
|
|
39072
|
-
|
|
39073
|
-
|
|
39074
|
-
|
|
39075
|
-
|
|
39076
|
-
|
|
39077
|
-
|
|
39078
|
-
|
|
39079
|
-
|
|
39080
|
-
|
|
39081
|
-
|
|
39082
|
-
|
|
39083
|
-
|
|
39084
|
-
|
|
39085
|
-
|
|
39086
|
-
|
|
39087
|
-
|
|
39088
|
-
|
|
39089
|
-
|
|
39090
|
-
|
|
39091
|
-
|
|
39092
|
-
|
|
39093
|
-
|
|
39094
|
-
|
|
39095
|
-
|
|
39096
|
-
|
|
39097
|
-
|
|
39098
|
-
|
|
39099
|
-
|
|
39100
|
-
|
|
39101
|
-
|
|
39102
|
-
|
|
39103
|
-
|
|
39104
|
-
|
|
39105
|
-
|
|
39106
|
-
|
|
39107
|
-
|
|
39108
|
-
|
|
39109
|
-
|
|
39110
|
-
|
|
39111
|
-
|
|
39112
|
-
|
|
39113
|
-
|
|
39114
|
-
|
|
39115
|
-
|
|
39116
|
-
|
|
39117
|
-
|
|
39118
|
-
|
|
39119
|
-
|
|
39120
|
-
|
|
40678
|
+
createPositionGizmo as e$,
|
|
40679
|
+
createClusteredPointLight as e0,
|
|
40680
|
+
createCopyToTextureTask as e1,
|
|
40681
|
+
createCsg2FromMesh as e2,
|
|
40682
|
+
createCsgFromMesh as e3,
|
|
40683
|
+
createCsmDirectionalShadowGenerator as e4,
|
|
40684
|
+
createCylinder as e5,
|
|
40685
|
+
createCylinderData as e6,
|
|
40686
|
+
createDebugNavMeshGeometry as e7,
|
|
40687
|
+
createDefaultCamera as e8,
|
|
40688
|
+
createDefaultTextData as e9,
|
|
40689
|
+
createLightGizmo as eA,
|
|
40690
|
+
createLinearDepthMaterial as eB,
|
|
40691
|
+
createMeshFromCsg as eC,
|
|
40692
|
+
createMeshFromCsg2 as eD,
|
|
40693
|
+
createMeshFromData as eE,
|
|
40694
|
+
createMeshesFromCsg2 as eF,
|
|
40695
|
+
createMorphTargets as eG,
|
|
40696
|
+
createNavCrowd as eH,
|
|
40697
|
+
createNavMesh as eI,
|
|
40698
|
+
createNavMeshFromSources as eJ,
|
|
40699
|
+
createNavigationPluginAsync as eK,
|
|
40700
|
+
createNodeNoColorMaterialView$1 as eL,
|
|
40701
|
+
createPbrMaterial as eM,
|
|
40702
|
+
createPbrNoColorMaterialView$1 as eN,
|
|
40703
|
+
createPcfDirectionalShadowGenerator as eO,
|
|
40704
|
+
createPcfSpotlightShadowGenerator as eP,
|
|
40705
|
+
createPhysicsAggregate as eQ,
|
|
40706
|
+
createPhysicsBody as eR,
|
|
40707
|
+
createPhysicsConstraint as eS,
|
|
40708
|
+
createPhysicsShape as eT,
|
|
40709
|
+
createPhysicsViewer as eU,
|
|
40710
|
+
createPlane as eV,
|
|
40711
|
+
createPlaneDragGizmo as eW,
|
|
40712
|
+
createPlaneRotationGizmo as eX,
|
|
40713
|
+
createPointLight as eY,
|
|
40714
|
+
createPointerDrag as eZ,
|
|
40715
|
+
createPolyhedron as e_,
|
|
40716
|
+
createDepthOfFieldPostProcessTask as ea,
|
|
40717
|
+
createDirectionalLight as eb,
|
|
40718
|
+
createDisc as ec,
|
|
40719
|
+
createEffectRenderTask as ed,
|
|
40720
|
+
createEffectRenderer as ee,
|
|
40721
|
+
createEffectWrapper as ef,
|
|
40722
|
+
createEngine as eg,
|
|
40723
|
+
createEsmDirectionalShadowGenerator as eh,
|
|
40724
|
+
createExtractHighlightsPostProcessTask as ei,
|
|
40725
|
+
createExtrudeShape as ej,
|
|
40726
|
+
createFacingBillboardSystem as ek,
|
|
40727
|
+
createFontFromBuffer as el,
|
|
40728
|
+
createFrameGraphContext as em,
|
|
40729
|
+
createGeometryRendererTask as en,
|
|
40730
|
+
createGeospatialCamera as eo,
|
|
40731
|
+
createGeospatialLimits as ep,
|
|
40732
|
+
createGlyphStorage as eq,
|
|
40733
|
+
createGpuPicker as er,
|
|
40734
|
+
createGridMaterial as es,
|
|
40735
|
+
createGridSpriteAtlas as et,
|
|
40736
|
+
createGround as eu,
|
|
40737
|
+
createGroundFromHeightMap as ev,
|
|
40738
|
+
createHavokWorld as ew,
|
|
40739
|
+
createHeightFieldShape as ex,
|
|
40740
|
+
createHemisphericLight as ey,
|
|
40741
|
+
createImageProcessingTask as ez,
|
|
40742
|
+
markMaterialUboDirty as f,
|
|
40743
|
+
disposePicker as f$,
|
|
40744
|
+
createProceduralGaussianSplattingMesh as f0,
|
|
40745
|
+
createPropertyAnimationClip as f1,
|
|
40746
|
+
createPropertyAnimationGroup as f2,
|
|
40747
|
+
createRenderTarget as f3,
|
|
40748
|
+
createRenderTargetTexture as f4,
|
|
40749
|
+
createRenderTask as f5,
|
|
40750
|
+
createRenderTexture2D as f6,
|
|
40751
|
+
createRibbon as f7,
|
|
40752
|
+
createRotationGizmo as f8,
|
|
40753
|
+
createScaleGizmo as f9,
|
|
40754
|
+
createTransformNode as fA,
|
|
40755
|
+
createTube as fB,
|
|
40756
|
+
createUniformEffectRenderTask as fC,
|
|
40757
|
+
createUniformEffectWrapper as fD,
|
|
40758
|
+
createUtilityLayer as fE,
|
|
40759
|
+
crossFadeAnimationGroups as fF,
|
|
40760
|
+
csg2Add as fG,
|
|
40761
|
+
csg2Intersect as fH,
|
|
40762
|
+
csg2Subtract as fI,
|
|
40763
|
+
csgIntersect as fJ,
|
|
40764
|
+
csgSubtract as fK,
|
|
40765
|
+
csgUnion as fL,
|
|
40766
|
+
cubicToQuadratics as fM,
|
|
40767
|
+
disposeAxisDragGizmo as fN,
|
|
40768
|
+
disposeAxisScaleGizmo as fO,
|
|
40769
|
+
disposeBoundingBoxGizmo as fP,
|
|
40770
|
+
disposeCameraGizmo as fQ,
|
|
40771
|
+
disposeCsg2 as fR,
|
|
40772
|
+
disposeDefaultTextData as fS,
|
|
40773
|
+
disposeEffectRenderer as fT,
|
|
40774
|
+
disposeEffectWrapper as fU,
|
|
40775
|
+
disposeEngine as fV,
|
|
40776
|
+
disposeFrameGraphContext as fW,
|
|
40777
|
+
disposeGlyphStorage as fX,
|
|
40778
|
+
disposeLightGizmo as fY,
|
|
40779
|
+
disposePhysics as fZ,
|
|
40780
|
+
disposePhysicsViewer as f_,
|
|
40781
|
+
createSceneContext as fa,
|
|
40782
|
+
createShaderMaterial as fb,
|
|
40783
|
+
createShaderNoColorMaterialView$1 as fc,
|
|
40784
|
+
createShaderNormalMaterialView as fd,
|
|
40785
|
+
createShadowTask as fe,
|
|
40786
|
+
createSolidTexture2D as ff,
|
|
40787
|
+
createSphere as fg,
|
|
40788
|
+
createSphereData as fh,
|
|
40789
|
+
createSpotLight as fi,
|
|
40790
|
+
createSprite2DCustomShader as fj,
|
|
40791
|
+
createSprite2DLayer as fk,
|
|
40792
|
+
createSpriteAnimationManager as fl,
|
|
40793
|
+
createSpriteAtlasFromFrames as fm,
|
|
40794
|
+
createSpriteFrameAnimation as fn,
|
|
40795
|
+
createSpriteRenderer as fo,
|
|
40796
|
+
createStandardMaterial as fp,
|
|
40797
|
+
createStandardNoColorMaterialView$1 as fq,
|
|
40798
|
+
createSurface as fr,
|
|
40799
|
+
createTextData as fs,
|
|
40800
|
+
createTextLayer as ft,
|
|
40801
|
+
createTextRenderable as fu,
|
|
40802
|
+
createTextRenderer as fv,
|
|
40803
|
+
createTexture2DFromPixels as fw,
|
|
40804
|
+
createTorus as fx,
|
|
40805
|
+
createTorusKnot as fy,
|
|
40806
|
+
createTorusKnotData as fz,
|
|
40807
|
+
TYPE_SIZES as g,
|
|
40808
|
+
loadFont as g$,
|
|
40809
|
+
disposePlaneDragGizmo as g0,
|
|
40810
|
+
disposePlaneRotationGizmo as g1,
|
|
40811
|
+
disposePositionGizmo as g2,
|
|
40812
|
+
disposeRotationGizmo as g3,
|
|
40813
|
+
disposeScaleGizmo as g4,
|
|
40814
|
+
disposeScene as g5,
|
|
40815
|
+
disposeSpriteAnimationBinding as g6,
|
|
40816
|
+
disposeSpriteRenderer as g7,
|
|
40817
|
+
disposeSurface as g8,
|
|
40818
|
+
disposeTextData as g9,
|
|
40819
|
+
getNavigationRandomSeed as gA,
|
|
40820
|
+
getPhysicsBodyLinearVelocity as gB,
|
|
40821
|
+
getPhysicsGravity as gC,
|
|
40822
|
+
getPhysicsTimestep as gD,
|
|
40823
|
+
getPhysicsVelocityLimits as gE,
|
|
40824
|
+
getPickedNormal as gF,
|
|
40825
|
+
getPickedUV as gG,
|
|
40826
|
+
getRenderTaskGpuTimings as gH,
|
|
40827
|
+
getSprite2DHandleIndex as gI,
|
|
40828
|
+
getVariantNames as gJ,
|
|
40829
|
+
goToFrame as gK,
|
|
40830
|
+
gsAlphaBlendedDepthFragment as gL,
|
|
40831
|
+
gsLinearDepthFragment as gM,
|
|
40832
|
+
hidePhysicsBody as gN,
|
|
40833
|
+
initializeCsg2Async as gO,
|
|
40834
|
+
invalidateRenderBundles as gP,
|
|
40835
|
+
isBillboardSpriteHandleAlive as gQ,
|
|
40836
|
+
isCsg2Ready as gR,
|
|
40837
|
+
isGizmoDragging as gS,
|
|
40838
|
+
isGizmoInteracting as gT,
|
|
40839
|
+
isGizmoPickPending as gU,
|
|
40840
|
+
isGpuTimingSupported as gV,
|
|
40841
|
+
isRenderTaskGpuTimingSupported as gW,
|
|
40842
|
+
isSprite2DHandleAlive as gX,
|
|
40843
|
+
loadBabylon as gY,
|
|
40844
|
+
loadBasisTexture2D as gZ,
|
|
40845
|
+
loadEnvironment as g_,
|
|
40846
|
+
disposeTextRenderable as ga,
|
|
40847
|
+
disposeTextRenderer as gb,
|
|
40848
|
+
disposeUniformEffectWrapper as gc,
|
|
40849
|
+
disposeUtilityLayer as gd,
|
|
40850
|
+
enableAnimationBlending as ge,
|
|
40851
|
+
enableDetailedPicking as gf,
|
|
40852
|
+
enableHavokFloatingOrigin as gg,
|
|
40853
|
+
enableMaterialPlugins as gh,
|
|
40854
|
+
enableMaterialTracking as gi,
|
|
40855
|
+
enablePropertyAnimationBlending as gj,
|
|
40856
|
+
enableRenderTaskTransmission as gk,
|
|
40857
|
+
enableThinInstanceGpuCulling as gl,
|
|
40858
|
+
extractGlyphCurves as gm,
|
|
40859
|
+
fadeAnimationWeight as gn,
|
|
40860
|
+
findRandomPoint as go,
|
|
40861
|
+
findRandomPointAroundCircle as gp,
|
|
40862
|
+
flushThinInstances as gq,
|
|
40863
|
+
flyGeospatialCameraToAsync as gr,
|
|
40864
|
+
getAgentPosition as gs,
|
|
40865
|
+
getAgentVelocity as gt,
|
|
40866
|
+
getAnimationGroups as gu,
|
|
40867
|
+
getBillboardSpriteHandleIndex as gv,
|
|
40868
|
+
getClosestPoint as gw,
|
|
40869
|
+
getEffectivePitchMax as gx,
|
|
40870
|
+
getFloatingOriginOffset as gy,
|
|
40871
|
+
getFrameGraph as gz,
|
|
40872
|
+
computeAabb as h,
|
|
40873
|
+
setAnimationAdditive as h$,
|
|
40874
|
+
loadGltf as h0,
|
|
40875
|
+
loadHdrEnvironment as h1,
|
|
40876
|
+
loadKtxTexture2D as h2,
|
|
40877
|
+
loadNodeBlockEmitterWithGeometry as h3,
|
|
40878
|
+
loadSOG as h4,
|
|
40879
|
+
loadSPZ as h5,
|
|
40880
|
+
loadSkybox as h6,
|
|
40881
|
+
loadSplat as h7,
|
|
40882
|
+
loadSpriteAtlas as h8,
|
|
40883
|
+
loadTexture2D as h9,
|
|
40884
|
+
registerSceneWithShadowSupport as hA,
|
|
40885
|
+
registerSpriteRenderer as hB,
|
|
40886
|
+
registerTextRenderer as hC,
|
|
40887
|
+
registerUtilityLayer as hD,
|
|
40888
|
+
releasePhysicsShape as hE,
|
|
40889
|
+
removeAnimationGroup as hF,
|
|
40890
|
+
removeAnimationTask as hG,
|
|
40891
|
+
removeBillboardSprite as hH,
|
|
40892
|
+
removeBillboardSpriteIndex as hI,
|
|
40893
|
+
removeFromScene as hJ,
|
|
40894
|
+
removeMeshFromTask as hK,
|
|
40895
|
+
removeObstacle as hL,
|
|
40896
|
+
removePhysicsBody as hM,
|
|
40897
|
+
removeSprite2D as hN,
|
|
40898
|
+
removeSprite2DIndex as hO,
|
|
40899
|
+
removeSpriteAnimation as hP,
|
|
40900
|
+
removeSpriteAnimationManager as hQ,
|
|
40901
|
+
removeSpriteRendererLayer as hR,
|
|
40902
|
+
removeTextRendererLayer as hS,
|
|
40903
|
+
removeThinInstance as hT,
|
|
40904
|
+
renderFrame as hU,
|
|
40905
|
+
resetVariant as hV,
|
|
40906
|
+
resizeEngine as hW,
|
|
40907
|
+
resizeMeshGeometry as hX,
|
|
40908
|
+
resizeSurface as hY,
|
|
40909
|
+
resolveCameraViewport as hZ,
|
|
40910
|
+
selectVariant as h_,
|
|
40911
|
+
markClusteredLightContainerDirty as ha,
|
|
40912
|
+
mat4Compose as hb,
|
|
40913
|
+
mat4Scale as hc,
|
|
40914
|
+
mat4Translation as hd,
|
|
40915
|
+
normalizeRadians as he,
|
|
40916
|
+
normalizeVec3$1 as hf,
|
|
40917
|
+
onBeforeRender as hg,
|
|
40918
|
+
onCsmReceiverUpdate as hh,
|
|
40919
|
+
onPhysicsAfterStep as hi,
|
|
40920
|
+
onSceneDispose as hj,
|
|
40921
|
+
packedSrgbToLinearRgba as hk,
|
|
40922
|
+
parseNodeMaterialFromSnippet as hl,
|
|
40923
|
+
pauseAnimation as hm,
|
|
40924
|
+
pickAsync as hn,
|
|
40925
|
+
playAnimation as ho,
|
|
40926
|
+
playBillboardSpriteAnimation as hp,
|
|
40927
|
+
playBillboardSpriteIndexAnimation as hq,
|
|
40928
|
+
playSprite2DAnimation as hr,
|
|
40929
|
+
playSprite2DIndexAnimation as hs,
|
|
40930
|
+
playSpriteFrameAnimation as ht,
|
|
40931
|
+
raycast as hu,
|
|
40932
|
+
rebuildMaterial as hv,
|
|
40933
|
+
registerEffectRenderer as hw,
|
|
40934
|
+
registerFrameGraphContext as hx,
|
|
40935
|
+
registerPointerDrag as hy,
|
|
40936
|
+
registerScene as hz,
|
|
39121
40937
|
initMeshTransform as i,
|
|
39122
|
-
|
|
39123
|
-
|
|
39124
|
-
|
|
39125
|
-
|
|
39126
|
-
|
|
39127
|
-
|
|
39128
|
-
|
|
39129
|
-
|
|
39130
|
-
|
|
39131
|
-
|
|
39132
|
-
|
|
39133
|
-
|
|
39134
|
-
|
|
39135
|
-
|
|
39136
|
-
|
|
39137
|
-
|
|
39138
|
-
|
|
39139
|
-
|
|
39140
|
-
|
|
39141
|
-
|
|
39142
|
-
|
|
39143
|
-
|
|
39144
|
-
|
|
39145
|
-
|
|
39146
|
-
|
|
39147
|
-
|
|
39148
|
-
|
|
39149
|
-
|
|
39150
|
-
|
|
39151
|
-
|
|
39152
|
-
|
|
39153
|
-
|
|
39154
|
-
|
|
39155
|
-
|
|
39156
|
-
|
|
39157
|
-
|
|
39158
|
-
|
|
39159
|
-
|
|
39160
|
-
|
|
39161
|
-
|
|
39162
|
-
|
|
39163
|
-
|
|
39164
|
-
|
|
39165
|
-
|
|
39166
|
-
|
|
39167
|
-
|
|
39168
|
-
|
|
39169
|
-
|
|
39170
|
-
|
|
39171
|
-
|
|
39172
|
-
|
|
39173
|
-
|
|
39174
|
-
|
|
39175
|
-
|
|
39176
|
-
|
|
39177
|
-
|
|
39178
|
-
|
|
39179
|
-
|
|
39180
|
-
|
|
39181
|
-
|
|
39182
|
-
|
|
39183
|
-
|
|
39184
|
-
|
|
39185
|
-
|
|
39186
|
-
|
|
39187
|
-
|
|
39188
|
-
|
|
39189
|
-
|
|
39190
|
-
|
|
39191
|
-
|
|
39192
|
-
|
|
39193
|
-
|
|
39194
|
-
|
|
40938
|
+
spriteBlendPremultiplied as i$,
|
|
40939
|
+
setAnimationTaskCategoryHandler as i0,
|
|
40940
|
+
setAnimationWeight as i1,
|
|
40941
|
+
setBillboardShaderParams as i2,
|
|
40942
|
+
setBillboardSpriteFrame as i3,
|
|
40943
|
+
setBillboardSpriteFrameIndex as i4,
|
|
40944
|
+
setCameraLimits as i5,
|
|
40945
|
+
setClipPlane as i6,
|
|
40946
|
+
setEffectTexture as i7,
|
|
40947
|
+
setEffectUniforms as i8,
|
|
40948
|
+
setEngineSize as i9,
|
|
40949
|
+
setScaleGizmoLocalCoordinates as iA,
|
|
40950
|
+
setShaderFloat as iB,
|
|
40951
|
+
setShaderMatrix as iC,
|
|
40952
|
+
setShaderStorageBuffer as iD,
|
|
40953
|
+
setShaderTexture as iE,
|
|
40954
|
+
setShaderUniform as iF,
|
|
40955
|
+
setShaderVector3 as iG,
|
|
40956
|
+
setShadowTaskCasterMeshes as iH,
|
|
40957
|
+
setSprite2DFrame as iI,
|
|
40958
|
+
setSprite2DFrameIndex as iJ,
|
|
40959
|
+
setSprite2DShaderParams as iK,
|
|
40960
|
+
setSprite2DUvOffset as iL,
|
|
40961
|
+
setSpriteRendererTarget as iM,
|
|
40962
|
+
setSurfaceSize as iN,
|
|
40963
|
+
setTextLayerPosition as iO,
|
|
40964
|
+
setThinInstanceColor as iP,
|
|
40965
|
+
setThinInstanceColors as iQ,
|
|
40966
|
+
setThinInstanceCount as iR,
|
|
40967
|
+
setThinInstanceMatrix as iS,
|
|
40968
|
+
setUniformEffectUniforms as iT,
|
|
40969
|
+
shapeCast as iU,
|
|
40970
|
+
shapeProximity as iV,
|
|
40971
|
+
showPhysicsBody as iW,
|
|
40972
|
+
showPhysicsConstraint as iX,
|
|
40973
|
+
spriteBlendAdditive as iY,
|
|
40974
|
+
spriteBlendAlpha as iZ,
|
|
40975
|
+
spriteBlendMultiply as i_,
|
|
40976
|
+
setFog as ia,
|
|
40977
|
+
setGeospatialOrientation as ib,
|
|
40978
|
+
setGpuTimingEnabled as ic,
|
|
40979
|
+
setKtx2DecoderUrl as id,
|
|
40980
|
+
setMorphTargetWeights as ie,
|
|
40981
|
+
setNavigationRandomSeed as ig,
|
|
40982
|
+
setParent as ih,
|
|
40983
|
+
setPhysicsBodyAngularVelocity as ii,
|
|
40984
|
+
setPhysicsBodyLinearVelocity as ij,
|
|
40985
|
+
setPhysicsBodyMass as ik,
|
|
40986
|
+
setPhysicsBodyMassProperties as il,
|
|
40987
|
+
setPhysicsBodyMotionType as im,
|
|
40988
|
+
setPhysicsBodyPreStep as io,
|
|
40989
|
+
setPhysicsBodyShape as ip,
|
|
40990
|
+
setPhysicsBodyTransform as iq,
|
|
40991
|
+
setPhysicsGravity as ir,
|
|
40992
|
+
setPhysicsShapeFilterCollideMask as is,
|
|
40993
|
+
setPhysicsShapeFilterMembershipMask as it,
|
|
40994
|
+
setPhysicsShapeMaterial as iu,
|
|
40995
|
+
setPhysicsTimestep as iv,
|
|
40996
|
+
setPhysicsVelocityLimits as iw,
|
|
40997
|
+
setPositionGizmoLocalCoordinates as ix,
|
|
40998
|
+
setRenderTaskGpuTimingEnabled as iy,
|
|
40999
|
+
setRotationGizmoLocalCoordinates as iz,
|
|
41000
|
+
U16 as j,
|
|
41001
|
+
srgbByteToLinear as j0,
|
|
41002
|
+
startAnimationManager as j1,
|
|
41003
|
+
startEngine as j2,
|
|
41004
|
+
startSpriteAnimationManager as j3,
|
|
41005
|
+
stopAnimation as j4,
|
|
41006
|
+
stopAnimationManager as j5,
|
|
41007
|
+
stopEngine as j6,
|
|
41008
|
+
stopSpriteAnimation as j7,
|
|
41009
|
+
stopSpriteAnimationManager as j8,
|
|
41010
|
+
unregisterEffectRenderer as j9,
|
|
41011
|
+
animationGroup as jA,
|
|
41012
|
+
createMorphTargets$1 as jB,
|
|
41013
|
+
unregisterFrameGraphContext as ja,
|
|
41014
|
+
unregisterScene as jb,
|
|
41015
|
+
unregisterSpriteRenderer as jc,
|
|
41016
|
+
unregisterTextRenderer as jd,
|
|
41017
|
+
updateAnimationManager as je,
|
|
41018
|
+
updateBillboardSprite as jf,
|
|
41019
|
+
updateBillboardSpriteIndex as jg,
|
|
41020
|
+
updateDefaultTextData as jh,
|
|
41021
|
+
updateGlyphStorage as ji,
|
|
41022
|
+
updateMeshColors as jj,
|
|
41023
|
+
updateMeshNormals as jk,
|
|
41024
|
+
updateMeshPositions as jl,
|
|
41025
|
+
updateMeshTangents as jm,
|
|
41026
|
+
updateMeshUv2 as jn,
|
|
41027
|
+
updateMeshUvs as jo,
|
|
41028
|
+
updateNavCrowd as jp,
|
|
41029
|
+
updateNavMeshObstacles as jq,
|
|
41030
|
+
updateSprite2D as jr,
|
|
41031
|
+
updateSprite2DIndex as js,
|
|
41032
|
+
updateSpriteAnimationManager as jt,
|
|
41033
|
+
updateTextData as ju,
|
|
41034
|
+
updateTexture2DFromPixels as jv,
|
|
41035
|
+
generateMipmaps$1 as jw,
|
|
41036
|
+
pointLight as jx,
|
|
41037
|
+
directionalLight as jy,
|
|
41038
|
+
spotLight as jz,
|
|
41039
|
+
createMappedBuffer as k,
|
|
41040
|
+
anyPrimitive as l,
|
|
41041
|
+
makeTimingSnapshot as m,
|
|
39195
41042
|
needsOrmComposite as n,
|
|
39196
41043
|
computeUboLayout as o,
|
|
39197
41044
|
packMat4IntoF32 as p,
|
|
@@ -39202,8 +41049,8 @@ export {
|
|
|
39202
41049
|
uploadTex as u,
|
|
39203
41050
|
cloneTexture2D as v,
|
|
39204
41051
|
writeNodeUBO as w,
|
|
39205
|
-
|
|
39206
|
-
|
|
39207
|
-
|
|
41052
|
+
createFreeCamera as x,
|
|
41053
|
+
targetSignatureKey as y,
|
|
41054
|
+
createDefaultPipelineDescriptor as z
|
|
39208
41055
|
};
|
|
39209
|
-
//# sourceMappingURL=index-
|
|
41056
|
+
//# sourceMappingURL=index-C-tEgwbZ.js.map
|