@babylonjs/lite 1.0.0 → 1.1.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/LICENSE +201 -0
- package/README.md +51 -0
- package/THIRD_PARTY_NOTICES.txt +318 -0
- package/{_mat4-storage-f64-CjDoht2w.js → _mat4-storage-f64-WeexU-hd.js} +2 -2
- package/{_mat4-storage-f64-CjDoht2w.js.map → _mat4-storage-f64-WeexU-hd.js.map} +1 -1
- package/{alpha-test-fragment-B7DjSnF7.js → alpha-test-fragment-x2mnjLgC.js} +2 -2
- package/{alpha-test-fragment-B7DjSnF7.js.map → alpha-test-fragment-x2mnjLgC.js.map} +1 -1
- package/{background-dds-skybox-BEX309u3.js → background-dds-skybox-BpcDr-9c.js} +3 -3
- package/{background-dds-skybox-BEX309u3.js.map → background-dds-skybox-BpcDr-9c.js.map} +1 -1
- package/{background-ground-BU0HOcM4.js → background-ground-Bm6gjWqx.js} +2 -2
- package/{background-ground-BU0HOcM4.js.map → background-ground-Bm6gjWqx.js.map} +1 -1
- package/{background-hdr-skybox--RRRic_K.js → background-hdr-skybox-CSFo8RX6.js} +3 -3
- package/{background-hdr-skybox--RRRic_K.js.map → background-hdr-skybox-CSFo8RX6.js.map} +1 -1
- package/{background-solid-skybox-BrH2fXSu.js → background-solid-skybox-DOOBeDIz.js} +2 -2
- package/{background-solid-skybox-BrH2fXSu.js.map → background-solid-skybox-DOOBeDIz.js.map} +1 -1
- package/{billboard-renderable-BHWryAeC.js → billboard-renderable-IJfCpeDS.js} +2 -2
- package/{billboard-renderable-BHWryAeC.js.map → billboard-renderable-IJfCpeDS.js.map} +1 -1
- package/{clamp-block-DqbwnQGW.js → clamp-block-BD_t8I89.js} +2 -2
- package/{clamp-block-DqbwnQGW.js.map → clamp-block-BD_t8I89.js.map} +1 -1
- package/{clearcoat-fragment-D6FSCie1.js → clearcoat-fragment-Dj7vGX2u.js} +2 -2
- package/{clearcoat-fragment-D6FSCie1.js.map → clearcoat-fragment-Dj7vGX2u.js.map} +1 -1
- package/{create-skeleton-D_uplboC.js → create-skeleton-s0hjrC3A.js} +2 -2
- package/{create-skeleton-D_uplboC.js.map → create-skeleton-s0hjrC3A.js.map} +1 -1
- package/{cubemap-skybox-material-DQcMMdf-.js → cubemap-skybox-material-8lzbgi7K.js} +2 -2
- package/{cubemap-skybox-material-DQcMMdf-.js.map → cubemap-skybox-material-8lzbgi7K.js.map} +1 -1
- package/{curve-block-21rT0JjG.js → curve-block-Ditr4R7V.js} +2 -2
- package/{curve-block-21rT0JjG.js.map → curve-block-Ditr4R7V.js.map} +1 -1
- package/{emissive-fragment-C5FtBs3y.js → emissive-fragment-BOAezkfk.js} +2 -2
- package/{emissive-fragment-C5FtBs3y.js.map → emissive-fragment-BOAezkfk.js.map} +1 -1
- package/{esm-shadow-view-c5YV4Eg9.js → esm-shadow-view-DRpyRAfa.js} +2 -2
- package/{esm-shadow-view-c5YV4Eg9.js.map → esm-shadow-view-DRpyRAfa.js.map} +1 -1
- package/{esm-shadow-view-Gtd1LWRP.js → esm-shadow-view-DmIORQGZ.js} +2 -2
- package/{esm-shadow-view-Gtd1LWRP.js.map → esm-shadow-view-DmIORQGZ.js.map} +1 -1
- package/{esm-shadow-view-Cl3rPGof.js → esm-shadow-view-JCPaOOi7.js} +2 -2
- package/{esm-shadow-view-Cl3rPGof.js.map → esm-shadow-view-JCPaOOi7.js.map} +1 -1
- package/{gaussian-splatting-pipeline-sh-7J31V23x.js → gaussian-splatting-pipeline-sh-B30Mu56i.js} +2 -2
- package/{gaussian-splatting-pipeline-sh-7J31V23x.js.map → gaussian-splatting-pipeline-sh-B30Mu56i.js.map} +1 -1
- package/{geometry-texture-output-dXk4E9uu.js → geometry-texture-output-DURiaJ_n.js} +2 -2
- package/{geometry-texture-output-dXk4E9uu.js.map → geometry-texture-output-DURiaJ_n.js.map} +1 -1
- package/{geometry-view-BsFJpBJa.js → geometry-view-DRrscyWU.js} +4 -4
- package/{geometry-view-BsFJpBJa.js.map → geometry-view-DRrscyWU.js.map} +1 -1
- package/{gltf-animation-K_zZxj_d.js → gltf-animation-BjnXkop6.js} +2 -2
- package/{gltf-animation-K_zZxj_d.js.map → gltf-animation-BjnXkop6.js.map} +1 -1
- package/{gltf-ext-basisu-CDbPclzZ.js → gltf-ext-basisu-DtzVV1Xx.js} +2 -202
- package/gltf-ext-basisu-DtzVV1Xx.js.map +1 -0
- package/{gltf-ext-node-visibility-DXCJEYr6.js → gltf-ext-node-visibility-BhX0DmiP.js} +2 -2
- package/{gltf-ext-node-visibility-DXCJEYr6.js.map → gltf-ext-node-visibility-BhX0DmiP.js.map} +1 -1
- package/{gltf-ext-quantization-CvHI_0Vg.js → gltf-ext-quantization-DaymajCR.js} +2 -2
- package/{gltf-ext-quantization-CvHI_0Vg.js.map → gltf-ext-quantization-DaymajCR.js.map} +1 -1
- package/{gltf-ext-uv-transform-DgYazJBs.js → gltf-ext-uv-transform-DFmNJ8kA.js} +2 -2
- package/{gltf-ext-uv-transform-DgYazJBs.js.map → gltf-ext-uv-transform-DFmNJ8kA.js.map} +1 -1
- package/{gltf-feature-animation-pointer-D1RJRFBw.js → gltf-feature-animation-pointer-C40tqOhL.js} +3 -3
- package/{gltf-feature-animation-pointer-D1RJRFBw.js.map → gltf-feature-animation-pointer-C40tqOhL.js.map} +1 -1
- package/{gltf-feature-animations-Cmc1uoIu.js → gltf-feature-animations-v0S_yb4T.js} +2 -2
- package/{gltf-feature-animations-Cmc1uoIu.js.map → gltf-feature-animations-v0S_yb4T.js.map} +1 -1
- package/{gltf-feature-draco-CKKzT5E3.js → gltf-feature-draco-CljWrsna.js} +2 -2
- package/{gltf-feature-draco-CKKzT5E3.js.map → gltf-feature-draco-CljWrsna.js.map} +1 -1
- package/{gltf-feature-gpu-instancing-n87SO6Vh.js → gltf-feature-gpu-instancing-BoeSm6Tn.js} +2 -2
- package/{gltf-feature-gpu-instancing-n87SO6Vh.js.map → gltf-feature-gpu-instancing-BoeSm6Tn.js.map} +1 -1
- package/{gltf-feature-lights-punctual-Ckm3ciL8.js → gltf-feature-lights-punctual-BCTwgyi_.js} +5 -5
- package/{gltf-feature-lights-punctual-Ckm3ciL8.js.map → gltf-feature-lights-punctual-BCTwgyi_.js.map} +1 -1
- package/{gltf-feature-meshopt-DLC4SF1E.js → gltf-feature-meshopt-DItMkOMt.js} +2 -2
- package/{gltf-feature-meshopt-DLC4SF1E.js.map → gltf-feature-meshopt-DItMkOMt.js.map} +1 -1
- package/{gltf-feature-morph-Cjtu7hYa.js → gltf-feature-morph-Cv0mEYIq.js} +3 -3
- package/{gltf-feature-morph-Cjtu7hYa.js.map → gltf-feature-morph-Cv0mEYIq.js.map} +1 -1
- package/{gltf-feature-registry-C63Hjp9w.js → gltf-feature-registry-wNbt6UC-.js} +15 -15
- package/{gltf-feature-registry-C63Hjp9w.js.map → gltf-feature-registry-wNbt6UC-.js.map} +1 -1
- package/{gltf-feature-skeleton-DKbOGidp.js → gltf-feature-skeleton-Deh2UBAn.js} +3 -3
- package/{gltf-feature-skeleton-DKbOGidp.js.map → gltf-feature-skeleton-Deh2UBAn.js.map} +1 -1
- package/{gltf-feature-variants-Cmzu0O0e.js → gltf-feature-variants-DGSdFNJq.js} +2 -2
- package/{gltf-feature-variants-Cmzu0O0e.js.map → gltf-feature-variants-DGSdFNJq.js.map} +1 -1
- package/{gltf-glb-parser-Cj5MHS-v.js → gltf-glb-parser-DSQWsT4r.js} +2 -2
- package/{gltf-glb-parser-Cj5MHS-v.js.map → gltf-glb-parser-DSQWsT4r.js.map} +1 -1
- package/{gltf-interleave-gHf9_t0i.js → gltf-interleave-OBqmlu-h.js} +11 -5
- package/gltf-interleave-OBqmlu-h.js.map +1 -0
- package/{gltf-normals-b2h74380.js → gltf-normals-D_P0KA4b.js} +10 -2
- package/gltf-normals-D_P0KA4b.js.map +1 -0
- package/{gltf-pbr-builder-ext-edNcjwPf.js → gltf-pbr-builder-ext-3imk8Tev.js} +2 -2
- package/{gltf-pbr-builder-ext-edNcjwPf.js.map → gltf-pbr-builder-ext-3imk8Tev.js.map} +1 -1
- package/{gltf-variants-CPxNdtP4.js → gltf-variants-Dyr54wwg.js} +4 -4
- package/{gltf-variants-CPxNdtP4.js.map → gltf-variants-Dyr54wwg.js.map} +1 -1
- package/gpu-task-timer-DVBNZfq5.js +236 -0
- package/gpu-task-timer-DVBNZfq5.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-CERN-Trj.js} +2 -2
- package/{gs-picking-pipeline-DYaW_Lg3.js.map → gs-picking-pipeline-CERN-Trj.js.map} +1 -1
- package/{havok-floating-origin-Dr-18Nds.js → havok-floating-origin-VVdJRUYc.js} +2 -2
- package/{havok-floating-origin-Dr-18Nds.js.map → havok-floating-origin-VVdJRUYc.js.map} +1 -1
- package/{index-CYZDclhF.js → index-7Bk-uLSM.js} +2 -2
- package/{index-CYZDclhF.js.map → index-7Bk-uLSM.js.map} +1 -1
- package/{index-CLElg2Bo.js → index-BgY3QEzL.js} +4774 -1276
- package/index-BgY3QEzL.js.map +1 -0
- package/{index-SMJ67XwT.js → index-Dr5LK2tg.js} +2 -2
- package/{index-SMJ67XwT.js.map → index-Dr5LK2tg.js.map} +1 -1
- package/index.d.ts +1047 -13
- package/index.js +508 -444
- package/{input-block-DqEedWF2.js → input-block-DjdlndCL.js} +2 -2
- package/{input-block-DqEedWF2.js.map → input-block-DjdlndCL.js.map} +1 -1
- package/{iridescence-fragment-BHU59-gQ.js → iridescence-fragment-kfsCs8lN.js} +2 -2
- package/{iridescence-fragment-BHU59-gQ.js.map → iridescence-fragment-kfsCs8lN.js.map} +1 -1
- package/{light-block-Bv37V8vl.js → light-block-qjCrz3de.js} +2 -2
- package/{light-block-Bv37V8vl.js.map → light-block-qjCrz3de.js.map} +1 -1
- package/{loop-block-qTg8vb99.js → loop-block-C8vkQ2bz.js} +2 -2
- package/{loop-block-qTg8vb99.js.map → loop-block-C8vkQ2bz.js.map} +1 -1
- package/{manifold-AS8POaOr.js → manifold-DeXMNgxT.js} +3 -3
- package/{manifold-AS8POaOr.js.map → manifold-DeXMNgxT.js.map} +1 -1
- package/{morph-fragment-BRCUr2wQ.js → morph-fragment-NpZYyIIU.js} +2 -2
- package/{morph-fragment-BRCUr2wQ.js.map → morph-fragment-NpZYyIIU.js.map} +1 -1
- package/{multilight-wgsl-DMeppAdZ.js → multilight-wgsl-I5SncF0q.js} +2 -2
- package/{multilight-wgsl-DMeppAdZ.js.map → multilight-wgsl-I5SncF0q.js.map} +1 -1
- package/{node-env-Bc559GmY.js → node-env-D7Aee08u.js} +2 -2
- package/{node-env-Bc559GmY.js.map → node-env-D7Aee08u.js.map} +1 -1
- package/{node-geometry-view-COmWsRXK.js → node-geometry-view-DfKXWNfV.js} +3 -3
- package/{node-geometry-view-COmWsRXK.js.map → node-geometry-view-DfKXWNfV.js.map} +1 -1
- package/{node-registry-extra-compat-dWrv7gpS.js → node-registry-extra-compat-CDLeBR1P.js} +2 -2
- package/{node-registry-extra-compat-dWrv7gpS.js.map → node-registry-extra-compat-CDLeBR1P.js.map} +1 -1
- package/{node-registry-extra-math-Bn854sX9.js → node-registry-extra-math-BA8_l4lB.js} +2 -2
- package/{node-registry-extra-math-Bn854sX9.js.map → node-registry-extra-math-BA8_l4lB.js.map} +1 -1
- package/{node-renderable-B5G8WcdH.js → node-renderable-EwLLnaL1.js} +2 -2
- package/{node-renderable-B5G8WcdH.js.map → node-renderable-EwLLnaL1.js.map} +1 -1
- package/{node-shadow-CVIUlNf0.js → node-shadow-CeTmT6g4.js} +2 -2
- package/{node-shadow-CVIUlNf0.js.map → node-shadow-CeTmT6g4.js.map} +1 -1
- package/{normal-map-fragment-CQSxhjCy.js → normal-map-fragment-BHImLyM-.js} +2 -2
- package/{normal-map-fragment-CQSxhjCy.js.map → normal-map-fragment-BHImLyM-.js.map} +1 -1
- package/package.json +10 -3
- package/{parse-camera-pBRT_6i5.js → parse-camera-5IGdctAS.js} +2 -2
- package/{parse-camera-pBRT_6i5.js.map → parse-camera-5IGdctAS.js.map} +1 -1
- package/{pbr-geometry-view-NiZY_juX.js → pbr-geometry-view-Dthf9Aut.js} +3 -3
- package/{pbr-geometry-view-NiZY_juX.js.map → pbr-geometry-view-Dthf9Aut.js.map} +1 -1
- package/{pbr-metallic-roughness-block-full-Ta9lR2cz.js → pbr-metallic-roughness-block-full-DD6zI_Lx.js} +2 -2
- package/{pbr-metallic-roughness-block-full-Ta9lR2cz.js.map → pbr-metallic-roughness-block-full-DD6zI_Lx.js.map} +1 -1
- package/{pbr-metallic-roughness-block-JBSi-tQN.js → pbr-metallic-roughness-block-g7wjzwN_.js} +2 -2
- package/{pbr-metallic-roughness-block-JBSi-tQN.js.map → pbr-metallic-roughness-block-g7wjzwN_.js.map} +1 -1
- package/{pbr-mr-helper-core-BVWNR08D.js → pbr-mr-helper-core-CWROQ7OA.js} +2 -2
- package/{pbr-mr-helper-core-BVWNR08D.js.map → pbr-mr-helper-core-CWROQ7OA.js.map} +1 -1
- package/{pbr-refraction-C9FvFmAp.js → pbr-refraction-Dxsm_gii.js} +2 -2
- package/{pbr-refraction-C9FvFmAp.js.map → pbr-refraction-Dxsm_gii.js.map} +1 -1
- package/{pbr-renderable-DzUF2QIk.js → pbr-renderable-CuKWalEM.js} +22 -22
- package/{pbr-renderable-DzUF2QIk.js.map → pbr-renderable-CuKWalEM.js.map} +1 -1
- package/{pbr-shadow-fragment-CnqnbGYS.js → pbr-shadow-fragment-waeIBQUq.js} +2 -2
- package/{pbr-shadow-fragment-CnqnbGYS.js.map → pbr-shadow-fragment-waeIBQUq.js.map} +1 -1
- package/{pbr-tracking-3tU1kqea.js → pbr-tracking-CdeqbBrh.js} +2 -2
- package/{pbr-tracking-3tU1kqea.js.map → pbr-tracking-CdeqbBrh.js.map} +1 -1
- package/{pbr-transmission-ext-BcLjRxfB.js → pbr-transmission-ext-BNiXngZc.js} +2 -2
- package/{pbr-transmission-ext-BcLjRxfB.js.map → pbr-transmission-ext-BNiXngZc.js.map} +1 -1
- package/{recast-navigation.wasm-DG_0AFuk.js → recast-navigation.wasm-VC4lGlEe.js} +3 -3
- package/{recast-navigation.wasm-DG_0AFuk.js.map → recast-navigation.wasm-VC4lGlEe.js.map} +1 -1
- package/{recast-navigation.wasm-compat-C-Bf2ylB.js → recast-navigation.wasm-compat-CTwYOzRz.js} +3 -3
- package/{recast-navigation.wasm-compat-C-Bf2ylB.js.map → recast-navigation.wasm-compat-CTwYOzRz.js.map} +1 -1
- package/{reflectance-fragment-Dbpgw3Jt.js → reflectance-fragment-BQFZ_pgy.js} +2 -2
- package/{reflectance-fragment-Dbpgw3Jt.js.map → reflectance-fragment-BQFZ_pgy.js.map} +1 -1
- package/{rgbd-decode-DoyUquy3.js → rgbd-decode-duTlXMWd.js} +2 -2
- package/{rgbd-decode-DoyUquy3.js.map → rgbd-decode-duTlXMWd.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-DnxR4rhp.js} +2 -2
- package/{screenshot-readback-D0Sj9qq3.js.map → screenshot-readback-DnxR4rhp.js.map} +1 -1
- package/{shader-composer-BUD_pSX4.js → shader-composer-CBy2i8nU.js} +2 -2
- package/{shader-composer-BUD_pSX4.js.map → shader-composer-CBy2i8nU.js.map} +1 -1
- package/{shader-renderable-D7-RyVxa.js → shader-renderable-DVMVD6zP.js} +41 -9
- package/shader-renderable-DVMVD6zP.js.map +1 -0
- package/{shader-thin-instance-DuBotxDO.js → shader-thin-instance-CsDo3ULk.js} +2 -2
- package/{shader-thin-instance-DuBotxDO.js.map → shader-thin-instance-CsDo3ULk.js.map} +1 -1
- package/{sheen-fragment-1MkEMcbc.js → sheen-fragment-B_Jd7wrr.js} +2 -2
- package/{sheen-fragment-1MkEMcbc.js.map → sheen-fragment-B_Jd7wrr.js.map} +1 -1
- package/{singlelight-directional-wgsl-BsV8G456.js → singlelight-directional-wgsl-Bw84txva.js} +2 -2
- package/{singlelight-directional-wgsl-BsV8G456.js.map → singlelight-directional-wgsl-Bw84txva.js.map} +1 -1
- package/{singlelight-hemispheric-wgsl-Bo0jKlW5.js → singlelight-hemispheric-wgsl-DjxhgI8r.js} +2 -2
- package/{singlelight-hemispheric-wgsl-Bo0jKlW5.js.map → singlelight-hemispheric-wgsl-DjxhgI8r.js.map} +1 -1
- package/{singlelight-point-wgsl-DV39UP5Y.js → singlelight-point-wgsl-iA1aRkXA.js} +2 -2
- package/{singlelight-point-wgsl-DV39UP5Y.js.map → singlelight-point-wgsl-iA1aRkXA.js.map} +1 -1
- package/{singlelight-spot-wgsl-yg3od6vL.js → singlelight-spot-wgsl-MDdTdstF.js} +2 -2
- package/{singlelight-spot-wgsl-yg3od6vL.js.map → singlelight-spot-wgsl-MDdTdstF.js.map} +1 -1
- package/{skeleton-fragment-DdxYG6kv.js → skeleton-fragment-COdHWFcK.js} +2 -2
- package/{skeleton-fragment-DdxYG6kv.js.map → skeleton-fragment-COdHWFcK.js.map} +1 -1
- package/{skybox-renderable-CJD4XmX5.js → skybox-renderable-DJYkfw32.js} +2 -2
- package/{skybox-renderable-CJD4XmX5.js.map → skybox-renderable-DJYkfw32.js.map} +1 -1
- package/{splat-ply-compressed-DHjyiVmI.js → splat-ply-compressed-SxMlsKNK.js} +2 -2
- package/{splat-ply-compressed-DHjyiVmI.js.map → splat-ply-compressed-SxMlsKNK.js.map} +1 -1
- package/{standard-pipeline-XTbHL7MY.js → standard-pipeline-DXFOUqU_.js} +3 -3
- package/{standard-pipeline-XTbHL7MY.js.map → standard-pipeline-DXFOUqU_.js.map} +1 -1
- package/{standard-renderable-CREWLNHI.js → standard-renderable-BAc-i-ig.js} +3 -3
- package/{standard-renderable-CREWLNHI.js.map → standard-renderable-BAc-i-ig.js.map} +1 -1
- package/{std-ambient-fragment-Bjx3VFrr.js → std-ambient-fragment-P8dHZ4An.js} +2 -2
- package/{std-ambient-fragment-Bjx3VFrr.js.map → std-ambient-fragment-P8dHZ4An.js.map} +1 -1
- package/{std-cube-reflection-fragment-y9WWdXUt.js → std-cube-reflection-fragment-CF03MuQt.js} +2 -2
- package/{std-cube-reflection-fragment-y9WWdXUt.js.map → std-cube-reflection-fragment-CF03MuQt.js.map} +1 -1
- package/{std-emissive-fragment-C8Lnmojh.js → std-emissive-fragment-P8yJGclx.js} +2 -2
- package/{std-emissive-fragment-C8Lnmojh.js.map → std-emissive-fragment-P8yJGclx.js.map} +1 -1
- package/{std-lightmap-fragment-DFxGcoA5.js → std-lightmap-fragment-CymEG79z.js} +9 -6
- package/std-lightmap-fragment-CymEG79z.js.map +1 -0
- package/{std-opacity-fragment-EXzFWiSp.js → std-opacity-fragment-DLa1zV06.js} +2 -2
- package/{std-opacity-fragment-EXzFWiSp.js.map → std-opacity-fragment-DLa1zV06.js.map} +1 -1
- package/{std-reflection-fragment-BoJORqpG.js → std-reflection-fragment-BLySsYos.js} +2 -2
- package/{std-reflection-fragment-BoJORqpG.js.map → std-reflection-fragment-BLySsYos.js.map} +1 -1
- package/{std-shadow-fragment-Bq-Wc8UJ.js → std-shadow-fragment-C_q27Mdi.js} +2 -2
- package/{std-shadow-fragment-Bq-Wc8UJ.js.map → std-shadow-fragment-C_q27Mdi.js.map} +1 -1
- package/{std-specular-fragment-CM5R5j2g.js → std-specular-fragment-CaBXyAWY.js} +2 -2
- package/{std-specular-fragment-CM5R5j2g.js.map → std-specular-fragment-CaBXyAWY.js.map} +1 -1
- package/{std-tracking-Cif_wXeT.js → std-tracking-Bw61Dv98.js} +2 -2
- package/{std-tracking-Cif_wXeT.js.map → std-tracking-Bw61Dv98.js.map} +1 -1
- package/{subsurface-fragment-BEaAXYXz.js → subsurface-fragment-BNQoG9gr.js} +2 -2
- package/{subsurface-fragment-BEaAXYXz.js.map → subsurface-fragment-BNQoG9gr.js.map} +1 -1
- package/{thin-instance-cull-binding-DWKUt5ZN.js → thin-instance-cull-binding-BNC5JiGw.js} +3 -3
- package/{thin-instance-cull-binding-DWKUt5ZN.js.map → thin-instance-cull-binding-BNC5JiGw.js.map} +1 -1
- package/{thin-instance-gpu-BDdRcNAh.js → thin-instance-gpu-C1DGstap.js} +2 -2
- package/{thin-instance-gpu-BDdRcNAh.js.map → thin-instance-gpu-C1DGstap.js.map} +1 -1
- package/{tracking-primitives-CglRNTlX.js → tracking-primitives-CMBWLxGr.js} +2 -2
- package/{tracking-primitives-CglRNTlX.js.map → tracking-primitives-CMBWLxGr.js.map} +1 -1
- package/{unlit-fragment-kxfZWlnp.js → unlit-fragment-BsHrS9XX.js} +2 -2
- package/{unlit-fragment-kxfZWlnp.js.map → unlit-fragment-BsHrS9XX.js.map} +1 -1
- package/gltf-ext-basisu-CDbPclzZ.js.map +0 -1
- package/gltf-interleave-gHf9_t0i.js.map +0 -1
- package/gltf-normals-b2h74380.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
- package/std-lightmap-fragment-DFxGcoA5.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { be as setSubtreeVisible } from "./index-BgY3QEzL.js";
|
|
2
2
|
function applyVisibility(json, nodeMap) {
|
|
3
3
|
var _a, _b, _c;
|
|
4
4
|
const nodes = json.nodes ?? [];
|
|
@@ -22,4 +22,4 @@ const ext = {
|
|
|
22
22
|
export {
|
|
23
23
|
ext as default
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=gltf-ext-node-visibility-
|
|
25
|
+
//# sourceMappingURL=gltf-ext-node-visibility-BhX0DmiP.js.map
|
package/{gltf-ext-node-visibility-DXCJEYr6.js.map → gltf-ext-node-visibility-BhX0DmiP.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-ext-node-visibility-
|
|
1
|
+
{"version":3,"file":"gltf-ext-node-visibility-BhX0DmiP.js","sources":["../src/loader-gltf/gltf-ext-node-visibility.ts"],"sourcesContent":["/** glTF KHR_node_visibility extension.\n *\n * Sets `node.visible = false` on SceneNodes whose glTF node has\n * `extensions.KHR_node_visibility.visible === false`, and cascades\n * through the subtree via `setSubtreeVisible` so that descendants\n * inherit the invisibility per the extension spec. The render path\n * and camera-AABB filter then skip them. Combined with\n * KHR_animation_pointer, the visible flag can also be toggled at runtime.\n *\n * Dynamically imported by load-gltf only when the asset declares the\n * extension in `extensionsUsed`, so bundles pay zero bytes otherwise. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport type { SceneNode } from \"../scene/scene-node.js\";\nimport { setSubtreeVisible } from \"../scene/visibility.js\";\n\nfunction applyVisibility(json: any, nodeMap: readonly (SceneNode | undefined)[]): void {\n const nodes = json.nodes ?? [];\n for (let i = 0; i < nodes.length; i++) {\n const vis = nodes[i]?.extensions?.KHR_node_visibility?.visible;\n const sn = nodeMap[i];\n if (vis === false && sn) {\n setSubtreeVisible(sn, false);\n }\n }\n}\n\nconst ext: GltfFeature = {\n id: \"KHR_node_visibility\",\n async applyAsset(_meshes, _root, ctx) {\n if (ctx._nodeMap) {\n applyVisibility(ctx._json, ctx._nodeMap);\n }\n return {};\n },\n};\nexport default ext;\n"],"names":[],"mappings":";AAgBA,SAAS,gBAAgB,MAAW,SAAmD;;AACnF,QAAM,QAAQ,KAAK,SAAS,CAAA;AAC5B,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACnC,UAAM,OAAM,uBAAM,CAAC,MAAP,mBAAU,eAAV,mBAAsB,wBAAtB,mBAA2C;AACvD,UAAM,KAAK,QAAQ,CAAC;AACpB,QAAI,QAAQ,SAAS,IAAI;AACrB,wBAAkB,IAAI,KAAK;AAAA,IAC/B;AAAA,EACJ;AACJ;AAEA,MAAM,MAAmB;AAAA,EACrB,IAAI;AAAA,EACJ,MAAM,WAAW,SAAS,OAAO,KAAK;AAClC,QAAI,IAAI,UAAU;AACd,sBAAgB,IAAI,OAAO,IAAI,QAAQ;AAAA,IAC3C;AACA,WAAO,CAAA;AAAA,EACX;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as U8, D as DV } from "./index-
|
|
1
|
+
import { e as U8, D as DV } from "./index-BgY3QEzL.js";
|
|
2
2
|
const BYTE = 5120;
|
|
3
3
|
const UNSIGNED_BYTE = 5121;
|
|
4
4
|
const SHORT = 5122;
|
|
@@ -92,4 +92,4 @@ const feature = {
|
|
|
92
92
|
export {
|
|
93
93
|
feature as default
|
|
94
94
|
};
|
|
95
|
-
//# sourceMappingURL=gltf-ext-quantization-
|
|
95
|
+
//# sourceMappingURL=gltf-ext-quantization-DaymajCR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-ext-quantization-
|
|
1
|
+
{"version":3,"file":"gltf-ext-quantization-DaymajCR.js","sources":["../src/loader-gltf/gltf-ext-quantization.ts"],"sourcesContent":["/**\n * KHR_mesh_quantization (+ post-meshopt) dequantization feature.\n *\n * Runs as a `preParse` hook, after EXT_meshopt_compression. The core accessor\n * reader (`resolveAccessor`) only understands tightly-packed FLOAT / UBYTE /\n * USHORT / UINT data and ignores `byteStride`; quantized assets store vertex\n * attributes (and meshopt-filtered animation outputs) as normalized or signed\n * integers, sometimes padded by a `byteStride`. This feature rewrites every such\n * accessor into a freshly-appended, tightly-packed FLOAT bufferView so the rest\n * of the loader stays completely unaware of quantization. It is dynamic-imported\n * only when `extensionsUsed` lists KHR_mesh_quantization, so non-quantized scenes\n * pay nothing.\n *\n * Conversion rule (role-agnostic, derived from the accessor alone):\n * - signed component types (BYTE/SHORT) → FLOAT (core would otherwise throw)\n * - `normalized` accessors → FLOAT (core would otherwise read raw ints)\n * - strided FLOAT accessors → tightly-packed FLOAT (core ignores byteStride)\n * Unsigned non-normalized integer accessors (JOINTS_0, indices) are left intact:\n * they are already tight and the skeleton / index paths expect integers.\n */\n\nimport { U8, DV } from \"../engine/typed-arrays.js\";\nimport type { GltfFeature } from \"./gltf-feature.js\";\n\nconst BYTE = 5120;\nconst UNSIGNED_BYTE = 5121;\nconst SHORT = 5122;\nconst UNSIGNED_SHORT = 5123;\nconst FLOAT = 5126;\n\nconst TYPE_COMPONENTS: Record<string, number> = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 };\nconst COMPONENT_BYTES: Record<number, number> = { 5120: 1, 5121: 1, 5122: 2, 5123: 2, 5125: 4, 5126: 4 };\n\ninterface Accessor {\n bufferView?: number;\n byteOffset?: number;\n componentType: number;\n normalized?: boolean;\n count: number;\n type: string;\n}\n\ninterface BufferView {\n buffer?: number;\n byteOffset?: number;\n byteLength: number;\n byteStride?: number;\n}\n\nfunction align4(n: number): number {\n return (n + 3) & ~3;\n}\n\n/** Read one component as a float, applying glTF normalization when requested. */\nfunction readComponent(view: DataView, offset: number, componentType: number, normalized: boolean): number {\n switch (componentType) {\n case BYTE: {\n const c = view.getInt8(offset);\n return normalized ? Math.max(c / 127, -1) : c;\n }\n case UNSIGNED_BYTE: {\n const c = view.getUint8(offset);\n return normalized ? c / 255 : c;\n }\n case SHORT: {\n const c = view.getInt16(offset, true);\n return normalized ? Math.max(c / 32767, -1) : c;\n }\n case UNSIGNED_SHORT: {\n const c = view.getUint16(offset, true);\n return normalized ? c / 65535 : c;\n }\n case FLOAT:\n return view.getFloat32(offset, true);\n default:\n throw new Error(`KHR_mesh_quantization: unsupported componentType ${componentType}`);\n }\n}\n\nconst feature: GltfFeature = {\n id: \"KHR_mesh_quantization\",\n async preParse(json, binChunk) {\n const accessors: Accessor[] = json.accessors ?? [];\n const bufferViews: BufferView[] = json.bufferViews ?? [];\n\n // Decide which accessors need rewriting and how many float bytes to append.\n const convert: number[] = [];\n let appended = 0;\n for (let i = 0; i < accessors.length; i++) {\n const a = accessors[i]!;\n if (a.bufferView === undefined) {\n continue;\n }\n const componentCount = TYPE_COMPONENTS[a.type] ?? 1;\n const stride = bufferViews[a.bufferView]?.byteStride;\n const signed = a.componentType === BYTE || a.componentType === SHORT;\n const stridedFloat = a.componentType === FLOAT && stride !== undefined && stride !== componentCount * 4;\n if (signed || a.normalized === true || stridedFloat) {\n convert.push(i);\n appended = align4(appended + a.count * componentCount * 4);\n }\n }\n\n if (convert.length === 0) {\n return;\n }\n\n // Build a new buffer: existing data (normalized to offset 0) + appended floats.\n const baseLen = align4(binChunk.byteLength);\n const out = new ArrayBuffer(baseLen + appended);\n new U8(out).set(new U8(binChunk.buffer, binChunk.byteOffset, binChunk.byteLength));\n const outView = new DV(out);\n\n let cursor = baseLen;\n for (const i of convert) {\n const a = accessors[i]!;\n const bv = bufferViews[a.bufferView!]!;\n const componentCount = TYPE_COMPONENTS[a.type] ?? 1;\n const compBytes = COMPONENT_BYTES[a.componentType]!;\n const stride = bv.byteStride ?? componentCount * compBytes;\n // bufferView/accessor byteOffsets are relative to the DataView's own\n // byteOffset (DataView getters add it back), matching resolveAccessor.\n const srcBase = (bv.byteOffset ?? 0) + (a.byteOffset ?? 0);\n\n const dstOffset = cursor;\n for (let v = 0; v < a.count; v++) {\n for (let c = 0; c < componentCount; c++) {\n const value = readComponent(binChunk, srcBase + v * stride + c * compBytes, a.componentType, !!a.normalized);\n outView.setFloat32(dstOffset + (v * componentCount + c) * 4, value, true);\n }\n }\n\n const byteLength = a.count * componentCount * 4;\n const newBvIndex = bufferViews.length;\n bufferViews.push({ buffer: 0, byteOffset: dstOffset, byteLength });\n a.bufferView = newBvIndex;\n a.byteOffset = 0;\n a.componentType = FLOAT;\n a.normalized = false;\n cursor = align4(cursor + byteLength);\n }\n\n return outView;\n },\n};\n\nexport default feature;\n"],"names":[],"mappings":";AAwBA,MAAM,OAAO;AACb,MAAM,gBAAgB;AACtB,MAAM,QAAQ;AACd,MAAM,iBAAiB;AACvB,MAAM,QAAQ;AAEd,MAAM,kBAA0C,EAAE,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AAE,QAAQ,iBAAiB;AAC9C,YAAM,aAAa,YAAY;AAC/B,kBAAY,KAAK,EAAE,QAAQ,GAAG,YAAY,WAAW,YAAY;AACjE,QAAE,aAAa;AACf,QAAE,aAAa;AACf,QAAE,gBAAgB;AAClB,QAAE,aAAa;AACf,eAAS,OAAO,SAAS,UAAU;AAAA,IACvC;AAEA,WAAO;AAAA,EACX;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as cloneTexture2D } from "./index-
|
|
1
|
+
import { v as cloneTexture2D } from "./index-BgY3QEzL.js";
|
|
2
2
|
const ext = {
|
|
3
3
|
id: "KHR_texture_transform",
|
|
4
4
|
wrapTexture(tex, texInfo) {
|
|
@@ -35,4 +35,4 @@ const ext = {
|
|
|
35
35
|
export {
|
|
36
36
|
ext as default
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=gltf-ext-uv-transform-
|
|
38
|
+
//# sourceMappingURL=gltf-ext-uv-transform-DFmNJ8kA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-ext-uv-transform-
|
|
1
|
+
{"version":3,"file":"gltf-ext-uv-transform-DFmNJ8kA.js","sources":["../src/loader-gltf/gltf-ext-uv-transform.ts"],"sourcesContent":["/** Per-textureInfo UV customization: KHR_texture_transform and/or texCoord=1.\n *\n * - Attaches `uScale/vScale/uOffset/vOffset/uAng` + `_hasTx=true` when the\n * textureInfo carries a KHR_texture_transform.\n * - Attaches `_texCoord=1` when the textureInfo (or its transform extension)\n * selects UV set 1. Spec: KHR_texture_transform.texCoord overrides\n * textureInfo.texCoord.\n *\n * Downstream the PBR material detects these fields and compiles a shader\n * with per-texture `txfUV` wrapping and per-texture UV selection. Identity\n * (no transform, texCoord=0) returns the base texture unchanged so the\n * cache reuses the same wrapper.\n *\n * Lazy-loaded: pulled into bundles whose glTF declares KHR_texture_transform\n * in `extensionsUsed` OR uses `texCoord:1` on any textureInfo. */\nimport type { Texture2D } from \"../texture/texture-2d.js\";\nimport { cloneTexture2D } from \"../texture/texture-2d.js\";\nimport type { GltfFeature } from \"./gltf-feature.js\";\n\ninterface KtInfo {\n texCoord?: number;\n extensions?: {\n KHR_texture_transform?: {\n scale?: [number, number];\n offset?: [number, number];\n rotation?: number;\n texCoord?: number;\n };\n };\n}\n\nconst ext: GltfFeature = {\n id: \"KHR_texture_transform\",\n wrapTexture(tex: Texture2D, texInfo: unknown): Texture2D {\n const info = texInfo as KtInfo | null | undefined;\n if (!info) {\n return tex;\n }\n const kt = info.extensions?.KHR_texture_transform;\n const patch: { uScale?: number; vScale?: number; uOffset?: number; vOffset?: number; uAng?: number; _hasTx?: true; _texCoord?: 0 | 1 } = {};\n if (kt) {\n if (kt.scale) {\n patch.uScale = kt.scale[0];\n patch.vScale = kt.scale[1];\n }\n if (kt.offset) {\n patch.uOffset = kt.offset[0];\n patch.vOffset = kt.offset[1];\n }\n if (kt.rotation) {\n patch.uAng = kt.rotation;\n }\n if (Object.keys(patch).length) {\n patch._hasTx = true;\n }\n }\n // Spec: KHR_texture_transform.texCoord overrides textureInfo.texCoord.\n const tc = kt?.texCoord ?? info.texCoord;\n if (tc === 1) {\n patch._texCoord = 1;\n }\n return Object.keys(patch).length ? cloneTexture2D(tex, patch) : tex;\n },\n};\nexport default ext;\n"],"names":[],"mappings":";AA+BA,MAAM,MAAmB;AAAA,EACrB,IAAI;AAAA,EACJ,YAAY,KAAgB,SAA6B;;AACrD,UAAM,OAAO;AACb,QAAI,CAAC,MAAM;AACP,aAAO;AAAA,IACX;AACA,UAAM,MAAK,UAAK,eAAL,mBAAiB;AAC5B,UAAM,QAAmI,CAAA;AACzI,QAAI,IAAI;AACJ,UAAI,GAAG,OAAO;AACV,cAAM,SAAS,GAAG,MAAM,CAAC;AACzB,cAAM,SAAS,GAAG,MAAM,CAAC;AAAA,MAC7B;AACA,UAAI,GAAG,QAAQ;AACX,cAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,cAAM,UAAU,GAAG,OAAO,CAAC;AAAA,MAC/B;AACA,UAAI,GAAG,UAAU;AACb,cAAM,OAAO,GAAG;AAAA,MACpB;AACA,UAAI,OAAO,KAAK,KAAK,EAAE,QAAQ;AAC3B,cAAM,SAAS;AAAA,MACnB;AAAA,IACJ;AAEA,UAAM,MAAK,yBAAI,aAAY,KAAK;AAChC,QAAI,OAAO,GAAG;AACV,YAAM,YAAY;AAAA,IACtB;AACA,WAAO,OAAO,KAAK,KAAK,EAAE,SAAS,eAAe,KAAK,KAAK,IAAI;AAAA,EACpE;AACJ;"}
|
package/{gltf-feature-animation-pointer-D1RJRFBw.js → gltf-feature-animation-pointer-C40tqOhL.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _installPointerHandlers } from "./gltf-animation-
|
|
1
|
+
import { be as setSubtreeVisible, a as F32, e as U8, j as U16, bW as I8, bX as I16, bY as PATH_POINTER } from "./index-BgY3QEzL.js";
|
|
2
|
+
import { _installPointerHandlers } from "./gltf-animation-BjnXkop6.js";
|
|
3
3
|
const _registry = [
|
|
4
4
|
// /nodes/{n}/extensions/KHR_node_visibility/visible — scalar (0 = hidden).
|
|
5
5
|
// The setter cascade handles descendants per the KHR_node_visibility spec
|
|
@@ -85,4 +85,4 @@ const feature = { id: "KHR_animation_pointer" };
|
|
|
85
85
|
export {
|
|
86
86
|
feature as default
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=gltf-feature-animation-pointer-
|
|
88
|
+
//# sourceMappingURL=gltf-feature-animation-pointer-C40tqOhL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-animation-pointer-
|
|
1
|
+
{"version":3,"file":"gltf-feature-animation-pointer-C40tqOhL.js","sources":["../src/loader-gltf/animation-pointer.ts","../src/loader-gltf/gltf-feature-animation-pointer.ts"],"sourcesContent":["/** KHR_animation_pointer — JSON-pointer resolver registry.\n * Handlers are registered incrementally (one per parity scene). Unknown\n * pointers return null and warn once. */\nimport type { SceneNode } from \"../scene/scene-node.js\";\nimport { setSubtreeVisible } from \"../scene/visibility.js\";\n\nexport interface ResolvedPointer {\n writer: (output: Float32Array, offset: number) => void;\n arity: number;\n}\n\nexport interface PointerContext {\n nodes: readonly (SceneNode | undefined)[];\n}\n\ntype PointerFactory = (match: RegExpExecArray, ctx: PointerContext) => ResolvedPointer | null;\n\nconst _registry: [RegExp, PointerFactory][] = [\n // /nodes/{n}/extensions/KHR_node_visibility/visible — scalar (0 = hidden).\n // The setter cascade handles descendants per the KHR_node_visibility spec\n // and bumps the module-scoped visibility epoch so the engine invalidates\n // its cached render bundle.\n [\n /^\\/nodes\\/(\\d+)\\/extensions\\/KHR_node_visibility\\/visible$/,\n (m, ctx) => {\n const n = ctx.nodes[+m[1]!];\n if (!n) {\n return null;\n }\n return {\n arity: 1,\n writer: (out, off) => {\n setSubtreeVisible(n, out[off]! !== 0);\n },\n };\n },\n ],\n];\n\nconst _warned = new Set<string>();\n\nexport function resolveAnimationPointer(pointer: string, ctx: PointerContext): ResolvedPointer | null {\n for (const [rx, make] of _registry) {\n const m = rx.exec(pointer);\n if (m) {\n return make(m, ctx);\n }\n }\n if (!_warned.has(pointer)) {\n _warned.add(pointer);\n\n console.warn(`[babylon-lite] KHR_animation_pointer: no handler for \"${pointer}\"`);\n }\n return null;\n}\n","/** KHR_animation_pointer glTF feature.\n *\n * Registered in load-gltf.ts's feature table gated on\n * `extensionsUsed.includes(\"KHR_animation_pointer\")`, so any scene that\n * doesn't declare the extension pays zero bytes for pointer resolution, the\n * non-Float32 sampler converter, or the visibility cascade helper.\n *\n * On side-effect import this module installs two callbacks into gltf-animation:\n * 1. A pointer-channel parser (resolves the JSON pointer to a writer fn).\n * 2. A sampler converter that handles the non-Float32/misaligned accessor\n * cases the fast path in gltf-animation can't express (e.g. the 11-byte\n * UNSIGNED_BYTE visibility accessor in CubeVisibility.glb). */\n\nimport { F32, U16, I16, U8, I8 } from \"../engine/typed-arrays.js\";\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport type { AnimationChannel } from \"../animation/types.js\";\nimport { PATH_POINTER } from \"../animation/types.js\";\nimport { resolveAnimationPointer } from \"./animation-pointer.js\";\nimport { _installPointerHandlers } from \"./gltf-animation.js\";\n\n_installPointerHandlers(\n (ptr, c, nodeMap) => {\n if (!nodeMap) {\n return null;\n }\n const resolved = resolveAnimationPointer(ptr, { nodes: nodeMap });\n if (!resolved) {\n return null;\n }\n const ch: AnimationChannel = {\n samplerIdx: c.sampler,\n nodeIdx: -1,\n path: PATH_POINTER,\n pointerWriter: resolved.writer,\n pointerArity: resolved.arity,\n };\n return ch;\n },\n (src, length, normalized) => {\n // Convert any animation-sampler payload to a standalone Float32Array.\n // Handles the cases the aligned-Float32 fast path can't express.\n const out = new F32(length);\n if (src instanceof F32) {\n for (let i = 0; i < length; i++) {\n out[i] = src[i]!;\n }\n } else if (src instanceof U8) {\n const k = normalized ? 1 / 255 : 1;\n for (let i = 0; i < length; i++) {\n out[i] = src[i]! * k;\n }\n } else if (src instanceof U16) {\n const k = normalized ? 1 / 65535 : 1;\n for (let i = 0; i < length; i++) {\n out[i] = src[i]! * k;\n }\n } else if (src instanceof I8) {\n for (let i = 0; i < length; i++) {\n out[i] = normalized ? Math.max(src[i]! / 127, -1) : src[i]!;\n }\n } else if (src instanceof I16) {\n for (let i = 0; i < length; i++) {\n out[i] = normalized ? Math.max(src[i]! / 32767, -1) : src[i]!;\n }\n }\n return out;\n }\n);\n\n// No per-asset hook — this feature only installs the seam at import time.\nconst feature: GltfFeature = { id: \"KHR_animation_pointer\" };\nexport default feature;\n"],"names":[],"mappings":";;AAiBA,MAAM,YAAwC;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1C;AAAA,IACI;AAAA,IACA,CAAC,GAAG,QAAQ;AACR,YAAM,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC,CAAE;AAC1B,UAAI,CAAC,GAAG;AACJ,eAAO;AAAA,MACX;AACA,aAAO;AAAA,QACH,OAA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a,IAAI,QAAQ;AACnC,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC7B,YAAI,CAAC,IAAI,IAAI,CAAC,IAAK;AAAA,MACvB;AAAA,IACJ,WAAW,eAAe,IAAI;AAC1B,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC7B,YAAI,CAAC,IAAI,aAAa,KAAK,IAAI,IAAI,CAAC,IAAK,KAAK,EAAE,IAAI,IAAI,CAAC;AAAA,MAC7D;AAAA,IACJ,WAAW,eAAe,KAAK;AAC3B,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC7B,YAAI,CAAC,IAAI,aAAa,KAAK,IAAI,IAAI,CAAC,IAAK,OAAO,EAAE,IAAI,IAAI,CAAC;AAAA,MAC/D;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACJ;AAGA,MAAM,UAAuB,EAAE,IAAI,wBAAA;"}
|
|
@@ -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-BjnXkop6.js"), import("./index-BgY3QEzL.js").then((n) => n.k7)]);
|
|
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-v0S_yb4T.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-animations-
|
|
1
|
+
{"version":3,"file":"gltf-feature-animations-v0S_yb4T.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,4 +1,4 @@
|
|
|
1
|
-
import { e as U8, U as U32,
|
|
1
|
+
import { e as U8, U as U32, bV as I32, a as F32 } from "./index-BgY3QEzL.js";
|
|
2
2
|
let dracoBaseUrl = "/";
|
|
3
3
|
let modulePromise = null;
|
|
4
4
|
let scriptLoadPromise = null;
|
|
@@ -122,4 +122,4 @@ const feature = {
|
|
|
122
122
|
export {
|
|
123
123
|
feature as default
|
|
124
124
|
};
|
|
125
|
-
//# sourceMappingURL=gltf-feature-draco-
|
|
125
|
+
//# sourceMappingURL=gltf-feature-draco-CljWrsna.js.map
|
|
@@ -1 +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":";A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,KAAK,YAAY,aAAa;AAC3C,MAAI,CAAC,MAAM;AACP,UAAM,IAAI,MAAM,oBAAoB,aAAa,YAAY;AAAA,EACjE;AACA,QAAM,SAAS,SAAS,cAAc,KAAK,cAAc;AACzD,SAAO,IAAI,GAAG,SAAS,QAAQ,QAAQ,KAAK,UAAU;AAC1D;ACpJA,MAAM,wBAAgD,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,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
|
+
{"version":3,"file":"gltf-feature-draco-CljWrsna.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,UAAM,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AAG,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, br as setThinInstances, bs as mat4ComposeInto, a as F32, h as computeAabb, bt as getLoaderTmpInstance, bu as mat4Multiply } from "./index-BgY3QEzL.js";
|
|
2
2
|
function collectMeshesUnderNode(tn) {
|
|
3
3
|
const out = [];
|
|
4
4
|
for (const c of (tn == null ? void 0 : tn.children) ?? []) {
|
|
@@ -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-BoeSm6Tn.js.map
|
package/{gltf-feature-gpu-instancing-n87SO6Vh.js.map → gltf-feature-gpu-instancing-BoeSm6Tn.js.map}
RENAMED
|
@@ -1 +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,QAAQ,EAAE;AACnC,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC5B,UAAM,KAAK,cAAc,YAAY,IAAI,CAAC,IAAK;AAC/C,UAAM,KAAK,cAAc,YAAY,IAAI,IAAI,CAAC,IAAK;AACnD,UAAM,KAAK,cAAc,YAAY,IAAI,IAAI,CAAC,IAAK;AACnD,UAAM,KAAK,WAAW,SAAS,IAAI,CAAC,IAAK;AACzC,UAAM,KAAK,WAAW,SAAS,IAAI,IAAI,CAAC,IAAK;AAC7C,UAAM,KAAK,WAAW,SAAS,IAAI,IAAI,CAAC,IAAK;AAC7C,UAAM,KAAK,WAAW,SAAS,IAAI,IAAI,CAAC,IAAK;AAC7C,UAAM,KAAK,QA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C;AAAA,IACN,KAAK,CAAC;AAAA,IACN,KAAK,CAAC;AAAA,EAAA,CACT;AACD,MAAI,QAAQ,UACR,QAAQ,UACR,QAAQ;AACZ,MAAI,QAAQ,WACR,QAAQ,WACR,QAAQ;AACZ,QAAM,YAAY,qBAAA;AAClB,QAAM,UAAU;AAChB,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC5B,aAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AACzB,cAAQ,CAAC,IAAI,SAAS,IAAI,KAAK,CAAC;AAAA,IACpC;AACA,UAAM,WAAW,aAAa,WAAW,SAAS;AAClD,UAAM,CAAC,MAAM,IAAI,IAAI,YAAY,SAAS,QAAQ;AAClD,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,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;"}
|
|
1
|
+
{"version":3,"file":"gltf-feature-gpu-instancing-BoeSm6Tn.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, w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Q;AAClD,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,IAClB;AACA,QAAI,KAAK,CAAC,IAAK,OAAO;AAClB,cAAQ,KAAK,CAAC;AAAA,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-Ckm3ciL8.js → gltf-feature-lights-punctual-BCTwgyi_.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MAX_LIGHTS,
|
|
1
|
+
import { M as MAX_LIGHTS, bc as setMaxLights, bd as computeNodeWorldMatrix } from "./index-BgY3QEzL.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-BgY3QEzL.js").then((n) => n.k4);
|
|
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-BgY3QEzL.js").then((n) => n.k5);
|
|
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-BgY3QEzL.js").then((n) => n.k6);
|
|
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-BCTwgyi_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-lights-punctual-
|
|
1
|
+
{"version":3,"file":"gltf-feature-lights-punctual-BCTwgyi_.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":";AAqBA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,WAAW,SAAS,OAAO,KAAK;;AAClC,UAAM,QAAmC,eAAI,MAAM,eAAV,mBAAsB,wBAAtB,mBAA2C;AACpF,QAAI,EAAC,6BAAM,SAAQ;AACf,aAAO,CAAA;AAAA,IACX;AACA,UAAM,SAAsB,CAAA;AAC5B,UAAM,QAAQ,IAAI,MAAM,SAAS,CAAA;AAKjC,QAAI,iBAAiB;AACrB,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACnC,YAAI,uBAAM,CAAC,MAAP,mBAAU,eAAV,mBAAsB,wBAAtB,mBAA2C,WAAU,QAAW;AAChE;AAAA,MACJ;AAAA,IACJ;AACA,QAAI,iBAAiB,YAAY;AAC7B,mBAAa,cAAc;AAAA,IAC/B;AACA,aAAS,UAAU,GAAG,UAAU,MAAM,QAAQ,WAAW;AACrD,YAAM,YAA+B,uBAAM,OAAO,MAAb,mBAAgB,eAAhB,mBAA4B,wBAA5B,mBAAiD;AACtF,UAAI,aAAa,QAAW;AACxB;AAAA,MACJ;AACA,YAAM,MAAM,KAAK,QAAQ;AACzB,UAAI,CAAC,KAAK;AACN;AAAA,MACJ;AACA,YAAM,QAAQ,uBAAuB,IAAI,OAAO,SAAS,IAAI,YAAY,IAAI,iBAAiB;AAC9F,YAAM,KAAK,MAAM,EAAE;AACnB,YAAM,KAAK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AS;AACrE,WAAG,UAAU;AACb,WAAG,WAAW;AACd,WAAG,QAAQ;AACX,eAAO,KAAK,EAAE;AAAA,MAClB;AAAA,IACJ;AACA,WAAO,EAAE,UAAU,OAAA;AAAA,EACvB;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as U8, D as DV } from "./index-
|
|
1
|
+
import { e as U8, D as DV } from "./index-BgY3QEzL.js";
|
|
2
2
|
let meshoptBaseUrl = "/";
|
|
3
3
|
let scriptLoadPromise = null;
|
|
4
4
|
function loadMeshoptScript() {
|
|
@@ -82,4 +82,4 @@ const feature = {
|
|
|
82
82
|
export {
|
|
83
83
|
feature as default
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=gltf-feature-meshopt-
|
|
85
|
+
//# sourceMappingURL=gltf-feature-meshopt-DItMkOMt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-meshopt-
|
|
1
|
+
{"version":3,"file":"gltf-feature-meshopt-DItMkOMt.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;AAChB;AAAA,IACJ;AACA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,iBAAiB;AAC9B,WAAO,SAAS,MAAM;AAClB,YAAM,MAAO,WAAyD;AACtE,UAAI,CAAC,KAAK;AACN,eAAO,IAAI,MAAM,2DAA2D,CAAC;AAAA,MACjF,OAAO;AACH,gBAAQ,GAAG;AAAA,MACf;AAAA,IACJ;AACA,WAAO,UAAU,MAAM,OAAO,IAAI,MAAM,4CAA4C,OAAO,GAAG,CAAC;AAC/F,aAAS,KAAK,YAAY,MAAM;AAAA,EACpC,CAAC;AACD,SAAO;AACX;AAGA,eAAsB,oBAAmD;AACrE,QAAM,MAAM,MAAM,kBAAA;AAClB,QAAM,IAAI;AACV,SAAO;AACX;ACdA,SAAS,OAAO,GAAmB;AAC/B,SAAQ,IAAI,IAAK;AACrB;AAEA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,SAAS,MAAM,UAAU;;AAC3B,UAAM,cAA4B,KAAK,eAAe,CAAA;AACtD,UAAM,UAA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jC,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, a as F32 } from "./index-
|
|
1
|
+
import { r as resolveAccessor, a as F32 } from "./index-BgY3QEzL.js";
|
|
2
2
|
const feature = {
|
|
3
3
|
id: "_morph",
|
|
4
4
|
async applyMesh(meshData, mesh, ctx) {
|
|
@@ -19,11 +19,11 @@ const feature = {
|
|
|
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-BgY3QEzL.js").then((n) => n.k8);
|
|
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-Cv0mEYIq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-feature-morph-
|
|
1
|
+
{"version":3,"file":"gltf-feature-morph-Cv0mEYIq.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, l as anyPrimitive } from "./index-BgY3QEzL.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-DItMkOMt.js")],
|
|
7
|
+
["KHR_mesh_quantization", () => import("./gltf-ext-quantization-DaymajCR.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-CljWrsna.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-DFmNJ8kA.js")],
|
|
25
|
+
["KHR_texture_basisu", () => import("./gltf-ext-basisu-DtzVV1Xx.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-Deh2UBAn.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-Cv0mEYIq.js")],
|
|
39
39
|
// Per-asset features
|
|
40
|
-
["KHR_lights_punctual", () => import("./gltf-feature-lights-punctual-
|
|
40
|
+
["KHR_lights_punctual", () => import("./gltf-feature-lights-punctual-BCTwgyi_.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-v0S_yb4T.js")],
|
|
45
|
+
[M + "variants", () => import("./gltf-feature-variants-DGSdFNJq.js")],
|
|
46
|
+
["KHR_node_visibility", () => import("./gltf-ext-node-visibility-BhX0DmiP.js")],
|
|
47
|
+
["KHR_animation_pointer", () => import("./gltf-feature-animation-pointer-C40tqOhL.js")],
|
|
48
|
+
["EXT_mesh_gpu_instancing", () => import("./gltf-feature-gpu-instancing-BoeSm6Tn.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-wNbt6UC-.js.map
|