@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,55 @@
|
|
|
1
|
+
const RANK = {
|
|
2
|
+
f32: 1,
|
|
3
|
+
vec2f: 2,
|
|
4
|
+
vec3f: 3,
|
|
5
|
+
vec4f: 4,
|
|
6
|
+
mat4f: 0,
|
|
7
|
+
texture2d: 0,
|
|
8
|
+
textureCube: 0
|
|
9
|
+
};
|
|
10
|
+
const RANK_TYPE = { 1: "f32", 2: "vec2f", 3: "vec3f", 4: "vec4f" };
|
|
11
|
+
function widerType(a, b) {
|
|
12
|
+
const ra = RANK[a] || 0;
|
|
13
|
+
const rb = RANK[b] || 0;
|
|
14
|
+
const r = Math.max(ra, rb);
|
|
15
|
+
if (!r) {
|
|
16
|
+
throw new Error(`NodeMaterial: cannot pick common numeric type from ${a} and ${b}`);
|
|
17
|
+
}
|
|
18
|
+
return RANK_TYPE[r];
|
|
19
|
+
}
|
|
20
|
+
function binaryEmitter(className, op, leftName = "left", rightName = "right") {
|
|
21
|
+
return {
|
|
22
|
+
className,
|
|
23
|
+
emit(block, _outputName, stage, state, ctx) {
|
|
24
|
+
const l = ctx.resolve(block, leftName, stage, state);
|
|
25
|
+
const r = ctx.resolve(block, rightName, stage, state);
|
|
26
|
+
const t = widerType(l.type, r.type);
|
|
27
|
+
const lc = ctx.cast(l, t).expr;
|
|
28
|
+
const rc = ctx.cast(r, t).expr;
|
|
29
|
+
return { expr: `(${op(lc, rc)})`, type: t };
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function unaryEmitter(className, op, returnType, inputName = "input") {
|
|
34
|
+
return {
|
|
35
|
+
className,
|
|
36
|
+
emit(block, _outputName, stage, state, ctx) {
|
|
37
|
+
const v = ctx.resolve(block, inputName, stage, state);
|
|
38
|
+
return { expr: `(${op(v.expr)})`, type: v.type };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function formatFloat(n) {
|
|
43
|
+
if (!Number.isFinite(n)) {
|
|
44
|
+
return "0.0";
|
|
45
|
+
}
|
|
46
|
+
const s = n.toString();
|
|
47
|
+
return s.includes(".") || s.includes("e") ? s : `${s}.0`;
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
binaryEmitter as b,
|
|
51
|
+
formatFloat as f,
|
|
52
|
+
unaryEmitter as u,
|
|
53
|
+
widerType as w
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=_math-factory-C-QqW-Wi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_math-factory-C-QqW-Wi.js","sources":["../src/material/node/blocks/_math-factory.ts"],"sourcesContent":["/** Shared factories for NME math blocks.\n *\n * Every block module uses these helpers to stay small — the registry still\n * maps each BJS class name to its own dynamic import, so Rollup can emit one\n * chunk per block. The factory code itself lands in a shared vendor chunk\n * that is only pulled when at least one math block is used.\n */\n\nimport type { BlockEmitter, NodeBlock, NodeBuildState, NodeEmitContext, NodeValueType } from \"../node-types.js\";\n\ntype Rank = 1 | 2 | 3 | 4;\nconst RANK: Record<NodeValueType, Rank | 0> = {\n f32: 1,\n vec2f: 2,\n vec3f: 3,\n vec4f: 4,\n mat4f: 0,\n texture2d: 0,\n textureCube: 0,\n};\nconst RANK_TYPE: Record<Rank, NodeValueType> = { 1: \"f32\", 2: \"vec2f\", 3: \"vec3f\", 4: \"vec4f\" };\n\n/** Pick the wider of two numeric NME types (`f32 < vec2 < vec3 < vec4`). */\nexport function widerType(a: NodeValueType, b: NodeValueType): NodeValueType {\n const ra = RANK[a] || 0;\n const rb = RANK[b] || 0;\n const r = Math.max(ra, rb) as Rank;\n if (!r) {\n throw new Error(`NodeMaterial: cannot pick common numeric type from ${a} and ${b}`);\n }\n return RANK_TYPE[r];\n}\n\n/** Binary op whose output type = widerType(left, right). */\nexport function binaryEmitter(className: string, op: (l: string, r: string) => string, leftName = \"left\", rightName = \"right\"): BlockEmitter {\n return {\n className,\n emit(block, _outputName, stage, state, ctx) {\n const l = ctx.resolve(block, leftName, stage, state);\n const r = ctx.resolve(block, rightName, stage, state);\n const t = widerType(l.type, r.type);\n const lc = ctx.cast(l, t).expr;\n const rc = ctx.cast(r, t).expr;\n return { expr: `(${op(lc, rc)})`, type: t };\n },\n };\n}\n\n/** Unary op — output type matches input. Optional `returnType` override. */\nexport function unaryEmitter(className: string, op: (v: string) => string, returnType?: NodeValueType, inputName = \"input\"): BlockEmitter {\n return {\n className,\n emit(block, _outputName, stage, state, ctx) {\n const v = ctx.resolve(block, inputName, stage, state);\n return { expr: `(${op(v.expr)})`, type: returnType ?? v.type };\n },\n };\n}\n\n/** Resolve an input, or fall back to a serialized scalar literal on the block. */\nexport function resolveOrScalar(block: NodeBlock, inputName: string, fallbackKey: string, stage: Parameters<BlockEmitter[\"emit\"]>[2], state: NodeBuildState, ctx: NodeEmitContext) {\n const input = block.inputs.get(inputName);\n if (input?.source) {\n return ctx.resolve(block, inputName, stage, state);\n }\n const raw = block.serialized[fallbackKey];\n const n = typeof raw === \"number\" ? raw : 0;\n return { expr: `${formatFloat(n)}`, type: \"f32\" as NodeValueType };\n}\n\nexport function formatFloat(n: number): string {\n if (!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AQ,OAAO,WAAW,OAAO,KAAK;AACpD,aAAO,EAAE,MAAM,IAAI,GAAG,EAAE,IAAI,CAAC,KAAK,MAAoB,EAAE,KAAA;AAAA,IAC5D;AAAA,EAAA;AAER;AAaO,SAAS,YAAY,GAAmB;AAC3C,MAAI,CAAC,OAAO,SAAS,CAAC,GAAG;AACrB,WAAO;AAAA,EACX;AACA,QAAM,IAAI,EAAE,SAAA;AACZ,SAAO,EAAE,SAAS,GAAG,KAAK,EAAE,SAAS,GAAG,IAAI,IAAI,GAAG,CAAC;AACxD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-block-CikX5gWy.js","sources":["../src/material/node/blocks/add-block.ts"],"sourcesContent":["import { binaryEmitter } from \"./_math-factory.js\";\nexport const emitter = binaryEmitter(\"AddBlock\", (l, r) => `${l} + ${r}`);\n"],"names":[],"mappings":";AACO,MAAM,UAAU,cAAc,YAAY,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ap as PBR_HAS_ALPHA_TEST } from "./index-C8HOR2sB.js";
|
|
2
|
+
const pbrExt = {
|
|
3
|
+
id: "alpha-test",
|
|
4
|
+
phase: "fragment",
|
|
5
|
+
frag(ctx) {
|
|
6
|
+
return ctx._features & PBR_HAS_ALPHA_TEST ? {
|
|
7
|
+
_id: "alpha-test",
|
|
8
|
+
_uboFields: [{ _name: "alphaCutOff", _type: "f32" }],
|
|
9
|
+
_fragmentSlots: { AT: `if(alpha*material.materialAlpha<material.alphaCutOff){discard;}` }
|
|
10
|
+
} : null;
|
|
11
|
+
},
|
|
12
|
+
writeUbo(data, mat, offsets) {
|
|
13
|
+
const off = offsets.get("alphaCutOff");
|
|
14
|
+
if (off !== void 0) {
|
|
15
|
+
data[off / 4] = mat.alphaCutOff ?? 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
pbrExt
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=alpha-test-fragment-CUiHCw7W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha-test-fragment-CUiHCw7W.js","sources":["../src/material/pbr/fragments/alpha-test-fragment.ts"],"sourcesContent":["import type { PbrMaterialProps } from \"../pbr-material.js\";\nimport type { PbrExt } from \"../pbr-flags.js\";\nimport { PBR_HAS_ALPHA_TEST } from \"../pbr-flag-bits.js\";\n\nexport const pbrExt: PbrExt = {\n id: \"alpha-test\",\n phase: \"fragment\",\n frag(ctx) {\n return ctx._features & PBR_HAS_ALPHA_TEST\n ? {\n _id: \"alpha-test\",\n _uboFields: [{ _name: \"alphaCutOff\", _type: \"f32\" }],\n _fragmentSlots: { AT: `if(alpha*material.materialAlpha<material.alphaCutOff){discard;}` },\n }\n : null;\n },\n writeUbo(data, mat, offsets) {\n const off = offsets.get(\"alphaCutOff\");\n if (off !== undefined) {\n data[off / 4] = (mat as PbrMaterialProps).alphaCutOff ?? 0;\n }\n },\n};\n"],"names":[],"mappings":";AAIO,MAAM,SAAiB;AAAA,EAC1B,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK,KAAK;AACN,WAAO,IAAI,YAAY,qBACjB;AAAA,MACI,KAAK;AAAA,MACL,YAAY,CAAC,EAAE,OAAO,eAAe,OAAO,OAAO;AAAA,MACnD,gBAAgB,EAAE,IAAI,kEAAA;AAAA,IAAkE,IAE5F;AAAA,EACV;AAAA,EACA,SAAS,MAAM,KAAK,SAAS;AACzB,UAAM,MAAM,QAAQ,IAAI,aAAa;AACrC,QAAI,QAAQ,QAAW;AACnB,WAAK,MAAM,CAAC,IAAK,IAAyB,eAAe;AAAA,IAC7D;AAAA,EACJ;AACJ;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const HELPER_KEY = "nme_ambientOcclusion";
|
|
2
|
+
const HELPER_WGSL = `
|
|
3
|
+
fn nme_aoNormalFromDepth(depthTex: texture_2d<f32>, depthSamp: sampler, depth: f32, coords: vec2<f32>, radius: f32) -> vec3<f32> {
|
|
4
|
+
let offset1 = vec2<f32>(0.0, radius);
|
|
5
|
+
let offset2 = vec2<f32>(radius, 0.0);
|
|
6
|
+
let depth1 = textureSampleLevel(depthTex, depthSamp, coords + offset1, 0.0).r;
|
|
7
|
+
let depth2 = textureSampleLevel(depthTex, depthSamp, coords + offset2, 0.0).r;
|
|
8
|
+
let p1 = vec3<f32>(offset1, depth1 - depth);
|
|
9
|
+
let p2 = vec3<f32>(offset2, depth2 - depth);
|
|
10
|
+
var normal = cross(p1, p2);
|
|
11
|
+
normal.z = -normal.z;
|
|
12
|
+
return normalize(normal);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fn nme_aoRandom(uv: vec2<f32>) -> vec3<f32> {
|
|
16
|
+
let x = fract(sin(dot(uv, vec2<f32>(12.9898, 78.233))) * 43758.5453);
|
|
17
|
+
let y = fract(sin(dot(uv, vec2<f32>(39.3468, 11.135))) * 24634.6345);
|
|
18
|
+
let z = fract(sin(dot(uv, vec2<f32>(73.156, 52.235))) * 12414.2347);
|
|
19
|
+
return normalize(vec3<f32>(x, y, z));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fn nme_computeAo(depthTex: texture_2d<f32>, depthSamp: sampler, fragCoord: vec4<f32>, screenSize: vec2<f32>, radius: f32, area: f32, fallOff: f32) -> f32 {
|
|
23
|
+
let uv = fragCoord.xy / screenSize;
|
|
24
|
+
let random = nme_aoRandom(uv * 4.0);
|
|
25
|
+
let depth = textureSampleLevel(depthTex, depthSamp, uv, 0.0).r;
|
|
26
|
+
let position = vec3<f32>(uv, depth);
|
|
27
|
+
let normal = nme_aoNormalFromDepth(depthTex, depthSamp, depth, uv, radius);
|
|
28
|
+
let radiusDepth = radius / depth;
|
|
29
|
+
let sampleSphere = array<vec3<f32>, 16>(
|
|
30
|
+
vec3<f32>(0.5381, 0.1856, -0.4319), vec3<f32>(0.1379, 0.2486, 0.4430), vec3<f32>(0.3371, 0.5679, -0.0057), vec3<f32>(-0.6999, -0.0451, -0.0019),
|
|
31
|
+
vec3<f32>(0.0689, -0.1598, -0.8547), vec3<f32>(0.0560, 0.0069, -0.1843), vec3<f32>(-0.0146, 0.1402, 0.0762), vec3<f32>(0.0100, -0.1924, -0.0344),
|
|
32
|
+
vec3<f32>(-0.3577, -0.5301, -0.4358), vec3<f32>(-0.3169, 0.1063, 0.0158), vec3<f32>(0.0103, -0.5869, 0.0046), vec3<f32>(-0.0897, -0.4940, 0.3287),
|
|
33
|
+
vec3<f32>(0.7119, -0.0154, -0.0918), vec3<f32>(-0.0533, 0.0596, -0.5411), vec3<f32>(0.0352, -0.0631, 0.5460), vec3<f32>(-0.4776, 0.2847, -0.0271)
|
|
34
|
+
);
|
|
35
|
+
var occlusion = 0.0;
|
|
36
|
+
for (var i = 0; i < 16; i = i + 1) {
|
|
37
|
+
let ray = radiusDepth * reflect(sampleSphere[i], random);
|
|
38
|
+
let hemiRay = position + sign(dot(ray, normal)) * ray;
|
|
39
|
+
let occlusionDepth = textureSample(depthTex, depthSamp, clamp(hemiRay.xy, vec2<f32>(0.001), vec2<f32>(0.999))).r;
|
|
40
|
+
let difference = depth - occlusionDepth;
|
|
41
|
+
occlusion += step(fallOff, difference) * (1.0 - smoothstep(fallOff, area, difference));
|
|
42
|
+
}
|
|
43
|
+
return clamp(1.0 - occlusion / 16.0, 0.0, 1.0);
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
function sanitize(name) {
|
|
47
|
+
return name.replace(/[^A-Za-z0-9_]/g, "_");
|
|
48
|
+
}
|
|
49
|
+
function num(value, fallback) {
|
|
50
|
+
return typeof value === "number" ? `${value}` : `${fallback}`;
|
|
51
|
+
}
|
|
52
|
+
const emitter = {
|
|
53
|
+
className: "AmbientOcclusionBlock",
|
|
54
|
+
stage: "fragment",
|
|
55
|
+
emit(block, _outputName, stage, state, ctx) {
|
|
56
|
+
var _a;
|
|
57
|
+
const source = (_a = block.inputs.get("source")) == null ? void 0 : _a.source;
|
|
58
|
+
if (!source) {
|
|
59
|
+
throw new Error(`NodeMaterial: AmbientOcclusionBlock "${block.name}" requires an ImageSourceBlock source`);
|
|
60
|
+
}
|
|
61
|
+
const producer = ctx.graph.blocks.get(source.blockId);
|
|
62
|
+
const bindingName = sanitize((producer == null ? void 0 : producer.name) || `ao${block.id}`);
|
|
63
|
+
if (!state.textures.find((t) => t.name === bindingName)) {
|
|
64
|
+
state.textures.push({ name: bindingName, kind: "texture2d", texture: null });
|
|
65
|
+
}
|
|
66
|
+
state.fragment.helpers.set(HELPER_KEY, HELPER_WGSL);
|
|
67
|
+
const screenSize = ctx.cast(ctx.resolve(block, "screenSize", stage, state), "vec2f").expr;
|
|
68
|
+
return {
|
|
69
|
+
expr: `nme_computeAo(nodeTex_${bindingName}, nodeSamp_${bindingName}, _NME_FRAG_COORD_, ${screenSize}, ${num(block.serialized.radius, 1e-4)}, ${num(block.serialized.area, 75e-4)}, ${num(block.serialized.fallOff, 1e-6)})`,
|
|
70
|
+
type: "f32"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
emitter
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=ambient-occlusion-block-DForhWL3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient-occlusion-block-DForhWL3.js","sources":["../src/material/node/blocks/ambient-occlusion-block.ts"],"sourcesContent":["import type { BlockEmitter, NodeExpr } from \"../node-types.js\";\n\nconst HELPER_KEY = \"nme_ambientOcclusion\";\nconst HELPER_WGSL = `\nfn nme_aoNormalFromDepth(depthTex: texture_2d<f32>, depthSamp: sampler, depth: f32, coords: vec2<f32>, radius: f32) -> vec3<f32> {\n let offset1 = vec2<f32>(0.0, radius);\n let offset2 = vec2<f32>(radius, 0.0);\n let depth1 = textureSampleLevel(depthTex, depthSamp, coords + offset1, 0.0).r;\n let depth2 = textureSampleLevel(depthTex, depthSamp, coords + offset2, 0.0).r;\n let p1 = vec3<f32>(offset1, depth1 - depth);\n let p2 = vec3<f32>(offset2, depth2 - depth);\n var normal = cross(p1, p2);\n normal.z = -normal.z;\n return normalize(normal);\n}\n\nfn nme_aoRandom(uv: vec2<f32>) -> vec3<f32> {\n let x = fract(sin(dot(uv, vec2<f32>(12.9898, 78.233))) * 43758.5453);\n let y = fract(sin(dot(uv, vec2<f32>(39.3468, 11.135))) * 24634.6345);\n let z = fract(sin(dot(uv, vec2<f32>(73.156, 52.235))) * 12414.2347);\n return normalize(vec3<f32>(x, y, z));\n}\n\nfn nme_computeAo(depthTex: texture_2d<f32>, depthSamp: sampler, fragCoord: vec4<f32>, screenSize: vec2<f32>, radius: f32, area: f32, fallOff: f32) -> f32 {\n let uv = fragCoord.xy / screenSize;\n let random = nme_aoRandom(uv * 4.0);\n let depth = textureSampleLevel(depthTex, depthSamp, uv, 0.0).r;\n let position = vec3<f32>(uv, depth);\n let normal = nme_aoNormalFromDepth(depthTex, depthSamp, depth, uv, radius);\n let radiusDepth = radius / depth;\n let sampleSphere = array<vec3<f32>, 16>(\n vec3<f32>(0.5381, 0.1856, -0.4319), vec3<f32>(0.1379, 0.2486, 0.4430), vec3<f32>(0.3371, 0.5679, -0.0057), vec3<f32>(-0.6999, -0.0451, -0.0019),\n vec3<f32>(0.0689, -0.1598, -0.8547), vec3<f32>(0.0560, 0.0069, -0.1843), vec3<f32>(-0.0146, 0.1402, 0.0762), vec3<f32>(0.0100, -0.1924, -0.0344),\n vec3<f32>(-0.3577, -0.5301, -0.4358), vec3<f32>(-0.3169, 0.1063, 0.0158), vec3<f32>(0.0103, -0.5869, 0.0046), vec3<f32>(-0.0897, -0.4940, 0.3287),\n vec3<f32>(0.7119, -0.0154, -0.0918), vec3<f32>(-0.0533, 0.0596, -0.5411), vec3<f32>(0.0352, -0.0631, 0.5460), vec3<f32>(-0.4776, 0.2847, -0.0271)\n );\n var occlusion = 0.0;\n for (var i = 0; i < 16; i = i + 1) {\n let ray = radiusDepth * reflect(sampleSphere[i], random);\n let hemiRay = position + sign(dot(ray, normal)) * ray;\n let occlusionDepth = textureSample(depthTex, depthSamp, clamp(hemiRay.xy, vec2<f32>(0.001), vec2<f32>(0.999))).r;\n let difference = depth - occlusionDepth;\n occlusion += step(fallOff, difference) * (1.0 - smoothstep(fallOff, area, difference));\n }\n return clamp(1.0 - occlusion / 16.0, 0.0, 1.0);\n}\n`;\n\nfunction sanitize(name: string): string {\n return name.replace(/[^A-Za-z0-9_]/g, \"_\");\n}\n\nfunction num(value: unknown, fallback: number): string {\n return typeof value === \"number\" ? `${value}` : `${fallback}`;\n}\n\nexport const emitter: BlockEmitter = {\n className: \"AmbientOcclusionBlock\",\n stage: \"fragment\",\n emit(block, _outputName, stage, state, ctx): NodeExpr {\n const source = block.inputs.get(\"source\")?.source;\n if (!source) {\n throw new Error(`NodeMaterial: AmbientOcclusionBlock \"${block.name}\" requires an ImageSourceBlock source`);\n }\n const producer = ctx.graph.blocks.get(source.blockId);\n const bindingName = sanitize(producer?.name || `ao${block.id}`);\n if (!state.textures.find((t) => t.name === bindingName)) {\n state.textures.push({ name: bindingName, kind: \"texture2d\", texture: null });\n }\n state.fragment.helpers.set(HELPER_KEY, HELPER_WGSL);\n const screenSize = ctx.cast(ctx.resolve(block, \"screenSize\", stage, state), \"vec2f\").expr;\n return {\n expr: `nme_computeAo(nodeTex_${bindingName}, nodeSamp_${bindingName}, _NME_FRAG_COORD_, ${screenSize}, ${num(block.serialized.radius, 0.0001)}, ${num(block.serialized.area, 0.0075)}, ${num(block.serialized.fallOff, 0.000001)})`,\n type: \"f32\",\n };\n },\n};\n"],"names":[],"mappings":"AAEA,MAAM,aAAa;AACnB,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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
+
const emitter = {
|
|
2
|
+
className: "AnisotropyBlock",
|
|
3
|
+
stage: "fragment",
|
|
4
|
+
emit(_block, _outputName, _stage, state, _ctx) {
|
|
5
|
+
state.usesAnisotropy = true;
|
|
6
|
+
return { expr: `vec3<f32>(0.0)`, type: "vec3f" };
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
emitter
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=anisotropy-block-D5fXH_OY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anisotropy-block-D5fXH_OY.js","sources":["../src/material/node/blocks/anisotropy-block.ts"],"sourcesContent":["/** AnisotropyBlock — passthrough marker.\n *\n * All anisotropic GGX math (alphaT/alphaB, anisotropic Burley D, anisotropic\n * Smith visibility, bent-normal env reflection) is implemented inside\n * PBRMetallicRoughnessBlock, which walks into the connected AnisotropyBlock\n * to read its inputs (intensity, direction, uv).\n */\n\nimport type { BlockEmitter } from \"../node-types.js\";\n\nexport const emitter: BlockEmitter = {\n className: \"AnisotropyBlock\",\n stage: \"fragment\",\n emit(_block, _outputName, _stage, state, _ctx) {\n state.usesAnisotropy = true;\n return { expr: `vec3<f32>(0.0)`, type: \"vec3f\" };\n },\n};\n"],"names":[],"mappings":"AAUO,MAAM,UAAwB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,KAAK,QAAQ,aAAa,QAAQ,OAAO,MAAM;AAC3C,UAAM,iBAAiB;AACvB,WAAO,EAAE,MAAM,kBAAkB,MAAM,QAAA;AAAA,EAC3C;AACJ;"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const ANISO_BRDF_FUNCTIONS = `
|
|
2
|
+
const RECIPROCAL_PI: f32 = 0.3183098861837907;
|
|
3
|
+
fn getAnisotropicRoughness(alphaG: f32, anisotropy: f32) -> vec2<f32> {
|
|
4
|
+
let aT = max(mix(alphaG, 1.0, anisotropy * anisotropy), 0.0005);
|
|
5
|
+
let aB = max(alphaG, 0.0005);
|
|
6
|
+
return vec2<f32>(aT, aB);
|
|
7
|
+
}
|
|
8
|
+
fn D_GGX_Anisotropic(NdotH: f32, TdotH: f32, BdotH: f32, alphaTB: vec2<f32>) -> f32 {
|
|
9
|
+
let a2 = alphaTB.x * alphaTB.y;
|
|
10
|
+
let v = vec3<f32>(alphaTB.y * TdotH, alphaTB.x * BdotH, a2 * NdotH);
|
|
11
|
+
let v2 = dot(v, v);
|
|
12
|
+
let w2 = a2 / v2;
|
|
13
|
+
return a2 * w2 * w2 * RECIPROCAL_PI;
|
|
14
|
+
}
|
|
15
|
+
fn V_GGXCorrelated_Anisotropic(NdotL: f32, NdotV: f32, TdotV: f32, BdotV: f32, TdotL: f32, BdotL: f32, alphaTB: vec2<f32>) -> f32 {
|
|
16
|
+
let lambdaV = NdotL * length(vec3<f32>(alphaTB.x * TdotV, alphaTB.y * BdotV, NdotV));
|
|
17
|
+
let lambdaL = NdotV * length(vec3<f32>(alphaTB.x * TdotL, alphaTB.y * BdotL, NdotL));
|
|
18
|
+
return 0.5 / (lambdaV + lambdaL);
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
function makeAnisotropyTBBlock(hasNormal) {
|
|
22
|
+
if (hasNormal) {
|
|
23
|
+
return `var anisoT = normalize(input.worldTangent);
|
|
24
|
+
var anisoB = normalize(input.worldBitangent);
|
|
25
|
+
{
|
|
26
|
+
let anisoDir = normalize(vec2<f32>(material.anisotropyParams.y, material.anisotropyParams.z));
|
|
27
|
+
anisoT = normalize(anisoT * anisoDir.x + anisoB * anisoDir.y);
|
|
28
|
+
anisoB = normalize(cross(N, anisoT));
|
|
29
|
+
}`;
|
|
30
|
+
}
|
|
31
|
+
return `var anisoT: vec3<f32>;
|
|
32
|
+
var anisoB: vec3<f32>;
|
|
33
|
+
{
|
|
34
|
+
let aniso_dp1 = dpdx(input.worldPos);
|
|
35
|
+
let aniso_dp2 = -dpdy(input.worldPos);
|
|
36
|
+
let aniso_duv1 = dpdx(input.uv);
|
|
37
|
+
let aniso_duv2 = -dpdy(input.uv);
|
|
38
|
+
let aniso_dp2perp = cross(aniso_dp2, N);
|
|
39
|
+
let aniso_dp1perp = cross(N, aniso_dp1);
|
|
40
|
+
var aniso_t = aniso_dp2perp * aniso_duv1.x + aniso_dp1perp * aniso_duv2.x;
|
|
41
|
+
var aniso_b = aniso_dp2perp * aniso_duv1.y + aniso_dp1perp * aniso_duv2.y;
|
|
42
|
+
let aniso_det = max(dot(aniso_t, aniso_t), dot(aniso_b, aniso_b));
|
|
43
|
+
let aniso_inv = select(inverseSqrt(aniso_det), 0.0, aniso_det == 0.0);
|
|
44
|
+
aniso_t *= aniso_inv;
|
|
45
|
+
aniso_b *= aniso_inv;
|
|
46
|
+
let aniso_tn = normalize(aniso_t);
|
|
47
|
+
let aniso_bn = normalize(aniso_b);
|
|
48
|
+
let anisoTBN = mat3x3<f32>(aniso_tn, aniso_bn, N);
|
|
49
|
+
let anisoDir = vec3<f32>(material.anisotropyParams.y, material.anisotropyParams.z, 0.0);
|
|
50
|
+
anisoT = normalize(anisoTBN * anisoDir);
|
|
51
|
+
anisoB = normalize(cross(anisoTBN[2], anisoT));
|
|
52
|
+
}`;
|
|
53
|
+
}
|
|
54
|
+
const ANISO_DIRECT_DG = `let aniso_alphaTB = getAnisotropicRoughness(directAlphaG, material.anisotropyParams.x);
|
|
55
|
+
let dl_TdotH = dot(anisoT, H); let dl_BdotH = dot(anisoB, H);
|
|
56
|
+
let dl_TdotV = dot(anisoT, V); let dl_BdotV = dot(anisoB, V);
|
|
57
|
+
let dl_TdotL = dot(anisoT, L); let dl_BdotL = dot(anisoB, L);
|
|
58
|
+
let D = D_GGX_Anisotropic(NdotH, dl_TdotH, dl_BdotH, aniso_alphaTB);
|
|
59
|
+
let G = V_GGXCorrelated_Anisotropic(NdotL, NdotV, dl_TdotV, dl_BdotV, dl_TdotL, dl_BdotL, aniso_alphaTB);`;
|
|
60
|
+
const ANISO_BENT_NORMAL = `let anisoIntensity = material.anisotropyParams.x;
|
|
61
|
+
var anisoBentNormal = cross(anisoB, V);
|
|
62
|
+
anisoBentNormal = normalize(cross(anisoBentNormal, anisoB));
|
|
63
|
+
let anisoSq = 1.0 - anisoIntensity * (1.0 - roughness);
|
|
64
|
+
let anisoA = anisoSq * anisoSq * anisoSq * anisoSq;
|
|
65
|
+
anisoBentNormal = normalize(mix(anisoBentNormal, N, anisoA));
|
|
66
|
+
let R_raw = reflect(-V, anisoBentNormal);`;
|
|
67
|
+
const pbrExt = {
|
|
68
|
+
id: "anisotropy",
|
|
69
|
+
phase: "fragment",
|
|
70
|
+
writeUbo(data, material, offsets) {
|
|
71
|
+
const aniso = material.anisotropy;
|
|
72
|
+
if (!(aniso == null ? void 0 : aniso.isEnabled) || !offsets.has("anisotropyParams")) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const off = offsets.get("anisotropyParams") / 4;
|
|
76
|
+
const dir = aniso.direction ?? [1, 0];
|
|
77
|
+
data[off] = aniso.intensity ?? 1;
|
|
78
|
+
data[off + 1] = dir[0];
|
|
79
|
+
data[off + 2] = dir[1];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
ANISO_BENT_NORMAL,
|
|
84
|
+
ANISO_BRDF_FUNCTIONS,
|
|
85
|
+
ANISO_DIRECT_DG,
|
|
86
|
+
makeAnisotropyTBBlock,
|
|
87
|
+
pbrExt
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=anisotropy-fragment-HgasXS7l.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anisotropy-fragment-HgasXS7l.js","sources":["../src/material/pbr/fragments/anisotropy-fragment.ts"],"sourcesContent":["/**\n * Anisotropy PBR Template Extension\n *\n * Provides WGSL strings for anisotropic BRDF and tangent frame computation.\n * Dynamically imported only when a scene uses PBR anisotropy, keeping\n * non-anisotropy PBR bundles lean.\n */\n\nimport type { PbrMaterialProps } from \"../pbr-material.js\";\nimport type { PbrExt } from \"../pbr-flags.js\";\n\nexport const ANISO_BRDF_FUNCTIONS = `\nconst RECIPROCAL_PI: f32 = 0.3183098861837907;\nfn getAnisotropicRoughness(alphaG: f32, anisotropy: f32) -> vec2<f32> {\nlet aT = max(mix(alphaG, 1.0, anisotropy * anisotropy), 0.0005);\nlet aB = max(alphaG, 0.0005);\nreturn vec2<f32>(aT, aB);\n}\nfn D_GGX_Anisotropic(NdotH: f32, TdotH: f32, BdotH: f32, alphaTB: vec2<f32>) -> f32 {\nlet a2 = alphaTB.x * alphaTB.y;\nlet v = vec3<f32>(alphaTB.y * TdotH, alphaTB.x * BdotH, a2 * NdotH);\nlet v2 = dot(v, v);\nlet w2 = a2 / v2;\nreturn a2 * w2 * w2 * RECIPROCAL_PI;\n}\nfn V_GGXCorrelated_Anisotropic(NdotL: f32, NdotV: f32, TdotV: f32, BdotV: f32, TdotL: f32, BdotL: f32, alphaTB: vec2<f32>) -> f32 {\nlet lambdaV = NdotL * length(vec3<f32>(alphaTB.x * TdotV, alphaTB.y * BdotV, NdotV));\nlet lambdaL = NdotV * length(vec3<f32>(alphaTB.x * TdotL, alphaTB.y * BdotL, NdotL));\nreturn 0.5 / (lambdaV + lambdaL);\n}\n`;\n\n/** Generate anisotropy tangent/bitangent computation block for the given normal mode. */\nexport function makeAnisotropyTBBlock(hasNormal: boolean): string {\n if (hasNormal) {\n return `var anisoT = normalize(input.worldTangent);\nvar anisoB = normalize(input.worldBitangent);\n{\nlet anisoDir = normalize(vec2<f32>(material.anisotropyParams.y, material.anisotropyParams.z));\nanisoT = normalize(anisoT * anisoDir.x + anisoB * anisoDir.y);\nanisoB = normalize(cross(N, anisoT));\n}`;\n }\n // Cotangent frame from UV screen-space derivatives — matches BJS cotangent_frame()\n // BJS negates dpdy via (-yFactor_) where yFactor_=1 in WebGPU\n return `var anisoT: vec3<f32>;\nvar anisoB: vec3<f32>;\n{\nlet aniso_dp1 = dpdx(input.worldPos);\nlet aniso_dp2 = -dpdy(input.worldPos);\nlet aniso_duv1 = dpdx(input.uv);\nlet aniso_duv2 = -dpdy(input.uv);\nlet aniso_dp2perp = cross(aniso_dp2, N);\nlet aniso_dp1perp = cross(N, aniso_dp1);\nvar aniso_t = aniso_dp2perp * aniso_duv1.x + aniso_dp1perp * aniso_duv2.x;\nvar aniso_b = aniso_dp2perp * aniso_duv1.y + aniso_dp1perp * aniso_duv2.y;\nlet aniso_det = max(dot(aniso_t, aniso_t), dot(aniso_b, aniso_b));\nlet aniso_inv = select(inverseSqrt(aniso_det), 0.0, aniso_det == 0.0);\naniso_t *= aniso_inv;\naniso_b *= aniso_inv;\nlet aniso_tn = normalize(aniso_t);\nlet aniso_bn = normalize(aniso_b);\nlet anisoTBN = mat3x3<f32>(aniso_tn, aniso_bn, N);\nlet anisoDir = vec3<f32>(material.anisotropyParams.y, material.anisotropyParams.z, 0.0);\nanisoT = normalize(anisoTBN * anisoDir);\nanisoB = normalize(cross(anisoTBN[2], anisoT));\n}`;\n}\n\n/** Anisotropic D/G replacement for single-light direct lighting. */\nexport const ANISO_DIRECT_DG = `let aniso_alphaTB = getAnisotropicRoughness(directAlphaG, material.anisotropyParams.x);\nlet dl_TdotH = dot(anisoT, H); let dl_BdotH = dot(anisoB, H);\nlet dl_TdotV = dot(anisoT, V); let dl_BdotV = dot(anisoB, V);\nlet dl_TdotL = dot(anisoT, L); let dl_BdotL = dot(anisoB, L);\nlet D = D_GGX_Anisotropic(NdotH, dl_TdotH, dl_BdotH, aniso_alphaTB);\nlet G = V_GGXCorrelated_Anisotropic(NdotL, NdotV, dl_TdotV, dl_BdotV, dl_TdotL, dl_BdotL, aniso_alphaTB);`;\n\n/** IBL bent normal computation for anisotropic reflection. */\nexport const ANISO_BENT_NORMAL = `let anisoIntensity = material.anisotropyParams.x;\nvar anisoBentNormal = cross(anisoB, V);\nanisoBentNormal = normalize(cross(anisoBentNormal, anisoB));\nlet anisoSq = 1.0 - anisoIntensity * (1.0 - roughness);\nlet anisoA = anisoSq * anisoSq * anisoSq * anisoSq;\nanisoBentNormal = normalize(mix(anisoBentNormal, N, anisoA));\nlet R_raw = reflect(-V, anisoBentNormal);`;\n\n/** Anisotropy extension — template-only (contributes no ShaderFragment or bindings);\n * present solely to write its material-UBO slice through the unified ext registry. */\nexport const pbrExt: PbrExt = {\n id: \"anisotropy\",\n phase: \"fragment\",\n writeUbo(data: Float32Array, material: unknown, offsets: ReadonlyMap<string, number>): void {\n const aniso = (material as PbrMaterialProps).anisotropy;\n if (!aniso?.isEnabled || !offsets.has(\"anisotropyParams\")) {\n return;\n }\n const off = offsets.get(\"anisotropyParams\")! / 4;\n const dir = aniso.direction ?? [1, 0];\n data[off] = aniso.intensity ?? 1.0;\n data[off + 1] = dir[0]!;\n data[off + 2] = dir[1]!;\n },\n};\n"],"names":[],"mappings":"AAWO,MAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsB7B,SAAS,sBAAsB,WAA4B;AAC9D,MAAI,WAAW;AACX,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOX;AAGA,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBX;AAGO,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAQxB,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU1B,MAAM,SAAiB;AAAA,EAC1B,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS,MAAoB,UAAmB,SAA4C;AACxF,UAAM,QAAS,SAA8B;AAC7C,QAAI,EAAC,+BAAO,cAAa,CAAC,QAAQ,IAAI,kBAAkB,GAAG;AACvD;AAAA,IACJ;AACA,UAAM,MAAM,QAAQ,IAAI,kBAAkB,IAAK;AAC/C,UAAM,MAAM,MAAM,aAAa,CAAC,GAAG,CAAC;AACpC,SAAK,GAAG,IAAI,MAAM,aAAa;AAC/B,SAAK,MAAM,CAAC,IAAI,IAAI,CAAC;AACrB,SAAK,MAAM,CAAC,IAAI,IAAI,CAAC;AAAA,EACzB;AACJ;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const emitter = {
|
|
2
|
+
className: "ArcTan2Block",
|
|
3
|
+
emit(block, _outputName, stage, state, ctx) {
|
|
4
|
+
const x = ctx.cast(ctx.resolve(block, "x", stage, state), "f32").expr;
|
|
5
|
+
const y = ctx.cast(ctx.resolve(block, "y", stage, state), "f32").expr;
|
|
6
|
+
return { expr: `atan2(${x}, ${y})`, type: "f32" };
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
emitter
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=arc-tan2-block-d8sWt_x0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arc-tan2-block-d8sWt_x0.js","sources":["../src/material/node/blocks/arc-tan2-block.ts"],"sourcesContent":["import type { BlockEmitter } from \"../node-types.js\";\n\nexport const emitter: BlockEmitter = {\n className: \"ArcTan2Block\",\n emit(block, _outputName, stage, state, ctx) {\n const x = ctx.cast(ctx.resolve(block, \"x\", stage, state), \"f32\").expr;\n const y = ctx.cast(ctx.resolve(block, \"y\", stage, state), \"f32\").expr;\n return { expr: `atan2(${x}, ${y})`, type: \"f32\" };\n },\n};\n"],"names":[],"mappings":"AAEO,MAAM,UAAwB;AAAA,EACjC,WAAW;AAAA,EACX,KAAK,OAAO,aAAa,OAAO,OAAO,KAAK;AACxC,UAAM,IAAI,IAAI,KAAK,IAAI,QAAQ,OAAO,KAAK,OAAO,KAAK,GAAG,KAAK,EAAE;AACjE,UAAM,IAAI,IAAI,KAAK,IAAI,QAAQ,OAAO,KAAK,OAAO,KAAK,GAAG,KAAK,EAAE;AACjE,WAAO,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,KAAK,MAAM,MAAA;AAAA,EAC9C;AACJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splat-sort-worker-Crg3CaCc.js","sources":["../src/loader-splat/splat-sort-worker.ts"],"sourcesContent":["/** Splat sort worker.\n *\n * Vite import: `import SortWorker from './splat-sort-worker.ts?worker&inline'`.\n * The `?worker&inline` query keeps the bundled worker JS embedded as a base-64\n * blob in the splat scene chunk — it adds zero bytes to any other scene\n * because the whole `loader-splat/` module is dynamic-imported.\n *\n * Protocol\n * --------\n * Init (once): `{ p: Float32Array, n: number }`\n * — buffer is transferred and retained on the worker side.\n * — positions are in mesh-LOCAL space (stride 3, xyz per splat).\n * Sort (N×): `{ m: Float32Array(16), f: Float32Array(3), c: Float32Array(3), d: BigInt64Array }`\n * — depthMix is round-tripped via transferable; layout is\n * high-32 bits = packed depth (then bit-inverted), low-32 bits = splat index.\n * After sort, low-32 bits give the back-to-front order.\n *\n * Depth recipe (mirrors BJS `_CreateWorker`)\n * ------------------------------------------\n * Per-frame the main thread sends the mesh's world matrix, the camera's\n * world-space forward vector and the camera's world-space position. The\n * worker collapses these into 4 scalars (a, b, c, d) such that\n * depth = a*localX + b*localY + c*localZ + d\n * = cameraForward · (world · localPos - cameraPosition).\n * This is more robust than the previous `10000 - dot(view-row, pos)` recipe:\n * - it accounts for non-identity world matrices (BJS Lite previously ignored them);\n * - it has no magic reference value, so it doesn't lose precision when\n * depths are large or wrap signs when depths exceed the reference;\n * - the back-to-front order is produced by bit-inverting the high 32 bits\n * of each i64 slot (`~indices[2j+1]`) instead of subtracting depths from\n * a constant — this preserves the full float precision range. */\n\nlet positions: Float32Array | null = null;\nlet vertexCount = 0;\n\nself.onmessage = (e: MessageEvent) => {\n const data = e.data as {\n p?: Float32Array;\n n?: number;\n m?: Float32Array;\n f?: Float32Array;\n c?: Float32Array;\n d?: BigInt64Array;\n };\n\n if (data.p) {\n positions = data.p;\n vertexCount = data.n ?? 0;\n return;\n }\n\n if (!positions || !data.m || !data.f || !data.c || !data.d) {\n return;\n }\n\n const m = data.m;\n const cf = data.f;\n const cp = data.c;\n const depthMix = data.d;\n const indices = new Uint32Array(depthMix.buffer);\n const floatMix = new Float32Array(depthMix.buffer);\n\n // Collapse cameraForward · (world · localPos - cameraPos) into (a*x + b*y + c*z + d).\n // Lite column-major: world's column k lives at indices [4k, 4k+1, 4k+2, 4k+3]\n // (the 4th row is always [0,0,0,1] for an affine matrix, so we skip m[3,7,11,15]).\n const camDot = cf[0]! * cp[0]! + cf[1]! * cp[1]! + cf[2]! * cp[2]!;\n const a = cf[0]! * m[0]! + cf[1]! * m[1]! + cf[2]! * m[2]!;\n const b = cf[0]! * m[4]! + cf[1]! * m[5]! + cf[2]! * m[6]!;\n const c = cf[0]! * m[8]! + cf[1]! * m[9]! + cf[2]! * m[10]!;\n const d = cf[0]! * m[12]! + cf[1]! * m[13]! + cf[2]! * m[14]! - camDot;\n\n for (let j = 0; j < vertexCount; j++) {\n indices[2 * j] = j;\n floatMix[2 * j + 1] = a * positions[3 * j]! + b * positions[3 * j + 1]! + c * positions[3 * j + 2]! + d;\n // Bit-invert the high 32 bits (where the depth float lives) so that\n // BigInt64Array.sort() yields back-to-front order without subtracting\n // depths from a constant (which would cap range and erode precision).\n indices[2 * j + 1] = ~indices[2 * j + 1]!;\n }\n\n depthMix.sort();\n\n (self as unknown as { postMessage: (m: unknown, t?: Transferable[]) => void }).postMessage({ d: depthMix }, [depthMix.buffer]);\n};\n"],"names":[],"mappings":";;AAgCA,MAAI,YAAiC;AACrC,MAAI,cAAc;AAElB,OAAK,YAAY,CAAC,MAAoB;AAClC,UAAM,OAAO,EAAE;AASf,QAAI,KAAK,GAAG;AACR,kBAAY,KAAK;AACjB,oBAAc,KAAK,KAAK;AACxB;AAAA,IACJ;AAEA,QAAI,CAAC,aAAa,CAAC,KAAK,KAAK,CAAC,KAAK,KAA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"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { e as createMappedBuffer, aO as getOrCreateSampler, aY as createUniformBuffer, aW as SCENE_UBO_WGSL } from "./index-C8HOR2sB.js";
|
|
2
|
+
import { a as WGSL_DITHER, b as WGSL_NO_DITHER } from "./wgsl-helpers-DyzNzCeE.js";
|
|
3
|
+
import { c as createCubemapSkyboxMaterial } from "./cubemap-skybox-material-DvXMVc4k.js";
|
|
4
|
+
const ddsSkyboxVertSrc = "// DDS Skybox Vertex Shader — standard world transform.\n// positionUVW uses local position for cube direction lookup.\n\nstruct MeshUniforms {\n world: mat4x4<f32>,\n};\n\n@group(1) @binding(0) var<uniform> mesh: MeshUniforms;\n\nstruct VertexOutput {\n @builtin(position) clipPos: vec4<f32>,\n @location(0) positionUVW: vec3<f32>,\n @location(1) positionW: vec3<f32>,\n};\n\n@vertex\nfn main(@location(0) position: vec3<f32>) -> VertexOutput {\n var output: VertexOutput;\n output.positionUVW = position;\n let worldPos = (mesh.world * vec4<f32>(position, 1.0)).xyz;\n output.positionW = worldPos;\n output.clipPos = scene.viewProjection * vec4<f32>(worldPos, 1.0);\n return output;\n}\n";
|
|
5
|
+
const ddsSkyboxFragSrc = "// DDS Cube Skybox Fragment Shader — samples DDS cube texture with BJS image processing.\n// Used by scenes that load backgroundSkybox.dds (createDefaultEnvironment).\n// Pipeline: exposure → Reinhard tonemap → gamma → contrast → dither.\n\nstruct MeshUniforms {\n world: mat4x4<f32>,\n primaryColor: vec3<f32>,\n exposureLinear: f32,\n contrast: f32,\n _pad1: f32,\n _pad2: f32,\n _pad3: f32,\n};\n\n@group(1) @binding(0) var<uniform> mesh: MeshUniforms;\n@group(1) @binding(1) var envCubemap: texture_cube<f32>;\n@group(1) @binding(2) var envSampler: sampler;\n\nstruct FragmentInput {\n @location(0) positionUVW: vec3<f32>,\n @location(1) positionW: vec3<f32>,\n};\n\n@fragment\nfn main(input: FragmentInput) -> @location(0) vec4<f32> {\n let dir = normalize(input.positionUVW);\n var color = textureSampleLevel(envCubemap, envSampler, dir, 0.0).rgb;\n\n // BJS BackgroundMaterial: colorBase = reflectionColor.rgb * primaryColor.rgb\n color *= mesh.primaryColor;\n\n if (scene.vImageInfos.w >= 0.0) {\n // Exposure\n color *= mesh.exposureLinear;\n // Reinhard tonemap (matches BJS toneMappingType 0)\n color = 1.0 - exp2(-1.590579 * color);\n // Gamma\n color = pow(color, vec3<f32>(1.0 / 2.2));\n color = saturate(color);\n\n // Contrast\n let highContrast = color * color * (3.0 - 2.0 * color);\n color = mix(color, highContrast, mesh.contrast - 1.0);\n\n // Dithering (enableNoise=true, variance=0.5)\n color = color + vec3<f32>(dither(input.positionW.xy, 0.5));\n color = max(color, vec3<f32>(0.0));\n }\n\n return vec4<f32>(color, 1.0);\n}\n";
|
|
6
|
+
const SKY_DDS_UNIFORM_SIZE = 96;
|
|
7
|
+
const DEFAULT_SKY_URL = "https://assets.babylonjs.com/core/environments/backgroundSkybox.dds";
|
|
8
|
+
function createSkyboxBuffers(engine, S) {
|
|
9
|
+
const positions = new Float32Array([
|
|
10
|
+
S,
|
|
11
|
+
-S,
|
|
12
|
+
S,
|
|
13
|
+
-S,
|
|
14
|
+
-S,
|
|
15
|
+
S,
|
|
16
|
+
-S,
|
|
17
|
+
S,
|
|
18
|
+
S,
|
|
19
|
+
S,
|
|
20
|
+
S,
|
|
21
|
+
S,
|
|
22
|
+
S,
|
|
23
|
+
S,
|
|
24
|
+
-S,
|
|
25
|
+
-S,
|
|
26
|
+
S,
|
|
27
|
+
-S,
|
|
28
|
+
-S,
|
|
29
|
+
-S,
|
|
30
|
+
-S,
|
|
31
|
+
S,
|
|
32
|
+
-S,
|
|
33
|
+
-S,
|
|
34
|
+
S,
|
|
35
|
+
S,
|
|
36
|
+
-S,
|
|
37
|
+
S,
|
|
38
|
+
-S,
|
|
39
|
+
-S,
|
|
40
|
+
S,
|
|
41
|
+
-S,
|
|
42
|
+
S,
|
|
43
|
+
S,
|
|
44
|
+
S,
|
|
45
|
+
S,
|
|
46
|
+
-S,
|
|
47
|
+
S,
|
|
48
|
+
S,
|
|
49
|
+
-S,
|
|
50
|
+
-S,
|
|
51
|
+
S,
|
|
52
|
+
-S,
|
|
53
|
+
-S,
|
|
54
|
+
-S,
|
|
55
|
+
-S,
|
|
56
|
+
S,
|
|
57
|
+
-S,
|
|
58
|
+
-S,
|
|
59
|
+
S,
|
|
60
|
+
S,
|
|
61
|
+
-S,
|
|
62
|
+
S,
|
|
63
|
+
-S,
|
|
64
|
+
S,
|
|
65
|
+
S,
|
|
66
|
+
-S,
|
|
67
|
+
S,
|
|
68
|
+
S,
|
|
69
|
+
S,
|
|
70
|
+
S,
|
|
71
|
+
-S,
|
|
72
|
+
S,
|
|
73
|
+
S,
|
|
74
|
+
-S,
|
|
75
|
+
-S,
|
|
76
|
+
-S,
|
|
77
|
+
-S,
|
|
78
|
+
-S,
|
|
79
|
+
-S,
|
|
80
|
+
-S,
|
|
81
|
+
S
|
|
82
|
+
]);
|
|
83
|
+
const indices = new Uint16Array([
|
|
84
|
+
2,
|
|
85
|
+
1,
|
|
86
|
+
0,
|
|
87
|
+
3,
|
|
88
|
+
2,
|
|
89
|
+
0,
|
|
90
|
+
6,
|
|
91
|
+
5,
|
|
92
|
+
4,
|
|
93
|
+
7,
|
|
94
|
+
6,
|
|
95
|
+
4,
|
|
96
|
+
10,
|
|
97
|
+
9,
|
|
98
|
+
8,
|
|
99
|
+
11,
|
|
100
|
+
10,
|
|
101
|
+
8,
|
|
102
|
+
14,
|
|
103
|
+
13,
|
|
104
|
+
12,
|
|
105
|
+
15,
|
|
106
|
+
14,
|
|
107
|
+
12,
|
|
108
|
+
18,
|
|
109
|
+
17,
|
|
110
|
+
16,
|
|
111
|
+
19,
|
|
112
|
+
18,
|
|
113
|
+
16,
|
|
114
|
+
22,
|
|
115
|
+
21,
|
|
116
|
+
20,
|
|
117
|
+
23,
|
|
118
|
+
22,
|
|
119
|
+
20
|
|
120
|
+
]);
|
|
121
|
+
return {
|
|
122
|
+
posBuffer: createMappedBuffer(engine, positions, GPUBufferUsage.VERTEX),
|
|
123
|
+
idxBuffer: createMappedBuffer(engine, indices, GPUBufferUsage.INDEX),
|
|
124
|
+
idxCount: 36
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function buildSkyboxWorldMatrix(rootPosition) {
|
|
128
|
+
const world = new Float32Array(16);
|
|
129
|
+
world[0] = 1;
|
|
130
|
+
world[5] = 1;
|
|
131
|
+
world[10] = 1;
|
|
132
|
+
world[15] = 1;
|
|
133
|
+
world[12] = rootPosition[0];
|
|
134
|
+
world[13] = rootPosition[1];
|
|
135
|
+
world[14] = rootPosition[2];
|
|
136
|
+
return world;
|
|
137
|
+
}
|
|
138
|
+
async function buildDdsSkyboxRenderable(scene, skyHalfSize, rootPosition, primaryColor, skyboxTextureUrl, enableNoise = true) {
|
|
139
|
+
const engine = scene.engine;
|
|
140
|
+
const skyboxWorld = buildSkyboxWorldMatrix(rootPosition);
|
|
141
|
+
const skyBufs = createSkyboxBuffers(engine, skyHalfSize);
|
|
142
|
+
const { cubeView, sampler } = await loadDdsCube(engine, skyboxTextureUrl ?? DEFAULT_SKY_URL);
|
|
143
|
+
const fragCode = SCENE_UBO_WGSL + (enableNoise ? WGSL_DITHER : WGSL_NO_DITHER) + ddsSkyboxFragSrc;
|
|
144
|
+
const mat = createCubemapSkyboxMaterial(enableNoise ? "skybox-dds" : "skybox-dds0", SCENE_UBO_WGSL + ddsSkyboxVertSrc, fragCode);
|
|
145
|
+
const ubo = createDdsMeshUBO(engine, skyboxWorld, primaryColor, scene.imageProcessing.exposure, scene.imageProcessing.contrast);
|
|
146
|
+
const bindGroup = mat.createBindGroup(engine, ubo, cubeView, sampler);
|
|
147
|
+
const r = {
|
|
148
|
+
order: 0,
|
|
149
|
+
isTransparent: false,
|
|
150
|
+
bind(eng, sig) {
|
|
151
|
+
return {
|
|
152
|
+
renderable: r,
|
|
153
|
+
pipeline: mat.getPipeline(eng, sig),
|
|
154
|
+
draw(pass) {
|
|
155
|
+
pass.setBindGroup(1, bindGroup);
|
|
156
|
+
pass.setVertexBuffer(0, skyBufs.posBuffer);
|
|
157
|
+
pass.setIndexBuffer(skyBufs.idxBuffer, "uint16");
|
|
158
|
+
pass.drawIndexed(skyBufs.idxCount);
|
|
159
|
+
return 1;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return r;
|
|
165
|
+
}
|
|
166
|
+
function createDdsMeshUBO(engine, world, primaryColor, exposureLinear, contrast) {
|
|
167
|
+
const data = new Float32Array(SKY_DDS_UNIFORM_SIZE / 4);
|
|
168
|
+
data.set(world, 0);
|
|
169
|
+
data[16] = primaryColor[0];
|
|
170
|
+
data[17] = primaryColor[1];
|
|
171
|
+
data[18] = primaryColor[2];
|
|
172
|
+
data[19] = exposureLinear;
|
|
173
|
+
data[20] = contrast;
|
|
174
|
+
return createUniformBuffer(engine, data);
|
|
175
|
+
}
|
|
176
|
+
async function loadDdsCube(engine, url) {
|
|
177
|
+
const device = engine._device;
|
|
178
|
+
const buf = await (await fetch(url)).arrayBuffer();
|
|
179
|
+
const header = new Int32Array(buf, 0, 32);
|
|
180
|
+
const width = header[3];
|
|
181
|
+
const height = header[4];
|
|
182
|
+
const mipCount = Math.max(header[7], 1);
|
|
183
|
+
const dataOffset = header[21] === 808540228 ? 128 + 20 : 128;
|
|
184
|
+
const raw = new Uint8Array(buf, dataOffset);
|
|
185
|
+
const fmt = "rgba16float";
|
|
186
|
+
const tex = device.createTexture({
|
|
187
|
+
size: [width, height, 6],
|
|
188
|
+
format: fmt,
|
|
189
|
+
mipLevelCount: mipCount,
|
|
190
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
|
|
191
|
+
dimension: "2d"
|
|
192
|
+
});
|
|
193
|
+
let offset = 0;
|
|
194
|
+
for (let face = 0; face < 6; face++) {
|
|
195
|
+
for (let m = 0; m < mipCount; m++) {
|
|
196
|
+
const s = Math.max(width >> m, 1);
|
|
197
|
+
device.queue.writeTexture(
|
|
198
|
+
{ texture: tex, origin: { x: 0, y: 0, z: face }, mipLevel: m },
|
|
199
|
+
raw.buffer,
|
|
200
|
+
{ offset: raw.byteOffset + offset, bytesPerRow: s * 8 },
|
|
201
|
+
{ width: s, height: s }
|
|
202
|
+
);
|
|
203
|
+
offset += s * s * 8;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const cubeView = tex.createView({ dimension: "cube" });
|
|
207
|
+
const sampler = getOrCreateSampler(engine, {
|
|
208
|
+
magFilter: "linear",
|
|
209
|
+
minFilter: "linear",
|
|
210
|
+
mipmapFilter: "linear",
|
|
211
|
+
addressModeU: "clamp-to-edge",
|
|
212
|
+
addressModeV: "clamp-to-edge",
|
|
213
|
+
addressModeW: "clamp-to-edge",
|
|
214
|
+
maxAnisotropy: 4
|
|
215
|
+
});
|
|
216
|
+
return { cubeView, sampler };
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
buildDdsSkyboxRenderable
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=background-dds-skybox-yHTqabU3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-dds-skybox-yHTqabU3.js","sources":["../shaders/skybox-dds.vertex.wgsl?raw","../shaders/skybox-dds.fragment.wgsl?raw","../src/material/pbr/background-dds-skybox.ts"],"sourcesContent":["export default \"// DDS Skybox Vertex Shader — standard world transform.\\n// positionUVW uses local position for cube direction lookup.\\n\\nstruct MeshUniforms {\\n world: mat4x4<f32>,\\n};\\n\\n@group(1) @binding(0) var<uniform> mesh: MeshUniforms;\\n\\nstruct VertexOutput {\\n @builtin(position) clipPos: vec4<f32>,\\n @location(0) positionUVW: vec3<f32>,\\n @location(1) positionW: vec3<f32>,\\n};\\n\\n@vertex\\nfn main(@location(0) position: vec3<f32>) -> VertexOutput {\\n var output: VertexOutput;\\n output.positionUVW = position;\\n let worldPos = (mesh.world * vec4<f32>(position, 1.0)).xyz;\\n output.positionW = worldPos;\\n output.clipPos = scene.viewProjection * vec4<f32>(worldPos, 1.0);\\n return output;\\n}\\n\"","export default \"// DDS Cube Skybox Fragment Shader — samples DDS cube texture with BJS image processing.\\n// Used by scenes that load backgroundSkybox.dds (createDefaultEnvironment).\\n// Pipeline: exposure → Reinhard tonemap → gamma → contrast → dither.\\n\\nstruct MeshUniforms {\\n world: mat4x4<f32>,\\n primaryColor: vec3<f32>,\\n exposureLinear: f32,\\n contrast: f32,\\n _pad1: f32,\\n _pad2: f32,\\n _pad3: f32,\\n};\\n\\n@group(1) @binding(0) var<uniform> mesh: MeshUniforms;\\n@group(1) @binding(1) var envCubemap: texture_cube<f32>;\\n@group(1) @binding(2) var envSampler: sampler;\\n\\nstruct FragmentInput {\\n @location(0) positionUVW: vec3<f32>,\\n @location(1) positionW: vec3<f32>,\\n};\\n\\n@fragment\\nfn main(input: FragmentInput) -> @location(0) vec4<f32> {\\n let dir = normalize(input.positionUVW);\\n var color = textureSampleLevel(envCubemap, envSampler, dir, 0.0).rgb;\\n\\n // BJS BackgroundMaterial: colorBase = reflectionColor.rgb * primaryColor.rgb\\n color *= mesh.primaryColor;\\n\\n if (scene.vImageInfos.w >= 0.0) {\\n // Exposure\\n color *= mesh.exposureLinear;\\n // Reinhard tonemap (matches BJS toneMappingType 0)\\n color = 1.0 - exp2(-1.590579 * color);\\n // Gamma\\n color = pow(color, vec3<f32>(1.0 / 2.2));\\n color = saturate(color);\\n\\n // Contrast\\n let highContrast = color * color * (3.0 - 2.0 * color);\\n color = mix(color, highContrast, mesh.contrast - 1.0);\\n\\n // Dithering (enableNoise=true, variance=0.5)\\n color = color + vec3<f32>(dither(input.positionW.xy, 0.5));\\n color = max(color, vec3<f32>(0.0));\\n }\\n\\n return vec4<f32>(color, 1.0);\\n}\\n\"","/** DDS cube skybox — lazy-loaded only when skyboxUrl ends with .dds.\n * Loads backgroundSkybox.dds and renders it with BJS image processing. */\n\nimport type { SceneContext } from \"../../scene/scene.js\";\nimport type { EngineContext } from \"../../engine/engine.js\";\nimport type { Mat4 } from \"../../math/types.js\";\nimport type { Renderable } from \"../../render/renderable.js\";\nimport { getOrCreateSampler } from \"../../resource/gpu-pool.js\";\nimport { createMappedBuffer, createUniformBuffer } from \"../../resource/gpu-buffers.js\";\nimport { WGSL_DITHER, WGSL_NO_DITHER } from \"../../shader/wgsl-helpers.js\";\nimport { SCENE_UBO_WGSL } from \"../../shader/scene-uniforms.js\";\nimport { createCubemapSkyboxMaterial } from \"./cubemap-skybox-material.js\";\nimport ddsSkyboxVertSrc from \"../../../shaders/skybox-dds.vertex.wgsl?raw\";\nimport ddsSkyboxFragSrc from \"../../../shaders/skybox-dds.fragment.wgsl?raw\";\n\nconst SKY_DDS_UNIFORM_SIZE = 96;\nconst DEFAULT_SKY_URL = \"https://assets.babylonjs.com/core/environments/backgroundSkybox.dds\";\n\nfunction createSkyboxBuffers(engine: EngineContext, S: number): { posBuffer: GPUBuffer; idxBuffer: GPUBuffer; idxCount: number } {\n // prettier-ignore\n const positions = new Float32Array([\n S,-S, S, -S,-S, S, -S, S, S, S, S, S,\n S, S,-S, -S, S,-S, -S,-S,-S, S,-S,-S,\n S, S,-S, S,-S,-S, S,-S, S, S, S, S,\n -S, S, S, -S,-S, S, -S,-S,-S, -S, S,-S,\n -S, S, S, -S, S,-S, S, S,-S, S, S, S,\n S,-S, S, S,-S,-S, -S,-S,-S, -S,-S, S,\n ]);\n // prettier-ignore\n const indices = new Uint16Array([\n 2, 1, 0, 3, 2, 0, 6, 5, 4, 7, 6, 4,\n 10, 9, 8, 11,10, 8, 14,13,12, 15,14,12,\n 18,17,16, 19,18,16, 22,21,20, 23,22,20,\n ]);\n return {\n posBuffer: createMappedBuffer(engine, positions, GPUBufferUsage.VERTEX),\n idxBuffer: createMappedBuffer(engine, indices, GPUBufferUsage.INDEX),\n idxCount: 36,\n };\n}\n\nfunction buildSkyboxWorldMatrix(rootPosition: [number, number, number]): Mat4 {\n const world = new Float32Array(16) as Mat4;\n world[0] = 1;\n world[5] = 1;\n world[10] = 1;\n world[15] = 1;\n world[12] = rootPosition[0];\n world[13] = rootPosition[1];\n world[14] = rootPosition[2];\n return world;\n}\n\n/** Build a DDS cube skybox as a complete Renderable (order 0). */\nexport async function buildDdsSkyboxRenderable(\n scene: SceneContext,\n skyHalfSize: number,\n rootPosition: [number, number, number],\n primaryColor: [number, number, number],\n skyboxTextureUrl?: string,\n enableNoise = true\n): Promise<Renderable> {\n const engine = scene.engine;\n\n const skyboxWorld = buildSkyboxWorldMatrix(rootPosition);\n\n const skyBufs = createSkyboxBuffers(engine, skyHalfSize);\n const { cubeView, sampler } = await loadDdsCube(engine, skyboxTextureUrl ?? DEFAULT_SKY_URL);\n\n const fragCode = SCENE_UBO_WGSL + (enableNoise ? WGSL_DITHER : WGSL_NO_DITHER) + ddsSkyboxFragSrc;\n const mat = createCubemapSkyboxMaterial(enableNoise ? \"skybox-dds\" : \"skybox-dds0\", SCENE_UBO_WGSL + ddsSkyboxVertSrc, fragCode);\n const ubo = createDdsMeshUBO(engine, skyboxWorld, primaryColor, scene.imageProcessing.exposure, scene.imageProcessing.contrast);\n const bindGroup = mat.createBindGroup(engine, ubo, cubeView, sampler);\n\n const r: Renderable = {\n order: 0,\n isTransparent: false,\n bind(eng, sig) {\n return {\n renderable: r,\n pipeline: mat.getPipeline(eng as EngineContext, sig),\n draw(pass) {\n pass.setBindGroup(1, bindGroup);\n pass.setVertexBuffer(0, skyBufs.posBuffer);\n pass.setIndexBuffer(skyBufs.idxBuffer, \"uint16\");\n pass.drawIndexed(skyBufs.idxCount);\n return 1;\n },\n };\n },\n };\n return r;\n}\n\n// ─── DDS Skybox UBO ──────────────────────────────────────────────────────────\n\nfunction createDdsMeshUBO(engine: EngineContext, world: Float32Array, primaryColor: [number, number, number], exposureLinear: number, contrast: number): GPUBuffer {\n const data = new Float32Array(SKY_DDS_UNIFORM_SIZE / 4);\n data.set(world, 0);\n data[16] = primaryColor[0];\n data[17] = primaryColor[1];\n data[18] = primaryColor[2];\n data[19] = exposureLinear;\n data[20] = contrast;\n return createUniformBuffer(engine, data);\n}\n\n// ─── DDS Cube Texture Loader ─────────────────────────────────────────────────\n\n/** Load a DDS cube texture (rgba16float) and return a cube texture view + sampler.\n * Uploads only mip 0 from the DDS file and generates remaining mipmaps on the\n * GPU so that cube face edges blend seamlessly — matching BJS's behaviour. */\nasync function loadDdsCube(engine: EngineContext, url: string): Promise<{ cubeView: GPUTextureView; sampler: GPUSampler }> {\n const device = engine._device;\n const buf = await (await fetch(url)).arrayBuffer();\n const header = new Int32Array(buf, 0, 32);\n const width = header[3]!;\n const height = header[4]!;\n const mipCount = Math.max(header[7]!, 1);\n\n // DDS pixel format offset 76..107 — for rgba16float, FourCC = 'DX10'\n // DDS_HEADER_DX10 at byte 128: dxgiFormat, resourceDimension, miscFlag, arraySize, etc.\n // For cube: miscFlag has RESOURCE_MISC_TEXTURECUBE (0x4), arraySize = 1 (6 faces in data)\n const dataOffset = header[21] === 0x30315844 /* 'DX10' */ ? 128 + 20 : 128;\n const raw = new Uint8Array(buf, dataOffset);\n\n const fmt: GPUTextureFormat = \"rgba16float\";\n const tex = device.createTexture({\n size: [width, height, 6],\n format: fmt,\n mipLevelCount: mipCount,\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,\n dimension: \"2d\",\n });\n\n // Upload all mip levels for each face from the DDS (face-major layout).\n // Even though the skybox shader samples mip 0 explicitly, uploading all\n // mips avoids the need for GPU-side mipmap generation.\n let offset = 0;\n for (let face = 0; face < 6; face++) {\n for (let m = 0; m < mipCount; m++) {\n const s = Math.max(width >> m, 1);\n device.queue.writeTexture(\n { texture: tex, origin: { x: 0, y: 0, z: face }, mipLevel: m },\n raw.buffer,\n { offset: raw.byteOffset + offset, bytesPerRow: s * 8 },\n { width: s, height: s }\n );\n offset += s * s * 8;\n }\n }\n\n const cubeView = tex.createView({ dimension: \"cube\" });\n const sampler = getOrCreateSampler(engine, {\n magFilter: \"linear\",\n minFilter: \"linear\",\n mipmapFilter: \"linear\",\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\",\n addressModeW: \"clamp-to-edge\",\n maxAnisotropy: 4,\n });\n\n return { cubeView, sampler };\n}\n"],"names":[],"mappings":";;;AAAA,MAAA,mBAAe;ACAf,MAAA,mBAAe;ACef,MAAM,uBAAuB;AAC7B,MAAM,kBAAkB;AAExB,SAAS,oBAAoB,QAAuB,GAA6E;AAE7H,QAAM,YAAY,IAAI,aAAa;AAAA,IAClC;AAAA,IAAE,CAAC;AAAA,IAAG;AAAA,IAAG,CAAC;AAAA,IAAE,CAAC;AAAA,IAAG;AAAA,IAAG,CAAC;AAAA,IAAG;AAAA,IAAG;AAAA,IAAI;AAAA,IAAG;AAAA,IAAG;AAAA,IACpC;AAAA,IAAG;AAAA,IAAE,CAAC;AAAA,IAAG,CAAC;AAAA,IAAG;AAAA,IAAE,CAAC;AAAA,IAAG,CAAC;AAAA,IAAE,CAAC;AAAA,IAAE,CAAC;AAAA,IAAI;AAAA,IAAE,CAAC;AAAA,IAAE,CAAC;AAAA,IACpC;AAAA,IAAG;AAAA,IAAE,CAAC;AAAA,IAAI;AAAA,IAAE,CAAC;AAAA,IAAE,CAAC;AAAA,IAAI;AAAA,IAAE,CAAC;AAAA,IAAG;AAAA,IAAI;AAAA,IAAG;AAAA,IAAG;AAAA,IACrC,CAAC;AAAA,IAAG;AAAA,IAAG;AAAA,IAAG,CAAC;AAAA,IAAE,CAAC;AAAA,IAAG;AAAA,IAAG,CAAC;AAAA,IAAE,CAAC;AAAA,IAAE,CAAC;AAAA,IAAG,CAAC;AAAA,IAAG;AAAA,IAAE,CAAC;AAAA,IACrC,CAAC;AAAA,IAAG;AAAA,IAAG;AAAA,IAAG,CAAC;AAAA,IAAG;AAAA,IAAE,CAAC;AAAA,IAAI;AAAA,IAAG;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