@babylonjs/lite 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_mat4-storage-f64-Bvh5TymE.js → _mat4-storage-f64-CjDoht2w.js} +3 -2
- package/_mat4-storage-f64-CjDoht2w.js.map +1 -0
- package/{alpha-test-fragment-BCChpzaV.js → alpha-test-fragment-B7DjSnF7.js} +2 -2
- package/{alpha-test-fragment-BCChpzaV.js.map → alpha-test-fragment-B7DjSnF7.js.map} +1 -1
- package/assets/splat-sort-worker-DT3eybMZ.js.map +1 -0
- package/{background-dds-skybox-ZjrSIxrT.js → background-dds-skybox-BEX309u3.js} +13 -13
- package/background-dds-skybox-BEX309u3.js.map +1 -0
- package/{background-ground-B2Mie-MI.js → background-ground-BU0HOcM4.js} +19 -19
- package/background-ground-BU0HOcM4.js.map +1 -0
- package/{background-hdr-skybox-DDRJYuT2.js → background-hdr-skybox--RRRic_K.js} +10 -10
- package/background-hdr-skybox--RRRic_K.js.map +1 -0
- package/{background-solid-skybox-fjXlnWaD.js → background-solid-skybox-BrH2fXSu.js} +11 -12
- package/background-solid-skybox-BrH2fXSu.js.map +1 -0
- package/{billboard-renderable-DKmlOgbM.js → billboard-renderable-BHWryAeC.js} +46 -10
- package/billboard-renderable-BHWryAeC.js.map +1 -0
- package/{clamp-block-CxRBPlUq.js → clamp-block-DqbwnQGW.js} +2 -2
- package/{clamp-block-CxRBPlUq.js.map → clamp-block-DqbwnQGW.js.map} +1 -1
- package/{clearcoat-fragment-KbZAa0TA.js → clearcoat-fragment-D6FSCie1.js} +2 -2
- package/{clearcoat-fragment-KbZAa0TA.js.map → clearcoat-fragment-D6FSCie1.js.map} +1 -1
- package/{create-skeleton-BBI5urcj.js → create-skeleton-D_uplboC.js} +9 -9
- package/create-skeleton-D_uplboC.js.map +1 -0
- package/{cubemap-skybox-material-DvW81drX.js → cubemap-skybox-material-DQcMMdf-.js} +6 -7
- package/cubemap-skybox-material-DQcMMdf-.js.map +1 -0
- package/{curve-block-Dh_xdUj-.js → curve-block-21rT0JjG.js} +2 -2
- package/{curve-block-Dh_xdUj-.js.map → curve-block-21rT0JjG.js.map} +1 -1
- package/{emissive-fragment-DD8cvHyx.js → emissive-fragment-C5FtBs3y.js} +3 -3
- package/emissive-fragment-C5FtBs3y.js.map +1 -0
- package/{esm-shadow-view-DYAc62Kl.js → esm-shadow-view-Cl3rPGof.js} +2 -2
- package/{esm-shadow-view-DYAc62Kl.js.map → esm-shadow-view-Cl3rPGof.js.map} +1 -1
- package/{esm-shadow-view-DHVS9r7H.js → esm-shadow-view-Gtd1LWRP.js} +2 -2
- package/{esm-shadow-view-DHVS9r7H.js.map → esm-shadow-view-Gtd1LWRP.js.map} +1 -1
- package/{esm-shadow-view-15S4JK6p.js → esm-shadow-view-c5YV4Eg9.js} +2 -2
- package/{esm-shadow-view-15S4JK6p.js.map → esm-shadow-view-c5YV4Eg9.js.map} +1 -1
- package/{gaussian-splatting-pipeline-sh-BvkUhA9V.js → gaussian-splatting-pipeline-sh-7J31V23x.js} +19 -19
- package/gaussian-splatting-pipeline-sh-7J31V23x.js.map +1 -0
- package/geometry-texture-output-dXk4E9uu.js +41 -0
- package/geometry-texture-output-dXk4E9uu.js.map +1 -0
- package/geometry-view-BsFJpBJa.js +404 -0
- package/geometry-view-BsFJpBJa.js.map +1 -0
- package/{gltf-animation-KnPzeOIY.js → gltf-animation-K_zZxj_d.js} +6 -6
- package/gltf-animation-K_zZxj_d.js.map +1 -0
- package/{gltf-ext-basisu-kmth3UWX.js → gltf-ext-basisu-CDbPclzZ.js} +48 -16
- package/gltf-ext-basisu-CDbPclzZ.js.map +1 -0
- package/{gltf-ext-node-visibility-BjRRd6si.js → gltf-ext-node-visibility-DXCJEYr6.js} +2 -2
- package/{gltf-ext-node-visibility-BjRRd6si.js.map → gltf-ext-node-visibility-DXCJEYr6.js.map} +1 -1
- package/{gltf-ext-quantization-CpZyLDIz.js → gltf-ext-quantization-CvHI_0Vg.js} +4 -3
- package/gltf-ext-quantization-CvHI_0Vg.js.map +1 -0
- package/{gltf-ext-uv-transform-MHmR-YyM.js → gltf-ext-uv-transform-DgYazJBs.js} +2 -2
- package/{gltf-ext-uv-transform-MHmR-YyM.js.map → gltf-ext-uv-transform-DgYazJBs.js.map} +1 -1
- package/{gltf-feature-animation-pointer-rFqLfbO_.js → gltf-feature-animation-pointer-D1RJRFBw.js} +9 -9
- package/gltf-feature-animation-pointer-D1RJRFBw.js.map +1 -0
- package/{gltf-feature-animations-DikONdzi.js → gltf-feature-animations-Cmc1uoIu.js} +2 -2
- package/{gltf-feature-animations-DikONdzi.js.map → gltf-feature-animations-Cmc1uoIu.js.map} +1 -1
- package/{gltf-feature-draco-yGSMGTE3.js → gltf-feature-draco-CKKzT5E3.js} +6 -5
- package/gltf-feature-draco-CKKzT5E3.js.map +1 -0
- package/{gltf-feature-gpu-instancing-Cj1XjmM6.js → gltf-feature-gpu-instancing-n87SO6Vh.js} +4 -4
- package/gltf-feature-gpu-instancing-n87SO6Vh.js.map +1 -0
- package/{gltf-feature-lights-punctual-C-0SlGmD.js → gltf-feature-lights-punctual-Ckm3ciL8.js} +5 -5
- package/{gltf-feature-lights-punctual-C-0SlGmD.js.map → gltf-feature-lights-punctual-Ckm3ciL8.js.map} +1 -1
- package/{gltf-feature-meshopt-Des96YFI.js → gltf-feature-meshopt-DLC4SF1E.js} +7 -6
- package/gltf-feature-meshopt-DLC4SF1E.js.map +1 -0
- package/{gltf-feature-morph-BAcY14XU.js → gltf-feature-morph-Cjtu7hYa.js} +4 -4
- package/gltf-feature-morph-Cjtu7hYa.js.map +1 -0
- package/{gltf-feature-registry-97sY_x5O.js → gltf-feature-registry-C63Hjp9w.js} +15 -15
- package/{gltf-feature-registry-97sY_x5O.js.map → gltf-feature-registry-C63Hjp9w.js.map} +1 -1
- package/{gltf-feature-skeleton-lVjkDfIU.js → gltf-feature-skeleton-DKbOGidp.js} +3 -3
- package/{gltf-feature-skeleton-lVjkDfIU.js.map → gltf-feature-skeleton-DKbOGidp.js.map} +1 -1
- package/{gltf-feature-variants-BphF4JmV.js → gltf-feature-variants-Cmzu0O0e.js} +2 -2
- package/{gltf-feature-variants-BphF4JmV.js.map → gltf-feature-variants-Cmzu0O0e.js.map} +1 -1
- package/{gltf-glb-parser-D6UZWFuC.js → gltf-glb-parser-Cj5MHS-v.js} +5 -4
- package/gltf-glb-parser-Cj5MHS-v.js.map +1 -0
- package/{gltf-interleave-C9eBqH_F.js → gltf-interleave-gHf9_t0i.js} +14 -14
- package/gltf-interleave-gHf9_t0i.js.map +1 -0
- package/{gltf-pbr-builder-ext-DPC0zg_u.js → gltf-pbr-builder-ext-edNcjwPf.js} +5 -5
- package/gltf-pbr-builder-ext-edNcjwPf.js.map +1 -0
- package/{gltf-variants-CnBEZr0o.js → gltf-variants-CPxNdtP4.js} +4 -4
- package/{gltf-variants-CnBEZr0o.js.map → gltf-variants-CPxNdtP4.js.map} +1 -1
- package/{gs-picking-pipeline-Bx8LTav6.js → gs-picking-pipeline-DYaW_Lg3.js} +14 -14
- package/gs-picking-pipeline-DYaW_Lg3.js.map +1 -0
- package/havok-floating-origin-Dr-18Nds.js +198 -0
- package/havok-floating-origin-Dr-18Nds.js.map +1 -0
- package/index-CLElg2Bo.js +39209 -0
- package/index-CLElg2Bo.js.map +1 -0
- package/index-CYZDclhF.js +918 -0
- package/index-CYZDclhF.js.map +1 -0
- package/index-SMJ67XwT.js +3330 -0
- package/index-SMJ67XwT.js.map +1 -0
- package/index.d.ts +2007 -105
- package/index.js +446 -322
- package/{input-block-Coi_aZwl.js → input-block-DqEedWF2.js} +2 -2
- package/{input-block-Coi_aZwl.js.map → input-block-DqEedWF2.js.map} +1 -1
- package/{iridescence-fragment-DwZcCTdD.js → iridescence-fragment-BHU59-gQ.js} +2 -2
- package/{iridescence-fragment-DwZcCTdD.js.map → iridescence-fragment-BHU59-gQ.js.map} +1 -1
- package/{light-block-Np_h5gPI.js → light-block-Bv37V8vl.js} +2 -2
- package/{light-block-Np_h5gPI.js.map → light-block-Bv37V8vl.js.map} +1 -1
- package/{loop-block-BFkLFYGm.js → loop-block-qTg8vb99.js} +2 -2
- package/{loop-block-BFkLFYGm.js.map → loop-block-qTg8vb99.js.map} +1 -1
- package/{morph-fragment-DqH-w61u.js → morph-fragment-BRCUr2wQ.js} +2 -2
- package/{morph-fragment-DqH-w61u.js.map → morph-fragment-BRCUr2wQ.js.map} +1 -1
- package/{multilight-wgsl-B9Mf9d-q.js → multilight-wgsl-DMeppAdZ.js} +2 -2
- package/{multilight-wgsl-B9Mf9d-q.js.map → multilight-wgsl-DMeppAdZ.js.map} +1 -1
- package/{node-env-BPZXZzBf.js → node-env-Bc559GmY.js} +6 -5
- package/node-env-Bc559GmY.js.map +1 -0
- package/node-geometry-view-COmWsRXK.js +291 -0
- package/node-geometry-view-COmWsRXK.js.map +1 -0
- package/{node-registry-extra-compat-Ch7ApZHF.js → node-registry-extra-compat-dWrv7gpS.js} +2 -2
- package/{node-registry-extra-compat-Ch7ApZHF.js.map → node-registry-extra-compat-dWrv7gpS.js.map} +1 -1
- package/{node-registry-extra-math-6ezzTkPj.js → node-registry-extra-math-Bn854sX9.js} +2 -2
- package/{node-registry-extra-math-6ezzTkPj.js.map → node-registry-extra-math-Bn854sX9.js.map} +1 -1
- package/{node-renderable-CS0CmsSp.js → node-renderable-B5G8WcdH.js} +15 -13
- package/node-renderable-B5G8WcdH.js.map +1 -0
- package/{node-shadow-CpnrdvtJ.js → node-shadow-CVIUlNf0.js} +7 -7
- package/node-shadow-CVIUlNf0.js.map +1 -0
- package/{normal-map-fragment-DradEMl-.js → normal-map-fragment-CQSxhjCy.js} +2 -2
- package/{normal-map-fragment-DradEMl-.js.map → normal-map-fragment-CQSxhjCy.js.map} +1 -1
- package/package.json +3 -10
- package/{parse-camera-CgV4bWc0.js → parse-camera-pBRT_6i5.js} +2 -2
- package/{parse-camera-CgV4bWc0.js.map → parse-camera-pBRT_6i5.js.map} +1 -1
- package/pbr-geometry-view-NiZY_juX.js +491 -0
- package/pbr-geometry-view-NiZY_juX.js.map +1 -0
- package/{pbr-metallic-roughness-block-BFwZj2Nw.js → pbr-metallic-roughness-block-JBSi-tQN.js} +2 -2
- package/{pbr-metallic-roughness-block-BFwZj2Nw.js.map → pbr-metallic-roughness-block-JBSi-tQN.js.map} +1 -1
- package/{pbr-metallic-roughness-block-full-5t0HT3xl.js → pbr-metallic-roughness-block-full-Ta9lR2cz.js} +2 -2
- package/{pbr-metallic-roughness-block-full-5t0HT3xl.js.map → pbr-metallic-roughness-block-full-Ta9lR2cz.js.map} +1 -1
- package/{pbr-mr-helper-core-R5tOZ8Ap.js → pbr-mr-helper-core-BVWNR08D.js} +2 -2
- package/{pbr-mr-helper-core-R5tOZ8Ap.js.map → pbr-mr-helper-core-BVWNR08D.js.map} +1 -1
- package/{pbr-refraction-Dd11HnaI.js → pbr-refraction-C9FvFmAp.js} +2 -2
- package/{pbr-refraction-Dd11HnaI.js.map → pbr-refraction-C9FvFmAp.js.map} +1 -1
- package/{pbr-renderable-BHAdF5Vw.js → pbr-renderable-DzUF2QIk.js} +60 -42
- package/pbr-renderable-DzUF2QIk.js.map +1 -0
- package/{pbr-shadow-fragment-BxUrFJYZ.js → pbr-shadow-fragment-CnqnbGYS.js} +2 -2
- package/{pbr-shadow-fragment-BxUrFJYZ.js.map → pbr-shadow-fragment-CnqnbGYS.js.map} +1 -1
- package/{pbr-tracking-D6i3yPb7.js → pbr-tracking-3tU1kqea.js} +2 -2
- package/{pbr-tracking-D6i3yPb7.js.map → pbr-tracking-3tU1kqea.js.map} +1 -1
- package/{pbr-transmission-ext-Dll8EYwE.js → pbr-transmission-ext-BcLjRxfB.js} +2 -2
- package/{pbr-transmission-ext-Dll8EYwE.js.map → pbr-transmission-ext-BcLjRxfB.js.map} +1 -1
- package/recast-navigation.wasm-DG_0AFuk.js +8706 -0
- package/recast-navigation.wasm-DG_0AFuk.js.map +1 -0
- package/recast-navigation.wasm-compat-C-Bf2ylB.js +8692 -0
- package/recast-navigation.wasm-compat-C-Bf2ylB.js.map +1 -0
- package/{reflectance-fragment-ejMJ4O1o.js → reflectance-fragment-Dbpgw3Jt.js} +2 -2
- package/{reflectance-fragment-ejMJ4O1o.js.map → reflectance-fragment-Dbpgw3Jt.js.map} +1 -1
- package/{rgbd-decode-DCvzUYeI.js → rgbd-decode-DoyUquy3.js} +7 -6
- package/rgbd-decode-DoyUquy3.js.map +1 -0
- package/{scene-material-swap-C2ykv55W.js → scene-material-swap-nNUH4nGn.js} +11 -4
- package/scene-material-swap-nNUH4nGn.js.map +1 -0
- package/screenshot-readback-D0Sj9qq3.js +92 -0
- package/screenshot-readback-D0Sj9qq3.js.map +1 -0
- package/{mesh-features-BAJpbMog.js → shader-composer-BUD_pSX4.js} +3 -54
- package/shader-composer-BUD_pSX4.js.map +1 -0
- package/{shader-renderable-BMf_vvO0.js → shader-renderable-D7-RyVxa.js} +25 -19
- package/shader-renderable-D7-RyVxa.js.map +1 -0
- package/{shader-thin-instance-5_WUfi3m.js → shader-thin-instance-DuBotxDO.js} +4 -4
- package/shader-thin-instance-DuBotxDO.js.map +1 -0
- package/{sheen-fragment-CS6z29Fs.js → sheen-fragment-1MkEMcbc.js} +2 -2
- package/{sheen-fragment-CS6z29Fs.js.map → sheen-fragment-1MkEMcbc.js.map} +1 -1
- package/{singlelight-directional-wgsl-4MIgZMeC.js → singlelight-directional-wgsl-BsV8G456.js} +2 -2
- package/{singlelight-directional-wgsl-4MIgZMeC.js.map → singlelight-directional-wgsl-BsV8G456.js.map} +1 -1
- package/{singlelight-hemispheric-wgsl-CK-GUYWe.js → singlelight-hemispheric-wgsl-Bo0jKlW5.js} +2 -2
- package/{singlelight-hemispheric-wgsl-CK-GUYWe.js.map → singlelight-hemispheric-wgsl-Bo0jKlW5.js.map} +1 -1
- package/{singlelight-point-wgsl-CYtzqCbP.js → singlelight-point-wgsl-DV39UP5Y.js} +2 -2
- package/{singlelight-point-wgsl-CYtzqCbP.js.map → singlelight-point-wgsl-DV39UP5Y.js.map} +1 -1
- package/{singlelight-spot-wgsl-DVbaVufF.js → singlelight-spot-wgsl-yg3od6vL.js} +2 -2
- package/{singlelight-spot-wgsl-DVbaVufF.js.map → singlelight-spot-wgsl-yg3od6vL.js.map} +1 -1
- package/{skeleton-fragment-BOVmc8YS.js → skeleton-fragment-DdxYG6kv.js} +2 -2
- package/{skeleton-fragment-BOVmc8YS.js.map → skeleton-fragment-DdxYG6kv.js.map} +1 -1
- package/{skybox-renderable-DDcCPSly.js → skybox-renderable-CJD4XmX5.js} +7 -8
- package/skybox-renderable-CJD4XmX5.js.map +1 -0
- package/{splat-ply-compressed-BahdBG1r.js → splat-ply-compressed-DHjyiVmI.js} +9 -8
- package/splat-ply-compressed-DHjyiVmI.js.map +1 -0
- package/{standard-renderable-D1bhoF0K.js → standard-pipeline-XTbHL7MY.js} +11 -202
- package/standard-pipeline-XTbHL7MY.js.map +1 -0
- package/standard-renderable-CREWLNHI.js +191 -0
- package/standard-renderable-CREWLNHI.js.map +1 -0
- package/{std-ambient-fragment-C6WNm8dQ.js → std-ambient-fragment-Bjx3VFrr.js} +2 -2
- package/{std-ambient-fragment-C6WNm8dQ.js.map → std-ambient-fragment-Bjx3VFrr.js.map} +1 -1
- package/{std-cube-reflection-fragment-Bqutpy2q.js → std-cube-reflection-fragment-y9WWdXUt.js} +2 -2
- package/{std-cube-reflection-fragment-Bqutpy2q.js.map → std-cube-reflection-fragment-y9WWdXUt.js.map} +1 -1
- package/{std-emissive-fragment-B-A83rqX.js → std-emissive-fragment-C8Lnmojh.js} +2 -2
- package/{std-emissive-fragment-B-A83rqX.js.map → std-emissive-fragment-C8Lnmojh.js.map} +1 -1
- package/{std-lightmap-fragment-Df7KJezh.js → std-lightmap-fragment-DFxGcoA5.js} +2 -2
- package/{std-lightmap-fragment-Df7KJezh.js.map → std-lightmap-fragment-DFxGcoA5.js.map} +1 -1
- package/{std-opacity-fragment-D9et2jip.js → std-opacity-fragment-EXzFWiSp.js} +2 -2
- package/{std-opacity-fragment-D9et2jip.js.map → std-opacity-fragment-EXzFWiSp.js.map} +1 -1
- package/{std-reflection-fragment-DBJeT-yg.js → std-reflection-fragment-BoJORqpG.js} +2 -2
- package/{std-reflection-fragment-DBJeT-yg.js.map → std-reflection-fragment-BoJORqpG.js.map} +1 -1
- package/{std-shadow-fragment-C6fD8rW-.js → std-shadow-fragment-Bq-Wc8UJ.js} +2 -2
- package/{std-shadow-fragment-C6fD8rW-.js.map → std-shadow-fragment-Bq-Wc8UJ.js.map} +1 -1
- package/{std-specular-fragment-C2ZOss-t.js → std-specular-fragment-CM5R5j2g.js} +2 -2
- package/{std-specular-fragment-C2ZOss-t.js.map → std-specular-fragment-CM5R5j2g.js.map} +1 -1
- package/{std-tracking-C4L4nQGc.js → std-tracking-Cif_wXeT.js} +2 -2
- package/{std-tracking-C4L4nQGc.js.map → std-tracking-Cif_wXeT.js.map} +1 -1
- package/{subsurface-fragment-C1H4ytqK.js → subsurface-fragment-BEaAXYXz.js} +2 -2
- package/{subsurface-fragment-C1H4ytqK.js.map → subsurface-fragment-BEaAXYXz.js.map} +1 -1
- package/swapchain-overlay-UCLilhbq.js +37 -0
- package/swapchain-overlay-UCLilhbq.js.map +1 -0
- package/{thin-instance-cull-binding-CCxrPNO6.js → thin-instance-cull-binding-DWKUt5ZN.js} +12 -12
- package/thin-instance-cull-binding-DWKUt5ZN.js.map +1 -0
- package/{thin-instance-gpu-E8DBd8XL.js → thin-instance-gpu-BDdRcNAh.js} +15 -7
- package/thin-instance-gpu-BDdRcNAh.js.map +1 -0
- package/{tracking-primitives-w4BVV9p9.js → tracking-primitives-CglRNTlX.js} +2 -2
- package/{tracking-primitives-w4BVV9p9.js.map → tracking-primitives-CglRNTlX.js.map} +1 -1
- package/{unlit-fragment-DU9_mhzZ.js → unlit-fragment-kxfZWlnp.js} +2 -2
- package/{unlit-fragment-DU9_mhzZ.js.map → unlit-fragment-kxfZWlnp.js.map} +1 -1
- package/_mat4-storage-f64-Bvh5TymE.js.map +0 -1
- package/assets/splat-sort-worker-Crg3CaCc.js.map +0 -1
- package/background-dds-skybox-ZjrSIxrT.js.map +0 -1
- package/background-ground-B2Mie-MI.js.map +0 -1
- package/background-hdr-skybox-DDRJYuT2.js.map +0 -1
- package/background-solid-skybox-fjXlnWaD.js.map +0 -1
- package/billboard-renderable-DKmlOgbM.js.map +0 -1
- package/create-skeleton-BBI5urcj.js.map +0 -1
- package/cubemap-skybox-material-DvW81drX.js.map +0 -1
- package/emissive-fragment-DD8cvHyx.js.map +0 -1
- package/gaussian-splatting-pipeline-sh-BvkUhA9V.js.map +0 -1
- package/gltf-animation-KnPzeOIY.js.map +0 -1
- package/gltf-ext-basisu-kmth3UWX.js.map +0 -1
- package/gltf-ext-quantization-CpZyLDIz.js.map +0 -1
- package/gltf-feature-animation-pointer-rFqLfbO_.js.map +0 -1
- package/gltf-feature-draco-yGSMGTE3.js.map +0 -1
- package/gltf-feature-gpu-instancing-Cj1XjmM6.js.map +0 -1
- package/gltf-feature-meshopt-Des96YFI.js.map +0 -1
- package/gltf-feature-morph-BAcY14XU.js.map +0 -1
- package/gltf-glb-parser-D6UZWFuC.js.map +0 -1
- package/gltf-interleave-C9eBqH_F.js.map +0 -1
- package/gltf-pbr-builder-ext-DPC0zg_u.js.map +0 -1
- package/gs-picking-pipeline-Bx8LTav6.js.map +0 -1
- package/index-B7Qhw0xL.js +0 -21232
- package/index-B7Qhw0xL.js.map +0 -1
- package/mesh-features-BAJpbMog.js.map +0 -1
- package/no-color-view-DsyLSL-W.js +0 -8
- package/no-color-view-DsyLSL-W.js.map +0 -1
- package/node-env-BPZXZzBf.js.map +0 -1
- package/node-registry-Bd-AlrgC.js +0 -190
- package/node-registry-Bd-AlrgC.js.map +0 -1
- package/node-renderable-CS0CmsSp.js.map +0 -1
- package/node-shadow-CpnrdvtJ.js.map +0 -1
- package/pbr-renderable-BHAdF5Vw.js.map +0 -1
- package/rgbd-decode-DCvzUYeI.js.map +0 -1
- package/scene-material-swap-C2ykv55W.js.map +0 -1
- package/shader-renderable-BMf_vvO0.js.map +0 -1
- package/shader-thin-instance-5_WUfi3m.js.map +0 -1
- package/skybox-renderable-DDcCPSly.js.map +0 -1
- package/splat-ply-compressed-BahdBG1r.js.map +0 -1
- package/standard-renderable-D1bhoF0K.js.map +0 -1
- package/swapchain-overlay-DcCSFDp7.js +0 -35
- package/swapchain-overlay-DcCSFDp7.js.map +0 -1
- package/thin-instance-cull-binding-CCxrPNO6.js.map +0 -1
- package/thin-instance-gpu-E8DBd8XL.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const feature = {
|
|
2
2
|
id: "_animations",
|
|
3
3
|
async applyAsset(meshes, _root, ctx) {
|
|
4
|
-
const [{ parseAnimationData }, { createAnimationGroups }] = await Promise.all([import("./gltf-animation-
|
|
4
|
+
const [{ parseAnimationData }, { createAnimationGroups }] = await Promise.all([import("./gltf-animation-K_zZxj_d.js"), import("./index-CLElg2Bo.js").then((n) => n.j5)]);
|
|
5
5
|
const animData = parseAnimationData(ctx._json, ctx._binChunk, meshes, ctx._parentMap, ctx._worldMatrixCache, ctx._nodeMap);
|
|
6
6
|
if (!animData) {
|
|
7
7
|
return {};
|
|
@@ -12,4 +12,4 @@ const feature = {
|
|
|
12
12
|
export {
|
|
13
13
|
feature as default
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=gltf-feature-animations-
|
|
15
|
+
//# sourceMappingURL=gltf-feature-animations-Cmc1uoIu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-animations-
|
|
1
|
+
{"version":3,"file":"gltf-feature-animations-Cmc1uoIu.js","sources":["../src/loader-gltf/gltf-feature-animations.ts"],"sourcesContent":["/** glTF animation feature.\n * Triggered when the asset has any animations. Per-asset hook parses clips,\n * binds them to the uploaded meshes, and returns AnimationGroups. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\n\nconst feature: GltfFeature = {\n id: \"_animations\",\n async applyAsset(meshes, _root, ctx) {\n const [{ parseAnimationData }, { createAnimationGroups }] = await Promise.all([import(\"./gltf-animation.js\"), import(\"../animation/animation-group.js\")]);\n const animData = parseAnimationData(ctx._json, ctx._binChunk, meshes, ctx._parentMap, ctx._worldMatrixCache, ctx._nodeMap);\n if (!animData) {\n return {};\n }\n return { animationGroups: createAnimationGroups(animData) };\n },\n};\nexport default feature;\n"],"names":[],"mappings":"AAMA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,WAAW,QAAQ,OAAO,KAAK;AACjC,UAAM,CAAC,EAAE,mBAAA,GAAsB,EAAE,sBAAA,CAAuB,IAAI,MAAM,QAAQ,IAAI,CAAC,OAAO,8BAAqB,GAAG,OAAO,qBAAiC,EAAA,KAAA,OAAA,EAAA,EAAA,CAAC,CAAC;AACxJ,UAAM,WAAW,mBAAmB,IAAI,OAAO,IAAI,WAAW,QAAQ,IAAI,YAAY,IAAI,mBAAmB,IAAI,QAAQ;AACzH,QAAI,CAAC,UAAU;AACX,aAAO,CAAA;AAAA,IACX;AACA,WAAO,EAAE,iBAAiB,sBAAsB,QAAQ,EAAA;AAAA,EAC5D;AACJ;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { e as U8, U as U32, bQ as I32, a as F32 } from "./index-CLElg2Bo.js";
|
|
1
2
|
let dracoBaseUrl = "/";
|
|
2
3
|
let modulePromise = null;
|
|
3
4
|
let scriptLoadPromise = null;
|
|
@@ -56,7 +57,7 @@ async function decodeDracoPrimitive(compressed, attributeMap, accessorTypes) {
|
|
|
56
57
|
const indexByteLength = indexCount * 4;
|
|
57
58
|
const indexPtr = module._malloc(indexByteLength);
|
|
58
59
|
decoder.GetTrianglesUInt32Array(mesh, indexByteLength, indexPtr);
|
|
59
|
-
const indices = new
|
|
60
|
+
const indices = new U32(module.HEAPU32.buffer, indexPtr, indexCount).slice();
|
|
60
61
|
module._free(indexPtr);
|
|
61
62
|
const attributes = /* @__PURE__ */ new Map();
|
|
62
63
|
for (const name of Object.keys(attributeMap)) {
|
|
@@ -71,9 +72,9 @@ async function decodeDracoPrimitive(compressed, attributeMap, accessorTypes) {
|
|
|
71
72
|
const dataType = isIntAttr ? module.DT_INT32 : module.DT_FLOAT32;
|
|
72
73
|
decoder.GetAttributeDataArrayForAllPoints(mesh, attr, dataType, byteLength, ptr);
|
|
73
74
|
if (isIntAttr) {
|
|
74
|
-
attributes.set(name, new
|
|
75
|
+
attributes.set(name, new I32(module.HEAP32.buffer, ptr, totalComponents).slice());
|
|
75
76
|
} else {
|
|
76
|
-
attributes.set(name, new
|
|
77
|
+
attributes.set(name, new F32(module.HEAPF32.buffer, ptr, totalComponents).slice());
|
|
77
78
|
}
|
|
78
79
|
module._free(ptr);
|
|
79
80
|
}
|
|
@@ -88,7 +89,7 @@ function getDracoBufferViewBytes(json, binChunk, bufferViewIdx) {
|
|
|
88
89
|
throw new Error(`Draco bufferView ${bufferViewIdx} not found`);
|
|
89
90
|
}
|
|
90
91
|
const offset = binChunk.byteOffset + (view.byteOffset ?? 0);
|
|
91
|
-
return new
|
|
92
|
+
return new U8(binChunk.buffer, offset, view.byteLength);
|
|
92
93
|
}
|
|
93
94
|
const TYPE_COMPONENT_COUNTS = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 };
|
|
94
95
|
const feature = {
|
|
@@ -121,4 +122,4 @@ const feature = {
|
|
|
121
122
|
export {
|
|
122
123
|
feature as default
|
|
123
124
|
};
|
|
124
|
-
//# sourceMappingURL=gltf-feature-draco-
|
|
125
|
+
//# sourceMappingURL=gltf-feature-draco-CKKzT5E3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-draco-CKKzT5E3.js","sources":["../src/loader-gltf/draco-decode.ts","../src/loader-gltf/gltf-feature-draco.ts"],"sourcesContent":["/**\n * Lazy KHR_draco_mesh_compression decoder.\n *\n * The Draco decoder (JS glue + WASM) is loaded from `/draco_decoder.js` and\n * `/draco_decoder.wasm` on first use via a `<script>` injection. This keeps\n * bundle size at zero bytes for scenes that do not load Draco-compressed\n * glTF assets — the entire module (including this file) is dynamically\n * imported from extractAllMeshes only when a primitive carries\n * `KHR_draco_mesh_compression`.\n *\n * The decoder output is always 32-bit: Float32 for FLOAT accessors,\n * Uint32Array for indices. Vertex attributes match glTF accessor types\n * (POSITION/NORMAL/TANGENT=VEC3, TEXCOORD_0=VEC2, ...).\n */\n\nimport { F32, U32, I32, U8 } from \"../engine/typed-arrays.js\";\nimport type { DecodedPrimitive } from \"./gltf-feature.js\";\n\n// Public base URL where the decoder JS + WASM are hosted. Defaults to site root.\nlet dracoBaseUrl = \"/\";\n\n/** Override the base URL where draco_decoder.js and draco_decoder.wasm are hosted. */\nexport function setDracoBaseUrl(url: string): void {\n dracoBaseUrl = url.endsWith(\"/\") ? url : url + \"/\";\n}\n\ninterface DracoModule {\n Decoder: new () => {\n DecodeBufferToMesh(buffer: unknown, mesh: unknown): { ok(): boolean; error_msg(): string };\n GetTrianglesUInt32Array(mesh: unknown, byteLength: number, outPtr: number): void;\n GetAttributeByUniqueId(mesh: unknown, uniqueId: number): unknown;\n GetAttributeDataArrayForAllPoints(mesh: unknown, attr: unknown, dataType: number, byteLength: number, outPtr: number): boolean;\n };\n DecoderBuffer: new () => { Init(data: Uint8Array, size: number): void };\n Mesh: new () => { num_faces(): number; num_points(): number };\n destroy(obj: unknown): void;\n HEAPF32: Float32Array;\n HEAPU32: Uint32Array;\n HEAP32: Int32Array;\n DT_FLOAT32: number;\n DT_INT32: number;\n _malloc(size: number): number;\n _free(ptr: number): void;\n}\n\ntype DracoFactory = (cfg: { locateFile?: (file: string) => string }) => Promise<DracoModule>;\n\nlet modulePromise: Promise<DracoModule> | null = null;\nlet scriptLoadPromise: Promise<DracoFactory> | null = null;\n\nfunction loadDracoScript(): Promise<DracoFactory> {\n if (scriptLoadPromise) {\n return scriptLoadPromise;\n }\n scriptLoadPromise = new Promise<DracoFactory>((resolve, reject) => {\n const existing = (globalThis as { DracoDecoderModule?: DracoFactory }).DracoDecoderModule;\n if (existing) {\n resolve(existing);\n return;\n }\n const script = document.createElement(\"script\");\n script.src = dracoBaseUrl + \"draco_decoder.js\";\n script.onload = () => {\n const factory = (globalThis as { DracoDecoderModule?: DracoFactory }).DracoDecoderModule;\n if (!factory) {\n reject(new Error(\"draco_decoder.js loaded but DracoDecoderModule is undefined\"));\n } else {\n resolve(factory);\n }\n };\n script.onerror = () => reject(new Error(\"Failed to load draco_decoder.js from \" + script.src));\n document.head.appendChild(script);\n });\n return scriptLoadPromise;\n}\n\nasync function getDracoModule(): Promise<DracoModule> {\n if (modulePromise) {\n return modulePromise;\n }\n modulePromise = (async () => {\n const factory = await loadDracoScript();\n return factory({ locateFile: (f: string) => dracoBaseUrl + f });\n })();\n return modulePromise;\n}\n\n/**\n * Decode a KHR_draco_mesh_compression primitive.\n * @param compressed - The raw bytes of the bufferView referenced by the extension.\n * @param attributeMap - Map of glTF attribute name (POSITION, NORMAL, ...) to Draco unique id.\n * @param accessorTypes - Map of glTF attribute name to component count (3 for VEC3, 2 for VEC2, 4 for VEC4).\n */\nexport async function decodeDracoPrimitive(compressed: Uint8Array, attributeMap: Record<string, number>, accessorTypes: Record<string, number>): Promise<DecodedPrimitive> {\n const module = await getDracoModule();\n const decoder = new module.Decoder();\n const buffer = new module.DecoderBuffer();\n buffer.Init(compressed, compressed.byteLength);\n const mesh = new module.Mesh();\n const status = decoder.DecodeBufferToMesh(buffer, mesh);\n if (!status.ok()) {\n const err = status.error_msg();\n module.destroy(buffer);\n module.destroy(mesh);\n module.destroy(decoder);\n throw new Error(\"Draco decode failed: \" + err);\n }\n\n const numPoints = mesh.num_points();\n const numFaces = mesh.num_faces();\n const indexCount = numFaces * 3;\n\n // Indices: Draco returns Uint32 triangles. Always slice() off the heap\n // view because module._malloc may grow the WASM memory and invalidate\n // the typed-array views we already hold.\n const indexByteLength = indexCount * 4;\n const indexPtr = module._malloc(indexByteLength);\n decoder.GetTrianglesUInt32Array(mesh, indexByteLength, indexPtr);\n const indices = new U32(module.HEAPU32.buffer, indexPtr, indexCount).slice();\n module._free(indexPtr);\n\n const attributes = new Map<string, Float32Array | Uint32Array | Int32Array>();\n for (const name of Object.keys(attributeMap)) {\n const uniqueId = attributeMap[name]!;\n const attr = decoder.GetAttributeByUniqueId(mesh, uniqueId);\n const componentCount = accessorTypes[name] ?? 3;\n const totalComponents = numPoints * componentCount;\n const isIntAttr = name === \"JOINTS_0\" || name === \"JOINTS_1\";\n const bytesPerElement = 4;\n const byteLength = totalComponents * bytesPerElement;\n const ptr = module._malloc(byteLength);\n const dataType = isIntAttr ? module.DT_INT32 : module.DT_FLOAT32;\n decoder.GetAttributeDataArrayForAllPoints(mesh, attr, dataType, byteLength, ptr);\n // Re-read the HEAP view AFTER malloc/decode — the underlying buffer\n // may have been reallocated during decoding.\n if (isIntAttr) {\n attributes.set(name, new I32(module.HEAP32.buffer, ptr, totalComponents).slice());\n } else {\n attributes.set(name, new F32(module.HEAPF32.buffer, ptr, totalComponents).slice());\n }\n module._free(ptr);\n }\n\n module.destroy(buffer);\n module.destroy(mesh);\n module.destroy(decoder);\n\n return { _attributes: attributes, _indices: indices, _vertexCount: numPoints, _indexCount: indexCount };\n}\n\n/**\n * Read the bufferView slice referenced by the Draco extension into a Uint8Array.\n */\nexport function getDracoBufferViewBytes(json: { bufferViews: Array<{ byteOffset?: number; byteLength: number }> }, binChunk: DataView, bufferViewIdx: number): Uint8Array {\n const view = json.bufferViews[bufferViewIdx];\n if (!view) {\n throw new Error(`Draco bufferView ${bufferViewIdx} not found`);\n }\n const offset = binChunk.byteOffset + (view.byteOffset ?? 0);\n return new U8(binChunk.buffer, offset, view.byteLength);\n}\n","/**\n * KHR_draco_mesh_compression feature.\n *\n * Runs as a `preMesh` hook — before mesh extraction — so the core loader\n * stays unaware of Draco. This module is only dynamic-imported when the\n * asset's `extensionsUsed` lists KHR_draco_mesh_compression, which in turn\n * dynamic-imports the actual Emscripten-based decoder (`draco-decode.ts`).\n */\n\nimport type { DecodedPrimitive, GltfFeature } from \"./gltf-feature.js\";\nimport { decodeDracoPrimitive, getDracoBufferViewBytes } from \"./draco-decode.js\";\n\nconst TYPE_COMPONENT_COUNTS: Record<string, number> = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 };\n\nconst feature: GltfFeature = {\n id: \"KHR_draco_mesh_compression\",\n async preMesh(jsonIn, binChunk) {\n const json = jsonIn as {\n meshes?: Array<{\n primitives?: Array<{ attributes?: Record<string, number>; extensions?: Record<string, { bufferView: number; attributes: Record<string, number> }> }>;\n }>;\n accessors?: Array<{ type: string }>;\n };\n const out = new Map<unknown, DecodedPrimitive>();\n for (const mesh of json.meshes ?? []) {\n for (const primitive of mesh.primitives ?? []) {\n const ext = primitive.extensions?.KHR_draco_mesh_compression;\n if (!ext) {\n continue;\n }\n const bytes = getDracoBufferViewBytes(json as { bufferViews: Array<{ byteOffset?: number; byteLength: number }> }, binChunk, ext.bufferView);\n const accessorTypes: Record<string, number> = {};\n for (const name of Object.keys(ext.attributes)) {\n const accIdx = primitive.attributes?.[name];\n if (accIdx !== undefined && json.accessors?.[accIdx]) {\n accessorTypes[name] = TYPE_COMPONENT_COUNTS[json.accessors[accIdx].type] ?? 3;\n }\n }\n const decoded = await decodeDracoPrimitive(bytes, ext.attributes, accessorTypes);\n out.set(primitive, decoded);\n }\n }\n return out;\n },\n};\n\nexport default feature;\n"],"names":[],"mappings":";AAmBA,IAAI,eAAe;AA4BnB,IAAI,gBAA6C;AACjD,IAAI,oBAAkD;AAEtD,SAAS,kBAAyC;AAC9C,MAAI,mBAAmB;AACnB,WAAO;AAAA,EACX;AACA,sBAAoB,IAAI,QAAsB,CAAC,SAAS,WAAW;AAC/D,UAAM,WAAY,WAAqD;AACvE,QAAI,UAAU;AACV,cAAQ,QAAQ;AAChB;AAAA,IACJ;AACA,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AAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAA;AAEtH,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,QAAQ,QAAQ,UAAU;;AAC5B,UAAM,OAAO;AAMb,UAAM,0BAAU,IAAA;AAChB,eAAW,QAAQ,KAAK,UAAU,CAAA,GAAI;AAClC,iBAAW,aAAa,KAAK,cAAc,CAAA,GAAI;AAC3C,cAAM,OAAM,eAAU,eAAV,mBAAsB;AAClC,YAAI,CAAC,KAAK;AACN;AAAA,QACJ;AACA,cAAM,QAAQ,wBAAwB,MAA6E,UAAU,IAAI,UAAU;AAC3I,cAAM,gBAAwC,CAAA;AAC9C,mBAAW,QAAQ,OAAO,KAAK,IAAI,UAAU,GAAG;AAC5C,gBAAM,UAAS,eAAU,eAAV,mBAAuB;AACtC,cAAI,WAAW,YAAa,UAAK,cAAL,mBAAiB,UAAS;AAClD,0BAAc,IAAI,IAAI,sBAAsB,KAAK,UAAU,MAAM,EAAE,IAAI,KAAK;AAAA,UAChF;AAAA,QACJ;AACA,cAAM,UAAU,MAAM,qBAAqB,OAAO,IAAI,YAAY,aAAa;AAC/E,YAAI,IAAI,WAAW,OAAO;AAAA,MAC9B;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveAccessor,
|
|
1
|
+
import { r as resolveAccessor, bm as setThinInstances, bn as mat4ComposeInto, a as F32, g as computeAabb, bo as getLoaderTmpInstance, bp as mat4Multiply } from "./index-CLElg2Bo.js";
|
|
2
2
|
function collectMeshesUnderNode(tn) {
|
|
3
3
|
const out = [];
|
|
4
4
|
for (const c of (tn == null ? void 0 : tn.children) ?? []) {
|
|
@@ -9,7 +9,7 @@ function collectMeshesUnderNode(tn) {
|
|
|
9
9
|
return out;
|
|
10
10
|
}
|
|
11
11
|
function buildInstanceMatrices(translation, rotation, scale, count) {
|
|
12
|
-
const matrices = new
|
|
12
|
+
const matrices = new F32(count * 16);
|
|
13
13
|
for (let i = 0; i < count; i++) {
|
|
14
14
|
const tx = translation ? translation[i * 3] : 0;
|
|
15
15
|
const ty = translation ? translation[i * 3 + 1] : 0;
|
|
@@ -88,7 +88,7 @@ function expandMeshAabbForInstances(mesh, matrices, count, nodeWorld) {
|
|
|
88
88
|
if (!isFinite(lmin[0])) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
-
const corners = new
|
|
91
|
+
const corners = new F32([
|
|
92
92
|
lmin[0],
|
|
93
93
|
lmin[1],
|
|
94
94
|
lmin[2],
|
|
@@ -149,4 +149,4 @@ function expandMeshAabbForInstances(mesh, matrices, count, nodeWorld) {
|
|
|
149
149
|
export {
|
|
150
150
|
ext as default
|
|
151
151
|
};
|
|
152
|
-
//# sourceMappingURL=gltf-feature-gpu-instancing-
|
|
152
|
+
//# sourceMappingURL=gltf-feature-gpu-instancing-n87SO6Vh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-gpu-instancing-n87SO6Vh.js","sources":["../src/loader-gltf/gltf-feature-gpu-instancing.ts"],"sourcesContent":["/** glTF EXT_mesh_gpu_instancing extension.\n *\n * Attaches hardware-instanced thin instances to every mesh that belongs to a\n * node carrying `extensions.EXT_mesh_gpu_instancing`. The extension provides\n * per-instance TRANSLATION / ROTATION / SCALE accessors (all optional); each\n * instance matrix is composed as T·R·S in the node's local frame. The node's\n * own TRS is applied through the regular parent-chain world matrix at render\n * time (`finalWorld = mesh.world * instanceWorld` in thin-instance-fragment),\n * so instance matrices must NOT pre-multiply the node transform.\n *\n * Dynamically imported by load-gltf only when the asset declares the\n * extension in `extensionsUsed`, so bundles pay zero bytes otherwise.\n *\n * Spec: https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md\n */\n\nimport { F32 } from \"../engine/typed-arrays.js\";\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport type { Mesh } from \"../mesh/mesh.js\";\nimport { resolveAccessor } from \"./gltf-parser.js\";\nimport { computeAabb } from \"../math/compute-aabb.js\";\nimport { mat4ComposeInto } from \"../math/mat4-compose-into.js\";\nimport { mat4Multiply } from \"../math/mat4-multiply.js\";\nimport type { Mat4 } from \"../math/types.js\";\nimport type { Mat4Storage } from \"../math/types.js\";\nimport { setThinInstances } from \"../mesh/thin-instance.js\";\nimport { getLoaderTmpInstance } from \"./_loader-scratch.js\";\n\n/** Collect every Mesh child (direct children only — matches buildNodeHierarchy). */\nfunction collectMeshesUnderNode(tn: { children?: unknown[] } | undefined): Mesh[] {\n const out: Mesh[] = [];\n for (const c of tn?.children ?? []) {\n if (c && typeof c === \"object\" && \"material\" in (c as object)) {\n out.push(c as Mesh);\n }\n }\n return out;\n}\n\nfunction buildInstanceMatrices(translation: Float32Array | null, rotation: Float32Array | null, scale: Float32Array | null, count: number): Float32Array {\n const matrices = new F32(count * 16);\n for (let i = 0; i < count; i++) {\n const tx = translation ? translation[i * 3]! : 0;\n const ty = translation ? translation[i * 3 + 1]! : 0;\n const tz = translation ? translation[i * 3 + 2]! : 0;\n const qx = rotation ? rotation[i * 4]! : 0;\n const qy = rotation ? rotation[i * 4 + 1]! : 0;\n const qz = rotation ? rotation[i * 4 + 2]! : 0;\n const qw = rotation ? rotation[i * 4 + 3]! : 1;\n const sx = scale ? scale[i * 3]! : 1;\n const sy = scale ? scale[i * 3 + 1]! : 1;\n const sz = scale ? scale[i * 3 + 2]! : 1;\n mat4ComposeInto(matrices, i * 16, tx, ty, tz, qx, qy, qz, qw, sx, sy, sz);\n }\n return matrices;\n}\n\nconst ext: GltfFeature = {\n id: \"EXT_mesh_gpu_instancing\",\n async applyAsset(_meshes, _root, ctx) {\n const { _json: json, _binChunk: binChunk, _nodeMap: nodeMap } = ctx;\n if (!nodeMap) {\n return {};\n }\n const nodes = json.nodes ?? [];\n for (let nodeIdx = 0; nodeIdx < nodes.length; nodeIdx++) {\n const attrs = nodes[nodeIdx]?.extensions?.EXT_mesh_gpu_instancing?.attributes;\n if (!attrs) {\n continue;\n }\n const tn = nodeMap[nodeIdx];\n if (!tn) {\n continue;\n }\n const meshesForNode = collectMeshesUnderNode(tn as unknown as { children?: unknown[] });\n if (meshesForNode.length === 0) {\n continue;\n }\n\n const tAcc = attrs.TRANSLATION !== undefined ? resolveAccessor(json, binChunk, attrs.TRANSLATION) : null;\n const rAcc = attrs.ROTATION !== undefined ? resolveAccessor(json, binChunk, attrs.ROTATION) : null;\n const sAcc = attrs.SCALE !== undefined ? resolveAccessor(json, binChunk, attrs.SCALE) : null;\n\n let count = 0;\n for (const acc of [tAcc, rAcc, sAcc]) {\n if (!acc) {\n continue;\n }\n if (count === 0) {\n count = acc._count;\n } else if (acc._count !== count) {\n throw new Error(`EXT_mesh_gpu_instancing: accessor count mismatch on node ${nodeIdx}`);\n }\n }\n if (count === 0) {\n continue;\n }\n\n const matrices = buildInstanceMatrices(\n tAcc ? (tAcc._data as Float32Array) : null,\n rAcc ? (rAcc._data as Float32Array) : null,\n sAcc ? (sAcc._data as Float32Array) : null,\n count\n );\n const nodeWorld = ctx._worldMatrixCache.get(nodeIdx);\n for (const mesh of meshesForNode) {\n setThinInstances(mesh, matrices, count);\n expandMeshAabbForInstances(mesh, matrices, count, nodeWorld);\n }\n }\n return {};\n },\n};\nexport default ext;\n\n/** Expand a mesh's world-space AABB to enclose all thin instances so that\n * auto-framing cameras see the full instanced grid, not just the base mesh.\n * Uses the module-level `getLoaderTmpInstance()` scratch for the per-iteration\n * instance world matrix — no per-call allocation. */\nfunction expandMeshAabbForInstances(mesh: Mesh, matrices: Float32Array, count: number, nodeWorld: Mat4 | undefined): void {\n const positions = mesh._cpuPositions;\n if (!positions || !nodeWorld || count === 0) {\n return;\n }\n // Local AABB of the base mesh (before any per-instance / node transform).\n const [lmin, lmax] = computeAabb(positions);\n if (!isFinite(lmin[0]!)) {\n return;\n }\n // 8 corners of the local AABB, packed as 24 floats for computeAabb.\n const corners = new F32([\n lmin[0]!,\n lmin[1]!,\n lmin[2]!,\n lmax[0]!,\n lmin[1]!,\n lmin[2]!,\n lmin[0]!,\n lmax[1]!,\n lmin[2]!,\n lmax[0]!,\n lmax[1]!,\n lmin[2]!,\n lmin[0]!,\n lmin[1]!,\n lmax[2]!,\n lmax[0]!,\n lmin[1]!,\n lmax[2]!,\n lmin[0]!,\n lmax[1]!,\n lmax[2]!,\n lmax[0]!,\n lmax[1]!,\n lmax[2]!,\n ]);\n let wMinX = Infinity,\n wMinY = Infinity,\n wMinZ = Infinity;\n let wMaxX = -Infinity,\n wMaxY = -Infinity,\n wMaxZ = -Infinity;\n const instWorld = getLoaderTmpInstance();\n const instBuf = instWorld as unknown as Mat4Storage;\n for (let i = 0; i < count; i++) {\n for (let k = 0; k < 16; k++) {\n instBuf[k] = matrices[i * 16 + k]!;\n }\n const combined = mat4Multiply(nodeWorld, instWorld);\n const [imin, imax] = computeAabb(corners, combined);\n if (imin[0]! < wMinX) {\n wMinX = imin[0]!;\n }\n if (imin[1]! < wMinY) {\n wMinY = imin[1]!;\n }\n if (imin[2]! < wMinZ) {\n wMinZ = imin[2]!;\n }\n if (imax[0]! > wMaxX) {\n wMaxX = imax[0]!;\n }\n if (imax[1]! > wMaxY) {\n wMaxY = imax[1]!;\n }\n if (imax[2]! > wMaxZ) {\n wMaxZ = imax[2]!;\n }\n }\n mesh.boundMin = [wMinX, wMinY, wMinZ];\n mesh.boundMax = [wMaxX, wMaxY, wMaxZ];\n}\n"],"names":[],"mappings":";AA6BA,SAAS,uBAAuB,IAAkD;AAC9E,QAAM,MAAc,CAAA;AACpB,aAAW,MAAK,yBAAI,aAAY,CAAA,GAAI;AAChC,QAAI,KAAK,OAAO,MAAM,YAAY,cAAe,GAAc;AAC3D,UAAI,KAAK,CAAS;AAAA,IACtB;AAAA,EACJ;AACA,SAAO;AACX;AAEA,SAAS,sBAAsB,aAAkC,UAA+B,OAA4B,OAA6B;AACrJ,QAAM,WAAW,IAAI,IAAI,QAA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IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ;AACA,OAAK,WAAW,CAAC,OAAO,OAAO,KAAK;AACpC,OAAK,WAAW,CAAC,OAAO,OAAO,KAAK;AACxC;"}
|
package/{gltf-feature-lights-punctual-C-0SlGmD.js → gltf-feature-lights-punctual-Ckm3ciL8.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MAX_LIGHTS,
|
|
1
|
+
import { M as MAX_LIGHTS, b7 as setMaxLights, b8 as computeNodeWorldMatrix } from "./index-CLElg2Bo.js";
|
|
2
2
|
const feature = {
|
|
3
3
|
id: "KHR_lights_punctual",
|
|
4
4
|
async applyAsset(_meshes, _root, ctx) {
|
|
@@ -40,20 +40,20 @@ const feature = {
|
|
|
40
40
|
const intensity = def.intensity ?? 1;
|
|
41
41
|
const range = def.range !== void 0 ? def.range : Number.MAX_VALUE;
|
|
42
42
|
if (def.type === "point") {
|
|
43
|
-
const { createPointLight } = await import("./index-
|
|
43
|
+
const { createPointLight } = await import("./index-CLElg2Bo.js").then((n) => n.j2);
|
|
44
44
|
const pl = createPointLight([px, py, pz], intensity);
|
|
45
45
|
pl.diffuse = color;
|
|
46
46
|
pl.specular = color;
|
|
47
47
|
pl.range = range;
|
|
48
48
|
lights.push(pl);
|
|
49
49
|
} else if (def.type === "directional") {
|
|
50
|
-
const { createDirectionalLight } = await import("./index-
|
|
50
|
+
const { createDirectionalLight } = await import("./index-CLElg2Bo.js").then((n) => n.j3);
|
|
51
51
|
const dl = createDirectionalLight(dir, intensity);
|
|
52
52
|
dl.diffuse = color;
|
|
53
53
|
dl.specular = color;
|
|
54
54
|
lights.push(dl);
|
|
55
55
|
} else if (def.type === "spot") {
|
|
56
|
-
const { createSpotLight } = await import("./index-
|
|
56
|
+
const { createSpotLight } = await import("./index-CLElg2Bo.js").then((n) => n.j4);
|
|
57
57
|
const outer = ((_i = def.spot) == null ? void 0 : _i.outerConeAngle) ?? Math.PI / 4;
|
|
58
58
|
const sl = createSpotLight([px, py, pz], dir, outer * 2, 1, intensity);
|
|
59
59
|
sl.diffuse = color;
|
|
@@ -68,4 +68,4 @@ const feature = {
|
|
|
68
68
|
export {
|
|
69
69
|
feature as default
|
|
70
70
|
};
|
|
71
|
-
//# sourceMappingURL=gltf-feature-lights-punctual-
|
|
71
|
+
//# sourceMappingURL=gltf-feature-lights-punctual-Ckm3ciL8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-lights-punctual-
|
|
1
|
+
{"version":3,"file":"gltf-feature-lights-punctual-Ckm3ciL8.js","sources":["../src/loader-gltf/gltf-feature-lights-punctual.ts"],"sourcesContent":["/** KHR_lights_punctual glTF extension.\n * Parses point / directional / spot lights from the asset's top-level\n * KHR_lights_punctual.lights array and instantiates one Lite light per\n * referencing node, baking the node's world transform into the light's\n * position / direction. Lights are contributed via the AssetContainer's\n * `entities` array; addToScene() picks them up through the `lightType`\n * branch of its traversal. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport type { LightBase } from \"../light/types.js\";\nimport { MAX_LIGHTS, setMaxLights } from \"../light/types.js\";\nimport { computeNodeWorldMatrix } from \"./gltf-parser.js\";\n\ninterface GltfLightDef {\n type: \"point\" | \"directional\" | \"spot\";\n color?: [number, number, number];\n intensity?: number;\n range?: number;\n spot?: { innerConeAngle?: number; outerConeAngle?: number };\n}\n\nconst feature: GltfFeature = {\n id: \"KHR_lights_punctual\",\n async applyAsset(_meshes, _root, ctx) {\n const defs: GltfLightDef[] | undefined = ctx._json.extensions?.KHR_lights_punctual?.lights;\n if (!defs?.length) {\n return {};\n }\n const lights: LightBase[] = [];\n const nodes = ctx._json.nodes ?? [];\n // Count lights first so we can raise MAX_LIGHTS before any pipeline is\n // compiled (loadGltf runs before addToScene which triggers pipeline\n // creation). Lite's MAX_LIGHTS is scene-wide, so cover every punctual\n // light declared by the asset rather than Babylon's per-material cap.\n let lightNodeCount = 0;\n for (let i = 0; i < nodes.length; i++) {\n if (nodes[i]?.extensions?.KHR_lights_punctual?.light !== undefined) {\n lightNodeCount++;\n }\n }\n if (lightNodeCount > MAX_LIGHTS) {\n setMaxLights(lightNodeCount);\n }\n for (let nodeIdx = 0; nodeIdx < nodes.length; nodeIdx++) {\n const lightIdx: number | undefined = nodes[nodeIdx]?.extensions?.KHR_lights_punctual?.light;\n if (lightIdx === undefined) {\n continue;\n }\n const def = defs[lightIdx];\n if (!def) {\n continue;\n }\n const world = computeNodeWorldMatrix(ctx._json, nodeIdx, ctx._parentMap, ctx._worldMatrixCache);\n const px = world[12]!;\n const py = world[13]!;\n const pz = world[14]!;\n // glTF convention: light forward is -Z in local space. Extract world-space forward\n // by transforming (0,0,-1) through the node's upper-3x3. Normalize defensively.\n const fx = -world[8]!;\n const fy = -world[9]!;\n const fz = -world[10]!;\n const flen = Math.hypot(fx, fy, fz) || 1;\n const dir: [number, number, number] = [fx / flen, fy / flen, fz / flen];\n const color: [number, number, number] = def.color ? [def.color[0]!, def.color[1]!, def.color[2]!] : [1, 1, 1];\n const intensity = def.intensity ?? 1;\n const range = def.range !== undefined ? def.range : Number.MAX_VALUE;\n\n if (def.type === \"point\") {\n const { createPointLight } = await import(\"../light/point-light.js\");\n const pl = createPointLight([px, py, pz], intensity);\n pl.diffuse = color;\n pl.specular = color;\n pl.range = range;\n lights.push(pl);\n } else if (def.type === \"directional\") {\n const { createDirectionalLight } = await import(\"../light/directional-light.js\");\n const dl = createDirectionalLight(dir, intensity);\n dl.diffuse = color;\n dl.specular = color;\n lights.push(dl);\n } else if (def.type === \"spot\") {\n const { createSpotLight } = await import(\"../light/spot-light.js\");\n const outer = def.spot?.outerConeAngle ?? Math.PI / 4;\n const sl = createSpotLight([px, py, pz], dir, outer * 2, 1, intensity);\n sl.diffuse = color;\n sl.specular = color;\n sl.range = range;\n lights.push(sl);\n }\n }\n return { entities: lights };\n },\n};\nexport default feature;\n"],"names":[],"mappings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
51
|
if ((ext.buffer ?? 0) !== 0) {
|
|
51
52
|
throw new Error(`EXT_meshopt_compression: compressed source buffer ${ext.buffer} is not buffer 0 (unsupported)`);
|
|
52
53
|
}
|
|
53
|
-
const source = new
|
|
54
|
-
const target = new
|
|
54
|
+
const source = new U8(binChunk.buffer, binChunk.byteOffset + (ext.byteOffset ?? 0), ext.byteLength);
|
|
55
|
+
const target = new U8(ext.count * ext.byteStride);
|
|
55
56
|
decoder.decodeGltfBuffer(target, ext.count, ext.byteStride, source, ext.mode, ext.filter ?? "NONE");
|
|
56
57
|
bytes = target;
|
|
57
58
|
} else {
|
|
58
59
|
if ((bv.buffer ?? 0) !== 0) {
|
|
59
60
|
throw new Error(`EXT_meshopt_compression: uncompressed bufferView in buffer ${bv.buffer} is not buffer 0 (unsupported)`);
|
|
60
61
|
}
|
|
61
|
-
bytes = new
|
|
62
|
+
bytes = new U8(binChunk.buffer.slice(binChunk.byteOffset + (bv.byteOffset ?? 0), binChunk.byteOffset + (bv.byteOffset ?? 0) + bv.byteLength));
|
|
62
63
|
}
|
|
63
64
|
materialized[i] = bytes;
|
|
64
65
|
newOffsets[i] = total;
|
|
65
66
|
total = align4(total + bytes.length);
|
|
66
67
|
}
|
|
67
|
-
const packed = new
|
|
68
|
+
const packed = new U8(total);
|
|
68
69
|
for (let i = 0; i < bufferViews.length; i++) {
|
|
69
70
|
const bv = bufferViews[i];
|
|
70
71
|
packed.set(materialized[i], newOffsets[i]);
|
|
@@ -75,10 +76,10 @@ const feature = {
|
|
|
75
76
|
delete bv.extensions.EXT_meshopt_compression;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
|
-
return new
|
|
79
|
+
return new DV(packed.buffer);
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
export {
|
|
82
83
|
feature as default
|
|
83
84
|
};
|
|
84
|
-
//# sourceMappingURL=gltf-feature-meshopt-
|
|
85
|
+
//# sourceMappingURL=gltf-feature-meshopt-DLC4SF1E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-meshopt-DLC4SF1E.js","sources":["../src/loader-gltf/meshopt-decode.ts","../src/loader-gltf/gltf-feature-meshopt.ts"],"sourcesContent":["/**\n * Lazy EXT_meshopt_compression decoder.\n *\n * The meshoptimizer decoder (JS glue + embedded WASM) is loaded from\n * `/meshopt_decoder.js` on first use via a `<script>` injection — exactly like\n * the Draco decoder. This keeps bundle size at zero bytes for scenes that do\n * not load meshopt-compressed glTF assets: the entire module (including this\n * file) is dynamic-imported from the meshopt feature only when an asset's\n * `extensionsUsed` lists EXT_meshopt_compression.\n */\n\n// Public base URL where meshopt_decoder.js is hosted. Defaults to site root.\nlet meshoptBaseUrl = \"/\";\n\n/** Override the base URL where meshopt_decoder.js is hosted. */\nexport function setMeshoptBaseUrl(url: string): void {\n meshoptBaseUrl = url.endsWith(\"/\") ? url : url + \"/\";\n}\n\n/** Minimal surface of the global `MeshoptDecoder` object we rely on. */\ninterface MeshoptDecoderModule {\n ready: Promise<void>;\n decodeGltfBuffer(target: Uint8Array, count: number, size: number, source: Uint8Array, mode: string, filter?: string): void;\n}\n\nlet scriptLoadPromise: Promise<MeshoptDecoderModule> | null = null;\n\nfunction loadMeshoptScript(): Promise<MeshoptDecoderModule> {\n if (scriptLoadPromise) {\n return scriptLoadPromise;\n }\n scriptLoadPromise = new Promise<MeshoptDecoderModule>((resolve, reject) => {\n const existing = (globalThis as { MeshoptDecoder?: MeshoptDecoderModule }).MeshoptDecoder;\n if (existing) {\n resolve(existing);\n return;\n }\n const script = document.createElement(\"script\");\n script.src = meshoptBaseUrl + \"meshopt_decoder.js\";\n script.onload = () => {\n const mod = (globalThis as { MeshoptDecoder?: MeshoptDecoderModule }).MeshoptDecoder;\n if (!mod) {\n reject(new Error(\"meshopt_decoder.js loaded but MeshoptDecoder is undefined\"));\n } else {\n resolve(mod);\n }\n };\n script.onerror = () => reject(new Error(\"Failed to load meshopt_decoder.js from \" + script.src));\n document.head.appendChild(script);\n });\n return scriptLoadPromise;\n}\n\n/** Resolve the ready meshopt decoder module (WASM instantiated). */\nexport async function getMeshoptDecoder(): Promise<MeshoptDecoderModule> {\n const mod = await loadMeshoptScript();\n await mod.ready;\n return mod;\n}\n","/**\n * EXT_meshopt_compression feature.\n *\n * Runs as a `preParse` hook — before any accessor is read — so the core loader\n * and accessor reader stay unaware of meshopt. This module is only\n * dynamic-imported when the asset's `extensionsUsed` lists\n * EXT_meshopt_compression, which in turn loads the meshoptimizer decoder\n * (`meshopt-decode.ts`) lazily.\n *\n * EXT_meshopt_compression is a bufferView-level codec: each compressed\n * bufferView carries an extension object describing the compressed source\n * (`buffer`/`byteOffset`/`byteLength`), the decoded layout (`count`/`byteStride`)\n * and the codec (`mode`/`filter`). We decode every compressed bufferView, copy\n * through every uncompressed one, and pack the results into a single contiguous\n * binary chunk, rewriting `bufferViews` to point into it. Accessor byteOffsets\n * are bufferView-relative and the per-bufferView layout (count * byteStride) is\n * preserved, so the existing accessor reader resolves the decoded data\n * transparently.\n */\n\nimport { U8, DV } from \"../engine/typed-arrays.js\";\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport { getMeshoptDecoder } from \"./meshopt-decode.js\";\n\ninterface MeshoptExt {\n buffer: number;\n byteOffset?: number;\n byteLength: number;\n byteStride: number;\n count: number;\n mode: string;\n filter?: string;\n}\n\ninterface BufferView {\n buffer?: number;\n byteOffset?: number;\n byteLength: number;\n byteStride?: number;\n extensions?: { EXT_meshopt_compression?: MeshoptExt; [k: string]: unknown };\n}\n\n/** Round up to the next 4-byte boundary so relocated bufferViews stay aligned\n * for Float32Array / Uint16Array / Uint32Array views over the packed buffer. */\nfunction align4(n: number): number {\n return (n + 3) & ~3;\n}\n\nconst feature: GltfFeature = {\n id: \"EXT_meshopt_compression\",\n async preParse(json, binChunk) {\n const bufferViews: BufferView[] = json.bufferViews ?? [];\n const decoder = await getMeshoptDecoder();\n\n // Pass 1: materialize each bufferView (decode meshopt ones, copy the rest)\n // and compute the packed-buffer offset for each.\n const materialized: Uint8Array[] = new Array(bufferViews.length);\n const newOffsets: number[] = new Array(bufferViews.length);\n let total = 0;\n for (let i = 0; i < bufferViews.length; i++) {\n const bv = bufferViews[i]!;\n const ext = bv.extensions?.EXT_meshopt_compression;\n let bytes: Uint8Array;\n if (ext) {\n if ((ext.buffer ?? 0) !== 0) {\n throw new Error(`EXT_meshopt_compression: compressed source buffer ${ext.buffer} is not buffer 0 (unsupported)`);\n }\n const source = new U8(binChunk.buffer, binChunk.byteOffset + (ext.byteOffset ?? 0), ext.byteLength);\n const target = new U8(ext.count * ext.byteStride);\n decoder.decodeGltfBuffer(target, ext.count, ext.byteStride, source, ext.mode, ext.filter ?? \"NONE\");\n bytes = target;\n } else {\n if ((bv.buffer ?? 0) !== 0) {\n throw new Error(`EXT_meshopt_compression: uncompressed bufferView in buffer ${bv.buffer} is not buffer 0 (unsupported)`);\n }\n bytes = new U8(binChunk.buffer.slice(binChunk.byteOffset + (bv.byteOffset ?? 0), binChunk.byteOffset + (bv.byteOffset ?? 0) + bv.byteLength));\n }\n materialized[i] = bytes;\n newOffsets[i] = total;\n total = align4(total + bytes.length);\n }\n\n // Pass 2: pack into a single contiguous buffer and rewrite bufferViews.\n const packed = new U8(total);\n for (let i = 0; i < bufferViews.length; i++) {\n const bv = bufferViews[i]!;\n packed.set(materialized[i]!, newOffsets[i]!);\n bv.buffer = 0;\n bv.byteOffset = newOffsets[i]!;\n bv.byteLength = materialized[i]!.length;\n if (bv.extensions) {\n delete bv.extensions.EXT_meshopt_compression;\n }\n }\n\n return new DV(packed.buffer);\n },\n};\n\nexport default feature;\n"],"names":[],"mappings":";AAYA,IAAI,iBAAiB;AAarB,IAAI,oBAA0D;AAE9D,SAAS,oBAAmD;AACxD,MAAI,mBAAmB;AACnB,WAAO;AAAA,EACX;AACA,sBAAoB,IAAI,QAA8B,CAAC,SAAS,WAAW;AACvE,UAAM,WAAY,WAAyD;AAC3E,QAAI,UAAU;AACV,cAAQ,QAAQ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,IAAI,MAAM,IAAI,UAAU,MAAM;AAClG,gBAAQ;AAAA,MACZ,OAAO;AACH,aAAK,GAAG,UAAU,OAAO,GAAG;AACxB,gBAAM,IAAI,MAAM,8DAA8D,GAAG,MAAM,gCAAgC;AAAA,QAC3H;AACA,gBAAQ,IAAI,GAAG,SAAS,OAAO,MAAM,SAAS,cAAc,GAAG,cAAc,IAAI,SAAS,cAAc,GAAG,cAAc,KAAK,GAAG,UAAU,CAAC;AAAA,MAChJ;AACA,mBAAa,CAAC,IAAI;AAClB,iBAAW,CAAC,IAAI;AAChB,cAAQ,OAAO,QAAQ,MAAM,MAAM;AAAA,IACvC;AAGA,UAAM,SAAS,IAAI,GAAG,KAAK;AAC3B,aAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AACzC,YAAM,KAAK,YAAY,CAAC;AACxB,aAAO,IAAI,aAAa,CAAC,GAAI,WAAW,CAAC,CAAE;AAC3C,SAAG,SAAS;AACZ,SAAG,aAAa,WAAW,CAAC;AAC5B,SAAG,aAAa,aAAa,CAAC,EAAG;AACjC,UAAI,GAAG,YAAY;AACf,eAAO,GAAG,WAAW;AAAA,MACzB;AAAA,IACJ;AAEA,WAAO,IAAI,GAAG,OAAO,MAAM;AAAA,EAC/B;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveAccessor } from "./index-
|
|
1
|
+
import { r as resolveAccessor, a as F32 } from "./index-CLElg2Bo.js";
|
|
2
2
|
const feature = {
|
|
3
3
|
id: "_morph",
|
|
4
4
|
async applyMesh(meshData, mesh, ctx) {
|
|
@@ -13,17 +13,17 @@ const feature = {
|
|
|
13
13
|
const posAcc = target.POSITION !== void 0 ? resolveAccessor(json, binChunk, target.POSITION) : null;
|
|
14
14
|
const normAcc = target.NORMAL !== void 0 ? resolveAccessor(json, binChunk, target.NORMAL) : null;
|
|
15
15
|
morphTargets.push({
|
|
16
|
-
positions: posAcc ? posAcc._data : new
|
|
16
|
+
positions: posAcc ? posAcc._data : new F32(meshData._vertexCount * 3),
|
|
17
17
|
normals: normAcc ? normAcc._data : null
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
const parentMesh = json.meshes[json.nodes[meshData._nodeIndex].mesh];
|
|
21
21
|
const morphWeights = parentMesh.weights ?? new Array(targets.length).fill(0);
|
|
22
|
-
const { createMorphTargets } = await import("./index-
|
|
22
|
+
const { createMorphTargets } = await import("./index-CLElg2Bo.js").then((n) => n.j6);
|
|
23
23
|
mesh.morphTargets = createMorphTargets(ctx._engine, morphTargets, meshData._vertexCount, morphWeights);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
export {
|
|
27
27
|
feature as default
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=gltf-feature-morph-
|
|
29
|
+
//# sourceMappingURL=gltf-feature-morph-Cjtu7hYa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-morph-Cjtu7hYa.js","sources":["../src/loader-gltf/gltf-feature-morph.ts"],"sourcesContent":["/** Morph target feature. Extracts per-primitive morph targets lazily so the\n * core loader doesn't carry any morph-related code for non-morphed assets. */\n\nimport { F32 } from \"../engine/typed-arrays.js\";\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport { resolveAccessor } from \"./gltf-parser.js\";\n\nconst feature: GltfFeature = {\n id: \"_morph\",\n async applyMesh(meshData, mesh, ctx) {\n const primitive = meshData._primitive;\n const targets = primitive.targets;\n if (!targets || targets.length === 0) {\n return;\n }\n const { _json: json, _binChunk: binChunk } = ctx;\n const morphTargets: { positions: Float32Array; normals: Float32Array | null }[] = [];\n for (const target of targets) {\n const posAcc = target.POSITION !== undefined ? resolveAccessor(json, binChunk, target.POSITION) : null;\n const normAcc = target.NORMAL !== undefined ? resolveAccessor(json, binChunk, target.NORMAL) : null;\n morphTargets.push({\n positions: posAcc ? (posAcc._data as Float32Array) : new F32(meshData._vertexCount * 3),\n normals: normAcc ? (normAcc._data as Float32Array) : null,\n });\n }\n const parentMesh = json.meshes[json.nodes[meshData._nodeIndex].mesh];\n const morphWeights = parentMesh.weights ?? new Array(targets.length).fill(0);\n const { createMorphTargets } = await import(\"../morph/create-morph-targets.js\");\n mesh.morphTargets = createMorphTargets(ctx._engine, morphTargets, meshData._vertexCount, morphWeights);\n },\n};\nexport default feature;\n"],"names":[],"mappings":";AAOA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,UAAU,UAAU,MAAM,KAAK;AACjC,UAAM,YAAY,SAAS;AAC3B,UAAM,UAAU,UAAU;AAC1B,QAAI,CAAC,WAAW,QAAQ,WAAW,GAAG;AAClC;AAAA,IACJ;AACA,UAAM,EAAE,OAAO,MAAM,WAAW,aAAa;AAC7C,UAAM,eAA4E,CAAA;AAClF,eAAW,UAAU,SAAS;AAC1B,YAAM,SAAS,OAAO,aAAa,SAAY,gBAAgB,MAAM,UAAU,OAAO,QAAQ,IAAI;AAClG,YAAM,UAAU,OAAO,WAAW,SAAY,gBAAgB,MAAM,UAAU,OAAO,MAAM,IAAI;AAC/F,mBAAa,KAAK;AAAA,QACd,WAAW,SAAU,OAAO,QAAyB,IAAI,IAAI,SAAS,eAAe,CAAC;AAAA,QACtF,SAAS,UAAW,QAAQ,QAAyB;AAAA,MAAA,CACxD;AAAA,IACL;AACA,UAAM,aAAa,KAAK,OAAO,KAAK,MAAM,SAAS,UAAU,EAAE,IAAI;AACnE,UAAM,eAAe,WAAW,WAAW,IAAI,MAAM,QAAQ,MAAM,EAAE,KAAK,CAAC;AAC3E,UAAM,EAAE,mBAAA,IAAuB,MAAM,OAAO,qBAAkC,EAAA,KAAA,OAAA,EAAA,EAAA;AAC9E,SAAK,eAAe,mBAAmB,IAAI,SAAS,cAAc,SAAS,cAAc,YAAY;AAAA,EACzG;AACJ;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as needsOrmComposite,
|
|
1
|
+
import { n as needsOrmComposite, k as anyPrimitive } from "./index-CLElg2Bo.js";
|
|
2
2
|
const M = "KHR_materials_";
|
|
3
3
|
const _features = [
|
|
4
4
|
// Pre-parse features (buffer-level): order matters — meshopt decompresses
|
|
5
5
|
// bufferViews first, then quantization dequantizes the resulting accessors.
|
|
6
|
-
["EXT_meshopt_compression", () => import("./gltf-feature-meshopt-
|
|
7
|
-
["KHR_mesh_quantization", () => import("./gltf-ext-quantization-
|
|
6
|
+
["EXT_meshopt_compression", () => import("./gltf-feature-meshopt-DLC4SF1E.js")],
|
|
7
|
+
["KHR_mesh_quantization", () => import("./gltf-ext-quantization-CvHI_0Vg.js")],
|
|
8
8
|
// Pre-mesh features (geometry decompression)
|
|
9
|
-
["KHR_draco_mesh_compression", () => import("./gltf-feature-draco-
|
|
9
|
+
["KHR_draco_mesh_compression", () => import("./gltf-feature-draco-CKKzT5E3.js")],
|
|
10
10
|
// Material extensions
|
|
11
11
|
[M + "clearcoat", () => import("./gltf-ext-clearcoat-CLH2SVph.js")],
|
|
12
12
|
[M + "iridescence", () => import("./gltf-ext-iridescence-C6bq7jiM.js")],
|
|
@@ -21,8 +21,8 @@ const _features = [
|
|
|
21
21
|
var _a;
|
|
22
22
|
return (_a = j.extensionsUsed) == null ? void 0 : _a.includes(M + e);
|
|
23
23
|
}), () => import("./gltf-ext-dielectric-qHzlnvdl.js")],
|
|
24
|
-
["KHR_texture_transform", () => import("./gltf-ext-uv-transform-
|
|
25
|
-
["KHR_texture_basisu", () => import("./gltf-ext-basisu-
|
|
24
|
+
["KHR_texture_transform", () => import("./gltf-ext-uv-transform-DgYazJBs.js")],
|
|
25
|
+
["KHR_texture_basisu", () => import("./gltf-ext-basisu-CDbPclzZ.js")],
|
|
26
26
|
[needsOrmComposite, () => import("./gltf-ext-orm-CT18G_vQ.js")],
|
|
27
27
|
// Per-mesh features (predicates inlined to avoid eager imports)
|
|
28
28
|
[(j) => {
|
|
@@ -31,21 +31,21 @@ const _features = [
|
|
|
31
31
|
var _a2;
|
|
32
32
|
return ((_a2 = p.attributes) == null ? void 0 : _a2.JOINTS_0) !== void 0;
|
|
33
33
|
});
|
|
34
|
-
}, () => import("./gltf-feature-skeleton-
|
|
34
|
+
}, () => import("./gltf-feature-skeleton-DKbOGidp.js")],
|
|
35
35
|
[(j) => anyPrimitive(j, (p) => {
|
|
36
36
|
var _a;
|
|
37
37
|
return !!((_a = p.targets) == null ? void 0 : _a.length);
|
|
38
|
-
}), () => import("./gltf-feature-morph-
|
|
38
|
+
}), () => import("./gltf-feature-morph-Cjtu7hYa.js")],
|
|
39
39
|
// Per-asset features
|
|
40
|
-
["KHR_lights_punctual", () => import("./gltf-feature-lights-punctual-
|
|
40
|
+
["KHR_lights_punctual", () => import("./gltf-feature-lights-punctual-Ckm3ciL8.js")],
|
|
41
41
|
[(j) => {
|
|
42
42
|
var _a;
|
|
43
43
|
return !!((_a = j.animations) == null ? void 0 : _a.length);
|
|
44
|
-
}, () => import("./gltf-feature-animations-
|
|
45
|
-
[M + "variants", () => import("./gltf-feature-variants-
|
|
46
|
-
["KHR_node_visibility", () => import("./gltf-ext-node-visibility-
|
|
47
|
-
["KHR_animation_pointer", () => import("./gltf-feature-animation-pointer-
|
|
48
|
-
["EXT_mesh_gpu_instancing", () => import("./gltf-feature-gpu-instancing-
|
|
44
|
+
}, () => import("./gltf-feature-animations-Cmc1uoIu.js")],
|
|
45
|
+
[M + "variants", () => import("./gltf-feature-variants-Cmzu0O0e.js")],
|
|
46
|
+
["KHR_node_visibility", () => import("./gltf-ext-node-visibility-DXCJEYr6.js")],
|
|
47
|
+
["KHR_animation_pointer", () => import("./gltf-feature-animation-pointer-D1RJRFBw.js")],
|
|
48
|
+
["EXT_mesh_gpu_instancing", () => import("./gltf-feature-gpu-instancing-n87SO6Vh.js")],
|
|
49
49
|
["KHR_xmp_json_ld", () => import("./gltf-feature-xmp-BUfq_IVG.js")]
|
|
50
50
|
];
|
|
51
51
|
async function loadGltfFeatures(json) {
|
|
@@ -56,4 +56,4 @@ async function loadGltfFeatures(json) {
|
|
|
56
56
|
export {
|
|
57
57
|
loadGltfFeatures
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=gltf-feature-registry-
|
|
59
|
+
//# sourceMappingURL=gltf-feature-registry-C63Hjp9w.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-registry-
|
|
1
|
+
{"version":3,"file":"gltf-feature-registry-C63Hjp9w.js","sources":["../src/loader-gltf/gltf-feature-registry.ts"],"sourcesContent":["/**\n * glTF optional-feature registry.\n *\n * The `_features` table maps every optional glTF capability to a `[trigger, load]`\n * pair: a cheap trigger plus a dynamic `import()` of the feature's `GltfFeature`\n * module. A trigger is either an exact `extensionsUsed` name (the common case) or\n * a predicate over the parsed JSON for features that aren't a simple extension\n * membership (ORM compositing, skeletons, morph targets, animations, dielectric\n * material cluster).\n *\n * This whole module is itself dynamically imported by the core loader\n * (`load-gltf.ts`) ONLY when the asset can possibly trigger at least one feature\n * — so assets that use no optional features (plain metallic-roughness GLBs) never\n * pay for the table or its import thunks.\n *\n * The core loader knows zero feature names; new extensions are added here alone.\n */\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport { anyPrimitive, needsOrmComposite } from \"./gltf-parser.js\";\n\n/** Dynamic `import()` of a feature's `GltfFeature` module. */\ntype Loader = () => Promise<{ default: GltfFeature }>;\n/** Either an exact `extensionsUsed` name, or a predicate over the parsed JSON. */\ntype Trigger = string | ((json: any) => boolean);\n\nconst M = \"KHR_materials_\";\n\nconst _features: [Trigger, Loader][] = [\n // Pre-parse features (buffer-level): order matters — meshopt decompresses\n // bufferViews first, then quantization dequantizes the resulting accessors.\n [\"EXT_meshopt_compression\", () => import(\"./gltf-feature-meshopt.js\")],\n [\"KHR_mesh_quantization\", () => import(\"./gltf-ext-quantization.js\")],\n // Pre-mesh features (geometry decompression)\n [\"KHR_draco_mesh_compression\", () => import(\"./gltf-feature-draco.js\")],\n // Material extensions\n [M + \"clearcoat\", () => import(\"./gltf-ext-clearcoat.js\")],\n [M + \"iridescence\", () => import(\"./gltf-ext-iridescence.js\")],\n [M + \"emissive_strength\", () => import(\"./gltf-ext-emissive-strength.js\")],\n [M + \"sheen\", () => import(\"./gltf-ext-sheen.js\")],\n [M + \"anisotropy\", () => import(\"./gltf-ext-anisotropy.js\")],\n [M + \"unlit\", () => import(\"./gltf-ext-unlit.js\")],\n [M + \"pbrSpecularGlossiness\", () => import(\"./gltf-ext-spec-gloss.js\")],\n // Dielectric cluster (ior/specular/transmission/volume/dispersion) — any of the five triggers the\n // loader; transmission refraction is wired dynamically by the PBR material path when needed.\n [(j) => [\"transmission\", \"volume\", \"ior\", \"specular\", \"dispersion\"].some((e) => j.extensionsUsed?.includes(M + e)), () => import(\"./gltf-ext-dielectric.js\")],\n [\"KHR_texture_transform\", () => import(\"./gltf-ext-uv-transform.js\")],\n [\"KHR_texture_basisu\", () => import(\"./gltf-ext-basisu.js\")],\n [needsOrmComposite, () => import(\"./gltf-ext-orm.js\")],\n // Per-mesh features (predicates inlined to avoid eager imports)\n [(j) => !!j.skins?.length && anyPrimitive(j, (p) => p.attributes?.JOINTS_0 !== undefined), () => import(\"./gltf-feature-skeleton.js\")],\n [(j) => anyPrimitive(j, (p) => !!p.targets?.length), () => import(\"./gltf-feature-morph.js\")],\n // Per-asset features\n [\"KHR_lights_punctual\", () => import(\"./gltf-feature-lights-punctual.js\")],\n [(j) => !!j.animations?.length, () => import(\"./gltf-feature-animations.js\")],\n [M + \"variants\", () => import(\"./gltf-feature-variants.js\")],\n [\"KHR_node_visibility\", () => import(\"./gltf-ext-node-visibility.js\")],\n [\"KHR_animation_pointer\", () => import(\"./gltf-feature-animation-pointer.js\")],\n [\"EXT_mesh_gpu_instancing\", () => import(\"./gltf-feature-gpu-instancing.js\")],\n [\"KHR_xmp_json_ld\", () => import(\"./gltf-feature-xmp.js\")],\n];\n\n/** Dynamic-import every feature the asset triggers. */\nexport async function loadGltfFeatures(json: any): Promise<GltfFeature[]> {\n const used: string[] = json.extensionsUsed ?? [];\n const mods = await Promise.all(_features.flatMap(([t, load]) => ((typeof t === \"string\" ? used.includes(t) : t(json)) ? [load()] : [])));\n return mods.map((m) => m.default);\n}\n"],"names":["_a"],"mappings":";AAyBA,MAAM,IAAI;AAEV,MAAM,YAAiC;AAAA;AAAA;AAAA,EAGnC,CAAC,2BAA2B,MAAM,OAAO,oCAA2B,CAAC;AAAA,EACrE,CAAC,yBAAyB,MAAM,OAAO,qCAA4B,CAAC;AAAA;AAAA,EAEpE,CAAC,8BAA8B,MAAM,OAAO,kCAAyB,CAAC;AAAA;AAAA,EAEtE,CAAC,IAAI,aAAa,MAAM,OAAO,kCAAyB,CAAC;AAAA,EACzD,CAAC,IAAI,eAAe,MAAM,OAAO,oCAA2B,CAAC;AAAA,EAC7D,CAAC,IAAI,qBAAqB,MAAM,OAAO,0CAAiC,CAAC;AAAA,EACzE,CAAC,IAAI,SAAS,MAAM,OAAO,8BAAqB,CAAC;AAAA,EACjD,CAAC,IAAI,cAAc,MAAM,OAAO,mCAA0B,CAAC;AAAA,EAC3D,CAAC,IAAI,SAAS,MAAM,OAAO,8BAAqB,CAAC;AAAA,EACjD,CAAC,IAAI,yBAAyB,MAAM,OAAO,mCAA0B,CAAC;AAAA;AAAA;AAAA,EAGtE,CAAC,CAAC,MAAM,CAAC,gBAAgB,UAAU,OAAO,YAAY,YAAY,EAAE,KAAK,CAAC;;AAAM,mBAAE,mBAAF,mBAAkB,SAAS,IAAI;AAAA,GAAE,GAAG,MAAM,OAAO,mCAA0B,CAAC;AAAA,EAC5J,CAAC,yBAAyB,MAAM,OAAO,qCAA4B,CAAC;AAAA,EACpE,CAAC,sBAAsB,MAAM,OAAO,+BAAsB,CAAC;AAAA,EAC3D,CAAC,mBAAmB,MAAM,OAAO,4BAAmB,CAAC;AAAA;AAAA,EAErD,CAAC,CAAC,MAAA;;AAAM,YAAC,GAAC,OAAE,UAAF,mBAAS,WAAU,aAAa,GAAG,CAAC,MAAA;;AAAM,eAAAA,MAAA,EAAE,eAAF,gBAAAA,IAAc,cAAa;AAAA,KAAS;AAAA,KAAG,MAAM,OAAO,qCAA4B,CAAC;AAAA,EACrI,CAAC,CAAC,MAAM,aAAa,GAAG,CAAC,MAAA;;AAAM,YAAC,GAAC,OAAE,YAAF,mBAAW;AAAA,GAAM,GAAG,MAAM,OAAO,kCAAyB,CAAC;AAAA;AAAA,EAE5F,CAAC,uBAAuB,MAAM,OAAO,4CAAmC,CAAC;AAAA,EACzE,CAAC,CAAC,MAAA;;AAAM,YAAC,GAAC,OAAE,eAAF,mBAAc;AAAA,KAAQ,MAAM,OAAO,uCAA8B,CAAC;AAAA,EAC5E,CAAC,IAAI,YAAY,MAAM,OAAO,qCAA4B,CAAC;AAAA,EAC3D,CAAC,uBAAuB,MAAM,OAAO,wCAA+B,CAAC;AAAA,EACrE,CAAC,yBAAyB,MAAM,OAAO,8CAAqC,CAAC;AAAA,EAC7E,CAAC,2BAA2B,MAAM,OAAO,2CAAkC,CAAC;AAAA,EAC5E,CAAC,mBAAmB,MAAM,OAAO,gCAAuB,CAAC;AAC7D;AAGA,eAAsB,iBAAiB,MAAmC;AACtE,QAAM,OAAiB,KAAK,kBAAkB,CAAA;AAC9C,QAAM,OAAO,MAAM,QAAQ,IAAI,UAAU,QAAQ,CAAC,CAAC,GAAG,IAAI,OAAQ,OAAO,MAAM,WAAW,KAAK,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,KAAA,CAAM,IAAI,CAAA,CAAG,CAAC;AACvI,SAAO,KAAK,IAAI,CAAC,MAAM,EAAE,OAAO;AACpC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveAccessor } from "./index-
|
|
1
|
+
import { r as resolveAccessor } from "./index-CLElg2Bo.js";
|
|
2
2
|
function resolveAttr(name, primitive, decoded, json, binChunk) {
|
|
3
3
|
var _a;
|
|
4
4
|
if (decoded && decoded._attributes.has(name)) {
|
|
@@ -24,7 +24,7 @@ const feature = {
|
|
|
24
24
|
}
|
|
25
25
|
const joints1 = resolveAttr("JOINTS_1", primitive, decoded, json, binChunk);
|
|
26
26
|
const weights1 = resolveAttr("WEIGHTS_1", primitive, decoded, json, binChunk);
|
|
27
|
-
const [{ extractSkin, computeBoneTextureData }, { createSkeleton }] = await Promise.all([import("./gltf-animation-
|
|
27
|
+
const [{ extractSkin, computeBoneTextureData }, { createSkeleton }] = await Promise.all([import("./gltf-animation-K_zZxj_d.js"), import("./create-skeleton-D_uplboC.js")]);
|
|
28
28
|
const skin = extractSkin(json, binChunk, node.skin, meshData._worldMatrix, parentMap, worldMatrixCache);
|
|
29
29
|
const boneData = computeBoneTextureData(skin);
|
|
30
30
|
mesh.skeleton = createSkeleton(ctx._engine, joints, weights, skin.jointNodes.length, boneData, joints1, weights1);
|
|
@@ -33,4 +33,4 @@ const feature = {
|
|
|
33
33
|
export {
|
|
34
34
|
feature as default
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=gltf-feature-skeleton-
|
|
36
|
+
//# sourceMappingURL=gltf-feature-skeleton-DKbOGidp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-skeleton-
|
|
1
|
+
{"version":3,"file":"gltf-feature-skeleton-DKbOGidp.js","sources":["../src/loader-gltf/gltf-feature-skeleton.ts"],"sourcesContent":["/** Skeletal animation feature. Extracts joints/weights/skin on demand so the\n * core loader doesn't carry any skinning-related code for non-skinned assets. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport { resolveAccessor } from \"./gltf-parser.js\";\n\n/** Resolve a vertex attribute by name, preferring any pre-decoded\n * (e.g. Draco) data over the raw accessor. */\nfunction resolveAttr(name: string, primitive: any, decoded: any, json: any, binChunk: DataView): ArrayBufferView | null {\n if (decoded && decoded._attributes.has(name)) {\n return decoded._attributes.get(name)!;\n }\n const idx = primitive.attributes?.[name];\n return idx !== undefined ? (resolveAccessor(json, binChunk, idx)._data as ArrayBufferView) : null;\n}\n\nconst feature: GltfFeature = {\n id: \"_skeleton\",\n async applyMesh(meshData, mesh, ctx) {\n const { _json: json, _binChunk: binChunk, _parentMap: parentMap, _worldMatrixCache: worldMatrixCache } = ctx;\n const node = json.nodes[meshData._nodeIndex];\n if (node.skin === undefined || !json.skins) {\n return;\n }\n const primitive = meshData._primitive;\n const decoded = meshData._decoded;\n const joints = resolveAttr(\"JOINTS_0\", primitive, decoded, json, binChunk) as Uint16Array | Uint8Array | null;\n const weights = resolveAttr(\"WEIGHTS_0\", primitive, decoded, json, binChunk) as Float32Array | null;\n if (!joints || !weights) {\n return;\n }\n const joints1 = resolveAttr(\"JOINTS_1\", primitive, decoded, json, binChunk) as Uint16Array | Uint8Array | null;\n const weights1 = resolveAttr(\"WEIGHTS_1\", primitive, decoded, json, binChunk) as Float32Array | null;\n\n const [{ extractSkin, computeBoneTextureData }, { createSkeleton }] = await Promise.all([import(\"./gltf-animation.js\"), import(\"../skeleton/create-skeleton.js\")]);\n const skin = extractSkin(json, binChunk, node.skin, meshData._worldMatrix, parentMap, worldMatrixCache);\n const boneData = computeBoneTextureData(skin);\n mesh.skeleton = createSkeleton(ctx._engine, joints, weights, skin.jointNodes.length, boneData, joints1, weights1);\n },\n};\nexport default feature;\n"],"names":[],"mappings":";AAQA,SAAS,YAAY,MAAc,WAAgB,SAAc,MAAW,UAA4C;;AACpH,MAAI,WAAW,QAAQ,YAAY,IAAI,IAAI,GAAG;AAC1C,WAAO,QAAQ,YAAY,IAAI,IAAI;AAAA,EACvC;AACA,QAAM,OAAM,eAAU,eAAV,mBAAuB;AACnC,SAAO,QAAQ,SAAa,gBAAgB,MAAM,UAAU,GAAG,EAAE,QAA4B;AACjG;AAEA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,UAAU,UAAU,MAAM,KAAK;AACjC,UAAM,EAAE,OAAO,MAAM,WAAW,UAAU,YAAY,WAAW,mBAAmB,iBAAA,IAAqB;AACzG,UAAM,OAAO,KAAK,MAAM,SAAS,UAAU;AAC3C,QAAI,KAAK,SAAS,UAAa,CAAC,KAAK,OAAO;AACxC;AAAA,IACJ;AACA,UAAM,YAAY,SAAS;AAC3B,UAAM,UAAU,SAAS;AACzB,UAAM,SAAS,YAAY,YAAY,WAAW,SAAS,MAAM,QAAQ;AACzE,UAAM,UAAU,YAAY,aAAa,WAAW,SAAS,MAAM,QAAQ;AAC3E,QAAI,CAAC,UAAU,CAAC,SAAS;AACrB;AAAA,IACJ;AACA,UAAM,UAAU,YAAY,YAAY,WAAW,SAAS,MAAM,QAAQ;AAC1E,UAAM,WAAW,YAAY,aAAa,WAAW,SAAS,MAAM,QAAQ;AAE5E,UAAM,CAAC,EAAE,aAAa,0BAA0B,EAAE,gBAAgB,IAAI,MAAM,QAAQ,IAAI,CAAC,OAAO,8BAAqB,GAAG,OAAO,+BAAgC,CAAC,CAAC;AACjK,UAAM,OAAO,YAAY,MAAM,UAAU,KAAK,MAAM,SAAS,cAAc,WAAW,gBAAgB;AACtG,UAAM,WAAW,uBAAuB,IAAI;AAC5C,SAAK,WAAW,eAAe,IAAI,SAAS,QAAQ,SAAS,KAAK,WAAW,QAAQ,UAAU,SAAS,QAAQ;AAAA,EACpH;AACJ;"}
|
|
@@ -6,7 +6,7 @@ const feature = {
|
|
|
6
6
|
if (!(variantNames == null ? void 0 : variantNames.length)) {
|
|
7
7
|
return {};
|
|
8
8
|
}
|
|
9
|
-
const { loadVariantMaterials } = await import("./gltf-variants-
|
|
9
|
+
const { loadVariantMaterials } = await import("./gltf-variants-CPxNdtP4.js");
|
|
10
10
|
const materialVariants = await loadVariantMaterials(ctx._json, ctx._binChunk, ctx._baseUrl, variantNames, meshes, ctx._engine, ctx._matExts, ctx._wrapTex);
|
|
11
11
|
return { materialVariants };
|
|
12
12
|
}
|
|
@@ -14,4 +14,4 @@ const feature = {
|
|
|
14
14
|
export {
|
|
15
15
|
feature as default
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=gltf-feature-variants-
|
|
17
|
+
//# sourceMappingURL=gltf-feature-variants-Cmzu0O0e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-variants-
|
|
1
|
+
{"version":3,"file":"gltf-feature-variants-Cmzu0O0e.js","sources":["../src/loader-gltf/gltf-feature-variants.ts"],"sourcesContent":["/** KHR_materials_variants feature.\n * Triggered when the root extension carries variant definitions. Per-asset\n * hook builds variant material data shared with the material-ext driver. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\n\nconst feature: GltfFeature = {\n id: \"KHR_materials_variants\",\n async applyAsset(meshes, _root, ctx) {\n const variantNames: string[] | undefined = ctx._json.extensions?.KHR_materials_variants?.variants?.map((v: { name: string }) => v.name);\n if (!variantNames?.length) {\n return {};\n }\n const { loadVariantMaterials } = await import(\"./gltf-variants.js\");\n const materialVariants = await loadVariantMaterials(ctx._json, ctx._binChunk, ctx._baseUrl, variantNames, meshes, ctx._engine, ctx._matExts, ctx._wrapTex);\n return { materialVariants };\n },\n};\nexport default feature;\n"],"names":[],"mappings":"AAMA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,WAAW,QAAQ,OAAO,KAAK;AAFzC;AAGQ,UAAM,gBAAqC,qBAAI,MAAM,eAAV,mBAAsB,2BAAtB,mBAA8C,aAA9C,mBAAwD,IAAI,CAAC,MAAwB,EAAE;AAClI,QAAI,EAAC,6CAAc,SAAQ;AACvB,aAAO,CAAA;AAAA,IACX;AACA,UAAM,EAAE,qBAAA,IAAyB,MAAM,OAAO,6BAAoB;AAClE,UAAM,mBAAmB,MAAM,qBAAqB,IAAI,OAAO,IAAI,WAAW,IAAI,UAAU,cAAc,QAAQ,IAAI,SAAS,IAAI,UAAU,IAAI,QAAQ;AACzJ,WAAO,EAAE,iBAAA;AAAA,EACb;AACJ;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { D as DV, e as U8 } from "./index-CLElg2Bo.js";
|
|
1
2
|
function parseGlbContainer(buffer) {
|
|
2
|
-
const view = new
|
|
3
|
+
const view = new DV(buffer);
|
|
3
4
|
const magic = view.getUint32(0, true);
|
|
4
5
|
if (magic !== 1179937895) {
|
|
5
6
|
throw new Error("Not a valid GLB file");
|
|
@@ -10,7 +11,7 @@ function parseGlbContainer(buffer) {
|
|
|
10
11
|
if (jsonType !== 1313821514) {
|
|
11
12
|
throw new Error("First GLB chunk is not JSON");
|
|
12
13
|
}
|
|
13
|
-
const jsonStr = new TextDecoder().decode(new
|
|
14
|
+
const jsonStr = new TextDecoder().decode(new U8(buffer, offset + 8, jsonLength));
|
|
14
15
|
const json = JSON.parse(jsonStr);
|
|
15
16
|
offset += 8 + jsonLength;
|
|
16
17
|
const binLength = view.getUint32(offset, true);
|
|
@@ -18,10 +19,10 @@ function parseGlbContainer(buffer) {
|
|
|
18
19
|
if (binType !== 5130562) {
|
|
19
20
|
throw new Error("Second GLB chunk is not BIN");
|
|
20
21
|
}
|
|
21
|
-
const binChunk = new
|
|
22
|
+
const binChunk = new DV(buffer, offset + 8, binLength);
|
|
22
23
|
return { json, binChunk };
|
|
23
24
|
}
|
|
24
25
|
export {
|
|
25
26
|
parseGlbContainer
|
|
26
27
|
};
|
|
27
|
-
//# sourceMappingURL=gltf-glb-parser-
|
|
28
|
+
//# sourceMappingURL=gltf-glb-parser-Cj5MHS-v.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-glb-parser-Cj5MHS-v.js","sources":["../src/loader-gltf/gltf-glb-parser.ts"],"sourcesContent":["import { U8, DV } from \"../engine/typed-arrays.js\";\n/** GLB binary container parsing. Kept separate so .gltf-only scenes do not ship it. */\n\nexport function parseGlbContainer(buffer: ArrayBuffer): { json: any; binChunk: DataView } {\n const view = new DV(buffer);\n\n // Header (12 bytes)\n const magic = view.getUint32(0, true);\n if (magic !== 0x46546c67) {\n throw new Error(\"Not a valid GLB file\");\n }\n // const version = view.getUint32(4, true);\n // const totalLength = view.getUint32(8, true);\n\n // JSON chunk\n let offset = 12;\n const jsonLength = view.getUint32(offset, true);\n const jsonType = view.getUint32(offset + 4, true);\n if (jsonType !== 0x4e4f534a) {\n throw new Error(\"First GLB chunk is not JSON\");\n }\n const jsonStr = new TextDecoder().decode(new U8(buffer, offset + 8, jsonLength));\n const json = JSON.parse(jsonStr);\n offset += 8 + jsonLength;\n\n // BIN chunk\n const binLength = view.getUint32(offset, true);\n const binType = view.getUint32(offset + 4, true);\n if (binType !== 0x004e4942) {\n throw new Error(\"Second GLB chunk is not BIN\");\n }\n const binChunk = new DV(buffer, offset + 8, binLength);\n\n return { json, binChunk };\n}\n"],"names":[],"mappings":";AAGO,SAAS,kBAAkB,QAAwD;AACtF,QAAM,OAAO,IAAI,GAAG,MAAM;AAG1B,QAAM,QAAQ,KAAK,UAAU,GAAG,IAAI;AACpC,MAAI,UAAU,YAAY;AACtB,UAAM,IAAI,MAAM,sBAAsB;AAAA,EAC1C;AAKA,MAAI,SAAS;AACb,QAAM,aAAa,KAAK,UAAU,QAAQ,IAAI;AAC9C,QAAM,WAAW,KAAK,UAAU,SAAS,GAAG,IAAI;AAChD,MAAI,aAAa,YAAY;AACzB,UAAM,IAAI,MAAM,6BAA6B;AAAA,EACjD;AACA,QAAM,UAAU,IAAI,YAAA,EAAc,OAAO,IAAI,GAAG,QAAQ,SAAS,GAAG,UAAU,CAAC;AAC/E,QAAM,OAAO,KAAK,MAAM,OAAO;AAC/B,YAAU,IAAI;AAGd,QAAM,YAAY,KAAK,UAAU,QAAQ,IAAI;AAC7C,QAAM,UAAU,KAAK,UAAU,SAAS,GAAG,IAAI;AAC/C,MAAI,YAAY,SAAY;AACxB,UAAM,IAAI,MAAM,6BAA6B;AAAA,EACjD;AACA,QAAM,WAAW,IAAI,GAAG,QAAQ,SAAS,GAAG,SAAS;AAErD,SAAO,EAAE,MAAM,SAAA;AACnB;"}
|