@babylonjs/lite 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_math-factory-C-QqW-Wi.js +55 -0
- package/_math-factory-C-QqW-Wi.js.map +1 -0
- package/add-block-CikX5gWy.js +6 -0
- package/add-block-CikX5gWy.js.map +1 -0
- package/alpha-test-fragment-CUiHCw7W.js +22 -0
- package/alpha-test-fragment-CUiHCw7W.js.map +1 -0
- package/ambient-occlusion-block-DForhWL3.js +77 -0
- package/ambient-occlusion-block-DForhWL3.js.map +1 -0
- package/anisotropy-block-D5fXH_OY.js +12 -0
- package/anisotropy-block-D5fXH_OY.js.map +1 -0
- package/anisotropy-fragment-HgasXS7l.js +89 -0
- package/anisotropy-fragment-HgasXS7l.js.map +1 -0
- package/arc-tan2-block-d8sWt_x0.js +12 -0
- package/arc-tan2-block-d8sWt_x0.js.map +1 -0
- package/assets/splat-sort-worker-Crg3CaCc.js.map +1 -0
- package/background-dds-skybox-yHTqabU3.js +221 -0
- package/background-dds-skybox-yHTqabU3.js.map +1 -0
- package/background-ground-DIw6D3qf.js +235 -0
- package/background-ground-DIw6D3qf.js.map +1 -0
- package/background-hdr-skybox-c4uuTmkP.js +179 -0
- package/background-hdr-skybox-c4uuTmkP.js.map +1 -0
- package/background-solid-skybox-DPGBpPbm.js +235 -0
- package/background-solid-skybox-DPGBpPbm.js.map +1 -0
- package/bake-local-matrix-Dfpd3b06.js +28 -0
- package/bake-local-matrix-Dfpd3b06.js.map +1 -0
- package/billboard-renderable-D8mlVGCd.js +242 -0
- package/billboard-renderable-D8mlVGCd.js.map +1 -0
- package/biplanar-block-DZnKuV81.js +115 -0
- package/biplanar-block-DZnKuV81.js.map +1 -0
- package/bones-block-D6IhqUVV.js +31 -0
- package/bones-block-D6IhqUVV.js.map +1 -0
- package/clamp-block-BdII67hT.js +21 -0
- package/clamp-block-BdII67hT.js.map +1 -0
- package/clearcoat-block-BGML4npi.js +12 -0
- package/clearcoat-block-BGML4npi.js.map +1 -0
- package/clearcoat-fragment-LCiG98Rf.js +256 -0
- package/clearcoat-fragment-LCiG98Rf.js.map +1 -0
- package/clip-planes-block-BPfFJrbf.js +26 -0
- package/clip-planes-block-BPfFJrbf.js.map +1 -0
- package/cloud-block-BeVrangc.js +90 -0
- package/cloud-block-BeVrangc.js.map +1 -0
- package/color-converter-block-CvwKiW4k.js +123 -0
- package/color-converter-block-CvwKiW4k.js.map +1 -0
- package/color-merger-CCu21ZII.js +57 -0
- package/color-merger-CCu21ZII.js.map +1 -0
- package/color-splitter-CGn1G4ow.js +33 -0
- package/color-splitter-CGn1G4ow.js.map +1 -0
- package/conditional-block-Cd2pbejI.js +51 -0
- package/conditional-block-Cd2pbejI.js.map +1 -0
- package/create-skeleton-C9JdIJnb.js +44 -0
- package/create-skeleton-C9JdIJnb.js.map +1 -0
- package/cross-block-DCrLwCpt.js +12 -0
- package/cross-block-DCrLwCpt.js.map +1 -0
- package/cubemap-skybox-material-DvXMVc4k.js +79 -0
- package/cubemap-skybox-material-DvXMVc4k.js.map +1 -0
- package/curve-block-BlJpXVYv.js +89 -0
- package/curve-block-BlJpXVYv.js.map +1 -0
- package/debug-block-D2pg4Yf6.js +14 -0
- package/debug-block-D2pg4Yf6.js.map +1 -0
- package/derivative-block-B8KjtaWs.js +20 -0
- package/derivative-block-B8KjtaWs.js.map +1 -0
- package/desaturate-block-C1RghNSB.js +15 -0
- package/desaturate-block-C1RghNSB.js.map +1 -0
- package/discard-block-B2jKjaEL.js +21 -0
- package/discard-block-B2jKjaEL.js.map +1 -0
- package/distance-block-3NkgFZ3f.js +16 -0
- package/distance-block-3NkgFZ3f.js.map +1 -0
- package/divide-block-ZyepIg_-.js +6 -0
- package/divide-block-ZyepIg_-.js.map +1 -0
- package/dot-block-VlfAC6cD.js +16 -0
- package/dot-block-VlfAC6cD.js.map +1 -0
- package/elbow-block-NEOiIxzO.js +10 -0
- package/elbow-block-NEOiIxzO.js.map +1 -0
- package/emissive-fragment-BnNvbBCw.js +39 -0
- package/emissive-fragment-BnNvbBCw.js.map +1 -0
- package/esm-shadow-view-DGKdF1NI.js +18 -0
- package/esm-shadow-view-DGKdF1NI.js.map +1 -0
- package/esm-shadow-view-DN9HIaM4.js +15 -0
- package/esm-shadow-view-DN9HIaM4.js.map +1 -0
- package/esm-shadow-view-Dk9NFtLq.js +15 -0
- package/esm-shadow-view-Dk9NFtLq.js.map +1 -0
- package/fog-block-DJ9hEolm.js +41 -0
- package/fog-block-DJ9hEolm.js.map +1 -0
- package/frag-coord-block-DzXfFgfV.js +25 -0
- package/frag-coord-block-DzXfFgfV.js.map +1 -0
- package/frag-depth-block-UQbeKP2D.js +34 -0
- package/frag-depth-block-UQbeKP2D.js.map +1 -0
- package/fragment-output-BOphkIeh.js +26 -0
- package/fragment-output-BOphkIeh.js.map +1 -0
- package/fresnel-block-DefHWeO-.js +20 -0
- package/fresnel-block-DefHWeO-.js.map +1 -0
- package/front-facing-0d6aiyrv.js +11 -0
- package/front-facing-0d6aiyrv.js.map +1 -0
- package/gaussian-splatting-pipeline-sh-DgJl7l56.js +500 -0
- package/gaussian-splatting-pipeline-sh-DgJl7l56.js.map +1 -0
- package/gltf-animation-D7uyTyO3.js +245 -0
- package/gltf-animation-D7uyTyO3.js.map +1 -0
- package/gltf-ext-anisotropy-CknJiJK8.js +22 -0
- package/gltf-ext-anisotropy-CknJiJK8.js.map +1 -0
- package/gltf-ext-basisu-CPg5kPrx.js +452 -0
- package/gltf-ext-basisu-CPg5kPrx.js.map +1 -0
- package/gltf-ext-clearcoat-CLH2SVph.js +31 -0
- package/gltf-ext-clearcoat-CLH2SVph.js.map +1 -0
- package/gltf-ext-dielectric-qHzlnvdl.js +105 -0
- package/gltf-ext-dielectric-qHzlnvdl.js.map +1 -0
- package/gltf-ext-emissive-strength-nzGZXZVK.js +19 -0
- package/gltf-ext-emissive-strength-nzGZXZVK.js.map +1 -0
- package/gltf-ext-iridescence-C6bq7jiM.js +26 -0
- package/gltf-ext-iridescence-C6bq7jiM.js.map +1 -0
- package/gltf-ext-node-visibility-MafA9ot2.js +25 -0
- package/gltf-ext-node-visibility-MafA9ot2.js.map +1 -0
- package/gltf-ext-orm-CT18G_vQ.js +33 -0
- package/gltf-ext-orm-CT18G_vQ.js.map +1 -0
- package/gltf-ext-quantization-CpZyLDIz.js +94 -0
- package/gltf-ext-quantization-CpZyLDIz.js.map +1 -0
- package/gltf-ext-sheen-BgIxUzyZ.js +25 -0
- package/gltf-ext-sheen-BgIxUzyZ.js.map +1 -0
- package/gltf-ext-spec-gloss-D0LJLBUM.js +24 -0
- package/gltf-ext-spec-gloss-D0LJLBUM.js.map +1 -0
- package/gltf-ext-unlit-D2ANui0V.js +16 -0
- package/gltf-ext-unlit-D2ANui0V.js.map +1 -0
- package/gltf-ext-uv-transform-CE_-T1Tr.js +38 -0
- package/gltf-ext-uv-transform-CE_-T1Tr.js.map +1 -0
- package/gltf-feature-animation-pointer-BjpwOOqo.js +88 -0
- package/gltf-feature-animation-pointer-BjpwOOqo.js.map +1 -0
- package/gltf-feature-animations-CCizegp8.js +15 -0
- package/gltf-feature-animations-CCizegp8.js.map +1 -0
- package/gltf-feature-draco-yGSMGTE3.js +124 -0
- package/gltf-feature-draco-yGSMGTE3.js.map +1 -0
- package/gltf-feature-gpu-instancing-2e_CFQnl.js +151 -0
- package/gltf-feature-gpu-instancing-2e_CFQnl.js.map +1 -0
- package/gltf-feature-lights-punctual-DDDg4j0U.js +71 -0
- package/gltf-feature-lights-punctual-DDDg4j0U.js.map +1 -0
- package/gltf-feature-meshopt-Des96YFI.js +84 -0
- package/gltf-feature-meshopt-Des96YFI.js.map +1 -0
- package/gltf-feature-morph-CKCw6tkX.js +29 -0
- package/gltf-feature-morph-CKCw6tkX.js.map +1 -0
- package/gltf-feature-skeleton-D8hWLqi2.js +36 -0
- package/gltf-feature-skeleton-D8hWLqi2.js.map +1 -0
- package/gltf-feature-variants-Ds6v9byg.js +17 -0
- package/gltf-feature-variants-Ds6v9byg.js.map +1 -0
- package/gltf-feature-xmp-BUfq_IVG.js +15 -0
- package/gltf-feature-xmp-BUfq_IVG.js.map +1 -0
- package/gltf-glb-parser-D6UZWFuC.js +27 -0
- package/gltf-glb-parser-D6UZWFuC.js.map +1 -0
- package/gltf-interleave-DGnUlz28.js +241 -0
- package/gltf-interleave-DGnUlz28.js.map +1 -0
- package/gltf-pbr-builder-ext-BFOxOCnQ.js +85 -0
- package/gltf-pbr-builder-ext-BFOxOCnQ.js.map +1 -0
- package/gltf-variants-DFbr8EES.js +88 -0
- package/gltf-variants-DFbr8EES.js.map +1 -0
- package/gradient-block-DL_60sDc.js +50 -0
- package/gradient-block-DL_60sDc.js.map +1 -0
- package/gs-picking-pipeline-DzfMASL9.js +280 -0
- package/gs-picking-pipeline-DzfMASL9.js.map +1 -0
- package/height-to-normal-block-DhPHkDFg.js +65 -0
- package/height-to-normal-block-DhPHkDFg.js.map +1 -0
- package/ibl-fragment-DqQVi8k0.js +91 -0
- package/ibl-fragment-DqQVi8k0.js.map +1 -0
- package/ibl-skybox-wgsl-DCah0kWV.js +13 -0
- package/ibl-skybox-wgsl-DCah0kWV.js.map +1 -0
- package/image-processing-block-DwrhhmuF.js +40 -0
- package/image-processing-block-DwrhhmuF.js.map +1 -0
- package/image-source-BuMJgd9-.js +17 -0
- package/image-source-BuMJgd9-.js.map +1 -0
- package/index-C8HOR2sB.js +19222 -0
- package/index-C8HOR2sB.js.map +1 -0
- package/index.d.ts +4611 -0
- package/index.js +309 -0
- package/index.js.map +1 -0
- package/input-block-DgAJBzN_.js +109 -0
- package/input-block-DgAJBzN_.js.map +1 -0
- package/instances-block-BaSSiz8m.js +12 -0
- package/instances-block-BaSSiz8m.js.map +1 -0
- package/iridescence-block-B0pRFoOU.js +67 -0
- package/iridescence-block-B0pRFoOU.js.map +1 -0
- package/iridescence-fragment-Gymp7or5.js +243 -0
- package/iridescence-fragment-Gymp7or5.js.map +1 -0
- package/length-block-ChOkeiHR.js +11 -0
- package/length-block-ChOkeiHR.js.map +1 -0
- package/lerp-block-DjI2SfmI.js +18 -0
- package/lerp-block-DjI2SfmI.js.map +1 -0
- package/light-block-B11ew7FA.js +123 -0
- package/light-block-B11ew7FA.js.map +1 -0
- package/light-information-VJbW0jbs.js +19 -0
- package/light-information-VJbW0jbs.js.map +1 -0
- package/loop-block-Bb23EOMb.js +71 -0
- package/loop-block-Bb23EOMb.js.map +1 -0
- package/manifold-AS8POaOr.js +3022 -0
- package/manifold-AS8POaOr.js.map +1 -0
- package/manifold-RCa7RkKz.js +5 -0
- package/manifold-RCa7RkKz.js.map +1 -0
- package/matrix-blocks-acWn_V6g.js +51 -0
- package/matrix-blocks-acWn_V6g.js.map +1 -0
- package/max-block-CjFgljZ7.js +6 -0
- package/max-block-CjFgljZ7.js.map +1 -0
- package/mesh-attribute-exists-block-BfK8UiSL.js +44 -0
- package/mesh-attribute-exists-block-BfK8UiSL.js.map +1 -0
- package/mesh-features-BLENkYVt.js +341 -0
- package/mesh-features-BLENkYVt.js.map +1 -0
- package/min-block-CHtBngNl.js +6 -0
- package/min-block-CHtBngNl.js.map +1 -0
- package/mod-block-Ceizv8Y7.js +6 -0
- package/mod-block-Ceizv8Y7.js.map +1 -0
- package/morph-fragment-DOVo70gP.js +59 -0
- package/morph-fragment-DOVo70gP.js.map +1 -0
- package/morph-targets-55z342ZB.js +35 -0
- package/morph-targets-55z342ZB.js.map +1 -0
- package/multilight-wgsl-BGyiIOp3.js +112 -0
- package/multilight-wgsl-BGyiIOp3.js.map +1 -0
- package/multiply-block-DaXLJ7Ud.js +6 -0
- package/multiply-block-DaXLJ7Ud.js.map +1 -0
- package/negate-block-9CSLc5pM.js +6 -0
- package/negate-block-9CSLc5pM.js.map +1 -0
- package/nlerp-block-BNK1adIb.js +21 -0
- package/nlerp-block-BNK1adIb.js.map +1 -0
- package/node-env-BPZXZzBf.js +39 -0
- package/node-env-BPZXZzBf.js.map +1 -0
- package/node-registry-DwgC4yth.js +190 -0
- package/node-registry-DwgC4yth.js.map +1 -0
- package/node-registry-extra-advanced-2DJVt67-.js +45 -0
- package/node-registry-extra-advanced-2DJVt67-.js.map +1 -0
- package/node-registry-extra-compat-Dhrw8fDQ.js +41 -0
- package/node-registry-extra-compat-Dhrw8fDQ.js.map +1 -0
- package/node-registry-extra-math-CsAHvIZo.js +49 -0
- package/node-registry-extra-math-CsAHvIZo.js.map +1 -0
- package/node-registry-extra-procedural-5pLQ3Bhz.js +45 -0
- package/node-registry-extra-procedural-5pLQ3Bhz.js.map +1 -0
- package/node-renderable-DlLIdBmd.js +269 -0
- package/node-renderable-DlLIdBmd.js.map +1 -0
- package/node-shadow-DKrcqmNg.js +122 -0
- package/node-shadow-DKrcqmNg.js.map +1 -0
- package/node-snippet-DUMm9qEO.js +22 -0
- package/node-snippet-DUMm9qEO.js.map +1 -0
- package/normal-blend-block-BfH_nBoj.js +29 -0
- package/normal-blend-block-BfH_nBoj.js.map +1 -0
- package/normal-map-fragment-DpsIXrJf.js +38 -0
- package/normal-map-fragment-DpsIXrJf.js.map +1 -0
- package/normalize-block-F2bLNj9K.js +6 -0
- package/normalize-block-F2bLNj9K.js.map +1 -0
- package/oneminus-block-BP9x4Dc3.js +6 -0
- package/oneminus-block-BP9x4Dc3.js.map +1 -0
- package/opposite-block-Cnqmm-lH.js +6 -0
- package/opposite-block-Cnqmm-lH.js.map +1 -0
- package/package.json +26 -0
- package/panner-block-BwMQq-6Y.js +13 -0
- package/panner-block-BwMQq-6Y.js.map +1 -0
- package/parse-camera-DM3oJJeT.js +23 -0
- package/parse-camera-DM3oJJeT.js.map +1 -0
- package/pbr-aces-wgsl-HpiQHGN_.js +13 -0
- package/pbr-aces-wgsl-HpiQHGN_.js.map +1 -0
- package/pbr-metallic-roughness-block-full-6vMm1Jk6.js +763 -0
- package/pbr-metallic-roughness-block-full-6vMm1Jk6.js.map +1 -0
- package/pbr-metallic-roughness-block-h_KAOZrW.js +104 -0
- package/pbr-metallic-roughness-block-h_KAOZrW.js.map +1 -0
- package/pbr-mr-helper-core-CIwm-T1G.js +237 -0
- package/pbr-mr-helper-core-CIwm-T1G.js.map +1 -0
- package/pbr-refraction-DGmMSa2v.js +17 -0
- package/pbr-refraction-DGmMSa2v.js.map +1 -0
- package/pbr-renderable-BJxUtPBb.js +961 -0
- package/pbr-renderable-BJxUtPBb.js.map +1 -0
- package/pbr-shadow-fragment-LO9SlbJj.js +14 -0
- package/pbr-shadow-fragment-LO9SlbJj.js.map +1 -0
- package/pbr-template-ext-8q7BcTDf.js +88 -0
- package/pbr-template-ext-8q7BcTDf.js.map +1 -0
- package/pbr-tracking-B3alzn91.js +31 -0
- package/pbr-tracking-B3alzn91.js.map +1 -0
- package/pbr-transmission-ext-BxW4CEGu.js +581 -0
- package/pbr-transmission-ext-BxW4CEGu.js.map +1 -0
- package/perturb-normal-0Q8EM9ig.js +39 -0
- package/perturb-normal-0Q8EM9ig.js.map +1 -0
- package/posterize-block-DfdKsbEf.js +28 -0
- package/posterize-block-DfdKsbEf.js.map +1 -0
- package/pow-block-DI5ICzhc.js +13 -0
- package/pow-block-DI5ICzhc.js.map +1 -0
- package/random-number-block-2OyRYljF.js +15 -0
- package/random-number-block-2OyRYljF.js.map +1 -0
- package/reciprocal-block-Ck3CW-j-.js +14 -0
- package/reciprocal-block-Ck3CW-j-.js.map +1 -0
- package/reflect-block-CizpzrX4.js +12 -0
- package/reflect-block-CizpzrX4.js.map +1 -0
- package/reflectance-fragment-BCrgPmrt.js +143 -0
- package/reflectance-fragment-BCrgPmrt.js.map +1 -0
- package/reflection-block-DqcwyYqr.js +12 -0
- package/reflection-block-DqcwyYqr.js.map +1 -0
- package/reflection-texture-base-block-1xmJ0HDj.js +10 -0
- package/reflection-texture-base-block-1xmJ0HDj.js.map +1 -0
- package/reflection-texture-block-C3QtzoV8.js +60 -0
- package/reflection-texture-block-C3QtzoV8.js.map +1 -0
- package/refract-block-HHiAk-7U.js +13 -0
- package/refract-block-HHiAk-7U.js.map +1 -0
- package/refraction-block-U8y6XiXs.js +11 -0
- package/refraction-block-U8y6XiXs.js.map +1 -0
- package/refraction-dispersion-wgsl-DdQCyyO1.js +16 -0
- package/refraction-dispersion-wgsl-DdQCyyO1.js.map +1 -0
- package/remap-block-DxK1W1vp.js +27 -0
- package/remap-block-DxK1W1vp.js.map +1 -0
- package/replace-color-block-1m--hiru.js +17 -0
- package/replace-color-block-1m--hiru.js.map +1 -0
- package/rgbd-decode-DCvzUYeI.js +110 -0
- package/rgbd-decode-DCvzUYeI.js.map +1 -0
- package/rotate2d-block-nEe1N2MJ.js +15 -0
- package/rotate2d-block-nEe1N2MJ.js.map +1 -0
- package/scale-block-C5Z8159G.js +13 -0
- package/scale-block-C5Z8159G.js.map +1 -0
- package/scene-material-swap-C2ykv55W.js +34 -0
- package/scene-material-swap-C2ykv55W.js.map +1 -0
- package/screen-size-block-BVNnOvE8.js +21 -0
- package/screen-size-block-BVNnOvE8.js.map +1 -0
- package/screen-space-block-CwaxdfSe.js +28 -0
- package/screen-space-block-CwaxdfSe.js.map +1 -0
- package/shader-renderable-D-6796KR.js +531 -0
- package/shader-renderable-D-6796KR.js.map +1 -0
- package/shadow-fragment-core-DHN2G6FI.js +110 -0
- package/shadow-fragment-core-DHN2G6FI.js.map +1 -0
- package/shadow-map-CQNQC-Fw.js +13 -0
- package/shadow-map-CQNQC-Fw.js.map +1 -0
- package/sheen-block-BugfJqK3.js +12 -0
- package/sheen-block-BugfJqK3.js.map +1 -0
- package/sheen-fragment-Dze2f7XJ.js +215 -0
- package/sheen-fragment-Dze2f7XJ.js.map +1 -0
- package/simplex-perlin-3d-block-CcMtofzV.js +58 -0
- package/simplex-perlin-3d-block-CcMtofzV.js.map +1 -0
- package/singlelight-directional-wgsl-CmUDZxwz.js +39 -0
- package/singlelight-directional-wgsl-CmUDZxwz.js.map +1 -0
- package/singlelight-hemispheric-wgsl-t-83IP_s.js +40 -0
- package/singlelight-hemispheric-wgsl-t-83IP_s.js.map +1 -0
- package/singlelight-point-wgsl-CLzULIYV.js +45 -0
- package/singlelight-point-wgsl-CLzULIYV.js.map +1 -0
- package/singlelight-spot-wgsl-DEEUrfVM.js +47 -0
- package/singlelight-spot-wgsl-DEEUrfVM.js.map +1 -0
- package/skeleton-fragment-B_XlFbtx.js +71 -0
- package/skeleton-fragment-B_XlFbtx.js.map +1 -0
- package/skybox-renderable-DDwzu-PT.js +92 -0
- package/skybox-renderable-DDwzu-PT.js.map +1 -0
- package/skybox.vertex-DJgi072W.js +5 -0
- package/skybox.vertex-DJgi072W.js.map +1 -0
- package/smoothstep-block-Di4t37x-.js +15 -0
- package/smoothstep-block-Di4t37x-.js.map +1 -0
- package/splat-ply-compressed-BahdBG1r.js +394 -0
- package/splat-ply-compressed-BahdBG1r.js.map +1 -0
- package/standard-renderable-GjxL9xSf.js +636 -0
- package/standard-renderable-GjxL9xSf.js.map +1 -0
- package/std-ambient-fragment-BoUsD06w.js +37 -0
- package/std-ambient-fragment-BoUsD06w.js.map +1 -0
- package/std-cube-reflection-fragment-ulqc3bsP.js +31 -0
- package/std-cube-reflection-fragment-ulqc3bsP.js.map +1 -0
- package/std-emissive-fragment-DNGj1HdQ.js +40 -0
- package/std-emissive-fragment-DNGj1HdQ.js.map +1 -0
- package/std-lightmap-fragment-Bqj89aIe.js +37 -0
- package/std-lightmap-fragment-Bqj89aIe.js.map +1 -0
- package/std-opacity-fragment-KuPh5N2Z.js +37 -0
- package/std-opacity-fragment-KuPh5N2Z.js.map +1 -0
- package/std-reflection-fragment-BA5Ghn_M.js +57 -0
- package/std-reflection-fragment-BA5Ghn_M.js.map +1 -0
- package/std-shadow-fragment-FNQfrJuC.js +8 -0
- package/std-shadow-fragment-FNQfrJuC.js.map +1 -0
- package/std-specular-fragment-CE-6scqd.js +37 -0
- package/std-specular-fragment-CE-6scqd.js.map +1 -0
- package/std-tracking-CNKZ-hJN.js +15 -0
- package/std-tracking-CNKZ-hJN.js.map +1 -0
- package/step-block-BkywzTYm.js +13 -0
- package/step-block-BkywzTYm.js.map +1 -0
- package/storage-read-block-BdzhJfln.js +25 -0
- package/storage-read-block-BdzhJfln.js.map +1 -0
- package/storage-write-block-DjLKZ0Ro.js +11 -0
- package/storage-write-block-DjLKZ0Ro.js.map +1 -0
- package/subsurface-block-CBhxT9ui.js +12 -0
- package/subsurface-block-CBhxT9ui.js.map +1 -0
- package/subsurface-fragment-liM3y2-P.js +158 -0
- package/subsurface-fragment-liM3y2-P.js.map +1 -0
- package/subtract-block-NPfKvzQP.js +6 -0
- package/subtract-block-NPfKvzQP.js.map +1 -0
- package/swapchain-overlay-DcCSFDp7.js +35 -0
- package/swapchain-overlay-DcCSFDp7.js.map +1 -0
- package/tbn-block-ByOI6Y43.js +43 -0
- package/tbn-block-ByOI6Y43.js.map +1 -0
- package/teleport-in-block-BMa17cqq.js +10 -0
- package/teleport-in-block-BMa17cqq.js.map +1 -0
- package/teleport-out-block-5AkB25H6.js +19 -0
- package/teleport-out-block-5AkB25H6.js.map +1 -0
- package/texture-block-rr21KIL_.js +70 -0
- package/texture-block-rr21KIL_.js.map +1 -0
- package/thin-instance-fragment-hsv-RyDs.js +69 -0
- package/thin-instance-fragment-hsv-RyDs.js.map +1 -0
- package/thin-instance-gpu-C9Gv_Z1w.js +62 -0
- package/thin-instance-gpu-C9Gv_Z1w.js.map +1 -0
- package/tracking-primitives-wgdBY85t.js +82 -0
- package/tracking-primitives-wgdBY85t.js.map +1 -0
- package/transform-block-DbRph9JI.js +32 -0
- package/transform-block-DbRph9JI.js.map +1 -0
- package/trigonometry-block-BYQcTHiD.js +36 -0
- package/trigonometry-block-BYQcTHiD.js.map +1 -0
- package/triplanar-block-BZHkD9hX.js +148 -0
- package/triplanar-block-BZHkD9hX.js.map +1 -0
- package/twirl-block-78WtdiBd.js +39 -0
- package/twirl-block-78WtdiBd.js.map +1 -0
- package/unlit-fragment-BIlhJpz6.js +43 -0
- package/unlit-fragment-BIlhJpz6.js.map +1 -0
- package/uv-transform-fragment-hYujGpZg.js +47 -0
- package/uv-transform-fragment-hYujGpZg.js.map +1 -0
- package/vector-merger-CrW-ONB0.js +43 -0
- package/vector-merger-CrW-ONB0.js.map +1 -0
- package/vector-splitter-BoJuHrAU.js +34 -0
- package/vector-splitter-BoJuHrAU.js.map +1 -0
- package/vertex-output-Cvft64y0.js +14 -0
- package/vertex-output-Cvft64y0.js.map +1 -0
- package/view-direction-CWVucfnT.js +12 -0
- package/view-direction-CWVucfnT.js.map +1 -0
- package/voronoi-noise-block-iNQxa_Ls.js +43 -0
- package/voronoi-noise-block-iNQxa_Ls.js.map +1 -0
- package/wave-block-CY_mk1ec.js +41 -0
- package/wave-block-CY_mk1ec.js.map +1 -0
- package/wgsl-helpers-DyzNzCeE.js +48 -0
- package/wgsl-helpers-DyzNzCeE.js.map +1 -0
- package/worley-noise-3d-block-CyR2-k4s.js +58 -0
- package/worley-noise-3d-block-CyR2-k4s.js.map +1 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
let dracoBaseUrl = "/";
|
|
2
|
+
let modulePromise = null;
|
|
3
|
+
let scriptLoadPromise = null;
|
|
4
|
+
function loadDracoScript() {
|
|
5
|
+
if (scriptLoadPromise) {
|
|
6
|
+
return scriptLoadPromise;
|
|
7
|
+
}
|
|
8
|
+
scriptLoadPromise = new Promise((resolve, reject) => {
|
|
9
|
+
const existing = globalThis.DracoDecoderModule;
|
|
10
|
+
if (existing) {
|
|
11
|
+
resolve(existing);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const script = document.createElement("script");
|
|
15
|
+
script.src = dracoBaseUrl + "draco_decoder.js";
|
|
16
|
+
script.onload = () => {
|
|
17
|
+
const factory = globalThis.DracoDecoderModule;
|
|
18
|
+
if (!factory) {
|
|
19
|
+
reject(new Error("draco_decoder.js loaded but DracoDecoderModule is undefined"));
|
|
20
|
+
} else {
|
|
21
|
+
resolve(factory);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
script.onerror = () => reject(new Error("Failed to load draco_decoder.js from " + script.src));
|
|
25
|
+
document.head.appendChild(script);
|
|
26
|
+
});
|
|
27
|
+
return scriptLoadPromise;
|
|
28
|
+
}
|
|
29
|
+
async function getDracoModule() {
|
|
30
|
+
if (modulePromise) {
|
|
31
|
+
return modulePromise;
|
|
32
|
+
}
|
|
33
|
+
modulePromise = (async () => {
|
|
34
|
+
const factory = await loadDracoScript();
|
|
35
|
+
return factory({ locateFile: (f) => dracoBaseUrl + f });
|
|
36
|
+
})();
|
|
37
|
+
return modulePromise;
|
|
38
|
+
}
|
|
39
|
+
async function decodeDracoPrimitive(compressed, attributeMap, accessorTypes) {
|
|
40
|
+
const module = await getDracoModule();
|
|
41
|
+
const decoder = new module.Decoder();
|
|
42
|
+
const buffer = new module.DecoderBuffer();
|
|
43
|
+
buffer.Init(compressed, compressed.byteLength);
|
|
44
|
+
const mesh = new module.Mesh();
|
|
45
|
+
const status = decoder.DecodeBufferToMesh(buffer, mesh);
|
|
46
|
+
if (!status.ok()) {
|
|
47
|
+
const err = status.error_msg();
|
|
48
|
+
module.destroy(buffer);
|
|
49
|
+
module.destroy(mesh);
|
|
50
|
+
module.destroy(decoder);
|
|
51
|
+
throw new Error("Draco decode failed: " + err);
|
|
52
|
+
}
|
|
53
|
+
const numPoints = mesh.num_points();
|
|
54
|
+
const numFaces = mesh.num_faces();
|
|
55
|
+
const indexCount = numFaces * 3;
|
|
56
|
+
const indexByteLength = indexCount * 4;
|
|
57
|
+
const indexPtr = module._malloc(indexByteLength);
|
|
58
|
+
decoder.GetTrianglesUInt32Array(mesh, indexByteLength, indexPtr);
|
|
59
|
+
const indices = new Uint32Array(module.HEAPU32.buffer, indexPtr, indexCount).slice();
|
|
60
|
+
module._free(indexPtr);
|
|
61
|
+
const attributes = /* @__PURE__ */ new Map();
|
|
62
|
+
for (const name of Object.keys(attributeMap)) {
|
|
63
|
+
const uniqueId = attributeMap[name];
|
|
64
|
+
const attr = decoder.GetAttributeByUniqueId(mesh, uniqueId);
|
|
65
|
+
const componentCount = accessorTypes[name] ?? 3;
|
|
66
|
+
const totalComponents = numPoints * componentCount;
|
|
67
|
+
const isIntAttr = name === "JOINTS_0" || name === "JOINTS_1";
|
|
68
|
+
const bytesPerElement = 4;
|
|
69
|
+
const byteLength = totalComponents * bytesPerElement;
|
|
70
|
+
const ptr = module._malloc(byteLength);
|
|
71
|
+
const dataType = isIntAttr ? module.DT_INT32 : module.DT_FLOAT32;
|
|
72
|
+
decoder.GetAttributeDataArrayForAllPoints(mesh, attr, dataType, byteLength, ptr);
|
|
73
|
+
if (isIntAttr) {
|
|
74
|
+
attributes.set(name, new Int32Array(module.HEAP32.buffer, ptr, totalComponents).slice());
|
|
75
|
+
} else {
|
|
76
|
+
attributes.set(name, new Float32Array(module.HEAPF32.buffer, ptr, totalComponents).slice());
|
|
77
|
+
}
|
|
78
|
+
module._free(ptr);
|
|
79
|
+
}
|
|
80
|
+
module.destroy(buffer);
|
|
81
|
+
module.destroy(mesh);
|
|
82
|
+
module.destroy(decoder);
|
|
83
|
+
return { _attributes: attributes, _indices: indices, _vertexCount: numPoints, _indexCount: indexCount };
|
|
84
|
+
}
|
|
85
|
+
function getDracoBufferViewBytes(json, binChunk, bufferViewIdx) {
|
|
86
|
+
const view = json.bufferViews[bufferViewIdx];
|
|
87
|
+
if (!view) {
|
|
88
|
+
throw new Error(`Draco bufferView ${bufferViewIdx} not found`);
|
|
89
|
+
}
|
|
90
|
+
const offset = binChunk.byteOffset + (view.byteOffset ?? 0);
|
|
91
|
+
return new Uint8Array(binChunk.buffer, offset, view.byteLength);
|
|
92
|
+
}
|
|
93
|
+
const TYPE_COMPONENT_COUNTS = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 };
|
|
94
|
+
const feature = {
|
|
95
|
+
id: "KHR_draco_mesh_compression",
|
|
96
|
+
async preMesh(jsonIn, binChunk) {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
const json = jsonIn;
|
|
99
|
+
const out = /* @__PURE__ */ new Map();
|
|
100
|
+
for (const mesh of json.meshes ?? []) {
|
|
101
|
+
for (const primitive of mesh.primitives ?? []) {
|
|
102
|
+
const ext = (_a = primitive.extensions) == null ? void 0 : _a.KHR_draco_mesh_compression;
|
|
103
|
+
if (!ext) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const bytes = getDracoBufferViewBytes(json, binChunk, ext.bufferView);
|
|
107
|
+
const accessorTypes = {};
|
|
108
|
+
for (const name of Object.keys(ext.attributes)) {
|
|
109
|
+
const accIdx = (_b = primitive.attributes) == null ? void 0 : _b[name];
|
|
110
|
+
if (accIdx !== void 0 && ((_c = json.accessors) == null ? void 0 : _c[accIdx])) {
|
|
111
|
+
accessorTypes[name] = TYPE_COMPONENT_COUNTS[json.accessors[accIdx].type] ?? 3;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const decoded = await decodeDracoPrimitive(bytes, ext.attributes, accessorTypes);
|
|
115
|
+
out.set(primitive, decoded);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
feature as default
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=gltf-feature-draco-yGSMGTE3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-draco-yGSMGTE3.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 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 Uint32Array(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 Int32Array(module.HEAP32.buffer, ptr, totalComponents).slice());\n } else {\n attributes.set(name, new Float32Array(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 Uint8Array(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":"AAkBA,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,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,eAAe;AAC5B,WAAO,SAAS,MAAM;AAClB,YAAM,UAAW,WAAqD;AACtE,UAAI,CAAC,SAAS;AACV,eAAO,IAAI,MAAM,6DAA6D,CAAC;AAAA,MACnF,OAAO;AACH,gBAAQ,OAAO;AAAA,MACnB;AAAA,IACJ;AACA,WAAO,UAAU,MAAM,OAAO,IAAI,MAAM,0CAA0C,OAAO,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AAM,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;"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { r as resolveAccessor, v as setThinInstances, x as mat4ComposeInto, d as computeAabb, y as mat4Multiply } from "./index-C8HOR2sB.js";
|
|
2
|
+
function collectMeshesUnderNode(tn) {
|
|
3
|
+
const out = [];
|
|
4
|
+
for (const c of (tn == null ? void 0 : tn.children) ?? []) {
|
|
5
|
+
if (c && typeof c === "object" && "material" in c) {
|
|
6
|
+
out.push(c);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
function buildInstanceMatrices(translation, rotation, scale, count) {
|
|
12
|
+
const matrices = new Float32Array(count * 16);
|
|
13
|
+
for (let i = 0; i < count; i++) {
|
|
14
|
+
const tx = translation ? translation[i * 3] : 0;
|
|
15
|
+
const ty = translation ? translation[i * 3 + 1] : 0;
|
|
16
|
+
const tz = translation ? translation[i * 3 + 2] : 0;
|
|
17
|
+
const qx = rotation ? rotation[i * 4] : 0;
|
|
18
|
+
const qy = rotation ? rotation[i * 4 + 1] : 0;
|
|
19
|
+
const qz = rotation ? rotation[i * 4 + 2] : 0;
|
|
20
|
+
const qw = rotation ? rotation[i * 4 + 3] : 1;
|
|
21
|
+
const sx = scale ? scale[i * 3] : 1;
|
|
22
|
+
const sy = scale ? scale[i * 3 + 1] : 1;
|
|
23
|
+
const sz = scale ? scale[i * 3 + 2] : 1;
|
|
24
|
+
mat4ComposeInto(matrices, i * 16, tx, ty, tz, qx, qy, qz, qw, sx, sy, sz);
|
|
25
|
+
}
|
|
26
|
+
return matrices;
|
|
27
|
+
}
|
|
28
|
+
const ext = {
|
|
29
|
+
id: "EXT_mesh_gpu_instancing",
|
|
30
|
+
async applyAsset(_meshes, _root, ctx) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
const { _json: json, _binChunk: binChunk, _nodeMap: nodeMap } = ctx;
|
|
33
|
+
if (!nodeMap) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
const nodes = json.nodes ?? [];
|
|
37
|
+
for (let nodeIdx = 0; nodeIdx < nodes.length; nodeIdx++) {
|
|
38
|
+
const attrs = (_c = (_b = (_a = nodes[nodeIdx]) == null ? void 0 : _a.extensions) == null ? void 0 : _b.EXT_mesh_gpu_instancing) == null ? void 0 : _c.attributes;
|
|
39
|
+
if (!attrs) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const tn = nodeMap[nodeIdx];
|
|
43
|
+
if (!tn) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const meshesForNode = collectMeshesUnderNode(tn);
|
|
47
|
+
if (meshesForNode.length === 0) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const tAcc = attrs.TRANSLATION !== void 0 ? resolveAccessor(json, binChunk, attrs.TRANSLATION) : null;
|
|
51
|
+
const rAcc = attrs.ROTATION !== void 0 ? resolveAccessor(json, binChunk, attrs.ROTATION) : null;
|
|
52
|
+
const sAcc = attrs.SCALE !== void 0 ? resolveAccessor(json, binChunk, attrs.SCALE) : null;
|
|
53
|
+
let count = 0;
|
|
54
|
+
for (const acc of [tAcc, rAcc, sAcc]) {
|
|
55
|
+
if (!acc) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (count === 0) {
|
|
59
|
+
count = acc._count;
|
|
60
|
+
} else if (acc._count !== count) {
|
|
61
|
+
throw new Error(`EXT_mesh_gpu_instancing: accessor count mismatch on node ${nodeIdx}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (count === 0) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const matrices = buildInstanceMatrices(
|
|
68
|
+
tAcc ? tAcc._data : null,
|
|
69
|
+
rAcc ? rAcc._data : null,
|
|
70
|
+
sAcc ? sAcc._data : null,
|
|
71
|
+
count
|
|
72
|
+
);
|
|
73
|
+
const nodeWorld = ctx._worldMatrixCache.get(nodeIdx);
|
|
74
|
+
for (const mesh of meshesForNode) {
|
|
75
|
+
setThinInstances(mesh, matrices, count);
|
|
76
|
+
expandMeshAabbForInstances(mesh, matrices, count, nodeWorld);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function expandMeshAabbForInstances(mesh, matrices, count, nodeWorld) {
|
|
83
|
+
const positions = mesh._cpuPositions;
|
|
84
|
+
if (!positions || !nodeWorld || count === 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const [lmin, lmax] = computeAabb(positions);
|
|
88
|
+
if (!isFinite(lmin[0])) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const corners = new Float32Array([
|
|
92
|
+
lmin[0],
|
|
93
|
+
lmin[1],
|
|
94
|
+
lmin[2],
|
|
95
|
+
lmax[0],
|
|
96
|
+
lmin[1],
|
|
97
|
+
lmin[2],
|
|
98
|
+
lmin[0],
|
|
99
|
+
lmax[1],
|
|
100
|
+
lmin[2],
|
|
101
|
+
lmax[0],
|
|
102
|
+
lmax[1],
|
|
103
|
+
lmin[2],
|
|
104
|
+
lmin[0],
|
|
105
|
+
lmin[1],
|
|
106
|
+
lmax[2],
|
|
107
|
+
lmax[0],
|
|
108
|
+
lmin[1],
|
|
109
|
+
lmax[2],
|
|
110
|
+
lmin[0],
|
|
111
|
+
lmax[1],
|
|
112
|
+
lmax[2],
|
|
113
|
+
lmax[0],
|
|
114
|
+
lmax[1],
|
|
115
|
+
lmax[2]
|
|
116
|
+
]);
|
|
117
|
+
let wMinX = Infinity, wMinY = Infinity, wMinZ = Infinity;
|
|
118
|
+
let wMaxX = -Infinity, wMaxY = -Infinity, wMaxZ = -Infinity;
|
|
119
|
+
const instWorld = new Float32Array(16);
|
|
120
|
+
for (let i = 0; i < count; i++) {
|
|
121
|
+
for (let k = 0; k < 16; k++) {
|
|
122
|
+
instWorld[k] = matrices[i * 16 + k];
|
|
123
|
+
}
|
|
124
|
+
const combined = mat4Multiply(nodeWorld, instWorld);
|
|
125
|
+
const [imin, imax] = computeAabb(corners, combined);
|
|
126
|
+
if (imin[0] < wMinX) {
|
|
127
|
+
wMinX = imin[0];
|
|
128
|
+
}
|
|
129
|
+
if (imin[1] < wMinY) {
|
|
130
|
+
wMinY = imin[1];
|
|
131
|
+
}
|
|
132
|
+
if (imin[2] < wMinZ) {
|
|
133
|
+
wMinZ = imin[2];
|
|
134
|
+
}
|
|
135
|
+
if (imax[0] > wMaxX) {
|
|
136
|
+
wMaxX = imax[0];
|
|
137
|
+
}
|
|
138
|
+
if (imax[1] > wMaxY) {
|
|
139
|
+
wMaxY = imax[1];
|
|
140
|
+
}
|
|
141
|
+
if (imax[2] > wMaxZ) {
|
|
142
|
+
wMaxZ = imax[2];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
mesh.boundMin = [wMinX, wMinY, wMinZ];
|
|
146
|
+
mesh.boundMax = [wMaxX, wMaxY, wMaxZ];
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
ext as default
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=gltf-feature-gpu-instancing-2e_CFQnl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-gpu-instancing-2e_CFQnl.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 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 { setThinInstances } from \"../mesh/thin-instance.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 Float32Array(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. */\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 Float32Array([\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 = new Float32Array(16) as Mat4;\n for (let i = 0; i < count; i++) {\n for (let k = 0; k < 16; k++) {\n instWorld[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 (im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AAK,CAAC;AAAA,IACtC;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;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { M as MAX_LIGHTS, s as setMaxLights, g as computeNodeWorldMatrix } from "./index-C8HOR2sB.js";
|
|
2
|
+
const feature = {
|
|
3
|
+
id: "KHR_lights_punctual",
|
|
4
|
+
async applyAsset(_meshes, _root, ctx) {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
6
|
+
const defs = (_b = (_a = ctx._json.extensions) == null ? void 0 : _a.KHR_lights_punctual) == null ? void 0 : _b.lights;
|
|
7
|
+
if (!(defs == null ? void 0 : defs.length)) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
const lights = [];
|
|
11
|
+
const nodes = ctx._json.nodes ?? [];
|
|
12
|
+
let lightNodeCount = 0;
|
|
13
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
14
|
+
if (((_e = (_d = (_c = nodes[i]) == null ? void 0 : _c.extensions) == null ? void 0 : _d.KHR_lights_punctual) == null ? void 0 : _e.light) !== void 0) {
|
|
15
|
+
lightNodeCount++;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (lightNodeCount > MAX_LIGHTS) {
|
|
19
|
+
setMaxLights(lightNodeCount);
|
|
20
|
+
}
|
|
21
|
+
for (let nodeIdx = 0; nodeIdx < nodes.length; nodeIdx++) {
|
|
22
|
+
const lightIdx = (_h = (_g = (_f = nodes[nodeIdx]) == null ? void 0 : _f.extensions) == null ? void 0 : _g.KHR_lights_punctual) == null ? void 0 : _h.light;
|
|
23
|
+
if (lightIdx === void 0) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const def = defs[lightIdx];
|
|
27
|
+
if (!def) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const world = computeNodeWorldMatrix(ctx._json, nodeIdx, ctx._parentMap, ctx._worldMatrixCache);
|
|
31
|
+
const px = world[12];
|
|
32
|
+
const py = world[13];
|
|
33
|
+
const pz = world[14];
|
|
34
|
+
const fx = -world[8];
|
|
35
|
+
const fy = -world[9];
|
|
36
|
+
const fz = -world[10];
|
|
37
|
+
const flen = Math.hypot(fx, fy, fz) || 1;
|
|
38
|
+
const dir = [fx / flen, fy / flen, fz / flen];
|
|
39
|
+
const color = def.color ? [def.color[0], def.color[1], def.color[2]] : [1, 1, 1];
|
|
40
|
+
const intensity = def.intensity ?? 1;
|
|
41
|
+
const range = def.range !== void 0 ? def.range : Number.MAX_VALUE;
|
|
42
|
+
if (def.type === "point") {
|
|
43
|
+
const { createPointLight } = await import("./index-C8HOR2sB.js").then((n) => n.gd);
|
|
44
|
+
const pl = createPointLight([px, py, pz], intensity);
|
|
45
|
+
pl.diffuse = color;
|
|
46
|
+
pl.specular = color;
|
|
47
|
+
pl.range = range;
|
|
48
|
+
lights.push(pl);
|
|
49
|
+
} else if (def.type === "directional") {
|
|
50
|
+
const { createDirectionalLight } = await import("./index-C8HOR2sB.js").then((n) => n.ge);
|
|
51
|
+
const dl = createDirectionalLight(dir, intensity);
|
|
52
|
+
dl.diffuse = color;
|
|
53
|
+
dl.specular = color;
|
|
54
|
+
lights.push(dl);
|
|
55
|
+
} else if (def.type === "spot") {
|
|
56
|
+
const { createSpotLight } = await import("./index-C8HOR2sB.js").then((n) => n.gf);
|
|
57
|
+
const outer = ((_i = def.spot) == null ? void 0 : _i.outerConeAngle) ?? Math.PI / 4;
|
|
58
|
+
const sl = createSpotLight([px, py, pz], dir, outer * 2, 1, intensity);
|
|
59
|
+
sl.diffuse = color;
|
|
60
|
+
sl.specular = color;
|
|
61
|
+
sl.range = range;
|
|
62
|
+
lights.push(sl);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { entities: lights };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
feature as default
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=gltf-feature-lights-punctual-DDDg4j0U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-lights-punctual-DDDg4j0U.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,MAAM,EAAE;AACnB,YAAM,KAAK,MAAM,EAAE;AAGnB,YAAM,KAAK,CAAC,MAAM,CAAC;AACnB,YAAM,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AAA,IACJ;AACA,WAAO,EAAE,UAAU,OAAA;AAAA,EACvB;AACJ;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
let meshoptBaseUrl = "/";
|
|
2
|
+
let scriptLoadPromise = null;
|
|
3
|
+
function loadMeshoptScript() {
|
|
4
|
+
if (scriptLoadPromise) {
|
|
5
|
+
return scriptLoadPromise;
|
|
6
|
+
}
|
|
7
|
+
scriptLoadPromise = new Promise((resolve, reject) => {
|
|
8
|
+
const existing = globalThis.MeshoptDecoder;
|
|
9
|
+
if (existing) {
|
|
10
|
+
resolve(existing);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const script = document.createElement("script");
|
|
14
|
+
script.src = meshoptBaseUrl + "meshopt_decoder.js";
|
|
15
|
+
script.onload = () => {
|
|
16
|
+
const mod = globalThis.MeshoptDecoder;
|
|
17
|
+
if (!mod) {
|
|
18
|
+
reject(new Error("meshopt_decoder.js loaded but MeshoptDecoder is undefined"));
|
|
19
|
+
} else {
|
|
20
|
+
resolve(mod);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
script.onerror = () => reject(new Error("Failed to load meshopt_decoder.js from " + script.src));
|
|
24
|
+
document.head.appendChild(script);
|
|
25
|
+
});
|
|
26
|
+
return scriptLoadPromise;
|
|
27
|
+
}
|
|
28
|
+
async function getMeshoptDecoder() {
|
|
29
|
+
const mod = await loadMeshoptScript();
|
|
30
|
+
await mod.ready;
|
|
31
|
+
return mod;
|
|
32
|
+
}
|
|
33
|
+
function align4(n) {
|
|
34
|
+
return n + 3 & -4;
|
|
35
|
+
}
|
|
36
|
+
const feature = {
|
|
37
|
+
id: "EXT_meshopt_compression",
|
|
38
|
+
async preParse(json, binChunk) {
|
|
39
|
+
var _a;
|
|
40
|
+
const bufferViews = json.bufferViews ?? [];
|
|
41
|
+
const decoder = await getMeshoptDecoder();
|
|
42
|
+
const materialized = new Array(bufferViews.length);
|
|
43
|
+
const newOffsets = new Array(bufferViews.length);
|
|
44
|
+
let total = 0;
|
|
45
|
+
for (let i = 0; i < bufferViews.length; i++) {
|
|
46
|
+
const bv = bufferViews[i];
|
|
47
|
+
const ext = (_a = bv.extensions) == null ? void 0 : _a.EXT_meshopt_compression;
|
|
48
|
+
let bytes;
|
|
49
|
+
if (ext) {
|
|
50
|
+
if ((ext.buffer ?? 0) !== 0) {
|
|
51
|
+
throw new Error(`EXT_meshopt_compression: compressed source buffer ${ext.buffer} is not buffer 0 (unsupported)`);
|
|
52
|
+
}
|
|
53
|
+
const source = new Uint8Array(binChunk.buffer, binChunk.byteOffset + (ext.byteOffset ?? 0), ext.byteLength);
|
|
54
|
+
const target = new Uint8Array(ext.count * ext.byteStride);
|
|
55
|
+
decoder.decodeGltfBuffer(target, ext.count, ext.byteStride, source, ext.mode, ext.filter ?? "NONE");
|
|
56
|
+
bytes = target;
|
|
57
|
+
} else {
|
|
58
|
+
if ((bv.buffer ?? 0) !== 0) {
|
|
59
|
+
throw new Error(`EXT_meshopt_compression: uncompressed bufferView in buffer ${bv.buffer} is not buffer 0 (unsupported)`);
|
|
60
|
+
}
|
|
61
|
+
bytes = new Uint8Array(binChunk.buffer.slice(binChunk.byteOffset + (bv.byteOffset ?? 0), binChunk.byteOffset + (bv.byteOffset ?? 0) + bv.byteLength));
|
|
62
|
+
}
|
|
63
|
+
materialized[i] = bytes;
|
|
64
|
+
newOffsets[i] = total;
|
|
65
|
+
total = align4(total + bytes.length);
|
|
66
|
+
}
|
|
67
|
+
const packed = new Uint8Array(total);
|
|
68
|
+
for (let i = 0; i < bufferViews.length; i++) {
|
|
69
|
+
const bv = bufferViews[i];
|
|
70
|
+
packed.set(materialized[i], newOffsets[i]);
|
|
71
|
+
bv.buffer = 0;
|
|
72
|
+
bv.byteOffset = newOffsets[i];
|
|
73
|
+
bv.byteLength = materialized[i].length;
|
|
74
|
+
if (bv.extensions) {
|
|
75
|
+
delete bv.extensions.EXT_meshopt_compression;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return new DataView(packed.buffer);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
feature as default
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=gltf-feature-meshopt-Des96YFI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-meshopt-Des96YFI.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 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 Uint8Array(binChunk.buffer, binChunk.byteOffset + (ext.byteOffset ?? 0), ext.byteLength);\n const target = new Uint8Array(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 Uint8Array(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 Uint8Array(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 DataView(packed.buffer);\n },\n};\n\nexport default feature;\n"],"names":[],"mappings":"AAYA,IAAI,iBAAiB;AAarB,IAAI,oBAA0D;AAE9D,SAAS,oBAAmD;AACxD,MA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AAc,IAAI,cAAc,IAAI,IAAI,UAAU;AAC1G,cAAM,SAAS,IAAI,WAAW,IAAI,QAAQ,IAAI,UAAU;AACxD,gBAAQ,iBAAiB,QAAQ,IAAI,OAAO,IAAI,YAAY,QAAQ,IAAI,MAAM,IAAI,UAAU,MAAM;AAClG,gBAAQ;AAAA,MACZ,OAAO;AACH,aAAK,GAAG,UAAU,OAAO,GAAG;AACxB,gBAAM,IAAI,MAAM,8DAA8D,GAAG,MAAM,gCAAgC;AAAA,QAC3H;AACA,gBAAQ,IAAI,WAAW,SAAS,OAAO,MAAM,SAAS,cAAc,GAAG,cAAc,IAAI,SAAS,cAAc,GAAG,cAAc,KAAK,GAAG,UAAU,CAAC;AAAA,MACxJ;AACA,mBAAa,CAAC,IAAI;AAClB,iBAAW,CAAC,IAAI;AAChB,cAAQ,OAAO,QAAQ,MAAM,MAAM;AAAA,IACvC;AAGA,UAAM,SAAS,IAAI,WAAW,KAAK;AACnC,aAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AACzC,YAAM,KAAK,YAAY,CAAC;AACxB,aAAO,IAAI,aAAa,CAAC,GAAI,WAAW,CAAC,CAAE;AAC3C,SAAG,SAAS;AACZ,SAAG,aAAa,WAAW,CAAC;AAC5B,SAAG,aAAa,aAAa,CAAC,EAAG;AACjC,UAAI,GAAG,YAAY;AACf,eAAO,GAAG,WAAW;AAAA,MACzB;AAAA,IACJ;AAEA,WAAO,IAAI,SAAS,OAAO,MAAM;AAAA,EACrC;AACJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { r as resolveAccessor } from "./index-C8HOR2sB.js";
|
|
2
|
+
const feature = {
|
|
3
|
+
id: "_morph",
|
|
4
|
+
async applyMesh(meshData, mesh, ctx) {
|
|
5
|
+
const primitive = meshData._primitive;
|
|
6
|
+
const targets = primitive.targets;
|
|
7
|
+
if (!targets || targets.length === 0) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const { _json: json, _binChunk: binChunk } = ctx;
|
|
11
|
+
const morphTargets = [];
|
|
12
|
+
for (const target of targets) {
|
|
13
|
+
const posAcc = target.POSITION !== void 0 ? resolveAccessor(json, binChunk, target.POSITION) : null;
|
|
14
|
+
const normAcc = target.NORMAL !== void 0 ? resolveAccessor(json, binChunk, target.NORMAL) : null;
|
|
15
|
+
morphTargets.push({
|
|
16
|
+
positions: posAcc ? posAcc._data : new Float32Array(meshData._vertexCount * 3),
|
|
17
|
+
normals: normAcc ? normAcc._data : null
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const parentMesh = json.meshes[json.nodes[meshData._nodeIndex].mesh];
|
|
21
|
+
const morphWeights = parentMesh.weights ?? new Array(targets.length).fill(0);
|
|
22
|
+
const { createMorphTargets } = await import("./index-C8HOR2sB.js").then((n) => n.gi);
|
|
23
|
+
mesh.morphTargets = createMorphTargets(ctx._engine, morphTargets, meshData._vertexCount, morphWeights);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
feature as default
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=gltf-feature-morph-CKCw6tkX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-morph-CKCw6tkX.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 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 Float32Array(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":";AAMA,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,aAAa,SAAS,eAAe,CAAC;AAAA,QAC/F,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;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { r as resolveAccessor } from "./index-C8HOR2sB.js";
|
|
2
|
+
function resolveAttr(name, primitive, decoded, json, binChunk) {
|
|
3
|
+
var _a;
|
|
4
|
+
if (decoded && decoded._attributes.has(name)) {
|
|
5
|
+
return decoded._attributes.get(name);
|
|
6
|
+
}
|
|
7
|
+
const idx = (_a = primitive.attributes) == null ? void 0 : _a[name];
|
|
8
|
+
return idx !== void 0 ? resolveAccessor(json, binChunk, idx)._data : null;
|
|
9
|
+
}
|
|
10
|
+
const feature = {
|
|
11
|
+
id: "_skeleton",
|
|
12
|
+
async applyMesh(meshData, mesh, ctx) {
|
|
13
|
+
const { _json: json, _binChunk: binChunk, _parentMap: parentMap, _worldMatrixCache: worldMatrixCache } = ctx;
|
|
14
|
+
const node = json.nodes[meshData._nodeIndex];
|
|
15
|
+
if (node.skin === void 0 || !json.skins) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const primitive = meshData._primitive;
|
|
19
|
+
const decoded = meshData._decoded;
|
|
20
|
+
const joints = resolveAttr("JOINTS_0", primitive, decoded, json, binChunk);
|
|
21
|
+
const weights = resolveAttr("WEIGHTS_0", primitive, decoded, json, binChunk);
|
|
22
|
+
if (!joints || !weights) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const joints1 = resolveAttr("JOINTS_1", primitive, decoded, json, binChunk);
|
|
26
|
+
const weights1 = resolveAttr("WEIGHTS_1", primitive, decoded, json, binChunk);
|
|
27
|
+
const [{ extractSkin, computeBoneTextureData }, { createSkeleton }] = await Promise.all([import("./gltf-animation-D7uyTyO3.js"), import("./create-skeleton-C9JdIJnb.js")]);
|
|
28
|
+
const skin = extractSkin(json, binChunk, node.skin, meshData._worldMatrix, parentMap, worldMatrixCache);
|
|
29
|
+
const boneData = computeBoneTextureData(skin);
|
|
30
|
+
mesh.skeleton = createSkeleton(ctx._engine, joints, weights, skin.jointNodes.length, boneData, joints1, weights1);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
feature as default
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=gltf-feature-skeleton-D8hWLqi2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-skeleton-D8hWLqi2.js","sources":["../src/loader-gltf/gltf-feature-skeleton.ts"],"sourcesContent":["/** Skeletal animation feature. Extracts joints/weights/skin on demand so the\n * core loader doesn't carry any skinning-related code for non-skinned assets. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\nimport { resolveAccessor } from \"./gltf-parser.js\";\n\n/** Resolve a vertex attribute by name, preferring any pre-decoded\n * (e.g. Draco) data over the raw accessor. */\nfunction resolveAttr(name: string, primitive: any, decoded: any, json: any, binChunk: DataView): ArrayBufferView | null {\n if (decoded && decoded._attributes.has(name)) {\n return decoded._attributes.get(name)!;\n }\n const idx = primitive.attributes?.[name];\n return idx !== undefined ? (resolveAccessor(json, binChunk, idx)._data as ArrayBufferView) : null;\n}\n\nconst feature: GltfFeature = {\n id: \"_skeleton\",\n async applyMesh(meshData, mesh, ctx) {\n const { _json: json, _binChunk: binChunk, _parentMap: parentMap, _worldMatrixCache: worldMatrixCache } = ctx;\n const node = json.nodes[meshData._nodeIndex];\n if (node.skin === undefined || !json.skins) {\n return;\n }\n const primitive = meshData._primitive;\n const decoded = meshData._decoded;\n const joints = resolveAttr(\"JOINTS_0\", primitive, decoded, json, binChunk) as Uint16Array | Uint8Array | null;\n const weights = resolveAttr(\"WEIGHTS_0\", primitive, decoded, json, binChunk) as Float32Array | null;\n if (!joints || !weights) {\n return;\n }\n const joints1 = resolveAttr(\"JOINTS_1\", primitive, decoded, json, binChunk) as Uint16Array | Uint8Array | null;\n const weights1 = resolveAttr(\"WEIGHTS_1\", primitive, decoded, json, binChunk) as Float32Array | null;\n\n const [{ extractSkin, computeBoneTextureData }, { createSkeleton }] = await Promise.all([import(\"./gltf-animation.js\"), import(\"../skeleton/create-skeleton.js\")]);\n const skin = extractSkin(json, binChunk, node.skin, meshData._worldMatrix, parentMap, worldMatrixCache);\n const boneData = computeBoneTextureData(skin);\n mesh.skeleton = createSkeleton(ctx._engine, joints, weights, skin.jointNodes.length, boneData, joints1, weights1);\n },\n};\nexport default feature;\n"],"names":[],"mappings":";AAQA,SAAS,YAAY,MAAc,WAAgB,SAAc,MAAW,UAA4C;;AACpH,MAAI,WAAW,QAAQ,YAAY,IAAI,IAAI,GAAG;AAC1C,WAAO,QAAQ,YAAY,IAAI,IAAI;AAAA,EACvC;AACA,QAAM,OAAM,eAAU,eAAV,mBAAuB;AACnC,SAAO,QAAQ,SAAa,gBAAgB,MAAM,UAAU,GAAG,EAAE,QAA4B;AACjG;AAEA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,UAAU,UAAU,MAAM,KAAK;AACjC,UAAM,EAAE,OAAO,MAAM,WAAW,UAAU,YAAY,WAAW,mBAAmB,iBAAA,IAAqB;AACzG,UAAM,OAAO,KAAK,MAAM,SAAS,UAAU;AAC3C,QAAI,KAAK,SAAS,UAAa,CAAC,KAAK,OAAO;AACxC;AAAA,IACJ;AACA,UAAM,YAAY,SAAS;AAC3B,UAAM,UAAU,SAAS;AACzB,UAAM,SAAS,YAAY,YAAY,WAAW,SAAS,MAAM,QAAQ;AACzE,UAAM,UAAU,YAAY,aAAa,WAAW,SAAS,MAAM,QAAQ;AAC3E,QAAI,CAAC,UAAU,CAAC,SAAS;AACrB;AAAA,IACJ;AACA,UAAM,UAAU,YAAY,YAAY,WAAW,SAAS,MAAM,QAAQ;AAC1E,UAAM,WAAW,YAAY,aAAa,WAAW,SAAS,MAAM,QAAQ;AAE5E,UAAM,CAAC,EAAE,aAAa,0BAA0B,EAAE,gBAAgB,IAAI,MAAM,QAAQ,IAAI,CAAC,OAAO,8BAAqB,GAAG,OAAO,+BAAgC,CAAC,CAAC;AACjK,UAAM,OAAO,YAAY,MAAM,UAAU,KAAK,MAAM,SAAS,cAAc,WAAW,gBAAgB;AACtG,UAAM,WAAW,uBAAuB,IAAI;AAC5C,SAAK,WAAW,eAAe,IAAI,SAAS,QAAQ,SAAS,KAAK,WAAW,QAAQ,UAAU,SAAS,QAAQ;AAAA,EACpH;AACJ;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const feature = {
|
|
2
|
+
id: "KHR_materials_variants",
|
|
3
|
+
async applyAsset(meshes, _root, ctx) {
|
|
4
|
+
var _a, _b, _c;
|
|
5
|
+
const variantNames = (_c = (_b = (_a = ctx._json.extensions) == null ? void 0 : _a.KHR_materials_variants) == null ? void 0 : _b.variants) == null ? void 0 : _c.map((v) => v.name);
|
|
6
|
+
if (!(variantNames == null ? void 0 : variantNames.length)) {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
const { loadVariantMaterials } = await import("./gltf-variants-DFbr8EES.js");
|
|
10
|
+
const materialVariants = await loadVariantMaterials(ctx._json, ctx._binChunk, ctx._baseUrl, variantNames, meshes, ctx._engine, ctx._matExts, ctx._wrapTex);
|
|
11
|
+
return { materialVariants };
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
feature as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=gltf-feature-variants-Ds6v9byg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-feature-variants-Ds6v9byg.js","sources":["../src/loader-gltf/gltf-feature-variants.ts"],"sourcesContent":["/** KHR_materials_variants feature.\n * Triggered when the root extension carries variant definitions. Per-asset\n * hook builds variant material data shared with the material-ext driver. */\n\nimport type { GltfFeature } from \"./gltf-feature.js\";\n\nconst feature: GltfFeature = {\n id: \"KHR_materials_variants\",\n async applyAsset(meshes, _root, ctx) {\n const variantNames: string[] | undefined = ctx._json.extensions?.KHR_materials_variants?.variants?.map((v: { name: string }) => v.name);\n if (!variantNames?.length) {\n return {};\n }\n const { loadVariantMaterials } = await import(\"./gltf-variants.js\");\n const materialVariants = await loadVariantMaterials(ctx._json, ctx._binChunk, ctx._baseUrl, variantNames, meshes, ctx._engine, ctx._matExts, ctx._wrapTex);\n return { materialVariants };\n },\n};\nexport default feature;\n"],"names":[],"mappings":"AAMA,MAAM,UAAuB;AAAA,EACzB,IAAI;AAAA,EACJ,MAAM,WAAW,QAAQ,OAAO,KAAK;AAFzC;AAGQ,UAAM,gBAAqC,qBAAI,MAAM,eAAV,mBAAsB,2BAAtB,mBAA8C,aAA9C,mBAAwD,IAAI,CAAC,MAAwB,EAAE;AAClI,QAAI,EAAC,6CAAc,SAAQ;AACvB,aAAO,CAAA;AAAA,IACX;AACA,UAAM,EAAE,qBAAA,IAAyB,MAAM,OAAO,6BAAoB;AAClE,UAAM,mBAAmB,MAAM,qBAAqB,IAAI,OAAO,IAAI,WAAW,IAAI,UAAU,cAAc,QAAQ,IAAI,SAAS,IAAI,UAAU,IAAI,QAAQ;AACzJ,WAAO,EAAE,iBAAA;AAAA,EACb;AACJ;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const feature = {
|
|
2
|
+
id: "KHR_xmp_json_ld",
|
|
3
|
+
async applyAsset(_meshes, _root, ctx) {
|
|
4
|
+
var _a, _b, _c, _d, _e;
|
|
5
|
+
const json = ctx._json;
|
|
6
|
+
const packets = ((_b = (_a = json.extensions) == null ? void 0 : _a.KHR_xmp_json_ld) == null ? void 0 : _b.packets) ?? [];
|
|
7
|
+
const assetPacketIndex = (_e = (_d = (_c = json.asset) == null ? void 0 : _c.extensions) == null ? void 0 : _d.KHR_xmp_json_ld) == null ? void 0 : _e.packet;
|
|
8
|
+
const assetPacket = assetPacketIndex !== void 0 ? packets[assetPacketIndex] : void 0;
|
|
9
|
+
return { xmpMetadata: { packets, assetPacket } };
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
feature as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=gltf-feature-xmp-BUfq_IVG.js.map
|