@babylonjs/lite 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_mat4-storage-f64-CjDoht2w.js +11 -0
- package/_mat4-storage-f64-CjDoht2w.js.map +1 -0
- package/{alpha-test-fragment-CUiHCw7W.js → alpha-test-fragment-B7DjSnF7.js} +2 -2
- package/{alpha-test-fragment-CUiHCw7W.js.map → alpha-test-fragment-B7DjSnF7.js.map} +1 -1
- package/assets/splat-sort-worker-DT3eybMZ.js.map +1 -0
- package/{background-dds-skybox-yHTqabU3.js → background-dds-skybox-BEX309u3.js} +14 -14
- package/background-dds-skybox-BEX309u3.js.map +1 -0
- package/{background-ground-DIw6D3qf.js → background-ground-BU0HOcM4.js} +20 -20
- package/background-ground-BU0HOcM4.js.map +1 -0
- package/{background-hdr-skybox-c4uuTmkP.js → background-hdr-skybox--RRRic_K.js} +10 -10
- package/background-hdr-skybox--RRRic_K.js.map +1 -0
- package/{background-solid-skybox-DPGBpPbm.js → background-solid-skybox-BrH2fXSu.js} +12 -13
- package/background-solid-skybox-BrH2fXSu.js.map +1 -0
- package/{billboard-renderable-D8mlVGCd.js → billboard-renderable-BHWryAeC.js} +46 -10
- package/billboard-renderable-BHWryAeC.js.map +1 -0
- package/{clamp-block-BdII67hT.js → clamp-block-DqbwnQGW.js} +2 -2
- package/{clamp-block-BdII67hT.js.map → clamp-block-DqbwnQGW.js.map} +1 -1
- package/{clearcoat-fragment-LCiG98Rf.js → clearcoat-fragment-D6FSCie1.js} +2 -2
- package/{clearcoat-fragment-LCiG98Rf.js.map → clearcoat-fragment-D6FSCie1.js.map} +1 -1
- package/{create-skeleton-C9JdIJnb.js → create-skeleton-D_uplboC.js} +9 -9
- package/create-skeleton-D_uplboC.js.map +1 -0
- package/{cubemap-skybox-material-DvXMVc4k.js → cubemap-skybox-material-DQcMMdf-.js} +6 -7
- package/cubemap-skybox-material-DQcMMdf-.js.map +1 -0
- package/{curve-block-BlJpXVYv.js → curve-block-21rT0JjG.js} +2 -2
- package/{curve-block-BlJpXVYv.js.map → curve-block-21rT0JjG.js.map} +1 -1
- package/{emissive-fragment-BnNvbBCw.js → emissive-fragment-C5FtBs3y.js} +3 -3
- package/emissive-fragment-C5FtBs3y.js.map +1 -0
- package/{esm-shadow-view-DN9HIaM4.js → esm-shadow-view-Cl3rPGof.js} +2 -2
- package/{esm-shadow-view-DN9HIaM4.js.map → esm-shadow-view-Cl3rPGof.js.map} +1 -1
- package/{esm-shadow-view-Dk9NFtLq.js → esm-shadow-view-Gtd1LWRP.js} +2 -2
- package/{esm-shadow-view-Dk9NFtLq.js.map → esm-shadow-view-Gtd1LWRP.js.map} +1 -1
- package/{esm-shadow-view-DGKdF1NI.js → esm-shadow-view-c5YV4Eg9.js} +2 -2
- package/{esm-shadow-view-DGKdF1NI.js.map → esm-shadow-view-c5YV4Eg9.js.map} +1 -1
- package/{gaussian-splatting-pipeline-sh-DgJl7l56.js → gaussian-splatting-pipeline-sh-7J31V23x.js} +19 -19
- package/gaussian-splatting-pipeline-sh-7J31V23x.js.map +1 -0
- package/geometry-texture-output-dXk4E9uu.js +41 -0
- package/geometry-texture-output-dXk4E9uu.js.map +1 -0
- package/geometry-view-BsFJpBJa.js +404 -0
- package/geometry-view-BsFJpBJa.js.map +1 -0
- package/{gltf-animation-D7uyTyO3.js → gltf-animation-K_zZxj_d.js} +7 -7
- package/gltf-animation-K_zZxj_d.js.map +1 -0
- package/gltf-color-normalize-Qxl-9C48.js +29 -0
- package/gltf-color-normalize-Qxl-9C48.js.map +1 -0
- package/{gltf-ext-basisu-CPg5kPrx.js → gltf-ext-basisu-CDbPclzZ.js} +53 -18
- package/gltf-ext-basisu-CDbPclzZ.js.map +1 -0
- package/{gltf-ext-node-visibility-MafA9ot2.js → gltf-ext-node-visibility-DXCJEYr6.js} +2 -2
- package/{gltf-ext-node-visibility-MafA9ot2.js.map → gltf-ext-node-visibility-DXCJEYr6.js.map} +1 -1
- package/{gltf-ext-quantization-CpZyLDIz.js → gltf-ext-quantization-CvHI_0Vg.js} +4 -3
- package/gltf-ext-quantization-CvHI_0Vg.js.map +1 -0
- package/{gltf-ext-uv-transform-CE_-T1Tr.js → gltf-ext-uv-transform-DgYazJBs.js} +2 -2
- package/{gltf-ext-uv-transform-CE_-T1Tr.js.map → gltf-ext-uv-transform-DgYazJBs.js.map} +1 -1
- package/{gltf-feature-animation-pointer-BjpwOOqo.js → gltf-feature-animation-pointer-D1RJRFBw.js} +9 -9
- package/gltf-feature-animation-pointer-D1RJRFBw.js.map +1 -0
- package/{gltf-feature-animations-CCizegp8.js → gltf-feature-animations-Cmc1uoIu.js} +2 -2
- package/{gltf-feature-animations-CCizegp8.js.map → gltf-feature-animations-Cmc1uoIu.js.map} +1 -1
- package/{gltf-feature-draco-yGSMGTE3.js → gltf-feature-draco-CKKzT5E3.js} +6 -5
- package/gltf-feature-draco-CKKzT5E3.js.map +1 -0
- package/{gltf-feature-gpu-instancing-2e_CFQnl.js → gltf-feature-gpu-instancing-n87SO6Vh.js} +7 -6
- package/gltf-feature-gpu-instancing-n87SO6Vh.js.map +1 -0
- package/{gltf-feature-lights-punctual-DDDg4j0U.js → gltf-feature-lights-punctual-Ckm3ciL8.js} +5 -5
- package/{gltf-feature-lights-punctual-DDDg4j0U.js.map → gltf-feature-lights-punctual-Ckm3ciL8.js.map} +1 -1
- package/{gltf-feature-meshopt-Des96YFI.js → gltf-feature-meshopt-DLC4SF1E.js} +7 -6
- package/gltf-feature-meshopt-DLC4SF1E.js.map +1 -0
- package/{gltf-feature-morph-CKCw6tkX.js → gltf-feature-morph-Cjtu7hYa.js} +4 -4
- package/gltf-feature-morph-Cjtu7hYa.js.map +1 -0
- package/gltf-feature-registry-C63Hjp9w.js +59 -0
- package/gltf-feature-registry-C63Hjp9w.js.map +1 -0
- package/{gltf-feature-skeleton-D8hWLqi2.js → gltf-feature-skeleton-DKbOGidp.js} +3 -3
- package/{gltf-feature-skeleton-D8hWLqi2.js.map → gltf-feature-skeleton-DKbOGidp.js.map} +1 -1
- package/{gltf-feature-variants-Ds6v9byg.js → gltf-feature-variants-Cmzu0O0e.js} +2 -2
- package/{gltf-feature-variants-Ds6v9byg.js.map → gltf-feature-variants-Cmzu0O0e.js.map} +1 -1
- package/{gltf-glb-parser-D6UZWFuC.js → gltf-glb-parser-Cj5MHS-v.js} +5 -4
- package/gltf-glb-parser-Cj5MHS-v.js.map +1 -0
- package/{gltf-interleave-DGnUlz28.js → gltf-interleave-gHf9_t0i.js} +14 -14
- package/gltf-interleave-gHf9_t0i.js.map +1 -0
- package/gltf-normals-b2h74380.js +37 -0
- package/gltf-normals-b2h74380.js.map +1 -0
- package/{gltf-pbr-builder-ext-BFOxOCnQ.js → gltf-pbr-builder-ext-edNcjwPf.js} +5 -5
- package/gltf-pbr-builder-ext-edNcjwPf.js.map +1 -0
- package/{gltf-variants-DFbr8EES.js → gltf-variants-CPxNdtP4.js} +4 -4
- package/{gltf-variants-DFbr8EES.js.map → gltf-variants-CPxNdtP4.js.map} +1 -1
- package/{gs-picking-pipeline-DzfMASL9.js → gs-picking-pipeline-DYaW_Lg3.js} +14 -14
- package/gs-picking-pipeline-DYaW_Lg3.js.map +1 -0
- package/havok-floating-origin-Dr-18Nds.js +198 -0
- package/havok-floating-origin-Dr-18Nds.js.map +1 -0
- package/index-CLElg2Bo.js +39209 -0
- package/index-CLElg2Bo.js.map +1 -0
- package/index-CYZDclhF.js +918 -0
- package/index-CYZDclhF.js.map +1 -0
- package/index-SMJ67XwT.js +3330 -0
- package/index-SMJ67XwT.js.map +1 -0
- package/index.d.ts +2508 -119
- package/index.js +444 -302
- package/{input-block-DgAJBzN_.js → input-block-DqEedWF2.js} +2 -2
- package/{input-block-DgAJBzN_.js.map → input-block-DqEedWF2.js.map} +1 -1
- package/{iridescence-fragment-Gymp7or5.js → iridescence-fragment-BHU59-gQ.js} +2 -2
- package/{iridescence-fragment-Gymp7or5.js.map → iridescence-fragment-BHU59-gQ.js.map} +1 -1
- package/{light-block-B11ew7FA.js → light-block-Bv37V8vl.js} +2 -2
- package/{light-block-B11ew7FA.js.map → light-block-Bv37V8vl.js.map} +1 -1
- package/{loop-block-Bb23EOMb.js → loop-block-qTg8vb99.js} +2 -2
- package/{loop-block-Bb23EOMb.js.map → loop-block-qTg8vb99.js.map} +1 -1
- package/{morph-fragment-DOVo70gP.js → morph-fragment-BRCUr2wQ.js} +2 -2
- package/{morph-fragment-DOVo70gP.js.map → morph-fragment-BRCUr2wQ.js.map} +1 -1
- package/{multilight-wgsl-BGyiIOp3.js → multilight-wgsl-DMeppAdZ.js} +4 -4
- package/{multilight-wgsl-BGyiIOp3.js.map → multilight-wgsl-DMeppAdZ.js.map} +1 -1
- package/{node-env-BPZXZzBf.js → node-env-Bc559GmY.js} +6 -5
- package/node-env-Bc559GmY.js.map +1 -0
- package/node-geometry-view-COmWsRXK.js +291 -0
- package/node-geometry-view-COmWsRXK.js.map +1 -0
- package/{node-registry-extra-compat-Dhrw8fDQ.js → node-registry-extra-compat-dWrv7gpS.js} +2 -2
- package/{node-registry-extra-compat-Dhrw8fDQ.js.map → node-registry-extra-compat-dWrv7gpS.js.map} +1 -1
- package/{node-registry-extra-math-CsAHvIZo.js → node-registry-extra-math-Bn854sX9.js} +2 -2
- package/{node-registry-extra-math-CsAHvIZo.js.map → node-registry-extra-math-Bn854sX9.js.map} +1 -1
- package/{node-renderable-DlLIdBmd.js → node-renderable-B5G8WcdH.js} +41 -22
- package/node-renderable-B5G8WcdH.js.map +1 -0
- package/{node-shadow-DKrcqmNg.js → node-shadow-CVIUlNf0.js} +7 -7
- package/node-shadow-CVIUlNf0.js.map +1 -0
- package/{normal-map-fragment-DpsIXrJf.js → normal-map-fragment-CQSxhjCy.js} +3 -3
- package/{normal-map-fragment-DpsIXrJf.js.map → normal-map-fragment-CQSxhjCy.js.map} +1 -1
- package/pack-mat4-with-offset-BqB8Jqo7.js +37 -0
- package/pack-mat4-with-offset-BqB8Jqo7.js.map +1 -0
- package/package.json +3 -10
- package/{parse-camera-DM3oJJeT.js → parse-camera-pBRT_6i5.js} +2 -2
- package/{parse-camera-DM3oJJeT.js.map → parse-camera-pBRT_6i5.js.map} +1 -1
- package/pbr-fog-wgsl-BqdCid6r.js +8 -0
- package/pbr-fog-wgsl-BqdCid6r.js.map +1 -0
- package/pbr-geometry-view-NiZY_juX.js +491 -0
- package/pbr-geometry-view-NiZY_juX.js.map +1 -0
- package/{pbr-metallic-roughness-block-h_KAOZrW.js → pbr-metallic-roughness-block-JBSi-tQN.js} +2 -2
- package/{pbr-metallic-roughness-block-h_KAOZrW.js.map → pbr-metallic-roughness-block-JBSi-tQN.js.map} +1 -1
- package/{pbr-metallic-roughness-block-full-6vMm1Jk6.js → pbr-metallic-roughness-block-full-Ta9lR2cz.js} +2 -2
- package/{pbr-metallic-roughness-block-full-6vMm1Jk6.js.map → pbr-metallic-roughness-block-full-Ta9lR2cz.js.map} +1 -1
- package/{pbr-mr-helper-core-CIwm-T1G.js → pbr-mr-helper-core-BVWNR08D.js} +2 -2
- package/{pbr-mr-helper-core-CIwm-T1G.js.map → pbr-mr-helper-core-BVWNR08D.js.map} +1 -1
- package/{pbr-refraction-DGmMSa2v.js → pbr-refraction-C9FvFmAp.js} +2 -2
- package/{pbr-refraction-DGmMSa2v.js.map → pbr-refraction-C9FvFmAp.js.map} +1 -1
- package/{pbr-renderable-BJxUtPBb.js → pbr-renderable-DzUF2QIk.js} +118 -58
- package/pbr-renderable-DzUF2QIk.js.map +1 -0
- package/{pbr-shadow-fragment-LO9SlbJj.js → pbr-shadow-fragment-CnqnbGYS.js} +6 -1
- package/pbr-shadow-fragment-CnqnbGYS.js.map +1 -0
- package/{pbr-template-ext-8q7BcTDf.js → pbr-template-ext-CGgB2n2y.js} +3 -2
- package/{pbr-template-ext-8q7BcTDf.js.map → pbr-template-ext-CGgB2n2y.js.map} +1 -1
- package/{pbr-tracking-B3alzn91.js → pbr-tracking-3tU1kqea.js} +2 -2
- package/{pbr-tracking-B3alzn91.js.map → pbr-tracking-3tU1kqea.js.map} +1 -1
- package/pbr-transmission-ext-BcLjRxfB.js +190 -0
- package/pbr-transmission-ext-BcLjRxfB.js.map +1 -0
- package/recast-navigation.wasm-DG_0AFuk.js +8706 -0
- package/recast-navigation.wasm-DG_0AFuk.js.map +1 -0
- package/recast-navigation.wasm-compat-C-Bf2ylB.js +8692 -0
- package/recast-navigation.wasm-compat-C-Bf2ylB.js.map +1 -0
- package/{reflectance-fragment-BCrgPmrt.js → reflectance-fragment-Dbpgw3Jt.js} +2 -2
- package/{reflectance-fragment-BCrgPmrt.js.map → reflectance-fragment-Dbpgw3Jt.js.map} +1 -1
- package/{rgbd-decode-DCvzUYeI.js → rgbd-decode-DoyUquy3.js} +7 -6
- package/rgbd-decode-DoyUquy3.js.map +1 -0
- package/{scene-material-swap-C2ykv55W.js → scene-material-swap-nNUH4nGn.js} +11 -4
- package/scene-material-swap-nNUH4nGn.js.map +1 -0
- package/screenshot-readback-D0Sj9qq3.js +92 -0
- package/screenshot-readback-D0Sj9qq3.js.map +1 -0
- package/{mesh-features-BLENkYVt.js → shader-composer-BUD_pSX4.js} +7 -55
- package/shader-composer-BUD_pSX4.js.map +1 -0
- package/{shader-renderable-D-6796KR.js → shader-renderable-D7-RyVxa.js} +62 -27
- package/shader-renderable-D7-RyVxa.js.map +1 -0
- package/shader-thin-instance-DuBotxDO.js +150 -0
- package/shader-thin-instance-DuBotxDO.js.map +1 -0
- package/shadow-fragment-core-DHN2G6FI.js.map +1 -1
- package/{sheen-fragment-Dze2f7XJ.js → sheen-fragment-1MkEMcbc.js} +2 -2
- package/{sheen-fragment-Dze2f7XJ.js.map → sheen-fragment-1MkEMcbc.js.map} +1 -1
- package/{singlelight-directional-wgsl-CmUDZxwz.js → singlelight-directional-wgsl-BsV8G456.js} +2 -2
- package/{singlelight-directional-wgsl-CmUDZxwz.js.map → singlelight-directional-wgsl-BsV8G456.js.map} +1 -1
- package/{singlelight-hemispheric-wgsl-t-83IP_s.js → singlelight-hemispheric-wgsl-Bo0jKlW5.js} +2 -2
- package/{singlelight-hemispheric-wgsl-t-83IP_s.js.map → singlelight-hemispheric-wgsl-Bo0jKlW5.js.map} +1 -1
- package/{singlelight-point-wgsl-CLzULIYV.js → singlelight-point-wgsl-DV39UP5Y.js} +2 -2
- package/{singlelight-point-wgsl-CLzULIYV.js.map → singlelight-point-wgsl-DV39UP5Y.js.map} +1 -1
- package/{singlelight-spot-wgsl-DEEUrfVM.js → singlelight-spot-wgsl-yg3od6vL.js} +2 -2
- package/{singlelight-spot-wgsl-DEEUrfVM.js.map → singlelight-spot-wgsl-yg3od6vL.js.map} +1 -1
- package/{skeleton-fragment-B_XlFbtx.js → skeleton-fragment-DdxYG6kv.js} +2 -2
- package/{skeleton-fragment-B_XlFbtx.js.map → skeleton-fragment-DdxYG6kv.js.map} +1 -1
- package/{skybox-renderable-DDwzu-PT.js → skybox-renderable-CJD4XmX5.js} +8 -9
- package/skybox-renderable-CJD4XmX5.js.map +1 -0
- package/{splat-ply-compressed-BahdBG1r.js → splat-ply-compressed-DHjyiVmI.js} +9 -8
- package/splat-ply-compressed-DHjyiVmI.js.map +1 -0
- package/{standard-renderable-GjxL9xSf.js → standard-pipeline-XTbHL7MY.js} +12 -257
- package/standard-pipeline-XTbHL7MY.js.map +1 -0
- package/standard-renderable-CREWLNHI.js +191 -0
- package/standard-renderable-CREWLNHI.js.map +1 -0
- package/{std-ambient-fragment-BoUsD06w.js → std-ambient-fragment-Bjx3VFrr.js} +2 -2
- package/{std-ambient-fragment-BoUsD06w.js.map → std-ambient-fragment-Bjx3VFrr.js.map} +1 -1
- package/{std-cube-reflection-fragment-ulqc3bsP.js → std-cube-reflection-fragment-y9WWdXUt.js} +2 -2
- package/{std-cube-reflection-fragment-ulqc3bsP.js.map → std-cube-reflection-fragment-y9WWdXUt.js.map} +1 -1
- package/{std-emissive-fragment-DNGj1HdQ.js → std-emissive-fragment-C8Lnmojh.js} +2 -2
- package/{std-emissive-fragment-DNGj1HdQ.js.map → std-emissive-fragment-C8Lnmojh.js.map} +1 -1
- package/{std-lightmap-fragment-Bqj89aIe.js → std-lightmap-fragment-DFxGcoA5.js} +2 -2
- package/{std-lightmap-fragment-Bqj89aIe.js.map → std-lightmap-fragment-DFxGcoA5.js.map} +1 -1
- package/{std-opacity-fragment-KuPh5N2Z.js → std-opacity-fragment-EXzFWiSp.js} +2 -2
- package/{std-opacity-fragment-KuPh5N2Z.js.map → std-opacity-fragment-EXzFWiSp.js.map} +1 -1
- package/{std-reflection-fragment-BA5Ghn_M.js → std-reflection-fragment-BoJORqpG.js} +2 -2
- package/{std-reflection-fragment-BA5Ghn_M.js.map → std-reflection-fragment-BoJORqpG.js.map} +1 -1
- package/std-shadow-fragment-Bq-Wc8UJ.js +13 -0
- package/std-shadow-fragment-Bq-Wc8UJ.js.map +1 -0
- package/{std-specular-fragment-CE-6scqd.js → std-specular-fragment-CM5R5j2g.js} +2 -2
- package/{std-specular-fragment-CE-6scqd.js.map → std-specular-fragment-CM5R5j2g.js.map} +1 -1
- package/{std-tracking-CNKZ-hJN.js → std-tracking-Cif_wXeT.js} +2 -2
- package/{std-tracking-CNKZ-hJN.js.map → std-tracking-Cif_wXeT.js.map} +1 -1
- package/{subsurface-fragment-liM3y2-P.js → subsurface-fragment-BEaAXYXz.js} +2 -2
- package/{subsurface-fragment-liM3y2-P.js.map → subsurface-fragment-BEaAXYXz.js.map} +1 -1
- package/swapchain-overlay-UCLilhbq.js +37 -0
- package/swapchain-overlay-UCLilhbq.js.map +1 -0
- package/thin-instance-cull-binding-DWKUt5ZN.js +310 -0
- package/thin-instance-cull-binding-DWKUt5ZN.js.map +1 -0
- package/{thin-instance-gpu-C9Gv_Z1w.js → thin-instance-gpu-BDdRcNAh.js} +30 -5
- package/thin-instance-gpu-BDdRcNAh.js.map +1 -0
- package/{tracking-primitives-wgdBY85t.js → tracking-primitives-CglRNTlX.js} +2 -2
- package/{tracking-primitives-wgdBY85t.js.map → tracking-primitives-CglRNTlX.js.map} +1 -1
- package/{unlit-fragment-BIlhJpz6.js → unlit-fragment-kxfZWlnp.js} +2 -2
- package/{unlit-fragment-BIlhJpz6.js.map → unlit-fragment-kxfZWlnp.js.map} +1 -1
- package/{wgsl-helpers-DyzNzCeE.js → wgsl-helpers-D8sl1VVA.js} +4 -4
- package/{wgsl-helpers-DyzNzCeE.js.map → wgsl-helpers-D8sl1VVA.js.map} +1 -1
- package/assets/splat-sort-worker-Crg3CaCc.js.map +0 -1
- package/background-dds-skybox-yHTqabU3.js.map +0 -1
- package/background-ground-DIw6D3qf.js.map +0 -1
- package/background-hdr-skybox-c4uuTmkP.js.map +0 -1
- package/background-solid-skybox-DPGBpPbm.js.map +0 -1
- package/billboard-renderable-D8mlVGCd.js.map +0 -1
- package/create-skeleton-C9JdIJnb.js.map +0 -1
- package/cubemap-skybox-material-DvXMVc4k.js.map +0 -1
- package/emissive-fragment-BnNvbBCw.js.map +0 -1
- package/gaussian-splatting-pipeline-sh-DgJl7l56.js.map +0 -1
- package/gltf-animation-D7uyTyO3.js.map +0 -1
- package/gltf-ext-basisu-CPg5kPrx.js.map +0 -1
- package/gltf-ext-quantization-CpZyLDIz.js.map +0 -1
- package/gltf-feature-animation-pointer-BjpwOOqo.js.map +0 -1
- package/gltf-feature-draco-yGSMGTE3.js.map +0 -1
- package/gltf-feature-gpu-instancing-2e_CFQnl.js.map +0 -1
- package/gltf-feature-meshopt-Des96YFI.js.map +0 -1
- package/gltf-feature-morph-CKCw6tkX.js.map +0 -1
- package/gltf-glb-parser-D6UZWFuC.js.map +0 -1
- package/gltf-interleave-DGnUlz28.js.map +0 -1
- package/gltf-pbr-builder-ext-BFOxOCnQ.js.map +0 -1
- package/gs-picking-pipeline-DzfMASL9.js.map +0 -1
- package/index-C8HOR2sB.js +0 -19222
- package/index-C8HOR2sB.js.map +0 -1
- package/mesh-features-BLENkYVt.js.map +0 -1
- package/node-env-BPZXZzBf.js.map +0 -1
- package/node-registry-DwgC4yth.js +0 -190
- package/node-registry-DwgC4yth.js.map +0 -1
- package/node-renderable-DlLIdBmd.js.map +0 -1
- package/node-shadow-DKrcqmNg.js.map +0 -1
- package/pbr-renderable-BJxUtPBb.js.map +0 -1
- package/pbr-shadow-fragment-LO9SlbJj.js.map +0 -1
- package/pbr-transmission-ext-BxW4CEGu.js +0 -581
- package/pbr-transmission-ext-BxW4CEGu.js.map +0 -1
- package/rgbd-decode-DCvzUYeI.js.map +0 -1
- package/scene-material-swap-C2ykv55W.js.map +0 -1
- package/shader-renderable-D-6796KR.js.map +0 -1
- package/skybox-renderable-DDwzu-PT.js.map +0 -1
- package/splat-ply-compressed-BahdBG1r.js.map +0 -1
- package/standard-renderable-GjxL9xSf.js.map +0 -1
- package/std-shadow-fragment-FNQfrJuC.js +0 -8
- package/std-shadow-fragment-FNQfrJuC.js.map +0 -1
- package/swapchain-overlay-DcCSFDp7.js +0 -35
- package/swapchain-overlay-DcCSFDp7.js.map +0 -1
- package/thin-instance-gpu-C9Gv_Z1w.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Increment ref count on a Texture2D. First acquire sets count to 1. */
|
|
2
|
+
export declare function acquireTexture(tex: Texture2D): void;
|
|
3
|
+
|
|
1
4
|
/** Add an agent to the crowd. Returns the agent index. */
|
|
2
5
|
export declare function addAgent(crowd: NavCrowd, position: Vec3, params: AgentParameters): number;
|
|
3
6
|
|
|
@@ -48,6 +51,15 @@ export declare function addBillboardSpriteIndex(system: BillboardSpriteSystem, p
|
|
|
48
51
|
*/
|
|
49
52
|
export declare function addBoxObstacle(plugin: NavigationPlugin, position: Vec3, halfExtents: Vec3, angle: number): ObstacleHandle | null;
|
|
50
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Register a clustered light container on a scene, building its GPU state and
|
|
56
|
+
* wiring it into the PBR materials already present in the scene.
|
|
57
|
+
*
|
|
58
|
+
* @param scene - The scene to attach the container to.
|
|
59
|
+
* @param container - The clustered light container to register.
|
|
60
|
+
*/
|
|
61
|
+
export declare function addClusteredLightContainer(scene: SceneContext, container: ClusteredLightContainer): void;
|
|
62
|
+
|
|
51
63
|
/**
|
|
52
64
|
* Add a cylinder obstacle to a tile-cache navmesh.
|
|
53
65
|
*
|
|
@@ -120,13 +132,20 @@ export declare function addTaskAtStart(target: FrameGraph | SceneContext, task:
|
|
|
120
132
|
/** Insert a task BEFORE another task in execute order. Accepts a FrameGraph or a SceneContext. */
|
|
121
133
|
export declare function addTaskBefore(target: FrameGraph | SceneContext, task: Task, before: Task): void;
|
|
122
134
|
|
|
135
|
+
/** Attach a `TextRenderable` to a scene. Uses the scene's deferred-renderables hook. */
|
|
136
|
+
export declare function addTextRenderable(scene: SceneContext, renderable: TextRenderable): void;
|
|
137
|
+
|
|
138
|
+
export declare function addTextRendererLayer(tr: TextRenderer, layer: TextLayer): void;
|
|
139
|
+
|
|
123
140
|
/** Add one instance. Returns its index. Grows capacity as needed. */
|
|
124
141
|
export declare function addThinInstance(mesh: Mesh, matrix: Mat4): number;
|
|
125
142
|
|
|
126
143
|
/**
|
|
127
|
-
* Adds an entity
|
|
128
|
-
*
|
|
129
|
-
*
|
|
144
|
+
* Adds an entity (mesh, light, camera, transform node, shadow generator, or asset container)
|
|
145
|
+
* to the scene, dispatching on its type. Asset containers are unpacked and each contained
|
|
146
|
+
* entity added recursively. Optional scene-hosted systems such as depth-hosted sprites
|
|
147
|
+
* expose their own opt-in add functions so mesh-only scenes do not pay feature-specific
|
|
148
|
+
* routing bytes here.
|
|
130
149
|
* @param scene - The owning scene (pillar 4b: entities never reference the scene themselves).
|
|
131
150
|
* @param entity - The entity (or asset container) to add.
|
|
132
151
|
*/
|
|
@@ -308,6 +327,36 @@ export declare interface AnisotropyProps {
|
|
|
308
327
|
|
|
309
328
|
declare type AnyMaterial = StandardMaterialProps | PbrMaterialProps;
|
|
310
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Append `sources` into the remaining free space of an atlas previously built by
|
|
332
|
+
* `createSpriteAtlasFromFrames`. The existing `GPUTexture` (and any bind group already
|
|
333
|
+
* referencing it) stays valid — each new frame is uploaded with a single
|
|
334
|
+
* `queue.writeTexture` and the UV slots of the *existing* frames are not touched, so
|
|
335
|
+
* sprite instances already drawing from this atlas remain correct.
|
|
336
|
+
*
|
|
337
|
+
* Returns the integer indices of the newly-appended frames in `atlas.frames`, in input
|
|
338
|
+
* order. Sources are validated and placed before any texel is written, so a thrown
|
|
339
|
+
* "atlas full" error leaves the atlas state untouched (all-or-nothing semantics).
|
|
340
|
+
*
|
|
341
|
+
* Throws when:
|
|
342
|
+
* - The atlas was built by `createGridSpriteAtlas` / `loadSpriteAtlas` (no packer state).
|
|
343
|
+
* - Any source has invalid size / sub-rect / pixel buffer length.
|
|
344
|
+
* - A source wider than `maxWidthPx` is supplied (cannot fit any shelf).
|
|
345
|
+
* - The packed sources would overflow the atlas height. Pre-size the atlas via
|
|
346
|
+
* `createSpriteAtlasFromFrames(engine, [...], { capacityPx: [w, h] })` to reserve room.
|
|
347
|
+
*/
|
|
348
|
+
export declare function appendSpriteAtlasFrames(engine: EngineContext, atlas: SpriteAtlas, sources: readonly SpriteAtlasFrameSource[]): number[];
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Apply a one-shot linear impulse (kg·m/s) to a body at a world `point` (defaults to the body's
|
|
352
|
+
* current position / centre of mass), waking it if asleep. Used to shoot, throw, or shove a prop.
|
|
353
|
+
* @param world - The physics world.
|
|
354
|
+
* @param body - The body to push.
|
|
355
|
+
* @param impulse - World-space impulse vector (kg·m/s).
|
|
356
|
+
* @param point - World point of application; defaults to the body's current position.
|
|
357
|
+
*/
|
|
358
|
+
export declare function applyPhysicsImpulse(world: PhysicsWorld, body: PhysicsBody, impulse: Vec3, point?: Vec3): void;
|
|
359
|
+
|
|
311
360
|
/** ArcRotateCamera — orbits around a target point.
|
|
312
361
|
* Uses Babylon.js convention: left-handed, alpha=rotation around Y, beta=elevation.
|
|
313
362
|
* Plain data + methods. Does NOT know about the scene.
|
|
@@ -338,11 +387,39 @@ export declare interface ArcRotateCamera extends Camera, IWorldMatrixProvider, I
|
|
|
338
387
|
inertialRadiusOffset: number;
|
|
339
388
|
inertialPanningX: number;
|
|
340
389
|
inertialPanningY: number;
|
|
341
|
-
|
|
390
|
+
/**
|
|
391
|
+
* Optional orbit limits enforced by {@link attachControl}'s per-frame loop.
|
|
392
|
+
* `undefined` means unbounded on that side. Set these via {@link setCameraLimits}
|
|
393
|
+
* so the current pose is clamped immediately (and inertia zeroed at the wall),
|
|
394
|
+
* avoiding any overshoot-then-snap jiggle. Angles are in radians.
|
|
395
|
+
*/
|
|
396
|
+
lowerAlphaLimit?: number;
|
|
397
|
+
upperAlphaLimit?: number;
|
|
398
|
+
lowerBetaLimit?: number;
|
|
399
|
+
upperBetaLimit?: number;
|
|
400
|
+
lowerRadiusLimit?: number;
|
|
401
|
+
upperRadiusLimit?: number;
|
|
342
402
|
parent: IWorldMatrixProvider | null;
|
|
343
403
|
readonly worldMatrix: Mat4;
|
|
344
404
|
readonly worldMatrixVersion: number;
|
|
345
405
|
}
|
|
346
406
|
|
|
407
|
+
/** Orbit limits for an {@link ArcRotateCamera}. Omit a field to leave that bound
|
|
408
|
+
* unbounded; pass an explicit `undefined` to clear a previously-set bound. */
|
|
409
|
+
export declare interface ArcRotateCameraLimits {
|
|
410
|
+
/** Minimum alpha (orbit) angle, radians. */
|
|
411
|
+
lowerAlphaLimit?: number;
|
|
412
|
+
/** Maximum alpha (orbit) angle, radians. */
|
|
413
|
+
upperAlphaLimit?: number;
|
|
414
|
+
/** Minimum beta (elevation) angle, radians. */
|
|
415
|
+
lowerBetaLimit?: number;
|
|
416
|
+
/** Maximum beta (elevation) angle, radians. */
|
|
417
|
+
upperBetaLimit?: number;
|
|
418
|
+
/** Minimum radius (closest zoom). */
|
|
419
|
+
lowerRadiusLimit?: number;
|
|
420
|
+
/** Maximum radius (farthest zoom). */
|
|
421
|
+
upperRadiusLimit?: number;
|
|
422
|
+
}
|
|
423
|
+
|
|
347
424
|
/**
|
|
348
425
|
* Result returned by loadGltf / loadBabylon.
|
|
349
426
|
* Pass directly to addToScene() — it handles all fields automatically.
|
|
@@ -369,6 +446,16 @@ export declare interface AssetContainer {
|
|
|
369
446
|
};
|
|
370
447
|
}
|
|
371
448
|
|
|
449
|
+
/** Bind the gizmo to a node — the gizmo follows the node's world translation
|
|
450
|
+
* and applies drag deltas to its `position`. */
|
|
451
|
+
export declare function attachAxisDragGizmoToNode(gizmo: AxisDragGizmo, node: SceneNode | null): void;
|
|
452
|
+
|
|
453
|
+
export declare function attachAxisScaleGizmoToNode(gizmo: AxisScaleGizmo, node: SceneNode | null): void;
|
|
454
|
+
|
|
455
|
+
export declare function attachBoundingBoxGizmoToNode(gizmo: BoundingBoxGizmo, node: SceneNode | null): void;
|
|
456
|
+
|
|
457
|
+
export declare function attachCameraGizmoToCamera(gizmo: CameraGizmo, camera: Camera | null): void;
|
|
458
|
+
|
|
372
459
|
/**
|
|
373
460
|
* Attach orbit/zoom/pan controls to an ArcRotateCamera.
|
|
374
461
|
* Matches Babylon.js ArcRotateCameraPointersInput behavior with inertia:
|
|
@@ -378,12 +465,43 @@ export declare interface AssetContainer {
|
|
|
378
465
|
* - Pinch: zoom (touch, direct — no inertia)
|
|
379
466
|
*
|
|
380
467
|
* Input handlers accumulate into the camera's inertial offset properties.
|
|
381
|
-
* Inertia is applied each frame via scene._beforeRender (
|
|
468
|
+
* Inertia is applied each frame via scene._beforeRender (the engine's render
|
|
469
|
+
* loop); a scene is required for inertia, there is no standalone rAF fallback.
|
|
470
|
+
*
|
|
471
|
+
* Orbit/zoom limits are entirely opt-in via {@link setCameraLimits}; the camera
|
|
472
|
+
* self-clamps in its setters, so this loop carries no limit code.
|
|
382
473
|
*
|
|
383
474
|
* Camera stays plain data — this function reads/writes its properties.
|
|
384
475
|
* Returns a cleanup function to remove all listeners and the beforeRender hook.
|
|
385
476
|
*/
|
|
386
|
-
export declare function attachControl(camera: ArcRotateCamera, canvas: HTMLCanvasElement, scene?: SceneContext): () => void;
|
|
477
|
+
export declare function attachControl(camera: ArcRotateCamera, canvas: HTMLCanvasElement, scene?: SceneContext, options?: AttachControlOptions): () => void;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Optional hooks that let an {@link attachControl} caller defer pointer
|
|
481
|
+
* gestures to an external interactor (typically a gizmo pointer-drag
|
|
482
|
+
* dispatcher) so the camera doesn't orbit when the user is interacting with
|
|
483
|
+
* something else on top of it. All fields are optional; omit them to keep
|
|
484
|
+
* the default behavior (the camera always handles its own pointer input).
|
|
485
|
+
*/
|
|
486
|
+
export declare interface AttachControlOptions {
|
|
487
|
+
/** Optional predicate consulted on every pointer-down. When it returns
|
|
488
|
+
* false the camera ignores that gesture (no rotate / pan). Used to defer
|
|
489
|
+
* to gizmo interaction so pressing or dragging a gizmo doesn't also orbit
|
|
490
|
+
* the camera. */
|
|
491
|
+
shouldHandlePointerDown?: (event: PointerEvent) => boolean;
|
|
492
|
+
/** Optional predicate consulted on pointer-move while a camera drag is in
|
|
493
|
+
* progress. When it returns true the camera ABORTS the current drag.
|
|
494
|
+
* Because gizmo picking is async, a press on a gizmo may not be known at
|
|
495
|
+
* pointer-down time (so the camera optimistically starts orbiting); once
|
|
496
|
+
* the gizmo drag is recognised a frame later this lets the gizmo reclaim
|
|
497
|
+
* the gesture and undo the (not-yet-applied) orbit. */
|
|
498
|
+
isExternalDragActive?: () => boolean;
|
|
499
|
+
/** Optional predicate consulted on pointer-move. While it returns true the
|
|
500
|
+
* camera DEFERS its orbit (consumes the move without applying it) — used
|
|
501
|
+
* to wait out an in-flight async gizmo pick so a press that lands on a
|
|
502
|
+
* gizmo never produces a stray orbit, regardless of pick latency. */
|
|
503
|
+
isExternalPickPending?: () => boolean;
|
|
504
|
+
}
|
|
387
505
|
|
|
388
506
|
/**
|
|
389
507
|
* Attach keyboard + mouse controls to a FreeCamera.
|
|
@@ -399,6 +517,36 @@ export declare function attachControl(camera: ArcRotateCamera, canvas: HTMLCanva
|
|
|
399
517
|
*/
|
|
400
518
|
export declare function attachFreeControl(camera: FreeCamera, canvas: HTMLCanvasElement, scene?: SceneContext): () => void;
|
|
401
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Attach orbit / pan / zoom controls to a {@link GeospatialCamera}, matching
|
|
522
|
+
* Babylon.js `GeospatialCamera` interactions:
|
|
523
|
+
* - Left-drag: pan (the cursor stays anchored to the globe surface).
|
|
524
|
+
* - Middle/right-drag: rotate (yaw + pitch / tilt).
|
|
525
|
+
* - Wheel: zoom (toward the cursor by default).
|
|
526
|
+
* - Keyboard: arrows = tilt, W/A/S/D = pan, +/- = zoom.
|
|
527
|
+
*
|
|
528
|
+
* Movement uses Babylon.js's framerate-independent physics model (velocity +
|
|
529
|
+
* inertial decay). Globe picking is analytic ray-sphere against the planet
|
|
530
|
+
* sphere (origin-centred, radius = `limits.planetRadius`) — no mesh picking
|
|
531
|
+
* subsystem is required. Inertia is integrated once per frame from the scene's
|
|
532
|
+
* render loop (`scene._beforeRender`).
|
|
533
|
+
*
|
|
534
|
+
* Returns a disposer that removes all listeners and the per-frame hook.
|
|
535
|
+
*/
|
|
536
|
+
export declare function attachGeospatialControls(camera: GeospatialCamera, canvas: HTMLCanvasElement, scene: SceneContext, options?: GeospatialControlOptions): () => void;
|
|
537
|
+
|
|
538
|
+
export declare function attachLightGizmoToLight(gizmo: LightGizmo, light: LightBase | null): void;
|
|
539
|
+
|
|
540
|
+
export declare function attachPlaneDragGizmoToNode(gizmo: PlaneDragGizmo, node: SceneNode | null): void;
|
|
541
|
+
|
|
542
|
+
export declare function attachPlaneRotationGizmoToNode(gizmo: PlaneRotationGizmo, node: SceneNode | null): void;
|
|
543
|
+
|
|
544
|
+
export declare function attachPositionGizmoToNode(gizmo: PositionGizmo, node: SceneNode | null): void;
|
|
545
|
+
|
|
546
|
+
export declare function attachRotationGizmoToNode(gizmo: RotationGizmo, node: SceneNode | null): void;
|
|
547
|
+
|
|
548
|
+
export declare function attachScaleGizmoToNode(gizmo: ScaleGizmo, node: SceneNode | null): void;
|
|
549
|
+
|
|
402
550
|
/**
|
|
403
551
|
* Attaches a manager to a sprite renderer's update hooks so its animations advance each frame.
|
|
404
552
|
* @param renderer - Sprite renderer whose update loop drives the manager.
|
|
@@ -417,9 +565,76 @@ export declare function attachSpriteAnimationsToRenderer(renderer: SpriteRendere
|
|
|
417
565
|
*/
|
|
418
566
|
export declare function attachSpriteAnimationsToScene(scene: SceneContext, manager: SpriteAnimationManager): SpriteAnimationBinding;
|
|
419
567
|
|
|
568
|
+
/**
|
|
569
|
+
* Attach a baked VAT to a mesh: builds the settings UBO, sets `mesh.vat` (reusing the skeleton's
|
|
570
|
+
* joints/weights vertex buffers), and DROPS the live skeleton so it's no longer CPU-updated. Returns a
|
|
571
|
+
* handle that advances the animation clock.
|
|
572
|
+
*
|
|
573
|
+
* @param engine - Engine context.
|
|
574
|
+
* @param mesh - The mesh that was baked (still has `mesh.skeleton`).
|
|
575
|
+
* @param baked - The result of `bakeVat`.
|
|
576
|
+
* @param clip - Initial clip name to play (defaults to the first baked clip).
|
|
577
|
+
*/
|
|
578
|
+
export declare function attachVat(engine: EngineContext, mesh: Mesh, baked: VatBakeResult, clip?: string): VatHandle;
|
|
579
|
+
|
|
580
|
+
export declare interface AxisDragGizmo {
|
|
581
|
+
/** The root node — gizmo follows its `attachedNode` by copying world translation. */
|
|
582
|
+
readonly root: SceneNode;
|
|
583
|
+
/** Drag behaviour driving the pointer interaction. */
|
|
584
|
+
readonly drag: PointerDrag;
|
|
585
|
+
/** Fired whenever a drag delta is applied to the attached node. */
|
|
586
|
+
readonly onPositionChanged: GizmoObservable<Vec3>;
|
|
587
|
+
/** Currently attached node — set via `attachAxisDragGizmoToNode`. */
|
|
588
|
+
attachedNode: SceneNode | null;
|
|
589
|
+
/** When true, the gizmo's drag axis is rotated each frame by the attached
|
|
590
|
+
* node's world rotation (local-coord mode). When false (default), the
|
|
591
|
+
* drag axis stays world-aligned. Mirrors BJS
|
|
592
|
+
* `updateGizmoRotationToMatchAttachedMesh`. */
|
|
593
|
+
useLocalCoordinates: boolean;
|
|
594
|
+
/** Material triplet (colored / hover / disabled). Hover state is updated
|
|
595
|
+
* automatically during pointer-down on the collider. */
|
|
596
|
+
readonly materials: GizmoMaterialSet;
|
|
597
|
+
|
|
598
|
+
export declare interface AxisDragGizmoOptions {
|
|
599
|
+
/** World-space drag axis (unit vector). */
|
|
600
|
+
dragAxis: Vec3;
|
|
601
|
+
/** Material color of the rendered arrow. Defaults to grey. */
|
|
602
|
+
color?: [number, number, number];
|
|
603
|
+
/** Hover material colour (defaults to yellow). */
|
|
604
|
+
hoverColor?: [number, number, number];
|
|
605
|
+
/** Disabled-state material colour (defaults to grey, alpha 0.4). */
|
|
606
|
+
disableColor?: [number, number, number];
|
|
607
|
+
/** Multiplier applied to the rendered arrow's tube/cone thickness. */
|
|
608
|
+
thickness?: number;
|
|
609
|
+
}
|
|
610
|
+
|
|
420
611
|
/** A billboard sprite system that rotates only around a fixed world axis. */
|
|
421
612
|
export declare type AxisLockedBillboardSpriteSystem = BillboardSpriteSystem<"axis-locked">;
|
|
422
613
|
|
|
614
|
+
export declare interface AxisScaleGizmo {
|
|
615
|
+
readonly root: SceneNode;
|
|
616
|
+
readonly drag: PointerDrag;
|
|
617
|
+
readonly onScaleChanged: GizmoObservable<Vec3>;
|
|
618
|
+
attachedNode: SceneNode | null;
|
|
619
|
+
/** Local-coord mode: drag axis rotates with the attached node. */
|
|
620
|
+
useLocalCoordinates: boolean;
|
|
621
|
+
readonly materials: GizmoMaterialSet;
|
|
622
|
+
|
|
623
|
+
export declare interface AxisScaleGizmoOptions {
|
|
624
|
+
/** World-space drag axis (unit vector). Scaling is applied to the attached
|
|
625
|
+
* node's local `scaling` components proportional to each axis component. */
|
|
626
|
+
dragAxis: Vec3;
|
|
627
|
+
color?: [number, number, number];
|
|
628
|
+
hoverColor?: [number, number, number];
|
|
629
|
+
disableColor?: [number, number, number];
|
|
630
|
+
/** Tube thickness multiplier (visible only; collider gets +4). */
|
|
631
|
+
thickness?: number;
|
|
632
|
+
/** Optional multiplier on the per-frame drag strength. Default 1. */
|
|
633
|
+
sensitivity?: number;
|
|
634
|
+
/** When true, scale uniformly on all 3 axes (matches BJS uniformScaling). */
|
|
635
|
+
uniformScaling?: boolean;
|
|
636
|
+
}
|
|
637
|
+
|
|
423
638
|
/**
|
|
424
639
|
* Bakes the mesh's current world matrix into its splat vertices, then resets the mesh's
|
|
425
640
|
* position, rotation, and scaling to identity so the visual result is unchanged.
|
|
@@ -435,6 +650,17 @@ export declare function bakeCurrentTransformIntoVertices(mesh: GaussianSplatting
|
|
|
435
650
|
*/
|
|
436
651
|
export declare function bakeTransformIntoVertices(mesh: GaussianSplattingMesh, transform: Mat4): void;
|
|
437
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Bake the given animation clips of a skinned mesh into a VAT texture. The clips are laid out as
|
|
655
|
+
* contiguous row blocks (clip 0 first), one texture row per frame. The mesh must still have its live
|
|
656
|
+
* `skeleton` at bake time (the bone matrices are read from it as each frame is evaluated).
|
|
657
|
+
*
|
|
658
|
+
* @param engine - Engine context.
|
|
659
|
+
* @param mesh - The skinned source mesh (must have `mesh.skeleton`).
|
|
660
|
+
* @param groups - The animation clips to bake (e.g. a creature's gait clips).
|
|
661
|
+
*/
|
|
662
|
+
export declare function bakeVat(engine: EngineContext, mesh: Mesh, groups: AnimationGroup[]): VatBakeResult;
|
|
663
|
+
|
|
438
664
|
/**
|
|
439
665
|
* Additive blending for world-space billboards. The billboard's RGB, scaled by its own alpha, is
|
|
440
666
|
* added to the framebuffer (no depth write, like the other transparent modes), so overlapping
|
|
@@ -594,9 +820,36 @@ export declare interface BlurPostProcessTaskConfig extends Omit<PostProcessTaskC
|
|
|
594
820
|
kernel?: number;
|
|
595
821
|
}
|
|
596
822
|
|
|
823
|
+
export declare interface BoundingBoxGizmo {
|
|
824
|
+
readonly root: SceneNode;
|
|
825
|
+
/** Currently attached node — set via `attachBoundingBoxGizmoToNode`. */
|
|
826
|
+
attachedNode: SceneNode | null;
|
|
827
|
+
/** Fires when any drag (scale / rotate / translate) updates the attached node. */
|
|
828
|
+
readonly onChanged: GizmoObservable<void>;
|
|
829
|
+
/** Material used to render all gizmo geometry. */
|
|
830
|
+
readonly material: StandardMaterialProps;
|
|
831
|
+
|
|
832
|
+
export declare interface BoundingBoxGizmoOptions {
|
|
833
|
+
/** RGB colour for the wireframe + handle materials. Defaults to grey. */
|
|
834
|
+
color?: [number, number, number];
|
|
835
|
+
/** Edge wireframe thickness (world units before scaling). Default 0.06. */
|
|
836
|
+
edgeThickness?: number;
|
|
837
|
+
/** Side length of the 8 corner scale boxes (world units). Default 0.18. */
|
|
838
|
+
scaleBoxSize?: number;
|
|
839
|
+
/** Length of the 12 elongated edge rotation anchors (world units). Default
|
|
840
|
+
* 0.16; thickness is length/4 (BJS 1.6:0.4 ratio). */
|
|
841
|
+
rotationAnchorSize?: number;
|
|
842
|
+
}
|
|
843
|
+
|
|
597
844
|
/** Minimal camera contract — any camera that can provide view/projection matrices.
|
|
598
845
|
* Both ArcRotateCamera and FreeCamera implement this interface.
|
|
599
|
-
* Pure state, no scene knowledge (pillar 4b).
|
|
846
|
+
* Pure state, no scene knowledge (pillar 4b).
|
|
847
|
+
*
|
|
848
|
+
* The view/projection matrix caches below are allocated by the camera factory
|
|
849
|
+
* via the process-global `allocateMat4()` singleton — F32 by default, F64
|
|
850
|
+
* after any HPM engine is constructed (see
|
|
851
|
+
* `docs/architecture/33-high-precision-matrix.md`). The storage
|
|
852
|
+
* type is fixed at construction and never changes. */
|
|
600
853
|
export declare interface Camera {
|
|
601
854
|
fov: number;
|
|
602
855
|
nearPlane: number;
|
|
@@ -606,6 +859,30 @@ export declare interface Camera {
|
|
|
606
859
|
readonly worldMatrix: Mat4;
|
|
607
860
|
readonly worldMatrixVersion: number;
|
|
608
861
|
|
|
862
|
+
export declare interface CameraGizmo {
|
|
863
|
+
/** Root node — the gizmo follows the attached camera's world translation
|
|
864
|
+
* and orientation each frame. */
|
|
865
|
+
readonly root: SceneNode;
|
|
866
|
+
/** Material shared by the body + frustum. Mutate `diffuseColor` to recolor. */
|
|
867
|
+
readonly material: StandardMaterialProps;
|
|
868
|
+
/** Alias of `material` — kept for backward compatibility with callers
|
|
869
|
+
* that mutated `frustumMaterial` against the older variant. */
|
|
870
|
+
readonly frustumMaterial: StandardMaterialProps;
|
|
871
|
+
/** Currently attached camera — set via `attachCameraGizmoToCamera`. */
|
|
872
|
+
attachedCamera: Camera | null;
|
|
873
|
+
|
|
874
|
+
export declare interface CameraGizmoOptions {
|
|
875
|
+
/** RGB color for the camera body + frustum material. Defaults to grey. */
|
|
876
|
+
color?: [number, number, number];
|
|
877
|
+
/** RGB color for the frustum wireframe edges (alias of `color` kept for
|
|
878
|
+
* backward compatibility with the previous tube-body variant). */
|
|
879
|
+
frustumColor?: [number, number, number];
|
|
880
|
+
/** Set to false to omit the frustum wireframe. Defaults to true. */
|
|
881
|
+
displayFrustum?: boolean;
|
|
882
|
+
/** Set to false to omit the camera body mesh (box + cylinders). Default true. */
|
|
883
|
+
displayBody?: boolean;
|
|
884
|
+
}
|
|
885
|
+
|
|
609
886
|
/** Cap mode: close both ends of the tube/extrusion. */
|
|
610
887
|
export declare const CAP_ALL = 3;
|
|
611
888
|
|
|
@@ -618,6 +895,32 @@ export declare const CAP_NONE = 0;
|
|
|
618
895
|
/** Cap mode: close only the start of the tube/extrusion. */
|
|
619
896
|
export declare const CAP_START = 1;
|
|
620
897
|
|
|
898
|
+
/**
|
|
899
|
+
* Capture the current canvas backbuffer of a {@link SurfaceContext} — the final presented
|
|
900
|
+
* frame (post-processing and all) with NO HTML/DOM overlay, since those are never drawn
|
|
901
|
+
* into the canvas.
|
|
902
|
+
*
|
|
903
|
+
* Pass `engine` to capture the engine's primary surface (the canvas given to `createEngine`),
|
|
904
|
+
* or pass an auxiliary surface returned by `createSurface` to capture that canvas. Each
|
|
905
|
+
* surface owns its own capture queue and COPY_SRC swapchain state, so surfaces that never
|
|
906
|
+
* capture stay compression-friendly even when another surface on the same engine is being
|
|
907
|
+
* captured every frame.
|
|
908
|
+
*
|
|
909
|
+
* The read is scheduled on a rendered frame: the copy is recorded into that frame's command
|
|
910
|
+
* encoder (so it reads a valid, just-rendered swapchain texture), then the staging buffer is
|
|
911
|
+
* mapped after submit and the pixels are unpacked. Requires a running render loop
|
|
912
|
+
* (`startEngine`); the returned promise resolves once the readback completes.
|
|
913
|
+
*
|
|
914
|
+
* Multiple calls queued on the same surface before the next serviced frame share a single
|
|
915
|
+
* GPU copy and all resolve with the same image.
|
|
916
|
+
*
|
|
917
|
+
* The readback implementation is loaded lazily on the first call, so engines whose surfaces
|
|
918
|
+
* never capture a screenshot ship none of it. The surface's swapchain stays a plain,
|
|
919
|
+
* compression-friendly RENDER_ATTACHMENT surface until the first capture is queued, at which
|
|
920
|
+
* point `renderFrame` reconfigures it once with COPY_SRC (before acquiring that frame's texture).
|
|
921
|
+
*/
|
|
922
|
+
export declare function captureScreenshot(surface: SurfaceContext): Promise<Screenshot>;
|
|
923
|
+
|
|
621
924
|
/** A post-process task that offsets the red/green/blue channels to simulate lens chromatic aberration. */
|
|
622
925
|
export declare interface ChromaticAberrationPostProcessTask extends PostProcessTask {
|
|
623
926
|
aberrationAmount: number;
|
|
@@ -634,6 +937,57 @@ export declare interface ChromaticAberrationPostProcessTaskConfig extends Omit<P
|
|
|
634
937
|
centerPosition?: PostProcessVec2_2;
|
|
635
938
|
}
|
|
636
939
|
|
|
940
|
+
/** A post-process task that writes the per-pixel circle-of-confusion (grayscale)
|
|
941
|
+
* derived from scene depth and the lens focus parameters. */
|
|
942
|
+
export declare interface CircleOfConfusionPostProcessTask extends PostProcessTask {
|
|
943
|
+
lensSize: number;
|
|
944
|
+
fStop: number;
|
|
945
|
+
focusDistance: number;
|
|
946
|
+
focalLength: number;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Configuration for `createCircleOfConfusionPostProcessTask`.
|
|
951
|
+
*
|
|
952
|
+
* Models Babylon.js's `FrameGraphCircleOfConfusionTask` +
|
|
953
|
+
* `ThinCircleOfConfusionPostProcess`.
|
|
954
|
+
*/
|
|
955
|
+
export declare interface CircleOfConfusionPostProcessTaskConfig extends Omit<PostProcessTaskConfig, "_shader"> {
|
|
956
|
+
/** Depth texture supplying per-pixel scene depth. With `depthNotNormalized`
|
|
957
|
+
* it must store **camera-space (view) depth** (the geometry renderer's
|
|
958
|
+
* VIEW_DEPTH attachment); otherwise it stores normalized [0,1] view depth. */
|
|
959
|
+
depthTexture: RenderTarget;
|
|
960
|
+
/** Camera used to read minZ/maxZ when the depth is normalized. */
|
|
961
|
+
camera: Camera;
|
|
962
|
+
/** Max lens size in scene units / 1000 (e.g. mm). Standard cameras are 50mm. Default 50. */
|
|
963
|
+
lensSize?: number;
|
|
964
|
+
/** F-Stop of the camera. Aperture diameter = lensSize / fStop. Default 1.4. */
|
|
965
|
+
fStop?: number;
|
|
966
|
+
/** Distance from the camera to focus on, in scene units / 1000. Default 2000. */
|
|
967
|
+
focusDistance?: number;
|
|
968
|
+
/** Focal length of the camera in scene units / 1000. Default 50. */
|
|
969
|
+
focalLength?: number;
|
|
970
|
+
/** When true the depth texture stores camera-space depth (0..maxZ) rather
|
|
971
|
+
* than normalized [0,1] depth, skipping the `cameraMinMaxZ` reconstruction. */
|
|
972
|
+
depthNotNormalized?: boolean;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Clamp the camera centre away from the geographic poles (in place), so the
|
|
977
|
+
* tangent basis stays well-defined. Mirrors Babylon.js `ClampCenterFromPolesInPlace`.
|
|
978
|
+
*/
|
|
979
|
+
export declare function clampCenterFromPoles(center: Vec3): Vec3;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Clamps a requested zoom distance so it respects the radius limits.
|
|
983
|
+
* @param limits - The geospatial limits.
|
|
984
|
+
* @param zoomDistance - Requested zoom (positive = zoom in, negative = zoom out).
|
|
985
|
+
* @param currentRadius - Current camera radius.
|
|
986
|
+
* @param distanceToTarget - Optional distance to the zoom target point (used for zoom-in clamping).
|
|
987
|
+
* @returns The clamped zoom distance.
|
|
988
|
+
*/
|
|
989
|
+
export declare function clampZoomDistance(limits: GeospatialLimits, zoomDistance: number, currentRadius: number, distanceToTarget?: number): number;
|
|
990
|
+
|
|
637
991
|
/** Removes and disposes every task attached to `manager`. */
|
|
638
992
|
export declare function clearAnimationManager(manager: AnimationManager): void;
|
|
639
993
|
|
|
@@ -668,6 +1022,9 @@ export declare interface ClearCoatProps {
|
|
|
668
1022
|
useF0Remap?: boolean;
|
|
669
1023
|
}
|
|
670
1024
|
|
|
1025
|
+
/** Clear sampler cache for a device. */
|
|
1026
|
+
export declare function clearSamplerCache(engine: EngineContext): void;
|
|
1027
|
+
|
|
671
1028
|
/** Clear all sprites from a layer while preserving allocated capacity. */
|
|
672
1029
|
export declare function clearSprite2DLayer(layer: Sprite2DLayer): void;
|
|
673
1030
|
|
|
@@ -680,40 +1037,149 @@ export declare function clearSpriteAnimations(manager: SpriteAnimationManager):
|
|
|
680
1037
|
/** A clipping plane expressed as the coefficients `[a, b, c, d]` of `a·x + b·y + c·z + d`. */
|
|
681
1038
|
export declare type ClipPlane = readonly [number, number, number, number];
|
|
682
1039
|
|
|
1040
|
+
/** Create a fresh Texture2D wrapper that shares GPU resources with `base`
|
|
1041
|
+
* but carries its own UV transform. Use this when the same underlying image
|
|
1042
|
+
* is referenced with different transforms (e.g. glTF KHR_texture_transform
|
|
1043
|
+
* on different textureInfos pointing at the same source). The caller is
|
|
1044
|
+
* responsible for acquireTexture/release pairing if the wrapper outlives
|
|
1045
|
+
* the base. */
|
|
1046
|
+
export declare function cloneTexture2D(base: Texture2D, transform: Partial<Pick<Texture2D, "uScale" | "vScale" | "uOffset" | "vOffset" | "uAng">> & {
|
|
1047
|
+
_texCoord?: 0 | 1;
|
|
1048
|
+
_hasTx?: true;
|
|
1049
|
+
}): Texture2D;
|
|
1050
|
+
|
|
683
1051
|
/** Deep-clone a SceneNode tree. Meshes are shallow-cloned (shared GPU buffers).
|
|
684
1052
|
* Lights, cameras, and other non-mesh/non-TN children are shallow-cloned. */
|
|
685
1053
|
export declare function cloneTransformNode(src: SceneNode): SceneNode;
|
|
686
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* Holds a large set of point lights that are binned into screen-space clusters
|
|
1057
|
+
* on the GPU, so PBR materials can shade hundreds of lights efficiently. Add it
|
|
1058
|
+
* to a scene with {@link addClusteredLightContainer}.
|
|
1059
|
+
*/
|
|
687
1060
|
export declare interface ClusteredLightContainer {
|
|
1061
|
+
/** Discriminant tag identifying this object as a clustered light container. */
|
|
688
1062
|
readonly kind: "clusteredLightContainer";
|
|
1063
|
+
/** The point lights managed by this container. */
|
|
689
1064
|
pointLights: ClusteredPointLight[];
|
|
1065
|
+
/** Number of cluster tiles across the screen horizontally. */
|
|
690
1066
|
horizontalTiles: number;
|
|
1067
|
+
/** Number of cluster tiles across the screen vertically. */
|
|
691
1068
|
verticalTiles: number;
|
|
1069
|
+
/** Number of depth slices used to bin lights along view-space Z. */
|
|
692
1070
|
zSlices: number;
|
|
693
1071
|
|
|
1072
|
+
/** Options for {@link createClusteredLightContainer}. */
|
|
694
1073
|
export declare interface ClusteredLightContainerOptions {
|
|
1074
|
+
/** Number of cluster tiles across the screen horizontally. Default `64`. */
|
|
695
1075
|
horizontalTiles?: number;
|
|
1076
|
+
/** Number of cluster tiles across the screen vertically. Default `64`. */
|
|
696
1077
|
verticalTiles?: number;
|
|
1078
|
+
/** Number of depth slices used to bin lights along view-space Z. Default `16`. */
|
|
697
1079
|
zSlices?: number;
|
|
698
1080
|
}
|
|
699
1081
|
|
|
1082
|
+
/**
|
|
1083
|
+
* A single point light stored inside a {@link ClusteredLightContainer}. Plain
|
|
1084
|
+
* data — created via {@link createClusteredPointLight} and mutated in place.
|
|
1085
|
+
*/
|
|
700
1086
|
export declare interface ClusteredPointLight {
|
|
1087
|
+
/** World-space position `[x, y, z]`. */
|
|
701
1088
|
position: [number, number, number];
|
|
1089
|
+
/** Diffuse colour `[r, g, b]` in linear space. */
|
|
702
1090
|
diffuse: [number, number, number];
|
|
1091
|
+
/** Falloff range in world units. */
|
|
703
1092
|
range: number;
|
|
1093
|
+
/** Light intensity multiplier. */
|
|
704
1094
|
intensity: number;
|
|
705
1095
|
}
|
|
706
1096
|
|
|
1097
|
+
/** Options for {@link createClusteredPointLight}. */
|
|
707
1098
|
export declare interface ClusteredPointLightOptions {
|
|
1099
|
+
/** World-space position `[x, y, z]`. */
|
|
708
1100
|
position: [number, number, number];
|
|
1101
|
+
/** Diffuse colour `[r, g, b]` in linear space. */
|
|
709
1102
|
diffuse: [number, number, number];
|
|
1103
|
+
/** Falloff range in world units. Default `1`. */
|
|
710
1104
|
range?: number;
|
|
1105
|
+
/** Light intensity multiplier. Default `1`. */
|
|
711
1106
|
intensity?: number;
|
|
712
1107
|
}
|
|
713
1108
|
|
|
1109
|
+
/**
|
|
1110
|
+
* Build the east/north/up orthonormal basis at a point on the globe (left-handed
|
|
1111
|
+
* convention). `up` is the geocentric normal (normalized position); `east` and
|
|
1112
|
+
* `north` complete a right-handed-looking tangent frame given the LH world.
|
|
1113
|
+
* Writes into the provided result objects and returns nothing.
|
|
1114
|
+
*/
|
|
1115
|
+
export declare function computeLocalBasis(worldPos: Vec3, refEast: Vec3, refNorth: Vec3, refUp: Vec3): void;
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Compute the lookAt direction from yaw/pitch at a centre point (forward formula).
|
|
1119
|
+
* Writes the normalized direction into `result`.
|
|
1120
|
+
*/
|
|
1121
|
+
export declare function computeLookAtFromYawPitch(yaw: number, pitch: number, center: Vec3, result: Vec3): Vec3;
|
|
1122
|
+
|
|
714
1123
|
/** Compute a path between two world positions, snapped to the navmesh. */
|
|
715
1124
|
export declare function computePath(plugin: NavigationPlugin, start: Vec3, end: Vec3): Vec3[];
|
|
716
1125
|
|
|
1126
|
+
/**
|
|
1127
|
+
* Inverse of {@link computeLookAtFromYawPitch}: given a lookAt direction and centre,
|
|
1128
|
+
* recover the yaw/pitch that would produce it. Writes `[yaw, pitch]` into `result`.
|
|
1129
|
+
* `currentYaw` is used as a fallback when looking straight down/up (yaw undefined).
|
|
1130
|
+
*/
|
|
1131
|
+
export declare function computeYawPitchFromLookAt(lookAt: Vec3, center: Vec3, currentYaw: number, result: {
|
|
1132
|
+
x: number;
|
|
1133
|
+
y: number;
|
|
1134
|
+
}): {
|
|
1135
|
+
x: number;
|
|
1136
|
+
y: number;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
export declare interface CopyToTextureTask extends Task {
|
|
1140
|
+
readonly name: string;
|
|
1141
|
+
sourceTexture: RenderTarget;
|
|
1142
|
+
targetTexture: RenderTarget | undefined;
|
|
1143
|
+
resolveTexture: RenderTarget | undefined;
|
|
1144
|
+
viewport: NormalizedViewport | null | undefined;
|
|
1145
|
+
lodLevel: number;
|
|
1146
|
+
/** `resolveTexture` if set, otherwise `targetTexture`. Kept for API parity
|
|
1147
|
+
* with BJS `FrameGraphCopyToTextureTask.outputTexture`. */
|
|
1148
|
+
readonly outputTexture: RenderTarget;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
export declare interface CopyToTextureTaskConfig {
|
|
1152
|
+
name?: string;
|
|
1153
|
+
sourceTexture: RenderTarget;
|
|
1154
|
+
/** Target attachment that receives the blit. Required UNLESS `resolveTexture`
|
|
1155
|
+
* is set, in which case the task does a resolve-only operation and writes
|
|
1156
|
+
* directly into `resolveTexture`. */
|
|
1157
|
+
targetTexture?: RenderTarget;
|
|
1158
|
+
/** Viewport applied to the target before the blit. When undefined (default),
|
|
1159
|
+
* the whole target is overwritten and the encoder-copy fast path becomes
|
|
1160
|
+
* available. When set, the blit path is used. */
|
|
1161
|
+
viewport?: NormalizedViewport | null;
|
|
1162
|
+
/** Source mip level to copy from. Default 0. The fast path uses this as
|
|
1163
|
+
* the source `mipLevel`; the blit path samples with `textureSampleLevel`. */
|
|
1164
|
+
lodLevel?: number;
|
|
1165
|
+
/** Optional single-sample texture that receives a hardware MSAA-resolve of
|
|
1166
|
+
* the task's MSAA color attachment at end-of-pass. Two modes:
|
|
1167
|
+
*
|
|
1168
|
+
* - Blit + resolve: `targetTexture` is MSAA and `resolveTexture` is SS.
|
|
1169
|
+
* The shader blit writes into `targetTexture` and at end-of-pass the
|
|
1170
|
+
* GPU resolves `targetTexture` into `resolveTexture`.
|
|
1171
|
+
*
|
|
1172
|
+
* - Resolve-only: `targetTexture` is omitted. The task runs a no-draw
|
|
1173
|
+
* render pass with `sourceTexture` as the color attachment (so the
|
|
1174
|
+
* source itself must be MSAA) and `resolveTexture` as its resolve
|
|
1175
|
+
* target. `viewport` and `lodLevel` are ignored. `sourceTexture` and
|
|
1176
|
+
* `resolveTexture` must have matching dimensions.
|
|
1177
|
+
*
|
|
1178
|
+
* In both modes, `resolveTexture.format` must match the MSAA
|
|
1179
|
+
* attachment's format and `resolveTexture` must be single-sample. */
|
|
1180
|
+
resolveTexture?: RenderTarget;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
717
1183
|
/**
|
|
718
1184
|
* Create a post-process task that merges a left-eye texture with the source (right eye) into a red/cyan anaglyph.
|
|
719
1185
|
* @param config - Source/target settings and the left-eye `leftTexture`.
|
|
@@ -747,6 +1213,10 @@ export declare function createAnimationTask(update: AnimationTaskUpdate, options
|
|
|
747
1213
|
/** Create a bare ArcRotateCamera with given params. Pure data, no scene knowledge. */
|
|
748
1214
|
export declare function createArcRotateCamera(alpha: number, beta: number, radius: number, target: Vec3): ArcRotateCamera;
|
|
749
1215
|
|
|
1216
|
+
/** Build an axis-drag gizmo and attach it to the given utility layer. Call
|
|
1217
|
+
* `attachAxisDragGizmoToNode` to bind it to a node so it follows + drives it. */
|
|
1218
|
+
export declare function createAxisDragGizmo(engine: EngineContext, layer: UtilityLayer, options: AxisDragGizmoOptions): AxisDragGizmo;
|
|
1219
|
+
|
|
750
1220
|
/**
|
|
751
1221
|
* Creates a billboard sprite system whose quads rotate only around a fixed world axis.
|
|
752
1222
|
* @param atlas - Sprite atlas supplying frames.
|
|
@@ -757,6 +1227,8 @@ export declare function createArcRotateCamera(alpha: number, beta: number, radiu
|
|
|
757
1227
|
*/
|
|
758
1228
|
export declare function createAxisLockedBillboardSystem(atlas: SpriteAtlas, axis: readonly [number, number, number], opts?: BillboardSpriteSystemOptions): AxisLockedBillboardSpriteSystem;
|
|
759
1229
|
|
|
1230
|
+
export declare function createAxisScaleGizmo(engine: EngineContext, layer: UtilityLayer, options: AxisScaleGizmoOptions): AxisScaleGizmo;
|
|
1231
|
+
|
|
760
1232
|
/**
|
|
761
1233
|
* Build a custom-shader descriptor to pass as `customShader` when creating a billboard system.
|
|
762
1234
|
* The descriptor is opaque; the pipeline consumes it lazily.
|
|
@@ -790,9 +1262,28 @@ export declare function createBloomPostProcessTask(config: BloomPostProcessTaskC
|
|
|
790
1262
|
*/
|
|
791
1263
|
export declare function createBlurPostProcessTask(config: BlurPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): BlurPostProcessTask;
|
|
792
1264
|
|
|
1265
|
+
export declare function createBoundingBoxGizmo(engine: EngineContext, layer: UtilityLayer, options?: BoundingBoxGizmoOptions): BoundingBoxGizmo;
|
|
1266
|
+
|
|
793
1267
|
/** Create a box mesh. Caller must assign material. */
|
|
794
1268
|
export declare function createBox(engine: EngineContext, size?: number): Mesh;
|
|
795
1269
|
|
|
1270
|
+
/** Build a display-only camera gizmo and attach it to the given utility
|
|
1271
|
+
* layer. Call `attachCameraGizmoToCamera` to bind a camera.
|
|
1272
|
+
*
|
|
1273
|
+
* The gizmo has two independently-toggleable parts, both visible by default
|
|
1274
|
+
* and parented to a root that follows the attached camera's world translation
|
|
1275
|
+
* + orientation each frame:
|
|
1276
|
+
*
|
|
1277
|
+
* - A camera **body** (`displayBody`, defaults to `true`) — a distance-scaled
|
|
1278
|
+
* box + 3 cylinders ported from BJS `_CreateCameraMesh`, lit grey, sized
|
|
1279
|
+
* so it stays a roughly constant size on screen.
|
|
1280
|
+
* - A camera **frustum** (`displayFrustum`, defaults to `true`) — 12 thin
|
|
1281
|
+
* cylinder edges forming a truncated-pyramid wireframe sized from the
|
|
1282
|
+
* camera's fov / near / far (far clamped to 60× near), unlit white.
|
|
1283
|
+
*
|
|
1284
|
+
* Set the matching option to `false` to display only one of them. */
|
|
1285
|
+
export declare function createCameraGizmo(engine: EngineContext, layer: UtilityLayer, options?: CameraGizmoOptions): CameraGizmo;
|
|
1286
|
+
|
|
796
1287
|
/**
|
|
797
1288
|
* Create a post-process task that simulates chromatic aberration by shifting color channels outward from a center point.
|
|
798
1289
|
* @param config - Aberration parameters and source/target settings.
|
|
@@ -802,6 +1293,41 @@ export declare function createBox(engine: EngineContext, size?: number): Mesh;
|
|
|
802
1293
|
*/
|
|
803
1294
|
export declare function createChromaticAberrationPostProcessTask(config: ChromaticAberrationPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): ChromaticAberrationPostProcessTask;
|
|
804
1295
|
|
|
1296
|
+
/**
|
|
1297
|
+
* Create a circle-of-confusion post-process task. The output is a grayscale map
|
|
1298
|
+
* where 0 = in focus and 1 = maximally out of focus, computed from the supplied
|
|
1299
|
+
* depth texture and the lens parameters (the usual first stage of a depth-of-field
|
|
1300
|
+
* pipeline). See https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch23.html.
|
|
1301
|
+
*
|
|
1302
|
+
* @param config - Depth texture, camera, lens parameters and source/target settings.
|
|
1303
|
+
* @param engine - The owning engine.
|
|
1304
|
+
* @param scene - Optional owning scene. Omit for scene-less standalone frame graphs.
|
|
1305
|
+
* @returns The circle-of-confusion post-process task.
|
|
1306
|
+
*/
|
|
1307
|
+
export declare function createCircleOfConfusionPostProcessTask(config: CircleOfConfusionPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): CircleOfConfusionPostProcessTask;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Create an empty {@link ClusteredLightContainer}. Add point lights with
|
|
1311
|
+
* {@link createClusteredPointLight}, then register it on a scene via
|
|
1312
|
+
* {@link addClusteredLightContainer}.
|
|
1313
|
+
*
|
|
1314
|
+
* @param options - Optional cluster tiling overrides.
|
|
1315
|
+
* @returns A new, empty clustered light container.
|
|
1316
|
+
*/
|
|
1317
|
+
export declare function createClusteredLightContainer(options?: ClusteredLightContainerOptions): ClusteredLightContainer;
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Add a point light to a clustered light container.
|
|
1321
|
+
*
|
|
1322
|
+
* @param container - The container to add the light to.
|
|
1323
|
+
* @param options - The light's position, colour and (optional) range/intensity.
|
|
1324
|
+
* @returns The created light (also pushed onto `container.pointLights`); mutate
|
|
1325
|
+
* it in place and call {@link markClusteredLightContainerDirty} to animate it.
|
|
1326
|
+
*/
|
|
1327
|
+
export declare function createClusteredPointLight(container: ClusteredLightContainer, options: ClusteredPointLightOptions): ClusteredPointLight;
|
|
1328
|
+
|
|
1329
|
+
export declare function createCopyToTextureTask(config: CopyToTextureTaskConfig, engine: EngineContext, scene: SceneContext): CopyToTextureTask;
|
|
1330
|
+
|
|
805
1331
|
/**
|
|
806
1332
|
* Builds a {@link Csg2Solid} from a mesh's CPU geometry, baking its world transform.
|
|
807
1333
|
* @param mesh - Source mesh; must retain CPU positions, normals, and indices.
|
|
@@ -818,9 +1344,27 @@ export declare function createCsg2FromMesh(mesh: Mesh, materialSlot?: number): C
|
|
|
818
1344
|
*/
|
|
819
1345
|
export declare function createCsgFromMesh(mesh: Mesh, materialSlot?: number): CsgSolid;
|
|
820
1346
|
|
|
1347
|
+
/**
|
|
1348
|
+
* Creates a cascaded shadow map (CSM) generator for a directional light.
|
|
1349
|
+
*
|
|
1350
|
+
* The shadow map is a `depth32float` `texture_2d_array` with one layer per
|
|
1351
|
+
* cascade; each cascade is fit to a logarithmic/uniform slice of the active
|
|
1352
|
+
* camera frustum and sampled on the receiver with a 5×5 PCF kernel. Casters are
|
|
1353
|
+
* supplied via {@link setShadowTaskCasterMeshes} and the receiver is any mesh
|
|
1354
|
+
* with `receiveShadows = true`.
|
|
1355
|
+
*
|
|
1356
|
+
* @param engine - The engine providing the GPU device.
|
|
1357
|
+
* @param _light - The directional light that casts the shadows.
|
|
1358
|
+
* @param cfg - Optional cascade, map-size and bias configuration.
|
|
1359
|
+
* @returns A `ShadowGenerator` wired to the CSM render path.
|
|
1360
|
+
*/
|
|
1361
|
+
export declare function createCsmDirectionalShadowGenerator(engine: EngineContext, _light: DirectionalLight, cfg?: CsmDirectionalShadowGeneratorConfig): ShadowGenerator;
|
|
1362
|
+
|
|
821
1363
|
/** Create a cylinder (or cone / truncated cone / prism) mesh. Caller must assign material. */
|
|
822
1364
|
export declare function createCylinder(engine: EngineContext, options?: CylinderOptions): Mesh;
|
|
823
1365
|
|
|
1366
|
+
export declare function createCylinderData(options?: CylinderOptions): CylinderData;
|
|
1367
|
+
|
|
824
1368
|
/**
|
|
825
1369
|
* Extract debug visualization geometry from the generated navmesh.
|
|
826
1370
|
* Faces are detached (each triangle gets its own 3 vertices) and per-vertex
|
|
@@ -841,6 +1385,28 @@ export declare function createDebugNavMeshGeometry(plugin: NavigationPlugin): {
|
|
|
841
1385
|
* Matches Babylon.js createDefaultCameraOrLight(true, true, true). */
|
|
842
1386
|
export declare function createDefaultCamera(scene: SceneContext): ArcRotateCamera;
|
|
843
1387
|
|
|
1388
|
+
/** Shape `text` with the default layout, extract glyph curves, and bundle into a
|
|
1389
|
+
* `DefaultTextData`. `textColor` is applied as the run's defaultColor (per-glyph color
|
|
1390
|
+
* overrides remain available via direct `updateTextData(replaceRun)` calls).
|
|
1391
|
+
*
|
|
1392
|
+
* The returned `DefaultTextData` owns its underlying `GlyphStorage` — release both with
|
|
1393
|
+
* `disposeDefaultTextData(data)`. */
|
|
1394
|
+
export declare function createDefaultTextData(font: Font, fontSizePx: number, text: string, textColor?: readonly [number, number, number, number], options?: TextLayoutOptions): DefaultTextData;
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* Create a depth-of-field post-process task. The source image is first reduced
|
|
1398
|
+
* to a circle-of-confusion map (from the depth texture + lens parameters), then
|
|
1399
|
+
* blurred at one to three decreasing resolutions with CoC-weighted blurs, and
|
|
1400
|
+
* finally merged so each pixel transitions smoothly from sharp to blurred based
|
|
1401
|
+
* on how far out of focus it is.
|
|
1402
|
+
*
|
|
1403
|
+
* @param config - Source/depth textures, camera, lens parameters, blur level, and target settings.
|
|
1404
|
+
* @param engine - The owning engine.
|
|
1405
|
+
* @param scene - Optional owning scene. Omit for scene-less standalone frame graphs.
|
|
1406
|
+
* @returns The depth-of-field post-process task.
|
|
1407
|
+
*/
|
|
1408
|
+
export declare function createDepthOfFieldPostProcessTask(config: DepthOfFieldPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): DepthOfFieldPostProcessTask;
|
|
1409
|
+
|
|
844
1410
|
/**
|
|
845
1411
|
* Creates a directional light shining along `direction` (a parallel light source, like the sun).
|
|
846
1412
|
* @param direction - World-space direction the light travels along.
|
|
@@ -860,7 +1426,7 @@ export declare function createDisc(engine: EngineContext, options?: DiscOptions)
|
|
|
860
1426
|
* Call `registerEffectRenderer` to start rendering, `unregisterEffectRenderer`
|
|
861
1427
|
* to pause, and `disposeEffectRenderer` to free GPU resources.
|
|
862
1428
|
*/
|
|
863
|
-
export declare function createEffectRenderer(
|
|
1429
|
+
export declare function createEffectRenderer(surface: SurfaceContext, effect: EffectWrapper, options?: EffectRendererOptions): EffectRenderer;
|
|
864
1430
|
|
|
865
1431
|
/**
|
|
866
1432
|
* Create a frame-graph task that draws an effect as a fullscreen pass into `config.target`.
|
|
@@ -880,9 +1446,15 @@ export declare function createEffectRenderTask(config: EffectRenderTaskConfig, e
|
|
|
880
1446
|
*/
|
|
881
1447
|
export declare function createEffectWrapper(engine: EngineContext, options: EffectWrapperOptions): EffectWrapper;
|
|
882
1448
|
|
|
883
|
-
/** Create the Babylon Lite engine
|
|
884
|
-
*
|
|
885
|
-
*
|
|
1449
|
+
/** Create the Babylon Lite engine bound to `canvas`. Acquires the GPU adapter + device,
|
|
1450
|
+
* configures the canvas's WebGPU context, and returns an `EngineContext` that *is also*
|
|
1451
|
+
* the primary `SurfaceContext` — i.e. the returned engine is itself the surface for the
|
|
1452
|
+
* given canvas. Additional canvases can be attached afterwards via
|
|
1453
|
+
* `createSurface(engine, otherCanvas, ...)`; they share device-scoped GPU resources
|
|
1454
|
+
* (textures, meshes, pipelines, bind groups) with the engine and with each other.
|
|
1455
|
+
*
|
|
1456
|
+
* Accepts either a DOM canvas (main thread) or an `OffscreenCanvas` (e.g. transferred
|
|
1457
|
+
* to a Web Worker) — see {@link RenderCanvas}. */
|
|
886
1458
|
export declare function createEngine(canvas: RenderCanvas, options?: EngineOptions): Promise<EngineContext>;
|
|
887
1459
|
|
|
888
1460
|
/**
|
|
@@ -915,12 +1487,32 @@ export declare function createExtrudeShape(engine: EngineContext, options: Extru
|
|
|
915
1487
|
*/
|
|
916
1488
|
export declare function createFacingBillboardSystem(atlas: SpriteAtlas, opts?: BillboardSpriteSystemOptions): FacingBillboardSpriteSystem;
|
|
917
1489
|
|
|
918
|
-
/**
|
|
919
|
-
export declare function
|
|
1490
|
+
/** Build a `Font` from an in-memory TTF/OTF buffer. */
|
|
1491
|
+
export declare function createFontFromBuffer(data: ArrayBuffer): Font;
|
|
1492
|
+
|
|
1493
|
+
/** Create a scene-less frame-graph context bound to `surface`, for fullscreen effects
|
|
1494
|
+
* and post-process chains. Pass the engine directly for the single-canvas case (since
|
|
1495
|
+
* `EngineContext extends SurfaceContext`); pass an auxiliary surface for multi-canvas. */
|
|
1496
|
+
export declare function createFrameGraphContext(surface: SurfaceContext, options?: FrameGraphContextOptions): FrameGraphContext;
|
|
920
1497
|
|
|
921
1498
|
/** Create a FreeCamera at the given position looking at target. Pure data, no scene knowledge. */
|
|
922
1499
|
export declare function createFreeCamera(position: Vec3, target: Vec3): FreeCamera;
|
|
923
1500
|
|
|
1501
|
+
/** Create a geometry-renderer task. All GPU resources are allocated lazily
|
|
1502
|
+
* during the first `record()` call (when the frame graph is built). */
|
|
1503
|
+
export declare function createGeometryRendererTask(config: GeometryRendererTaskConfig, engine: EngineContext, scene: SceneContext): GeometryRendererTask;
|
|
1504
|
+
|
|
1505
|
+
/** Create a {@link GeospatialCamera} for a planet of the given radius. Pure data, no scene knowledge. */
|
|
1506
|
+
export declare function createGeospatialCamera(options: GeospatialCameraOptions): GeospatialCamera;
|
|
1507
|
+
|
|
1508
|
+
/** Create geospatial limits for a planet of the given radius, matching Babylon.js defaults. */
|
|
1509
|
+
export declare function createGeospatialLimits(planetRadius: number): GeospatialLimits;
|
|
1510
|
+
|
|
1511
|
+
/** Build a `GlyphStorage`. If `initial` is provided, each curve-set is packed into its
|
|
1512
|
+
* own atlas synchronously. The passed inner maps are *adopted* by the storage — the
|
|
1513
|
+
* caller must not mutate them directly afterward (use `updateGlyphStorage` instead). */
|
|
1514
|
+
export declare function createGlyphStorage(initial?: Map<CurveSetId, Map<number, GlyphCurves>>): GlyphStorage;
|
|
1515
|
+
|
|
924
1516
|
/** Create a GPU picker bound to the given scene. */
|
|
925
1517
|
export declare function createGpuPicker(scene: SceneContext): GpuPicker;
|
|
926
1518
|
|
|
@@ -957,6 +1549,9 @@ export declare function createGroundFromHeightMap(engine: EngineContext, url: st
|
|
|
957
1549
|
* const hknp = await HavokPhysics({ locateFile: () => "/HavokPhysics.wasm" });
|
|
958
1550
|
* const world = createHavokWorld(scene, hknp);
|
|
959
1551
|
* ```
|
|
1552
|
+
*
|
|
1553
|
+
* For Large World Rendering, call {@link enableHavokFloatingOrigin} on the returned world (before
|
|
1554
|
+
* creating any bodies) to opt into multi-region floating-origin simulation.
|
|
960
1555
|
*/
|
|
961
1556
|
export declare function createHavokWorld(scene: SceneContext, hknp: any, gravity?: Vec3): PhysicsWorld;
|
|
962
1557
|
|
|
@@ -974,6 +1569,11 @@ export declare function createHemisphericLight(direction?: [number, number, numb
|
|
|
974
1569
|
*/
|
|
975
1570
|
export declare function createImageProcessingTask(config: ImageProcessingTaskConfig, engine: EngineContext, scene: SceneContext): Task;
|
|
976
1571
|
|
|
1572
|
+
/** Build a display-only light gizmo and attach it to the utility layer. The
|
|
1573
|
+
* per-light-type geometry is built lazily on the first `attachLightGizmoToLight`
|
|
1574
|
+
* (since the light type isn't known until then). */
|
|
1575
|
+
export declare function createLightGizmo(engine: EngineContext, layer: UtilityLayer, options?: LightGizmoOptions): LightGizmo;
|
|
1576
|
+
|
|
977
1577
|
/** Create a linear-depth ShaderMaterial that writes `(d, d, d, 1)` per fragment.
|
|
978
1578
|
* The depth is computed from the view-space z, normalized by the supplied
|
|
979
1579
|
* near/far range (or 0.03/15 by default). Override per material via the
|
|
@@ -1053,6 +1653,11 @@ export declare function createNavigationPluginAsync(options?: {
|
|
|
1053
1653
|
*/
|
|
1054
1654
|
export declare function createNavMesh(plugin: NavigationPlugin, meshes: Mesh[], params: NavMeshParameters): void;
|
|
1055
1655
|
|
|
1656
|
+
/** Build a navmesh from raw CPU geometry sources. This is the non-rendering twin of
|
|
1657
|
+
* `createNavMesh`: callers that already own procedural navigation geometry can avoid
|
|
1658
|
+
* creating hidden GPU meshes just to feed Recast. */
|
|
1659
|
+
export declare function createNavMeshFromSources(plugin: NavigationPlugin, sources: NavMeshSource[], params: NavMeshParameters): void;
|
|
1660
|
+
|
|
1056
1661
|
/** Create a no-color view over a NodeMaterial source. */
|
|
1057
1662
|
export declare function createNodeNoColorMaterialView(source: NodeMaterial): MaterialView;
|
|
1058
1663
|
|
|
@@ -1111,6 +1716,14 @@ export declare function createPhysicsShape(world: PhysicsWorld, options: Physics
|
|
|
1111
1716
|
/** Create a plane (unit quad facing -Z). Caller must assign material. */
|
|
1112
1717
|
export declare function createPlane(engine: EngineContext, options?: PlaneOptions): Mesh;
|
|
1113
1718
|
|
|
1719
|
+
export declare function createPlaneDragGizmo(engine: EngineContext, layer: UtilityLayer, options: PlaneDragGizmoOptions): PlaneDragGizmo;
|
|
1720
|
+
|
|
1721
|
+
export declare function createPlaneRotationGizmo(engine: EngineContext, layer: UtilityLayer, options: PlaneRotationGizmoOptions): PlaneRotationGizmo;
|
|
1722
|
+
|
|
1723
|
+
/** Build a PointerDrag descriptor. The drag is inert until `registerPointerDrag`
|
|
1724
|
+
* is called against a utility layer with collider meshes assigned to it. */
|
|
1725
|
+
export declare function createPointerDrag(options: PointerDragOptions): PointerDrag;
|
|
1726
|
+
|
|
1114
1727
|
/**
|
|
1115
1728
|
* Creates a point light that emits in all directions from `position` with distance falloff.
|
|
1116
1729
|
* @param position - World-space position of the light.
|
|
@@ -1122,6 +1735,11 @@ export declare function createPointLight(position: [number, number, number], int
|
|
|
1122
1735
|
/** Create a polyhedron (15 presets). Caller must assign material. */
|
|
1123
1736
|
export declare function createPolyhedron(engine: EngineContext, options?: PolyhedronOptions): Mesh;
|
|
1124
1737
|
|
|
1738
|
+
/** Build a composite position gizmo. Colors match BJS PositionGizmo
|
|
1739
|
+
* defaults: half-saturation red / green / blue along X / Y / Z
|
|
1740
|
+
* (`Color3.Red().scale(0.5)` etc.). */
|
|
1741
|
+
export declare function createPositionGizmo(engine: EngineContext, layer: UtilityLayer, options?: PositionGizmoOptions): PositionGizmo;
|
|
1742
|
+
|
|
1125
1743
|
/**
|
|
1126
1744
|
* Creates a Gaussian Splatting mesh with `splatCount` placeholder splats and attaches
|
|
1127
1745
|
* it to the scene's render pipeline. Useful for procedurally filling splat data later.
|
|
@@ -1181,11 +1799,33 @@ export declare function createRenderTargetTexture(engine: EngineContext, descrip
|
|
|
1181
1799
|
* Swapchain-targeted tasks acquire the swap view per-frame at execute time. */
|
|
1182
1800
|
export declare function createRenderTask(config: RenderTaskConfig, engine: EngineContext, scene: SceneContext): RenderTask;
|
|
1183
1801
|
|
|
1802
|
+
/**
|
|
1803
|
+
* Create an empty `Texture2D` usable as **both a render target and a sampled texture**
|
|
1804
|
+
* (`RENDER_ATTACHMENT | TEXTURE_BINDING`). This is the building block for offscreen
|
|
1805
|
+
* render-to-texture: render a pass into `tex.view`, then sample `tex` in a later pass
|
|
1806
|
+
* (e.g. a fullscreen post-process). Defaults to the engine's swapchain format + a
|
|
1807
|
+
* linear sampler so the result can be presented directly.
|
|
1808
|
+
*
|
|
1809
|
+
* To use the result as a `SpriteRenderer` target (via `setSpriteRendererTarget`), leave
|
|
1810
|
+
* `format` at its default `engine.format` — sprite pipelines bake in that format, so a
|
|
1811
|
+
* differently-formatted target trips WebGPU validation at render-pass begin. A custom
|
|
1812
|
+
* `format` is for offscreen targets driven by some other pass, not the sprite renderer.
|
|
1813
|
+
*/
|
|
1814
|
+
export declare function createRenderTexture2D(engine: EngineContext, width: number, height: number, options?: RenderTexture2DOptions): Texture2D;
|
|
1815
|
+
|
|
1184
1816
|
/** Create a ribbon from an array of parallel Vec3 paths. Caller must assign material. */
|
|
1185
1817
|
export declare function createRibbon(engine: EngineContext, options: RibbonOptions): Mesh;
|
|
1186
1818
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1819
|
+
export declare function createRotationGizmo(engine: EngineContext, layer: UtilityLayer, options?: RotationGizmoOptions): RotationGizmo;
|
|
1820
|
+
|
|
1821
|
+
export declare function createScaleGizmo(engine: EngineContext, layer: UtilityLayer, options?: ScaleGizmoOptions): ScaleGizmo;
|
|
1822
|
+
|
|
1823
|
+
/** Create an empty scene context bound to the given `surface`. The default render task
|
|
1824
|
+
* is built against the surface's format, MSAA configuration, and swapchain RT — the
|
|
1825
|
+
* scene is permanently bound to that surface. Pass `engine` directly (since
|
|
1826
|
+
* `EngineContext extends SurfaceContext`) for the common single-canvas case, or pass
|
|
1827
|
+
* an auxiliary surface created via `createSurface`. */
|
|
1828
|
+
export declare function createSceneContext(surface: SurfaceContext, options?: SceneContextOptions): SceneContext;
|
|
1189
1829
|
|
|
1190
1830
|
/** Create a ShaderMaterial from WGSL sources and declarations, validating
|
|
1191
1831
|
* attributes, uniforms, samplers, and defines.
|
|
@@ -1193,6 +1833,22 @@ export declare function createSceneContext(engine: EngineContext, options?: Scen
|
|
|
1193
1833
|
* @returns The constructed `ShaderMaterial`. */
|
|
1194
1834
|
export declare function createShaderMaterial(options: ShaderMaterialOptions): ShaderMaterial;
|
|
1195
1835
|
|
|
1836
|
+
/**
|
|
1837
|
+
* Create a no-colour view over a ShaderMaterial source, used by the shadow caster pass.
|
|
1838
|
+
*
|
|
1839
|
+
* Unlike standard/PBR/node, a ShaderMaterial needs no feature flag to drop its colour output: the shader
|
|
1840
|
+
* pipeline already omits the fragment stage when the render target has no colour attachment (the depth-only
|
|
1841
|
+
* shadow map). The view exists purely so the caster gets its OWN renderable + system UBO (written with the
|
|
1842
|
+
* shadow camera's view-projection) instead of clobbering the source material's main-pass UBO.
|
|
1843
|
+
*/
|
|
1844
|
+
export declare function createShaderNoColorMaterialView(source: ShaderMaterial): MaterialView;
|
|
1845
|
+
|
|
1846
|
+
/** Wrap a ShaderMaterial as a normal-buffer view. The returned view renders the
|
|
1847
|
+
* source's geometry (instancing/displacement intact) but writes the geometric
|
|
1848
|
+
* normal instead of the material's colour. Idempotent-friendly: create one per
|
|
1849
|
+
* source and reuse it. */
|
|
1850
|
+
export declare function createShaderNormalMaterialView(source: ShaderMaterial, config?: ShaderNormalViewConfig): MaterialView;
|
|
1851
|
+
|
|
1196
1852
|
/** Create a 1×1 solid-color `Texture2D` from straight RGBA components in [0, 1].
|
|
1197
1853
|
* @param engine - Engine context.
|
|
1198
1854
|
* @param r - Red channel (0–1).
|
|
@@ -1241,7 +1897,11 @@ export declare function createSpriteAnimationManager(options?: SpriteAnimationMa
|
|
|
1241
1897
|
* Pack `sources` into a single `SpriteAtlas`. Shelf-packs in input order: each
|
|
1242
1898
|
* frame is placed left-to-right on the current shelf, wrapping to a new shelf
|
|
1243
1899
|
* (row) when it would overflow `maxWidthPx`. The texture is sized exactly to the
|
|
1244
|
-
* packed content.
|
|
1900
|
+
* packed content unless `options.capacityPx` is supplied to reserve headroom for
|
|
1901
|
+
* later `appendSpriteAtlasFrames` calls.
|
|
1902
|
+
*
|
|
1903
|
+
* Pass `sources: []` together with `options.capacityPx` to create an empty atlas
|
|
1904
|
+
* sized for future appends.
|
|
1245
1905
|
*/
|
|
1246
1906
|
export declare function createSpriteAtlasFromFrames(engine: EngineContext, sources: readonly SpriteAtlasFrameSource[], options?: SpriteAtlasPackOptions): SpriteAtlas;
|
|
1247
1907
|
|
|
@@ -1258,8 +1918,11 @@ export declare function createSpriteAtlasFromFrames(engine: EngineContext, sourc
|
|
|
1258
1918
|
*/
|
|
1259
1919
|
export declare function createSpriteFrameAnimation(target: SpriteAnimationTarget, from: number, to: number, loop: boolean, delayMs: number, options?: PlaySpriteAnimationOptions): SpriteFrameAnimation;
|
|
1260
1920
|
|
|
1261
|
-
/** Create a `SpriteRenderer` for `
|
|
1262
|
-
|
|
1921
|
+
/** Create a `SpriteRenderer` for `surface`, pre-warming pipelines for the layers' blend
|
|
1922
|
+
* modes. Pass the engine directly for the common single-canvas case (since
|
|
1923
|
+
* `EngineContext extends SurfaceContext`); pass an auxiliary surface created via
|
|
1924
|
+
* `createSurface` for multi-canvas. */
|
|
1925
|
+
export declare function createSpriteRenderer(surface: SurfaceContext, opts: SpriteRendererOptions): SpriteRenderer;
|
|
1263
1926
|
|
|
1264
1927
|
/** Create StandardMaterial with Babylon defaults. */
|
|
1265
1928
|
export declare function createStandardMaterial(): StandardMaterialProps;
|
|
@@ -1268,6 +1931,32 @@ export declare function createStandardMaterial(): StandardMaterialProps;
|
|
|
1268
1931
|
* The view references the source; material state is never copied. */
|
|
1269
1932
|
export declare function createStandardNoColorMaterialView(source: StandardMaterialProps): MaterialView;
|
|
1270
1933
|
|
|
1934
|
+
/**
|
|
1935
|
+
* Create an auxiliary rendering surface bound to an existing engine. The surface
|
|
1936
|
+
* configures its own `GPUCanvasContext` against `engine._device` and is appended to
|
|
1937
|
+
* `engine.surfaces`. GPU resources (textures, buffers, pipelines) are shared across
|
|
1938
|
+
* all surfaces of the same engine because they're device-scoped — render to multiple
|
|
1939
|
+
* canvases by creating additional surfaces and binding scenes / renderers to each.
|
|
1940
|
+
*
|
|
1941
|
+
* The engine's own primary surface (`engine.surfaces[0] === engine`) is created
|
|
1942
|
+
* automatically by `createEngine(canvas)`; use `createSurface` only for additional
|
|
1943
|
+
* canvases beyond that one.
|
|
1944
|
+
*
|
|
1945
|
+
* Accepts either a DOM canvas (main thread) or an `OffscreenCanvas` (e.g. transferred
|
|
1946
|
+
* to a Web Worker via `transferControlToOffscreen()`).
|
|
1947
|
+
*/
|
|
1948
|
+
export declare function createSurface(engine: EngineContext, canvas: RenderCanvas, options?: SurfaceOptions): SurfaceContext;
|
|
1949
|
+
|
|
1950
|
+
/** Create a TextData bound to `storage`. If `runs` is omitted the TextData starts empty;
|
|
1951
|
+
* runs can be appended later via `updateTextData({ update: "addRun", … })`. */
|
|
1952
|
+
export declare function createTextData(storage: GlyphStorage, runs?: readonly GlyphRun[]): TextData;
|
|
1953
|
+
|
|
1954
|
+
export declare function createTextLayer(data: TextData, options?: TextLayerOptions): TextLayer;
|
|
1955
|
+
|
|
1956
|
+
export declare function createTextRenderable(data: TextData, options?: TextRenderableOptions): TextRenderable;
|
|
1957
|
+
|
|
1958
|
+
export declare function createTextRenderer(surface: SurfaceContext, opts: TextRendererOptions): TextRenderer;
|
|
1959
|
+
|
|
1271
1960
|
/**
|
|
1272
1961
|
* Create a `Texture2D` from a tightly-packed RGBA8 byte buffer.
|
|
1273
1962
|
*
|
|
@@ -1282,6 +1971,18 @@ export declare function createTexture2DFromPixels(engine: EngineContext, data: U
|
|
|
1282
1971
|
/** Create a torus mesh. Caller must assign material. */
|
|
1283
1972
|
export declare function createTorus(engine: EngineContext, options?: TorusOptions): Mesh;
|
|
1284
1973
|
|
|
1974
|
+
/** Create a torus-knot mesh. Caller must assign material. */
|
|
1975
|
+
export declare function createTorusKnot(engine: EngineContext, options?: TorusKnotOptions): Mesh;
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* Builds the CPU vertex data for a torus knot, matching Babylon.js byte-for-byte
|
|
1979
|
+
* (same curve math, same Frenet frame, same ComputeNormals, same index winding).
|
|
1980
|
+
*
|
|
1981
|
+
* @param opts - Optional radius / tube / segmentation / winding parameters.
|
|
1982
|
+
* @returns Tightly-packed `positions`, `normals`, `uvs` and `indices` typed arrays.
|
|
1983
|
+
*/
|
|
1984
|
+
export declare function createTorusKnotData(opts?: TorusKnotOptions): TorusKnotData;
|
|
1985
|
+
|
|
1285
1986
|
/** Create a TransformNode (SceneNode) with TRS values and lazy world matrix.
|
|
1286
1987
|
* Parameters: name, position (px,py,pz), rotation quaternion (qx,qy,qz,qw), scaling (sx,sy,sz). */
|
|
1287
1988
|
export declare function createTransformNode(name: string, px?: number, py?: number, pz?: number, qx?: number, qy?: number, qz?: number, qw?: number, sx?: number, sy?: number, sz?: number): TransformNode;
|
|
@@ -1306,6 +2007,14 @@ export declare function createUniformEffectRenderTask(config: UniformEffectRende
|
|
|
1306
2007
|
*/
|
|
1307
2008
|
export declare function createUniformEffectWrapper(engine: EngineContext, options: UniformEffectWrapperOptions): UniformEffectWrapper;
|
|
1308
2009
|
|
|
2010
|
+
/** Create a utility layer attached to the given engine + main scene.
|
|
2011
|
+
* The returned `scene` shares the main scene's camera so view + projection
|
|
2012
|
+
* remain in sync without manual mirroring. The utility scene renders with a
|
|
2013
|
+
* fresh-cleared depth buffer (so its gizmos appear on top of the main scene)
|
|
2014
|
+
* while keeping NORMAL intra-layer depth testing — solid gizmo bodies (e.g.
|
|
2015
|
+
* the camera-gizmo box + cylinders) occlude their own back faces correctly. */
|
|
2016
|
+
export declare function createUtilityLayer(engine: EngineContext, mainScene: SceneContext, options?: UtilityLayerOptions): UtilityLayer;
|
|
2017
|
+
|
|
1309
2018
|
/** Cross-fades from `fromGroup` to `toGroup`, fading the first to weight 0 and the second to `options.toWeight` (default 1). */
|
|
1310
2019
|
export declare function crossFadeAnimationGroups(manager: AnimationManager, fromGroup: AnimationGroup, toGroup: AnimationGroup, options: CrossFadeAnimationGroupsOptions): void;
|
|
1311
2020
|
|
|
@@ -1354,6 +2063,39 @@ export declare function csgSubtract(a: CsgSolid, b: CsgSolid): CsgSolid;
|
|
|
1354
2063
|
*/
|
|
1355
2064
|
export declare function csgUnion(a: CsgSolid, b: CsgSolid): CsgSolid;
|
|
1356
2065
|
|
|
2066
|
+
/** Configuration for a directional-light cascaded shadow generator. */
|
|
2067
|
+
export declare interface CsmDirectionalShadowGeneratorConfig {
|
|
2068
|
+
/** Shadow map resolution per cascade (square). Default 1024. */
|
|
2069
|
+
mapSize?: number;
|
|
2070
|
+
/** Number of cascades. Default 4 (max 4). */
|
|
2071
|
+
numCascades?: number;
|
|
2072
|
+
/** Split blend between logarithmic and uniform partitioning, 0..1. Default 0.5. */
|
|
2073
|
+
lambda?: number;
|
|
2074
|
+
/** Fraction of a cascade used to cross-fade into the next one. Default 0.1. Set 0 to disable blending. */
|
|
2075
|
+
cascadeBlendPercentage?: number;
|
|
2076
|
+
/** Use a stable bounding-sphere fit (no shimmering) instead of a tight AABB fit. Default false. */
|
|
2077
|
+
stabilizeCascades?: boolean;
|
|
2078
|
+
/** Maximum shadow distance in world units. Default = camera far plane. */
|
|
2079
|
+
shadowMaxZ?: number;
|
|
2080
|
+
/** Depth bias added during shadow-map generation. Default 0.00005. */
|
|
2081
|
+
bias?: number;
|
|
2082
|
+
/** Shadow darkness (0 = black shadow, 1 = no shadow). Default 0. */
|
|
2083
|
+
darkness?: number;
|
|
2084
|
+
/** Soft fade-out at the edge of each cascade frustum, 0..1. Default 0. */
|
|
2085
|
+
frustumEdgeFalloff?: number;
|
|
2086
|
+
/** Regenerate every cascade every frame even when nothing moved. Default false. */
|
|
2087
|
+
forceRefreshEveryFrame?: boolean;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
/** Approximate a cubic Bézier with two quadratics using the "3/4 rule" (matches Slug reference).
|
|
2091
|
+
* Exposed as a public helper so callers that ingest cubic outlines from their own font sources
|
|
2092
|
+
* (e.g. DirectWrite, FreeType) can convert into the quadratic-only format `GlyphCurves` expects. */
|
|
2093
|
+
export declare function cubicToQuadratics(p0x: number, p0y: number, c1x: number, c1y: number, c2x: number, c2y: number, p1x: number, p1y: number): [QuadCurve, QuadCurve];
|
|
2094
|
+
|
|
2095
|
+
/** Identifier for a curve set (a font's glyph-curves map). Strings let callers use a
|
|
2096
|
+
* human-readable key (e.g. the font face name) for easy debugging. */
|
|
2097
|
+
export declare type CurveSetId = string;
|
|
2098
|
+
|
|
1357
2099
|
/** One extra texture bound after the atlas. In WGSL it becomes `<name>Tex` + `<name>Samp`. */
|
|
1358
2100
|
export declare interface CustomShaderTexture {
|
|
1359
2101
|
/** Identifier used in WGSL: becomes `<name>Tex` (texture) and `<name>Samp` (sampler). */
|
|
@@ -1361,6 +2103,26 @@ export declare interface CustomShaderTexture {
|
|
|
1361
2103
|
readonly texture: Texture2D;
|
|
1362
2104
|
}
|
|
1363
2105
|
|
|
2106
|
+
/**
|
|
2107
|
+
* CreateCylinder — matches Babylon.js MeshBuilder.CreateCylinder default options.
|
|
2108
|
+
*
|
|
2109
|
+
* Supports cylinders, cones (diameterTop=0), truncated cones, and prisms
|
|
2110
|
+
* (low tessellation). Options are a subset of Babylon's MeshBuilder that
|
|
2111
|
+
* covers the typical procedural use-case. Advanced options — `arc`,
|
|
2112
|
+
* `enclose`, `hasRings`, `faceColors`, `faceUV`, `cap != CAP_ALL` — are
|
|
2113
|
+
* intentionally omitted to keep the API small; the default behavior (full
|
|
2114
|
+
* 360°, single ring, CAP_ALL) matches Babylon exactly.
|
|
2115
|
+
*
|
|
2116
|
+
* Index order and normal computation are ported verbatim from
|
|
2117
|
+
* `@babylonjs/core/Meshes/Builders/cylinderBuilder.js` to guarantee parity.
|
|
2118
|
+
*/
|
|
2119
|
+
export declare interface CylinderData {
|
|
2120
|
+
positions: Float32Array;
|
|
2121
|
+
normals: Float32Array;
|
|
2122
|
+
uvs: Float32Array;
|
|
2123
|
+
indices: Uint32Array;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
1364
2126
|
/** Options for `createCylinderData`. Subset of Babylon's CreateCylinder. */
|
|
1365
2127
|
export declare interface CylinderOptions {
|
|
1366
2128
|
height?: number;
|
|
@@ -1371,6 +2133,69 @@ export declare interface CylinderOptions {
|
|
|
1371
2133
|
subdivisions?: number;
|
|
1372
2134
|
}
|
|
1373
2135
|
|
|
2136
|
+
/** Convenience text-data variant that owns its `GlyphStorage` and exposes the laid-out
|
|
2137
|
+
* pixel-space `width` / `height` of the text block. Produced by `createDefaultTextData`. */
|
|
2138
|
+
export declare interface DefaultTextData extends TextData {
|
|
2139
|
+
readonly [defaultTextDataBrand]: true;
|
|
2140
|
+
/** Pixel-space width of the laid-out run (max line width). */
|
|
2141
|
+
readonly width: number;
|
|
2142
|
+
/** Pixel-space height of the laid-out run (lines × line-height). */
|
|
2143
|
+
readonly height: number;
|
|
2144
|
+
|
|
2145
|
+
declare const defaultTextDataBrand: unique symbol;
|
|
2146
|
+
|
|
2147
|
+
/** Quality of the depth-of-field blur. Models BJS `ThinDepthOfFieldEffectBlurLevel`. */
|
|
2148
|
+
export declare enum DepthOfFieldBlurLevel {
|
|
2149
|
+
/** Subtle blur — 1 blur level, kernel 15. */
|
|
2150
|
+
Low = 0,
|
|
2151
|
+
/** Medium blur — 2 blur levels, kernel 31. */
|
|
2152
|
+
Medium = 1,
|
|
2153
|
+
/** Large blur — 3 blur levels, kernel 51. */
|
|
2154
|
+
High = 2
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/** A composite depth-of-field post-process task: circle-of-confusion → CoC-weighted blur pyramid → merge. */
|
|
2158
|
+
export declare interface DepthOfFieldPostProcessTask extends Task, PostProcessTaskSettings {
|
|
2159
|
+
readonly name: string;
|
|
2160
|
+
sourceTexture: RenderTarget;
|
|
2161
|
+
targetTexture: RenderTarget | null;
|
|
2162
|
+
outputTexture: RenderTarget;
|
|
2163
|
+
lensSize: number;
|
|
2164
|
+
fStop: number;
|
|
2165
|
+
focusDistance: number;
|
|
2166
|
+
focalLength: number;
|
|
2167
|
+
/** Recompute and upload the uniforms of every sub-pass (CoC, blurs, merge). */
|
|
2168
|
+
updateUniforms(): void;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* Configuration for `createDepthOfFieldPostProcessTask`.
|
|
2173
|
+
*
|
|
2174
|
+
* Models Babylon.js's `FrameGraphDepthOfFieldTask` + `ThinDepthOfFieldEffect`:
|
|
2175
|
+
* a circle-of-confusion pass feeds a stack of CoC-weighted separable blurs,
|
|
2176
|
+
* which are merged back over the sharp image for a physically-plausible
|
|
2177
|
+
* depth-of-field effect.
|
|
2178
|
+
*/
|
|
2179
|
+
export declare interface DepthOfFieldPostProcessTaskConfig extends PostProcessTaskSettings {
|
|
2180
|
+
/** Depth texture. With `depthNotNormalized` it stores camera-space (view)
|
|
2181
|
+
* depth; otherwise normalized [0,1] view depth. */
|
|
2182
|
+
depthTexture: RenderTarget;
|
|
2183
|
+
/** Camera used to read minZ/maxZ when the depth is normalized. */
|
|
2184
|
+
camera: Camera;
|
|
2185
|
+
/** Max lens size in scene units / 1000. Default 50. */
|
|
2186
|
+
lensSize?: number;
|
|
2187
|
+
/** F-Stop of the camera. Default 1.4. */
|
|
2188
|
+
fStop?: number;
|
|
2189
|
+
/** Distance from the camera to focus on, in scene units / 1000. Default 2000. */
|
|
2190
|
+
focusDistance?: number;
|
|
2191
|
+
/** Focal length of the camera in scene units / 1000. Default 50. */
|
|
2192
|
+
focalLength?: number;
|
|
2193
|
+
/** Blur quality. Default {@link DepthOfFieldBlurLevel.Low}. */
|
|
2194
|
+
blurLevel?: DepthOfFieldBlurLevel;
|
|
2195
|
+
/** When true the depth texture stores camera-space depth (0..maxZ). */
|
|
2196
|
+
depthNotNormalized?: boolean;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
1374
2199
|
export declare interface DirectionalLight extends LightBase {
|
|
1375
2200
|
readonly lightType: "directional";
|
|
1376
2201
|
direction: ObservableVec3;
|
|
@@ -1388,23 +2213,41 @@ export declare interface DiscOptions {
|
|
|
1388
2213
|
arc?: number;
|
|
1389
2214
|
}
|
|
1390
2215
|
|
|
2216
|
+
/** Dispose the gizmo: remove meshes, unregister pointer-drag, drop materials. */
|
|
2217
|
+
export declare function disposeAxisDragGizmo(gizmo: AxisDragGizmo, layer: UtilityLayer): void;
|
|
2218
|
+
|
|
2219
|
+
export declare function disposeAxisScaleGizmo(gizmo: AxisScaleGizmo, layer: UtilityLayer): void;
|
|
2220
|
+
|
|
2221
|
+
export declare function disposeBoundingBoxGizmo(gizmo: BoundingBoxGizmo, layer: UtilityLayer): void;
|
|
2222
|
+
|
|
2223
|
+
export declare function disposeCameraGizmo(gizmo: CameraGizmo, layer: UtilityLayer): void;
|
|
2224
|
+
|
|
1391
2225
|
/** Frees the WASM memory backing a solid. The solid must not be used afterwards. */
|
|
1392
2226
|
export declare function disposeCsg2(solid: Csg2Solid): void;
|
|
1393
2227
|
|
|
2228
|
+
/** Release the per-block GPU resources AND the underlying `GlyphStorage` owned by `data`. */
|
|
2229
|
+
export declare function disposeDefaultTextData(data: DefaultTextData): void;
|
|
2230
|
+
|
|
1394
2231
|
/** Unregister and free all GPU resources owned by the renderer. */
|
|
1395
2232
|
export declare function disposeEffectRenderer(er: EffectRenderer): void;
|
|
1396
2233
|
|
|
1397
2234
|
/** Destroy the uniform buffers and clear the cached pipelines, bind groups, and slots owned by the effect wrapper. */
|
|
1398
2235
|
export declare function disposeEffectWrapper(wrapper: EffectWrapper): void;
|
|
1399
2236
|
|
|
1400
|
-
/** Release all engine-owned GPU resources (device +
|
|
1401
|
-
* own their own GPU resources (frame graphs, render
|
|
1402
|
-
* separately. */
|
|
2237
|
+
/** Release all engine-owned GPU resources (device + every attached surface's swapchain
|
|
2238
|
+
* context). Rendering contexts own their own GPU resources (frame graphs, render
|
|
2239
|
+
* targets) and dispose them separately. */
|
|
1403
2240
|
export declare function disposeEngine(engine: EngineContext): void;
|
|
1404
2241
|
|
|
1405
2242
|
/** Unregister and dispose all GPU resources owned by the standalone frame graph. */
|
|
1406
2243
|
export declare function disposeFrameGraphContext(ctx: FrameGraphContext): void;
|
|
1407
2244
|
|
|
2245
|
+
/** Release every GPU atlas owned by `storage`. Idempotent. The caller is responsible for
|
|
2246
|
+
* ensuring no `TextData` is still drawing from this storage. */
|
|
2247
|
+
export declare function disposeGlyphStorage(storage: GlyphStorage): void;
|
|
2248
|
+
|
|
2249
|
+
export declare function disposeLightGizmo(gizmo: LightGizmo, layer: UtilityLayer): void;
|
|
2250
|
+
|
|
1408
2251
|
/**
|
|
1409
2252
|
* Removes and releases all bodies, then releases the native world. Call once when tearing down physics.
|
|
1410
2253
|
* @param world - The physics world to dispose.
|
|
@@ -1414,6 +2257,16 @@ export declare function disposePhysics(world: PhysicsWorld): void;
|
|
|
1414
2257
|
/** Dispose GPU resources owned by this picker. */
|
|
1415
2258
|
export declare function disposePicker(picker: GpuPicker): void;
|
|
1416
2259
|
|
|
2260
|
+
export declare function disposePlaneDragGizmo(gizmo: PlaneDragGizmo, layer: UtilityLayer): void;
|
|
2261
|
+
|
|
2262
|
+
export declare function disposePlaneRotationGizmo(gizmo: PlaneRotationGizmo, layer: UtilityLayer): void;
|
|
2263
|
+
|
|
2264
|
+
export declare function disposePositionGizmo(gizmo: PositionGizmo, layer: UtilityLayer): void;
|
|
2265
|
+
|
|
2266
|
+
export declare function disposeRotationGizmo(gizmo: RotationGizmo, layer: UtilityLayer): void;
|
|
2267
|
+
|
|
2268
|
+
export declare function disposeScaleGizmo(gizmo: ScaleGizmo, layer: UtilityLayer): void;
|
|
2269
|
+
|
|
1417
2270
|
/** Release all GPU resources owned by this scene. */
|
|
1418
2271
|
export declare function disposeScene(scene: SceneContext): void;
|
|
1419
2272
|
|
|
@@ -1432,9 +2285,29 @@ export declare function disposeSpriteAnimationBinding(binding: SpriteAnimationBi
|
|
|
1432
2285
|
*/
|
|
1433
2286
|
export declare function disposeSpriteRenderer(sr: SpriteRenderer): void;
|
|
1434
2287
|
|
|
2288
|
+
/** Remove and unconfigure an auxiliary surface from its engine. Rendering contexts
|
|
2289
|
+
* registered on this surface are dropped from its list but not disposed — call their
|
|
2290
|
+
* own disposers (e.g. `disposeScene`) separately.
|
|
2291
|
+
*
|
|
2292
|
+
* Throws if called on the engine's primary surface (`surface === engine`); use
|
|
2293
|
+
* `disposeEngine` to tear down the engine and all its surfaces. */
|
|
2294
|
+
export declare function disposeSurface(surface: SurfaceContext): void;
|
|
2295
|
+
|
|
2296
|
+
/** Release per-block GPU resources owned by `data`. Does NOT dispose the bound
|
|
2297
|
+
* `GlyphStorage` — caller owns its lifetime and must dispose it separately via
|
|
2298
|
+
* `disposeGlyphStorage` once no `TextData` references it. */
|
|
2299
|
+
export declare function disposeTextData(data: TextData): void;
|
|
2300
|
+
|
|
2301
|
+
export declare function disposeTextRenderable(renderable: TextRenderable): void;
|
|
2302
|
+
|
|
2303
|
+
export declare function disposeTextRenderer(tr: TextRenderer): void;
|
|
2304
|
+
|
|
1435
2305
|
/** Destroy the uniform buffer and clear cached GPU objects owned by the uniform effect wrapper. */
|
|
1436
2306
|
export declare function disposeUniformEffectWrapper(wrapper: UniformEffectWrapper): void;
|
|
1437
2307
|
|
|
2308
|
+
/** Dispose the utility layer's underlying scene. Idempotent. */
|
|
2309
|
+
export declare function disposeUtilityLayer(utility: UtilityLayer): void;
|
|
2310
|
+
|
|
1438
2311
|
/**
|
|
1439
2312
|
* A per-pass draw binding produced by `Renderable.bind(engine, target)`.
|
|
1440
2313
|
*
|
|
@@ -1549,6 +2422,38 @@ export declare function enableAnimationBlending(manager: AnimationManager): void
|
|
|
1549
2422
|
*/
|
|
1550
2423
|
export declare function enableDetailedPicking(picker: GpuPicker): void;
|
|
1551
2424
|
|
|
2425
|
+
/**
|
|
2426
|
+
* Opt a Havok world into multi-region floating-origin simulation (Large World Rendering).
|
|
2427
|
+
*
|
|
2428
|
+
* Loads the floating-origin runtime on demand (`physics/havok-floating-origin.ts`) so worlds that
|
|
2429
|
+
* never call this — i.e. ordinary near-origin physics scenes — never pull that code into their
|
|
2430
|
+
* bundle. Once enabled, bodies far apart in world space are simulated in separate regions (each
|
|
2431
|
+
* within `floatingOriginWorldRadius` of its origin) so the float32 Havok solver keeps full
|
|
2432
|
+
* precision. Node transforms remain true world coordinates; eye-relative rendering is handled
|
|
2433
|
+
* independently by the floating-origin render path.
|
|
2434
|
+
*
|
|
2435
|
+
* Must be called **before** creating any bodies in the world. Pair it with an engine created with
|
|
2436
|
+
* `useFloatingOrigin: true` so rendering and physics share the same far-from-origin handling.
|
|
2437
|
+
* @param world - The physics world to enable floating origin on.
|
|
2438
|
+
* @param floatingOriginWorldRadius - Region capture radius in metres (default 100000, matching Babylon.js).
|
|
2439
|
+
*/
|
|
2440
|
+
export declare function enableHavokFloatingOrigin(world: PhysicsWorld, floatingOriginWorldRadius?: number): Promise<void>;
|
|
2441
|
+
|
|
2442
|
+
/**
|
|
2443
|
+
* Enable material-plugin support for `scene`.
|
|
2444
|
+
*
|
|
2445
|
+
* - Registers the PBR plugin bridge: its `detect` hook encodes a per-signature
|
|
2446
|
+
* index into each PBR material's feature bits during the build, so no mesh
|
|
2447
|
+
* walk is needed here.
|
|
2448
|
+
* - Registers the Standard plugin bridge and walks `scene.meshes`, pre-baking a
|
|
2449
|
+
* per-signature index into every Standard plugin material's cached
|
|
2450
|
+
* `_renderFeatures` (Standard's feature computation is not ext-extensible, so
|
|
2451
|
+
* the index must be baked in up front). Standard plugin uniforms are delivered
|
|
2452
|
+
* through a self-managed uniform buffer built here and bound via the
|
|
2453
|
+
* pre-existing `StdExt._bind` loop.
|
|
2454
|
+
*/
|
|
2455
|
+
export declare function enableMaterialPlugins(scene: SceneContext): void;
|
|
2456
|
+
|
|
1552
2457
|
/** Enable automatic dirty tracking on a PBR or Standard material.
|
|
1553
2458
|
* After calling this, any UBO-backed property mutation marks the source material UBO dirty. */
|
|
1554
2459
|
export declare function enableMaterialTracking(material: Material & {
|
|
@@ -1558,6 +2463,10 @@ export declare function enableMaterialTracking(material: Material & {
|
|
|
1558
2463
|
/** Enables weighted property-animation blending on `manager` by registering its category handler. */
|
|
1559
2464
|
export declare function enablePropertyAnimationBlending(manager: AnimationManager): void;
|
|
1560
2465
|
|
|
2466
|
+
export declare function enableRenderTaskTransmission(task: RenderTask, engine: EngineContext, options?: TransmissionOptions): SceneColorGrab;
|
|
2467
|
+
|
|
2468
|
+
export declare function enableSceneTransmission(scene: SceneContext, engine: EngineContext): void;
|
|
2469
|
+
|
|
1561
2470
|
/** Enable or disable GPU frustum culling for an existing thin-instanced mesh.
|
|
1562
2471
|
*
|
|
1563
2472
|
* Call this after `setThinInstances()`/`addThinInstance()` and before `registerScene()`.
|
|
@@ -1569,43 +2478,68 @@ export declare function enableThinInstanceGpuCulling(mesh: Mesh, enabled?: boole
|
|
|
1569
2478
|
/** CPU helper matching BJS `GaussianSplattingGpuPickingMaterialPlugin.EncodeIdToColor`. */
|
|
1570
2479
|
export declare function encodeIdToColor(id: number): [number, number, number];
|
|
1571
2480
|
|
|
1572
|
-
/**
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
2481
|
+
/**
|
|
2482
|
+
* Handle to the WebGPU engine — pure state, no attached methods.
|
|
2483
|
+
*
|
|
2484
|
+
* The engine owns the `GPUDevice` and all device-scoped GPU resources (textures, buffers,
|
|
2485
|
+
* pipelines, bind groups). It also **is itself a {@link SurfaceContext}** bound to the
|
|
2486
|
+
* canvas passed into `createEngine` — the primary surface. Additional canvases can be
|
|
2487
|
+
* attached via `createSurface(engine, canvas, ...)`; GPU resources are shared across all
|
|
2488
|
+
* surfaces because they're device-scoped, while each surface owns its own swapchain
|
|
2489
|
+
* context.
|
|
2490
|
+
*/
|
|
2491
|
+
export declare interface EngineContext extends SurfaceContext {
|
|
2492
|
+
/** Rendering surfaces attached to this engine, in registration order. Index 0 is
|
|
2493
|
+
* the engine itself (the primary surface) — the tuple type guarantees at least
|
|
2494
|
+
* one entry so `engine.surfaces[0]` is always defined. Use
|
|
2495
|
+
* `createSurface(engine, canvas, ...)` to append more. */
|
|
2496
|
+
readonly surfaces: readonly [SurfaceContext, ...SurfaceContext[]];
|
|
1580
2497
|
/** Number of GPU draw calls in the last rendered frame, summed across all surfaces. */
|
|
1581
2498
|
drawCallCount: number;
|
|
1582
|
-
/**
|
|
1583
|
-
*
|
|
1584
|
-
*
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
2499
|
+
/**
|
|
2500
|
+
* When true, world matrices are computed using Float64 intermediate precision
|
|
2501
|
+
* and downcast to Float32 at GPU upload time. Defaults to false.
|
|
2502
|
+
*/
|
|
2503
|
+
useHighPrecisionMatrix: boolean;
|
|
2504
|
+
/**
|
|
2505
|
+
* When true, every scene on this engine uses the floating-origin (eye-relative
|
|
2506
|
+
* upload) trick to render large-world coordinates without F32 jitter. Requires
|
|
2507
|
+
* `useHighPrecisionMatrix: true`. Defaults to false.
|
|
2508
|
+
*
|
|
2509
|
+
* LWR is engine-wide: all scenes created against this engine inherit the
|
|
2510
|
+
* mode. The LWR runtime module (`large-world/floating-origin.js`) is
|
|
2511
|
+
* dynamically imported during `createEngine` only when this flag is true,
|
|
2512
|
+
* so non-LWR engines never pull the module into their bundle.
|
|
2513
|
+
*/
|
|
2514
|
+
useFloatingOrigin: boolean;
|
|
1588
2515
|
|
|
1589
2516
|
/**
|
|
1590
|
-
* Options for `createEngine`.
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1593
|
-
* (2x is not a valid WebGPU sample count). Defaults to `4`.
|
|
2517
|
+
* Options for `createEngine`. Per-surface options for the primary surface (the canvas
|
|
2518
|
+
* passed to `createEngine`) come from {@link SurfaceOptions} and are passed alongside
|
|
2519
|
+
* the engine options as a single union: `createEngine(canvas, opts: EngineOptions & SurfaceOptions)`.
|
|
1594
2520
|
*/
|
|
1595
|
-
export declare interface EngineOptions {
|
|
1596
|
-
msaaSamples?: 1 | 4;
|
|
2521
|
+
export declare interface EngineOptions extends SurfaceOptions {
|
|
1597
2522
|
/**
|
|
1598
|
-
* WebGPU
|
|
1599
|
-
*
|
|
2523
|
+
* Extra WebGPU device limits to request when calling `adapter.requestDevice()`.
|
|
2524
|
+
* Use to raise per-device caps such as `maxColorAttachmentBytesPerSample` (default 32),
|
|
2525
|
+
* which is required when rendering into many MRT attachments. Caller is responsible for
|
|
2526
|
+
* staying within the adapter's reported limits.
|
|
1600
2527
|
*/
|
|
1601
|
-
|
|
2528
|
+
requiredLimits?: Record<string, GPUSize64 | undefined>;
|
|
1602
2529
|
/**
|
|
1603
|
-
*
|
|
1604
|
-
* The backing store is sized at `min(devicePixelRatio, maxDevicePixelRatio) * cssPixels`.
|
|
1605
|
-
* `maxDevicePixelRatio: 1` renders at native CSS-pixel resolution (no DPR upscaling) —
|
|
1606
|
-
* useful on high-DPI/iOS devices where `devicePixelRatio` is ~3. Defaults to unclamped
|
|
1607
|
-
* (full devicePixelRatio). Equivalent to Babylon.js `setHardwareScalingRatio`.
|
|
2530
|
+
* Enable Float64 intermediate precision for world matrix computations. Defaults to false.
|
|
1608
2531
|
*/
|
|
1609
|
-
|
|
2532
|
+
useHighPrecisionMatrix?: boolean;
|
|
2533
|
+
/**
|
|
2534
|
+
* Enable floating-origin (Large World Rendering) for every scene on this engine.
|
|
2535
|
+
* Requires `useHighPrecisionMatrix: true` — throws synchronously if set without it.
|
|
2536
|
+
* Defaults to false.
|
|
2537
|
+
*
|
|
2538
|
+
* When true, `createEngine` dynamically imports the LWR runtime
|
|
2539
|
+
* (`large-world/floating-origin.js`) so engines without LWR never pull the
|
|
2540
|
+
* module into their bundle (tree-shaken via the dynamic-import gate, same
|
|
2541
|
+
* pattern as the F64 storage module).
|
|
2542
|
+
*/
|
|
2543
|
+
useFloatingOrigin?: boolean;
|
|
1610
2544
|
}
|
|
1611
2545
|
|
|
1612
2546
|
/** GPU-resident environment textures. */
|
|
@@ -1652,6 +2586,11 @@ declare interface EulerProxy {
|
|
|
1652
2586
|
set(x: number, y: number, z: number): void;
|
|
1653
2587
|
}
|
|
1654
2588
|
|
|
2589
|
+
/** Extract outlines for the requested glyph ids and add them to `target`.
|
|
2590
|
+
* Skips ids already present in `target`. Glyphs with no outline are silently skipped.
|
|
2591
|
+
* Mutates `target` directly — no allocation when no new glyphs appear. */
|
|
2592
|
+
export declare function extractGlyphCurves(font: Font, glyphIds: ReadonlySet<number>, target: Map<number, GlyphCurves>): void;
|
|
2593
|
+
|
|
1655
2594
|
/** A post-process task that keeps only pixels whose luminance exceeds `threshold` and zeroes the rest. */
|
|
1656
2595
|
export declare interface ExtractHighlightsPostProcessTask extends PostProcessTask {
|
|
1657
2596
|
threshold: number;
|
|
@@ -1700,6 +2639,17 @@ export declare function findRandomPointAroundCircle(plugin: NavigationPlugin, po
|
|
|
1700
2639
|
/** Mark thin instance data dirty after direct array manipulation. */
|
|
1701
2640
|
export declare function flushThinInstances(mesh: Mesh): void;
|
|
1702
2641
|
|
|
2642
|
+
/**
|
|
2643
|
+
* Smoothly animate a {@link GeospatialCamera} to new yaw/pitch/radius/centre over
|
|
2644
|
+
* `durationMs`, driven by the scene's render loop. Yaw takes the shortest angular
|
|
2645
|
+
* path; the centre follows a great-circle (with an optional parabolic hop).
|
|
2646
|
+
*
|
|
2647
|
+
* The returned promise resolves when the flight completes; it also resolves early
|
|
2648
|
+
* if the flight is interrupted (by user input through `attachGeospatialControls`,
|
|
2649
|
+
* or by a subsequent `flyGeospatialCameraToAsync` call). Only one flight runs at a time.
|
|
2650
|
+
*/
|
|
2651
|
+
export declare function flyGeospatialCameraToAsync(camera: GeospatialCamera, scene: SceneContext, options: GeospatialFlyOptions): Promise<void>;
|
|
2652
|
+
|
|
1703
2653
|
/** Fog configuration — plain data. */
|
|
1704
2654
|
export declare interface FogConfig {
|
|
1705
2655
|
mode: 0 | 1 | 2 | 3;
|
|
@@ -1709,6 +2659,11 @@ export declare interface FogConfig {
|
|
|
1709
2659
|
color: [number, number, number];
|
|
1710
2660
|
}
|
|
1711
2661
|
|
|
2662
|
+
export declare interface Font {
|
|
2663
|
+
readonly [fontBrand]: true;
|
|
2664
|
+
|
|
2665
|
+
declare const fontBrand: unique symbol;
|
|
2666
|
+
|
|
1712
2667
|
/** The frame graph — an ordered list of tasks. */
|
|
1713
2668
|
export declare interface FrameGraph {
|
|
1714
2669
|
/** Build (or rebuild) every task in execute order. */
|
|
1715
2670
|
build(): void;
|
|
@@ -1721,7 +2676,8 @@ export declare interface FrameGraph {
|
|
|
1721
2676
|
/** Build (or rebuild) every task in e
|
|
1722
2677
|
/** A scene-less rendering context driven directly by a FrameGraph. */
|
|
1723
2678
|
export declare interface FrameGraphContext extends RenderingContext_2 {
|
|
1724
2679
|
readonly name: string;
|
|
1725
|
-
|
|
2680
|
+
/** Surface this context renders into. */
|
|
2681
|
+
readonly surface: SurfaceContext;
|
|
1726
2682
|
readonly frameGraph: FrameGraph;
|
|
1727
2683
|
clearColor: GPUColorDict;
|
|
1728
2684
|
}
|
|
@@ -1779,6 +2735,251 @@ export declare interface GaussianSplattingMesh extends SceneNode {
|
|
|
1779
2735
|
/** Numbe
|
|
1780
2736
|
updateData(splatBuffer: ArrayBuffer): void;
|
|
1781
2737
|
}
|
|
1782
2738
|
|
|
2739
|
+
export declare interface GeometryRendererTask extends Task {
|
|
2740
|
+
readonly name: string;
|
|
2741
|
+
/** The optional target texture the task wrote the real (lit) color into.
|
|
2742
|
+
* Equal to {@link GeometryRendererTaskConfig.targetTexture} when the
|
|
2743
|
+
* config provided one, otherwise `undefined`. */
|
|
2744
|
+
readonly outputTexture: RenderTarget | undefined;
|
|
2745
|
+
/** Single-attachment depth `RenderTarget` exposing the pass's depth/stencil
|
|
2746
|
+
* attachment. Downstream tasks (e.g. a `RenderTask` running after the
|
|
2747
|
+
* geometry pass) can consume this as a depth input to reuse the values
|
|
2748
|
+
* written here. When the caller supplied an external `depthTexture` in the
|
|
2749
|
+
* config, this returns that same RT; otherwise it wraps the MRT-owned
|
|
2750
|
+
* depth and is populated post-`record()`. */
|
|
2751
|
+
readonly geometryDepthTexture: RenderTarget;
|
|
2752
|
+
/** Per-type accessors. `null` when that type was not requested. Each value
|
|
2753
|
+
* is a single-attachment `RenderTarget` whose color slot aliases the
|
|
2754
|
+
* matching MRT attachment, so downstream tasks (copy-to-texture, etc.)
|
|
2755
|
+
* can consume it like an ordinary RT. */
|
|
2756
|
+
readonly geometryIrradianceTexture: RenderTarget | null;
|
|
2757
|
+
readonly geometryWorldPositionTexture: RenderTarget | null;
|
|
2758
|
+
readonly geometryLocalPositionTexture: RenderTarget | null;
|
|
2759
|
+
readonly geometryReflectivityTexture: RenderTarget | null;
|
|
2760
|
+
readonly geometryViewDepthTexture: RenderTarget | null;
|
|
2761
|
+
readonly geometryNormalizedViewDepthTexture: RenderTarget | null;
|
|
2762
|
+
readonly geometryScreenspaceDepthTexture: RenderTarget | null;
|
|
2763
|
+
readonly geometryViewNormalTexture: RenderTarget | null;
|
|
2764
|
+
readonly geometryWorldNormalTexture: RenderTarget | null;
|
|
2765
|
+
readonly geometryAlbedoTexture: RenderTarget | null;
|
|
2766
|
+
readonly geometryLinearVelocityTexture: RenderTarget | null;
|
|
2767
|
+
/** Skip a mesh from the velocity attachment's previous-world tracking. */
|
|
2768
|
+
excludeFromVelocity(mesh: Mesh): void;
|
|
2769
|
+
/** Re-include a mesh in velocity tracking. */
|
|
2770
|
+
includeInVelocity(mesh: Mesh): void;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
export declare interface GeometryRendererTaskConfig {
|
|
2774
|
+
name?: string;
|
|
2775
|
+
/** Caster meshes. When omitted, defaults to `scene.meshes`. */
|
|
2776
|
+
meshes?: readonly Mesh[];
|
|
2777
|
+
/** Per-pass camera override. Defaults to `scene.camera`. */
|
|
2778
|
+
camera?: Camera | null;
|
|
2779
|
+
/** Render-target size. Defaults to the scene's `surface`. */
|
|
2780
|
+
size?: SurfaceContext | {
|
|
2781
|
+
width: number;
|
|
2782
|
+
height: number;
|
|
2783
|
+
};
|
|
2784
|
+
/** MSAA sample count. Defaults to 1. */
|
|
2785
|
+
samples?: 1 | 4;
|
|
2786
|
+
/** Externally-owned depth attachment. When omitted, the task creates its
|
|
2787
|
+
* own `depth32float` depth texture sized to match the color attachments. */
|
|
2788
|
+
depthTexture?: RenderTarget | null;
|
|
2789
|
+
/** Ordered list of MRT attachments (1..8). The array index becomes the
|
|
2790
|
+
* fragment shader's `@location(i)` and the render-pass color attachment slot. */
|
|
2791
|
+
readonly textureDescriptions: readonly GeometryRendererTextureDescription[];
|
|
2792
|
+
/** Flip culling direction. Default false. */
|
|
2793
|
+
reverseCulling?: boolean;
|
|
2794
|
+
/** Optional color render-target that receives the *real* (lit) material
|
|
2795
|
+
* color, written as an additional color attachment alongside the geometry
|
|
2796
|
+
* data attachments. Must have the same {@link sampleCount} and resolved
|
|
2797
|
+
* pixel size as the geometry MRT (size: `<surface>` with samples matching).
|
|
2798
|
+
* When omitted, no real-color attachment is added to the pass.
|
|
2799
|
+
*
|
|
2800
|
+
* The target attachment uses `loadOp: "load"` (matches BJS), so the
|
|
2801
|
+
* caller must initialize the target's contents (e.g. via a clear pass)
|
|
2802
|
+
* before the geometry task runs — unless {@link targetTextureClearColor}
|
|
2803
|
+
* is provided. */
|
|
2804
|
+
targetTexture?: RenderTarget;
|
|
2805
|
+
/** When set together with {@link targetTexture}, the target attachment
|
|
2806
|
+
* uses `loadOp: "clear"` with this color at the start of the geometry
|
|
2807
|
+
* pass. Convenient for demo / standalone use where no prior task has
|
|
2808
|
+
* initialized the target's contents. */
|
|
2809
|
+
targetTextureClearColor?: GPUColor;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/** One MRT color attachment requested by the user. */
|
|
2813
|
+
export declare interface GeometryRendererTextureDescription {
|
|
2814
|
+
/** Which geometry value to write. */
|
|
2815
|
+
readonly type: GeometryTextureType;
|
|
2816
|
+
/** Per-attachment WebGPU format override. Defaults to
|
|
2817
|
+
* {@link GEOMETRY_TEXTURE_DESCRIPTIONS}[type].defaultFormat. */
|
|
2818
|
+
readonly format?: GPUTextureFormat;
|
|
2819
|
+
/** Per-attachment clear-value override. Defaults to
|
|
2820
|
+
* {@link GEOMETRY_TEXTURE_DESCRIPTIONS}[type].clearValue. Use to match a
|
|
2821
|
+
* reference engine's clear behaviour (e.g. clear VIEW_DEPTH to 0 instead of
|
|
2822
|
+
* the camera far plane to mirror BJS's PREPASS_DEPTH). */
|
|
2823
|
+
readonly clearValue?: GPUColor;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
/**
|
|
2827
|
+
* Geometry renderer texture types.
|
|
2828
|
+
*
|
|
2829
|
+
* Each enum value corresponds to a single geometry attachment that
|
|
2830
|
+
* {@link createGeometryRendererTask} can write to. The companion
|
|
2831
|
+
* {@link GEOMETRY_TEXTURE_DESCRIPTIONS} table provides the default
|
|
2832
|
+
* per-type WebGPU format and the clear behaviour at the start of a
|
|
2833
|
+
* geometry pass.
|
|
2834
|
+
*
|
|
2835
|
+
* The enum is intentionally a subset of Babylon.js'
|
|
2836
|
+
* `MaterialHelperGeometryRendering.GeometryTextureDescriptions`. The
|
|
2837
|
+
* following BJS types are excluded by design:
|
|
2838
|
+
* - `ALBEDO_SQRT` — we only expose `ALBEDO`.
|
|
2839
|
+
* - `VELOCITY` (vec2 SS) — we only expose `LINEAR_VELOCITY` (vec3 WS).
|
|
2840
|
+
* - `IRRADIANCE_LEGACY` — we only expose `IRRADIANCE`.
|
|
2841
|
+
* - `COLOR` — handled separately via the geometry task's
|
|
2842
|
+
* optional `targetTexture` color attachment
|
|
2843
|
+
* (BJS `PREPASS_COLOR_INDEX`).
|
|
2844
|
+
*
|
|
2845
|
+
* Module is lazy-loaded by the geometry view and the geometry task only;
|
|
2846
|
+
* existing scenes never import it.
|
|
2847
|
+
*/
|
|
2848
|
+
/** Identifies a single geometry texture supported by `createGeometryRendererTask`. */
|
|
2849
|
+
export declare enum GeometryTextureType {
|
|
2850
|
+
/** Half-float RGBA — diffuse irradiance accumulated at the surface. */
|
|
2851
|
+
IRRADIANCE = 0,
|
|
2852
|
+
/** Half-float RGBA — world-space position. */
|
|
2853
|
+
WORLD_POSITION = 1,
|
|
2854
|
+
/** Half-float RGBA — object-local position (before world transform). */
|
|
2855
|
+
LOCAL_POSITION = 2,
|
|
2856
|
+
/** Unorm8 RGBA — material reflectivity (rgb) + roughness (a). */
|
|
2857
|
+
REFLECTIVITY = 3,
|
|
2858
|
+
/** Float R — linear view-space depth (camera-far at the far plane). Cleared to camera far. */
|
|
2859
|
+
VIEW_DEPTH = 4,
|
|
2860
|
+
/** Half-float R — view-space depth normalized to [0,1] (1 at the far plane). */
|
|
2861
|
+
NORMALIZED_VIEW_DEPTH = 5,
|
|
2862
|
+
/** Half-float R — clip-space depth in [0,1] (matches GPU depth buffer post-projection). */
|
|
2863
|
+
SCREENSPACE_DEPTH = 6,
|
|
2864
|
+
/** Half-float RGBA — view-space surface normal. */
|
|
2865
|
+
VIEW_NORMAL = 7,
|
|
2866
|
+
/** Half-float RGBA — world-space surface normal. */
|
|
2867
|
+
WORLD_NORMAL = 8,
|
|
2868
|
+
/** Unorm8 RGBA — surface albedo (diffuse colour, no lighting). */
|
|
2869
|
+
ALBEDO = 9,
|
|
2870
|
+
/** Half-float RGBA — per-pixel linear world-space velocity in units / frame. */
|
|
2871
|
+
LINEAR_VELOCITY = 10
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
/** Camera that orbits a spherical planet centred at the world origin (Babylon.js `GeospatialCamera`).
|
|
2875
|
+
*
|
|
2876
|
+
* Orientation is fully described by `center` (the anchored point on the globe in
|
|
2877
|
+
* ECEF coordinates), `yaw`, `pitch`, and `radius`. Setting any of these
|
|
2878
|
+
* recomputes the derived `position` / `upVector` and the view matrix.
|
|
2879
|
+
*
|
|
2880
|
+
* Pure state — behaviour is provided by standalone functions
|
|
2881
|
+
* ({@link setGeospatialOrientation}, `attachGeospatialControls`,
|
|
2882
|
+
* `flyGeospatialCameraToAsync`). The camera never references the scene. */
|
|
2883
|
+
export declare interface GeospatialCamera extends Camera, IWorldMatrixProvider, IParentable {
|
|
2884
|
+
/** The anchored point on the globe (ECEF). Assigning re-orbits around the new centre. */
|
|
2885
|
+
center: Vec3;
|
|
2886
|
+
/** Yaw about the geocentric up axis. Wrapped to [-π, π). 0 = north, π/2 = east. */
|
|
2887
|
+
yaw: number;
|
|
2888
|
+
/** Pitch from looking straight down (0) to the horizon (π/2). Wrapped to [-π, π). */
|
|
2889
|
+
pitch: number;
|
|
2890
|
+
/** Distance from the camera to its centre point (distinct from `planetRadius`). */
|
|
2891
|
+
radius: number;
|
|
2892
|
+
/** Limits governing yaw/pitch/radius clamping. Mutable; clamping applies on the next orientation change. */
|
|
2893
|
+
limits: GeospatialLimits;
|
|
2894
|
+
/** Derived world-space eye position. Read-only — driven by center/yaw/pitch/radius. */
|
|
2895
|
+
readonly position: Vec3;
|
|
2896
|
+
/** Derived camera up vector. Read-only. */
|
|
2897
|
+
readonly upVector: Vec3;
|
|
2898
|
+
fov: number;
|
|
2899
|
+
nearPlane: number;
|
|
2900
|
+
farPlane: number;
|
|
2901
|
+
viewport?: NormalizedViewport;
|
|
2902
|
+
children: SceneNode[];
|
|
2903
|
+
parent: IWorldMatrixProvider | null;
|
|
2904
|
+
readonly worldMatrix: Mat4;
|
|
2905
|
+
readonly worldMatrixVersion: number;
|
|
2906
|
+
|
|
2907
|
+
/** Options for {@link createGeospatialCamera}. */
|
|
2908
|
+
export declare interface GeospatialCameraOptions {
|
|
2909
|
+
/** Radius of the planet being orbited. */
|
|
2910
|
+
planetRadius: number;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
/** Options for {@link attachGeospatialControls}. */
|
|
2914
|
+
export declare interface GeospatialControlOptions {
|
|
2915
|
+
/** When true, zooming moves toward the point under the cursor; otherwise along the look vector. Default true. */
|
|
2916
|
+
zoomToCursor?: boolean;
|
|
2917
|
+
/** Enable simple sphere collision so the camera cannot dip below the surface. Default false. */
|
|
2918
|
+
checkCollisions?: boolean;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
/** Options for {@link flyGeospatialCameraToAsync}. Omitted target fields keep their current value. */
|
|
2922
|
+
export declare interface GeospatialFlyOptions {
|
|
2923
|
+
/** Target yaw (radians). Shortest angular path is taken. */
|
|
2924
|
+
yaw?: number;
|
|
2925
|
+
/** Target pitch (radians). */
|
|
2926
|
+
pitch?: number;
|
|
2927
|
+
/** Target radius. */
|
|
2928
|
+
radius?: number;
|
|
2929
|
+
/** Target centre (ECEF). Animated along a great-circle (slerp). */
|
|
2930
|
+
center?: Vec3;
|
|
2931
|
+
/** Flight duration in ms. Default 1000. */
|
|
2932
|
+
durationMs?: number;
|
|
2933
|
+
/** Parabolic "hop" height scale for the centre animation (0 = none). */
|
|
2934
|
+
centerHopScale?: number;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
/** Pitch/yaw/radius bounds for a {@link GeospatialCamera}.
|
|
2938
|
+
*
|
|
2939
|
+
* Pure state, mirroring Babylon.js `GeospatialLimits`. Behaviour
|
|
2940
|
+
* ({@link getEffectivePitchMax}, {@link clampZoomDistance}) lives in
|
|
2941
|
+
* standalone functions so unused limit logic is tree-shaken.
|
|
2942
|
+
*
|
|
2943
|
+
* All angles are in radians. Pitch is measured from "looking straight down at
|
|
2944
|
+
* the planet centre" (0) to "looking at the horizon" (π/2). */
|
|
2945
|
+
export declare interface GeospatialLimits {
|
|
2946
|
+
/** Radius of the planet — used for altitude/radius conversions. */
|
|
2947
|
+
planetRadius: number;
|
|
2948
|
+
/** Minimum camera distance from its centre point (closest zoom). Default 10. */
|
|
2949
|
+
radiusMin: number;
|
|
2950
|
+
/** Maximum camera distance from its centre point (farthest zoom). Default `planetRadius * 4`. */
|
|
2951
|
+
radiusMax: number;
|
|
2952
|
+
/** Minimum pitch angle (≈0 = looking straight down at the planet). */
|
|
2953
|
+
pitchMin: number;
|
|
2954
|
+
/** Maximum pitch angle (π/2 = looking at the horizon). */
|
|
2955
|
+
pitchMax: number;
|
|
2956
|
+
/**
|
|
2957
|
+
* Controls how pitch is disabled as the camera zooms out.
|
|
2958
|
+
* `x` = radius scale at which full pitch is allowed (e.g. 2 ⇒ 2·planetRadius),
|
|
2959
|
+
* `y` = radius scale at which pitch is fully disabled (forced to `pitchMin`).
|
|
2960
|
+
* `null` disables this feature (full pitch at every radius).
|
|
2961
|
+
*/
|
|
2962
|
+
pitchDisabledRadiusScale: {
|
|
2963
|
+
x: number;
|
|
2964
|
+
y: number;
|
|
2965
|
+
} | null;
|
|
2966
|
+
/** Minimum yaw angle (rotation about the geocentric up axis). Default -Infinity. */
|
|
2967
|
+
yawMin: number;
|
|
2968
|
+
/** Maximum yaw angle. Default +Infinity. */
|
|
2969
|
+
yawMax: number;
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
/** A delta to apply via {@link setGeospatialOrientation}; omitted fields keep their current value. */
|
|
2973
|
+
export declare interface GeospatialOrientation {
|
|
2974
|
+
/** Yaw in radians (0 = north, π/2 = east). */
|
|
2975
|
+
yaw?: number;
|
|
2976
|
+
/** Pitch in radians (0 = looking straight down at the planet centre, π/2 = horizon). */
|
|
2977
|
+
pitch?: number;
|
|
2978
|
+
/** Distance from the camera to its centre point. */
|
|
2979
|
+
radius?: number;
|
|
2980
|
+
/** Anchor point on the globe (ECEF) that the camera orbits. */
|
|
2981
|
+
center?: Vec3;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
1783
2984
|
/** Get the current world position of an agent. */
|
|
1784
2985
|
export declare function getAgentPosition(crowd: NavCrowd, index: number): Vec3;
|
|
1785
2986
|
|
|
@@ -1805,18 +3006,41 @@ export declare function getClosestPoint(plugin: NavigationPlugin, position: Vec3
|
|
|
1805
3006
|
/** Returns the render-target aspect ratio adjusted for the camera's normalized viewport, or the raw ratio if none. */
|
|
1806
3007
|
export declare function getEffectiveAspectRatio(camera: Camera | null | undefined, targetWidth: number, targetHeight: number): number;
|
|
1807
3008
|
|
|
3009
|
+
/**
|
|
3010
|
+
* Computes the effective maximum pitch for a given camera radius. When
|
|
3011
|
+
* `pitchDisabledRadiusScale` is set, pitch is interpolated from `pitchMax` down
|
|
3012
|
+
* to `pitchMin` as the camera zooms out from `x·planetRadius` to `y·planetRadius`
|
|
3013
|
+
* (so a fully zoomed-out camera looks straight down).
|
|
3014
|
+
*/
|
|
3015
|
+
export declare function getEffectivePitchMax(limits: GeospatialLimits, currentRadius: number): number;
|
|
3016
|
+
|
|
3017
|
+
/** Read the current floating-origin offset from a scene as a `Vec3`. The
|
|
3018
|
+
* offset is the active camera's world position. Returns the zero vector
|
|
3019
|
+
* when no camera is set (typical headless/precompute case). For non-LWR
|
|
3020
|
+
* engines this module is not imported, so the function is unreachable. */
|
|
3021
|
+
export declare function getFloatingOriginOffset(scene: SceneContext): Vec3;
|
|
3022
|
+
|
|
1808
3023
|
/** Get the scene's frame graph. Always non-null — created in `createSceneContext`. */
|
|
1809
3024
|
export declare function getFrameGraph(scene: SceneContext): FrameGraph;
|
|
1810
3025
|
|
|
1811
3026
|
/** Get the current seed used by Recast's randomized queries. */
|
|
1812
3027
|
export declare function getNavigationRandomSeed(plugin: NavigationPlugin): number;
|
|
1813
3028
|
|
|
3029
|
+
/** Get or create a deduplicated sampler. Same config → same GPUSampler. */
|
|
3030
|
+
export declare function getOrCreateSampler(engine: EngineContext, desc?: GPUSamplerDescriptor): GPUSampler;
|
|
3031
|
+
|
|
3032
|
+
/**
|
|
3033
|
+
* Get a body's current linear velocity (m/s).
|
|
3034
|
+
*/
|
|
3035
|
+
export declare function getPhysicsBodyLinearVelocity(world: PhysicsWorld, body: PhysicsBody): Vec3;
|
|
3036
|
+
|
|
1814
3037
|
/**
|
|
1815
|
-
* Returns the world's current gravity vector.
|
|
3038
|
+
* Returns the world's current gravity vector, or a specific region's when `worldPosition` is given.
|
|
1816
3039
|
* @param world - The physics world.
|
|
3040
|
+
* @param worldPosition - Optional world position selecting the region to read; omit for the world-wide gravity.
|
|
1817
3041
|
* @returns Gravity acceleration in m/s².
|
|
1818
3042
|
*/
|
|
1819
|
-
export declare function getPhysicsGravity(world: PhysicsWorld): Vec3;
|
|
3043
|
+
export declare function getPhysicsGravity(world: PhysicsWorld, worldPosition?: Vec3): Vec3;
|
|
1820
3044
|
|
|
1821
3045
|
/**
|
|
1822
3046
|
* Returns the world's fixed simulation timestep in seconds.
|
|
@@ -1865,12 +3089,39 @@ export declare function getSprite2DHandleIndex(handle: Sprite2DHandle): number;
|
|
|
1865
3089
|
*/
|
|
1866
3090
|
export declare function getVariantNames(container: AssetContainer): readonly string[];
|
|
1867
3091
|
|
|
1868
|
-
/** Compute the view matrix for a camera. Cached per worldMatrixVersion.
|
|
3092
|
+
/** Compute the view matrix for a camera. Cached per worldMatrixVersion.
|
|
3093
|
+
*
|
|
3094
|
+
* Floating-origin awareness: when `camera._useFloatingOrigin` is set
|
|
3095
|
+
* (LWR — wired by the scene's `_update` when the active scene camera is
|
|
3096
|
+
* bound to an LWR engine), the view matrix translation column is forced
|
|
3097
|
+
* to zero. The GPU vertex shader then sees the camera at the origin in
|
|
3098
|
+
* the eye-relative frame, matching the mesh-world UBO pack which
|
|
3099
|
+
* subtracted the camera position from world translations. View × world
|
|
3100
|
+
* in the shader produces eye-relative vertex coordinates at full
|
|
3101
|
+
* precision regardless of how far from world-origin the scene is.
|
|
3102
|
+
*
|
|
3103
|
+
* When the flag is unset (standard non-LWR rendering), this path is
|
|
3104
|
+
* bit-identical to a normal `R_inv * -cameraPos` view matrix. */
|
|
1869
3105
|
export declare function getViewMatrix(camera: Camera): Mat4;
|
|
1870
3106
|
|
|
1871
3107
|
/** Compute the view-projection matrix for a camera. Cached per worldMatrixVersion + aspect. */
|
|
1872
3108
|
export declare function getViewProjectionMatrix(camera: Camera, aspectRatio: number): Mat4;
|
|
1873
3109
|
|
|
3110
|
+
declare interface GizmoMaterialSet {
|
|
3111
|
+
colored: StandardMaterialProps;
|
|
3112
|
+
hover: StandardMaterialProps;
|
|
3113
|
+
disabled: StandardMaterialProps;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
/** Tiny single-event observable used by gizmos/pointer-drag (no dependency on
|
|
3117
|
+
* BJS's Observable, no module-level allocations). */
|
|
3118
|
+
declare class GizmoObservable<T> {
|
|
3119
|
+
private _subs;
|
|
3120
|
+
add(cb: (arg: T) => void): () => void;
|
|
3121
|
+
notify(arg: T): void;
|
|
3122
|
+
clear(): void;
|
|
3123
|
+
}
|
|
3124
|
+
|
|
1874
3125
|
/** Everything the animation system needs, parsed from a glTF file. */
|
|
1875
3126
|
export declare interface GltfAnimationData {
|
|
1876
3127
|
readonly clips: readonly AnimationClip[];
|
|
@@ -1888,6 +3139,61 @@ export declare interface GltfAnimationData {
|
|
|
1888
3139
|
readonly excludedNodeIndices: ReadonlySet<number>;
|
|
1889
3140
|
}
|
|
1890
3141
|
|
|
3142
|
+
export declare type GlyphBounds = {
|
|
3143
|
+
readonly xMin: number;
|
|
3144
|
+
readonly yMin: number;
|
|
3145
|
+
readonly xMax: number;
|
|
3146
|
+
readonly yMax: number;
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3149
|
+
export declare type GlyphCurves = {
|
|
3150
|
+
readonly glyphId: number;
|
|
3151
|
+
readonly curves: readonly QuadCurve[];
|
|
3152
|
+
readonly bounds: GlyphBounds;
|
|
3153
|
+
|
|
3154
|
+
export declare type GlyphRun = {
|
|
3155
|
+
/** Which curve set this run's glyph ids index into. */
|
|
3156
|
+
readonly curveSet: CurveSetId;
|
|
3157
|
+
readonly glyphs: readonly PlacedGlyph[];
|
|
3158
|
+
/** Font-units → pixels scale used by the layout. */
|
|
3159
|
+
readonly pixelsPerFontUnit: number;
|
|
3160
|
+
/** Optional default color for every glyph in this run, as linear RGBA in [0,1]. A glyph's
|
|
3161
|
+
* own `PlacedGlyph.color` takes precedence over this. When omitted, glyphs default to
|
|
3162
|
+
* opaque white. The rendered alpha is additionally scaled by the whole-block opacity. */
|
|
3163
|
+
readonly defaultColor?: readonly [number, number, number, number];
|
|
3164
|
+
};
|
|
3165
|
+
|
|
3166
|
+
/** Opaque bundle of glyph outlines (organized by curve-set) and the GPU atlases packed
|
|
3167
|
+
* from them. Holds an arbitrary number of curve-sets — each curve-set gets its own atlas.
|
|
3168
|
+
* Shared by reference across any number of `TextData`s that need the same glyph catalog. */
|
|
3169
|
+
export declare interface GlyphStorage {
|
|
3170
|
+
readonly [glyphStorageBrand]: true;
|
|
3171
|
+
|
|
3172
|
+
/** Glyph storage: per-curve-set CPU outline catalog plus the GPU atlas packed from it.
|
|
3173
|
+
*
|
|
3174
|
+
* Layered:
|
|
3175
|
+
* - `GlyphStorage` is the opaque public handle. Holds one or more curve-sets keyed by
|
|
3176
|
+
* `CurveSetId` (typically a font family name). Each curve-set owns its glyph
|
|
3177
|
+
* outlines plus the `SharedAtlas` packed from them.
|
|
3178
|
+
* - `SharedAtlas` is the CPU staging: two `rgba32float`-shaped `Float32Array`s holding
|
|
3179
|
+
* quadratic curve control points and per-band curve-index lists, both append-only.
|
|
3180
|
+
* - Atlas packing (`packAppendGlyph`) and spatial-band partitioning (`buildGlyphBands`)
|
|
3181
|
+
* live here as internal helpers — they implement the storage's invariants and are
|
|
3182
|
+
* not callable from outside the module.
|
|
3183
|
+
* - GPU creation/upload (`SharedAtlasGpu`, `ensureSharedAtlasGpu`) lives in
|
|
3184
|
+
* `_gpu/text-textures.ts`; the shared types are exported from here. GPU teardown
|
|
3185
|
+
* is performed inline in `disposeGlyphStorage` to avoid a circular import edge.
|
|
3186
|
+
*
|
|
3187
|
+
* Lifetime is caller-owned (matches `Texture2D` semantics):
|
|
3188
|
+
* - `createGlyphStorage(initial?)` allocates a fresh storage, optionally seeded.
|
|
3189
|
+
* - `updateGlyphStorage(storage, curveSetId, curves)` adds glyphs (creating the
|
|
3190
|
+
* curve-set on demand). Glyph ids already present are skipped.
|
|
3191
|
+
* - `disposeGlyphStorage(storage)` releases every atlas. The caller must ensure no
|
|
3192
|
+
* `TextData` is still drawing from it — using a disposed storage is undefined
|
|
3193
|
+
* behavior. Idempotent.
|
|
3194
|
+
*/
|
|
3195
|
+
declare const glyphStorageBrand: unique symbol;
|
|
3196
|
+
|
|
1891
3197
|
/** Seek to a specific frame, apply the pose, and pause. */
|
|
1892
3198
|
export declare function goToFrame(group: AnimationGroup, frame: number, engine?: EngineContext): void;
|
|
1893
3199
|
|
|
@@ -2042,6 +3348,13 @@ export declare function initializeCsg2Async(): Promise<void>;
|
|
|
2042
3348
|
|
|
2043
3349
|
declare type InterpMode = 0 | 1 | 2;
|
|
2044
3350
|
|
|
3351
|
+
/** Force every registered scene's cached render + shadow bundles to RE-RECORD on the next frame, by bumping
|
|
3352
|
+
* each rendering context's `_renderableVersion` (the same signal a mesh add/remove or `resizeMeshGeometry`
|
|
3353
|
+
* emits). Use after an out-of-band GPU buffer REALLOCATION that the cached bundles can't otherwise notice —
|
|
3354
|
+
* e.g. growing a thin-instanced mesh's matrix buffer past its capacity (the bundle captured the old buffer
|
|
3355
|
+
* handle and would bind a freed buffer). A no-op-cheap version bump; the actual re-record happens lazily. */
|
|
3356
|
+
export declare function invalidateRenderBundles(engine: EngineContext): void;
|
|
3357
|
+
|
|
2045
3358
|
/** Any object that can be attached to a parent in the scene hierarchy.
|
|
2046
3359
|
* When parent is null, position/rotation/scaling are in world space. */
|
|
2047
3360
|
export declare interface IParentable {
|
|
@@ -2075,6 +3388,26 @@ export declare function isBillboardSpriteHandleAlive(handle: BillboardSpriteHand
|
|
|
2075
3388
|
/** Returns whether the manifold-3d runtime has finished loading and CSG2 is usable. */
|
|
2076
3389
|
export declare function isCsg2Ready(): boolean;
|
|
2077
3390
|
|
|
3391
|
+
/** Returns true when the gizmo dispatcher for `canvas` has an ACTIVE drag in
|
|
3392
|
+
* progress (a collider was pressed and is being dragged). Unlike
|
|
3393
|
+
* {@link isGizmoInteracting} this ignores mere hover, so camera controls can
|
|
3394
|
+
* abort an optimistically-started orbit once a gizmo drag (recognised a frame
|
|
3395
|
+
* after pointer-down, since picking is async) reclaims the gesture — without
|
|
3396
|
+
* aborting a legitimate orbit when the cursor merely passes over a gizmo. */
|
|
3397
|
+
export declare function isGizmoDragging(canvas: HTMLCanvasElement): boolean;
|
|
3398
|
+
|
|
3399
|
+
/** Returns true when the gizmo dispatcher for `canvas` currently has a pointer
|
|
3400
|
+
* hovering one of its colliders or an active drag in progress. Camera
|
|
3401
|
+
* controls consult this on pointer-down so orbiting doesn't start when the
|
|
3402
|
+
* press lands on (or drags) a gizmo. */
|
|
3403
|
+
export declare function isGizmoInteracting(canvas: HTMLCanvasElement): boolean;
|
|
3404
|
+
|
|
3405
|
+
/** Returns true while the gizmo dispatcher for `canvas` has a pointer-down GPU
|
|
3406
|
+
* pick still in flight. Camera controls consult this to DEFER (not yet apply)
|
|
3407
|
+
* an orbit until the pick resolves, so a press that lands on a gizmo never
|
|
3408
|
+
* produces a stray orbit even if the async pick is slow. */
|
|
3409
|
+
export declare function isGizmoPickPending(canvas: HTMLCanvasElement): boolean;
|
|
3410
|
+
|
|
2078
3411
|
/**
|
|
2079
3412
|
* Returns `true` if the sprite referenced by `handle` is still present in its layer.
|
|
2080
3413
|
* @param handle - Handle to test.
|
|
@@ -2106,6 +3439,19 @@ export declare interface LightBase extends IWorldMatrixProvider, IParentable {
|
|
|
2106
3439
|
readonly worldMatrix: Mat4;
|
|
2107
3440
|
readonly worldMatrixVersion: number;
|
|
2108
3441
|
|
|
3442
|
+
export declare interface LightGizmo {
|
|
3443
|
+
/** Root node — follows the attached light's position (when it has one)
|
|
3444
|
+
* and orients along its direction (when it has one). */
|
|
3445
|
+
readonly root: SceneNode;
|
|
3446
|
+
readonly material: StandardMaterialProps;
|
|
3447
|
+
/** Currently attached light — set via `attachLightGizmoToLight`. */
|
|
3448
|
+
attachedLight: LightBase | null;
|
|
3449
|
+
|
|
3450
|
+
export declare interface LightGizmoOptions {
|
|
3451
|
+
/** RGB color for the light gizmo body material. Defaults to grey. */
|
|
3452
|
+
color?: [number, number, number];
|
|
3453
|
+
}
|
|
3454
|
+
|
|
2109
3455
|
/** Options for `createLinearDepthMaterial()`. */
|
|
2110
3456
|
export declare interface LinearDepthMaterialOptions {
|
|
2111
3457
|
/** Camera near plane (defaults to 0.03 to match the source playground). */
|
|
@@ -2116,6 +3462,9 @@ export declare interface LinearDepthMaterialOptions {
|
|
|
2116
3462
|
name?: string;
|
|
2117
3463
|
}
|
|
2118
3464
|
|
|
3465
|
+
/** Convert linear [0,1] to sRGB [0,255] using the IEC 61966-2-1 transfer curve. */
|
|
3466
|
+
export declare function linearToSrgbByte(v: number): number;
|
|
3467
|
+
|
|
2119
3468
|
/** Options for `loadSpriteAtlas`. PR 1 supports the `gridSize` path only. */
|
|
2120
3469
|
export declare interface LoadAtlasOptions {
|
|
2121
3470
|
/** Grid cell size `[w, h]` in pixels. Required in PR 1. */
|
|
@@ -2190,6 +3539,9 @@ export declare function loadEnvironment(scene: SceneContext, url: string, option
|
|
|
2190
3539
|
brdfUrl: string;
|
|
2191
3540
|
}): Promise<EnvironmentTextures>;
|
|
2192
3541
|
|
|
3542
|
+
/** Load a TTF or OTF font from a URL. */
|
|
3543
|
+
export declare function loadFont(url: string): Promise<Font>;
|
|
3544
|
+
|
|
2193
3545
|
/**
|
|
2194
3546
|
* Load a .glb or .gltf file, parse it, and upload mesh + material data to GPU.
|
|
2195
3547
|
* Supports both binary GLB and separate .gltf + .bin + image files.
|
|
@@ -2228,6 +3580,14 @@ export declare function loadHdrEnvironment(scene: SceneContext, url: string, opt
|
|
|
2228
3580
|
*/
|
|
2229
3581
|
export declare function loadKtxTexture2D(engine: EngineContext, baseUrl: string, suffixes: string[], opts?: Texture2DOptions): Promise<Texture2D>;
|
|
2230
3582
|
|
|
3583
|
+
/**
|
|
3584
|
+
* Resolve a node-block emitter, including the geometry-renderer terminal
|
|
3585
|
+
* (`GeometryTextureOutputBlock`). Pass as `blockLoader` to
|
|
3586
|
+
* `parseNodeMaterialFromSnippet` for node-material geometry-renderer scenes so
|
|
3587
|
+
* ordinary node scenes don't bundle the geometry block.
|
|
3588
|
+
*/
|
|
3589
|
+
export declare function loadNodeBlockEmitterWithGeometry(className: string): Promise<BlockEmitter>;
|
|
3590
|
+
|
|
2231
3591
|
/** Load a skybox cube texture and register it on the scene.
|
|
2232
3592
|
* The auto-builder will create the pipeline and render it.
|
|
2233
3593
|
*
|
|
@@ -2273,16 +3633,24 @@ export declare function loadSPZ(scene: SceneContext, url: string): Promise<Gauss
|
|
|
2273
3633
|
* @returns A promise resolving to the uploaded `Texture2D`. */
|
|
2274
3634
|
export declare function loadTexture2D(engine: EngineContext, url: string, opts?: Texture2DOptions): Promise<Texture2D>;
|
|
2275
3635
|
|
|
3636
|
+
/** Force the container's GPU light state to re-upload next frame. Call after mutating a light's
|
|
3637
|
+
* position / range / intensity / diffuse in place (e.g. animated lights such as drifting fireflies),
|
|
3638
|
+
* since those edits don't bump the container version on their own. */
|
|
3639
|
+
export declare function markClusteredLightContainerDirty(container: ClusteredLightContainer): void;
|
|
3640
|
+
|
|
2276
3641
|
/** Mark a material source (or one of its views) as needing UBO re-upload.
|
|
2277
3642
|
* The source owns a monotonic version so multiple renderables/views can observe
|
|
2278
3643
|
* the same mutation independently without racing on a single cleared boolean. */
|
|
2279
3644
|
export declare function markMaterialUboDirty(materialOrView: Material): void;
|
|
2280
3645
|
|
|
2281
|
-
/** 4x4 column-major matrix
|
|
2282
|
-
* Layout matches WebGPU/WGSL mat4x4<f32> memory order.
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
3646
|
+
/** 4x4 column-major matrix (16 elements).
|
|
3647
|
+
* Layout matches WebGPU/WGSL mat4x4<f32> memory order. Opaque-by-convention:
|
|
3648
|
+
* callers MUST NOT depend on the underlying storage (Float32Array vs
|
|
3649
|
+
* Float64Array). Internal kernels and uploaders use the `Mat4Storage` view
|
|
3650
|
+
* defined below to access the concrete typed array behind the brand. */
|
|
3651
|
+
export declare interface Mat4 {
|
|
2286
3652
|
readonly length: 16;
|
|
3653
|
+
readonly [index: number]: number;
|
|
3654
|
+
}
|
|
2287
3655
|
|
|
2288
3656
|
/** Compose TRS (translation * rotation * scale) into a single Mat4. */
|
|
2289
3657
|
export declare function mat4Compose(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, sx: number, sy: number, sz: number): Mat4;
|
|
@@ -2290,6 +3658,9 @@ export declare function mat4Compose(tx: number, ty: number, tz: number, qx: numb
|
|
|
2290
3658
|
/** Create a new identity Mat4. */
|
|
2291
3659
|
export declare function mat4Identity(): Mat4;
|
|
2292
3660
|
|
|
3661
|
+
/** Compute inverse of a Mat4. Returns null if singular. */
|
|
3662
|
+
export declare function mat4Invert(input: Mat4): Mat4 | null;
|
|
3663
|
+
|
|
2293
3664
|
/** Create a scaling matrix. */
|
|
2294
3665
|
export declare function mat4Scale(x: number, y: number, z: number): Mat4;
|
|
2295
3666
|
|
|
@@ -2304,6 +3675,37 @@ export declare interface Material {
|
|
|
2304
3675
|
/** Optional human-readable name. Popula
|
|
2305
3676
|
* (e.g. the glTF material name) so callers can look a material up by name. */
|
|
2306
3677
|
name?: string;
|
|
2307
3678
|
|
|
3679
|
+
/** Plain-data material plugin. All behaviour is via optional function members. */
|
|
3680
|
+
export declare interface MaterialPlugin {
|
|
3681
|
+
/** Stable identifier. Factored into the pipeline cache key. */
|
|
3682
|
+
readonly name: string;
|
|
3683
|
+
/** Lower runs first. Default 500. */
|
|
3684
|
+
priority?: number;
|
|
3685
|
+
/** Default true when attached. A disabled plugin contributes no shader code
|
|
3686
|
+
* but still changes the pipeline cache key (so toggling forces a rebuild). */
|
|
3687
|
+
isEnabled?: boolean;
|
|
3688
|
+
/** Static defines folded into the pipeline cache key (and available to the
|
|
3689
|
+
* plugin when it builds its custom code). */
|
|
3690
|
+
defines?: Record<string, boolean | number>;
|
|
3691
|
+
/** Return WGSL snippets keyed by injection point, or null. */
|
|
3692
|
+
getCustomCode?(shaderType: "vertex" | "fragment"): Partial<Record<MaterialPluginPoint, string>> | null;
|
|
3693
|
+
/** Declare custom UBO fields appended to the host material's uniform buffer. */
|
|
3694
|
+
getUniforms?(): {
|
|
3695
|
+
ubo?: PluginUboField[];
|
|
3696
|
+
};
|
|
3697
|
+
/** Declare custom texture/sampler bindings. */
|
|
3698
|
+
getSamplers?(): PluginSamplerDecl[];
|
|
3699
|
+
/** Write this plugin's UBO slice. `offsets` maps field name → byte offset. */
|
|
3700
|
+
writeUbo?(data: Float32Array, offsets: ReadonlyMap<string, number>): void;
|
|
3701
|
+
/** Emit texture bindings in the same order as {@link getSamplers}. */
|
|
3702
|
+
bindTextures?(out: PluginTextureBinding[]): void;
|
|
3703
|
+
/** Enumerate textures for acquire/release bookkeeping. */
|
|
3704
|
+
getActiveTextures?(out: Texture2D[]): void;
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
/** BJS-compatible injection-point names accepted by {@link MaterialPlugin.getCustomCode}. */
|
|
3708
|
+
export declare type MaterialPluginPoint = "CUSTOM_FRAGMENT_DEFINITIONS" | "CUSTOM_FRAGMENT_MAIN_BEGIN" | "CUSTOM_FRAGMENT_UPDATE_ALPHA" | "CUSTOM_FRAGMENT_UPDATE_DIFFUSE" | "CUSTOM_FRAGMENT_BEFORE_LIGHTS" | "CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION" | "CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR" | "CUSTOM_VERTEX_MAIN_BEGIN" | "CUSTOM_VERTEX_UPDATE_WORLDPOS" | "CUSTOM_VERTEX_MAIN_END";
|
|
3709
|
+
|
|
2308
3710
|
/** Exact material render-feature override used by MaterialView.
|
|
2309
3711
|
* Feature bits are interpreted by each concrete material family. */
|
|
2310
3712
|
export declare interface MaterialRenderFeatures {
|
|
@@ -2331,7 +3733,12 @@ export declare interface MaterialVariantData {
|
|
|
2331
3733
|
* The view is also a Material: it inherits material state from {@link source}
|
|
2332
3734
|
* through the prototype chain and owns only render-feature bits. Keeping views
|
|
2333
3735
|
* material-compatible lets ordinary render paths read properties normally, so
|
|
2334
|
-
* scenes that never create views do not retain view-specific unwrap branches.
|
|
3736
|
+
* scenes that never create views do not retain view-specific unwrap branches.
|
|
3737
|
+
*
|
|
3738
|
+
* Specialized views (e.g. the Standard geometry MRT view) override
|
|
3739
|
+
* {@link Material._buildGroup} with a view-specific builder whose
|
|
3740
|
+
* `_rebuildSingle` builds the right kind of Renderable — no per-family
|
|
3741
|
+
* branching is required in the core render-task. */
|
|
2335
3742
|
export declare interface MaterialView extends Material {
|
|
2336
3743
|
readonly source: Material;
|
|
2337
3744
|
|
|
@@ -2356,13 +3763,25 @@ export declare interface Mesh extends SceneNode {
|
|
|
2356
3763
|
boundMax?: [number, number, number];
|
|
2357
3764
|
/** Skeleton GPU data (skeletal animation). Type-only — no module dependency. */
|
|
2358
3765
|
skeleton?: SkeletonData | null;
|
|
3766
|
+
/** Baked vertex-animation (VAT) GPU data — replaces live skinning so the mesh thin-instances.
|
|
3767
|
+
* Mutually exclusive with live `skeleton` skinning. Type-only — no module dependency. */
|
|
3768
|
+
vat?: VatData | null;
|
|
2359
3769
|
/** Morph target GPU data. Type-only — no module dependency. */
|
|
2360
3770
|
morphTargets?: MorphTargetData | null;
|
|
2361
3771
|
/** User-controlled render order. Lower = drawn first within phase.
|
|
2362
3772
|
* Only affects ordering within the opaque or transparent phase. */
|
|
2363
3773
|
renderOrder?: number;
|
|
3774
|
+
/** On a transmission-enabled render task, draw this transparent mesh LAST — after the transmissive
|
|
3775
|
+
* surface and after the scene-colour grab — so it sits on top of the water/glass AND is excluded from
|
|
3776
|
+
* what that surface refracts (e.g. lily pads resting on water should not appear in the refraction).
|
|
3777
|
+
* Enable transmission on the task with `enableRenderTaskTransmission`; only transparent surfaces
|
|
3778
|
+
* (`needAlphaBlending`) are deferred. No effect on tasks without transmission. */
|
|
3779
|
+
renderOnTop?: boolean;
|
|
2364
3780
|
/** Thin instance data (CPU-side). GPU buffer managed by render system. */
|
|
2365
|
-
thinInstances?: ThinInstanceData | null;
|
|
3781
|
+
thinInstances?: ThinInstanceData | null;
|
|
3782
|
+
/** When `false`, the GPU picker skips this mesh. Defaults to `true`
|
|
3783
|
+
* (undefined behaves as pickable). Mirrors BJS `AbstractMesh.isPickable`. */
|
|
3784
|
+
pickable?: boolean;
|
|
2366
3785
|
|
|
2367
3786
|
/** Opaque GPU geometry handle (user never touches these). */
|
|
2368
3787
|
export declare interface MeshGPU {
|
|
@@ -2445,6 +3864,12 @@ export declare interface NavMeshParameters {
|
|
|
2445
3864
|
keepIntermediates?: boolean;
|
|
2446
3865
|
}
|
|
2447
3866
|
|
|
3867
|
+
/** A single mesh source for navmesh construction. */
|
|
3868
|
+
export declare interface NavMeshSource {
|
|
3869
|
+
positions: ArrayLike<number>;
|
|
3870
|
+
indices: ArrayLike<number>;
|
|
3871
|
+
}
|
|
3872
|
+
|
|
2448
3873
|
/** Parsed block in the graph. */
|
|
2449
3874
|
declare interface NodeBlock {
|
|
2450
3875
|
readonly id: number;
|
|
@@ -2535,8 +3960,7 @@ declare interface NodeBuildState {
|
|
|
2535
3960
|
hasSkeleton: boolean;
|
|
2536
3961
|
/** When false (default), InstancesBlock passes through the uniform world
|
|
2537
3962
|
* matrix. Set to true when thin-instance attributes are bound. */
|
|
2538
|
-
hasInstances: boolean;
|
|
2539
|
-
}
|
|
3963
|
+
hasInstances: boolean;
|
|
2540
3964
|
|
|
2541
3965
|
/** A single connection point on a block — input only.
|
|
2542
3966
|
* Output connection types are resolved by the emitter at graph-walk time. */
|
|
@@ -2652,6 +4076,9 @@ export declare interface NormalizedViewport {
|
|
|
2652
4076
|
height: number;
|
|
2653
4077
|
}
|
|
2654
4078
|
|
|
4079
|
+
/** Wrap an angle to [-π, π), matching Babylon.js `Scalar.NormalizeRadians`. */
|
|
4080
|
+
export declare function normalizeRadians(angle: number): number;
|
|
4081
|
+
|
|
2655
4082
|
/**
|
|
2656
4083
|
* Normalizes the vector `(x, y, z)` to unit length.
|
|
2657
4084
|
* @param x - X component.
|
|
@@ -2672,7 +4099,12 @@ export declare class ObservableQuat implements Quat {
|
|
|
2672
4099
|
private _z;
|
|
2673
4100
|
private _w;
|
|
2674
4101
|
private readonly _onDirty;
|
|
4102
|
+
/** Bumped on every value change. Lets derived caches (e.g. the Euler proxy) detect
|
|
4103
|
+
* external quaternion writes and re-sync only when needed. */
|
|
4104
|
+
private _version;
|
|
2675
4105
|
constructor(x: number, y: number, z: number, w: number, onDirty: () => void);
|
|
4106
|
+
/** Monotonic change counter — incremented whenever any component changes. */
|
|
4107
|
+
get version(): number;
|
|
2676
4108
|
get x(): number;
|
|
2677
4109
|
set x(v: number);
|
|
2678
4110
|
get y(): number;
|
|
@@ -2728,10 +4160,35 @@ export declare interface OffMeshConnection {
|
|
|
2728
4160
|
/** Register a callback to run before each rendered frame. */
|
|
2729
4161
|
export declare function onBeforeRender(scene: SceneContext, cb: (deltaMs: number) => void): void;
|
|
2730
4162
|
|
|
4163
|
+
/**
|
|
4164
|
+
* Register a callback fired each frame the CSM cascades are recomputed, right after the receiver
|
|
4165
|
+
* UBO is updated and uploaded — and before the shadow map and main pass are rendered.
|
|
4166
|
+
*
|
|
4167
|
+
* Custom `ShaderMaterial` receivers that mirror the cascade transforms into their own uniforms
|
|
4168
|
+
* (rather than binding the generator's receiver UBO directly, as the built-in standard/PBR/node
|
|
4169
|
+
* receivers do) MUST sync from inside this callback. Syncing from an `onBeforeRender` callback
|
|
4170
|
+
* reads the *previous* frame's transforms — a one-frame lag that makes those shadows visibly swim
|
|
4171
|
+
* while the camera moves (the cascade window can slide many texels per frame during a zoom).
|
|
4172
|
+
*
|
|
4173
|
+
* Multiple receivers may register on the same generator; every registered callback is invoked each
|
|
4174
|
+
* frame. The callback receives the 80-float receiver UBO (layout: four `mat4x4` cascade transforms,
|
|
4175
|
+
* `viewFrustumZ`, `frustumLengths`, `shadowsInfo`, `csmParams` — see the cascaded-shadow
|
|
4176
|
+
* architecture doc). The array is reused each frame; copy what you need.
|
|
4177
|
+
*
|
|
4178
|
+
* @param sg - A cascaded-shadow generator from {@link createCsmDirectionalShadowGenerator}.
|
|
4179
|
+
* @param cb - Receiver-sync callback.
|
|
4180
|
+
* @returns A disposer that unregisters this callback.
|
|
4181
|
+
*/
|
|
4182
|
+
export declare function onCsmReceiverUpdate(sg: ShadowGenerator, cb: (data: Float32Array) => void): () => void;
|
|
4183
|
+
|
|
2731
4184
|
/** Register a callback to run when `disposeScene` is called. Used to tie
|
|
2732
4185
|
* user-owned GPU resources (e.g. a `SpriteRenderer`) to the scene's lifetime. */
|
|
2733
4186
|
export declare function onSceneDispose(scene: SceneContext, cb: () => void): void;
|
|
2734
4187
|
|
|
4188
|
+
/** Convert a packed 0xRRGGBB sRGB color to a linear-RGBA tuple suitable for
|
|
4189
|
+
* text-renderer `defaultColor` / `PlacedGlyph.color`. */
|
|
4190
|
+
export declare function packedSrgbToLinearRgba(packed: number, alpha?: number): readonly [number, number, number, number];
|
|
4191
|
+
|
|
2735
4192
|
/** Parse a Babylon NME graph (by snippet ID or inline JSON), emit WGSL, compile
|
|
2736
4193
|
* the GPU pipeline, and return a ready-to-render `NodeMaterial`.
|
|
2737
4194
|
* @param engine - Engine context.
|
|
@@ -2776,6 +4233,10 @@ export declare function pauseAnimation(group: AnimationGroup): void;
|
|
|
2776
4233
|
* Optional sub-feature objects (clearcoat, sheen, anisotropy, subsurface) are
|
|
2777
4234
|
* only bundled when referenced. */
|
|
2778
4235
|
export declare interface PbrMaterialProps extends Material {
|
|
4236
|
+
/** Optional opt-in material plugins (custom WGSL + uniforms + samplers layered
|
|
4237
|
+
* on top of the built-in PBR pipeline). Attach via `material.plugins = [plugin]`,
|
|
4238
|
+
* then call `enableMaterialPlugins(scene)` before `registerScene`. */
|
|
4239
|
+
plugins?: MaterialPlugin[];
|
|
2779
4240
|
baseColorTexture?: Texture2D;
|
|
2780
4241
|
/** Linear RGB/A factor multiplied with the base-color texture (glTF baseColorFactor). Default [1,1,1,1]. */
|
|
2781
4242
|
baseColorFactor?: [number, number, number, number];
|
|
@@ -2925,8 +4386,7 @@ export declare interface PhysicsAggregateOptions {
|
|
|
2925
4386
|
|
|
2926
4387
|
/** Opaque handle to a Havok rigid body, bound to a scene node and a motion type. */
|
|
2927
4388
|
export declare interface PhysicsBody {
|
|
2928
4389
|
readonly node: SceneNode;
|
|
2929
|
-
readonly motionType: PhysicsMotionType;
|
|
2930
|
-
}
|
|
4390
|
+
readonly motionType: PhysicsMotionType;
|
|
2931
4391
|
|
|
2932
4392
|
/** How a body moves: `STATIC` (immovable), `ANIMATED` (driven by the node transform), or `DYNAMIC` (simulated). */
|
|
2933
4393
|
export declare const enum PhysicsMotionType {
|
|
@@ -2970,7 +4430,7 @@ export declare const enum PhysicsShapeType {
|
|
|
2970
4430
|
export declare interface PhysicsWorld {
|
|
2971
4431
|
|
|
2972
4432
|
/** Pick the mesh at CSS-space canvas coordinates, matching Babylon.js Scene.pick. Returns a PickingInfo. */
|
|
2973
|
-
export declare function pickAsync(picker: GpuPicker, x: number, y: number): Promise<PickingInfo>;
|
|
4433
|
+
export declare function pickAsync(picker: GpuPicker, x: number, y: number, options?: PickOptions): Promise<PickingInfo>;
|
|
2974
4434
|
|
|
2975
4435
|
/** Result of a GPU pick operation. */
|
|
2976
4436
|
export declare interface PickingInfo {
|
|
@@ -2993,6 +4453,16 @@ export declare interface PickingInfo {
|
|
|
2993
4453
|
ray: Ray | null;
|
|
2994
4454
|
}
|
|
2995
4455
|
|
|
4456
|
+
/** Options for {@link pickAsync}. */
|
|
4457
|
+
export declare interface PickOptions {
|
|
4458
|
+
/** Restrict the pick to a subset of the scene's meshes — return `true` for a mesh that may be picked,
|
|
4459
|
+
* `false` to ignore it entirely (it neither occludes nor is returned). Lets a caller provide its
|
|
4460
|
+
* "list of pickables" so decorative meshes (grass, foliage, particles, …) can't swallow a pick of a
|
|
4461
|
+
* structure behind/around them. When omitted, every mesh is pickable (previous behaviour). Applied
|
|
4462
|
+
* identically to the id-assignment and id-resolve passes so ids stay consistent. */
|
|
4463
|
+
filter?: (mesh: Mesh) => boolean;
|
|
4464
|
+
}
|
|
4465
|
+
|
|
2996
4466
|
/** Sampler and format overrides for `createTexture2DFromPixels()`. */
|
|
2997
4467
|
export declare interface PixelsTexture2DOptions {
|
|
2998
4468
|
/** Address mode U. Default 'clamp-to-edge'. */
|
|
@@ -3016,6 +4486,36 @@ export declare interface PixelViewport {
|
|
|
3016
4486
|
height: number;
|
|
3017
4487
|
}
|
|
3018
4488
|
|
|
4489
|
+
export declare type PlacedGlyph = {
|
|
4490
|
+
readonly glyphId: number;
|
|
4491
|
+
/** Pixel position of glyph baseline origin. */
|
|
4492
|
+
readonly x: number;
|
|
4493
|
+
readonly y: number;
|
|
4494
|
+
/** Optional per-glyph color as linear RGBA in [0,1]. When present this overrides the
|
|
4495
|
+
* run's `defaultColor` for this glyph. When omitted, the glyph falls back to the run's
|
|
4496
|
+
* `defaultColor`, and if that is also omitted, to opaque white. The rendered alpha is
|
|
4497
|
+
* additionally scaled by the whole-block opacity (e.g. `TextRenderable.opacity`). */
|
|
4498
|
+
readonly color?: readonly [number, number, number, number];
|
|
4499
|
+
};
|
|
4500
|
+
|
|
4501
|
+
export declare interface PlaneDragGizmo {
|
|
4502
|
+
readonly root: SceneNode;
|
|
4503
|
+
readonly drag: PointerDrag;
|
|
4504
|
+
readonly onPositionChanged: GizmoObservable<Vec3>;
|
|
4505
|
+
attachedNode: SceneNode | null;
|
|
4506
|
+
/** When true, the plane normal rotates with the attached node each frame
|
|
4507
|
+
* (local-coord mode). When false, the normal stays world-aligned. */
|
|
4508
|
+
useLocalCoordinates: boolean;
|
|
4509
|
+
readonly materials: GizmoMaterialSet;
|
|
4510
|
+
|
|
4511
|
+
export declare interface PlaneDragGizmoOptions {
|
|
4512
|
+
/** World-space drag plane normal (unit vector). */
|
|
4513
|
+
dragPlaneNormal: Vec3;
|
|
4514
|
+
color?: [number, number, number];
|
|
4515
|
+
hoverColor?: [number, number, number];
|
|
4516
|
+
disableColor?: [number, number, number];
|
|
4517
|
+
}
|
|
4518
|
+
|
|
3019
4519
|
/** Options for `createPlaneData`. Subset of Babylon's CreatePlane. */
|
|
3020
4520
|
export declare interface PlaneOptions {
|
|
3021
4521
|
size?: number;
|
|
@@ -3023,6 +4523,33 @@ export declare interface PlaneOptions {
|
|
|
3023
4523
|
height?: number;
|
|
3024
4524
|
}
|
|
3025
4525
|
|
|
4526
|
+
export declare interface PlaneRotationGizmo {
|
|
4527
|
+
readonly root: SceneNode;
|
|
4528
|
+
readonly drag: PointerDrag;
|
|
4529
|
+
readonly onRotationChanged: GizmoObservable<[number, number, number, number]>;
|
|
4530
|
+
attachedNode: SceneNode | null;
|
|
4531
|
+
/** Local-coord mode: plane normal rotates with the attached node. */
|
|
4532
|
+
useLocalCoordinates: boolean;
|
|
4533
|
+
readonly materials: GizmoMaterialSet;
|
|
4534
|
+
/** ShaderMaterial driving the rotation-sector camembert visual. Exposed so
|
|
4535
|
+
* callers can change the colour at runtime. */
|
|
4536
|
+
readonly rotationDisplayMaterial: ShaderMaterial;
|
|
4537
|
+
|
|
4538
|
+
export declare interface PlaneRotationGizmoOptions {
|
|
4539
|
+
/** World-space rotation plane normal (unit vector). */
|
|
4540
|
+
planeNormal: Vec3;
|
|
4541
|
+
color?: [number, number, number];
|
|
4542
|
+
hoverColor?: [number, number, number];
|
|
4543
|
+
disableColor?: [number, number, number];
|
|
4544
|
+
/** Torus tessellation. Default 32 (matches BJS). */
|
|
4545
|
+
tessellation?: number;
|
|
4546
|
+
/** Tube thickness multiplier. Default 1. */
|
|
4547
|
+
thickness?: number;
|
|
4548
|
+
/** Colour of the rotation "camembert" sector visual shown while dragging.
|
|
4549
|
+
* Defaults to the hover colour. */
|
|
4550
|
+
rotationColor?: [number, number, number];
|
|
4551
|
+
}
|
|
4552
|
+
|
|
3026
4553
|
/** Start playing an animation group. */
|
|
3027
4554
|
export declare function playAnimation(group: AnimationGroup): void;
|
|
3028
4555
|
|
|
@@ -3084,6 +4611,96 @@ export declare interface PlaySpriteAnimationOptions {
|
|
|
3084
4611
|
/** Replay an animation; omit options to keep callbacks/removal, pass options to overwrite them, or `{}` to clear them. */
|
|
3085
4612
|
export declare function playSpriteFrameAnimation(animation: SpriteFrameAnimation, from?: number, to?: number, loop?: boolean, delayMs?: number, options?: PlaySpriteAnimationOptions): void;
|
|
3086
4613
|
|
|
4614
|
+
/** A texture + sampler pair contributed by a plugin. `texture`/`sampler` are the
|
|
4615
|
+
* WGSL variable names used by the plugin's custom code; the engine wires up the
|
|
4616
|
+
* GPU bindings in declaration order from {@link MaterialPlugin.bindTextures}. */
|
|
4617
|
+
export declare interface PluginSamplerDecl {
|
|
4618
|
+
readonly texture: string;
|
|
4619
|
+
readonly sampler: string;
|
|
4620
|
+
/** Defaults to "texture_2d<f32>". */
|
|
4621
|
+
readonly textureType?: "texture_2d<f32>";
|
|
4622
|
+
/** Defaults to "sampler". */
|
|
4623
|
+
readonly samplerType?: "sampler" | "sampler_non_filtering";
|
|
4624
|
+
}
|
|
4625
|
+
|
|
4626
|
+
/** A texture binding emitted by {@link MaterialPlugin.bindTextures}. Public types
|
|
4627
|
+
* only — no raw GPU handles (GUIDANCE §4d). The engine reads `texture.view` /
|
|
4628
|
+
* `texture.sampler` internally. */
|
|
4629
|
+
export declare interface PluginTextureBinding {
|
|
4630
|
+
readonly texture: Texture2D;
|
|
4631
|
+
}
|
|
4632
|
+
|
|
4633
|
+
/** A custom uniform contributed by a plugin. The WGSL `type` is used verbatim
|
|
4634
|
+
* (e.g. "vec4<f32>", "f32", "mat4x4<f32>") inside the host material's UBO. */
|
|
4635
|
+
export declare interface PluginUboField {
|
|
4636
|
+
readonly name: string;
|
|
4637
|
+
readonly type: string;
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4640
|
+
export declare interface PointerDrag {
|
|
4641
|
+
readonly options: Readonly<PointerDragOptions>;
|
|
4642
|
+
enabled: boolean;
|
|
3087
4643
|
/** Fired once when a pointer-down lands on one of `_colliders`. */
|
|
4644
|
+
onDragStart: GizmoObservable<PointerDragStartEvent>;
|
|
4645
|
+
/** Fired on every pointer-move while a drag is active. */
|
|
4646
|
+
onDrag: GizmoObservable<PointerDragMoveEvent>;
|
|
4647
|
+
/** Fired once when the pointer is released. */
|
|
4648
|
+
onDragEnd: GizmoObservable<PointerDragEndEvent>;
|
|
4649
|
+
/** Fired when the pointer hovers over one of `_colliders` (no button pressed).
|
|
4650
|
+
* Used by gizmos to swap to a hover-coloured material before any drag.
|
|
4651
|
+
* Always fires AFTER a previous `onHoverEnd` for a different drag, so the
|
|
4652
|
+
* receiver doesn't need to track which collider is currently hovered. */
|
|
4653
|
+
onHoverStart: GizmoObservable<void>;
|
|
4654
|
+
/** Fired when the pointer leaves a previously-hovered collider. */
|
|
4655
|
+
onHoverEnd: GizmoObservable<void>;
|
|
4656
|
+
/** True while a drag is in progress. */
|
|
4657
|
+
dragging: boolean;
|
|
4658
|
+
/** True while the pointer is hovering one of `_colliders` (no drag). */
|
|
4659
|
+
hovering: boolean;
|
|
4660
|
+
}
|
|
4661
|
+
|
|
4662
|
+
export declare interface PointerDragEndEvent {
|
|
4663
|
+
pointerEvent: PointerEvent | null;
|
|
4664
|
+
}
|
|
4665
|
+
|
|
4666
|
+
export declare interface PointerDragMoveEvent {
|
|
4667
|
+
/** World-space delta from the previous drag-plane point. For axis-drag this
|
|
4668
|
+
* is already projected onto the drag axis (parallel to axis). */
|
|
4669
|
+
delta: Vec3;
|
|
4670
|
+
/** Current world-space point on the drag plane (post-projection). */
|
|
4671
|
+
dragPlanePoint: Vec3;
|
|
4672
|
+
/** Signed scalar distance projected onto the drag axis since drag start
|
|
4673
|
+
* (axis-drag mode); for plane mode this is `delta.length()`. */
|
|
4674
|
+
dragDistance: number;
|
|
4675
|
+
}
|
|
4676
|
+
|
|
4677
|
+
export declare interface PointerDragOptions {
|
|
4678
|
+
/** Drag along a single world-space axis (unit vector). Mutually exclusive
|
|
4679
|
+
* with `dragPlaneNormal`. */
|
|
4680
|
+
dragAxis?: Vec3;
|
|
4681
|
+
/** Drag inside a plane defined by this world-space normal. Mutually
|
|
4682
|
+
* exclusive with `dragAxis`. */
|
|
4683
|
+
dragPlaneNormal?: Vec3;
|
|
4684
|
+
/** When false, the dispatcher fires events but doesn't move the picked
|
|
4685
|
+
* mesh. Gizmos always set this to false and apply transforms to their
|
|
4686
|
+
* attached node themselves. */
|
|
4687
|
+
moveAttached?: boolean;
|
|
4688
|
+
/** Optional override for the drag-plane anchor point (plane mode only).
|
|
4689
|
+
* When it returns a point, the camera-facing drag plane passes through that
|
|
4690
|
+
* point instead of the picked surface point, so the screen→world scale is
|
|
4691
|
+
* taken at that depth. The BoundingBoxGizmo body drag anchors at the
|
|
4692
|
+
* bounding-box CENTRE (matching BJS, whose body `_dragMesh` sits at the box
|
|
4693
|
+
* centroid) so the translation scale doesn't depend on where the press
|
|
4694
|
+
* landed on the (inset, camera-facing) body surface. */
|
|
4695
|
+
getPlanePoint?: () => Vec3 | null;
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
export declare interface PointerDragStartEvent {
|
|
4699
|
+
/** World-space point where the ray intersected the drag plane on drag start. */
|
|
4700
|
+
dragPlanePoint: Vec3;
|
|
4701
|
+
/** Browser pointer event that triggered drag start. */
|
|
4702
|
+
pointerEvent: PointerEvent;
|
|
4703
|
+
}
|
|
4704
|
+
|
|
3088
4705
|
export declare interface PointLight extends LightBase {
|
|
3089
4706
|
readonly lightType: "point";
|
|
3090
4707
|
position: ObservableVec3;
|
|
@@ -3109,6 +4726,25 @@ export declare interface PolyhedronOptions {
|
|
|
3109
4726
|
flat?: boolean;
|
|
3110
4727
|
}
|
|
3111
4728
|
|
|
4729
|
+
export declare interface PositionGizmo {
|
|
4730
|
+
readonly xGizmo: AxisDragGizmo;
|
|
4731
|
+
readonly yGizmo: AxisDragGizmo;
|
|
4732
|
+
readonly zGizmo: AxisDragGizmo;
|
|
4733
|
+
readonly xPlaneGizmo: PlaneDragGizmo | null;
|
|
4734
|
+
readonly yPlaneGizmo: PlaneDragGizmo | null;
|
|
4735
|
+
readonly zPlaneGizmo: PlaneDragGizmo | null;
|
|
4736
|
+
attachedNode: SceneNode | null;
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4739
|
+
export declare interface PositionGizmoOptions {
|
|
4740
|
+
/** When true, planar drag gizmos (XY/XZ/YZ) are created in addition to the
|
|
4741
|
+
* 3 axis arrows. Default false — matches BJS where `planarGizmoEnabled`
|
|
4742
|
+
* defaults to false and must be opted into. */
|
|
4743
|
+
planarEnabled?: boolean;
|
|
4744
|
+
/** Tube thickness multiplier for the axis arrows. */
|
|
4745
|
+
thickness?: number;
|
|
4746
|
+
}
|
|
4747
|
+
|
|
3112
4748
|
/** Output blend mode: `0` opaque, `1` additive, `2` premultiplied, `7` non-premultiplied alpha. */
|
|
3113
4749
|
export declare type PostProcessAlphaMode = 0 | 1 | 2 | 7;
|
|
3114
4750
|
|
|
@@ -3190,6 +4826,15 @@ export declare interface PropertyAnimationTrackOptions {
|
|
|
3190
4826
|
readonly quaternion?: boolean;
|
|
3191
4827
|
}
|
|
3192
4828
|
|
|
4829
|
+
export declare type QuadCurve = {
|
|
4830
|
+
readonly p0x: number;
|
|
4831
|
+
readonly p0y: number;
|
|
4832
|
+
readonly p1x: number;
|
|
4833
|
+
readonly p1y: number;
|
|
4834
|
+
readonly p2x: number;
|
|
4835
|
+
readonly p2y: number;
|
|
4836
|
+
};
|
|
4837
|
+
|
|
3193
4838
|
/** Quaternion rotation */
|
|
3194
4839
|
declare interface Quat {
|
|
3195
4840
|
x: number;
|
|
@@ -3249,27 +4894,59 @@ export declare interface RefractionProps {
|
|
|
3249
4894
|
dispersion?: number;
|
|
3250
4895
|
}
|
|
3251
4896
|
|
|
3252
|
-
/** Register the effect renderer with its
|
|
4897
|
+
/** Register the effect renderer with its surface. Idempotent — a second call is a no-op. */
|
|
3253
4898
|
export declare function registerEffectRenderer(er: EffectRenderer): void;
|
|
3254
4899
|
|
|
3255
|
-
/** Build and register the standalone frame-graph context with its
|
|
4900
|
+
/** Build and register the standalone frame-graph context with its surface. */
|
|
3256
4901
|
export declare function registerFrameGraphContext(ctx: FrameGraphContext): void;
|
|
3257
4902
|
|
|
4903
|
+
/** Register the drag's colliders + handlers with the per-canvas dispatcher for
|
|
4904
|
+
* this utility layer. Returns a function that unregisters the drag. When the
|
|
4905
|
+
* last drag for a canvas is unregistered, the dispatcher tears itself down
|
|
4906
|
+
* (canvas listeners are detached, the GPU picker is disposed, the cache entry
|
|
4907
|
+
* is removed) so disposing all gizmos doesn't leak listeners or GPU resources. */
|
|
4908
|
+
export declare function registerPointerDrag(layer: UtilityLayer, canvas: HTMLCanvasElement, drag: PointerDrag): () => void;
|
|
4909
|
+
|
|
3258
4910
|
/**
|
|
3259
4911
|
* Register a scene with the engine. Builds deferred work, sorts renderables by order,
|
|
3260
|
-
* and adds the scene to
|
|
4912
|
+
* and adds the scene to its bound surface's render list in overlay order. The scene is
|
|
4913
|
+
* always attached to `scene.surface` (which equals the engine itself in the
|
|
4914
|
+
* single-canvas case).
|
|
3261
4915
|
*/
|
|
3262
|
-
export declare function registerScene(
|
|
4916
|
+
export declare function registerScene(scene: SceneContext): Promise<void>;
|
|
3263
4917
|
|
|
3264
4918
|
/**
|
|
3265
4919
|
* Register a scene with the engine and install the scene-owned shadow frame-graph task.
|
|
3266
|
-
* Use only for scenes that generate shadow maps.
|
|
4920
|
+
* Use only for scenes that generate shadow maps. Like {@link registerScene}, the scene
|
|
4921
|
+
* is attached to `scene.surface` (and its owning engine is `scene.surface.engine`).
|
|
3267
4922
|
*/
|
|
3268
|
-
export declare function registerSceneWithShadowSupport(
|
|
4923
|
+
export declare function registerSceneWithShadowSupport(scene: SceneContext): Promise<void>;
|
|
3269
4924
|
|
|
3270
4925
|
/** Push the renderer onto its engine's `_renderingContexts`. Idempotent — a second call is a no-op. */
|
|
3271
4926
|
export declare function registerSpriteRenderer(sr: SpriteRenderer): void;
|
|
3272
4927
|
|
|
4928
|
+
export declare function registerTextRenderer(tr: TextRenderer): void;
|
|
4929
|
+
|
|
4930
|
+
/** Register the utility layer with the engine. Must be called after the main
|
|
4931
|
+
* scene has been registered so the swapchain overlay path is enabled. */
|
|
4932
|
+
export declare function registerUtilityLayer(utility: UtilityLayer): Promise<void>;
|
|
4933
|
+
|
|
4934
|
+
/**
|
|
4935
|
+
* Release a collision shape's native handle, freeing its WASM memory. Only call once no body still
|
|
4936
|
+
* references the shape (e.g. after {@link removePhysicsBody}). Useful when rebuilding a changing set of
|
|
4937
|
+
* static colliders so their shapes don't accumulate.
|
|
4938
|
+
* @param world - The physics world.
|
|
4939
|
+
* @param shape - The shape to release.
|
|
4940
|
+
*/
|
|
4941
|
+
export declare function releasePhysicsShape(world: PhysicsWorld, shape: PhysicsShape): void;
|
|
4942
|
+
|
|
4943
|
+
/**
|
|
4944
|
+
* Decrement ref count on a Texture2D.
|
|
4945
|
+
* Calls `tex.texture.destroy()` when count reaches 0.
|
|
4946
|
+
* Returns true if the texture was destroyed.
|
|
4947
|
+
*/
|
|
4948
|
+
export declare function releaseTexture(tex: Texture2D): boolean;
|
|
4949
|
+
|
|
3273
4950
|
/** Detaches `group` from `manager`, removing its animation task so it is no longer ticked. */
|
|
3274
4951
|
export declare function removeAnimationGroup(manager: AnimationManager, group: AnimationGroup): void;
|
|
3275
4952
|
|
|
@@ -3300,6 +4977,16 @@ export declare function removeMeshFromTask(task: RenderTask, mesh: object): void
|
|
|
3300
4977
|
/** Remove an obstacle previously added by `addBoxObstacle` / `addCylinderObstacle`. */
|
|
3301
4978
|
export declare function removeObstacle(plugin: NavigationPlugin, obstacle: ObstacleHandle): void;
|
|
3302
4979
|
|
|
4980
|
+
/**
|
|
4981
|
+
* Remove a single body from the world and release its native handle (the per-frame step skips it from
|
|
4982
|
+
* now on). After this the body must not be reused. A body that isn't in the world is ignored, so this is
|
|
4983
|
+
* safe to call once per body. Does NOT release the body's collision shape — release that separately with
|
|
4984
|
+
* {@link releasePhysicsShape} if it isn't shared.
|
|
4985
|
+
* @param world - The physics world.
|
|
4986
|
+
* @param body - The body to remove.
|
|
4987
|
+
*/
|
|
4988
|
+
export declare function removePhysicsBody(world: PhysicsWorld, body: PhysicsBody): void;
|
|
4989
|
+
|
|
3303
4990
|
/**
|
|
3304
4991
|
* Removes the sprite referenced by `handle`. Does nothing if it is already gone.
|
|
3305
4992
|
* @param handle - Handle of the sprite to remove.
|
|
@@ -3326,6 +5013,8 @@ export declare function removeSpriteAnimationManager(manager: AnimationManager,
|
|
|
3326
5013
|
/** Remove a layer from the renderer and destroy any GPU resources cached for it. */
|
|
3327
5014
|
export declare function removeSpriteRendererLayer(sr: SpriteRenderer, layer: Sprite2DLayer): boolean;
|
|
3328
5015
|
|
|
5016
|
+
export declare function removeTextRendererLayer(tr: TextRenderer, layer: TextLayer): boolean;
|
|
5017
|
+
|
|
3329
5018
|
/** Remove instance by index. Swap-removes: last instance fills the gap. */
|
|
3330
5019
|
export declare function removeThinInstance(mesh: Mesh, index: number): void;
|
|
3331
5020
|
|
|
@@ -3355,6 +5044,8 @@ export declare interface Renderable {
|
|
|
3355
5044
|
*/
|
|
3356
5045
|
export declare type RenderCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
3357
5046
|
|
|
5047
|
+
export declare function renderFrame(engine: EngineContext, delta: number): void;
|
|
5048
|
+
|
|
3358
5049
|
/**
|
|
3359
5050
|
* Minimal surface an engine sees for anything it renders. Scenes (and any other
|
|
3360
5051
|
* future renderable thing) register themselves as a `RenderingContext` and
|
|
@@ -3369,7 +5060,8 @@ export declare interface RenderPass extends Pass {
|
|
|
3369
5060
|
/** Per-frame mutable sta
|
|
3370
5061
|
* before iterating its passes. */
|
|
3371
5062
|
clearColor: GPUColorDict;
|
|
3372
5063
|
/** True → loadOp `"clear"`, false → `"load"` (overlay mode). */
|
|
3373
|
-
clear: boolean;
|
|
5064
|
+
clear: boolean;
|
|
5065
|
+
}
|
|
3374
5066
|
|
|
3375
5067
|
/** Body of a render pass — receives the live render-pass encoder and returns
|
|
3376
5068
|
* the number of draws issued. */
|
|
@@ -3381,22 +5073,22 @@ export declare interface RenderTarget {
|
|
|
3381
5073
|
/** Describes a render target — what attachments to create, not the GPU objects
|
|
3382
5074
|
* themselves. GPU textures are allocated later by `buildRenderTarget`. */
|
|
3383
5075
|
export declare interface RenderTargetDescriptor {
|
|
3384
|
-
label?: string;
|
|
3385
|
-
colorFormat?: GPUTextureFormat;
|
|
3386
|
-
depthStencilFormat?: GPUTextureFormat;
|
|
3387
5076
|
sampleCount: number;
|
|
3388
|
-
/**
|
|
3389
|
-
|
|
5077
|
+
/** Debug label applied to the allocated GPU color/depth textures. */
|
|
5078
|
+
lbl?: string;
|
|
5079
|
+
/** Color attachment texture format (e.g. `"bgra8unorm"`, `"rgba16float"`). Omit for a depth-only target. */
|
|
5080
|
+
format?: GPUTextureFormat;
|
|
5081
|
+
/** Depth/stencil attachment format (e.g. `"depth24plus-stencil8"`). Omit for a color-only target (e.g. the swapchain). */
|
|
5082
|
+
dFormat?: GPUTextureFormat;
|
|
3390
5083
|
/** MSAA sample count: `1` = single-sample (no multisampling), `4` = 4x MSAA. */
|
|
5084
|
+
samples: number;
|
|
5085
|
+
/** A `SurfaceContext` to size to that surface's swapchain (re-resolved each
|
|
5086
|
+
* `buildRenderTarget`), or explicit `{ width, height }` in device pixels. Pass a
|
|
5087
|
+
* surface for canvas-sized RTs; the RT then tracks that specific surface in
|
|
5088
|
+
* multi-surface setups. In the common single-canvas case, pass the engine directly
|
|
5089
|
+
* (since `EngineContext extends SurfaceContext`). */
|
|
5090
|
+
size: SurfaceContext | {
|
|
3391
5091
|
width: number;
|
|
3392
5092
|
height: number;
|
|
3393
5093
|
};
|
|
3394
|
-
/** If true, the color attachment resolves to the swapchain texture. The RT still
|
|
3395
|
-
* owns the MSAA texture (when sampleCount \> 1) and the depth texture; only the
|
|
3396
|
-
* final color is the swapchain view, acquired per frame and patched in at execute
|
|
3397
|
-
* time. With sampleCount === 1 the RT owns no color texture (the swap view is the
|
|
3398
|
-
* color attachment directly). */
|
|
3399
|
-
resolveToSwapchain?: boolean;
|
|
3400
|
-
/** Override projection Y-flip. Defaults to true for offscreen targets and false for swapchain targets. */
|
|
3401
|
-
flipY?: boolean;
|
|
3402
5094
|
}
|
|
3403
5095
|
|
|
3404
5096
|
/** Signature of a render target's attachment set — enough to key a GPURenderPipeline. */
|
|
@@ -3421,10 +5113,32 @@ export declare interface RenderTaskConfig {
|
|
|
3421
5113
|
* management is virtualized, callers must provide the concrete target; once
|
|
3422
5114
|
* virtualized, the task should create/manage its own render target. */
|
|
3423
5115
|
rt: RenderTarget;
|
|
5116
|
+
/** Optional single-sample resolve target. When `rt` is multisampled
|
|
5117
|
+
* (`sampleCount > 1`), the color attachment resolves into this target's
|
|
5118
|
+
* color texture at end-of-pass — letting an MSAA render feed a post-process
|
|
5119
|
+
* that requires a single-sample source, without an extra resolve pass.
|
|
5120
|
+
* Caller contract (not validated): must be single-sample with a color
|
|
5121
|
+
* format and size matching `rt`; WebGPU errors at pass-encode time if not.
|
|
5122
|
+
* Ignored when `rt` is single-sample. */
|
|
5123
|
+
rst?: RenderTarget;
|
|
5124
|
+
/** Optional separate depth/stencil attachment. The pass binds this target's
|
|
5125
|
+
* depth view instead of `rt`'s own, and uses its `depthStencilFormat` for
|
|
5126
|
+
* pipeline signature matching. The colour `rt` must omit `depthStencilFormat`
|
|
5127
|
+
* (so it allocates no internal depth) and match this target in size + sample
|
|
5128
|
+
* count. Two ownership modes, distinguished by `_eager`:
|
|
5129
|
+
* - `_eager` depth (e.g. a `GeometryRendererTask` output): the task neither
|
|
5130
|
+
* builds nor clears nor disposes it — it loads it (`loadOp: "load"`) and the
|
|
5131
|
+
* caller owns clearing. This is how scenes reuse a pre-rendered depth buffer.
|
|
5132
|
+
* - non-`_eager` depth: the task owns it — builds/rebuilds it in `record()`,
|
|
5133
|
+
* clears it (`loadOp: "clear"`), and disposes it. Used by the default
|
|
5134
|
+
* single-sample scene task, whose colour `rt` is the depth-less
|
|
5135
|
+
* engine `scRT`. */
|
|
5136
|
+
depth?: RenderTarget;
|
|
3424
5137
|
/** Background clear color. May be mutated frame-to-frame. */
|
|
3425
5138
|
clrColor?: GPUColorDict;
|
|
3426
|
-
/** When true,
|
|
3427
|
-
*
|
|
5139
|
+
/** When true, color `loadOp` is "clear"; when false, "load" (overlays previous
|
|
5140
|
+
* color content). Depth is always cleared when rt-owned and always loaded when
|
|
5141
|
+
* supplied via `depth`. */
|
|
3428
5142
|
clr?: boolean;
|
|
3429
5143
|
/** Per-pass camera override. Null/undefined uses `scene.camera`. */
|
|
3430
5144
|
cam?: Camera | null;
|
|
@@ -3438,21 +5152,60 @@ export declare interface RenderTaskConfig {
|
|
|
3438
5152
|
};
|
|
3439
5153
|
}
|
|
3440
5154
|
|
|
5155
|
+
/** Sampler / format overrides for `createRenderTexture2D()`. */
|
|
5156
|
+
export declare interface RenderTexture2DOptions {
|
|
5157
|
+
/** Address mode U. Default 'clamp-to-edge'. */
|
|
5158
|
+
addressModeU?: GPUAddressMode;
|
|
5159
|
+
/** Address mode V. Default 'clamp-to-edge'. */
|
|
5160
|
+
addressModeV?: GPUAddressMode;
|
|
5161
|
+
/** Min filter. Default 'linear'. */
|
|
5162
|
+
minFilter?: GPUFilterMode;
|
|
5163
|
+
/** Mag filter. Default 'linear'. */
|
|
5164
|
+
magFilter?: GPUFilterMode;
|
|
5165
|
+
/**
|
|
5166
|
+
* Color format. Default `engine.format` so it can be sampled and presented.
|
|
5167
|
+
*
|
|
5168
|
+
* ⚠️ Only the default `engine.format` is compatible with a `SpriteRenderer`
|
|
5169
|
+
* target (`setSpriteRendererTarget`): sprite pipelines are created with
|
|
5170
|
+
* `engine.format`, and a render pass whose color attachment format differs from
|
|
5171
|
+
* the bound pipeline fails WebGPU validation at pass begin. Override this **only**
|
|
5172
|
+
* for offscreen targets you render into by some OTHER means (a custom pass /
|
|
5173
|
+
* `EffectRenderer`), never as a sprite-render target.
|
|
5174
|
+
*/
|
|
5175
|
+
format?: GPUTextureFormat;
|
|
5176
|
+
}
|
|
5177
|
+
|
|
3441
5178
|
/**
|
|
3442
5179
|
* Reset all variant-participating meshes to their original (default) materials.
|
|
3443
5180
|
*/
|
|
3444
5181
|
export declare function resetVariant(container: AssetContainer): void;
|
|
3445
5182
|
|
|
3446
|
-
/** Resize
|
|
3447
|
-
*
|
|
3448
|
-
*
|
|
3449
|
-
*
|
|
3450
|
-
*
|
|
3451
|
-
*
|
|
3452
|
-
* box, so its size is pushed in externally via {@link setEngineSize} (e.g. from the host
|
|
3453
|
-
* thread that owns the visible canvas) and this call is a no-op for it. */
|
|
5183
|
+
/** Resize every surface attached to this engine (including the engine's own primary
|
|
5184
|
+
* surface). For DOM-canvas surfaces, snaps the swapchain backing store to the current
|
|
5185
|
+
* `clientWidth × clientHeight × devicePixelRatio` (capped by each surface's
|
|
5186
|
+
* `maxDevicePixelRatio`). For `OffscreenCanvas` surfaces this is a no-op per surface —
|
|
5187
|
+
* call `setSurfaceSize` on the specific surface instead, since an `OffscreenCanvas`
|
|
5188
|
+
* has no layout. */
|
|
3454
5189
|
export declare function resizeEngine(engine: EngineContext): void;
|
|
3455
5190
|
|
|
5191
|
+
/** Replace a mesh's GPU geometry IN PLACE with new (possibly larger or smaller) buffers, reusing the
|
|
5192
|
+
* same Mesh object so existing references to it (scene entries, shadow-caster lists, materials) stay
|
|
5193
|
+
* valid. Unlike `updateMeshPositions`, this REALLOCATES the GPU buffers, so it's the way to GROW a
|
|
5194
|
+
* dynamically-generated mesh past its original vertex/index capacity (e.g. an ever-larger bridge whose
|
|
5195
|
+
* box budget overflows). The old GPU buffers are destroyed to free device memory. Recomputes bounds. */
|
|
5196
|
+
export declare function resizeMeshGeometry(engine: EngineContext, mesh: Mesh, positions: Float32Array, normals: Float32Array, indices: Uint32Array, uvs?: Float32Array, uvs2?: Float32Array, tangents?: Float32Array, colors?: Float32Array): void;
|
|
5197
|
+
|
|
5198
|
+
/** Resize this surface's swapchain backing store to match the canvas client size. When
|
|
5199
|
+
* the size changes, asks every rendering context registered on this surface to rebuild
|
|
5200
|
+
* its canvas-sized GPU resources via the optional `_resize` hook. If the canvas has
|
|
5201
|
+
* not been laid out yet, preserves its explicit backing-store size.
|
|
5202
|
+
*
|
|
5203
|
+
* Only DOM canvases are auto-sized from layout here. An `OffscreenCanvas` has no
|
|
5204
|
+
* layout box, so its size must be pushed in externally via {@link setSurfaceSize}
|
|
5205
|
+
* (e.g. from the host thread that owns the visible canvas) and this call is a no-op
|
|
5206
|
+
* for it. */
|
|
5207
|
+
export declare function resizeSurface(surface: SurfaceContext): void;
|
|
5208
|
+
|
|
3456
5209
|
/** Resolve a Babylon-style normalized viewport to integer render-target pixels.
|
|
3457
5210
|
* Babylon viewport y is normalized from the bottom; WebGPU viewport/scissor y is from the top. */
|
|
3458
5211
|
export declare function resolveCameraViewport(camera: Camera | null | undefined, targetWidth: number, targetHeight: number): PixelViewport;
|
|
@@ -3465,6 +5218,31 @@ export declare interface RibbonOptions {
|
|
|
3465
5218
|
offset?: number;
|
|
3466
5219
|
}
|
|
3467
5220
|
|
|
5221
|
+
export declare interface RotationGizmo {
|
|
5222
|
+
readonly xGizmo: PlaneRotationGizmo;
|
|
5223
|
+
readonly yGizmo: PlaneRotationGizmo;
|
|
5224
|
+
readonly zGizmo: PlaneRotationGizmo;
|
|
5225
|
+
attachedNode: SceneNode | null;
|
|
5226
|
+
}
|
|
5227
|
+
|
|
5228
|
+
export declare interface RotationGizmoOptions {
|
|
5229
|
+
tessellation?: number;
|
|
5230
|
+
thickness?: number;
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5233
|
+
export declare interface ScaleGizmo {
|
|
5234
|
+
readonly xGizmo: AxisScaleGizmo;
|
|
5235
|
+
readonly yGizmo: AxisScaleGizmo;
|
|
5236
|
+
readonly zGizmo: AxisScaleGizmo;
|
|
5237
|
+
/** Central uniform-scale gizmo (single arrow with uniformScaling = true). */
|
|
5238
|
+
readonly uniformScaleGizmo: AxisScaleGizmo;
|
|
5239
|
+
attachedNode: SceneNode | null;
|
|
5240
|
+
}
|
|
5241
|
+
|
|
5242
|
+
export declare interface ScaleGizmoOptions {
|
|
5243
|
+
thickness?: number;
|
|
5244
|
+
}
|
|
5245
|
+
|
|
3468
5246
|
/** Scattering sub-feature. Presence enables screen-space subsurface scattering.
|
|
3469
5247
|
* NOTE: PrePass/SSS pipeline is not yet implemented — this type is reserved. */
|
|
3470
5248
|
declare interface ScatteringProps {
|
|
@@ -3474,9 +5252,23 @@ declare interface ScatteringProps {
|
|
|
3474
5252
|
metersPerUnit?: number;
|
|
3475
5253
|
}
|
|
3476
5254
|
|
|
5255
|
+
/** Handle to a render task's scene-color grab, returned by `enableRenderTaskTransmission`. */
|
|
5256
|
+
export declare interface SceneColorGrab {
|
|
5257
|
+
/** The live opaque-scene-color texture sampled by transmissive surfaces, or null before the
|
|
5258
|
+
* frame graph has built the task at least once. Its identity changes when the task rebuilds
|
|
5259
|
+
* (e.g. on resize), so consumers that bind it to a custom material should re-bind when it
|
|
5260
|
+
* changes. */
|
|
5261
|
+
readonly texture: Texture2D | null;
|
|
5262
|
+
}
|
|
5263
|
+
|
|
3477
5264
|
/** Top-level scene context — pure state, no attached methods. */
|
|
3478
5265
|
export declare interface SceneContext extends RenderingContext_2 {
|
|
3479
|
-
|
|
5266
|
+
/** Surface this scene renders into. Set at scene-creation time and immutable
|
|
5267
|
+
* afterwards — the default render task is sized and MSAA-matched to this surface,
|
|
5268
|
+
* and `registerScene` attaches the scene to it. For the engine's primary surface
|
|
5269
|
+
* (the common single-canvas case) this is the engine itself. The owning engine is
|
|
5270
|
+
* reachable via `scene.surface.engine`. */
|
|
5271
|
+
readonly surface: SurfaceContext;
|
|
3480
5272
|
clearColor: GPUColorDict;
|
|
3481
5273
|
camera: Camera | null;
|
|
3482
5274
|
lights: LightBase[];
|
|
@@ -3527,6 +5319,29 @@ export declare interface SceneUniformUpdater {
|
|
|
3527
5319
|
update(engine: EngineContext): void;
|
|
3528
5320
|
}
|
|
3529
5321
|
|
|
5322
|
+
/**
|
|
5323
|
+
* A captured frame, read back from the canvas swapchain.
|
|
5324
|
+
*
|
|
5325
|
+
* `data` is tightly-packed RGBA8 (4 bytes/pixel), row-major, top row first — the same
|
|
5326
|
+
* layout `ImageData` expects, so it can be handed straight to a 2D canvas:
|
|
5327
|
+
*
|
|
5328
|
+
* ```ts
|
|
5329
|
+
* const shot = await captureScreenshot(surface);
|
|
5330
|
+
* const cv = new OffscreenCanvas(shot.width, shot.height);
|
|
5331
|
+
* cv.getContext("2d")!.putImageData(new ImageData(shot.data, shot.width, shot.height), 0, 0);
|
|
5332
|
+
* const url = await cv.convertToBlob({ type: "image/jpeg", quality: 0.85 });
|
|
5333
|
+
* ```
|
|
5334
|
+
*
|
|
5335
|
+
* Alpha is forced to 255 (fully opaque): the swapchain is presented opaque, so its alpha
|
|
5336
|
+
* channel is not meaningful for a saved image. Colours are the final, presented 8-bit
|
|
5337
|
+
* values (BGRA swizzled to RGBA when the preferred canvas format is BGRA).
|
|
5338
|
+
*/
|
|
5339
|
+
export declare interface Screenshot {
|
|
5340
|
+
readonly width: number;
|
|
5341
|
+
readonly height: number;
|
|
5342
|
+
readonly data: Uint8ClampedArray;
|
|
5343
|
+
}
|
|
5344
|
+
|
|
3530
5345
|
/**
|
|
3531
5346
|
* Select a material variant by name on a loaded glTF asset.
|
|
3532
5347
|
*
|
|
@@ -3577,6 +5392,42 @@ export declare function setBillboardSpriteFrame(handle: BillboardSpriteHandle, f
|
|
|
3577
5392
|
*/
|
|
3578
5393
|
export declare function setBillboardSpriteFrameIndex(system: BillboardSpriteSystem, index: number, frame: number): void;
|
|
3579
5394
|
|
|
5395
|
+
/**
|
|
5396
|
+
* Configure orbit/zoom limits on an ArcRotateCamera. This is fully opt-in and
|
|
5397
|
+
* self-contained: cameras that never call it pay zero cost and bundle no clamping
|
|
5398
|
+
* code (the camera's scalar setters call an undefined hook).
|
|
5399
|
+
*
|
|
5400
|
+
* What it does:
|
|
5401
|
+
* 1. Stores the provided bounds on the camera and clamps the current pose into
|
|
5402
|
+
* range right away (inertia zeroed), so enabling limits never causes a jump.
|
|
5403
|
+
* 2. Installs a self-clamp hook on the camera (`_clampToLimits`). The
|
|
5404
|
+
* alpha/beta/radius setters invoke it on every mutation, so any caller —
|
|
5405
|
+
* pinch direct-write, inertial overshoot, auto-rotate — is snapped back to
|
|
5406
|
+
* the wall in the same statement that pushed past it. The camera is therefore
|
|
5407
|
+
* never observably out of bounds at any point a per-frame callback reads it
|
|
5408
|
+
* (e.g. a camera-pinned skybox), eliminating both the overshoot-then-snap
|
|
5409
|
+
* jiggle and the one-frame clip "blink" of a deferred per-frame clamp.
|
|
5410
|
+
*
|
|
5411
|
+
* Only the fields present on `limits` are written, so calls compose; pass a field
|
|
5412
|
+
* as `undefined` to remove that bound. Returns a disposer that removes the
|
|
5413
|
+
* self-clamp hook.
|
|
5414
|
+
*
|
|
5415
|
+
* The optional `scene` parameter is accepted for backward compatibility and is
|
|
5416
|
+
* unused — enforcement no longer needs a per-frame scene hook.
|
|
5417
|
+
*/
|
|
5418
|
+
export declare function setCameraLimits(camera: ArcRotateCamera, limits: ArcRotateCameraLimits, scene?: SceneContext): () => void;
|
|
5419
|
+
|
|
5420
|
+
/**
|
|
5421
|
+
* Set the scene clip plane and register its scene-uniform contributor.
|
|
5422
|
+
*
|
|
5423
|
+
* The clip plane is opt-in: importing `setClipPlane` is what pulls the clip-plane
|
|
5424
|
+
* UBO writer into the bundle, keeping those bytes out of scenes that never clip.
|
|
5425
|
+
*
|
|
5426
|
+
* @param scene - The scene to configure.
|
|
5427
|
+
* @param plane - The clip plane as `[a, b, c, d]` coefficients of `a·x + b·y + c·z + d`.
|
|
5428
|
+
*/
|
|
5429
|
+
export declare function setClipPlane(scene: SceneContext, plane: ClipPlane): void;
|
|
5430
|
+
|
|
3580
5431
|
/**
|
|
3581
5432
|
* Bind a texture to one of the effect's texture slots, marking the bind group dirty so it is rebuilt.
|
|
3582
5433
|
* @param wrapper - The effect wrapper to update.
|
|
@@ -3593,13 +5444,26 @@ export declare function setEffectTexture(wrapper: EffectWrapper, bindingNameOrIn
|
|
|
3593
5444
|
*/
|
|
3594
5445
|
export declare function setEffectUniforms(wrapper: EffectWrapper, data: ArrayBuffer | ArrayBufferView | Record<string | number, ArrayBuffer | ArrayBufferView>): void;
|
|
3595
5446
|
|
|
3596
|
-
/** Set the swapchain backing-store size directly, in device
|
|
3597
|
-
*
|
|
3598
|
-
*
|
|
3599
|
-
*
|
|
3600
|
-
* optional `_resize` hook. */
|
|
5447
|
+
/** Set the engine's primary-surface swapchain backing-store size directly, in device
|
|
5448
|
+
* pixels. Convenience wrapper around `setSurfaceSize(engine, w, h)` since the engine
|
|
5449
|
+
* *is* its own primary surface — for auxiliary surfaces, prefer calling `setSurfaceSize`
|
|
5450
|
+
* on the specific target. */
|
|
3601
5451
|
export declare function setEngineSize(engine: EngineContext, widthPx: number, heightPx: number): void;
|
|
3602
5452
|
|
|
5453
|
+
/**
|
|
5454
|
+
* Enable scene fog and register its scene-uniform contributor.
|
|
5455
|
+
*
|
|
5456
|
+
* Fog is an opt-in feature: importing `setFog` is what pulls the fog UBO writer
|
|
5457
|
+
* into the bundle, keeping those bytes out of scenes that never use fog.
|
|
5458
|
+
*
|
|
5459
|
+
* @param scene - The scene to configure.
|
|
5460
|
+
* @param config - The fog configuration (mode, density, start, end, color).
|
|
5461
|
+
*/
|
|
5462
|
+
export declare function setFog(scene: SceneContext, config: FogConfig): void;
|
|
5463
|
+
|
|
5464
|
+
/** Set one or more orientation fields at once (single recompute). Omitted fields keep their value. */
|
|
5465
|
+
export declare function setGeospatialOrientation(camera: GeospatialCamera, orientation: GeospatialOrientation): void;
|
|
5466
|
+
|
|
3603
5467
|
/** Raise (or lower) the maximum number of scene lights in the shared lights UBO.
|
|
3604
5468
|
* Must be called BEFORE scene pipelines are compiled — existing pipelines
|
|
3605
5469
|
* and UBOs bake the cap into their WGSL/layout. */
|
|
@@ -3624,13 +5488,33 @@ export declare function setNavigationRandomSeed(plugin: NavigationPlugin, seed:
|
|
|
3624
5488
|
*/
|
|
3625
5489
|
export declare function setParent(child: Mesh, parent: IWorldMatrixProvider | null): void;
|
|
3626
5490
|
|
|
5491
|
+
/**
|
|
5492
|
+
* Set a body's angular velocity (rad/s).
|
|
5493
|
+
*/
|
|
5494
|
+
export declare function setPhysicsBodyAngularVelocity(world: PhysicsWorld, body: PhysicsBody, velocity: Vec3): void;
|
|
5495
|
+
|
|
5496
|
+
/**
|
|
5497
|
+
* Set a body's linear velocity (m/s) directly — e.g. to impart a throw velocity on release.
|
|
5498
|
+
*/
|
|
5499
|
+
export declare function setPhysicsBodyLinearVelocity(world: PhysicsWorld, body: PhysicsBody, velocity: Vec3): void;
|
|
5500
|
+
|
|
3627
5501
|
/**
|
|
3628
5502
|
* Sets a body's mass and a matching diagonal inertia tensor.
|
|
3629
5503
|
* @param world - The physics world.
|
|
3630
5504
|
* @param body - The body to update.
|
|
3631
5505
|
* @param mass - Mass in kilograms.
|
|
5506
|
+
* @param centerOfMass - Optional body-local centre of mass (defaults to the origin). Use this when the
|
|
5507
|
+
* collision shape is offset from the body's reference frame (e.g. a prop whose body origin sits at
|
|
5508
|
+
* its base but whose shape is centred on its middle) so it tumbles around its real centre.
|
|
5509
|
+
*/
|
|
5510
|
+
export declare function setPhysicsBodyMass(world: PhysicsWorld, body: PhysicsBody, mass: number, centerOfMass?: Vec3): void;
|
|
5511
|
+
|
|
5512
|
+
/**
|
|
5513
|
+
* Switch a body's motion type at runtime (e.g. ANIMATED/kinematic while a prop is grabbed, then
|
|
5514
|
+
* DYNAMIC on release). Mutates `body.motionType` so the per-frame step syncs it the right way
|
|
5515
|
+
* (ANIMATED: node → body before the step; DYNAMIC: body → node after).
|
|
3632
5516
|
*/
|
|
3633
|
-
export declare function
|
|
5517
|
+
export declare function setPhysicsBodyMotionType(world: PhysicsWorld, body: PhysicsBody, motionType: PhysicsMotionType): void;
|
|
3634
5518
|
|
|
3635
5519
|
/**
|
|
3636
5520
|
* Assigns a collision shape to a body.
|
|
@@ -3641,11 +5525,20 @@ export declare function setPhysicsBodyMass(world: PhysicsWorld, body: PhysicsBod
|
|
|
3641
5525
|
export declare function setPhysicsBodyShape(world: PhysicsWorld, body: PhysicsBody, shape: PhysicsShape): void;
|
|
3642
5526
|
|
|
3643
5527
|
/**
|
|
3644
|
-
*
|
|
5528
|
+
* Teleport a body to a world position + orientation (a pure transform set — velocities are left
|
|
5529
|
+
* unchanged). For grab-follow, save-restore, and undo. Also updates the bound node so a render that
|
|
5530
|
+
* reads the node before the next physics step stays consistent.
|
|
5531
|
+
*/
|
|
5532
|
+
export declare function setPhysicsBodyTransform(world: PhysicsWorld, body: PhysicsBody, position: Vec3, rotation: Quat): void;
|
|
5533
|
+
|
|
5534
|
+
/**
|
|
5535
|
+
* Sets gravity for the world, or for a single region when `worldPosition` is given.
|
|
5536
|
+
* Passing a position is useful for planetary scenarios where gravity direction varies by location.
|
|
3645
5537
|
* @param world - The physics world.
|
|
3646
5538
|
* @param gravity - Gravity acceleration in m/s².
|
|
5539
|
+
* @param worldPosition - Optional world position selecting the region to update; omit to update all regions.
|
|
3647
5540
|
*/
|
|
3648
|
-
export declare function setPhysicsGravity(world: PhysicsWorld, gravity: Vec3): void;
|
|
5541
|
+
export declare function setPhysicsGravity(world: PhysicsWorld, gravity: Vec3, worldPosition?: Vec3): void;
|
|
3649
5542
|
|
|
3650
5543
|
/**
|
|
3651
5544
|
* Sets a shape's surface material properties.
|
|
@@ -3671,11 +5564,22 @@ export declare function setPhysicsTimestep(world: PhysicsWorld, dt: number): voi
|
|
|
3671
5564
|
*/
|
|
3672
5565
|
export declare function setPhysicsVelocityLimits(world: PhysicsWorld, maxLinear: number, maxAngular: number): void;
|
|
3673
5566
|
|
|
5567
|
+
export declare function setPositionGizmoLocalCoordinates(gizmo: PositionGizmo, useLocal: boolean): void;
|
|
5568
|
+
|
|
5569
|
+
export declare function setRotationGizmoLocalCoordinates(gizmo: RotationGizmo, useLocal: boolean): void;
|
|
5570
|
+
|
|
5571
|
+
/** Toggle local-coord mode on the per-axis scale arrows. The uniform-scale
|
|
5572
|
+
* gizmo (centre) is always uniform so it ignores the flag. */
|
|
5573
|
+
export declare function setScaleGizmoLocalCoordinates(gizmo: ScaleGizmo, useLocal: boolean): void;
|
|
5574
|
+
|
|
3674
5575
|
/** Set a declared `f32` uniform. Convenience wrapper over `setShaderUniform()`. */
|
|
3675
5576
|
export declare function setShaderFloat(material: ShaderMaterial, name: string, value: number): void;
|
|
3676
5577
|
|
|
3677
|
-
/** Set a declared `mat4x4<f32>` uniform. Convenience wrapper over `setShaderUniform()`.
|
|
3678
|
-
|
|
5578
|
+
/** Set a declared `mat4x4<f32>` uniform. Convenience wrapper over `setShaderUniform()`.
|
|
5579
|
+
* Accepts a raw `Float32Array` or the engine's branded `Mat4` (e.g. the result of
|
|
5580
|
+
* `getViewProjectionMatrix()` / `mat4Invert()`), so camera/math matrices can be fed
|
|
5581
|
+
* straight into a matrix uniform without laundering through a typed array. */
|
|
5582
|
+
export declare function setShaderMatrix(material: ShaderMaterial, name: string, value: Float32Array | Mat4): void;
|
|
3679
5583
|
|
|
3680
5584
|
/** Bind (or clear) the texture for a declared sampler, enforcing that depth and
|
|
3681
5585
|
* non-depth samplers receive a matching `Texture2D`.
|
|
@@ -3731,6 +5635,18 @@ export declare function setSprite2DShaderParams(layer: Sprite2DLayer, params: re
|
|
|
3731
5635
|
*/
|
|
3732
5636
|
export declare function setSprite2DUvOffset(layer: Sprite2DLayer, index: number, uvOffset: readonly [number, number]): void;
|
|
3733
5637
|
|
|
5638
|
+
/**
|
|
5639
|
+
* Redirect a sprite renderer's output to an offscreen render {@link Texture2D} `target` (for
|
|
5640
|
+
* render-to-texture / post-processing), or pass `null` to render to the swapchain (the
|
|
5641
|
+
* default). Pair with {@link createRenderTexture2D} at its default format and the renderer's
|
|
5642
|
+
* target size. The target's texture must be the engine's swapchain format: sprite pipelines
|
|
5643
|
+
* are baked with `engine.format`, so a target of any OTHER format fails WebGPU validation at
|
|
5644
|
+
* render-pass begin. A second renderer can then sample that texture (e.g. a fullscreen
|
|
5645
|
+
* custom-shader layer) and present it. Renderers registered later run later, so register the
|
|
5646
|
+
* offscreen scene pass before the presenting pass.
|
|
5647
|
+
*/
|
|
5648
|
+
export declare function setSpriteRendererTarget(sr: SpriteRenderer, target: Texture2D | null): void;
|
|
5649
|
+
|
|
3734
5650
|
/** Set `visible` on `node` and all descendants (via `node.children`). glTF
|
|
3735
5651
|
* KHR_node_visibility specifies that children inherit their parent's
|
|
3736
5652
|
* invisibility — we materialize this at set-time so the render hot-path
|
|
@@ -3739,14 +5655,39 @@ declare function setSubtreeVisible(node: SceneNode, v: boolean): void;
|
|
|
3739
5655
|
export { setSubtreeVisible as setMeshVisible }
|
|
3740
5656
|
export { setSubtreeVisible }
|
|
3741
5657
|
|
|
5658
|
+
/** Set this surface's swapchain backing-store size directly, in device pixels. Use this
|
|
5659
|
+
* when the surface renders into an `OffscreenCanvas` whose layout size is only known
|
|
5660
|
+
* on another thread (the host posts the CSS size × devicePixelRatio). When the size
|
|
5661
|
+
* changes, asks every rendering context registered on this surface to rebuild its
|
|
5662
|
+
* canvas-sized GPU resources via the optional `_resize` hook. */
|
|
5663
|
+
export declare function setSurfaceSize(surface: SurfaceContext, widthPx: number, heightPx: number): void;
|
|
5664
|
+
|
|
5665
|
+
/** Update the layer's pixel position. Convenience wrapper. */
|
|
5666
|
+
export declare function setTextLayerPosition(layer: TextLayer, x: number, y: number): void;
|
|
5667
|
+
|
|
5668
|
+
/** Update ONE instance's RGBA color in place — the color twin of `setThinInstanceMatrix`. Only the
|
|
5669
|
+
* touched span re-uploads (dirty-range), so per-instance color churn (e.g. streamed instances carrying
|
|
5670
|
+
* per-slot animation timestamps) stays cheap on large pools. Requires colors to have been set via
|
|
5671
|
+
* `setThinInstanceColors` first. */
|
|
5672
|
+
export declare function setThinInstanceColor(mesh: Mesh, index: number, r: number, g: number, b: number, a: number): void;
|
|
5673
|
+
|
|
3742
5674
|
/** Set per-instance RGBA colors for a thin-instanced mesh. */
|
|
3743
5675
|
export declare function setThinInstanceColors(mesh: Mesh, colors: Float32Array): void;
|
|
3744
5676
|
|
|
5677
|
+
/** Update ONLY the active instance count (and re-upload the [0,count) matrix range), leaving `_capacity`
|
|
5678
|
+
* — and therefore the already-allocated GPU buffer — untouched. This is the way to vary how many instances
|
|
5679
|
+
* draw FRAME-TO-FRAME on an established thin-instanced mesh WITHOUT recreating the GPU buffer (which would
|
|
5680
|
+
* invalidate any cached render/shadow bundle that captured the old buffer handle). Pre-size the buffer once
|
|
5681
|
+
* with `setThinInstances(mesh, matrices, capacity)`, then call this each update with `count <= capacity`.
|
|
5682
|
+
* The draw reads `count` live, so the bundle stays valid. Caller must keep writing into the SAME `matrices`
|
|
5683
|
+
* array the mesh already references. No-op if the mesh isn't thin-instanced yet. */
|
|
5684
|
+
export declare function setThinInstanceCount(mesh: Mesh, count: number): void;
|
|
5685
|
+
|
|
3745
5686
|
/** Update one instance's matrix. */
|
|
3746
5687
|
export declare function setThinInstanceMatrix(mesh: Mesh, index: number, matrix: Mat4): void;
|
|
3747
5688
|
|
|
3748
5689
|
/** Set all instances from a pre-built matrix array. */
|
|
3749
|
-
export declare function setThinInstances(mesh: Mesh, matrices: Float32Array, count: number): void;
|
|
5690
|
+
export declare function setThinInstances(mesh: Mesh, matrices: Float32Array | Float64Array, count: number): void;
|
|
3750
5691
|
|
|
3751
5692
|
/**
|
|
3752
5693
|
* Write bytes into the uniform effect's single uniform buffer.
|
|
@@ -3783,10 +5724,14 @@ export declare interface ShaderMaterial extends Material {
|
|
|
3783
5724
|
readonly defines: readonly ShaderDefine[];
|
|
3784
5725
|
readonly needAlphaBlending: boolean;
|
|
3785
5726
|
readonly blendMode: "alpha" | "additive";
|
|
5727
|
+
/** True for transmissive/refractive surfaces (see `ShaderMaterialOptions.transmissive`). */
|
|
5728
|
+
readonly transmissive: boolean;
|
|
3786
5729
|
readonly needAlphaTesting: boolean;
|
|
3787
5730
|
readonly backFaceCulling: boolean;
|
|
3788
5731
|
readonly depthWrite: boolean;
|
|
3789
|
-
readonly depthCompare: GPUCompareFunction;
|
|
5732
|
+
readonly depthCompare: GPUCompareFunction;
|
|
5733
|
+
readonly depthBias: number;
|
|
5734
|
+
readonly depthBiasSlopeScale: number;
|
|
3790
5735
|
|
|
3791
5736
|
/** Options describing a ShaderMaterial: WGSL sources, attributes, uniforms,
|
|
3792
5737
|
* samplers, defines, and blend/depth state. Passed to `createShaderMaterial()`. */
|
|
@@ -3803,16 +5748,51 @@ export declare interface ShaderMaterialOptions {
|
|
|
3803
5748
|
* standard src-over; "additive" adds the fragment's premultiplied-by-alpha
|
|
3804
5749
|
* color to the framebuffer, which is the right choice for glows/light FX. */
|
|
3805
5750
|
readonly blendMode?: "alpha" | "additive";
|
|
5751
|
+
/** Mark this surface as transmissive/refractive: the renderer grabs the opaque scene color
|
|
5752
|
+
* behind it just before it draws, so the fragment can sample what is *through* it (water,
|
|
5753
|
+
* glass). Requires `needAlphaBlending` (the surface composites over the grabbed scene
|
|
5754
|
+
* color). Enable the scene-color grab on the surface's render task with
|
|
5755
|
+
* `enableRenderTaskTransmission`, then bind the resulting texture via `setShaderTexture`.
|
|
5756
|
+
* Default false. */
|
|
5757
|
+
readonly transmissive?: boolean;
|
|
3806
5758
|
readonly needAlphaTesting?: boolean;
|
|
3807
5759
|
readonly backFaceCulling?: boolean;
|
|
3808
5760
|
readonly depthWrite?: boolean;
|
|
3809
5761
|
readonly depthCompare?: GPUCompareFunction;
|
|
5762
|
+
/** Constant depth-bias added in the pipeline's depth-stencil state (units of the depth format's minimum
|
|
5763
|
+
* representable value). Lets a surface that hugs another (e.g. tiles overlapping a cone, decals) win the
|
|
5764
|
+
* depth test consistently and avoid z-fighting. Default 0 (no bias). */
|
|
5765
|
+
readonly depthBias?: number;
|
|
5766
|
+
/** Slope-scaled depth bias — extra bias proportional to the depth gradient, so steeply-angled (grazing)
|
|
5767
|
+
* surfaces get more bias. Pairs with `depthBias` to kill z-fighting at oblique angles. Default 0. */
|
|
5768
|
+
readonly depthBiasSlopeScale?: number;
|
|
5769
|
+
}
|
|
5770
|
+
|
|
5771
|
+
/** Configuration for {@link createShaderNormalMaterialView}. */
|
|
5772
|
+
export declare interface ShaderNormalViewConfig {
|
|
5773
|
+
/** Name of the world-position varying the source vertex stage emits. Default `"vWorldPos"`. */
|
|
5774
|
+
readonly worldPosVarying?: string;
|
|
5775
|
+
/** `@location()` of that varying in the vertex output struct. Default `0`. */
|
|
5776
|
+
readonly worldPosLocation?: number;
|
|
5777
|
+
/** Output space of the encoded normal: `"view"` (default — ready for
|
|
5778
|
+
* Blender-style screen-space curvature) or `"world"`. */
|
|
5779
|
+
readonly space?: "view" | "world";
|
|
5780
|
+
/** When set, the output ALPHA encodes the fragment's view distance normalized by this range
|
|
5781
|
+
* (`clamp(viewZ / range, 0, 1)`) so a consumer can fade the effect with distance. Clear the target's
|
|
5782
|
+
* alpha to `1` as the "no geometry" sentinel. When omitted, alpha is a flat `1` (validity only). */
|
|
5783
|
+
readonly distanceEncodeRange?: number;
|
|
3810
5784
|
}
|
|
3811
5785
|
|
|
3812
5786
|
/** A sampler declaration: WGSL identifier and the bound texture's sample type. */
|
|
3813
5787
|
export declare interface ShaderSamplerDecl {
|
|
3814
5788
|
readonly name: string;
|
|
3815
5789
|
readonly sampleType?: "float" | "unfilterable-float" | "depth";
|
|
5790
|
+
/** Texture view dimension. Default "2d". Use "2d-array" for layered maps such as
|
|
5791
|
+
* cascaded-shadow (CSM) depth arrays. */
|
|
5792
|
+
readonly viewDimension?: "2d" | "2d-array";
|
|
5793
|
+
/** Bind a hardware comparison sampler (`sampler_comparison`) for depth compare / PCF
|
|
5794
|
+
* filtering. Implies a depth texture. Default false. */
|
|
5795
|
+
readonly comparison?: boolean;
|
|
3816
5796
|
}
|
|
3817
5797
|
|
|
3818
5798
|
/** A sampler entry: either a bare sampler name or an explicit declaration. */
|
|
@@ -4102,15 +6082,31 @@ export declare interface SpriteAtlas {
|
|
|
4102
6082
|
readonly texture: Texture2D;
|
|
4103
6083
|
readonly textureSizePx: readonly [number, number];
|
|
4104
6084
|
readonly frames: readonly SpriteFrame[];
|
|
4105
|
-
readonly premultipliedAlpha: boolean;
|
|
4106
|
-
}
|
|
6085
|
+
readonly premultipliedAlpha: boolean;
|
|
4107
6086
|
|
|
4108
|
-
/** One source frame for `createSpriteAtlasFromFrames`.
|
|
6087
|
+
/** One source frame for `createSpriteAtlasFromFrames` / `appendSpriteAtlasFrames`. The packed
|
|
6088
|
+
* region is `width × height` texels. By default the source is read as a tightly-packed RGBA8
|
|
6089
|
+
* buffer of exactly that size starting at byte 0; the optional `srcX` / `srcY` / `srcStrideBytes`
|
|
6090
|
+
* fields let the source describe a sub-rectangle of a larger buffer without forcing the caller
|
|
6091
|
+
* to copy out the sub-rect first. */
|
|
4109
6092
|
export declare interface SpriteAtlasFrameSource {
|
|
4110
|
-
/**
|
|
6093
|
+
/** RGBA8 bytes, row-major, top-to-bottom, straight alpha. When `srcX` / `srcY` /
|
|
6094
|
+
* `srcStrideBytes` are all defaulted, this must be exactly `width * height * 4` bytes;
|
|
6095
|
+
* when sub-rect fields are supplied, it must be large enough to cover the rect
|
|
6096
|
+
* (see those fields' docs). */
|
|
4111
6097
|
readonly pixels: Uint8Array;
|
|
6098
|
+
/** Width of the frame to pack (texels written to the atlas). */
|
|
4112
6099
|
readonly width: number;
|
|
6100
|
+
/** Height of the frame to pack (texels written to the atlas). */
|
|
4113
6101
|
readonly height: number;
|
|
6102
|
+
/** Top-left x of the sub-rect to pack, in texels into `pixels`. Default `0`. */
|
|
6103
|
+
readonly srcX?: number;
|
|
6104
|
+
/** Top-left y of the sub-rect to pack, in texels into `pixels`. Default `0`. */
|
|
6105
|
+
readonly srcY?: number;
|
|
6106
|
+
/** Bytes between consecutive rows of `pixels`. Default `width * 4` (tightly packed).
|
|
6107
|
+
* Must satisfy `(srcX + width) * 4 <= srcStrideBytes` — i.e. each row's sub-rect window
|
|
6108
|
+
* must fit within one stride, so reads do not spill into the next row. */
|
|
6109
|
+
readonly srcStrideBytes?: number;
|
|
4114
6110
|
/** Pivot in [0,1] of the frame. Default `[0.5, 0.5]`. */
|
|
4115
6111
|
readonly pivot?: readonly [number, number];
|
|
4116
6112
|
/** Recorded on the emitted `SpriteFrame.name`. */
|
|
@@ -4126,6 +6122,11 @@ export declare interface SpriteAtlasPackOptions {
|
|
|
4126
6122
|
/** Min/mag filter for the packed texture. Default `"nearest"`. */
|
|
4127
6123
|
sampling?: SpriteSampling;
|
|
4128
6124
|
premultipliedAlpha?: boolean;
|
|
6125
|
+
/** Pre-allocate the atlas texture at this `[width, height]` regardless of initial-content
|
|
6126
|
+
* size, leaving headroom for later `appendSpriteAtlasFrames` calls (which never grow the
|
|
6127
|
+
* texture). Required when `sources` is empty. Defaults to the size required by the initial
|
|
6128
|
+
* `sources` (no append headroom). */
|
|
6129
|
+
capacityPx?: readonly [number, number];
|
|
4129
6130
|
}
|
|
4130
6131
|
|
|
4131
6132
|
/**
|
|
@@ -4230,6 +6231,9 @@ export declare interface SpriteRendererOptions {
|
|
|
4230
6231
|
/** Texture sampling mode for a sprite atlas. */
|
|
4231
6232
|
export declare type SpriteSampling = "linear" | "nearest";
|
|
4232
6233
|
|
|
6234
|
+
/** Inverse of `linearToSrgbByte` — sRGB byte [0,255] → linear [0,1]. */
|
|
6235
|
+
export declare function srgbByteToLinear(b: number): number;
|
|
6236
|
+
|
|
4233
6237
|
/** Which shader stage an emitter writes into. Neutral blocks can run in either;
|
|
4234
6238
|
* the walker places them in the stage of their consumer (fragment by default). */
|
|
4235
6239
|
declare type Stage = "vertex" | "fragment";
|
|
@@ -4246,6 +6250,10 @@ declare interface StageState {
|
|
|
4246
6250
|
|
|
4247
6251
|
/** StandardMaterial properties — plain data. */
|
|
4248
6252
|
export declare interface StandardMaterialProps extends Material {
|
|
6253
|
+
/** Optional opt-in material plugins (custom WGSL + uniforms + samplers layered
|
|
6254
|
+
* on top of the built-in Standard pipeline). Attach via `material.plugins = [plugin]`,
|
|
6255
|
+
* then call `enableMaterialPlugins(scene)` before `registerScene`. */
|
|
6256
|
+
plugins?: MaterialPlugin[];
|
|
4249
6257
|
diffuseColor: [number, number, number];
|
|
4250
6258
|
alpha: number;
|
|
4251
6259
|
specularColor: [number, number, number];
|
|
@@ -4361,6 +6369,60 @@ export declare interface SubSurfaceProps {
|
|
|
4361
6369
|
refraction?: RefractionProps;
|
|
4362
6370
|
}
|
|
4363
6371
|
|
|
6372
|
+
/**
|
|
6373
|
+
* Per-canvas rendering surface — owns the GPU canvas context, swapchain format, MSAA
|
|
6374
|
+
* configuration, and the list of `RenderingContext`s (scenes, effect renderers,
|
|
6375
|
+
* frame-graph contexts, sprite/text renderers) that present to this canvas.
|
|
6376
|
+
*
|
|
6377
|
+
* The `EngineContext` *is itself a `SurfaceContext`* (the primary one, bound to the
|
|
6378
|
+
* canvas passed into `createEngine`). Additional surfaces for auxiliary canvases are
|
|
6379
|
+
* created via {@link createSurface}. GPU resources (textures, buffers, pipelines, bind
|
|
6380
|
+
* groups) live on the {@link EngineContext} (device-scoped) and are shared across all
|
|
6381
|
+
* surfaces of the same engine — only the swapchain output is per-surface.
|
|
6382
|
+
*/
|
|
6383
|
+
export declare interface SurfaceContext {
|
|
6384
|
+
/** Owning engine. For the engine's primary surface this points back to the engine
|
|
6385
|
+
* itself (`engine.engine === engine`). */
|
|
6386
|
+
readonly engine: EngineContext;
|
|
6387
|
+
/** Canvas this surface presents to. */
|
|
6388
|
+
readonly canvas: RenderCanvas;
|
|
6389
|
+
/** Swapchain texture format for this surface. Use as the `format` for offscreen
|
|
6390
|
+
* RTs that will be composited onto this surface. */
|
|
6391
|
+
readonly format: GPUTextureFormat;
|
|
6392
|
+
/** MSAA sample count for the main render pass into this surface (1 or 4). */
|
|
6393
|
+
readonly msaaSamples: number;
|
|
4364
6394
|
/**
|
|
6395
|
+
* Surface-owned color-only render target that wraps this canvas's swapchain texture.
|
|
6396
|
+
* Its `_colorTexture`/`_colorView` are re-acquired from `context.getCurrentTexture()`
|
|
6397
|
+
* once per frame (see `_refreshScRT`), so it is always single-sample and carries no
|
|
6398
|
+
* depth. Render/post-process/copy tasks target it (or resolve into it) to present to
|
|
6399
|
+
* the canvas. It is `_eager` — `buildRenderTarget` and `disposeRenderTarget` both
|
|
6400
|
+
* no-op on it and the surface owns its textures, so its shared `_descriptor` must
|
|
6401
|
+
* never be mutated.
|
|
6402
|
+
*/
|
|
6403
|
+
readonly scRT: RenderTarget;
|
|
6404
|
+
/** Clamps the effective device pixel ratio used for this surface's swapchain backing
|
|
6405
|
+
* store. The backing store is sized at `min(devicePixelRatio, maxDevicePixelRatio) * cssPixels`.
|
|
6406
|
+
* `maxDevicePixelRatio = 1` renders at native CSS-pixel resolution (no DPR upscaling);
|
|
6407
|
+
* the default `Infinity` is unclamped (full devicePixelRatio). Mutable at runtime — set
|
|
6408
|
+
* before the next `resizeSurface` to take effect (mirrors Babylon `setHardwareScalingRatio`). */
|
|
6409
|
+
maxDevicePixelRatio: number;
|
|
6410
|
+
|
|
6411
|
+
/** Options for {@link createSurface}, and for the per-surface portion of `createEngine`. */
|
|
6412
|
+
export declare interface SurfaceOptions {
|
|
6413
|
+
/** MSAA sample count for the main render pass. WebGPU only permits `1` (no MSAA)
|
|
6414
|
+
* or `4` (4x MSAA). Defaults to `4`. */
|
|
6415
|
+
msaaSamples?: 1 | 4;
|
|
6416
|
+
/** WebGPU canvas alpha mode. Use `"premultiplied"` to enable canvas transparency
|
|
6417
|
+
* (clear color with `alpha < 1` will let HTML content underneath show through).
|
|
6418
|
+
* Defaults to `"opaque"`. */
|
|
6419
|
+
alphaMode?: GPUCanvasAlphaMode;
|
|
6420
|
+
/** Override the swapchain format. Defaults to `navigator.gpu.getPreferredCanvasFormat()`. */
|
|
6421
|
+
format?: GPUTextureFormat;
|
|
6422
|
+
/** Clamps the effective device pixel ratio used for the swapchain backing store.
|
|
6423
|
+
* Defaults to unclamped (full devicePixelRatio). */
|
|
6424
|
+
maxDevicePixelRatio?: number;
|
|
6425
|
+
}
|
|
6426
|
+
|
|
4365
6427
|
declare type TargetPath = 0 | 1 | 2 | 3 | 4;
|
|
4366
6428
|
|
|
4367
6429
|
/** Polymorphic interface that all frame-graph tasks implement: records `Pass` objects during `record()` and is executed once per frame. */
|
|
@@ -4376,6 +6438,125 @@ export declare interface Task {
|
|
|
4376
6438
|
dispose(): void;
|
|
4377
6439
|
}
|
|
4378
6440
|
|
|
6441
|
+
export declare interface TextData {
|
|
6442
|
+
readonly [textDataBrand]: true;
|
|
6443
|
+
/** Live, in-insertion-order view of the runs currently rendered. Mutated by
|
|
6444
|
+
* `updateTextData`. Do not mutate from outside. */
|
|
6445
|
+
readonly runs: readonly GlyphRun[];
|
|
6446
|
+
|
|
6447
|
+
declare const textDataBrand: unique symbol;
|
|
6448
|
+
|
|
6449
|
+
/** Discriminated union driving `updateTextData`. Each variant's `update` field is the
|
|
6450
|
+
* discriminator. Arrays/maps passed inside any variant are *adopted* by the `TextData`
|
|
6451
|
+
* and must not be read or mutated by the caller afterward. */
|
|
6452
|
+
export declare type TextDataUpdate = {
|
|
6453
|
+
/** Rebuild runs and/or swap to a different storage. Both `runs` and `storage`
|
|
6454
|
+
* are optional; missing fields default to the TextData's current value, so
|
|
6455
|
+
* `{ update: "reset" }` with neither performs a pure compaction pass that
|
|
6456
|
+
* re-lays-out the slot allocator without dead slots or gaps.
|
|
6457
|
+
* Invalidates any previously-passed `GlyphRun` references when `runs` is set. */
|
|
6458
|
+
update: "reset";
|
|
6459
|
+
runs?: GlyphRun[];
|
|
6460
|
+
storage?: GlyphStorage;
|
|
6461
|
+
} | {
|
|
6462
|
+
/** Append a new run to the live runs list, or insert it before the run currently at
|
|
6463
|
+
* `insertBefore`. The run's `curveSet` must already exist in the bound storage. */
|
|
6464
|
+
update: "addRun";
|
|
6465
|
+
run: GlyphRun;
|
|
6466
|
+
/** Index in `data.runs` to insert before. Default = append at end. */
|
|
6467
|
+
insertBefore?: number;
|
|
6468
|
+
} | {
|
|
6469
|
+
/** Remove a previously-added run. Accepts either the `GlyphRun` reference or its
|
|
6470
|
+
* current index in `data.runs`. */
|
|
6471
|
+
update: "removeRun";
|
|
6472
|
+
run: GlyphRun | number;
|
|
6473
|
+
} | {
|
|
6474
|
+
/** Replace one run's contents in place. The new run takes the slot in `data.runs`
|
|
6475
|
+
* that the previous run occupied. Cheapest when the new run has the same glyph
|
|
6476
|
+
* count and the same `curveSet` as the previous one. */
|
|
6477
|
+
update: "replaceRun";
|
|
6478
|
+
previous: GlyphRun | number;
|
|
6479
|
+
run: GlyphRun;
|
|
6480
|
+
};
|
|
6481
|
+
|
|
6482
|
+
/** Pure-data 2D text layer. Mutate fields directly between frames. */
|
|
6483
|
+
export declare interface TextLayer {
|
|
4379
6484
|
readonly data: TextData;
|
|
6485
|
+
positionPx: {
|
|
6486
|
+
x: number;
|
|
6487
|
+
y: number;
|
|
6488
|
+
};
|
|
6489
|
+
rotationRad: number;
|
|
6490
|
+
scale: number;
|
|
6491
|
+
order: number;
|
|
6492
|
+
opacity: number;
|
|
6493
|
+
visible: boolean;
|
|
6494
|
+
|
|
6495
|
+
export declare interface TextLayerOptions {
|
|
6496
|
+
/** Top-left origin (in canvas pixels) for the layer's local coordinate frame. Default (0, 0). */
|
|
6497
|
+
readonly positionPx?: {
|
|
6498
|
+
readonly x: number;
|
|
6499
|
+
readonly y: number;
|
|
6500
|
+
};
|
|
6501
|
+
/** Z-axis rotation about `positionPx`, in radians. Default 0. */
|
|
6502
|
+
readonly rotationRad?: number;
|
|
6503
|
+
/** Uniform scale applied to the laid-out text. Default 1. */
|
|
6504
|
+
readonly scale?: number;
|
|
6505
|
+
/** Sort order within a renderer (lower draws first). Default 0. */
|
|
6506
|
+
readonly order?: number;
|
|
6507
|
+
/** Alpha multiplier in [0, 1]. Default 1. */
|
|
6508
|
+
readonly opacity?: number;
|
|
6509
|
+
/** Default true. */
|
|
6510
|
+
readonly visible?: boolean;
|
|
6511
|
+
}
|
|
6512
|
+
|
|
6513
|
+
export declare type TextLayoutOptions = {
|
|
6514
|
+
/** Max line width in pixels before word-wrap. Default: Infinity. */
|
|
6515
|
+
readonly maxWidth?: number;
|
|
6516
|
+
/** Line-height multiplier. Default: 1.2. */
|
|
6517
|
+
readonly lineHeight?: number;
|
|
6518
|
+
/** Horizontal alignment. Default: "left". */
|
|
6519
|
+
readonly align?: "left" | "center" | "right";
|
|
6520
|
+
/** Extra spacing in font units. Default: 0. */
|
|
6521
|
+
readonly letterSpacing?: number;
|
|
6522
|
+
/** Tab size in spaces. Default: 4. */
|
|
6523
|
+
readonly tabSize?: number;
|
|
6524
|
+
};
|
|
6525
|
+
|
|
6526
|
+
export declare interface TextRenderable extends Renderable {
|
|
4380
6527
|
readonly position: ObservableVec3;
|
|
6528
|
+
readonly rotation: EulerProxy;
|
|
6529
|
+
readonly rotationQuaternion: ObservableQuat;
|
|
6530
|
+
readonly scaling: ObservableVec3;
|
|
6531
|
+
/** Whole-block opacity in [0,1]. Color is supplied per-glyph by the `TextData` descriptor. */
|
|
6532
|
+
opacity: number;
|
|
6533
|
+
ignoreDepth: boolean;
|
|
6534
|
+
order: number;
|
|
6535
|
+
|
|
6536
|
+
export declare interface TextRenderableOptions {
|
|
6537
|
+
readonly position?: Readonly<Vec3>;
|
|
6538
|
+
readonly rotationQuaternion?: {
|
|
6539
|
+
readonly x: number;
|
|
6540
|
+
readonly y: number;
|
|
6541
|
+
readonly z: number;
|
|
6542
|
+
readonly w: number;
|
|
6543
|
+
};
|
|
6544
|
+
readonly scaling?: Readonly<Vec3>;
|
|
6545
|
+
/** Whole-block opacity in [0,1]. Default 1. Per-glyph/per-run color comes from the `TextData`
|
|
6546
|
+
* descriptor (`PlacedGlyph.color` / `GlyphRun.defaultColor`), not from the renderable. */
|
|
6547
|
+
readonly opacity?: number;
|
|
6548
|
+
readonly ignoreDepth?: boolean;
|
|
6549
|
+
readonly order?: number;
|
|
6550
|
+
}
|
|
6551
|
+
|
|
6552
|
+
export declare interface TextRenderer extends RenderingContext_2 {
|
|
4381
6553
|
readonly layers: readonly TextLayer[];
|
|
6554
|
+
|
|
6555
|
+
export declare interface TextRendererOptions {
|
|
6556
|
+
layers: readonly TextLayer[];
|
|
6557
|
+
/** Default true. Set false for HUD overlays so the text pass preserves existing scene color. */
|
|
6558
|
+
clear?: boolean;
|
|
6559
|
+
/** Default `{ r: 0, g: 0, b: 0, a: 1 }`. */
|
|
6560
|
+
clearValue?: GPUColorDict;
|
|
6561
|
+
}
|
|
6562
|
+
|
|
4382
6563
|
/** A loaded 2D texture: the GPU texture, its default view and sampler, pixel
|
|
4383
6564
|
* dimensions, and an optional per-texture UV transform. This is the public
|
|
4384
6565
|
* texture handle returned by `loadTexture2D()`, `createSolidTexture2D()`, etc. */
|
|
@@ -4445,8 +6626,11 @@ export declare interface ThicknessProps {
|
|
|
4445
6626
|
|
|
4446
6627
|
/** CPU-side data backing a thin-instanced mesh: world matrices, optional colors, and GPU sync state. */
|
|
4447
6628
|
export declare interface ThinInstanceData {
|
|
4448
|
-
/** CPU-side instance world matrices (16 floats per instance).
|
|
4449
|
-
|
|
6629
|
+
/** CPU-side instance world matrices (16 floats per instance). Storage may
|
|
6630
|
+
* be Float32Array (default) or Float64Array (after an HPM engine is
|
|
6631
|
+
* constructed; the caller built the slab via `allocateMat4()`). The GPU
|
|
6632
|
+
* upload path in thin-instance-gpu.ts handles both (REQ-API-3, D5). */
|
|
6633
|
+
matrices: Float32Array | Float64Array;
|
|
4450
6634
|
/** Active instance count. */
|
|
4451
6635
|
count: number;
|
|
4452
6636
|
/** Optional per-instance RGBA colors (4 floats per instance). */
|
|
4453
6637
|
colors?: Float32Array | null;
|
|
@@ -4459,6 +6643,51 @@ export declare interface TintProps {
|
|
|
4459
6643
|
atDistance?: number;
|
|
4460
6644
|
}
|
|
4461
6645
|
|
|
6646
|
+
/**
|
|
6647
|
+
* Torus-knot mesh generator — matches Babylon.js `CreateTorusKnotVertexData` exactly.
|
|
6648
|
+
*
|
|
6649
|
+
* The knot centre-line is the (p, q) torus knot curve:
|
|
6650
|
+
*
|
|
6651
|
+
* getPos(angle):
|
|
6652
|
+
* cu = cos(angle), su = sin(angle), s = (q/p) * angle
|
|
6653
|
+
* x = radius * (2 + cos(s)) * 0.5 * cu
|
|
6654
|
+
* y = radius * (2 + cos(s)) * 0.5 * su
|
|
6655
|
+
* z = radius * sin(s) * 0.5
|
|
6656
|
+
*
|
|
6657
|
+
* A Frenet-like frame (tangent / normal / bitangent built from cross products of
|
|
6658
|
+
* the curve point and a nearby sample) sweeps a circle of `tube` radius around
|
|
6659
|
+
* the curve. Normals are computed with the area-weighted-per-face-then-normalize
|
|
6660
|
+
* scheme of Babylon's `VertexData.ComputeNormals` (see {@link computeNormals}),
|
|
6661
|
+
* NOT analytically, so the knot shades pixel-identically to Babylon.js.
|
|
6662
|
+
*
|
|
6663
|
+
* Loop bounds mirror Babylon precisely: the vertex loop runs `i <= radialSegments`
|
|
6664
|
+
* (with `i % radialSegments` wrap) while the index loop runs `i < radialSegments`
|
|
6665
|
+
* and `j < tubularSegments` (with `(j + 1) % tubularSegments` wrap).
|
|
6666
|
+
*/
|
|
6667
|
+
/** CPU geometry for a torus knot: tightly-packed typed arrays ready for GPU upload. */
|
|
6668
|
+
export declare interface TorusKnotData {
|
|
6669
|
+
positions: Float32Array;
|
|
6670
|
+
normals: Float32Array;
|
|
6671
|
+
uvs: Float32Array;
|
|
6672
|
+
indices: Uint32Array;
|
|
6673
|
+
}
|
|
6674
|
+
|
|
6675
|
+
/** Options for {@link createTorusKnotData}. Subset of Babylon's CreateTorusKnot. */
|
|
6676
|
+
export declare interface TorusKnotOptions {
|
|
6677
|
+
/** Global radius of the torus knot. Default 2. */
|
|
6678
|
+
radius?: number;
|
|
6679
|
+
/** Thickness of the tube. Default 0.5. */
|
|
6680
|
+
tube?: number;
|
|
6681
|
+
/** Number of sides on each tube segment. Default 32. */
|
|
6682
|
+
radialSegments?: number;
|
|
6683
|
+
/** Number of tubes the knot is decomposed into. Default 32. */
|
|
6684
|
+
tubularSegments?: number;
|
|
6685
|
+
/** Number of windings around the z axis. Default 2. */
|
|
6686
|
+
p?: number;
|
|
6687
|
+
/** Number of windings around the x axis. Default 3. */
|
|
6688
|
+
q?: number;
|
|
6689
|
+
}
|
|
6690
|
+
|
|
4462
6691
|
/** Options for `createTorusData`. Subset of Babylon's CreateTorus. */
|
|
4463
6692
|
export declare interface TorusOptions {
|
|
4464
6693
|
diameter?: number;
|
|
@@ -4480,6 +6709,19 @@ export declare interface TranslucencyProps {
|
|
|
4480
6709
|
diffusionDistance?: [number, number, number];
|
|
4481
6710
|
}
|
|
4482
6711
|
|
|
6712
|
+
export declare interface TransmissionOptions {
|
|
6713
|
+
/** When true (the default), retarget the task's color buffer to a linear `rgba16float`
|
|
6714
|
+
* offscreen and tone-map it in a trailing image-processing pass — the model PBR
|
|
6715
|
+
* transmission uses so refractive materials read scene color in *linear* space.
|
|
6716
|
+
*
|
|
6717
|
+
* Set false to perform ONLY the mid-pass scene-color grab: the task's render target
|
|
6718
|
+
* format / sample count / clear are left untouched and no tone-map pass is added. Use
|
|
6719
|
+
* this for consumers that own their tone mapping / post (e.g. a custom depth-of-field
|
|
6720
|
+
* stack) and just need the opaque scene color exposed to a custom transmissive
|
|
6721
|
+
* `ShaderMaterial`. */
|
|
6722
|
+
linear?: boolean;
|
|
6723
|
+
}
|
|
6724
|
+
|
|
4483
6725
|
/** Options for `createTubeData`: a circular cross-section swept along a path. */
|
|
4484
6726
|
export declare interface TubeOptions {
|
|
4485
6727
|
path: Vec3[];
|
|
@@ -4520,18 +6762,21 @@ export declare interface UniformEffectWrapperOptions {
|
|
|
4520
6762
|
uniformByteLength: number;
|
|
4521
6763
|
}
|
|
4522
6764
|
|
|
4523
|
-
/** Unregister the effect renderer from its
|
|
6765
|
+
/** Unregister the effect renderer from its surface. No-op if not registered. */
|
|
4524
6766
|
export declare function unregisterEffectRenderer(er: EffectRenderer): void;
|
|
4525
6767
|
|
|
4526
|
-
/** Unregister the standalone frame-graph context from its
|
|
6768
|
+
/** Unregister the standalone frame-graph context from its surface. */
|
|
4527
6769
|
export declare function unregisterFrameGraphContext(ctx: FrameGraphContext): void;
|
|
4528
6770
|
|
|
4529
|
-
/** Remove a previously-registered scene. Idempotent. Does not dispose scene resources.
|
|
4530
|
-
|
|
6771
|
+
/** Remove a previously-registered scene. Idempotent. Does not dispose scene resources.
|
|
6772
|
+
* The scene is always removed from `scene.surface`. */
|
|
6773
|
+
export declare function unregisterScene(scene: SceneContext): void;
|
|
4531
6774
|
|
|
4532
6775
|
/** Splice the renderer out of its engine's `_renderingContexts`. No-op if not present. */
|
|
4533
6776
|
export declare function unregisterSpriteRenderer(sr: SpriteRenderer): void;
|
|
4534
6777
|
|
|
6778
|
+
export declare function unregisterTextRenderer(tr: TextRenderer): void;
|
|
6779
|
+
|
|
4535
6780
|
/** Advances every active task by `deltaMs` (or by `fixedDeltaMs` when set), running the category handler first.
|
|
4536
6781
|
* Ignores non-finite or negative steps. */
|
|
4537
6782
|
export declare function updateAnimationManager(manager: AnimationManager, deltaMs: number): void;
|
|
@@ -4553,6 +6798,28 @@ export declare function updateBillboardSprite(handle: BillboardSpriteHandle, pat
|
|
|
4553
6798
|
*/
|
|
4554
6799
|
export declare function updateBillboardSpriteIndex(system: BillboardSpriteSystem, index: number, patch: Partial<BillboardSpriteInit>): void;
|
|
4555
6800
|
|
|
6801
|
+
/** Re-shape `text` and apply the new run via `updateTextData(replaceRun)`. New glyphs are
|
|
6802
|
+
* added to the storage in place. When `textColor` is omitted, the live run's existing
|
|
6803
|
+
* `defaultColor` is preserved (so any caller-driven color override survives a text re-shape). */
|
|
6804
|
+
export declare function updateDefaultTextData(data: DefaultTextData, text: string, textColor?: readonly [number, number, number, number]): void;
|
|
6805
|
+
|
|
6806
|
+
/** Add glyphs to the named curve-set, creating it if it doesn't exist yet. Glyph ids
|
|
6807
|
+
* already present in the curve-set are skipped (the existing outline + atlas slot wins).
|
|
6808
|
+
* Safe to call between frames: the atlas grows in place and the next render uploads the
|
|
6809
|
+
* new glyphs. */
|
|
6810
|
+
export declare function updateGlyphStorage(storage: GlyphStorage, curveSetId: CurveSetId, curves: ReadonlyMap<number, GlyphCurves>): void;
|
|
6811
|
+
|
|
6812
|
+
/** Re-upload (part of) a mesh's COLOR buffer — the twin of `updateMeshNormals`/`updateMeshPositions`
|
|
6813
|
+
* for dynamically re-generated geometry whose per-vertex colors change (e.g. a procedural mesh whose
|
|
6814
|
+
* parts are re-tinted each rebuild). The color attribute is vec4 (16 bytes/vertex). No-op if the mesh
|
|
6815
|
+
* was created without colors. Zero-allocation GPU upload only. */
|
|
6816
|
+
export declare function updateMeshColors(engine: EngineContext, mesh: Mesh, colors: Float32Array, vertexOffset?: number): void;
|
|
6817
|
+
|
|
6818
|
+
/** Re-upload (part of) a mesh's NORMAL buffer — the twin of `updateMeshPositions` for dynamically
|
|
6819
|
+
* re-generated geometry whose per-vertex normals change (e.g. a swept tube re-fitted each rebuild).
|
|
6820
|
+
* No-op if the mesh was created without normals. Zero-allocation GPU upload only. */
|
|
6821
|
+
export declare function updateMeshNormals(engine: EngineContext, mesh: Mesh, normals: Float32Array, vertexOffset?: number): void;
|
|
6822
|
+
|
|
4556
6823
|
/** Update a mesh's GPU vertex positions in place (e.g. CPU vertex animation).
|
|
4557
6824
|
* `positions` must hold tightly-packed XYZ floats matching the mesh's vertex count.
|
|
4558
6825
|
* `vertexOffset` is the first vertex to overwrite (defaults to 0).
|
|
@@ -4560,6 +6827,24 @@ export declare function updateBillboardSpriteIndex(system: BillboardSpriteSystem
|
|
|
4560
6827
|
* Zero-allocation GPU upload only — CPU-side picking geometry is not refreshed. */
|
|
4561
6828
|
export declare function updateMeshPositions(engine: EngineContext, mesh: Mesh, positions: Float32Array, vertexOffset?: number): void;
|
|
4562
6829
|
|
|
6830
|
+
/** Re-upload (part of) a mesh's TANGENT buffer — the twin of `updateMeshColors` for dynamically
|
|
6831
|
+
* re-generated geometry whose per-vertex tangent (vec4) payload changes each rebuild (e.g. a procedural
|
|
6832
|
+
* batch that streams a per-vertex coordinate frame / mask through the tangent slot). The tangent attribute
|
|
6833
|
+
* is vec4 (16 bytes/vertex). No-op if the mesh was created without tangents. Zero-allocation GPU upload only. */
|
|
6834
|
+
export declare function updateMeshTangents(engine: EngineContext, mesh: Mesh, tangents: Float32Array, vertexOffset?: number): void;
|
|
6835
|
+
|
|
6836
|
+
/** Re-upload (part of) a mesh's second UV buffer (uv2) — the twin of `updateMeshUvs` for dynamically
|
|
6837
|
+
* re-generated geometry whose per-vertex uv2 payload changes each rebuild (e.g. a procedural batch that
|
|
6838
|
+
* re-bakes per-vertex AO / gradient data). The uv2 attribute is vec2 (8 bytes/vertex). No-op if the mesh
|
|
6839
|
+
* was created without uv2. Zero-allocation GPU upload only. */
|
|
6840
|
+
export declare function updateMeshUv2(engine: EngineContext, mesh: Mesh, uvs2: Float32Array, vertexOffset?: number): void;
|
|
6841
|
+
|
|
6842
|
+
/** Re-upload (part of) a mesh's UV buffer — the twin of `updateMeshNormals`/`updateMeshColors` for
|
|
6843
|
+
* dynamically re-generated geometry whose per-vertex UVs change (e.g. a procedural mesh whose parts
|
|
6844
|
+
* carry per-rebuild UV payloads). The uv attribute is vec2 (8 bytes/vertex). No-op if the mesh was
|
|
6845
|
+
* created without UVs. Zero-allocation GPU upload only. */
|
|
6846
|
+
export declare function updateMeshUvs(engine: EngineContext, mesh: Mesh, uvs: Float32Array, vertexOffset?: number): void;
|
|
6847
|
+
|
|
4563
6848
|
/** Advance the crowd simulation by `dt` seconds. */
|
|
4564
6849
|
export declare function updateNavCrowd(crowd: NavCrowd, dt: number): void;
|
|
4565
6850
|
|
|
@@ -4585,6 +6870,41 @@ export declare function updateSprite2DIndex(layer: Sprite2DLayer, index: number,
|
|
|
4585
6870
|
*/
|
|
4586
6871
|
export declare function updateSpriteAnimationManager(manager: SpriteAnimationManager, deltaMs: number): void;
|
|
4587
6872
|
|
|
6873
|
+
export declare function updateTextData(data: TextData, update: TextDataUpdate): void;
|
|
6874
|
+
|
|
6875
|
+
/**
|
|
6876
|
+
* Update a rectangular region of an existing `Texture2D` from a tightly-packed RGBA8 byte buffer.
|
|
6877
|
+
*
|
|
6878
|
+
* The texture must have been created with `COPY_DST` usage (as `createTexture2DFromPixels` does).
|
|
6879
|
+
* This is the runtime counterpart to `createTexture2DFromPixels` — for data textures the app mutates
|
|
6880
|
+
* each frame / on demand (e.g. a terrain carve heightmap stamped by a dig tool).
|
|
6881
|
+
*
|
|
6882
|
+
* @param engine - Engine context.
|
|
6883
|
+
* @param tex - Target texture (from `createTexture2DFromPixels`).
|
|
6884
|
+
* @param data - `width * height * 4` bytes for the sub-region, row-major, straight alpha.
|
|
6885
|
+
* @param x - Destination origin X in texels (default 0).
|
|
6886
|
+
* @param y - Destination origin Y in texels (default 0).
|
|
6887
|
+
* @param width - Region width in texels (default `tex.width`).
|
|
6888
|
+
* @param height - Region height in texels (default `tex.height`).
|
|
6889
|
+
*/
|
|
6890
|
+
export declare function updateTexture2DFromPixels(engine: EngineContext, tex: Texture2D, data: Uint8Array, x?: number, y?: number, width?: number, height?: number): void;
|
|
6891
|
+
|
|
6892
|
+
/** UtilityLayer handle. The `scene` field is a regular `SceneContext` — pass it
|
|
6893
|
+
* to gizmo factories so their meshes are added there instead of the main
|
|
6894
|
+
* scene. */
|
|
6895
|
+
export declare interface UtilityLayer {
|
|
6896
|
+
readonly scene: SceneContext;
|
|
6897
|
+
readonly mainScene: SceneContext;
|
|
6898
|
+
}
|
|
6899
|
+
|
|
6900
|
+
export declare interface UtilityLayerOptions {
|
|
6901
|
+
/** Add a built-in hemispheric light so gizmo materials are visible without
|
|
6902
|
+
* the caller adding one. Defaults to true. */
|
|
6903
|
+
addDefaultLight?: boolean;
|
|
6904
|
+
/** Default light intensity when `addDefaultLight` is true. Defaults to 1.0. */
|
|
6905
|
+
lightIntensity?: number;
|
|
6906
|
+
}
|
|
6907
|
+
|
|
4588
6908
|
/** Per-mesh original + variant material entry. */
|
|
4589
6909
|
declare interface VariantMeshEntry {
|
|
4590
6910
|
mesh: Mesh;
|
|
@@ -4593,6 +6913,75 @@ declare interface VariantMeshEntry {
|
|
|
4593
6913
|
|
|
4594
6914
|
declare interface Varying {
|
|
4595
6915
|
|
|
6916
|
+
/** Result of baking — the GPU texture plus a per-clip row map for choosing playback params. */
|
|
6917
|
+
export declare interface VatBakeResult {
|
|
6918
|
+
readonly texture: GPUTexture;
|
|
6919
|
+
readonly boneCount: number;
|
|
6920
|
+
readonly frameCount: number;
|
|
6921
|
+
/** Clip name → row range, for building the per-mesh/per-instance (fromRow,toRow,offset,fps) params. */
|
|
6922
|
+
readonly clips: Record<string, VatClip>;
|
|
6923
|
+
}
|
|
6924
|
+
|
|
6925
|
+
/** Where one clip landed in the baked texture: its first row, its frame count, and its native fps. */
|
|
6926
|
+
export declare interface VatClip {
|
|
6927
|
+
readonly fromRow: number;
|
|
6928
|
+
readonly frameCount: number;
|
|
6929
|
+
readonly fps: number;
|
|
6930
|
+
}
|
|
6931
|
+
|
|
6932
|
+
/** VAT (Vertex Animation Texture) GPU data — BAKED skinning. Attached to `mesh.vat` by vat/vat-baker.ts.
|
|
6933
|
+
* The skeletal animation is pre-evaluated into `texture` (one frame per row); the shader reads bone
|
|
6934
|
+
* matrices from the current frame's row instead of a live per-frame upload, so the mesh thin-instances.
|
|
6935
|
+
* Reuses the same joints/weights vertex-buffer field names as SkeletonData so the renderable binds either. */
|
|
6936
|
+
declare interface VatData {
|
|
6937
|
+
readonly boneCount: number;
|
|
6938
|
+
/** Baked bone-matrix texture: rgba32float, (boneCount*4) × frameCount, one animation frame per row
|
|
6939
|
+
* (identical per-row layout to the live bone texture in skeleton/create-skeleton.ts). */
|
|
6940
|
+
readonly texture: GPUTexture;
|
|
6941
|
+
readonly frameCount: number;
|
|
6942
|
+
/** UBO consumed by the VAT vertex fragment: `params` vec4 = (fromRow, toRow, frameOffset, fps);
|
|
6943
|
+
* `clock` vec4 .x = elapsed seconds. Advanced by the VAT manager (vat/vat-baker.ts). */
|
|
6944
|
+
readonly settingsBuffer: GPUBuffer;
|
|
6945
|
+
readonly jointsBuffer: GPUBuffer;
|
|
6946
|
+
readonly weightsBuffer: GPUBuffer;
|
|
6947
|
+
readonly joints1Buffer: GPUBuffer | null;
|
|
6948
|
+
readonly weights1Buffer: GPUBuffer | null;
|
|
6949
|
+
/** Optional per-instance VAT params texture (rgba32float, (2*instanceCount) x 1): TWO texels per
|
|
6950
|
+
* thin-instance — A=(fromRow,toRow,offset,fps), B=(fromRow,toRow,blend,fps) — so each instance plays
|
|
6951
|
+
* its own clip + phase (and can blend two clips) from the one shared baked texture. Present + the mesh
|
|
6952
|
+
* thin-instanced ⇒ the VAT vertex path reads its frame rows from this texture indexed by
|
|
6953
|
+
* `@builtin(instance_index)` instead of the shared settings UBO. Set via the VatHandle. */
|
|
6954
|
+
instanceTexture?: GPUTexture | null;
|
|
6955
|
+
}
|
|
6956
|
+
|
|
6957
|
+
/** Runtime VAT playback handle for one mesh (the analogue of BJS BakedVertexAnimationManager + the
|
|
6958
|
+
* per-mesh settings). Advance `update()` each frame; set the active clip with `play()`. */
|
|
6959
|
+
export declare interface VatHandle {
|
|
6960
|
+
/** The mesh this drives (its `mesh.vat` is set). */
|
|
6961
|
+
readonly mesh: Mesh;
|
|
6962
|
+
/** Baked clip row map. */
|
|
6963
|
+
readonly clips: Record<string, VatClip>;
|
|
6964
|
+
/** Select the clip to play (by name) or set explicit playback params. */
|
|
6965
|
+
play(clip: string, opts?: {
|
|
6966
|
+
offset?: number;
|
|
6967
|
+
fps?: number;
|
|
6968
|
+
}): void;
|
|
6969
|
+
/** Advance the animation clock by `dtSeconds` and upload it. */
|
|
6970
|
+
update(dtSeconds: number): void;
|
|
6971
|
+
/** Enable/refresh PER-INSTANCE VAT: upload one vec4 (fromRow, toRow, timeOffset, fps) per thin-instance,
|
|
6972
|
+
* so every instance plays its own clip + phase from the one shared baked texture (all instances in a
|
|
6973
|
+
* single draw call). `params.length` must be `4 * instanceCount`. Call this BEFORE registerScene the
|
|
6974
|
+
* first time — it sets `mesh.vat.instanceTexture`; a VAT mesh that is thin-instanced then takes the
|
|
6975
|
+
* per-instance vertex path. Later calls re-upload in place. Use `clips` to look up each clip's
|
|
6976
|
+
* fromRow/toRow/fps when building `params`. (Internally expanded to the dual-clip layout, blend 0.) */
|
|
6977
|
+
setInstances(params: Float32Array): void;
|
|
6978
|
+
/** PER-INSTANCE DUAL-CLIP VAT: like setInstances, but each instance carries TWO clips that are blended,
|
|
6979
|
+
* so gait cross-fades stay smooth. `params.length` must be `8 * instanceCount` — two vec4s per instance:
|
|
6980
|
+
* A = (fromRowA, toRowA, timeOffset, fpsA), B = (fromRowB, toRowB, blendWeight, fpsB), where blendWeight
|
|
6981
|
+
* in [0,1] lerps A→B and B reuses A's timeOffset. Same per-instance VAT path as setInstances. */
|
|
6982
|
+
setInstancesBlend(params: Float32Array): void;
|
|
6983
|
+
}
|
|
6984
|
+
|
|
4596
6985
|
/** 3-component vector (position, direction, color) */
|
|
4597
6986
|
export declare interface Vec3 {
|
|
4598
6987
|
x: number;
|