@babylonjs/lite 0.2.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_mat4-storage-f64-Bvh5TymE.js → _mat4-storage-f64-BW9sTaVh.js} +3 -2
- package/_mat4-storage-f64-BW9sTaVh.js.map +1 -0
- package/{alpha-test-fragment-BCChpzaV.js → alpha-test-fragment-eUG971h3.js} +2 -2
- package/{alpha-test-fragment-BCChpzaV.js.map → alpha-test-fragment-eUG971h3.js.map} +1 -1
- package/assets/splat-sort-worker-DT3eybMZ.js.map +1 -0
- package/{background-dds-skybox-ZjrSIxrT.js → background-dds-skybox-BwG0kYQP.js} +13 -13
- package/background-dds-skybox-BwG0kYQP.js.map +1 -0
- package/{background-ground-B2Mie-MI.js → background-ground-DiFpKJzF.js} +19 -19
- package/background-ground-DiFpKJzF.js.map +1 -0
- package/{background-hdr-skybox-DDRJYuT2.js → background-hdr-skybox-DIgJhvfj.js} +10 -10
- package/background-hdr-skybox-DIgJhvfj.js.map +1 -0
- package/{background-solid-skybox-fjXlnWaD.js → background-solid-skybox--fqHdan_.js} +11 -12
- package/background-solid-skybox--fqHdan_.js.map +1 -0
- package/{billboard-renderable-DKmlOgbM.js → billboard-renderable-HY2XCd52.js} +46 -10
- package/billboard-renderable-HY2XCd52.js.map +1 -0
- package/{clamp-block-CxRBPlUq.js → clamp-block-XHdUk2Va.js} +2 -2
- package/{clamp-block-CxRBPlUq.js.map → clamp-block-XHdUk2Va.js.map} +1 -1
- package/{clearcoat-fragment-KbZAa0TA.js → clearcoat-fragment-CHYw8MPB.js} +2 -2
- package/{clearcoat-fragment-KbZAa0TA.js.map → clearcoat-fragment-CHYw8MPB.js.map} +1 -1
- package/{create-skeleton-BBI5urcj.js → create-skeleton-9tdiUjRP.js} +9 -9
- package/create-skeleton-9tdiUjRP.js.map +1 -0
- package/{cubemap-skybox-material-DvW81drX.js → cubemap-skybox-material-DqQ0dyz8.js} +6 -7
- package/cubemap-skybox-material-DqQ0dyz8.js.map +1 -0
- package/{curve-block-Dh_xdUj-.js → curve-block-S27sXrJQ.js} +2 -2
- package/{curve-block-Dh_xdUj-.js.map → curve-block-S27sXrJQ.js.map} +1 -1
- package/{emissive-fragment-DD8cvHyx.js → emissive-fragment-CZMQ0_bF.js} +3 -3
- package/emissive-fragment-CZMQ0_bF.js.map +1 -0
- package/{esm-shadow-view-DHVS9r7H.js → esm-shadow-view-CUwxbnMR.js} +2 -2
- package/{esm-shadow-view-DHVS9r7H.js.map → esm-shadow-view-CUwxbnMR.js.map} +1 -1
- package/{esm-shadow-view-15S4JK6p.js → esm-shadow-view-Cl36rOrK.js} +2 -2
- package/{esm-shadow-view-15S4JK6p.js.map → esm-shadow-view-Cl36rOrK.js.map} +1 -1
- package/{esm-shadow-view-DYAc62Kl.js → esm-shadow-view-DKQ-FSoV.js} +2 -2
- package/{esm-shadow-view-DYAc62Kl.js.map → esm-shadow-view-DKQ-FSoV.js.map} +1 -1
- package/{gaussian-splatting-pipeline-sh-BvkUhA9V.js → gaussian-splatting-pipeline-sh-DDo7QQ8l.js} +19 -19
- package/gaussian-splatting-pipeline-sh-DDo7QQ8l.js.map +1 -0
- package/geometry-texture-output-BmuAquio.js +41 -0
- package/geometry-texture-output-BmuAquio.js.map +1 -0
- package/geometry-view-xWZmq799.js +404 -0
- package/geometry-view-xWZmq799.js.map +1 -0
- package/{gltf-animation-KnPzeOIY.js → gltf-animation-Bq7k_5HA.js} +6 -6
- package/gltf-animation-Bq7k_5HA.js.map +1 -0
- package/{gltf-ext-basisu-kmth3UWX.js → gltf-ext-basisu-C5teqxzQ.js} +43 -211
- package/gltf-ext-basisu-C5teqxzQ.js.map +1 -0
- package/{gltf-ext-node-visibility-BjRRd6si.js → gltf-ext-node-visibility-DnGTKkMf.js} +2 -2
- package/{gltf-ext-node-visibility-BjRRd6si.js.map → gltf-ext-node-visibility-DnGTKkMf.js.map} +1 -1
- package/{gltf-ext-quantization-CpZyLDIz.js → gltf-ext-quantization-DheC7FhB.js} +4 -3
- package/gltf-ext-quantization-DheC7FhB.js.map +1 -0
- package/{gltf-ext-uv-transform-MHmR-YyM.js → gltf-ext-uv-transform-DljdVllE.js} +2 -2
- package/{gltf-ext-uv-transform-MHmR-YyM.js.map → gltf-ext-uv-transform-DljdVllE.js.map} +1 -1
- package/{gltf-feature-animation-pointer-rFqLfbO_.js → gltf-feature-animation-pointer-DVhymFLK.js} +9 -9
- package/gltf-feature-animation-pointer-DVhymFLK.js.map +1 -0
- package/{gltf-feature-animations-DikONdzi.js → gltf-feature-animations-hxC3y3bJ.js} +2 -2
- package/{gltf-feature-animations-DikONdzi.js.map → gltf-feature-animations-hxC3y3bJ.js.map} +1 -1
- package/{gltf-feature-draco-yGSMGTE3.js → gltf-feature-draco-B7Q_cMUv.js} +6 -5
- package/gltf-feature-draco-B7Q_cMUv.js.map +1 -0
- package/{gltf-feature-gpu-instancing-Cj1XjmM6.js → gltf-feature-gpu-instancing-C7sRzWv7.js} +4 -4
- package/gltf-feature-gpu-instancing-C7sRzWv7.js.map +1 -0
- package/{gltf-feature-lights-punctual-C-0SlGmD.js → gltf-feature-lights-punctual-DF7kya14.js} +5 -5
- package/{gltf-feature-lights-punctual-C-0SlGmD.js.map → gltf-feature-lights-punctual-DF7kya14.js.map} +1 -1
- package/{gltf-feature-meshopt-Des96YFI.js → gltf-feature-meshopt-DRG9hEqT.js} +7 -6
- package/gltf-feature-meshopt-DRG9hEqT.js.map +1 -0
- package/{gltf-feature-morph-BAcY14XU.js → gltf-feature-morph-DZydYgWp.js} +4 -4
- package/gltf-feature-morph-DZydYgWp.js.map +1 -0
- package/{gltf-feature-registry-97sY_x5O.js → gltf-feature-registry-DeYdy3DV.js} +15 -15
- package/{gltf-feature-registry-97sY_x5O.js.map → gltf-feature-registry-DeYdy3DV.js.map} +1 -1
- package/{gltf-feature-skeleton-lVjkDfIU.js → gltf-feature-skeleton-B9och1W0.js} +3 -3
- package/{gltf-feature-skeleton-lVjkDfIU.js.map → gltf-feature-skeleton-B9och1W0.js.map} +1 -1
- package/{gltf-feature-variants-BphF4JmV.js → gltf-feature-variants-CY_Qft7f.js} +2 -2
- package/{gltf-feature-variants-BphF4JmV.js.map → gltf-feature-variants-CY_Qft7f.js.map} +1 -1
- package/{gltf-glb-parser-D6UZWFuC.js → gltf-glb-parser-CqOeXFOz.js} +5 -4
- package/gltf-glb-parser-CqOeXFOz.js.map +1 -0
- package/{gltf-interleave-C9eBqH_F.js → gltf-interleave-DWf27t-h.js} +14 -15
- package/gltf-interleave-DWf27t-h.js.map +1 -0
- package/{gltf-pbr-builder-ext-DPC0zg_u.js → gltf-pbr-builder-ext-DvFxuOqN.js} +5 -5
- package/gltf-pbr-builder-ext-DvFxuOqN.js.map +1 -0
- package/{gltf-variants-CnBEZr0o.js → gltf-variants-CUvzYGYX.js} +4 -4
- package/{gltf-variants-CnBEZr0o.js.map → gltf-variants-CUvzYGYX.js.map} +1 -1
- package/gpu-task-timer-Dgkff80h.js +236 -0
- package/gpu-task-timer-Dgkff80h.js.map +1 -0
- package/gpu-timer-CUpqT_hK.js +55 -0
- package/gpu-timer-CUpqT_hK.js.map +1 -0
- package/{gs-picking-pipeline-Bx8LTav6.js → gs-picking-pipeline-55sM5LzV.js} +14 -14
- package/gs-picking-pipeline-55sM5LzV.js.map +1 -0
- package/havok-floating-origin-5xp32P-C.js +198 -0
- package/havok-floating-origin-5xp32P-C.js.map +1 -0
- package/index-C-tEgwbZ.js +41056 -0
- package/index-C-tEgwbZ.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 +2490 -108
- package/index.js +476 -323
- package/{input-block-Coi_aZwl.js → input-block-DbRYCnet.js} +2 -2
- package/{input-block-Coi_aZwl.js.map → input-block-DbRYCnet.js.map} +1 -1
- package/{iridescence-fragment-DwZcCTdD.js → iridescence-fragment-S3Ko1jvC.js} +2 -2
- package/{iridescence-fragment-DwZcCTdD.js.map → iridescence-fragment-S3Ko1jvC.js.map} +1 -1
- package/{light-block-Np_h5gPI.js → light-block-CAqWkucp.js} +2 -2
- package/{light-block-Np_h5gPI.js.map → light-block-CAqWkucp.js.map} +1 -1
- package/{loop-block-BFkLFYGm.js → loop-block-ch-biPFY.js} +2 -2
- package/{loop-block-BFkLFYGm.js.map → loop-block-ch-biPFY.js.map} +1 -1
- package/{morph-fragment-DqH-w61u.js → morph-fragment-D9he3Ksk.js} +2 -2
- package/{morph-fragment-DqH-w61u.js.map → morph-fragment-D9he3Ksk.js.map} +1 -1
- package/{multilight-wgsl-B9Mf9d-q.js → multilight-wgsl-74aXpcJG.js} +2 -2
- package/{multilight-wgsl-B9Mf9d-q.js.map → multilight-wgsl-74aXpcJG.js.map} +1 -1
- package/{node-env-BPZXZzBf.js → node-env-B2bjGcMS.js} +6 -5
- package/node-env-B2bjGcMS.js.map +1 -0
- package/node-geometry-view-CSXlEAhG.js +291 -0
- package/node-geometry-view-CSXlEAhG.js.map +1 -0
- package/{node-registry-extra-compat-Ch7ApZHF.js → node-registry-extra-compat-BEQH_ksg.js} +2 -2
- package/{node-registry-extra-compat-Ch7ApZHF.js.map → node-registry-extra-compat-BEQH_ksg.js.map} +1 -1
- package/{node-registry-extra-math-6ezzTkPj.js → node-registry-extra-math-Bm32WBAa.js} +2 -2
- package/{node-registry-extra-math-6ezzTkPj.js.map → node-registry-extra-math-Bm32WBAa.js.map} +1 -1
- package/{node-renderable-CS0CmsSp.js → node-renderable-BMHny4tC.js} +15 -13
- package/node-renderable-BMHny4tC.js.map +1 -0
- package/{node-shadow-CpnrdvtJ.js → node-shadow-BRiz7CT1.js} +7 -7
- package/node-shadow-BRiz7CT1.js.map +1 -0
- package/{normal-map-fragment-DradEMl-.js → normal-map-fragment-sE3TjF4U.js} +2 -2
- package/{normal-map-fragment-DradEMl-.js.map → normal-map-fragment-sE3TjF4U.js.map} +1 -1
- package/package.json +3 -10
- package/{parse-camera-CgV4bWc0.js → parse-camera-CmZBS423.js} +2 -2
- package/{parse-camera-CgV4bWc0.js.map → parse-camera-CmZBS423.js.map} +1 -1
- package/pbr-geometry-view-T3vMABM8.js +491 -0
- package/pbr-geometry-view-T3vMABM8.js.map +1 -0
- package/{pbr-metallic-roughness-block-BFwZj2Nw.js → pbr-metallic-roughness-block-DbozMlHU.js} +2 -2
- package/{pbr-metallic-roughness-block-BFwZj2Nw.js.map → pbr-metallic-roughness-block-DbozMlHU.js.map} +1 -1
- package/{pbr-metallic-roughness-block-full-5t0HT3xl.js → pbr-metallic-roughness-block-full-CHC8w-Uv.js} +2 -2
- package/{pbr-metallic-roughness-block-full-5t0HT3xl.js.map → pbr-metallic-roughness-block-full-CHC8w-Uv.js.map} +1 -1
- package/{pbr-mr-helper-core-R5tOZ8Ap.js → pbr-mr-helper-core-DGRgbRXl.js} +2 -2
- package/{pbr-mr-helper-core-R5tOZ8Ap.js.map → pbr-mr-helper-core-DGRgbRXl.js.map} +1 -1
- package/{pbr-refraction-Dd11HnaI.js → pbr-refraction-CquDP9JO.js} +2 -2
- package/{pbr-refraction-Dd11HnaI.js.map → pbr-refraction-CquDP9JO.js.map} +1 -1
- package/{pbr-renderable-BHAdF5Vw.js → pbr-renderable-CaHKHU0g.js} +60 -42
- package/pbr-renderable-CaHKHU0g.js.map +1 -0
- package/{pbr-shadow-fragment-BxUrFJYZ.js → pbr-shadow-fragment-DmnNe6yz.js} +2 -2
- package/{pbr-shadow-fragment-BxUrFJYZ.js.map → pbr-shadow-fragment-DmnNe6yz.js.map} +1 -1
- package/{pbr-tracking-D6i3yPb7.js → pbr-tracking-Bo7RTANK.js} +2 -2
- package/{pbr-tracking-D6i3yPb7.js.map → pbr-tracking-Bo7RTANK.js.map} +1 -1
- package/{pbr-transmission-ext-Dll8EYwE.js → pbr-transmission-ext-CoGcJBGE.js} +2 -2
- package/{pbr-transmission-ext-Dll8EYwE.js.map → pbr-transmission-ext-CoGcJBGE.js.map} +1 -1
- package/recast-navigation.wasm-DG_0AFuk.js +8706 -0
- package/recast-navigation.wasm-DG_0AFuk.js.map +1 -0
- package/recast-navigation.wasm-compat-C-Bf2ylB.js +8692 -0
- package/recast-navigation.wasm-compat-C-Bf2ylB.js.map +1 -0
- package/{reflectance-fragment-ejMJ4O1o.js → reflectance-fragment-CExe6qDY.js} +2 -2
- package/{reflectance-fragment-ejMJ4O1o.js.map → reflectance-fragment-CExe6qDY.js.map} +1 -1
- package/{rgbd-decode-DCvzUYeI.js → rgbd-decode-DkiiiIlt.js} +7 -6
- package/rgbd-decode-DkiiiIlt.js.map +1 -0
- package/{scene-material-swap-C2ykv55W.js → scene-material-swap-4qM0tpBK.js} +11 -5
- package/scene-material-swap-4qM0tpBK.js.map +1 -0
- package/screenshot-readback-avr_tYGZ.js +92 -0
- package/screenshot-readback-avr_tYGZ.js.map +1 -0
- package/{mesh-features-BAJpbMog.js → shader-composer-CZagsJDS.js} +3 -54
- package/shader-composer-CZagsJDS.js.map +1 -0
- package/{shader-renderable-BMf_vvO0.js → shader-renderable-D5sbgzxt.js} +62 -24
- package/shader-renderable-D5sbgzxt.js.map +1 -0
- package/{shader-thin-instance-5_WUfi3m.js → shader-thin-instance-CkQ8rrfH.js} +4 -4
- package/shader-thin-instance-CkQ8rrfH.js.map +1 -0
- package/{sheen-fragment-CS6z29Fs.js → sheen-fragment-BEigjpTX.js} +2 -2
- package/{sheen-fragment-CS6z29Fs.js.map → sheen-fragment-BEigjpTX.js.map} +1 -1
- package/{singlelight-directional-wgsl-4MIgZMeC.js → singlelight-directional-wgsl-Ccsk-ys3.js} +2 -2
- package/{singlelight-directional-wgsl-4MIgZMeC.js.map → singlelight-directional-wgsl-Ccsk-ys3.js.map} +1 -1
- package/{singlelight-hemispheric-wgsl-CK-GUYWe.js → singlelight-hemispheric-wgsl-DL-jpc97.js} +2 -2
- package/{singlelight-hemispheric-wgsl-CK-GUYWe.js.map → singlelight-hemispheric-wgsl-DL-jpc97.js.map} +1 -1
- package/{singlelight-point-wgsl-CYtzqCbP.js → singlelight-point-wgsl-hYmiP6ys.js} +2 -2
- package/{singlelight-point-wgsl-CYtzqCbP.js.map → singlelight-point-wgsl-hYmiP6ys.js.map} +1 -1
- package/{singlelight-spot-wgsl-DVbaVufF.js → singlelight-spot-wgsl-DSjp1p1C.js} +2 -2
- package/{singlelight-spot-wgsl-DVbaVufF.js.map → singlelight-spot-wgsl-DSjp1p1C.js.map} +1 -1
- package/{skeleton-fragment-BOVmc8YS.js → skeleton-fragment-B__bUbPK.js} +2 -2
- package/{skeleton-fragment-BOVmc8YS.js.map → skeleton-fragment-B__bUbPK.js.map} +1 -1
- package/{skybox-renderable-DDcCPSly.js → skybox-renderable-BH6uUkal.js} +7 -8
- package/skybox-renderable-BH6uUkal.js.map +1 -0
- package/{splat-ply-compressed-BahdBG1r.js → splat-ply-compressed-BGNK6dnh.js} +9 -8
- package/splat-ply-compressed-BGNK6dnh.js.map +1 -0
- package/{standard-renderable-D1bhoF0K.js → standard-pipeline-BvFynkwL.js} +11 -202
- package/standard-pipeline-BvFynkwL.js.map +1 -0
- package/standard-renderable-1Q3zemys.js +191 -0
- package/standard-renderable-1Q3zemys.js.map +1 -0
- package/{std-ambient-fragment-C6WNm8dQ.js → std-ambient-fragment-__F1KTEu.js} +2 -2
- package/{std-ambient-fragment-C6WNm8dQ.js.map → std-ambient-fragment-__F1KTEu.js.map} +1 -1
- package/{std-cube-reflection-fragment-Bqutpy2q.js → std-cube-reflection-fragment-DidM0byH.js} +2 -2
- package/{std-cube-reflection-fragment-Bqutpy2q.js.map → std-cube-reflection-fragment-DidM0byH.js.map} +1 -1
- package/{std-emissive-fragment-B-A83rqX.js → std-emissive-fragment-Bj62X4Np.js} +2 -2
- package/{std-emissive-fragment-B-A83rqX.js.map → std-emissive-fragment-Bj62X4Np.js.map} +1 -1
- package/{std-lightmap-fragment-Df7KJezh.js → std-lightmap-fragment-DXvfWvKc.js} +2 -2
- package/{std-lightmap-fragment-Df7KJezh.js.map → std-lightmap-fragment-DXvfWvKc.js.map} +1 -1
- package/{std-opacity-fragment-D9et2jip.js → std-opacity-fragment-BzMMb1K_.js} +2 -2
- package/{std-opacity-fragment-D9et2jip.js.map → std-opacity-fragment-BzMMb1K_.js.map} +1 -1
- package/{std-reflection-fragment-DBJeT-yg.js → std-reflection-fragment-DC9Kvu1C.js} +2 -2
- package/{std-reflection-fragment-DBJeT-yg.js.map → std-reflection-fragment-DC9Kvu1C.js.map} +1 -1
- package/{std-shadow-fragment-C6fD8rW-.js → std-shadow-fragment-BnMHeF1-.js} +2 -2
- package/{std-shadow-fragment-C6fD8rW-.js.map → std-shadow-fragment-BnMHeF1-.js.map} +1 -1
- package/{std-specular-fragment-C2ZOss-t.js → std-specular-fragment-Bio681OG.js} +2 -2
- package/{std-specular-fragment-C2ZOss-t.js.map → std-specular-fragment-Bio681OG.js.map} +1 -1
- package/{std-tracking-C4L4nQGc.js → std-tracking-BTcrry2o.js} +2 -2
- package/{std-tracking-C4L4nQGc.js.map → std-tracking-BTcrry2o.js.map} +1 -1
- package/{subsurface-fragment-C1H4ytqK.js → subsurface-fragment-DpKib445.js} +2 -2
- package/{subsurface-fragment-C1H4ytqK.js.map → subsurface-fragment-DpKib445.js.map} +1 -1
- package/swapchain-overlay-UCLilhbq.js +37 -0
- package/swapchain-overlay-UCLilhbq.js.map +1 -0
- package/{thin-instance-cull-binding-CCxrPNO6.js → thin-instance-cull-binding-DwZi7mlE.js} +12 -12
- package/thin-instance-cull-binding-DwZi7mlE.js.map +1 -0
- package/{thin-instance-gpu-E8DBd8XL.js → thin-instance-gpu-uY2NOv0J.js} +15 -7
- package/thin-instance-gpu-uY2NOv0J.js.map +1 -0
- package/{tracking-primitives-w4BVV9p9.js → tracking-primitives-Ck5bgCuo.js} +2 -2
- package/{tracking-primitives-w4BVV9p9.js.map → tracking-primitives-Ck5bgCuo.js.map} +1 -1
- package/{unlit-fragment-DU9_mhzZ.js → unlit-fragment-nc6hu3Mw.js} +2 -2
- package/{unlit-fragment-DU9_mhzZ.js.map → unlit-fragment-nc6hu3Mw.js.map} +1 -1
- package/_mat4-storage-f64-Bvh5TymE.js.map +0 -1
- package/assets/splat-sort-worker-Crg3CaCc.js.map +0 -1
- package/background-dds-skybox-ZjrSIxrT.js.map +0 -1
- package/background-ground-B2Mie-MI.js.map +0 -1
- package/background-hdr-skybox-DDRJYuT2.js.map +0 -1
- package/background-solid-skybox-fjXlnWaD.js.map +0 -1
- package/billboard-renderable-DKmlOgbM.js.map +0 -1
- package/create-skeleton-BBI5urcj.js.map +0 -1
- package/cubemap-skybox-material-DvW81drX.js.map +0 -1
- package/emissive-fragment-DD8cvHyx.js.map +0 -1
- package/gaussian-splatting-pipeline-sh-BvkUhA9V.js.map +0 -1
- package/gltf-animation-KnPzeOIY.js.map +0 -1
- package/gltf-ext-basisu-kmth3UWX.js.map +0 -1
- package/gltf-ext-quantization-CpZyLDIz.js.map +0 -1
- package/gltf-feature-animation-pointer-rFqLfbO_.js.map +0 -1
- package/gltf-feature-draco-yGSMGTE3.js.map +0 -1
- package/gltf-feature-gpu-instancing-Cj1XjmM6.js.map +0 -1
- package/gltf-feature-meshopt-Des96YFI.js.map +0 -1
- package/gltf-feature-morph-BAcY14XU.js.map +0 -1
- package/gltf-glb-parser-D6UZWFuC.js.map +0 -1
- package/gltf-interleave-C9eBqH_F.js.map +0 -1
- package/gltf-pbr-builder-ext-DPC0zg_u.js.map +0 -1
- package/gs-picking-pipeline-Bx8LTav6.js.map +0 -1
- package/index-B7Qhw0xL.js +0 -21232
- package/index-B7Qhw0xL.js.map +0 -1
- package/mesh-features-BAJpbMog.js.map +0 -1
- package/no-color-view-DsyLSL-W.js +0 -8
- package/no-color-view-DsyLSL-W.js.map +0 -1
- package/node-env-BPZXZzBf.js.map +0 -1
- package/node-registry-Bd-AlrgC.js +0 -190
- package/node-registry-Bd-AlrgC.js.map +0 -1
- package/node-renderable-CS0CmsSp.js.map +0 -1
- package/node-shadow-CpnrdvtJ.js.map +0 -1
- package/pbr-renderable-BHAdF5Vw.js.map +0 -1
- package/rgbd-decode-DCvzUYeI.js.map +0 -1
- package/scene-material-swap-C2ykv55W.js.map +0 -1
- package/shader-renderable-BMf_vvO0.js.map +0 -1
- package/shader-thin-instance-5_WUfi3m.js.map +0 -1
- package/skybox-renderable-DDcCPSly.js.map +0 -1
- package/splat-ply-compressed-BahdBG1r.js.map +0 -1
- package/standard-renderable-D1bhoF0K.js.map +0 -1
- package/swapchain-overlay-DcCSFDp7.js +0 -35
- package/swapchain-overlay-DcCSFDp7.js.map +0 -1
- package/thin-instance-cull-binding-CCxrPNO6.js.map +0 -1
- package/thin-instance-gpu-E8DBd8XL.js.map +0 -1
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
|
|
|
@@ -85,6 +88,27 @@ export declare function addFacingBillboardSystem(scene: SceneContext, system: Fa
|
|
|
85
88
|
* (compute / copy / object-list) needs the same surface. */
|
|
86
89
|
export declare function addPassDependencies(pass: Pass, deps: RenderTarget | readonly RenderTarget[]): void;
|
|
87
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Adds a child shape to a container shape with an explicit local transform.
|
|
93
|
+
* @param world - The physics world.
|
|
94
|
+
* @param container - Parent container shape.
|
|
95
|
+
* @param child - Child shape to append.
|
|
96
|
+
* @param translation - Child translation in container space.
|
|
97
|
+
* @param rotation - Child rotation in container space.
|
|
98
|
+
* @param scale - Child scale in container space.
|
|
99
|
+
*/
|
|
100
|
+
export declare function addPhysicsShapeChild(world: PhysicsWorld, container: PhysicsShape, child: PhysicsShape, translation?: Vec3, rotation?: Quat, scale?: Vec3): void;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Adds a child shape to a container, deriving its local transform from two scene nodes.
|
|
104
|
+
* @param world - The physics world.
|
|
105
|
+
* @param container - Parent container shape.
|
|
106
|
+
* @param parentNode - Scene node associated with the container shape.
|
|
107
|
+
* @param child - Child shape to append.
|
|
108
|
+
* @param childNode - Scene node associated with the child shape.
|
|
109
|
+
*/
|
|
110
|
+
export declare function addPhysicsShapeChildFromParent(world: PhysicsWorld, container: PhysicsShape, parentNode: SceneNode, child: PhysicsShape, childNode: SceneNode): void;
|
|
111
|
+
|
|
88
112
|
/** Create a `RenderPass`, wire it to the task currently recording, and return
|
|
89
113
|
* it. Must be called from inside `Task.record()` so the FG can associate the
|
|
90
114
|
* new pass with the right task (mirrors BJS `frameGraph.addRenderPass`).
|
|
@@ -129,6 +153,11 @@ export declare function addTaskAtStart(target: FrameGraph | SceneContext, task:
|
|
|
129
153
|
/** Insert a task BEFORE another task in execute order. Accepts a FrameGraph or a SceneContext. */
|
|
130
154
|
export declare function addTaskBefore(target: FrameGraph | SceneContext, task: Task, before: Task): void;
|
|
131
155
|
|
|
156
|
+
/** Attach a `TextRenderable` to a scene. Uses the scene's deferred-renderables hook. */
|
|
157
|
+
export declare function addTextRenderable(scene: SceneContext, renderable: TextRenderable): void;
|
|
158
|
+
|
|
159
|
+
export declare function addTextRendererLayer(tr: TextRenderer, layer: TextLayer): void;
|
|
160
|
+
|
|
132
161
|
/** Add one instance. Returns its index. Grows capacity as needed. */
|
|
133
162
|
export declare function addThinInstance(mesh: Mesh, matrix: Mat4): number;
|
|
134
163
|
|
|
@@ -319,6 +348,53 @@ export declare interface AnisotropyProps {
|
|
|
319
348
|
|
|
320
349
|
declare type AnyMaterial = StandardMaterialProps | PbrMaterialProps;
|
|
321
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Append `sources` into the remaining free space of an atlas previously built by
|
|
353
|
+
* `createSpriteAtlasFromFrames`. The existing `GPUTexture` (and any bind group already
|
|
354
|
+
* referencing it) stays valid — each new frame is uploaded with a single
|
|
355
|
+
* `queue.writeTexture` and the UV slots of the *existing* frames are not touched, so
|
|
356
|
+
* sprite instances already drawing from this atlas remain correct.
|
|
357
|
+
*
|
|
358
|
+
* Returns the integer indices of the newly-appended frames in `atlas.frames`, in input
|
|
359
|
+
* order. Sources are validated and placed before any texel is written, so a thrown
|
|
360
|
+
* "atlas full" error leaves the atlas state untouched (all-or-nothing semantics).
|
|
361
|
+
*
|
|
362
|
+
* Throws when:
|
|
363
|
+
* - The atlas was built by `createGridSpriteAtlas` / `loadSpriteAtlas` (no packer state).
|
|
364
|
+
* - Any source has invalid size / sub-rect / pixel buffer length.
|
|
365
|
+
* - A source wider than `maxWidthPx` is supplied (cannot fit any shelf).
|
|
366
|
+
* - The packed sources would overflow the atlas height. Pre-size the atlas via
|
|
367
|
+
* `createSpriteAtlasFromFrames(engine, [...], { capacityPx: [w, h] })` to reserve room.
|
|
368
|
+
*/
|
|
369
|
+
export declare function appendSpriteAtlasFrames(engine: EngineContext, atlas: SpriteAtlas, sources: readonly SpriteAtlasFrameSource[]): number[];
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Applies a force for one fixed physics timestep, matching Babylon.js PhysicsBody.applyForce.
|
|
373
|
+
* @param world - The physics world.
|
|
374
|
+
* @param body - The physics body to update.
|
|
375
|
+
* @param force - Force vector.
|
|
376
|
+
* @param location - World-space application point.
|
|
377
|
+
*/
|
|
378
|
+
export declare function applyPhysicsBodyForce(world: PhysicsWorld, body: PhysicsBody, force: Vec3, location: Vec3): void;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Applies a world-space impulse to a physics body.
|
|
382
|
+
* @param body - The physics body to update.
|
|
383
|
+
* @param impulse - Impulse vector.
|
|
384
|
+
* @param location - World-space application point.
|
|
385
|
+
*/
|
|
386
|
+
export declare function applyPhysicsBodyImpulse(body: PhysicsBody, impulse: Vec3, location: Vec3): void;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Apply a one-shot linear impulse (kg·m/s) to a body at a world `point` (defaults to the body's
|
|
390
|
+
* current position / centre of mass), waking it if asleep. Used to shoot, throw, or shove a prop.
|
|
391
|
+
* @param world - The physics world.
|
|
392
|
+
* @param body - The body to push.
|
|
393
|
+
* @param impulse - World-space impulse vector (kg·m/s).
|
|
394
|
+
* @param point - World point of application; defaults to the body's current position.
|
|
395
|
+
*/
|
|
396
|
+
export declare function applyPhysicsImpulse(world: PhysicsWorld, body: PhysicsBody, impulse: Vec3, point?: Vec3): void;
|
|
397
|
+
|
|
322
398
|
/** ArcRotateCamera — orbits around a target point.
|
|
323
399
|
* Uses Babylon.js convention: left-handed, alpha=rotation around Y, beta=elevation.
|
|
324
400
|
* Plain data + methods. Does NOT know about the scene.
|
|
@@ -408,6 +484,16 @@ export declare interface AssetContainer {
|
|
|
408
484
|
};
|
|
409
485
|
}
|
|
410
486
|
|
|
487
|
+
/** Bind the gizmo to a node — the gizmo follows the node's world translation
|
|
488
|
+
* and applies drag deltas to its `position`. */
|
|
489
|
+
export declare function attachAxisDragGizmoToNode(gizmo: AxisDragGizmo, node: SceneNode | null): void;
|
|
490
|
+
|
|
491
|
+
export declare function attachAxisScaleGizmoToNode(gizmo: AxisScaleGizmo, node: SceneNode | null): void;
|
|
492
|
+
|
|
493
|
+
export declare function attachBoundingBoxGizmoToNode(gizmo: BoundingBoxGizmo, node: SceneNode | null): void;
|
|
494
|
+
|
|
495
|
+
export declare function attachCameraGizmoToCamera(gizmo: CameraGizmo, camera: Camera | null): void;
|
|
496
|
+
|
|
411
497
|
/**
|
|
412
498
|
* Attach orbit/zoom/pan controls to an ArcRotateCamera.
|
|
413
499
|
* Matches Babylon.js ArcRotateCameraPointersInput behavior with inertia:
|
|
@@ -426,7 +512,34 @@ export declare interface AssetContainer {
|
|
|
426
512
|
* Camera stays plain data — this function reads/writes its properties.
|
|
427
513
|
* Returns a cleanup function to remove all listeners and the beforeRender hook.
|
|
428
514
|
*/
|
|
429
|
-
export declare function attachControl(camera: ArcRotateCamera, canvas: HTMLCanvasElement, scene?: SceneContext): () => void;
|
|
515
|
+
export declare function attachControl(camera: ArcRotateCamera, canvas: HTMLCanvasElement, scene?: SceneContext, options?: AttachControlOptions): () => void;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Optional hooks that let an {@link attachControl} caller defer pointer
|
|
519
|
+
* gestures to an external interactor (typically a gizmo pointer-drag
|
|
520
|
+
* dispatcher) so the camera doesn't orbit when the user is interacting with
|
|
521
|
+
* something else on top of it. All fields are optional; omit them to keep
|
|
522
|
+
* the default behavior (the camera always handles its own pointer input).
|
|
523
|
+
*/
|
|
524
|
+
export declare interface AttachControlOptions {
|
|
525
|
+
/** Optional predicate consulted on every pointer-down. When it returns
|
|
526
|
+
* false the camera ignores that gesture (no rotate / pan). Used to defer
|
|
527
|
+
* to gizmo interaction so pressing or dragging a gizmo doesn't also orbit
|
|
528
|
+
* the camera. */
|
|
529
|
+
shouldHandlePointerDown?: (event: PointerEvent) => boolean;
|
|
530
|
+
/** Optional predicate consulted on pointer-move while a camera drag is in
|
|
531
|
+
* progress. When it returns true the camera ABORTS the current drag.
|
|
532
|
+
* Because gizmo picking is async, a press on a gizmo may not be known at
|
|
533
|
+
* pointer-down time (so the camera optimistically starts orbiting); once
|
|
534
|
+
* the gizmo drag is recognised a frame later this lets the gizmo reclaim
|
|
535
|
+
* the gesture and undo the (not-yet-applied) orbit. */
|
|
536
|
+
isExternalDragActive?: () => boolean;
|
|
537
|
+
/** Optional predicate consulted on pointer-move. While it returns true the
|
|
538
|
+
* camera DEFERS its orbit (consumes the move without applying it) — used
|
|
539
|
+
* to wait out an in-flight async gizmo pick so a press that lands on a
|
|
540
|
+
* gizmo never produces a stray orbit, regardless of pick latency. */
|
|
541
|
+
isExternalPickPending?: () => boolean;
|
|
542
|
+
}
|
|
430
543
|
|
|
431
544
|
/**
|
|
432
545
|
* Attach keyboard + mouse controls to a FreeCamera.
|
|
@@ -442,6 +555,38 @@ export declare function attachControl(camera: ArcRotateCamera, canvas: HTMLCanva
|
|
|
442
555
|
*/
|
|
443
556
|
export declare function attachFreeControl(camera: FreeCamera, canvas: HTMLCanvasElement, scene?: SceneContext): () => void;
|
|
444
557
|
|
|
558
|
+
/**
|
|
559
|
+
* Attach orbit / pan / zoom controls to a {@link GeospatialCamera}, matching
|
|
560
|
+
* Babylon.js `GeospatialCamera` interactions:
|
|
561
|
+
* - Left-drag: pan (the cursor stays anchored to the globe surface).
|
|
562
|
+
* - Middle/right-drag: rotate (yaw + pitch / tilt).
|
|
563
|
+
* - Wheel: zoom (toward the cursor by default).
|
|
564
|
+
* - Touch: single-finger drag = pan; two-finger pinch = zoom toward the centroid,
|
|
565
|
+
* promoting to a pan once the centroid drifts ≥ 20 px.
|
|
566
|
+
* - Keyboard: arrows = pan, Ctrl+arrows = tilt (pitch/yaw), +/- = zoom along the look vector.
|
|
567
|
+
*
|
|
568
|
+
* Movement uses Babylon.js's framerate-independent physics model (velocity +
|
|
569
|
+
* inertial decay). Globe picking is analytic ray-sphere against the planet
|
|
570
|
+
* sphere (origin-centred, radius = `limits.planetRadius`) — no mesh picking
|
|
571
|
+
* subsystem is required. Inertia is integrated once per frame from the scene's
|
|
572
|
+
* render loop (`scene._beforeRender`).
|
|
573
|
+
*
|
|
574
|
+
* Returns a disposer that removes all listeners and the per-frame hook.
|
|
575
|
+
*/
|
|
576
|
+
export declare function attachGeospatialControls(camera: GeospatialCamera, canvas: HTMLCanvasElement, scene: SceneContext, options?: GeospatialControlOptions): () => void;
|
|
577
|
+
|
|
578
|
+
export declare function attachLightGizmoToLight(gizmo: LightGizmo, light: LightBase | null): void;
|
|
579
|
+
|
|
580
|
+
export declare function attachPlaneDragGizmoToNode(gizmo: PlaneDragGizmo, node: SceneNode | null): void;
|
|
581
|
+
|
|
582
|
+
export declare function attachPlaneRotationGizmoToNode(gizmo: PlaneRotationGizmo, node: SceneNode | null): void;
|
|
583
|
+
|
|
584
|
+
export declare function attachPositionGizmoToNode(gizmo: PositionGizmo, node: SceneNode | null): void;
|
|
585
|
+
|
|
586
|
+
export declare function attachRotationGizmoToNode(gizmo: RotationGizmo, node: SceneNode | null): void;
|
|
587
|
+
|
|
588
|
+
export declare function attachScaleGizmoToNode(gizmo: ScaleGizmo, node: SceneNode | null): void;
|
|
589
|
+
|
|
445
590
|
/**
|
|
446
591
|
* Attaches a manager to a sprite renderer's update hooks so its animations advance each frame.
|
|
447
592
|
* @param renderer - Sprite renderer whose update loop drives the manager.
|
|
@@ -460,9 +605,76 @@ export declare function attachSpriteAnimationsToRenderer(renderer: SpriteRendere
|
|
|
460
605
|
*/
|
|
461
606
|
export declare function attachSpriteAnimationsToScene(scene: SceneContext, manager: SpriteAnimationManager): SpriteAnimationBinding;
|
|
462
607
|
|
|
608
|
+
/**
|
|
609
|
+
* Attach a baked VAT to a mesh: builds the settings UBO, sets `mesh.vat` (reusing the skeleton's
|
|
610
|
+
* joints/weights vertex buffers), and DROPS the live skeleton so it's no longer CPU-updated. Returns a
|
|
611
|
+
* handle that advances the animation clock.
|
|
612
|
+
*
|
|
613
|
+
* @param engine - Engine context.
|
|
614
|
+
* @param mesh - The mesh that was baked (still has `mesh.skeleton`).
|
|
615
|
+
* @param baked - The result of `bakeVat`.
|
|
616
|
+
* @param clip - Initial clip name to play (defaults to the first baked clip).
|
|
617
|
+
*/
|
|
618
|
+
export declare function attachVat(engine: EngineContext, mesh: Mesh, baked: VatBakeResult, clip?: string): VatHandle;
|
|
619
|
+
|
|
620
|
+
export declare interface AxisDragGizmo {
|
|
621
|
+
/** The root node — gizmo follows its `attachedNode` by copying world translation. */
|
|
622
|
+
readonly root: SceneNode;
|
|
623
|
+
/** Drag behaviour driving the pointer interaction. */
|
|
624
|
+
readonly drag: PointerDrag;
|
|
625
|
+
/** Fired whenever a drag delta is applied to the attached node. */
|
|
626
|
+
readonly onPositionChanged: GizmoObservable<Vec3>;
|
|
627
|
+
/** Currently attached node — set via `attachAxisDragGizmoToNode`. */
|
|
628
|
+
attachedNode: SceneNode | null;
|
|
629
|
+
/** When true, the gizmo's drag axis is rotated each frame by the attached
|
|
630
|
+
* node's world rotation (local-coord mode). When false (default), the
|
|
631
|
+
* drag axis stays world-aligned. Mirrors BJS
|
|
632
|
+
* `updateGizmoRotationToMatchAttachedMesh`. */
|
|
633
|
+
useLocalCoordinates: boolean;
|
|
634
|
+
/** Material triplet (colored / hover / disabled). Hover state is updated
|
|
635
|
+
* automatically during pointer-down on the collider. */
|
|
636
|
+
readonly materials: GizmoMaterialSet;
|
|
637
|
+
|
|
638
|
+
export declare interface AxisDragGizmoOptions {
|
|
639
|
+
/** World-space drag axis (unit vector). */
|
|
640
|
+
dragAxis: Vec3;
|
|
641
|
+
/** Material color of the rendered arrow. Defaults to grey. */
|
|
642
|
+
color?: [number, number, number];
|
|
643
|
+
/** Hover material colour (defaults to yellow). */
|
|
644
|
+
hoverColor?: [number, number, number];
|
|
645
|
+
/** Disabled-state material colour (defaults to grey, alpha 0.4). */
|
|
646
|
+
disableColor?: [number, number, number];
|
|
647
|
+
/** Multiplier applied to the rendered arrow's tube/cone thickness. */
|
|
648
|
+
thickness?: number;
|
|
649
|
+
}
|
|
650
|
+
|
|
463
651
|
/** A billboard sprite system that rotates only around a fixed world axis. */
|
|
464
652
|
export declare type AxisLockedBillboardSpriteSystem = BillboardSpriteSystem<"axis-locked">;
|
|
465
653
|
|
|
654
|
+
export declare interface AxisScaleGizmo {
|
|
655
|
+
readonly root: SceneNode;
|
|
656
|
+
readonly drag: PointerDrag;
|
|
657
|
+
readonly onScaleChanged: GizmoObservable<Vec3>;
|
|
658
|
+
attachedNode: SceneNode | null;
|
|
659
|
+
/** Local-coord mode: drag axis rotates with the attached node. */
|
|
660
|
+
useLocalCoordinates: boolean;
|
|
661
|
+
readonly materials: GizmoMaterialSet;
|
|
662
|
+
|
|
663
|
+
export declare interface AxisScaleGizmoOptions {
|
|
664
|
+
/** World-space drag axis (unit vector). Scaling is applied to the attached
|
|
665
|
+
* node's local `scaling` components proportional to each axis component. */
|
|
666
|
+
dragAxis: Vec3;
|
|
667
|
+
color?: [number, number, number];
|
|
668
|
+
hoverColor?: [number, number, number];
|
|
669
|
+
disableColor?: [number, number, number];
|
|
670
|
+
/** Tube thickness multiplier (visible only; collider gets +4). */
|
|
671
|
+
thickness?: number;
|
|
672
|
+
/** Optional multiplier on the per-frame drag strength. Default 1. */
|
|
673
|
+
sensitivity?: number;
|
|
674
|
+
/** When true, scale uniformly on all 3 axes (matches BJS uniformScaling). */
|
|
675
|
+
uniformScaling?: boolean;
|
|
676
|
+
}
|
|
677
|
+
|
|
466
678
|
/**
|
|
467
679
|
* Bakes the mesh's current world matrix into its splat vertices, then resets the mesh's
|
|
468
680
|
* position, rotation, and scaling to identity so the visual result is unchanged.
|
|
@@ -478,6 +690,17 @@ export declare function bakeCurrentTransformIntoVertices(mesh: GaussianSplatting
|
|
|
478
690
|
*/
|
|
479
691
|
export declare function bakeTransformIntoVertices(mesh: GaussianSplattingMesh, transform: Mat4): void;
|
|
480
692
|
|
|
693
|
+
/**
|
|
694
|
+
* Bake the given animation clips of a skinned mesh into a VAT texture. The clips are laid out as
|
|
695
|
+
* contiguous row blocks (clip 0 first), one texture row per frame. The mesh must still have its live
|
|
696
|
+
* `skeleton` at bake time (the bone matrices are read from it as each frame is evaluated).
|
|
697
|
+
*
|
|
698
|
+
* @param engine - Engine context.
|
|
699
|
+
* @param mesh - The skinned source mesh (must have `mesh.skeleton`).
|
|
700
|
+
* @param groups - The animation clips to bake (e.g. a creature's gait clips).
|
|
701
|
+
*/
|
|
702
|
+
export declare function bakeVat(engine: EngineContext, mesh: Mesh, groups: AnimationGroup[]): VatBakeResult;
|
|
703
|
+
|
|
481
704
|
/**
|
|
482
705
|
* Additive blending for world-space billboards. The billboard's RGB, scaled by its own alpha, is
|
|
483
706
|
* added to the framebuffer (no depth write, like the other transparent modes), so overlapping
|
|
@@ -637,6 +860,27 @@ export declare interface BlurPostProcessTaskConfig extends Omit<PostProcessTaskC
|
|
|
637
860
|
kernel?: number;
|
|
638
861
|
}
|
|
639
862
|
|
|
863
|
+
export declare interface BoundingBoxGizmo {
|
|
864
|
+
readonly root: SceneNode;
|
|
865
|
+
/** Currently attached node — set via `attachBoundingBoxGizmoToNode`. */
|
|
866
|
+
attachedNode: SceneNode | null;
|
|
867
|
+
/** Fires when any drag (scale / rotate / translate) updates the attached node. */
|
|
868
|
+
readonly onChanged: GizmoObservable<void>;
|
|
869
|
+
/** Material used to render all gizmo geometry. */
|
|
870
|
+
readonly material: StandardMaterialProps;
|
|
871
|
+
|
|
872
|
+
export declare interface BoundingBoxGizmoOptions {
|
|
873
|
+
/** RGB colour for the wireframe + handle materials. Defaults to grey. */
|
|
874
|
+
color?: [number, number, number];
|
|
875
|
+
/** Edge wireframe thickness (world units before scaling). Default 0.06. */
|
|
876
|
+
edgeThickness?: number;
|
|
877
|
+
/** Side length of the 8 corner scale boxes (world units). Default 0.18. */
|
|
878
|
+
scaleBoxSize?: number;
|
|
879
|
+
/** Length of the 12 elongated edge rotation anchors (world units). Default
|
|
880
|
+
* 0.16; thickness is length/4 (BJS 1.6:0.4 ratio). */
|
|
881
|
+
rotationAnchorSize?: number;
|
|
882
|
+
}
|
|
883
|
+
|
|
640
884
|
/** Minimal camera contract — any camera that can provide view/projection matrices.
|
|
641
885
|
* Both ArcRotateCamera and FreeCamera implement this interface.
|
|
642
886
|
* Pure state, no scene knowledge (pillar 4b).
|
|
@@ -655,6 +899,30 @@ export declare interface Camera {
|
|
|
655
899
|
readonly worldMatrix: Mat4;
|
|
656
900
|
readonly worldMatrixVersion: number;
|
|
657
901
|
|
|
902
|
+
export declare interface CameraGizmo {
|
|
903
|
+
/** Root node — the gizmo follows the attached camera's world translation
|
|
904
|
+
* and orientation each frame. */
|
|
905
|
+
readonly root: SceneNode;
|
|
906
|
+
/** Material shared by the body + frustum. Mutate `diffuseColor` to recolor. */
|
|
907
|
+
readonly material: StandardMaterialProps;
|
|
908
|
+
/** Alias of `material` — kept for backward compatibility with callers
|
|
909
|
+
* that mutated `frustumMaterial` against the older variant. */
|
|
910
|
+
readonly frustumMaterial: StandardMaterialProps;
|
|
911
|
+
/** Currently attached camera — set via `attachCameraGizmoToCamera`. */
|
|
912
|
+
attachedCamera: Camera | null;
|
|
913
|
+
|
|
914
|
+
export declare interface CameraGizmoOptions {
|
|
915
|
+
/** RGB color for the camera body + frustum material. Defaults to grey. */
|
|
916
|
+
color?: [number, number, number];
|
|
917
|
+
/** RGB color for the frustum wireframe edges (alias of `color` kept for
|
|
918
|
+
* backward compatibility with the previous tube-body variant). */
|
|
919
|
+
frustumColor?: [number, number, number];
|
|
920
|
+
/** Set to false to omit the frustum wireframe. Defaults to true. */
|
|
921
|
+
displayFrustum?: boolean;
|
|
922
|
+
/** Set to false to omit the camera body mesh (box + cylinders). Default true. */
|
|
923
|
+
displayBody?: boolean;
|
|
924
|
+
}
|
|
925
|
+
|
|
658
926
|
/** Cap mode: close both ends of the tube/extrusion. */
|
|
659
927
|
export declare const CAP_ALL = 3;
|
|
660
928
|
|
|
@@ -667,6 +935,71 @@ export declare const CAP_NONE = 0;
|
|
|
667
935
|
/** Cap mode: close only the start of the tube/extrusion. */
|
|
668
936
|
export declare const CAP_START = 1;
|
|
669
937
|
|
|
938
|
+
/**
|
|
939
|
+
* CreateCapsule — matches Babylon.js MeshBuilder.CreateCapsule default options.
|
|
940
|
+
*
|
|
941
|
+
* Generates a capsule (a cylinder capped by two hemispheres) or a "pill" when
|
|
942
|
+
* `radiusTop`/`radiusBottom` differ. Vertex/normal/UV generation and index
|
|
943
|
+
* winding are ported verbatim from `@babylonjs/core/Meshes/Builders/capsuleBuilder.js`
|
|
944
|
+
* to guarantee parity. The default Y-up orientation is used (the `orientation`
|
|
945
|
+
* remap of the Babylon builder is intentionally omitted to keep the API small).
|
|
946
|
+
*/
|
|
947
|
+
/** Geometry buffers produced by {@link createCapsuleData}. */
|
|
948
|
+
export declare interface CapsuleData {
|
|
949
|
+
positions: Float32Array;
|
|
950
|
+
normals: Float32Array;
|
|
951
|
+
uvs: Float32Array;
|
|
952
|
+
indices: Uint32Array;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/** Options for `createCapsuleData`. Subset of Babylon's CreateCapsule. */
|
|
956
|
+
export declare interface CapsuleOptions {
|
|
957
|
+
/** Total height of the capsule including both caps. Default 1. */
|
|
958
|
+
height?: number;
|
|
959
|
+
/** Radius of the cylindrical body and both caps. Default 0.25. */
|
|
960
|
+
radius?: number;
|
|
961
|
+
/** Radius of the top cap; defaults to `radius`. */
|
|
962
|
+
radiusTop?: number;
|
|
963
|
+
/** Radius of the bottom cap; defaults to `radius`. */
|
|
964
|
+
radiusBottom?: number;
|
|
965
|
+
/** Number of radial segments around the capsule. Default 16. */
|
|
966
|
+
tessellation?: number;
|
|
967
|
+
/** Number of height segments along the cylindrical body. Default 2. */
|
|
968
|
+
subdivisions?: number;
|
|
969
|
+
/** Number of segments per cap; defaults applied to both caps. Default 6. */
|
|
970
|
+
capSubdivisions?: number;
|
|
971
|
+
/** Number of segments for the top cap; defaults to `capSubdivisions`. */
|
|
972
|
+
topCapSubdivisions?: number;
|
|
973
|
+
/** Number of segments for the bottom cap; defaults to `capSubdivisions`. */
|
|
974
|
+
bottomCapSubdivisions?: number;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Capture the current canvas backbuffer of a {@link SurfaceContext} — the final presented
|
|
979
|
+
* frame (post-processing and all) with NO HTML/DOM overlay, since those are never drawn
|
|
980
|
+
* into the canvas.
|
|
981
|
+
*
|
|
982
|
+
* Pass `engine` to capture the engine's primary surface (the canvas given to `createEngine`),
|
|
983
|
+
* or pass an auxiliary surface returned by `createSurface` to capture that canvas. Each
|
|
984
|
+
* surface owns its own capture queue and COPY_SRC swapchain state, so surfaces that never
|
|
985
|
+
* capture stay compression-friendly even when another surface on the same engine is being
|
|
986
|
+
* captured every frame.
|
|
987
|
+
*
|
|
988
|
+
* The read is scheduled on a rendered frame: the copy is recorded into that frame's command
|
|
989
|
+
* encoder (so it reads a valid, just-rendered swapchain texture), then the staging buffer is
|
|
990
|
+
* mapped after submit and the pixels are unpacked. Requires a running render loop
|
|
991
|
+
* (`startEngine`); the returned promise resolves once the readback completes.
|
|
992
|
+
*
|
|
993
|
+
* Multiple calls queued on the same surface before the next serviced frame share a single
|
|
994
|
+
* GPU copy and all resolve with the same image.
|
|
995
|
+
*
|
|
996
|
+
* The readback implementation is loaded lazily on the first call, so engines whose surfaces
|
|
997
|
+
* never capture a screenshot ship none of it. The surface's swapchain stays a plain,
|
|
998
|
+
* compression-friendly RENDER_ATTACHMENT surface until the first capture is queued, at which
|
|
999
|
+
* point `renderFrame` reconfigures it once with COPY_SRC (before acquiring that frame's texture).
|
|
1000
|
+
*/
|
|
1001
|
+
export declare function captureScreenshot(surface: SurfaceContext): Promise<Screenshot>;
|
|
1002
|
+
|
|
670
1003
|
/** A post-process task that offsets the red/green/blue channels to simulate lens chromatic aberration. */
|
|
671
1004
|
export declare interface ChromaticAberrationPostProcessTask extends PostProcessTask {
|
|
672
1005
|
aberrationAmount: number;
|
|
@@ -683,6 +1016,57 @@ export declare interface ChromaticAberrationPostProcessTaskConfig extends Omit<P
|
|
|
683
1016
|
centerPosition?: PostProcessVec2_2;
|
|
684
1017
|
}
|
|
685
1018
|
|
|
1019
|
+
/** A post-process task that writes the per-pixel circle-of-confusion (grayscale)
|
|
1020
|
+
* derived from scene depth and the lens focus parameters. */
|
|
1021
|
+
export declare interface CircleOfConfusionPostProcessTask extends PostProcessTask {
|
|
1022
|
+
lensSize: number;
|
|
1023
|
+
fStop: number;
|
|
1024
|
+
focusDistance: number;
|
|
1025
|
+
focalLength: number;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Configuration for `createCircleOfConfusionPostProcessTask`.
|
|
1030
|
+
*
|
|
1031
|
+
* Models Babylon.js's `FrameGraphCircleOfConfusionTask` +
|
|
1032
|
+
* `ThinCircleOfConfusionPostProcess`.
|
|
1033
|
+
*/
|
|
1034
|
+
export declare interface CircleOfConfusionPostProcessTaskConfig extends Omit<PostProcessTaskConfig, "_shader"> {
|
|
1035
|
+
/** Depth texture supplying per-pixel scene depth. With `depthNotNormalized`
|
|
1036
|
+
* it must store **camera-space (view) depth** (the geometry renderer's
|
|
1037
|
+
* VIEW_DEPTH attachment); otherwise it stores normalized [0,1] view depth. */
|
|
1038
|
+
depthTexture: RenderTarget;
|
|
1039
|
+
/** Camera used to read minZ/maxZ when the depth is normalized. */
|
|
1040
|
+
camera: Camera;
|
|
1041
|
+
/** Max lens size in scene units / 1000 (e.g. mm). Standard cameras are 50mm. Default 50. */
|
|
1042
|
+
lensSize?: number;
|
|
1043
|
+
/** F-Stop of the camera. Aperture diameter = lensSize / fStop. Default 1.4. */
|
|
1044
|
+
fStop?: number;
|
|
1045
|
+
/** Distance from the camera to focus on, in scene units / 1000. Default 2000. */
|
|
1046
|
+
focusDistance?: number;
|
|
1047
|
+
/** Focal length of the camera in scene units / 1000. Default 50. */
|
|
1048
|
+
focalLength?: number;
|
|
1049
|
+
/** When true the depth texture stores camera-space depth (0..maxZ) rather
|
|
1050
|
+
* than normalized [0,1] depth, skipping the `cameraMinMaxZ` reconstruction. */
|
|
1051
|
+
depthNotNormalized?: boolean;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Clamp the camera centre away from the geographic poles (in place), so the
|
|
1056
|
+
* tangent basis stays well-defined. Mirrors Babylon.js `ClampCenterFromPolesInPlace`.
|
|
1057
|
+
*/
|
|
1058
|
+
export declare function clampCenterFromPoles(center: Vec3): Vec3;
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Clamps a requested zoom distance so it respects the radius limits.
|
|
1062
|
+
* @param limits - The geospatial limits.
|
|
1063
|
+
* @param zoomDistance - Requested zoom (positive = zoom in, negative = zoom out).
|
|
1064
|
+
* @param currentRadius - Current camera radius.
|
|
1065
|
+
* @param distanceToTarget - Optional distance to the zoom target point (used for zoom-in clamping).
|
|
1066
|
+
* @returns The clamped zoom distance.
|
|
1067
|
+
*/
|
|
1068
|
+
export declare function clampZoomDistance(limits: GeospatialLimits, zoomDistance: number, currentRadius: number, distanceToTarget?: number): number;
|
|
1069
|
+
|
|
686
1070
|
/** Removes and disposes every task attached to `manager`. */
|
|
687
1071
|
export declare function clearAnimationManager(manager: AnimationManager): void;
|
|
688
1072
|
|
|
@@ -717,6 +1101,9 @@ export declare interface ClearCoatProps {
|
|
|
717
1101
|
useF0Remap?: boolean;
|
|
718
1102
|
}
|
|
719
1103
|
|
|
1104
|
+
/** Clear sampler cache for a device. */
|
|
1105
|
+
export declare function clearSamplerCache(engine: EngineContext): void;
|
|
1106
|
+
|
|
720
1107
|
/** Clear all sprites from a layer while preserving allocated capacity. */
|
|
721
1108
|
export declare function clearSprite2DLayer(layer: Sprite2DLayer): void;
|
|
722
1109
|
|
|
@@ -798,9 +1185,80 @@ export declare interface ClusteredPointLightOptions {
|
|
|
798
1185
|
intensity?: number;
|
|
799
1186
|
}
|
|
800
1187
|
|
|
1188
|
+
/**
|
|
1189
|
+
* Build the east/north/up orthonormal basis at a point on the globe (left-handed
|
|
1190
|
+
* convention). `up` is the geocentric normal (normalized position); `east` and
|
|
1191
|
+
* `north` complete a right-handed-looking tangent frame given the LH world.
|
|
1192
|
+
* Writes into the provided result objects and returns nothing.
|
|
1193
|
+
*/
|
|
1194
|
+
export declare function computeLocalBasis(worldPos: Vec3, refEast: Vec3, refNorth: Vec3, refUp: Vec3): void;
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* Compute the lookAt direction from yaw/pitch at a centre point (forward formula).
|
|
1198
|
+
* Writes the normalized direction into `result`.
|
|
1199
|
+
*/
|
|
1200
|
+
export declare function computeLookAtFromYawPitch(yaw: number, pitch: number, center: Vec3, result: Vec3): Vec3;
|
|
1201
|
+
|
|
801
1202
|
/** Compute a path between two world positions, snapped to the navmesh. */
|
|
802
1203
|
export declare function computePath(plugin: NavigationPlugin, start: Vec3, end: Vec3): Vec3[];
|
|
803
1204
|
|
|
1205
|
+
/**
|
|
1206
|
+
* Inverse of {@link computeLookAtFromYawPitch}: given a lookAt direction and centre,
|
|
1207
|
+
* recover the yaw/pitch that would produce it. Writes `[yaw, pitch]` into `result`.
|
|
1208
|
+
* `currentYaw` is used as a fallback when looking straight down/up (yaw undefined).
|
|
1209
|
+
*/
|
|
1210
|
+
export declare function computeYawPitchFromLookAt(lookAt: Vec3, center: Vec3, currentYaw: number, result: {
|
|
1211
|
+
x: number;
|
|
1212
|
+
y: number;
|
|
1213
|
+
}): {
|
|
1214
|
+
x: number;
|
|
1215
|
+
y: number;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
export declare interface CopyToTextureTask extends Task {
|
|
1219
|
+
readonly name: string;
|
|
1220
|
+
sourceTexture: RenderTarget;
|
|
1221
|
+
targetTexture: RenderTarget | undefined;
|
|
1222
|
+
resolveTexture: RenderTarget | undefined;
|
|
1223
|
+
viewport: NormalizedViewport | null | undefined;
|
|
1224
|
+
lodLevel: number;
|
|
1225
|
+
/** `resolveTexture` if set, otherwise `targetTexture`. Kept for API parity
|
|
1226
|
+
* with BJS `FrameGraphCopyToTextureTask.outputTexture`. */
|
|
1227
|
+
readonly outputTexture: RenderTarget;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
export declare interface CopyToTextureTaskConfig {
|
|
1231
|
+
name?: string;
|
|
1232
|
+
sourceTexture: RenderTarget;
|
|
1233
|
+
/** Target attachment that receives the blit. Required UNLESS `resolveTexture`
|
|
1234
|
+
* is set, in which case the task does a resolve-only operation and writes
|
|
1235
|
+
* directly into `resolveTexture`. */
|
|
1236
|
+
targetTexture?: RenderTarget;
|
|
1237
|
+
/** Viewport applied to the target before the blit. When undefined (default),
|
|
1238
|
+
* the whole target is overwritten and the encoder-copy fast path becomes
|
|
1239
|
+
* available. When set, the blit path is used. */
|
|
1240
|
+
viewport?: NormalizedViewport | null;
|
|
1241
|
+
/** Source mip level to copy from. Default 0. The fast path uses this as
|
|
1242
|
+
* the source `mipLevel`; the blit path samples with `textureSampleLevel`. */
|
|
1243
|
+
lodLevel?: number;
|
|
1244
|
+
/** Optional single-sample texture that receives a hardware MSAA-resolve of
|
|
1245
|
+
* the task's MSAA color attachment at end-of-pass. Two modes:
|
|
1246
|
+
*
|
|
1247
|
+
* - Blit + resolve: `targetTexture` is MSAA and `resolveTexture` is SS.
|
|
1248
|
+
* The shader blit writes into `targetTexture` and at end-of-pass the
|
|
1249
|
+
* GPU resolves `targetTexture` into `resolveTexture`.
|
|
1250
|
+
*
|
|
1251
|
+
* - Resolve-only: `targetTexture` is omitted. The task runs a no-draw
|
|
1252
|
+
* render pass with `sourceTexture` as the color attachment (so the
|
|
1253
|
+
* source itself must be MSAA) and `resolveTexture` as its resolve
|
|
1254
|
+
* target. `viewport` and `lodLevel` are ignored. `sourceTexture` and
|
|
1255
|
+
* `resolveTexture` must have matching dimensions.
|
|
1256
|
+
*
|
|
1257
|
+
* In both modes, `resolveTexture.format` must match the MSAA
|
|
1258
|
+
* attachment's format and `resolveTexture` must be single-sample. */
|
|
1259
|
+
resolveTexture?: RenderTarget;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
804
1262
|
/**
|
|
805
1263
|
* Create a post-process task that merges a left-eye texture with the source (right eye) into a red/cyan anaglyph.
|
|
806
1264
|
* @param config - Source/target settings and the left-eye `leftTexture`.
|
|
@@ -834,6 +1292,10 @@ export declare function createAnimationTask(update: AnimationTaskUpdate, options
|
|
|
834
1292
|
/** Create a bare ArcRotateCamera with given params. Pure data, no scene knowledge. */
|
|
835
1293
|
export declare function createArcRotateCamera(alpha: number, beta: number, radius: number, target: Vec3): ArcRotateCamera;
|
|
836
1294
|
|
|
1295
|
+
/** Build an axis-drag gizmo and attach it to the given utility layer. Call
|
|
1296
|
+
* `attachAxisDragGizmoToNode` to bind it to a node so it follows + drives it. */
|
|
1297
|
+
export declare function createAxisDragGizmo(engine: EngineContext, layer: UtilityLayer, options: AxisDragGizmoOptions): AxisDragGizmo;
|
|
1298
|
+
|
|
837
1299
|
/**
|
|
838
1300
|
* Creates a billboard sprite system whose quads rotate only around a fixed world axis.
|
|
839
1301
|
* @param atlas - Sprite atlas supplying frames.
|
|
@@ -844,6 +1306,8 @@ export declare function createArcRotateCamera(alpha: number, beta: number, radiu
|
|
|
844
1306
|
*/
|
|
845
1307
|
export declare function createAxisLockedBillboardSystem(atlas: SpriteAtlas, axis: readonly [number, number, number], opts?: BillboardSpriteSystemOptions): AxisLockedBillboardSpriteSystem;
|
|
846
1308
|
|
|
1309
|
+
export declare function createAxisScaleGizmo(engine: EngineContext, layer: UtilityLayer, options: AxisScaleGizmoOptions): AxisScaleGizmo;
|
|
1310
|
+
|
|
847
1311
|
/**
|
|
848
1312
|
* Build a custom-shader descriptor to pass as `customShader` when creating a billboard system.
|
|
849
1313
|
* The descriptor is opaque; the pipeline consumes it lazily.
|
|
@@ -877,9 +1341,38 @@ export declare function createBloomPostProcessTask(config: BloomPostProcessTaskC
|
|
|
877
1341
|
*/
|
|
878
1342
|
export declare function createBlurPostProcessTask(config: BlurPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): BlurPostProcessTask;
|
|
879
1343
|
|
|
1344
|
+
export declare function createBoundingBoxGizmo(engine: EngineContext, layer: UtilityLayer, options?: BoundingBoxGizmoOptions): BoundingBoxGizmo;
|
|
1345
|
+
|
|
880
1346
|
/** Create a box mesh. Caller must assign material. */
|
|
881
1347
|
export declare function createBox(engine: EngineContext, size?: number): Mesh;
|
|
882
1348
|
|
|
1349
|
+
/** Build a display-only camera gizmo and attach it to the given utility
|
|
1350
|
+
* layer. Call `attachCameraGizmoToCamera` to bind a camera.
|
|
1351
|
+
*
|
|
1352
|
+
* The gizmo has two independently-toggleable parts, both visible by default
|
|
1353
|
+
* and parented to a root that follows the attached camera's world translation
|
|
1354
|
+
* + orientation each frame:
|
|
1355
|
+
*
|
|
1356
|
+
* - A camera **body** (`displayBody`, defaults to `true`) — a distance-scaled
|
|
1357
|
+
* box + 3 cylinders ported from BJS `_CreateCameraMesh`, lit grey, sized
|
|
1358
|
+
* so it stays a roughly constant size on screen.
|
|
1359
|
+
* - A camera **frustum** (`displayFrustum`, defaults to `true`) — 12 thin
|
|
1360
|
+
* cylinder edges forming a truncated-pyramid wireframe sized from the
|
|
1361
|
+
* camera's fov / near / far (far clamped to 60× near), unlit white.
|
|
1362
|
+
*
|
|
1363
|
+
* Set the matching option to `false` to display only one of them. */
|
|
1364
|
+
export declare function createCameraGizmo(engine: EngineContext, layer: UtilityLayer, options?: CameraGizmoOptions): CameraGizmo;
|
|
1365
|
+
|
|
1366
|
+
/** Create a capsule (cylinder capped by two hemispheres) mesh. Caller must assign material. */
|
|
1367
|
+
export declare function createCapsule(engine: EngineContext, options?: CapsuleOptions): Mesh;
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Build capsule geometry data.
|
|
1371
|
+
* @param options - Capsule dimensions and tessellation.
|
|
1372
|
+
* @returns Positions, normals, UVs, and indices for the capsule mesh.
|
|
1373
|
+
*/
|
|
1374
|
+
export declare function createCapsuleData(options?: CapsuleOptions): CapsuleData;
|
|
1375
|
+
|
|
883
1376
|
/**
|
|
884
1377
|
* Create a post-process task that simulates chromatic aberration by shifting color channels outward from a center point.
|
|
885
1378
|
* @param config - Aberration parameters and source/target settings.
|
|
@@ -889,6 +1382,19 @@ export declare function createBox(engine: EngineContext, size?: number): Mesh;
|
|
|
889
1382
|
*/
|
|
890
1383
|
export declare function createChromaticAberrationPostProcessTask(config: ChromaticAberrationPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): ChromaticAberrationPostProcessTask;
|
|
891
1384
|
|
|
1385
|
+
/**
|
|
1386
|
+
* Create a circle-of-confusion post-process task. The output is a grayscale map
|
|
1387
|
+
* where 0 = in focus and 1 = maximally out of focus, computed from the supplied
|
|
1388
|
+
* depth texture and the lens parameters (the usual first stage of a depth-of-field
|
|
1389
|
+
* pipeline). See https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch23.html.
|
|
1390
|
+
*
|
|
1391
|
+
* @param config - Depth texture, camera, lens parameters and source/target settings.
|
|
1392
|
+
* @param engine - The owning engine.
|
|
1393
|
+
* @param scene - Optional owning scene. Omit for scene-less standalone frame graphs.
|
|
1394
|
+
* @returns The circle-of-confusion post-process task.
|
|
1395
|
+
*/
|
|
1396
|
+
export declare function createCircleOfConfusionPostProcessTask(config: CircleOfConfusionPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): CircleOfConfusionPostProcessTask;
|
|
1397
|
+
|
|
892
1398
|
/**
|
|
893
1399
|
* Create an empty {@link ClusteredLightContainer}. Add point lights with
|
|
894
1400
|
* {@link createClusteredPointLight}, then register it on a scene via
|
|
@@ -909,6 +1415,8 @@ export declare function createClusteredLightContainer(options?: ClusteredLightCo
|
|
|
909
1415
|
*/
|
|
910
1416
|
export declare function createClusteredPointLight(container: ClusteredLightContainer, options: ClusteredPointLightOptions): ClusteredPointLight;
|
|
911
1417
|
|
|
1418
|
+
export declare function createCopyToTextureTask(config: CopyToTextureTaskConfig, engine: EngineContext, scene: SceneContext): CopyToTextureTask;
|
|
1419
|
+
|
|
912
1420
|
/**
|
|
913
1421
|
* Builds a {@link Csg2Solid} from a mesh's CPU geometry, baking its world transform.
|
|
914
1422
|
* @param mesh - Source mesh; must retain CPU positions, normals, and indices.
|
|
@@ -944,6 +1452,8 @@ export declare function createCsmDirectionalShadowGenerator(engine: EngineContex
|
|
|
944
1452
|
/** Create a cylinder (or cone / truncated cone / prism) mesh. Caller must assign material. */
|
|
945
1453
|
export declare function createCylinder(engine: EngineContext, options?: CylinderOptions): Mesh;
|
|
946
1454
|
|
|
1455
|
+
export declare function createCylinderData(options?: CylinderOptions): CylinderData;
|
|
1456
|
+
|
|
947
1457
|
/**
|
|
948
1458
|
* Extract debug visualization geometry from the generated navmesh.
|
|
949
1459
|
* Faces are detached (each triangle gets its own 3 vertices) and per-vertex
|
|
@@ -964,6 +1474,28 @@ export declare function createDebugNavMeshGeometry(plugin: NavigationPlugin): {
|
|
|
964
1474
|
* Matches Babylon.js createDefaultCameraOrLight(true, true, true). */
|
|
965
1475
|
export declare function createDefaultCamera(scene: SceneContext): ArcRotateCamera;
|
|
966
1476
|
|
|
1477
|
+
/** Shape `text` with the default layout, extract glyph curves, and bundle into a
|
|
1478
|
+
* `DefaultTextData`. `textColor` is applied as the run's defaultColor (per-glyph color
|
|
1479
|
+
* overrides remain available via direct `updateTextData(replaceRun)` calls).
|
|
1480
|
+
*
|
|
1481
|
+
* The returned `DefaultTextData` owns its underlying `GlyphStorage` — release both with
|
|
1482
|
+
* `disposeDefaultTextData(data)`. */
|
|
1483
|
+
export declare function createDefaultTextData(font: Font, fontSizePx: number, text: string, textColor?: readonly [number, number, number, number], options?: TextLayoutOptions): DefaultTextData;
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Create a depth-of-field post-process task. The source image is first reduced
|
|
1487
|
+
* to a circle-of-confusion map (from the depth texture + lens parameters), then
|
|
1488
|
+
* blurred at one to three decreasing resolutions with CoC-weighted blurs, and
|
|
1489
|
+
* finally merged so each pixel transitions smoothly from sharp to blurred based
|
|
1490
|
+
* on how far out of focus it is.
|
|
1491
|
+
*
|
|
1492
|
+
* @param config - Source/depth textures, camera, lens parameters, blur level, and target settings.
|
|
1493
|
+
* @param engine - The owning engine.
|
|
1494
|
+
* @param scene - Optional owning scene. Omit for scene-less standalone frame graphs.
|
|
1495
|
+
* @returns The depth-of-field post-process task.
|
|
1496
|
+
*/
|
|
1497
|
+
export declare function createDepthOfFieldPostProcessTask(config: DepthOfFieldPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): DepthOfFieldPostProcessTask;
|
|
1498
|
+
|
|
967
1499
|
/**
|
|
968
1500
|
* Creates a directional light shining along `direction` (a parallel light source, like the sun).
|
|
969
1501
|
* @param direction - World-space direction the light travels along.
|
|
@@ -983,7 +1515,7 @@ export declare function createDisc(engine: EngineContext, options?: DiscOptions)
|
|
|
983
1515
|
* Call `registerEffectRenderer` to start rendering, `unregisterEffectRenderer`
|
|
984
1516
|
* to pause, and `disposeEffectRenderer` to free GPU resources.
|
|
985
1517
|
*/
|
|
986
|
-
export declare function createEffectRenderer(
|
|
1518
|
+
export declare function createEffectRenderer(surface: SurfaceContext, effect: EffectWrapper, options?: EffectRendererOptions): EffectRenderer;
|
|
987
1519
|
|
|
988
1520
|
/**
|
|
989
1521
|
* Create a frame-graph task that draws an effect as a fullscreen pass into `config.target`.
|
|
@@ -1003,9 +1535,15 @@ export declare function createEffectRenderTask(config: EffectRenderTaskConfig, e
|
|
|
1003
1535
|
*/
|
|
1004
1536
|
export declare function createEffectWrapper(engine: EngineContext, options: EffectWrapperOptions): EffectWrapper;
|
|
1005
1537
|
|
|
1006
|
-
/** Create the Babylon Lite engine
|
|
1007
|
-
*
|
|
1008
|
-
*
|
|
1538
|
+
/** Create the Babylon Lite engine bound to `canvas`. Acquires the GPU adapter + device,
|
|
1539
|
+
* configures the canvas's WebGPU context, and returns an `EngineContext` that *is also*
|
|
1540
|
+
* the primary `SurfaceContext` — i.e. the returned engine is itself the surface for the
|
|
1541
|
+
* given canvas. Additional canvases can be attached afterwards via
|
|
1542
|
+
* `createSurface(engine, otherCanvas, ...)`; they share device-scoped GPU resources
|
|
1543
|
+
* (textures, meshes, pipelines, bind groups) with the engine and with each other.
|
|
1544
|
+
*
|
|
1545
|
+
* Accepts either a DOM canvas (main thread) or an `OffscreenCanvas` (e.g. transferred
|
|
1546
|
+
* to a Web Worker) — see {@link RenderCanvas}. */
|
|
1009
1547
|
export declare function createEngine(canvas: RenderCanvas, options?: EngineOptions): Promise<EngineContext>;
|
|
1010
1548
|
|
|
1011
1549
|
/**
|
|
@@ -1038,12 +1576,32 @@ export declare function createExtrudeShape(engine: EngineContext, options: Extru
|
|
|
1038
1576
|
*/
|
|
1039
1577
|
export declare function createFacingBillboardSystem(atlas: SpriteAtlas, opts?: BillboardSpriteSystemOptions): FacingBillboardSpriteSystem;
|
|
1040
1578
|
|
|
1041
|
-
/**
|
|
1042
|
-
export declare function
|
|
1579
|
+
/** Build a `Font` from an in-memory TTF/OTF buffer. */
|
|
1580
|
+
export declare function createFontFromBuffer(data: ArrayBuffer): Font;
|
|
1581
|
+
|
|
1582
|
+
/** Create a scene-less frame-graph context bound to `surface`, for fullscreen effects
|
|
1583
|
+
* and post-process chains. Pass the engine directly for the single-canvas case (since
|
|
1584
|
+
* `EngineContext extends SurfaceContext`); pass an auxiliary surface for multi-canvas. */
|
|
1585
|
+
export declare function createFrameGraphContext(surface: SurfaceContext, options?: FrameGraphContextOptions): FrameGraphContext;
|
|
1043
1586
|
|
|
1044
1587
|
/** Create a FreeCamera at the given position looking at target. Pure data, no scene knowledge. */
|
|
1045
1588
|
export declare function createFreeCamera(position: Vec3, target: Vec3): FreeCamera;
|
|
1046
1589
|
|
|
1590
|
+
/** Create a geometry-renderer task. All GPU resources are allocated lazily
|
|
1591
|
+
* during the first `record()` call (when the frame graph is built). */
|
|
1592
|
+
export declare function createGeometryRendererTask(config: GeometryRendererTaskConfig, engine: EngineContext, scene: SceneContext): GeometryRendererTask;
|
|
1593
|
+
|
|
1594
|
+
/** Create a {@link GeospatialCamera} for a planet of the given radius. Pure data, no scene knowledge. */
|
|
1595
|
+
export declare function createGeospatialCamera(options: GeospatialCameraOptions): GeospatialCamera;
|
|
1596
|
+
|
|
1597
|
+
/** Create geospatial limits for a planet of the given radius, matching Babylon.js defaults. */
|
|
1598
|
+
export declare function createGeospatialLimits(planetRadius: number): GeospatialLimits;
|
|
1599
|
+
|
|
1600
|
+
/** Build a `GlyphStorage`. If `initial` is provided, each curve-set is packed into its
|
|
1601
|
+
* own atlas synchronously. The passed inner maps are *adopted* by the storage — the
|
|
1602
|
+
* caller must not mutate them directly afterward (use `updateGlyphStorage` instead). */
|
|
1603
|
+
export declare function createGlyphStorage(initial?: Map<CurveSetId, Map<number, GlyphCurves>>): GlyphStorage;
|
|
1604
|
+
|
|
1047
1605
|
/** Create a GPU picker bound to the given scene. */
|
|
1048
1606
|
export declare function createGpuPicker(scene: SceneContext): GpuPicker;
|
|
1049
1607
|
|
|
@@ -1080,9 +1638,21 @@ export declare function createGroundFromHeightMap(engine: EngineContext, url: st
|
|
|
1080
1638
|
* const hknp = await HavokPhysics({ locateFile: () => "/HavokPhysics.wasm" });
|
|
1081
1639
|
* const world = createHavokWorld(scene, hknp);
|
|
1082
1640
|
* ```
|
|
1641
|
+
*
|
|
1642
|
+
* For Large World Rendering, call {@link enableHavokFloatingOrigin} on the returned world (before
|
|
1643
|
+
* creating any bodies) to opt into multi-region floating-origin simulation.
|
|
1083
1644
|
*/
|
|
1084
1645
|
export declare function createHavokWorld(scene: SceneContext, hknp: any, gravity?: Vec3): PhysicsWorld;
|
|
1085
1646
|
|
|
1647
|
+
/**
|
|
1648
|
+
* Create a Havok heightfield collision shape. Attach it to a STATIC body bound to the
|
|
1649
|
+
* ground mesh so the heightfield aligns with the visible terrain.
|
|
1650
|
+
* @param world - The physics world.
|
|
1651
|
+
* @param options - Ground mesh source or explicit heightfield parameters.
|
|
1652
|
+
* @returns The created shape handle.
|
|
1653
|
+
*/
|
|
1654
|
+
export declare function createHeightFieldShape(world: PhysicsWorld, options: HeightFieldShapeOptions): PhysicsShape;
|
|
1655
|
+
|
|
1086
1656
|
/** Create a hemispheric light. Returns plain data — caller adds to scene.
|
|
1087
1657
|
* Matches Babylon.js HemisphericLight behavior. */
|
|
1088
1658
|
export declare function createHemisphericLight(direction?: [number, number, number], intensity?: number): HemisphericLight;
|
|
@@ -1097,6 +1667,11 @@ export declare function createHemisphericLight(direction?: [number, number, numb
|
|
|
1097
1667
|
*/
|
|
1098
1668
|
export declare function createImageProcessingTask(config: ImageProcessingTaskConfig, engine: EngineContext, scene: SceneContext): Task;
|
|
1099
1669
|
|
|
1670
|
+
/** Build a display-only light gizmo and attach it to the utility layer. The
|
|
1671
|
+
* per-light-type geometry is built lazily on the first `attachLightGizmoToLight`
|
|
1672
|
+
* (since the light type isn't known until then). */
|
|
1673
|
+
export declare function createLightGizmo(engine: EngineContext, layer: UtilityLayer, options?: LightGizmoOptions): LightGizmo;
|
|
1674
|
+
|
|
1100
1675
|
/** Create a linear-depth ShaderMaterial that writes `(d, d, d, 1)` per fragment.
|
|
1101
1676
|
* The depth is computed from the view-space z, normalized by the supplied
|
|
1102
1677
|
* near/far range (or 0.03/15 by default). Override per material via the
|
|
@@ -1176,6 +1751,11 @@ export declare function createNavigationPluginAsync(options?: {
|
|
|
1176
1751
|
*/
|
|
1177
1752
|
export declare function createNavMesh(plugin: NavigationPlugin, meshes: Mesh[], params: NavMeshParameters): void;
|
|
1178
1753
|
|
|
1754
|
+
/** Build a navmesh from raw CPU geometry sources. This is the non-rendering twin of
|
|
1755
|
+
* `createNavMesh`: callers that already own procedural navigation geometry can avoid
|
|
1756
|
+
* creating hidden GPU meshes just to feed Recast. */
|
|
1757
|
+
export declare function createNavMeshFromSources(plugin: NavigationPlugin, sources: NavMeshSource[], params: NavMeshParameters): void;
|
|
1758
|
+
|
|
1179
1759
|
/** Create a no-color view over a NodeMaterial source. */
|
|
1180
1760
|
export declare function createNodeNoColorMaterialView(source: NodeMaterial): MaterialView;
|
|
1181
1761
|
|
|
@@ -1209,7 +1789,7 @@ export declare function createPcfSpotlightShadowGenerator(engine: EngineContext,
|
|
|
1209
1789
|
/**
|
|
1210
1790
|
* Create a physics aggregate: body + shape + material wired together.
|
|
1211
1791
|
* `mass === 0` → STATIC, `mass > 0` → DYNAMIC.
|
|
1212
|
-
*
|
|
1792
|
+
* Primitive shape geometry is auto-sized from the mesh bounding box when not specified.
|
|
1213
1793
|
*/
|
|
1214
1794
|
export declare function createPhysicsAggregate(world: PhysicsWorld, node: Mesh, type: PhysicsShapeType, options: PhysicsAggregateOptions): PhysicsAggregate;
|
|
1215
1795
|
|
|
@@ -1224,16 +1804,38 @@ export declare function createPhysicsAggregate(world: PhysicsWorld, node: Mesh,
|
|
|
1224
1804
|
export declare function createPhysicsBody(world: PhysicsWorld, node: SceneNode, motionType: PhysicsMotionType, startsAsleep?: boolean): PhysicsBody;
|
|
1225
1805
|
|
|
1226
1806
|
/**
|
|
1227
|
-
* Creates
|
|
1807
|
+
* Creates and enables a Havok constraint between two physics bodies.
|
|
1808
|
+
* @param world - The physics world.
|
|
1809
|
+
* @param bodyA - Parent body.
|
|
1810
|
+
* @param bodyB - Child body.
|
|
1811
|
+
* @param type - Constraint type.
|
|
1812
|
+
* @param options - Pivot and axis options.
|
|
1813
|
+
* @param limits - Optional 6DoF limits.
|
|
1814
|
+
*/
|
|
1815
|
+
export declare function createPhysicsConstraint(world: PhysicsWorld, bodyA: PhysicsBody, bodyB: PhysicsBody, type: PhysicsConstraintType, options?: PhysicsConstraintOptions, limits?: readonly PhysicsConstraintLimit[]): PhysicsConstraint;
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Creates a collision shape from the given options.
|
|
1228
1819
|
* @param world - The physics world.
|
|
1229
1820
|
* @param options - The shape type and its geometry parameters.
|
|
1230
1821
|
* @returns The created shape handle.
|
|
1231
1822
|
*/
|
|
1232
1823
|
export declare function createPhysicsShape(world: PhysicsWorld, options: PhysicsShapeOptions): PhysicsShape;
|
|
1233
1824
|
|
|
1825
|
+
/** Creates a tree-shakable Physics V2 debug viewer for a scene/world pair. */
|
|
1826
|
+
export declare function createPhysicsViewer(scene: SceneContext, world: PhysicsWorld, options?: PhysicsViewerOptions): PhysicsViewer;
|
|
1827
|
+
|
|
1234
1828
|
/** Create a plane (unit quad facing -Z). Caller must assign material. */
|
|
1235
1829
|
export declare function createPlane(engine: EngineContext, options?: PlaneOptions): Mesh;
|
|
1236
1830
|
|
|
1831
|
+
export declare function createPlaneDragGizmo(engine: EngineContext, layer: UtilityLayer, options: PlaneDragGizmoOptions): PlaneDragGizmo;
|
|
1832
|
+
|
|
1833
|
+
export declare function createPlaneRotationGizmo(engine: EngineContext, layer: UtilityLayer, options: PlaneRotationGizmoOptions): PlaneRotationGizmo;
|
|
1834
|
+
|
|
1835
|
+
/** Build a PointerDrag descriptor. The drag is inert until `registerPointerDrag`
|
|
1836
|
+
* is called against a utility layer with collider meshes assigned to it. */
|
|
1837
|
+
export declare function createPointerDrag(options: PointerDragOptions): PointerDrag;
|
|
1838
|
+
|
|
1237
1839
|
/**
|
|
1238
1840
|
* Creates a point light that emits in all directions from `position` with distance falloff.
|
|
1239
1841
|
* @param position - World-space position of the light.
|
|
@@ -1245,6 +1847,11 @@ export declare function createPointLight(position: [number, number, number], int
|
|
|
1245
1847
|
/** Create a polyhedron (15 presets). Caller must assign material. */
|
|
1246
1848
|
export declare function createPolyhedron(engine: EngineContext, options?: PolyhedronOptions): Mesh;
|
|
1247
1849
|
|
|
1850
|
+
/** Build a composite position gizmo. Colors match BJS PositionGizmo
|
|
1851
|
+
* defaults: half-saturation red / green / blue along X / Y / Z
|
|
1852
|
+
* (`Color3.Red().scale(0.5)` etc.). */
|
|
1853
|
+
export declare function createPositionGizmo(engine: EngineContext, layer: UtilityLayer, options?: PositionGizmoOptions): PositionGizmo;
|
|
1854
|
+
|
|
1248
1855
|
/**
|
|
1249
1856
|
* Creates a Gaussian Splatting mesh with `splatCount` placeholder splats and attaches
|
|
1250
1857
|
* it to the scene's render pipeline. Useful for procedurally filling splat data later.
|
|
@@ -1304,11 +1911,33 @@ export declare function createRenderTargetTexture(engine: EngineContext, descrip
|
|
|
1304
1911
|
* Swapchain-targeted tasks acquire the swap view per-frame at execute time. */
|
|
1305
1912
|
export declare function createRenderTask(config: RenderTaskConfig, engine: EngineContext, scene: SceneContext): RenderTask;
|
|
1306
1913
|
|
|
1914
|
+
/**
|
|
1915
|
+
* Create an empty `Texture2D` usable as **both a render target and a sampled texture**
|
|
1916
|
+
* (`RENDER_ATTACHMENT | TEXTURE_BINDING`). This is the building block for offscreen
|
|
1917
|
+
* render-to-texture: render a pass into `tex.view`, then sample `tex` in a later pass
|
|
1918
|
+
* (e.g. a fullscreen post-process). Defaults to the engine's swapchain format + a
|
|
1919
|
+
* linear sampler so the result can be presented directly.
|
|
1920
|
+
*
|
|
1921
|
+
* To use the result as a `SpriteRenderer` target (via `setSpriteRendererTarget`), leave
|
|
1922
|
+
* `format` at its default `engine.format` — sprite pipelines bake in that format, so a
|
|
1923
|
+
* differently-formatted target trips WebGPU validation at render-pass begin. A custom
|
|
1924
|
+
* `format` is for offscreen targets driven by some other pass, not the sprite renderer.
|
|
1925
|
+
*/
|
|
1926
|
+
export declare function createRenderTexture2D(engine: EngineContext, width: number, height: number, options?: RenderTexture2DOptions): Texture2D;
|
|
1927
|
+
|
|
1307
1928
|
/** Create a ribbon from an array of parallel Vec3 paths. Caller must assign material. */
|
|
1308
1929
|
export declare function createRibbon(engine: EngineContext, options: RibbonOptions): Mesh;
|
|
1309
1930
|
|
|
1310
|
-
|
|
1311
|
-
|
|
1931
|
+
export declare function createRotationGizmo(engine: EngineContext, layer: UtilityLayer, options?: RotationGizmoOptions): RotationGizmo;
|
|
1932
|
+
|
|
1933
|
+
export declare function createScaleGizmo(engine: EngineContext, layer: UtilityLayer, options?: ScaleGizmoOptions): ScaleGizmo;
|
|
1934
|
+
|
|
1935
|
+
/** Create an empty scene context bound to the given `surface`. The default render task
|
|
1936
|
+
* is built against the surface's format, MSAA configuration, and swapchain RT — the
|
|
1937
|
+
* scene is permanently bound to that surface. Pass `engine` directly (since
|
|
1938
|
+
* `EngineContext extends SurfaceContext`) for the common single-canvas case, or pass
|
|
1939
|
+
* an auxiliary surface created via `createSurface`. */
|
|
1940
|
+
export declare function createSceneContext(surface: SurfaceContext, options?: SceneContextOptions): SceneContext;
|
|
1312
1941
|
|
|
1313
1942
|
/** Create a ShaderMaterial from WGSL sources and declarations, validating
|
|
1314
1943
|
* attributes, uniforms, samplers, and defines.
|
|
@@ -1316,6 +1945,22 @@ export declare function createSceneContext(engine: EngineContext, options?: Scen
|
|
|
1316
1945
|
* @returns The constructed `ShaderMaterial`. */
|
|
1317
1946
|
export declare function createShaderMaterial(options: ShaderMaterialOptions): ShaderMaterial;
|
|
1318
1947
|
|
|
1948
|
+
/**
|
|
1949
|
+
* Create a no-colour view over a ShaderMaterial source, used by the shadow caster pass.
|
|
1950
|
+
*
|
|
1951
|
+
* Unlike standard/PBR/node, a ShaderMaterial needs no feature flag to drop its colour output: the shader
|
|
1952
|
+
* pipeline already omits the fragment stage when the render target has no colour attachment (the depth-only
|
|
1953
|
+
* shadow map). The view exists purely so the caster gets its OWN renderable + system UBO (written with the
|
|
1954
|
+
* shadow camera's view-projection) instead of clobbering the source material's main-pass UBO.
|
|
1955
|
+
*/
|
|
1956
|
+
export declare function createShaderNoColorMaterialView(source: ShaderMaterial): MaterialView;
|
|
1957
|
+
|
|
1958
|
+
/** Wrap a ShaderMaterial as a normal-buffer view. The returned view renders the
|
|
1959
|
+
* source's geometry (instancing/displacement intact) but writes the geometric
|
|
1960
|
+
* normal instead of the material's colour. Idempotent-friendly: create one per
|
|
1961
|
+
* source and reuse it. */
|
|
1962
|
+
export declare function createShaderNormalMaterialView(source: ShaderMaterial, config?: ShaderNormalViewConfig): MaterialView;
|
|
1963
|
+
|
|
1319
1964
|
/** Create a 1×1 solid-color `Texture2D` from straight RGBA components in [0, 1].
|
|
1320
1965
|
* @param engine - Engine context.
|
|
1321
1966
|
* @param r - Red channel (0–1).
|
|
@@ -1364,7 +2009,11 @@ export declare function createSpriteAnimationManager(options?: SpriteAnimationMa
|
|
|
1364
2009
|
* Pack `sources` into a single `SpriteAtlas`. Shelf-packs in input order: each
|
|
1365
2010
|
* frame is placed left-to-right on the current shelf, wrapping to a new shelf
|
|
1366
2011
|
* (row) when it would overflow `maxWidthPx`. The texture is sized exactly to the
|
|
1367
|
-
* packed content.
|
|
2012
|
+
* packed content unless `options.capacityPx` is supplied to reserve headroom for
|
|
2013
|
+
* later `appendSpriteAtlasFrames` calls.
|
|
2014
|
+
*
|
|
2015
|
+
* Pass `sources: []` together with `options.capacityPx` to create an empty atlas
|
|
2016
|
+
* sized for future appends.
|
|
1368
2017
|
*/
|
|
1369
2018
|
export declare function createSpriteAtlasFromFrames(engine: EngineContext, sources: readonly SpriteAtlasFrameSource[], options?: SpriteAtlasPackOptions): SpriteAtlas;
|
|
1370
2019
|
|
|
@@ -1381,8 +2030,11 @@ export declare function createSpriteAtlasFromFrames(engine: EngineContext, sourc
|
|
|
1381
2030
|
*/
|
|
1382
2031
|
export declare function createSpriteFrameAnimation(target: SpriteAnimationTarget, from: number, to: number, loop: boolean, delayMs: number, options?: PlaySpriteAnimationOptions): SpriteFrameAnimation;
|
|
1383
2032
|
|
|
1384
|
-
/** Create a `SpriteRenderer` for `
|
|
1385
|
-
|
|
2033
|
+
/** Create a `SpriteRenderer` for `surface`, pre-warming pipelines for the layers' blend
|
|
2034
|
+
* modes. Pass the engine directly for the common single-canvas case (since
|
|
2035
|
+
* `EngineContext extends SurfaceContext`); pass an auxiliary surface created via
|
|
2036
|
+
* `createSurface` for multi-canvas. */
|
|
2037
|
+
export declare function createSpriteRenderer(surface: SurfaceContext, opts: SpriteRendererOptions): SpriteRenderer;
|
|
1386
2038
|
|
|
1387
2039
|
/** Create StandardMaterial with Babylon defaults. */
|
|
1388
2040
|
export declare function createStandardMaterial(): StandardMaterialProps;
|
|
@@ -1391,6 +2043,32 @@ export declare function createStandardMaterial(): StandardMaterialProps;
|
|
|
1391
2043
|
* The view references the source; material state is never copied. */
|
|
1392
2044
|
export declare function createStandardNoColorMaterialView(source: StandardMaterialProps): MaterialView;
|
|
1393
2045
|
|
|
2046
|
+
/**
|
|
2047
|
+
* Create an auxiliary rendering surface bound to an existing engine. The surface
|
|
2048
|
+
* configures its own `GPUCanvasContext` against `engine._device` and is appended to
|
|
2049
|
+
* `engine.surfaces`. GPU resources (textures, buffers, pipelines) are shared across
|
|
2050
|
+
* all surfaces of the same engine because they're device-scoped — render to multiple
|
|
2051
|
+
* canvases by creating additional surfaces and binding scenes / renderers to each.
|
|
2052
|
+
*
|
|
2053
|
+
* The engine's own primary surface (`engine.surfaces[0] === engine`) is created
|
|
2054
|
+
* automatically by `createEngine(canvas)`; use `createSurface` only for additional
|
|
2055
|
+
* canvases beyond that one.
|
|
2056
|
+
*
|
|
2057
|
+
* Accepts either a DOM canvas (main thread) or an `OffscreenCanvas` (e.g. transferred
|
|
2058
|
+
* to a Web Worker via `transferControlToOffscreen()`).
|
|
2059
|
+
*/
|
|
2060
|
+
export declare function createSurface(engine: EngineContext, canvas: RenderCanvas, options?: SurfaceOptions): SurfaceContext;
|
|
2061
|
+
|
|
2062
|
+
/** Create a TextData bound to `storage`. If `runs` is omitted the TextData starts empty;
|
|
2063
|
+
* runs can be appended later via `updateTextData({ update: "addRun", … })`. */
|
|
2064
|
+
export declare function createTextData(storage: GlyphStorage, runs?: readonly GlyphRun[]): TextData;
|
|
2065
|
+
|
|
2066
|
+
export declare function createTextLayer(data: TextData, options?: TextLayerOptions): TextLayer;
|
|
2067
|
+
|
|
2068
|
+
export declare function createTextRenderable(data: TextData, options?: TextRenderableOptions): TextRenderable;
|
|
2069
|
+
|
|
2070
|
+
export declare function createTextRenderer(surface: SurfaceContext, opts: TextRendererOptions): TextRenderer;
|
|
2071
|
+
|
|
1394
2072
|
/**
|
|
1395
2073
|
* Create a `Texture2D` from a tightly-packed RGBA8 byte buffer.
|
|
1396
2074
|
*
|
|
@@ -1441,6 +2119,14 @@ export declare function createUniformEffectRenderTask(config: UniformEffectRende
|
|
|
1441
2119
|
*/
|
|
1442
2120
|
export declare function createUniformEffectWrapper(engine: EngineContext, options: UniformEffectWrapperOptions): UniformEffectWrapper;
|
|
1443
2121
|
|
|
2122
|
+
/** Create a utility layer attached to the given engine + main scene.
|
|
2123
|
+
* The returned `scene` shares the main scene's camera so view + projection
|
|
2124
|
+
* remain in sync without manual mirroring. The utility scene renders with a
|
|
2125
|
+
* fresh-cleared depth buffer (so its gizmos appear on top of the main scene)
|
|
2126
|
+
* while keeping NORMAL intra-layer depth testing — solid gizmo bodies (e.g.
|
|
2127
|
+
* the camera-gizmo box + cylinders) occlude their own back faces correctly. */
|
|
2128
|
+
export declare function createUtilityLayer(engine: EngineContext, mainScene: SceneContext, options?: UtilityLayerOptions): UtilityLayer;
|
|
2129
|
+
|
|
1444
2130
|
/** Cross-fades from `fromGroup` to `toGroup`, fading the first to weight 0 and the second to `options.toWeight` (default 1). */
|
|
1445
2131
|
export declare function crossFadeAnimationGroups(manager: AnimationManager, fromGroup: AnimationGroup, toGroup: AnimationGroup, options: CrossFadeAnimationGroupsOptions): void;
|
|
1446
2132
|
|
|
@@ -1513,6 +2199,15 @@ export declare interface CsmDirectionalShadowGeneratorConfig {
|
|
|
1513
2199
|
forceRefreshEveryFrame?: boolean;
|
|
1514
2200
|
}
|
|
1515
2201
|
|
|
2202
|
+
/** Approximate a cubic Bézier with two quadratics using the "3/4 rule" (matches Slug reference).
|
|
2203
|
+
* Exposed as a public helper so callers that ingest cubic outlines from their own font sources
|
|
2204
|
+
* (e.g. DirectWrite, FreeType) can convert into the quadratic-only format `GlyphCurves` expects. */
|
|
2205
|
+
export declare function cubicToQuadratics(p0x: number, p0y: number, c1x: number, c1y: number, c2x: number, c2y: number, p1x: number, p1y: number): [QuadCurve, QuadCurve];
|
|
2206
|
+
|
|
2207
|
+
/** Identifier for a curve set (a font's glyph-curves map). Strings let callers use a
|
|
2208
|
+
* human-readable key (e.g. the font face name) for easy debugging. */
|
|
2209
|
+
export declare type CurveSetId = string;
|
|
2210
|
+
|
|
1516
2211
|
/** One extra texture bound after the atlas. In WGSL it becomes `<name>Tex` + `<name>Samp`. */
|
|
1517
2212
|
export declare interface CustomShaderTexture {
|
|
1518
2213
|
/** Identifier used in WGSL: becomes `<name>Tex` (texture) and `<name>Samp` (sampler). */
|
|
@@ -1520,6 +2215,26 @@ export declare interface CustomShaderTexture {
|
|
|
1520
2215
|
readonly texture: Texture2D;
|
|
1521
2216
|
}
|
|
1522
2217
|
|
|
2218
|
+
/**
|
|
2219
|
+
* CreateCylinder — matches Babylon.js MeshBuilder.CreateCylinder default options.
|
|
2220
|
+
*
|
|
2221
|
+
* Supports cylinders, cones (diameterTop=0), truncated cones, and prisms
|
|
2222
|
+
* (low tessellation). Options are a subset of Babylon's MeshBuilder that
|
|
2223
|
+
* covers the typical procedural use-case. Advanced options — `arc`,
|
|
2224
|
+
* `enclose`, `hasRings`, `faceColors`, `faceUV`, `cap != CAP_ALL` — are
|
|
2225
|
+
* intentionally omitted to keep the API small; the default behavior (full
|
|
2226
|
+
* 360°, single ring, CAP_ALL) matches Babylon exactly.
|
|
2227
|
+
*
|
|
2228
|
+
* Index order and normal computation are ported verbatim from
|
|
2229
|
+
* `@babylonjs/core/Meshes/Builders/cylinderBuilder.js` to guarantee parity.
|
|
2230
|
+
*/
|
|
2231
|
+
export declare interface CylinderData {
|
|
2232
|
+
positions: Float32Array;
|
|
2233
|
+
normals: Float32Array;
|
|
2234
|
+
uvs: Float32Array;
|
|
2235
|
+
indices: Uint32Array;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
1523
2238
|
/** Options for `createCylinderData`. Subset of Babylon's CreateCylinder. */
|
|
1524
2239
|
export declare interface CylinderOptions {
|
|
1525
2240
|
height?: number;
|
|
@@ -1530,6 +2245,69 @@ export declare interface CylinderOptions {
|
|
|
1530
2245
|
subdivisions?: number;
|
|
1531
2246
|
}
|
|
1532
2247
|
|
|
2248
|
+
/** Convenience text-data variant that owns its `GlyphStorage` and exposes the laid-out
|
|
2249
|
+
* pixel-space `width` / `height` of the text block. Produced by `createDefaultTextData`. */
|
|
2250
|
+
export declare interface DefaultTextData extends TextData {
|
|
2251
|
+
readonly [defaultTextDataBrand]: true;
|
|
2252
|
+
/** Pixel-space width of the laid-out run (max line width). */
|
|
2253
|
+
readonly width: number;
|
|
2254
|
+
/** Pixel-space height of the laid-out run (lines × line-height). */
|
|
2255
|
+
readonly height: number;
|
|
2256
|
+
|
|
2257
|
+
declare const defaultTextDataBrand: unique symbol;
|
|
2258
|
+
|
|
2259
|
+
/** Quality of the depth-of-field blur. Models BJS `ThinDepthOfFieldEffectBlurLevel`. */
|
|
2260
|
+
export declare enum DepthOfFieldBlurLevel {
|
|
2261
|
+
/** Subtle blur — 1 blur level, kernel 15. */
|
|
2262
|
+
Low = 0,
|
|
2263
|
+
/** Medium blur — 2 blur levels, kernel 31. */
|
|
2264
|
+
Medium = 1,
|
|
2265
|
+
/** Large blur — 3 blur levels, kernel 51. */
|
|
2266
|
+
High = 2
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
/** A composite depth-of-field post-process task: circle-of-confusion → CoC-weighted blur pyramid → merge. */
|
|
2270
|
+
export declare interface DepthOfFieldPostProcessTask extends Task, PostProcessTaskSettings {
|
|
2271
|
+
readonly name: string;
|
|
2272
|
+
sourceTexture: RenderTarget;
|
|
2273
|
+
targetTexture: RenderTarget | null;
|
|
2274
|
+
outputTexture: RenderTarget;
|
|
2275
|
+
lensSize: number;
|
|
2276
|
+
fStop: number;
|
|
2277
|
+
focusDistance: number;
|
|
2278
|
+
focalLength: number;
|
|
2279
|
+
/** Recompute and upload the uniforms of every sub-pass (CoC, blurs, merge). */
|
|
2280
|
+
updateUniforms(): void;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* Configuration for `createDepthOfFieldPostProcessTask`.
|
|
2285
|
+
*
|
|
2286
|
+
* Models Babylon.js's `FrameGraphDepthOfFieldTask` + `ThinDepthOfFieldEffect`:
|
|
2287
|
+
* a circle-of-confusion pass feeds a stack of CoC-weighted separable blurs,
|
|
2288
|
+
* which are merged back over the sharp image for a physically-plausible
|
|
2289
|
+
* depth-of-field effect.
|
|
2290
|
+
*/
|
|
2291
|
+
export declare interface DepthOfFieldPostProcessTaskConfig extends PostProcessTaskSettings {
|
|
2292
|
+
/** Depth texture. With `depthNotNormalized` it stores camera-space (view)
|
|
2293
|
+
* depth; otherwise normalized [0,1] view depth. */
|
|
2294
|
+
depthTexture: RenderTarget;
|
|
2295
|
+
/** Camera used to read minZ/maxZ when the depth is normalized. */
|
|
2296
|
+
camera: Camera;
|
|
2297
|
+
/** Max lens size in scene units / 1000. Default 50. */
|
|
2298
|
+
lensSize?: number;
|
|
2299
|
+
/** F-Stop of the camera. Default 1.4. */
|
|
2300
|
+
fStop?: number;
|
|
2301
|
+
/** Distance from the camera to focus on, in scene units / 1000. Default 2000. */
|
|
2302
|
+
focusDistance?: number;
|
|
2303
|
+
/** Focal length of the camera in scene units / 1000. Default 50. */
|
|
2304
|
+
focalLength?: number;
|
|
2305
|
+
/** Blur quality. Default {@link DepthOfFieldBlurLevel.Low}. */
|
|
2306
|
+
blurLevel?: DepthOfFieldBlurLevel;
|
|
2307
|
+
/** When true the depth texture stores camera-space depth (0..maxZ). */
|
|
2308
|
+
depthNotNormalized?: boolean;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
1533
2311
|
export declare interface DirectionalLight extends LightBase {
|
|
1534
2312
|
readonly lightType: "directional";
|
|
1535
2313
|
direction: ObservableVec3;
|
|
@@ -1547,32 +2325,63 @@ export declare interface DiscOptions {
|
|
|
1547
2325
|
arc?: number;
|
|
1548
2326
|
}
|
|
1549
2327
|
|
|
2328
|
+
/** Dispose the gizmo: remove meshes, unregister pointer-drag, drop materials. */
|
|
2329
|
+
export declare function disposeAxisDragGizmo(gizmo: AxisDragGizmo, layer: UtilityLayer): void;
|
|
2330
|
+
|
|
2331
|
+
export declare function disposeAxisScaleGizmo(gizmo: AxisScaleGizmo, layer: UtilityLayer): void;
|
|
2332
|
+
|
|
2333
|
+
export declare function disposeBoundingBoxGizmo(gizmo: BoundingBoxGizmo, layer: UtilityLayer): void;
|
|
2334
|
+
|
|
2335
|
+
export declare function disposeCameraGizmo(gizmo: CameraGizmo, layer: UtilityLayer): void;
|
|
2336
|
+
|
|
1550
2337
|
/** Frees the WASM memory backing a solid. The solid must not be used afterwards. */
|
|
1551
2338
|
export declare function disposeCsg2(solid: Csg2Solid): void;
|
|
1552
2339
|
|
|
2340
|
+
/** Release the per-block GPU resources AND the underlying `GlyphStorage` owned by `data`. */
|
|
2341
|
+
export declare function disposeDefaultTextData(data: DefaultTextData): void;
|
|
2342
|
+
|
|
1553
2343
|
/** Unregister and free all GPU resources owned by the renderer. */
|
|
1554
2344
|
export declare function disposeEffectRenderer(er: EffectRenderer): void;
|
|
1555
2345
|
|
|
1556
2346
|
/** Destroy the uniform buffers and clear the cached pipelines, bind groups, and slots owned by the effect wrapper. */
|
|
1557
2347
|
export declare function disposeEffectWrapper(wrapper: EffectWrapper): void;
|
|
1558
2348
|
|
|
1559
|
-
/** Release all engine-owned GPU resources (device +
|
|
1560
|
-
* own their own GPU resources (frame graphs, render
|
|
1561
|
-
* separately. */
|
|
2349
|
+
/** Release all engine-owned GPU resources (device + every attached surface's swapchain
|
|
2350
|
+
* context). Rendering contexts own their own GPU resources (frame graphs, render
|
|
2351
|
+
* targets) and dispose them separately. */
|
|
1562
2352
|
export declare function disposeEngine(engine: EngineContext): void;
|
|
1563
2353
|
|
|
1564
2354
|
/** Unregister and dispose all GPU resources owned by the standalone frame graph. */
|
|
1565
2355
|
export declare function disposeFrameGraphContext(ctx: FrameGraphContext): void;
|
|
1566
2356
|
|
|
2357
|
+
/** Release every GPU atlas owned by `storage`. Idempotent. The caller is responsible for
|
|
2358
|
+
* ensuring no `TextData` is still drawing from this storage. */
|
|
2359
|
+
export declare function disposeGlyphStorage(storage: GlyphStorage): void;
|
|
2360
|
+
|
|
2361
|
+
export declare function disposeLightGizmo(gizmo: LightGizmo, layer: UtilityLayer): void;
|
|
2362
|
+
|
|
1567
2363
|
/**
|
|
1568
2364
|
* Removes and releases all bodies, then releases the native world. Call once when tearing down physics.
|
|
1569
2365
|
* @param world - The physics world to dispose.
|
|
1570
2366
|
*/
|
|
1571
2367
|
export declare function disposePhysics(world: PhysicsWorld): void;
|
|
1572
2368
|
|
|
2369
|
+
/** Disposes all physics debug meshes and unregisters the viewer update hook. */
|
|
2370
|
+
export declare function disposePhysicsViewer(viewer: PhysicsViewer): void;
|
|
2371
|
+
|
|
1573
2372
|
/** Dispose GPU resources owned by this picker. */
|
|
1574
2373
|
export declare function disposePicker(picker: GpuPicker): void;
|
|
1575
2374
|
|
|
2375
|
+
export declare function disposePlaneDragGizmo(gizmo: PlaneDragGizmo, layer: UtilityLayer): void;
|
|
2376
|
+
|
|
2377
|
+
export declare function disposePlaneRotationGizmo(gizmo: PlaneRotationGizmo, layer: UtilityLayer): void;
|
|
2378
|
+
|
|
2379
|
+
export declare function disposePositionGizmo(gizmo: PositionGizmo, layer: UtilityLayer): void;
|
|
2380
|
+
|
|
2381
|
+
export declare function disposeRotationGizmo(gizmo: RotationGizmo, layer: UtilityLayer): void;
|
|
2382
|
+
|
|
2383
|
+
export declare function disposeScaleGizmo(gizmo: ScaleGizmo, layer: UtilityLayer): void;
|
|
2384
|
+
|
|
1576
2385
|
/** Release all GPU resources owned by this scene. */
|
|
1577
2386
|
export declare function disposeScene(scene: SceneContext): void;
|
|
1578
2387
|
|
|
@@ -1591,9 +2400,29 @@ export declare function disposeSpriteAnimationBinding(binding: SpriteAnimationBi
|
|
|
1591
2400
|
*/
|
|
1592
2401
|
export declare function disposeSpriteRenderer(sr: SpriteRenderer): void;
|
|
1593
2402
|
|
|
2403
|
+
/** Remove and unconfigure an auxiliary surface from its engine. Rendering contexts
|
|
2404
|
+
* registered on this surface are dropped from its list but not disposed — call their
|
|
2405
|
+
* own disposers (e.g. `disposeScene`) separately.
|
|
2406
|
+
*
|
|
2407
|
+
* Throws if called on the engine's primary surface (`surface === engine`); use
|
|
2408
|
+
* `disposeEngine` to tear down the engine and all its surfaces. */
|
|
2409
|
+
export declare function disposeSurface(surface: SurfaceContext): void;
|
|
2410
|
+
|
|
2411
|
+
/** Release per-block GPU resources owned by `data`. Does NOT dispose the bound
|
|
2412
|
+
* `GlyphStorage` — caller owns its lifetime and must dispose it separately via
|
|
2413
|
+
* `disposeGlyphStorage` once no `TextData` references it. */
|
|
2414
|
+
export declare function disposeTextData(data: TextData): void;
|
|
2415
|
+
|
|
2416
|
+
export declare function disposeTextRenderable(renderable: TextRenderable): void;
|
|
2417
|
+
|
|
2418
|
+
export declare function disposeTextRenderer(tr: TextRenderer): void;
|
|
2419
|
+
|
|
1594
2420
|
/** Destroy the uniform buffer and clear cached GPU objects owned by the uniform effect wrapper. */
|
|
1595
2421
|
export declare function disposeUniformEffectWrapper(wrapper: UniformEffectWrapper): void;
|
|
1596
2422
|
|
|
2423
|
+
/** Dispose the utility layer's underlying scene. Idempotent. */
|
|
2424
|
+
export declare function disposeUtilityLayer(utility: UtilityLayer): void;
|
|
2425
|
+
|
|
1597
2426
|
/**
|
|
1598
2427
|
* A per-pass draw binding produced by `Renderable.bind(engine, target)`.
|
|
1599
2428
|
*
|
|
@@ -1708,6 +2537,23 @@ export declare function enableAnimationBlending(manager: AnimationManager): void
|
|
|
1708
2537
|
*/
|
|
1709
2538
|
export declare function enableDetailedPicking(picker: GpuPicker): void;
|
|
1710
2539
|
|
|
2540
|
+
/**
|
|
2541
|
+
* Opt a Havok world into multi-region floating-origin simulation (Large World Rendering).
|
|
2542
|
+
*
|
|
2543
|
+
* Loads the floating-origin runtime on demand (`physics/havok-floating-origin.ts`) so worlds that
|
|
2544
|
+
* never call this — i.e. ordinary near-origin physics scenes — never pull that code into their
|
|
2545
|
+
* bundle. Once enabled, bodies far apart in world space are simulated in separate regions (each
|
|
2546
|
+
* within `floatingOriginWorldRadius` of its origin) so the float32 Havok solver keeps full
|
|
2547
|
+
* precision. Node transforms remain true world coordinates; eye-relative rendering is handled
|
|
2548
|
+
* independently by the floating-origin render path.
|
|
2549
|
+
*
|
|
2550
|
+
* Must be called **before** creating any bodies in the world. Pair it with an engine created with
|
|
2551
|
+
* `useFloatingOrigin: true` so rendering and physics share the same far-from-origin handling.
|
|
2552
|
+
* @param world - The physics world to enable floating origin on.
|
|
2553
|
+
* @param floatingOriginWorldRadius - Region capture radius in metres (default 100000, matching Babylon.js).
|
|
2554
|
+
*/
|
|
2555
|
+
export declare function enableHavokFloatingOrigin(world: PhysicsWorld, floatingOriginWorldRadius?: number): Promise<void>;
|
|
2556
|
+
|
|
1711
2557
|
/**
|
|
1712
2558
|
* Enable material-plugin support for `scene`.
|
|
1713
2559
|
*
|
|
@@ -1747,16 +2593,28 @@ export declare function enableThinInstanceGpuCulling(mesh: Mesh, enabled?: boole
|
|
|
1747
2593
|
/** CPU helper matching BJS `GaussianSplattingGpuPickingMaterialPlugin.EncodeIdToColor`. */
|
|
1748
2594
|
export declare function encodeIdToColor(id: number): [number, number, number];
|
|
1749
2595
|
|
|
1750
|
-
/**
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
2596
|
+
/**
|
|
2597
|
+
* Handle to the WebGPU engine — pure state, no attached methods.
|
|
2598
|
+
*
|
|
2599
|
+
* The engine owns the `GPUDevice` and all device-scoped GPU resources (textures, buffers,
|
|
2600
|
+
* pipelines, bind groups). It also **is itself a {@link SurfaceContext}** bound to the
|
|
2601
|
+
* canvas passed into `createEngine` — the primary surface. Additional canvases can be
|
|
2602
|
+
* attached via `createSurface(engine, canvas, ...)`; GPU resources are shared across all
|
|
2603
|
+
* surfaces because they're device-scoped, while each surface owns its own swapchain
|
|
2604
|
+
* context.
|
|
2605
|
+
*/
|
|
2606
|
+
export declare interface EngineContext extends SurfaceContext {
|
|
2607
|
+
/** Rendering surfaces attached to this engine, in registration order. Index 0 is
|
|
2608
|
+
* the engine itself (the primary surface) — the tuple type guarantees at least
|
|
2609
|
+
* one entry so `engine.surfaces[0]` is always defined. Use
|
|
2610
|
+
* `createSurface(engine, canvas, ...)` to append more. */
|
|
2611
|
+
readonly surfaces: readonly [SurfaceContext, ...SurfaceContext[]];
|
|
1758
2612
|
/** Number of GPU draw calls in the last rendered frame, summed across all surfaces. */
|
|
1759
2613
|
drawCallCount: number;
|
|
1760
|
-
/**
|
|
2614
|
+
/** GPU time spent on the last measured frame, in milliseconds — 0 until the first measured frame and
|
|
2615
|
+
* while GPU timing is disabled (the default). Enable with {@link setGpuTimingEnabled}; query device
|
|
2616
|
+
* capability with {@link isGpuTimingSupported}. Updates a frame or two behind, since the timestamp
|
|
2617
|
+
* readback is async and off the render critical path, so reading it does not perturb the value. */
|
|
2618
|
+
gpuFrameTimeMs: number;
|
|
1761
2619
|
/**
|
|
1762
2620
|
* When true, world matrices are computed using Float64 intermediate precision
|
|
1763
2621
|
* and downcast to Float32 at GPU upload time. Defaults to false.
|
|
1764
2622
|
*/
|
|
@@ -1771,27 +2629,21 @@ export declare interface EngineContext {
|
|
|
1771
2629
|
* dynamically imported during `createEngine` only when this flag is true,
|
|
1772
2630
|
* so non-LWR engines never pull the module into their bundle.
|
|
1773
2631
|
*/
|
|
1774
|
-
useFloatingOrigin: boolean;
|
|
1775
|
-
/** Clamps the effective device pixel ratio used for the swapchain backing store.
|
|
1776
|
-
* The backing store is sized at `min(devicePixelRatio, maxDevicePixelRatio) * cssPixels`.
|
|
1777
|
-
* `maxDevicePixelRatio = 1` renders at native CSS-pixel resolution (no DPR upscaling);
|
|
1778
|
-
* the default `Infinity` is unclamped (full devicePixelRatio). Mutable at runtime — set
|
|
1779
|
-
* before the next `resizeEngine` to take effect (mirrors `setHardwareScalingRatio`). */
|
|
1780
|
-
maxDevicePixelRatio: number;
|
|
2632
|
+
useFloatingOrigin: boolean;
|
|
1781
2633
|
|
|
1782
2634
|
/**
|
|
1783
|
-
* Options for `createEngine`.
|
|
1784
|
-
*
|
|
1785
|
-
*
|
|
1786
|
-
* (2x is not a valid WebGPU sample count). Defaults to `4`.
|
|
2635
|
+
* Options for `createEngine`. Per-surface options for the primary surface (the canvas
|
|
2636
|
+
* passed to `createEngine`) come from {@link SurfaceOptions} and are passed alongside
|
|
2637
|
+
* the engine options as a single union: `createEngine(canvas, opts: EngineOptions & SurfaceOptions)`.
|
|
1787
2638
|
*/
|
|
1788
|
-
export declare interface EngineOptions {
|
|
1789
|
-
msaaSamples?: 1 | 4;
|
|
2639
|
+
export declare interface EngineOptions extends SurfaceOptions {
|
|
1790
2640
|
/**
|
|
1791
|
-
* WebGPU
|
|
1792
|
-
*
|
|
2641
|
+
* Extra WebGPU device limits to request when calling `adapter.requestDevice()`.
|
|
2642
|
+
* Use to raise per-device caps such as `maxColorAttachmentBytesPerSample` (default 32),
|
|
2643
|
+
* which is required when rendering into many MRT attachments. Caller is responsible for
|
|
2644
|
+
* staying within the adapter's reported limits.
|
|
1793
2645
|
*/
|
|
1794
|
-
|
|
2646
|
+
requiredLimits?: Record<string, GPUSize64 | undefined>;
|
|
1795
2647
|
/**
|
|
1796
2648
|
* Enable Float64 intermediate precision for world matrix computations. Defaults to false.
|
|
1797
2649
|
*/
|
|
@@ -1807,14 +2659,6 @@ export declare interface EngineOptions {
|
|
|
1807
2659
|
* pattern as the F64 storage module).
|
|
1808
2660
|
*/
|
|
1809
2661
|
useFloatingOrigin?: boolean;
|
|
1810
|
-
/**
|
|
1811
|
-
* Clamps the effective device pixel ratio used for the swapchain backing store.
|
|
1812
|
-
* The backing store is sized at `min(devicePixelRatio, maxDevicePixelRatio) * cssPixels`.
|
|
1813
|
-
* `maxDevicePixelRatio: 1` renders at native CSS-pixel resolution (no DPR upscaling) —
|
|
1814
|
-
* useful on high-DPI/iOS devices where `devicePixelRatio` is ~3. Defaults to unclamped
|
|
1815
|
-
* (full devicePixelRatio). Equivalent to Babylon.js `setHardwareScalingRatio`.
|
|
1816
|
-
*/
|
|
1817
|
-
maxDevicePixelRatio?: number;
|
|
1818
2662
|
}
|
|
1819
2663
|
|
|
1820
2664
|
/** GPU-resident environment textures. */
|
|
@@ -1861,6 +2705,11 @@ declare interface EulerProxy {
|
|
|
1861
2705
|
set(x: number, y: number, z: number): void;
|
|
1862
2706
|
}
|
|
1863
2707
|
|
|
2708
|
+
/** Extract outlines for the requested glyph ids and add them to `target`.
|
|
2709
|
+
* Skips ids already present in `target`. Glyphs with no outline are silently skipped.
|
|
2710
|
+
* Mutates `target` directly — no allocation when no new glyphs appear. */
|
|
2711
|
+
export declare function extractGlyphCurves(font: Font, glyphIds: ReadonlySet<number>, target: Map<number, GlyphCurves>): void;
|
|
2712
|
+
|
|
1864
2713
|
/** A post-process task that keeps only pixels whose luminance exceeds `threshold` and zeroes the rest. */
|
|
1865
2714
|
export declare interface ExtractHighlightsPostProcessTask extends PostProcessTask {
|
|
1866
2715
|
threshold: number;
|
|
@@ -1909,6 +2758,17 @@ export declare function findRandomPointAroundCircle(plugin: NavigationPlugin, po
|
|
|
1909
2758
|
/** Mark thin instance data dirty after direct array manipulation. */
|
|
1910
2759
|
export declare function flushThinInstances(mesh: Mesh): void;
|
|
1911
2760
|
|
|
2761
|
+
/**
|
|
2762
|
+
* Smoothly animate a {@link GeospatialCamera} to new yaw/pitch/radius/centre over
|
|
2763
|
+
* `durationMs`, driven by the scene's render loop. Yaw takes the shortest angular
|
|
2764
|
+
* path; the centre follows a great-circle (with an optional parabolic hop).
|
|
2765
|
+
*
|
|
2766
|
+
* The returned promise resolves when the flight completes; it also resolves early
|
|
2767
|
+
* if the flight is interrupted (by user input through `attachGeospatialControls`,
|
|
2768
|
+
* or by a subsequent `flyGeospatialCameraToAsync` call). Only one flight runs at a time.
|
|
2769
|
+
*/
|
|
2770
|
+
export declare function flyGeospatialCameraToAsync(camera: GeospatialCamera, scene: SceneContext, options: GeospatialFlyOptions): Promise<void>;
|
|
2771
|
+
|
|
1912
2772
|
/** Fog configuration — plain data. */
|
|
1913
2773
|
export declare interface FogConfig {
|
|
1914
2774
|
mode: 0 | 1 | 2 | 3;
|
|
@@ -1918,6 +2778,11 @@ export declare interface FogConfig {
|
|
|
1918
2778
|
color: [number, number, number];
|
|
1919
2779
|
}
|
|
1920
2780
|
|
|
2781
|
+
export declare interface Font {
|
|
2782
|
+
readonly [fontBrand]: true;
|
|
2783
|
+
|
|
2784
|
+
declare const fontBrand: unique symbol;
|
|
2785
|
+
|
|
1921
2786
|
/** The frame graph — an ordered list of tasks. */
|
|
1922
2787
|
export declare interface FrameGraph {
|
|
1923
2788
|
/** Build (or rebuild) every task in execute order. */
|
|
1924
2789
|
build(): void;
|
|
@@ -1930,7 +2795,8 @@ export declare interface FrameGraph {
|
|
|
1930
2795
|
/** Build (or rebuild) every task in e
|
|
1931
2796
|
/** A scene-less rendering context driven directly by a FrameGraph. */
|
|
1932
2797
|
export declare interface FrameGraphContext extends RenderingContext_2 {
|
|
1933
2798
|
readonly name: string;
|
|
1934
|
-
|
|
2799
|
+
/** Surface this context renders into. */
|
|
2800
|
+
readonly surface: SurfaceContext;
|
|
1935
2801
|
readonly frameGraph: FrameGraph;
|
|
1936
2802
|
clearColor: GPUColorDict;
|
|
1937
2803
|
}
|
|
@@ -1988,6 +2854,251 @@ export declare interface GaussianSplattingMesh extends SceneNode {
|
|
|
1988
2854
|
/** Numbe
|
|
1989
2855
|
updateData(splatBuffer: ArrayBuffer): void;
|
|
1990
2856
|
}
|
|
1991
2857
|
|
|
2858
|
+
export declare interface GeometryRendererTask extends Task {
|
|
2859
|
+
readonly name: string;
|
|
2860
|
+
/** The optional target texture the task wrote the real (lit) color into.
|
|
2861
|
+
* Equal to {@link GeometryRendererTaskConfig.targetTexture} when the
|
|
2862
|
+
* config provided one, otherwise `undefined`. */
|
|
2863
|
+
readonly outputTexture: RenderTarget | undefined;
|
|
2864
|
+
/** Single-attachment depth `RenderTarget` exposing the pass's depth/stencil
|
|
2865
|
+
* attachment. Downstream tasks (e.g. a `RenderTask` running after the
|
|
2866
|
+
* geometry pass) can consume this as a depth input to reuse the values
|
|
2867
|
+
* written here. When the caller supplied an external `depthTexture` in the
|
|
2868
|
+
* config, this returns that same RT; otherwise it wraps the MRT-owned
|
|
2869
|
+
* depth and is populated post-`record()`. */
|
|
2870
|
+
readonly geometryDepthTexture: RenderTarget;
|
|
2871
|
+
/** Per-type accessors. `null` when that type was not requested. Each value
|
|
2872
|
+
* is a single-attachment `RenderTarget` whose color slot aliases the
|
|
2873
|
+
* matching MRT attachment, so downstream tasks (copy-to-texture, etc.)
|
|
2874
|
+
* can consume it like an ordinary RT. */
|
|
2875
|
+
readonly geometryIrradianceTexture: RenderTarget | null;
|
|
2876
|
+
readonly geometryWorldPositionTexture: RenderTarget | null;
|
|
2877
|
+
readonly geometryLocalPositionTexture: RenderTarget | null;
|
|
2878
|
+
readonly geometryReflectivityTexture: RenderTarget | null;
|
|
2879
|
+
readonly geometryViewDepthTexture: RenderTarget | null;
|
|
2880
|
+
readonly geometryNormalizedViewDepthTexture: RenderTarget | null;
|
|
2881
|
+
readonly geometryScreenspaceDepthTexture: RenderTarget | null;
|
|
2882
|
+
readonly geometryViewNormalTexture: RenderTarget | null;
|
|
2883
|
+
readonly geometryWorldNormalTexture: RenderTarget | null;
|
|
2884
|
+
readonly geometryAlbedoTexture: RenderTarget | null;
|
|
2885
|
+
readonly geometryLinearVelocityTexture: RenderTarget | null;
|
|
2886
|
+
/** Skip a mesh from the velocity attachment's previous-world tracking. */
|
|
2887
|
+
excludeFromVelocity(mesh: Mesh): void;
|
|
2888
|
+
/** Re-include a mesh in velocity tracking. */
|
|
2889
|
+
includeInVelocity(mesh: Mesh): void;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
export declare interface GeometryRendererTaskConfig {
|
|
2893
|
+
name?: string;
|
|
2894
|
+
/** Caster meshes. When omitted, defaults to `scene.meshes`. */
|
|
2895
|
+
meshes?: readonly Mesh[];
|
|
2896
|
+
/** Per-pass camera override. Defaults to `scene.camera`. */
|
|
2897
|
+
camera?: Camera | null;
|
|
2898
|
+
/** Render-target size. Defaults to the scene's `surface`. */
|
|
2899
|
+
size?: SurfaceContext | {
|
|
2900
|
+
width: number;
|
|
2901
|
+
height: number;
|
|
2902
|
+
};
|
|
2903
|
+
/** MSAA sample count. Defaults to 1. */
|
|
2904
|
+
samples?: 1 | 4;
|
|
2905
|
+
/** Externally-owned depth attachment. When omitted, the task creates its
|
|
2906
|
+
* own `depth32float` depth texture sized to match the color attachments. */
|
|
2907
|
+
depthTexture?: RenderTarget | null;
|
|
2908
|
+
/** Ordered list of MRT attachments (1..8). The array index becomes the
|
|
2909
|
+
* fragment shader's `@location(i)` and the render-pass color attachment slot. */
|
|
2910
|
+
readonly textureDescriptions: readonly GeometryRendererTextureDescription[];
|
|
2911
|
+
/** Flip culling direction. Default false. */
|
|
2912
|
+
reverseCulling?: boolean;
|
|
2913
|
+
/** Optional color render-target that receives the *real* (lit) material
|
|
2914
|
+
* color, written as an additional color attachment alongside the geometry
|
|
2915
|
+
* data attachments. Must have the same {@link sampleCount} and resolved
|
|
2916
|
+
* pixel size as the geometry MRT (size: `<surface>` with samples matching).
|
|
2917
|
+
* When omitted, no real-color attachment is added to the pass.
|
|
2918
|
+
*
|
|
2919
|
+
* The target attachment uses `loadOp: "load"` (matches BJS), so the
|
|
2920
|
+
* caller must initialize the target's contents (e.g. via a clear pass)
|
|
2921
|
+
* before the geometry task runs — unless {@link targetTextureClearColor}
|
|
2922
|
+
* is provided. */
|
|
2923
|
+
targetTexture?: RenderTarget;
|
|
2924
|
+
/** When set together with {@link targetTexture}, the target attachment
|
|
2925
|
+
* uses `loadOp: "clear"` with this color at the start of the geometry
|
|
2926
|
+
* pass. Convenient for demo / standalone use where no prior task has
|
|
2927
|
+
* initialized the target's contents. */
|
|
2928
|
+
targetTextureClearColor?: GPUColor;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
/** One MRT color attachment requested by the user. */
|
|
2932
|
+
export declare interface GeometryRendererTextureDescription {
|
|
2933
|
+
/** Which geometry value to write. */
|
|
2934
|
+
readonly type: GeometryTextureType;
|
|
2935
|
+
/** Per-attachment WebGPU format override. Defaults to
|
|
2936
|
+
* {@link GEOMETRY_TEXTURE_DESCRIPTIONS}[type].defaultFormat. */
|
|
2937
|
+
readonly format?: GPUTextureFormat;
|
|
2938
|
+
/** Per-attachment clear-value override. Defaults to
|
|
2939
|
+
* {@link GEOMETRY_TEXTURE_DESCRIPTIONS}[type].clearValue. Use to match a
|
|
2940
|
+
* reference engine's clear behaviour (e.g. clear VIEW_DEPTH to 0 instead of
|
|
2941
|
+
* the camera far plane to mirror BJS's PREPASS_DEPTH). */
|
|
2942
|
+
readonly clearValue?: GPUColor;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
/**
|
|
2946
|
+
* Geometry renderer texture types.
|
|
2947
|
+
*
|
|
2948
|
+
* Each enum value corresponds to a single geometry attachment that
|
|
2949
|
+
* {@link createGeometryRendererTask} can write to. The companion
|
|
2950
|
+
* {@link GEOMETRY_TEXTURE_DESCRIPTIONS} table provides the default
|
|
2951
|
+
* per-type WebGPU format and the clear behaviour at the start of a
|
|
2952
|
+
* geometry pass.
|
|
2953
|
+
*
|
|
2954
|
+
* The enum is intentionally a subset of Babylon.js'
|
|
2955
|
+
* `MaterialHelperGeometryRendering.GeometryTextureDescriptions`. The
|
|
2956
|
+
* following BJS types are excluded by design:
|
|
2957
|
+
* - `ALBEDO_SQRT` — we only expose `ALBEDO`.
|
|
2958
|
+
* - `VELOCITY` (vec2 SS) — we only expose `LINEAR_VELOCITY` (vec3 WS).
|
|
2959
|
+
* - `IRRADIANCE_LEGACY` — we only expose `IRRADIANCE`.
|
|
2960
|
+
* - `COLOR` — handled separately via the geometry task's
|
|
2961
|
+
* optional `targetTexture` color attachment
|
|
2962
|
+
* (BJS `PREPASS_COLOR_INDEX`).
|
|
2963
|
+
*
|
|
2964
|
+
* Module is lazy-loaded by the geometry view and the geometry task only;
|
|
2965
|
+
* existing scenes never import it.
|
|
2966
|
+
*/
|
|
2967
|
+
/** Identifies a single geometry texture supported by `createGeometryRendererTask`. */
|
|
2968
|
+
export declare enum GeometryTextureType {
|
|
2969
|
+
/** Half-float RGBA — diffuse irradiance accumulated at the surface. */
|
|
2970
|
+
IRRADIANCE = 0,
|
|
2971
|
+
/** Half-float RGBA — world-space position. */
|
|
2972
|
+
WORLD_POSITION = 1,
|
|
2973
|
+
/** Half-float RGBA — object-local position (before world transform). */
|
|
2974
|
+
LOCAL_POSITION = 2,
|
|
2975
|
+
/** Unorm8 RGBA — material reflectivity (rgb) + roughness (a). */
|
|
2976
|
+
REFLECTIVITY = 3,
|
|
2977
|
+
/** Float R — linear view-space depth (camera-far at the far plane). Cleared to camera far. */
|
|
2978
|
+
VIEW_DEPTH = 4,
|
|
2979
|
+
/** Half-float R — view-space depth normalized to [0,1] (1 at the far plane). */
|
|
2980
|
+
NORMALIZED_VIEW_DEPTH = 5,
|
|
2981
|
+
/** Half-float R — clip-space depth in [0,1] (matches GPU depth buffer post-projection). */
|
|
2982
|
+
SCREENSPACE_DEPTH = 6,
|
|
2983
|
+
/** Half-float RGBA — view-space surface normal. */
|
|
2984
|
+
VIEW_NORMAL = 7,
|
|
2985
|
+
/** Half-float RGBA — world-space surface normal. */
|
|
2986
|
+
WORLD_NORMAL = 8,
|
|
2987
|
+
/** Unorm8 RGBA — surface albedo (diffuse colour, no lighting). */
|
|
2988
|
+
ALBEDO = 9,
|
|
2989
|
+
/** Half-float RGBA — per-pixel linear world-space velocity in units / frame. */
|
|
2990
|
+
LINEAR_VELOCITY = 10
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
/** Camera that orbits a spherical planet centred at the world origin (Babylon.js `GeospatialCamera`).
|
|
2994
|
+
*
|
|
2995
|
+
* Orientation is fully described by `center` (the anchored point on the globe in
|
|
2996
|
+
* ECEF coordinates), `yaw`, `pitch`, and `radius`. Setting any of these
|
|
2997
|
+
* recomputes the derived `position` / `upVector` and the view matrix.
|
|
2998
|
+
*
|
|
2999
|
+
* Pure state — behaviour is provided by standalone functions
|
|
3000
|
+
* ({@link setGeospatialOrientation}, `attachGeospatialControls`,
|
|
3001
|
+
* `flyGeospatialCameraToAsync`). The camera never references the scene. */
|
|
3002
|
+
export declare interface GeospatialCamera extends Camera, IWorldMatrixProvider, IParentable {
|
|
3003
|
+
/** The anchored point on the globe (ECEF). Assigning re-orbits around the new centre. */
|
|
3004
|
+
center: Vec3;
|
|
3005
|
+
/** Yaw about the geocentric up axis. Wrapped to [-π, π). 0 = north, π/2 = east. */
|
|
3006
|
+
yaw: number;
|
|
3007
|
+
/** Pitch from looking straight down (0) to the horizon (π/2). Wrapped to [-π, π). */
|
|
3008
|
+
pitch: number;
|
|
3009
|
+
/** Distance from the camera to its centre point (distinct from `planetRadius`). */
|
|
3010
|
+
radius: number;
|
|
3011
|
+
/** Limits governing yaw/pitch/radius clamping. Mutable; clamping applies on the next orientation change. */
|
|
3012
|
+
limits: GeospatialLimits;
|
|
3013
|
+
/** Derived world-space eye position. Read-only — driven by center/yaw/pitch/radius. */
|
|
3014
|
+
readonly position: Vec3;
|
|
3015
|
+
/** Derived camera up vector. Read-only. */
|
|
3016
|
+
readonly upVector: Vec3;
|
|
3017
|
+
fov: number;
|
|
3018
|
+
nearPlane: number;
|
|
3019
|
+
farPlane: number;
|
|
3020
|
+
viewport?: NormalizedViewport;
|
|
3021
|
+
children: SceneNode[];
|
|
3022
|
+
parent: IWorldMatrixProvider | null;
|
|
3023
|
+
readonly worldMatrix: Mat4;
|
|
3024
|
+
readonly worldMatrixVersion: number;
|
|
3025
|
+
|
|
3026
|
+
/** Options for {@link createGeospatialCamera}. */
|
|
3027
|
+
export declare interface GeospatialCameraOptions {
|
|
3028
|
+
/** Radius of the planet being orbited. */
|
|
3029
|
+
planetRadius: number;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
/** Options for {@link attachGeospatialControls}. */
|
|
3033
|
+
export declare interface GeospatialControlOptions {
|
|
3034
|
+
/** When true, zooming moves toward the point under the cursor; otherwise along the look vector. Default true. */
|
|
3035
|
+
zoomToCursor?: boolean;
|
|
3036
|
+
/** Enable simple sphere collision so the camera cannot dip below the surface. Default false. */
|
|
3037
|
+
checkCollisions?: boolean;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
/** Options for {@link flyGeospatialCameraToAsync}. Omitted target fields keep their current value. */
|
|
3041
|
+
export declare interface GeospatialFlyOptions {
|
|
3042
|
+
/** Target yaw (radians). Shortest angular path is taken. */
|
|
3043
|
+
yaw?: number;
|
|
3044
|
+
/** Target pitch (radians). */
|
|
3045
|
+
pitch?: number;
|
|
3046
|
+
/** Target radius. */
|
|
3047
|
+
radius?: number;
|
|
3048
|
+
/** Target centre (ECEF). Animated along a great-circle (slerp). */
|
|
3049
|
+
center?: Vec3;
|
|
3050
|
+
/** Flight duration in ms. Default 1000. */
|
|
3051
|
+
durationMs?: number;
|
|
3052
|
+
/** Parabolic "hop" height scale for the centre animation (0 = none). */
|
|
3053
|
+
centerHopScale?: number;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
/** Pitch/yaw/radius bounds for a {@link GeospatialCamera}.
|
|
3057
|
+
*
|
|
3058
|
+
* Pure state, mirroring Babylon.js `GeospatialLimits`. Behaviour
|
|
3059
|
+
* ({@link getEffectivePitchMax}, {@link clampZoomDistance}) lives in
|
|
3060
|
+
* standalone functions so unused limit logic is tree-shaken.
|
|
3061
|
+
*
|
|
3062
|
+
* All angles are in radians. Pitch is measured from "looking straight down at
|
|
3063
|
+
* the planet centre" (0) to "looking at the horizon" (π/2). */
|
|
3064
|
+
export declare interface GeospatialLimits {
|
|
3065
|
+
/** Radius of the planet — used for altitude/radius conversions. */
|
|
3066
|
+
planetRadius: number;
|
|
3067
|
+
/** Minimum camera distance from its centre point (closest zoom). Default 10. */
|
|
3068
|
+
radiusMin: number;
|
|
3069
|
+
/** Maximum camera distance from its centre point (farthest zoom). Default `planetRadius * 4`. */
|
|
3070
|
+
radiusMax: number;
|
|
3071
|
+
/** Minimum pitch angle (≈0 = looking straight down at the planet). */
|
|
3072
|
+
pitchMin: number;
|
|
3073
|
+
/** Maximum pitch angle (π/2 = looking at the horizon). */
|
|
3074
|
+
pitchMax: number;
|
|
3075
|
+
/**
|
|
3076
|
+
* Controls how pitch is disabled as the camera zooms out.
|
|
3077
|
+
* `x` = radius scale at which full pitch is allowed (e.g. 2 ⇒ 2·planetRadius),
|
|
3078
|
+
* `y` = radius scale at which pitch is fully disabled (forced to `pitchMin`).
|
|
3079
|
+
* `null` disables this feature (full pitch at every radius).
|
|
3080
|
+
*/
|
|
3081
|
+
pitchDisabledRadiusScale: {
|
|
3082
|
+
x: number;
|
|
3083
|
+
y: number;
|
|
3084
|
+
} | null;
|
|
3085
|
+
/** Minimum yaw angle (rotation about the geocentric up axis). Default -Infinity. */
|
|
3086
|
+
yawMin: number;
|
|
3087
|
+
/** Maximum yaw angle. Default +Infinity. */
|
|
3088
|
+
yawMax: number;
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
/** A delta to apply via {@link setGeospatialOrientation}; omitted fields keep their current value. */
|
|
3092
|
+
export declare interface GeospatialOrientation {
|
|
3093
|
+
/** Yaw in radians (0 = north, π/2 = east). */
|
|
3094
|
+
yaw?: number;
|
|
3095
|
+
/** Pitch in radians (0 = looking straight down at the planet centre, π/2 = horizon). */
|
|
3096
|
+
pitch?: number;
|
|
3097
|
+
/** Distance from the camera to its centre point. */
|
|
3098
|
+
radius?: number;
|
|
3099
|
+
/** Anchor point on the globe (ECEF) that the camera orbits. */
|
|
3100
|
+
center?: Vec3;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
1992
3103
|
/** Get the current world position of an agent. */
|
|
1993
3104
|
export declare function getAgentPosition(crowd: NavCrowd, index: number): Vec3;
|
|
1994
3105
|
|
|
@@ -2014,6 +3125,14 @@ export declare function getClosestPoint(plugin: NavigationPlugin, position: Vec3
|
|
|
2014
3125
|
/** Returns the render-target aspect ratio adjusted for the camera's normalized viewport, or the raw ratio if none. */
|
|
2015
3126
|
export declare function getEffectiveAspectRatio(camera: Camera | null | undefined, targetWidth: number, targetHeight: number): number;
|
|
2016
3127
|
|
|
3128
|
+
/**
|
|
3129
|
+
* Computes the effective maximum pitch for a given camera radius. When
|
|
3130
|
+
* `pitchDisabledRadiusScale` is set, pitch is interpolated from `pitchMax` down
|
|
3131
|
+
* to `pitchMin` as the camera zooms out from `x·planetRadius` to `y·planetRadius`
|
|
3132
|
+
* (so a fully zoomed-out camera looks straight down).
|
|
3133
|
+
*/
|
|
3134
|
+
export declare function getEffectivePitchMax(limits: GeospatialLimits, currentRadius: number): number;
|
|
3135
|
+
|
|
2017
3136
|
/** Read the current floating-origin offset from a scene as a `Vec3`. The
|
|
2018
3137
|
* offset is the active camera's world position. Returns the zero vector
|
|
2019
3138
|
* when no camera is set (typical headless/precompute case). For non-LWR
|
|
@@ -2026,12 +3145,21 @@ export declare function getFrameGraph(scene: SceneContext): FrameGraph;
|
|
|
2026
3145
|
/** Get the current seed used by Recast's randomized queries. */
|
|
2027
3146
|
export declare function getNavigationRandomSeed(plugin: NavigationPlugin): number;
|
|
2028
3147
|
|
|
3148
|
+
/** Get or create a deduplicated sampler. Same config → same GPUSampler. */
|
|
3149
|
+
export declare function getOrCreateSampler(engine: EngineContext, desc?: GPUSamplerDescriptor): GPUSampler;
|
|
3150
|
+
|
|
3151
|
+
/**
|
|
3152
|
+
* Get a body's current linear velocity (m/s).
|
|
3153
|
+
*/
|
|
3154
|
+
export declare function getPhysicsBodyLinearVelocity(world: PhysicsWorld, body: PhysicsBody): Vec3;
|
|
3155
|
+
|
|
2029
3156
|
/**
|
|
2030
|
-
* Returns the world's current gravity vector.
|
|
3157
|
+
* Returns the world's current gravity vector, or a specific region's when `worldPosition` is given.
|
|
2031
3158
|
* @param world - The physics world.
|
|
3159
|
+
* @param worldPosition - Optional world position selecting the region to read; omit for the world-wide gravity.
|
|
2032
3160
|
* @returns Gravity acceleration in m/s².
|
|
2033
3161
|
*/
|
|
2034
|
-
export declare function getPhysicsGravity(world: PhysicsWorld): Vec3;
|
|
3162
|
+
export declare function getPhysicsGravity(world: PhysicsWorld, worldPosition?: Vec3): Vec3;
|
|
2035
3163
|
|
|
2036
3164
|
/**
|
|
2037
3165
|
* Returns the world's fixed simulation timestep in seconds.
|
|
@@ -2066,6 +3194,9 @@ export declare function getPickedUV(info: PickingInfo): [number, number] | null;
|
|
|
2066
3194
|
/** Compute the projection matrix for a camera. Cached per worldMatrixVersion + aspect. */
|
|
2067
3195
|
export declare function getProjectionMatrix(camera: Camera, aspectRatio: number): Mat4;
|
|
2068
3196
|
|
|
3197
|
+
/** Return the latest task GPU timing snapshot without stalling the GPU or CPU. */
|
|
3198
|
+
export declare function getRenderTaskGpuTimings(engine: EngineContext): RenderTaskGpuTimings;
|
|
3199
|
+
|
|
2069
3200
|
/**
|
|
2070
3201
|
* Resolves the current instance index of the sprite referenced by `handle`.
|
|
2071
3202
|
* @param handle - Handle of the sprite to resolve.
|
|
@@ -2098,6 +3229,21 @@ export declare function getViewMatrix(camera: Camera): Mat4;
|
|
|
2098
3229
|
/** Compute the view-projection matrix for a camera. Cached per worldMatrixVersion + aspect. */
|
|
2099
3230
|
export declare function getViewProjectionMatrix(camera: Camera, aspectRatio: number): Mat4;
|
|
2100
3231
|
|
|
3232
|
+
declare interface GizmoMaterialSet {
|
|
3233
|
+
colored: StandardMaterialProps;
|
|
3234
|
+
hover: StandardMaterialProps;
|
|
3235
|
+
disabled: StandardMaterialProps;
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
/** Tiny single-event observable used by gizmos/pointer-drag (no dependency on
|
|
3239
|
+
* BJS's Observable, no module-level allocations). */
|
|
3240
|
+
declare class GizmoObservable<T> {
|
|
3241
|
+
private _subs;
|
|
3242
|
+
add(cb: (arg: T) => void): () => void;
|
|
3243
|
+
notify(arg: T): void;
|
|
3244
|
+
clear(): void;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
2101
3247
|
/** Everything the animation system needs, parsed from a glTF file. */
|
|
2102
3248
|
export declare interface GltfAnimationData {
|
|
2103
3249
|
readonly clips: readonly AnimationClip[];
|
|
@@ -2115,6 +3261,61 @@ export declare interface GltfAnimationData {
|
|
|
2115
3261
|
readonly excludedNodeIndices: ReadonlySet<number>;
|
|
2116
3262
|
}
|
|
2117
3263
|
|
|
3264
|
+
export declare type GlyphBounds = {
|
|
3265
|
+
readonly xMin: number;
|
|
3266
|
+
readonly yMin: number;
|
|
3267
|
+
readonly xMax: number;
|
|
3268
|
+
readonly yMax: number;
|
|
3269
|
+
};
|
|
3270
|
+
|
|
3271
|
+
export declare type GlyphCurves = {
|
|
3272
|
+
readonly glyphId: number;
|
|
3273
|
+
readonly curves: readonly QuadCurve[];
|
|
3274
|
+
readonly bounds: GlyphBounds;
|
|
3275
|
+
|
|
3276
|
+
export declare type GlyphRun = {
|
|
3277
|
+
/** Which curve set this run's glyph ids index into. */
|
|
3278
|
+
readonly curveSet: CurveSetId;
|
|
3279
|
+
readonly glyphs: readonly PlacedGlyph[];
|
|
3280
|
+
/** Font-units → pixels scale used by the layout. */
|
|
3281
|
+
readonly pixelsPerFontUnit: number;
|
|
3282
|
+
/** Optional default color for every glyph in this run, as linear RGBA in [0,1]. A glyph's
|
|
3283
|
+
* own `PlacedGlyph.color` takes precedence over this. When omitted, glyphs default to
|
|
3284
|
+
* opaque white. The rendered alpha is additionally scaled by the whole-block opacity. */
|
|
3285
|
+
readonly defaultColor?: readonly [number, number, number, number];
|
|
3286
|
+
};
|
|
3287
|
+
|
|
3288
|
+
/** Opaque bundle of glyph outlines (organized by curve-set) and the GPU atlases packed
|
|
3289
|
+
* from them. Holds an arbitrary number of curve-sets — each curve-set gets its own atlas.
|
|
3290
|
+
* Shared by reference across any number of `TextData`s that need the same glyph catalog. */
|
|
3291
|
+
export declare interface GlyphStorage {
|
|
3292
|
+
readonly [glyphStorageBrand]: true;
|
|
3293
|
+
|
|
3294
|
+
/** Glyph storage: per-curve-set CPU outline catalog plus the GPU atlas packed from it.
|
|
3295
|
+
*
|
|
3296
|
+
* Layered:
|
|
3297
|
+
* - `GlyphStorage` is the opaque public handle. Holds one or more curve-sets keyed by
|
|
3298
|
+
* `CurveSetId` (typically a font family name). Each curve-set owns its glyph
|
|
3299
|
+
* outlines plus the `SharedAtlas` packed from them.
|
|
3300
|
+
* - `SharedAtlas` is the CPU staging: two `rgba32float`-shaped `Float32Array`s holding
|
|
3301
|
+
* quadratic curve control points and per-band curve-index lists, both append-only.
|
|
3302
|
+
* - Atlas packing (`packAppendGlyph`) and spatial-band partitioning (`buildGlyphBands`)
|
|
3303
|
+
* live here as internal helpers — they implement the storage's invariants and are
|
|
3304
|
+
* not callable from outside the module.
|
|
3305
|
+
* - GPU creation/upload (`SharedAtlasGpu`, `ensureSharedAtlasGpu`) lives in
|
|
3306
|
+
* `_gpu/text-textures.ts`; the shared types are exported from here. GPU teardown
|
|
3307
|
+
* is performed inline in `disposeGlyphStorage` to avoid a circular import edge.
|
|
3308
|
+
*
|
|
3309
|
+
* Lifetime is caller-owned (matches `Texture2D` semantics):
|
|
3310
|
+
* - `createGlyphStorage(initial?)` allocates a fresh storage, optionally seeded.
|
|
3311
|
+
* - `updateGlyphStorage(storage, curveSetId, curves)` adds glyphs (creating the
|
|
3312
|
+
* curve-set on demand). Glyph ids already present are skipped.
|
|
3313
|
+
* - `disposeGlyphStorage(storage)` releases every atlas. The caller must ensure no
|
|
3314
|
+
* `TextData` is still drawing from it — using a disposed storage is undefined
|
|
3315
|
+
* behavior. Idempotent.
|
|
3316
|
+
*/
|
|
3317
|
+
declare const glyphStorageBrand: unique symbol;
|
|
3318
|
+
|
|
2118
3319
|
/** Seek to a specific frame, apply the pose, and pause. */
|
|
2119
3320
|
export declare function goToFrame(group: AnimationGroup, frame: number, engine?: EngineContext): void;
|
|
2120
3321
|
|
|
@@ -2237,6 +3438,27 @@ declare interface HdrLoadOptions {
|
|
|
2237
3438
|
skyboxSize?: number;
|
|
2238
3439
|
}
|
|
2239
3440
|
|
|
3441
|
+
/** Options for {@link createHeightFieldShape}. */
|
|
3442
|
+
export declare interface HeightFieldShapeOptions {
|
|
3443
|
+
/**
|
|
3444
|
+
* Ground mesh whose world-space vertex grid defines the heightfield. When set, the
|
|
3445
|
+
* sample count, world size, and height data are derived from the mesh (the explicit
|
|
3446
|
+
* fields below are ignored). The mesh must be a regular `(N+1)×(N+1)` grid such as the
|
|
3447
|
+
* one produced by `createGroundFromHeightMap`.
|
|
3448
|
+
*/
|
|
3449
|
+
groundMesh?: Mesh;
|
|
3450
|
+
/** Explicit: number of height samples along X. */
|
|
3451
|
+
numHeightFieldSamplesX?: number;
|
|
3452
|
+
/** Explicit: number of height samples along Z. */
|
|
3453
|
+
numHeightFieldSamplesZ?: number;
|
|
3454
|
+
/** Explicit: world-space size along X. */
|
|
3455
|
+
heightFieldSizeX?: number;
|
|
3456
|
+
/** Explicit: world-space size along Z. */
|
|
3457
|
+
heightFieldSizeZ?: number;
|
|
3458
|
+
/** Explicit: row-major height samples (`numHeightFieldSamplesX * numHeightFieldSamplesZ`). */
|
|
3459
|
+
heightFieldData?: Float32Array;
|
|
3460
|
+
}
|
|
3461
|
+
|
|
2240
3462
|
export declare interface HemisphericLight extends LightBase {
|
|
2241
3463
|
readonly lightType: "hemispheric";
|
|
2242
3464
|
direction: ObservableVec3;
|
|
@@ -2246,6 +3468,9 @@ export declare interface HemisphericLight extends LightBase {
|
|
|
2246
3468
|
groundColor: [number, number, number];
|
|
2247
3469
|
}
|
|
2248
3470
|
|
|
3471
|
+
/** Hides a body that was previously shown with {@link showPhysicsBody}. */
|
|
3472
|
+
export declare function hidePhysicsBody(viewer: PhysicsViewer, body: PhysicsBody): boolean;
|
|
3473
|
+
|
|
2249
3474
|
/** Image processing configuration. */
|
|
2250
3475
|
export declare interface ImageProcessingConfig {
|
|
2251
3476
|
exposure: number;
|
|
@@ -2269,6 +3494,13 @@ export declare function initializeCsg2Async(): Promise<void>;
|
|
|
2269
3494
|
|
|
2270
3495
|
declare type InterpMode = 0 | 1 | 2;
|
|
2271
3496
|
|
|
3497
|
+
/** Force every registered scene's cached render + shadow bundles to RE-RECORD on the next frame, by bumping
|
|
3498
|
+
* each rendering context's `_renderableVersion` (the same signal a mesh add/remove or `resizeMeshGeometry`
|
|
3499
|
+
* emits). Use after an out-of-band GPU buffer REALLOCATION that the cached bundles can't otherwise notice —
|
|
3500
|
+
* e.g. growing a thin-instanced mesh's matrix buffer past its capacity (the bundle captured the old buffer
|
|
3501
|
+
* handle and would bind a freed buffer). A no-op-cheap version bump; the actual re-record happens lazily. */
|
|
3502
|
+
export declare function invalidateRenderBundles(engine: EngineContext): void;
|
|
3503
|
+
|
|
2272
3504
|
/** Any object that can be attached to a parent in the scene hierarchy.
|
|
2273
3505
|
* When parent is null, position/rotation/scaling are in world space. */
|
|
2274
3506
|
export declare interface IParentable {
|
|
@@ -2302,6 +3534,34 @@ export declare function isBillboardSpriteHandleAlive(handle: BillboardSpriteHand
|
|
|
2302
3534
|
/** Returns whether the manifold-3d runtime has finished loading and CSG2 is usable. */
|
|
2303
3535
|
export declare function isCsg2Ready(): boolean;
|
|
2304
3536
|
|
|
3537
|
+
/** Returns true when the gizmo dispatcher for `canvas` has an ACTIVE drag in
|
|
3538
|
+
* progress (a collider was pressed and is being dragged). Unlike
|
|
3539
|
+
* {@link isGizmoInteracting} this ignores mere hover, so camera controls can
|
|
3540
|
+
* abort an optimistically-started orbit once a gizmo drag (recognised a frame
|
|
3541
|
+
* after pointer-down, since picking is async) reclaims the gesture — without
|
|
3542
|
+
* aborting a legitimate orbit when the cursor merely passes over a gizmo. */
|
|
3543
|
+
export declare function isGizmoDragging(canvas: HTMLCanvasElement): boolean;
|
|
3544
|
+
|
|
3545
|
+
/** Returns true when the gizmo dispatcher for `canvas` currently has a pointer
|
|
3546
|
+
* hovering one of its colliders or an active drag in progress. Camera
|
|
3547
|
+
* controls consult this on pointer-down so orbiting doesn't start when the
|
|
3548
|
+
* press lands on (or drags) a gizmo. */
|
|
3549
|
+
export declare function isGizmoInteracting(canvas: HTMLCanvasElement): boolean;
|
|
3550
|
+
|
|
3551
|
+
/** Returns true while the gizmo dispatcher for `canvas` has a pointer-down GPU
|
|
3552
|
+
* pick still in flight. Camera controls consult this to DEFER (not yet apply)
|
|
3553
|
+
* an orbit until the pick resolves, so a press that lands on a gizmo never
|
|
3554
|
+
* produces a stray orbit even if the async pick is slow. */
|
|
3555
|
+
export declare function isGizmoPickPending(canvas: HTMLCanvasElement): boolean;
|
|
3556
|
+
|
|
3557
|
+
/** Whether GPU frame-time measurement is available on this engine's device — i.e. the adapter offered
|
|
3558
|
+
* the WebGPU `timestamp-query` feature (requested opportunistically by {@link createEngine}). When false,
|
|
3559
|
+
* {@link setGpuTimingEnabled} is a no-op and {@link EngineContext.gpuFrameTimeMs} stays 0. */
|
|
3560
|
+
export declare function isGpuTimingSupported(engine: EngineContext): boolean;
|
|
3561
|
+
|
|
3562
|
+
/** Whether per-render-task GPU timing can run on this engine's WebGPU device. */
|
|
3563
|
+
export declare function isRenderTaskGpuTimingSupported(engine: EngineContext): boolean;
|
|
3564
|
+
|
|
2305
3565
|
/**
|
|
2306
3566
|
* Returns `true` if the sprite referenced by `handle` is still present in its layer.
|
|
2307
3567
|
* @param handle - Handle to test.
|
|
@@ -2333,6 +3593,19 @@ export declare interface LightBase extends IWorldMatrixProvider, IParentable {
|
|
|
2333
3593
|
readonly worldMatrix: Mat4;
|
|
2334
3594
|
readonly worldMatrixVersion: number;
|
|
2335
3595
|
|
|
3596
|
+
export declare interface LightGizmo {
|
|
3597
|
+
/** Root node — follows the attached light's position (when it has one)
|
|
3598
|
+
* and orients along its direction (when it has one). */
|
|
3599
|
+
readonly root: SceneNode;
|
|
3600
|
+
readonly material: StandardMaterialProps;
|
|
3601
|
+
/** Currently attached light — set via `attachLightGizmoToLight`. */
|
|
3602
|
+
attachedLight: LightBase | null;
|
|
3603
|
+
|
|
3604
|
+
export declare interface LightGizmoOptions {
|
|
3605
|
+
/** RGB color for the light gizmo body material. Defaults to grey. */
|
|
3606
|
+
color?: [number, number, number];
|
|
3607
|
+
}
|
|
3608
|
+
|
|
2336
3609
|
/** Options for `createLinearDepthMaterial()`. */
|
|
2337
3610
|
export declare interface LinearDepthMaterialOptions {
|
|
2338
3611
|
/** Camera near plane (defaults to 0.03 to match the source playground). */
|
|
@@ -2343,6 +3616,9 @@ export declare interface LinearDepthMaterialOptions {
|
|
|
2343
3616
|
name?: string;
|
|
2344
3617
|
}
|
|
2345
3618
|
|
|
3619
|
+
/** Convert linear [0,1] to sRGB [0,255] using the IEC 61966-2-1 transfer curve. */
|
|
3620
|
+
export declare function linearToSrgbByte(v: number): number;
|
|
3621
|
+
|
|
2346
3622
|
/** Options for `loadSpriteAtlas`. PR 1 supports the `gridSize` path only. */
|
|
2347
3623
|
export declare interface LoadAtlasOptions {
|
|
2348
3624
|
/** Grid cell size `[w, h]` in pixels. Required in PR 1. */
|
|
@@ -2417,6 +3693,9 @@ export declare function loadEnvironment(scene: SceneContext, url: string, option
|
|
|
2417
3693
|
brdfUrl: string;
|
|
2418
3694
|
}): Promise<EnvironmentTextures>;
|
|
2419
3695
|
|
|
3696
|
+
/** Load a TTF or OTF font from a URL. */
|
|
3697
|
+
export declare function loadFont(url: string): Promise<Font>;
|
|
3698
|
+
|
|
2420
3699
|
/**
|
|
2421
3700
|
* Load a .glb or .gltf file, parse it, and upload mesh + material data to GPU.
|
|
2422
3701
|
* Supports both binary GLB and separate .gltf + .bin + image files.
|
|
@@ -2455,6 +3734,14 @@ export declare function loadHdrEnvironment(scene: SceneContext, url: string, opt
|
|
|
2455
3734
|
*/
|
|
2456
3735
|
export declare function loadKtxTexture2D(engine: EngineContext, baseUrl: string, suffixes: string[], opts?: Texture2DOptions): Promise<Texture2D>;
|
|
2457
3736
|
|
|
3737
|
+
/**
|
|
3738
|
+
* Resolve a node-block emitter, including the geometry-renderer terminal
|
|
3739
|
+
* (`GeometryTextureOutputBlock`). Pass as `blockLoader` to
|
|
3740
|
+
* `parseNodeMaterialFromSnippet` for node-material geometry-renderer scenes so
|
|
3741
|
+
* ordinary node scenes don't bundle the geometry block.
|
|
3742
|
+
*/
|
|
3743
|
+
export declare function loadNodeBlockEmitterWithGeometry(className: string): Promise<BlockEmitter>;
|
|
3744
|
+
|
|
2458
3745
|
/** Load a skybox cube texture and register it on the scene.
|
|
2459
3746
|
* The auto-builder will create the pipeline and render it.
|
|
2460
3747
|
*
|
|
@@ -2600,7 +3887,12 @@ export declare interface MaterialVariantData {
|
|
|
2600
3887
|
* The view is also a Material: it inherits material state from {@link source}
|
|
2601
3888
|
* through the prototype chain and owns only render-feature bits. Keeping views
|
|
2602
3889
|
* material-compatible lets ordinary render paths read properties normally, so
|
|
2603
|
-
* scenes that never create views do not retain view-specific unwrap branches.
|
|
3890
|
+
* scenes that never create views do not retain view-specific unwrap branches.
|
|
3891
|
+
*
|
|
3892
|
+
* Specialized views (e.g. the Standard geometry MRT view) override
|
|
3893
|
+
* {@link Material._buildGroup} with a view-specific builder whose
|
|
3894
|
+
* `_rebuildSingle` builds the right kind of Renderable — no per-family
|
|
3895
|
+
* branching is required in the core render-task. */
|
|
2604
3896
|
export declare interface MaterialView extends Material {
|
|
2605
3897
|
readonly source: Material;
|
|
2606
3898
|
|
|
@@ -2625,6 +3917,9 @@ export declare interface Mesh extends SceneNode {
|
|
|
2625
3917
|
boundMax?: [number, number, number];
|
|
2626
3918
|
/** Skeleton GPU data (skeletal animation). Type-only — no module dependency. */
|
|
2627
3919
|
skeleton?: SkeletonData | null;
|
|
3920
|
+
/** Baked vertex-animation (VAT) GPU data — replaces live skinning so the mesh thin-instances.
|
|
3921
|
+
* Mutually exclusive with live `skeleton` skinning. Type-only — no module dependency. */
|
|
3922
|
+
vat?: VatData | null;
|
|
2628
3923
|
/** Morph target GPU data. Type-only — no module dependency. */
|
|
2629
3924
|
morphTargets?: MorphTargetData | null;
|
|
2630
3925
|
/** User-controlled render order. Lower = drawn first within phase.
|
|
@@ -2637,7 +3932,12 @@ export declare interface Mesh extends SceneNode {
|
|
|
2637
3932
|
* (`needAlphaBlending`) are deferred. No effect on tasks without transmission. */
|
|
2638
3933
|
renderOnTop?: boolean;
|
|
2639
3934
|
/** Thin instance data (CPU-side). GPU buffer managed by render system. */
|
|
2640
|
-
thinInstances?: ThinInstanceData | null;
|
|
3935
|
+
thinInstances?: ThinInstanceData | null;
|
|
3936
|
+
/** When `false`, the GPU picker skips this mesh. Defaults to `true`
|
|
3937
|
+
* (undefined behaves as pickable). Mirrors BJS `AbstractMesh.isPickable`. */
|
|
3938
|
+
pickable?: boolean;
|
|
3939
|
+
/** Optional per-mesh GPU-picking clip volumes. Fragments inside any volume are ignored by the GPU picker. */
|
|
3940
|
+
pickingClipVolumes?: readonly PickingClipVolume[] | null;
|
|
2641
3941
|
|
|
2642
3942
|
/** Opaque GPU geometry handle (user never touches these). */
|
|
2643
3943
|
export declare interface MeshGPU {
|
|
@@ -2720,6 +4020,12 @@ export declare interface NavMeshParameters {
|
|
|
2720
4020
|
keepIntermediates?: boolean;
|
|
2721
4021
|
}
|
|
2722
4022
|
|
|
4023
|
+
/** A single mesh source for navmesh construction. */
|
|
4024
|
+
export declare interface NavMeshSource {
|
|
4025
|
+
positions: ArrayLike<number>;
|
|
4026
|
+
indices: ArrayLike<number>;
|
|
4027
|
+
}
|
|
4028
|
+
|
|
2723
4029
|
/** Parsed block in the graph. */
|
|
2724
4030
|
declare interface NodeBlock {
|
|
2725
4031
|
readonly id: number;
|
|
@@ -2810,8 +4116,7 @@ declare interface NodeBuildState {
|
|
|
2810
4116
|
hasSkeleton: boolean;
|
|
2811
4117
|
/** When false (default), InstancesBlock passes through the uniform world
|
|
2812
4118
|
* matrix. Set to true when thin-instance attributes are bound. */
|
|
2813
|
-
hasInstances: boolean;
|
|
2814
|
-
}
|
|
4119
|
+
hasInstances: boolean;
|
|
2815
4120
|
|
|
2816
4121
|
/** A single connection point on a block — input only.
|
|
2817
4122
|
* Output connection types are resolved by the emitter at graph-walk time. */
|
|
@@ -2927,6 +4232,9 @@ export declare interface NormalizedViewport {
|
|
|
2927
4232
|
height: number;
|
|
2928
4233
|
}
|
|
2929
4234
|
|
|
4235
|
+
/** Wrap an angle to [-π, π), matching Babylon.js `Scalar.NormalizeRadians`. */
|
|
4236
|
+
export declare function normalizeRadians(angle: number): number;
|
|
4237
|
+
|
|
2930
4238
|
/**
|
|
2931
4239
|
* Normalizes the vector `(x, y, z)` to unit length.
|
|
2932
4240
|
* @param x - X component.
|
|
@@ -3029,10 +4337,24 @@ export declare function onBeforeRender(scene: SceneContext, cb: (deltaMs: number
|
|
|
3029
4337
|
*/
|
|
3030
4338
|
export declare function onCsmReceiverUpdate(sg: ShadowGenerator, cb: (data: Float32Array) => void): () => void;
|
|
3031
4339
|
|
|
4340
|
+
/**
|
|
4341
|
+
* Registers a callback to run after each physics step, once dynamic body transforms have been
|
|
4342
|
+
* synced back to their nodes and before the frame is rendered. Use this for per-step logic that
|
|
4343
|
+
* must observe (or react to) the freshly-integrated state — e.g. tracking a marker to a body's
|
|
4344
|
+
* post-step pose, or applying a force whose effect should integrate on the next step.
|
|
4345
|
+
* @param world - The physics world to hook.
|
|
4346
|
+
* @param cb - Callback invoked with the world timestep (seconds) after each step.
|
|
4347
|
+
*/
|
|
4348
|
+
export declare function onPhysicsAfterStep(world: PhysicsWorld, cb: (timestep: number) => void): void;
|
|
4349
|
+
|
|
3032
4350
|
/** Register a callback to run when `disposeScene` is called. Used to tie
|
|
3033
4351
|
* user-owned GPU resources (e.g. a `SpriteRenderer`) to the scene's lifetime. */
|
|
3034
4352
|
export declare function onSceneDispose(scene: SceneContext, cb: () => void): void;
|
|
3035
4353
|
|
|
4354
|
+
/** Convert a packed 0xRRGGBB sRGB color to a linear-RGBA tuple suitable for
|
|
4355
|
+
* text-renderer `defaultColor` / `PlacedGlyph.color`. */
|
|
4356
|
+
export declare function packedSrgbToLinearRgba(packed: number, alpha?: number): readonly [number, number, number, number];
|
|
4357
|
+
|
|
3036
4358
|
/** Parse a Babylon NME graph (by snippet ID or inline JSON), emit WGSL, compile
|
|
3037
4359
|
* the GPU pipeline, and return a ready-to-render `NodeMaterial`.
|
|
3038
4360
|
* @param engine - Engine context.
|
|
@@ -3226,11 +4548,89 @@ export declare interface PhysicsAggregateOptions {
|
|
|
3226
4548
|
center?: Vec3;
|
|
3227
4549
|
startAsleep?: boolean;
|
|
3228
4550
|
isTriggerShape?: boolean;
|
|
4551
|
+
/**
|
|
4552
|
+
* Optional pre-built shape. When provided, it is used directly and the
|
|
4553
|
+
* primitive-shape build path is skipped. This lets callers supply
|
|
4554
|
+
* mesh/convex-hull shapes (built via `createPhysicsShape`) without pulling
|
|
4555
|
+
* the mesh-shape code into `createPhysicsAggregate` itself.
|
|
4556
|
+
*/
|
|
4557
|
+
shape?: PhysicsShape;
|
|
3229
4558
|
}
|
|
3230
4559
|
|
|
3231
4560
|
/** Opaque handle to a Havok rigid body, bound to a scene node and a motion type. */
|
|
3232
4561
|
export declare interface PhysicsBody {
|
|
3233
4562
|
readonly node: SceneNode;
|
|
3234
|
-
readonly motionType: PhysicsMotionType;
|
|
4563
|
+
readonly motionType: PhysicsMotionType;
|
|
4564
|
+
|
|
4565
|
+
/** Opaque handle to a Havok constraint between two bodies. */
|
|
4566
|
+
export declare interface PhysicsConstraint {
|
|
3235
4567
|
readonly bodyA: PhysicsBody;
|
|
4568
|
+
readonly bodyB: PhysicsBody;
|
|
4569
|
+
readonly type: PhysicsConstraintType;
|
|
4570
|
+
readonly options: PhysicsConstraintOptions;
|
|
4571
|
+
readonly limits?: readonly PhysicsConstraintLimit[];
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4574
|
+
/** Axis addressed by a Physics V2 constraint limit. */
|
|
4575
|
+
export declare const enum PhysicsConstraintAxis {
|
|
4576
|
+
LINEAR_X = 0,
|
|
4577
|
+
LINEAR_Y = 1,
|
|
4578
|
+
LINEAR_Z = 2,
|
|
4579
|
+
ANGULAR_X = 3,
|
|
4580
|
+
ANGULAR_Y = 4,
|
|
4581
|
+
ANGULAR_Z = 5,
|
|
4582
|
+
LINEAR_DISTANCE = 6
|
|
4583
|
+
}
|
|
4584
|
+
|
|
4585
|
+
/** Minimal constraint debug data consumed by the Lite PhysicsViewer. */
|
|
4586
|
+
export declare interface PhysicsConstraintDebug {
|
|
4587
|
+
readonly bodyA: PhysicsBody;
|
|
4588
|
+
readonly bodyB: PhysicsBody;
|
|
4589
|
+
readonly pivotA: Vec3;
|
|
4590
|
+
readonly pivotB: Vec3;
|
|
4591
|
+
readonly axisA?: Vec3;
|
|
4592
|
+
readonly axisB?: Vec3;
|
|
4593
|
+
readonly perpAxisA?: Vec3;
|
|
4594
|
+
readonly perpAxisB?: Vec3;
|
|
4595
|
+
readonly type?: number;
|
|
4596
|
+
}
|
|
4597
|
+
|
|
4598
|
+
/** Limit options used by 6DoF constraints. */
|
|
4599
|
+
export declare interface PhysicsConstraintLimit {
|
|
4600
|
+
axis: PhysicsConstraintAxis;
|
|
4601
|
+
minLimit?: number;
|
|
4602
|
+
maxLimit?: number;
|
|
4603
|
+
stiffness?: number;
|
|
4604
|
+
damping?: number;
|
|
4605
|
+
}
|
|
4606
|
+
|
|
4607
|
+
/** Pivot/axis options used to create a physics constraint. */
|
|
4608
|
+
export declare interface PhysicsConstraintOptions {
|
|
4609
|
+
pivotA?: Vec3;
|
|
4610
|
+
pivotB?: Vec3;
|
|
4611
|
+
axisA?: Vec3;
|
|
4612
|
+
axisB?: Vec3;
|
|
4613
|
+
perpAxisA?: Vec3;
|
|
4614
|
+
perpAxisB?: Vec3;
|
|
4615
|
+
maxDistance?: number;
|
|
4616
|
+
collision?: boolean;
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
/** Type of Havok Physics V2 constraint. */
|
|
4620
|
+
export declare const enum PhysicsConstraintType {
|
|
4621
|
+
BALL_AND_SOCKET = 1,
|
|
4622
|
+
DISTANCE = 2,
|
|
4623
|
+
HINGE = 3,
|
|
4624
|
+
SLIDER = 4,
|
|
4625
|
+
LOCK = 5,
|
|
4626
|
+
PRISMATIC = 6,
|
|
4627
|
+
SIX_DOF = 7
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4630
|
+
/** Mass properties applied to a physics body. Omitted fields keep Havok's shape-derived values. */
|
|
4631
|
+
export declare interface PhysicsMassProperties {
|
|
4632
|
+
centerOfMass?: Vec3;
|
|
4633
|
+
mass?: number;
|
|
4634
|
+
inertia?: Vec3;
|
|
4635
|
+
inertiaOrientation?: Quat;
|
|
3236
4636
|
}
|
|
3237
4637
|
|
|
3238
4638
|
/** How a body moves: `STATIC` (immovable), `ANIMATED` (driven by the node transform), or `DYNAMIC` (simulated). */
|
|
@@ -3247,6 +4647,10 @@ export declare interface PhysicsShape {
|
|
|
3247
4647
|
export declare interface PhysicsShapeOptions {
|
|
3248
4648
|
type: PhysicsShapeType;
|
|
3249
4649
|
parameters?: PhysicsShapeParameters;
|
|
4650
|
+
/** Mesh or transform hierarchy used when `type` is `MESH` or `CONVEX_HULL`. */
|
|
4651
|
+
mesh?: SceneNode;
|
|
4652
|
+
/** When true, mesh and convex-hull shapes accumulate descendant meshes under `mesh`. */
|
|
4653
|
+
includeChildMeshes?: boolean;
|
|
3250
4654
|
}
|
|
3251
4655
|
|
|
3252
4656
|
/** Geometry parameters describing a collision shape; which fields apply depends on the shape type. */
|
|
@@ -3271,11 +4675,31 @@ export declare const enum PhysicsShapeType {
|
|
|
3271
4675
|
HEIGHTFIELD = 7
|
|
3272
4676
|
}
|
|
3273
4677
|
|
|
4678
|
+
/** Pure-state handle for Havok Physics V2 debug rendering. */
|
|
4679
|
+
export declare interface PhysicsViewer {
|
|
4680
|
+
readonly scene: SceneContext;
|
|
4681
|
+
readonly world: PhysicsWorld;
|
|
4682
|
+
|
|
4683
|
+
/** Options used when creating a physics debug viewer. */
|
|
4684
|
+
export declare interface PhysicsViewerOptions {
|
|
4685
|
+
/** RGBA debug line color. Defaults to opaque white, matching Babylon.js PhysicsViewer. */
|
|
4686
|
+
color?: readonly [number, number, number, number];
|
|
4687
|
+
}
|
|
4688
|
+
|
|
3274
4689
|
/** Pure-state handle to a Havok physics world: the WASM module, the native world, its bodies, and the timestep. */
|
|
3275
4690
|
export declare interface PhysicsWorld {
|
|
3276
4691
|
|
|
3277
4692
|
/** Pick the mesh at CSS-space canvas coordinates, matching Babylon.js Scene.pick. Returns a PickingInfo. */
|
|
3278
|
-
export declare function pickAsync(picker: GpuPicker, x: number, y: number): Promise<PickingInfo>;
|
|
4693
|
+
export declare function pickAsync(picker: GpuPicker, x: number, y: number, options?: PickOptions): Promise<PickingInfo>;
|
|
4694
|
+
|
|
4695
|
+
/** Optional GPU-picking discard volume. The picker clips fragments in a bounded local frame:
|
|
4696
|
+
* `a=(origin.x, origin.z, tangent.x, tangent.z)`, `b=(baseY, halfWidth, springY, rise)`,
|
|
4697
|
+
* `c=(ringT, depthHalf, flatFlag, _)`. */
|
|
4698
|
+
declare interface PickingClipVolume {
|
|
4699
|
+
readonly a: readonly [number, number, number, number];
|
|
4700
|
+
readonly b: readonly [number, number, number, number];
|
|
4701
|
+
readonly c: readonly [number, number, number, number];
|
|
4702
|
+
}
|
|
3279
4703
|
|
|
3280
4704
|
/** Result of a GPU pick operation. */
|
|
3281
4705
|
export declare interface PickingInfo {
|
|
@@ -3298,6 +4722,18 @@ export declare interface PickingInfo {
|
|
|
3298
4722
|
ray: Ray | null;
|
|
3299
4723
|
}
|
|
3300
4724
|
|
|
4725
|
+
/** Options for {@link pickAsync}. */
|
|
4726
|
+
export declare interface PickOptions {
|
|
4727
|
+
/** Restrict the pick to a subset of the scene's meshes — return `true` for a mesh that may be picked,
|
|
4728
|
+
* `false` to ignore it entirely (it neither occludes nor is returned). Lets a caller provide its
|
|
4729
|
+
* "list of pickables" so decorative meshes (grass, foliage, particles, …) can't swallow a pick of a
|
|
4730
|
+
* structure behind/around them. When omitted, every mesh is pickable (previous behaviour). Applied
|
|
4731
|
+
* identically to the id-assignment and id-resolve passes so ids stay consistent. */
|
|
4732
|
+
filter?: (mesh: Mesh) => boolean;
|
|
4733
|
+
/** Dev-only diagnostics: logs the pick ray, pixel, pick id/depth and resolved mesh. */
|
|
4734
|
+
debugLabel?: string;
|
|
4735
|
+
}
|
|
4736
|
+
|
|
3301
4737
|
/** Sampler and format overrides for `createTexture2DFromPixels()`. */
|
|
3302
4738
|
export declare interface PixelsTexture2DOptions {
|
|
3303
4739
|
/** Address mode U. Default 'clamp-to-edge'. */
|
|
@@ -3321,6 +4757,36 @@ export declare interface PixelViewport {
|
|
|
3321
4757
|
height: number;
|
|
3322
4758
|
}
|
|
3323
4759
|
|
|
4760
|
+
export declare type PlacedGlyph = {
|
|
4761
|
+
readonly glyphId: number;
|
|
4762
|
+
/** Pixel position of glyph baseline origin. */
|
|
4763
|
+
readonly x: number;
|
|
4764
|
+
readonly y: number;
|
|
4765
|
+
/** Optional per-glyph color as linear RGBA in [0,1]. When present this overrides the
|
|
4766
|
+
* run's `defaultColor` for this glyph. When omitted, the glyph falls back to the run's
|
|
4767
|
+
* `defaultColor`, and if that is also omitted, to opaque white. The rendered alpha is
|
|
4768
|
+
* additionally scaled by the whole-block opacity (e.g. `TextRenderable.opacity`). */
|
|
4769
|
+
readonly color?: readonly [number, number, number, number];
|
|
4770
|
+
};
|
|
4771
|
+
|
|
4772
|
+
export declare interface PlaneDragGizmo {
|
|
4773
|
+
readonly root: SceneNode;
|
|
4774
|
+
readonly drag: PointerDrag;
|
|
4775
|
+
readonly onPositionChanged: GizmoObservable<Vec3>;
|
|
4776
|
+
attachedNode: SceneNode | null;
|
|
4777
|
+
/** When true, the plane normal rotates with the attached node each frame
|
|
4778
|
+
* (local-coord mode). When false, the normal stays world-aligned. */
|
|
4779
|
+
useLocalCoordinates: boolean;
|
|
4780
|
+
readonly materials: GizmoMaterialSet;
|
|
4781
|
+
|
|
4782
|
+
export declare interface PlaneDragGizmoOptions {
|
|
4783
|
+
/** World-space drag plane normal (unit vector). */
|
|
4784
|
+
dragPlaneNormal: Vec3;
|
|
4785
|
+
color?: [number, number, number];
|
|
4786
|
+
hoverColor?: [number, number, number];
|
|
4787
|
+
disableColor?: [number, number, number];
|
|
4788
|
+
}
|
|
4789
|
+
|
|
3324
4790
|
/** Options for `createPlaneData`. Subset of Babylon's CreatePlane. */
|
|
3325
4791
|
export declare interface PlaneOptions {
|
|
3326
4792
|
size?: number;
|
|
@@ -3328,6 +4794,33 @@ export declare interface PlaneOptions {
|
|
|
3328
4794
|
height?: number;
|
|
3329
4795
|
}
|
|
3330
4796
|
|
|
4797
|
+
export declare interface PlaneRotationGizmo {
|
|
4798
|
+
readonly root: SceneNode;
|
|
4799
|
+
readonly drag: PointerDrag;
|
|
4800
|
+
readonly onRotationChanged: GizmoObservable<[number, number, number, number]>;
|
|
4801
|
+
attachedNode: SceneNode | null;
|
|
4802
|
+
/** Local-coord mode: plane normal rotates with the attached node. */
|
|
4803
|
+
useLocalCoordinates: boolean;
|
|
4804
|
+
readonly materials: GizmoMaterialSet;
|
|
4805
|
+
/** ShaderMaterial driving the rotation-sector camembert visual. Exposed so
|
|
4806
|
+
* callers can change the colour at runtime. */
|
|
4807
|
+
readonly rotationDisplayMaterial: ShaderMaterial;
|
|
4808
|
+
|
|
4809
|
+
export declare interface PlaneRotationGizmoOptions {
|
|
4810
|
+
/** World-space rotation plane normal (unit vector). */
|
|
4811
|
+
planeNormal: Vec3;
|
|
4812
|
+
color?: [number, number, number];
|
|
4813
|
+
hoverColor?: [number, number, number];
|
|
4814
|
+
disableColor?: [number, number, number];
|
|
4815
|
+
/** Torus tessellation. Default 32 (matches BJS). */
|
|
4816
|
+
tessellation?: number;
|
|
4817
|
+
/** Tube thickness multiplier. Default 1. */
|
|
4818
|
+
thickness?: number;
|
|
4819
|
+
/** Colour of the rotation "camembert" sector visual shown while dragging.
|
|
4820
|
+
* Defaults to the hover colour. */
|
|
4821
|
+
rotationColor?: [number, number, number];
|
|
4822
|
+
}
|
|
4823
|
+
|
|
3331
4824
|
/** Start playing an animation group. */
|
|
3332
4825
|
export declare function playAnimation(group: AnimationGroup): void;
|
|
3333
4826
|
|
|
@@ -3415,6 +4908,70 @@ export declare interface PluginUboField {
|
|
|
3415
4908
|
readonly type: string;
|
|
3416
4909
|
}
|
|
3417
4910
|
|
|
4911
|
+
export declare interface PointerDrag {
|
|
4912
|
+
readonly options: Readonly<PointerDragOptions>;
|
|
4913
|
+
enabled: boolean;
|
|
3418
4914
|
/** Fired once when a pointer-down lands on one of `_colliders`. */
|
|
4915
|
+
onDragStart: GizmoObservable<PointerDragStartEvent>;
|
|
4916
|
+
/** Fired on every pointer-move while a drag is active. */
|
|
4917
|
+
onDrag: GizmoObservable<PointerDragMoveEvent>;
|
|
4918
|
+
/** Fired once when the pointer is released. */
|
|
4919
|
+
onDragEnd: GizmoObservable<PointerDragEndEvent>;
|
|
4920
|
+
/** Fired when the pointer hovers over one of `_colliders` (no button pressed).
|
|
4921
|
+
* Used by gizmos to swap to a hover-coloured material before any drag.
|
|
4922
|
+
* Always fires AFTER a previous `onHoverEnd` for a different drag, so the
|
|
4923
|
+
* receiver doesn't need to track which collider is currently hovered. */
|
|
4924
|
+
onHoverStart: GizmoObservable<void>;
|
|
4925
|
+
/** Fired when the pointer leaves a previously-hovered collider. */
|
|
4926
|
+
onHoverEnd: GizmoObservable<void>;
|
|
4927
|
+
/** True while a drag is in progress. */
|
|
4928
|
+
dragging: boolean;
|
|
4929
|
+
/** True while the pointer is hovering one of `_colliders` (no drag). */
|
|
4930
|
+
hovering: boolean;
|
|
4931
|
+
}
|
|
4932
|
+
|
|
4933
|
+
export declare interface PointerDragEndEvent {
|
|
4934
|
+
pointerEvent: PointerEvent | null;
|
|
4935
|
+
}
|
|
4936
|
+
|
|
4937
|
+
export declare interface PointerDragMoveEvent {
|
|
4938
|
+
/** World-space delta from the previous drag-plane point. For axis-drag this
|
|
4939
|
+
* is already projected onto the drag axis (parallel to axis). */
|
|
4940
|
+
delta: Vec3;
|
|
4941
|
+
/** Current world-space point on the drag plane (post-projection). */
|
|
4942
|
+
dragPlanePoint: Vec3;
|
|
4943
|
+
/** Signed scalar distance projected onto the drag axis since drag start
|
|
4944
|
+
* (axis-drag mode); for plane mode this is `delta.length()`. */
|
|
4945
|
+
dragDistance: number;
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4948
|
+
export declare interface PointerDragOptions {
|
|
4949
|
+
/** Drag along a single world-space axis (unit vector). Mutually exclusive
|
|
4950
|
+
* with `dragPlaneNormal`. */
|
|
4951
|
+
dragAxis?: Vec3;
|
|
4952
|
+
/** Drag inside a plane defined by this world-space normal. Mutually
|
|
4953
|
+
* exclusive with `dragAxis`. */
|
|
4954
|
+
dragPlaneNormal?: Vec3;
|
|
4955
|
+
/** When false, the dispatcher fires events but doesn't move the picked
|
|
4956
|
+
* mesh. Gizmos always set this to false and apply transforms to their
|
|
4957
|
+
* attached node themselves. */
|
|
4958
|
+
moveAttached?: boolean;
|
|
4959
|
+
/** Optional override for the drag-plane anchor point (plane mode only).
|
|
4960
|
+
* When it returns a point, the camera-facing drag plane passes through that
|
|
4961
|
+
* point instead of the picked surface point, so the screen→world scale is
|
|
4962
|
+
* taken at that depth. The BoundingBoxGizmo body drag anchors at the
|
|
4963
|
+
* bounding-box CENTRE (matching BJS, whose body `_dragMesh` sits at the box
|
|
4964
|
+
* centroid) so the translation scale doesn't depend on where the press
|
|
4965
|
+
* landed on the (inset, camera-facing) body surface. */
|
|
4966
|
+
getPlanePoint?: () => Vec3 | null;
|
|
4967
|
+
}
|
|
4968
|
+
|
|
4969
|
+
export declare interface PointerDragStartEvent {
|
|
4970
|
+
/** World-space point where the ray intersected the drag plane on drag start. */
|
|
4971
|
+
dragPlanePoint: Vec3;
|
|
4972
|
+
/** Browser pointer event that triggered drag start. */
|
|
4973
|
+
pointerEvent: PointerEvent;
|
|
4974
|
+
}
|
|
4975
|
+
|
|
3419
4976
|
export declare interface PointLight extends LightBase {
|
|
3420
4977
|
readonly lightType: "point";
|
|
3421
4978
|
position: ObservableVec3;
|
|
@@ -3440,6 +4997,25 @@ export declare interface PolyhedronOptions {
|
|
|
3440
4997
|
flat?: boolean;
|
|
3441
4998
|
}
|
|
3442
4999
|
|
|
5000
|
+
export declare interface PositionGizmo {
|
|
5001
|
+
readonly xGizmo: AxisDragGizmo;
|
|
5002
|
+
readonly yGizmo: AxisDragGizmo;
|
|
5003
|
+
readonly zGizmo: AxisDragGizmo;
|
|
5004
|
+
readonly xPlaneGizmo: PlaneDragGizmo | null;
|
|
5005
|
+
readonly yPlaneGizmo: PlaneDragGizmo | null;
|
|
5006
|
+
readonly zPlaneGizmo: PlaneDragGizmo | null;
|
|
5007
|
+
attachedNode: SceneNode | null;
|
|
5008
|
+
}
|
|
5009
|
+
|
|
5010
|
+
export declare interface PositionGizmoOptions {
|
|
5011
|
+
/** When true, planar drag gizmos (XY/XZ/YZ) are created in addition to the
|
|
5012
|
+
* 3 axis arrows. Default false — matches BJS where `planarGizmoEnabled`
|
|
5013
|
+
* defaults to false and must be opted into. */
|
|
5014
|
+
planarEnabled?: boolean;
|
|
5015
|
+
/** Tube thickness multiplier for the axis arrows. */
|
|
5016
|
+
thickness?: number;
|
|
5017
|
+
}
|
|
5018
|
+
|
|
3443
5019
|
/** Output blend mode: `0` opaque, `1` additive, `2` premultiplied, `7` non-premultiplied alpha. */
|
|
3444
5020
|
export declare type PostProcessAlphaMode = 0 | 1 | 2 | 7;
|
|
3445
5021
|
|
|
@@ -3521,6 +5097,15 @@ export declare interface PropertyAnimationTrackOptions {
|
|
|
3521
5097
|
readonly quaternion?: boolean;
|
|
3522
5098
|
}
|
|
3523
5099
|
|
|
5100
|
+
export declare type QuadCurve = {
|
|
5101
|
+
readonly p0x: number;
|
|
5102
|
+
readonly p0y: number;
|
|
5103
|
+
readonly p1x: number;
|
|
5104
|
+
readonly p1y: number;
|
|
5105
|
+
readonly p2x: number;
|
|
5106
|
+
readonly p2y: number;
|
|
5107
|
+
};
|
|
5108
|
+
|
|
3524
5109
|
/** Quaternion rotation */
|
|
3525
5110
|
declare interface Quat {
|
|
3526
5111
|
x: number;
|
|
@@ -3580,27 +5165,59 @@ export declare interface RefractionProps {
|
|
|
3580
5165
|
dispersion?: number;
|
|
3581
5166
|
}
|
|
3582
5167
|
|
|
3583
|
-
/** Register the effect renderer with its
|
|
5168
|
+
/** Register the effect renderer with its surface. Idempotent — a second call is a no-op. */
|
|
3584
5169
|
export declare function registerEffectRenderer(er: EffectRenderer): void;
|
|
3585
5170
|
|
|
3586
|
-
/** Build and register the standalone frame-graph context with its
|
|
5171
|
+
/** Build and register the standalone frame-graph context with its surface. */
|
|
3587
5172
|
export declare function registerFrameGraphContext(ctx: FrameGraphContext): void;
|
|
3588
5173
|
|
|
5174
|
+
/** Register the drag's colliders + handlers with the per-canvas dispatcher for
|
|
5175
|
+
* this utility layer. Returns a function that unregisters the drag. When the
|
|
5176
|
+
* last drag for a canvas is unregistered, the dispatcher tears itself down
|
|
5177
|
+
* (canvas listeners are detached, the GPU picker is disposed, the cache entry
|
|
5178
|
+
* is removed) so disposing all gizmos doesn't leak listeners or GPU resources. */
|
|
5179
|
+
export declare function registerPointerDrag(layer: UtilityLayer, canvas: HTMLCanvasElement, drag: PointerDrag): () => void;
|
|
5180
|
+
|
|
3589
5181
|
/**
|
|
3590
5182
|
* Register a scene with the engine. Builds deferred work, sorts renderables by order,
|
|
3591
|
-
* and adds the scene to
|
|
5183
|
+
* and adds the scene to its bound surface's render list in overlay order. The scene is
|
|
5184
|
+
* always attached to `scene.surface` (which equals the engine itself in the
|
|
5185
|
+
* single-canvas case).
|
|
3592
5186
|
*/
|
|
3593
|
-
export declare function registerScene(
|
|
5187
|
+
export declare function registerScene(scene: SceneContext): Promise<void>;
|
|
3594
5188
|
|
|
3595
5189
|
/**
|
|
3596
5190
|
* Register a scene with the engine and install the scene-owned shadow frame-graph task.
|
|
3597
|
-
* Use only for scenes that generate shadow maps.
|
|
5191
|
+
* Use only for scenes that generate shadow maps. Like {@link registerScene}, the scene
|
|
5192
|
+
* is attached to `scene.surface` (and its owning engine is `scene.surface.engine`).
|
|
3598
5193
|
*/
|
|
3599
|
-
export declare function registerSceneWithShadowSupport(
|
|
5194
|
+
export declare function registerSceneWithShadowSupport(scene: SceneContext): Promise<void>;
|
|
3600
5195
|
|
|
3601
5196
|
/** Push the renderer onto its engine's `_renderingContexts`. Idempotent — a second call is a no-op. */
|
|
3602
5197
|
export declare function registerSpriteRenderer(sr: SpriteRenderer): void;
|
|
3603
5198
|
|
|
5199
|
+
export declare function registerTextRenderer(tr: TextRenderer): void;
|
|
5200
|
+
|
|
5201
|
+
/** Register the utility layer with the engine. Must be called after the main
|
|
5202
|
+
* scene has been registered so the swapchain overlay path is enabled. */
|
|
5203
|
+
export declare function registerUtilityLayer(utility: UtilityLayer): Promise<void>;
|
|
5204
|
+
|
|
5205
|
+
/**
|
|
5206
|
+
* Release a collision shape's native handle, freeing its WASM memory. Only call once no body still
|
|
5207
|
+
* references the shape (e.g. after {@link removePhysicsBody}). Useful when rebuilding a changing set of
|
|
5208
|
+
* static colliders so their shapes don't accumulate.
|
|
5209
|
+
* @param world - The physics world.
|
|
5210
|
+
* @param shape - The shape to release.
|
|
5211
|
+
*/
|
|
5212
|
+
export declare function releasePhysicsShape(world: PhysicsWorld, shape: PhysicsShape): void;
|
|
5213
|
+
|
|
5214
|
+
/**
|
|
5215
|
+
* Decrement ref count on a Texture2D.
|
|
5216
|
+
* Calls `tex.texture.destroy()` when count reaches 0.
|
|
5217
|
+
* Returns true if the texture was destroyed.
|
|
5218
|
+
*/
|
|
5219
|
+
export declare function releaseTexture(tex: Texture2D): boolean;
|
|
5220
|
+
|
|
3604
5221
|
/** Detaches `group` from `manager`, removing its animation task so it is no longer ticked. */
|
|
3605
5222
|
export declare function removeAnimationGroup(manager: AnimationManager, group: AnimationGroup): void;
|
|
3606
5223
|
|
|
@@ -3631,6 +5248,16 @@ export declare function removeMeshFromTask(task: RenderTask, mesh: object): void
|
|
|
3631
5248
|
/** Remove an obstacle previously added by `addBoxObstacle` / `addCylinderObstacle`. */
|
|
3632
5249
|
export declare function removeObstacle(plugin: NavigationPlugin, obstacle: ObstacleHandle): void;
|
|
3633
5250
|
|
|
5251
|
+
/**
|
|
5252
|
+
* Remove a single body from the world and release its native handle (the per-frame step skips it from
|
|
5253
|
+
* now on). After this the body must not be reused. A body that isn't in the world is ignored, so this is
|
|
5254
|
+
* safe to call once per body. Does NOT release the body's collision shape — release that separately with
|
|
5255
|
+
* {@link releasePhysicsShape} if it isn't shared.
|
|
5256
|
+
* @param world - The physics world.
|
|
5257
|
+
* @param body - The body to remove.
|
|
5258
|
+
*/
|
|
5259
|
+
export declare function removePhysicsBody(world: PhysicsWorld, body: PhysicsBody): void;
|
|
5260
|
+
|
|
3634
5261
|
/**
|
|
3635
5262
|
* Removes the sprite referenced by `handle`. Does nothing if it is already gone.
|
|
3636
5263
|
* @param handle - Handle of the sprite to remove.
|
|
@@ -3657,6 +5284,8 @@ export declare function removeSpriteAnimationManager(manager: AnimationManager,
|
|
|
3657
5284
|
/** Remove a layer from the renderer and destroy any GPU resources cached for it. */
|
|
3658
5285
|
export declare function removeSpriteRendererLayer(sr: SpriteRenderer, layer: Sprite2DLayer): boolean;
|
|
3659
5286
|
|
|
5287
|
+
export declare function removeTextRendererLayer(tr: TextRenderer, layer: TextLayer): boolean;
|
|
5288
|
+
|
|
3660
5289
|
/** Remove instance by index. Swap-removes: last instance fills the gap. */
|
|
3661
5290
|
export declare function removeThinInstance(mesh: Mesh, index: number): void;
|
|
3662
5291
|
|
|
@@ -3686,6 +5315,8 @@ export declare interface Renderable {
|
|
|
3686
5315
|
*/
|
|
3687
5316
|
export declare type RenderCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
3688
5317
|
|
|
5318
|
+
export declare function renderFrame(engine: EngineContext, delta: number): void;
|
|
5319
|
+
|
|
3689
5320
|
/**
|
|
3690
5321
|
* Minimal surface an engine sees for anything it renders. Scenes (and any other
|
|
3691
5322
|
* future renderable thing) register themselves as a `RenderingContext` and
|
|
@@ -3700,7 +5331,8 @@ export declare interface RenderPass extends Pass {
|
|
|
3700
5331
|
/** Per-frame mutable sta
|
|
3701
5332
|
* before iterating its passes. */
|
|
3702
5333
|
clearColor: GPUColorDict;
|
|
3703
5334
|
/** True → loadOp `"clear"`, false → `"load"` (overlay mode). */
|
|
3704
|
-
clear: boolean;
|
|
5335
|
+
clear: boolean;
|
|
5336
|
+
}
|
|
3705
5337
|
|
|
3706
5338
|
/** Body of a render pass — receives the live render-pass encoder and returns
|
|
3707
5339
|
* the number of draws issued. */
|
|
@@ -3712,22 +5344,22 @@ export declare interface RenderTarget {
|
|
|
3712
5344
|
/** Describes a render target — what attachments to create, not the GPU objects
|
|
3713
5345
|
* themselves. GPU textures are allocated later by `buildRenderTarget`. */
|
|
3714
5346
|
export declare interface RenderTargetDescriptor {
|
|
3715
|
-
label?: string;
|
|
3716
|
-
colorFormat?: GPUTextureFormat;
|
|
3717
|
-
depthStencilFormat?: GPUTextureFormat;
|
|
3718
5347
|
sampleCount: number;
|
|
3719
|
-
/**
|
|
3720
|
-
|
|
5348
|
+
/** Debug label applied to the allocated GPU color/depth textures. */
|
|
5349
|
+
lbl?: string;
|
|
5350
|
+
/** Color attachment texture format (e.g. `"bgra8unorm"`, `"rgba16float"`). Omit for a depth-only target. */
|
|
5351
|
+
format?: GPUTextureFormat;
|
|
5352
|
+
/** Depth/stencil attachment format (e.g. `"depth24plus-stencil8"`). Omit for a color-only target (e.g. the swapchain). */
|
|
5353
|
+
dFormat?: GPUTextureFormat;
|
|
3721
5354
|
/** MSAA sample count: `1` = single-sample (no multisampling), `4` = 4x MSAA. */
|
|
5355
|
+
samples: number;
|
|
5356
|
+
/** A `SurfaceContext` to size to that surface's swapchain (re-resolved each
|
|
5357
|
+
* `buildRenderTarget`), or explicit `{ width, height }` in device pixels. Pass a
|
|
5358
|
+
* surface for canvas-sized RTs; the RT then tracks that specific surface in
|
|
5359
|
+
* multi-surface setups. In the common single-canvas case, pass the engine directly
|
|
5360
|
+
* (since `EngineContext extends SurfaceContext`). */
|
|
5361
|
+
size: SurfaceContext | {
|
|
3722
5362
|
width: number;
|
|
3723
5363
|
height: number;
|
|
3724
5364
|
};
|
|
3725
|
-
/** If true, the color attachment resolves to the swapchain texture. The RT still
|
|
3726
|
-
* owns the MSAA texture (when sampleCount \> 1) and the depth texture; only the
|
|
3727
|
-
* final color is the swapchain view, acquired per frame and patched in at execute
|
|
3728
|
-
* time. With sampleCount === 1 the RT owns no color texture (the swap view is the
|
|
3729
|
-
* color attachment directly). */
|
|
3730
|
-
resolveToSwapchain?: boolean;
|
|
3731
|
-
/** Override projection Y-flip. Defaults to true for offscreen targets and false for swapchain targets. */
|
|
3732
|
-
flipY?: boolean;
|
|
3733
5365
|
}
|
|
3734
5366
|
|
|
3735
5367
|
/** Signature of a render target's attachment set — enough to key a GPURenderPipeline. */
|
|
@@ -3752,38 +5384,132 @@ export declare interface RenderTaskConfig {
|
|
|
3752
5384
|
* management is virtualized, callers must provide the concrete target; once
|
|
3753
5385
|
* virtualized, the task should create/manage its own render target. */
|
|
3754
5386
|
rt: RenderTarget;
|
|
5387
|
+
/** Optional single-sample resolve target. When `rt` is multisampled
|
|
5388
|
+
* (`sampleCount > 1`), the color attachment resolves into this target's
|
|
5389
|
+
* color texture at end-of-pass — letting an MSAA render feed a post-process
|
|
5390
|
+
* that requires a single-sample source, without an extra resolve pass.
|
|
5391
|
+
* Caller contract (not validated): must be single-sample with a color
|
|
5392
|
+
* format and size matching `rt`; WebGPU errors at pass-encode time if not.
|
|
5393
|
+
* Ignored when `rt` is single-sample. */
|
|
5394
|
+
rst?: RenderTarget;
|
|
5395
|
+
/** Optional separate depth/stencil attachment. The pass binds this target's
|
|
5396
|
+
* depth view instead of `rt`'s own, and uses its `depthStencilFormat` for
|
|
5397
|
+
* pipeline signature matching. The colour `rt` must omit `depthStencilFormat`
|
|
5398
|
+
* (so it allocates no internal depth) and match this target in size + sample
|
|
5399
|
+
* count. Two ownership modes, distinguished by `_eager`:
|
|
5400
|
+
* - `_eager` depth (e.g. a `GeometryRendererTask` output): the task neither
|
|
5401
|
+
* builds nor clears nor disposes it — it loads it (`loadOp: "load"`) and the
|
|
5402
|
+
* caller owns clearing. This is how scenes reuse a pre-rendered depth buffer.
|
|
5403
|
+
* - non-`_eager` depth: the task owns it — builds/rebuilds it in `record()`,
|
|
5404
|
+
* clears it (`loadOp: "clear"`), and disposes it. Used by the default
|
|
5405
|
+
* single-sample scene task, whose colour `rt` is the depth-less
|
|
5406
|
+
* engine `scRT`. */
|
|
5407
|
+
depth?: RenderTarget;
|
|
3755
5408
|
/** Background clear color. May be mutated frame-to-frame. */
|
|
3756
5409
|
clrColor?: GPUColorDict;
|
|
3757
|
-
/** When true,
|
|
3758
|
-
*
|
|
5410
|
+
/** When true, color `loadOp` is "clear"; when false, "load" (overlays previous
|
|
5411
|
+
* color content). Depth is always cleared when rt-owned and always loaded when
|
|
5412
|
+
* supplied via `depth`. */
|
|
3759
5413
|
clr?: boolean;
|
|
3760
5414
|
/** Per-pass camera override. Null/undefined uses `scene.camera`. */
|
|
3761
5415
|
cam?: Camera | null;
|
|
3762
5416
|
/** Use canvas dimensions, not render-target dimensions, for this pass's scene UBO aspect. */
|
|
3763
5417
|
cs?: boolean;
|
|
3764
5418
|
/** Scene-texture transmission settings. `copyCount: 0` copies before every transmissive draw.
|
|
3765
|
-
* `generateMipmaps: false` allocates only mip 0 for the refraction texture and skips mip generation.
|
|
5419
|
+
* `generateMipmaps: false` allocates only mip 0 for the refraction texture and skips mip generation.
|
|
5420
|
+
* `mipLevelCount` caps the generated chain when a material only samples low explicit LODs. */
|
|
3766
5421
|
transmission?: {
|
|
3767
5422
|
copyCount?: number;
|
|
3768
5423
|
generateMipmaps?: boolean;
|
|
5424
|
+
mipLevelCount?: number;
|
|
3769
5425
|
};
|
|
3770
5426
|
}
|
|
3771
5427
|
|
|
5428
|
+
/** GPU time measured for one frame-graph task in one rendered frame. */
|
|
5429
|
+
export declare interface RenderTaskGpuTiming {
|
|
5430
|
+
/** Execution-order index within the measured frame. Useful when several tasks share the same name. */
|
|
5431
|
+
readonly index: number;
|
|
5432
|
+
/** The task's existing frame-graph label (`Task.name`, e.g. `"shadow"`, `"scene"`, `"post-process"`). */
|
|
5433
|
+
readonly name: string;
|
|
5434
|
+
/** GPU duration for this task in milliseconds. */
|
|
5435
|
+
readonly durationMs: number;
|
|
5436
|
+
}
|
|
5437
|
+
|
|
5438
|
+
/** Latest per-task GPU timing snapshot for an engine. */
|
|
5439
|
+
export declare interface RenderTaskGpuTimings {
|
|
5440
|
+
/** `unsupported` when the WebGPU device lacks `timestamp-query`; `pending` until the first readback lands. */
|
|
5441
|
+
readonly status: RenderTaskGpuTimingStatus;
|
|
5442
|
+
/** Whether this engine's device exposes WebGPU timestamp queries. */
|
|
5443
|
+
readonly supported: boolean;
|
|
5444
|
+
/** Whether task timing is currently enabled and recording future frames. */
|
|
5445
|
+
readonly enabled: boolean;
|
|
5446
|
+
/** Monotonic profiler frame index for the snapshot. `0` means no measured frame has completed yet. */
|
|
5447
|
+
readonly frameIndex: number;
|
|
5448
|
+
/** Measured tasks in frame execution order. Empty until `status === "available"`. */
|
|
5449
|
+
readonly tasks: readonly RenderTaskGpuTiming[];
|
|
5450
|
+
/** Number of tasks skipped in that frame because the profiler's query-set capacity was exceeded. */
|
|
5451
|
+
readonly droppedTaskCount: number;
|
|
5452
|
+
/** Readback failure message when `status === "error"`. */
|
|
5453
|
+
readonly error?: string;
|
|
5454
|
+
}
|
|
5455
|
+
|
|
5456
|
+
/** Availability / lifecycle state for per-frame-graph-task GPU timings. */
|
|
5457
|
+
export declare type RenderTaskGpuTimingStatus = "unsupported" | "disabled" | "pending" | "available" | "error";
|
|
5458
|
+
|
|
5459
|
+
/** Sampler / format overrides for `createRenderTexture2D()`. */
|
|
5460
|
+
export declare interface RenderTexture2DOptions {
|
|
5461
|
+
/** Address mode U. Default 'clamp-to-edge'. */
|
|
5462
|
+
addressModeU?: GPUAddressMode;
|
|
5463
|
+
/** Address mode V. Default 'clamp-to-edge'. */
|
|
5464
|
+
addressModeV?: GPUAddressMode;
|
|
5465
|
+
/** Min filter. Default 'linear'. */
|
|
5466
|
+
minFilter?: GPUFilterMode;
|
|
5467
|
+
/** Mag filter. Default 'linear'. */
|
|
5468
|
+
magFilter?: GPUFilterMode;
|
|
5469
|
+
/**
|
|
5470
|
+
* Color format. Default `engine.format` so it can be sampled and presented.
|
|
5471
|
+
*
|
|
5472
|
+
* ⚠️ Only the default `engine.format` is compatible with a `SpriteRenderer`
|
|
5473
|
+
* target (`setSpriteRendererTarget`): sprite pipelines are created with
|
|
5474
|
+
* `engine.format`, and a render pass whose color attachment format differs from
|
|
5475
|
+
* the bound pipeline fails WebGPU validation at pass begin. Override this **only**
|
|
5476
|
+
* for offscreen targets you render into by some OTHER means (a custom pass /
|
|
5477
|
+
* `EffectRenderer`), never as a sprite-render target.
|
|
5478
|
+
*/
|
|
5479
|
+
format?: GPUTextureFormat;
|
|
5480
|
+
}
|
|
5481
|
+
|
|
3772
5482
|
/**
|
|
3773
5483
|
* Reset all variant-participating meshes to their original (default) materials.
|
|
3774
5484
|
*/
|
|
3775
5485
|
export declare function resetVariant(container: AssetContainer): void;
|
|
3776
5486
|
|
|
3777
|
-
/** Resize
|
|
3778
|
-
*
|
|
3779
|
-
*
|
|
3780
|
-
*
|
|
3781
|
-
*
|
|
3782
|
-
*
|
|
3783
|
-
* box, so its size is pushed in externally via {@link setEngineSize} (e.g. from the host
|
|
3784
|
-
* thread that owns the visible canvas) and this call is a no-op for it. */
|
|
5487
|
+
/** Resize every surface attached to this engine (including the engine's own primary
|
|
5488
|
+
* surface). For DOM-canvas surfaces, snaps the swapchain backing store to the current
|
|
5489
|
+
* `clientWidth × clientHeight × devicePixelRatio` (capped by each surface's
|
|
5490
|
+
* `maxDevicePixelRatio`). For `OffscreenCanvas` surfaces this is a no-op per surface —
|
|
5491
|
+
* call `setSurfaceSize` on the specific surface instead, since an `OffscreenCanvas`
|
|
5492
|
+
* has no layout. */
|
|
3785
5493
|
export declare function resizeEngine(engine: EngineContext): void;
|
|
3786
5494
|
|
|
5495
|
+
/** Replace a mesh's GPU geometry IN PLACE with new (possibly larger or smaller) buffers, reusing the
|
|
5496
|
+
* same Mesh object so existing references to it (scene entries, shadow-caster lists, materials) stay
|
|
5497
|
+
* valid. Unlike `updateMeshPositions`, this REALLOCATES the GPU buffers, so it's the way to GROW a
|
|
5498
|
+
* dynamically-generated mesh past its original vertex/index capacity (e.g. an ever-larger bridge whose
|
|
5499
|
+
* box budget overflows). The old GPU buffers are destroyed to free device memory. Recomputes bounds. */
|
|
5500
|
+
export declare function resizeMeshGeometry(engine: EngineContext, mesh: Mesh, positions: Float32Array, normals: Float32Array, indices: Uint32Array, uvs?: Float32Array, uvs2?: Float32Array, tangents?: Float32Array, colors?: Float32Array): void;
|
|
5501
|
+
|
|
5502
|
+
/** Resize this surface's swapchain backing store to match the canvas client size. When
|
|
5503
|
+
* the size changes, asks every rendering context registered on this surface to rebuild
|
|
5504
|
+
* its canvas-sized GPU resources via the optional `_resize` hook. If the canvas has
|
|
5505
|
+
* not been laid out yet, preserves its explicit backing-store size.
|
|
5506
|
+
*
|
|
5507
|
+
* Only DOM canvases are auto-sized from layout here. An `OffscreenCanvas` has no
|
|
5508
|
+
* layout box, so its size must be pushed in externally via {@link setSurfaceSize}
|
|
5509
|
+
* (e.g. from the host thread that owns the visible canvas) and this call is a no-op
|
|
5510
|
+
* for it. */
|
|
5511
|
+
export declare function resizeSurface(surface: SurfaceContext): void;
|
|
5512
|
+
|
|
3787
5513
|
/** Resolve a Babylon-style normalized viewport to integer render-target pixels.
|
|
3788
5514
|
* Babylon viewport y is normalized from the bottom; WebGPU viewport/scissor y is from the top. */
|
|
3789
5515
|
export declare function resolveCameraViewport(camera: Camera | null | undefined, targetWidth: number, targetHeight: number): PixelViewport;
|
|
@@ -3796,6 +5522,31 @@ export declare interface RibbonOptions {
|
|
|
3796
5522
|
offset?: number;
|
|
3797
5523
|
}
|
|
3798
5524
|
|
|
5525
|
+
export declare interface RotationGizmo {
|
|
5526
|
+
readonly xGizmo: PlaneRotationGizmo;
|
|
5527
|
+
readonly yGizmo: PlaneRotationGizmo;
|
|
5528
|
+
readonly zGizmo: PlaneRotationGizmo;
|
|
5529
|
+
attachedNode: SceneNode | null;
|
|
5530
|
+
}
|
|
5531
|
+
|
|
5532
|
+
export declare interface RotationGizmoOptions {
|
|
5533
|
+
tessellation?: number;
|
|
5534
|
+
thickness?: number;
|
|
5535
|
+
}
|
|
5536
|
+
|
|
5537
|
+
export declare interface ScaleGizmo {
|
|
5538
|
+
readonly xGizmo: AxisScaleGizmo;
|
|
5539
|
+
readonly yGizmo: AxisScaleGizmo;
|
|
5540
|
+
readonly zGizmo: AxisScaleGizmo;
|
|
5541
|
+
/** Central uniform-scale gizmo (single arrow with uniformScaling = true). */
|
|
5542
|
+
readonly uniformScaleGizmo: AxisScaleGizmo;
|
|
5543
|
+
attachedNode: SceneNode | null;
|
|
5544
|
+
}
|
|
5545
|
+
|
|
5546
|
+
export declare interface ScaleGizmoOptions {
|
|
5547
|
+
thickness?: number;
|
|
5548
|
+
}
|
|
5549
|
+
|
|
3799
5550
|
/** Scattering sub-feature. Presence enables screen-space subsurface scattering.
|
|
3800
5551
|
* NOTE: PrePass/SSS pipeline is not yet implemented — this type is reserved. */
|
|
3801
5552
|
declare interface ScatteringProps {
|
|
@@ -3816,7 +5567,12 @@ export declare interface SceneColorGrab {
|
|
|
3816
5567
|
|
|
3817
5568
|
/** Top-level scene context — pure state, no attached methods. */
|
|
3818
5569
|
export declare interface SceneContext extends RenderingContext_2 {
|
|
3819
|
-
|
|
5570
|
+
/** Surface this scene renders into. Set at scene-creation time and immutable
|
|
5571
|
+
* afterwards — the default render task is sized and MSAA-matched to this surface,
|
|
5572
|
+
* and `registerScene` attaches the scene to it. For the engine's primary surface
|
|
5573
|
+
* (the common single-canvas case) this is the engine itself. The owning engine is
|
|
5574
|
+
* reachable via `scene.surface.engine`. */
|
|
5575
|
+
readonly surface: SurfaceContext;
|
|
3820
5576
|
clearColor: GPUColorDict;
|
|
3821
5577
|
camera: Camera | null;
|
|
3822
5578
|
lights: LightBase[];
|
|
@@ -3867,6 +5623,29 @@ export declare interface SceneUniformUpdater {
|
|
|
3867
5623
|
update(engine: EngineContext): void;
|
|
3868
5624
|
}
|
|
3869
5625
|
|
|
5626
|
+
/**
|
|
5627
|
+
* A captured frame, read back from the canvas swapchain.
|
|
5628
|
+
*
|
|
5629
|
+
* `data` is tightly-packed RGBA8 (4 bytes/pixel), row-major, top row first — the same
|
|
5630
|
+
* layout `ImageData` expects, so it can be handed straight to a 2D canvas:
|
|
5631
|
+
*
|
|
5632
|
+
* ```ts
|
|
5633
|
+
* const shot = await captureScreenshot(surface);
|
|
5634
|
+
* const cv = new OffscreenCanvas(shot.width, shot.height);
|
|
5635
|
+
* cv.getContext("2d")!.putImageData(new ImageData(shot.data, shot.width, shot.height), 0, 0);
|
|
5636
|
+
* const url = await cv.convertToBlob({ type: "image/jpeg", quality: 0.85 });
|
|
5637
|
+
* ```
|
|
5638
|
+
*
|
|
5639
|
+
* Alpha is forced to 255 (fully opaque): the swapchain is presented opaque, so its alpha
|
|
5640
|
+
* channel is not meaningful for a saved image. Colours are the final, presented 8-bit
|
|
5641
|
+
* values (BGRA swizzled to RGBA when the preferred canvas format is BGRA).
|
|
5642
|
+
*/
|
|
5643
|
+
export declare interface Screenshot {
|
|
5644
|
+
readonly width: number;
|
|
5645
|
+
readonly height: number;
|
|
5646
|
+
readonly data: Uint8ClampedArray;
|
|
5647
|
+
}
|
|
5648
|
+
|
|
3870
5649
|
/**
|
|
3871
5650
|
* Select a material variant by name on a loaded glTF asset.
|
|
3872
5651
|
*
|
|
@@ -3969,11 +5748,10 @@ export declare function setEffectTexture(wrapper: EffectWrapper, bindingNameOrIn
|
|
|
3969
5748
|
*/
|
|
3970
5749
|
export declare function setEffectUniforms(wrapper: EffectWrapper, data: ArrayBuffer | ArrayBufferView | Record<string | number, ArrayBuffer | ArrayBufferView>): void;
|
|
3971
5750
|
|
|
3972
|
-
/** Set the swapchain backing-store size directly, in device
|
|
3973
|
-
*
|
|
3974
|
-
*
|
|
3975
|
-
*
|
|
3976
|
-
* optional `_resize` hook. */
|
|
5751
|
+
/** Set the engine's primary-surface swapchain backing-store size directly, in device
|
|
5752
|
+
* pixels. Convenience wrapper around `setSurfaceSize(engine, w, h)` since the engine
|
|
5753
|
+
* *is* its own primary surface — for auxiliary surfaces, prefer calling `setSurfaceSize`
|
|
5754
|
+
* on the specific target. */
|
|
3977
5755
|
export declare function setEngineSize(engine: EngineContext, widthPx: number, heightPx: number): void;
|
|
3978
5756
|
|
|
3979
5757
|
/**
|
|
@@ -3987,6 +5765,27 @@ export declare function setEngineSize(engine: EngineContext, widthPx: number, he
|
|
|
3987
5765
|
*/
|
|
3988
5766
|
export declare function setFog(scene: SceneContext, config: FogConfig): void;
|
|
3989
5767
|
|
|
5768
|
+
/** Set one or more orientation fields at once (single recompute). Omitted fields keep their value. */
|
|
5769
|
+
export declare function setGeospatialOrientation(camera: GeospatialCamera, orientation: GeospatialOrientation): void;
|
|
5770
|
+
|
|
5771
|
+
/** Enable or disable per-frame GPU timing. Disabled by default and a no-op on devices where
|
|
5772
|
+
* {@link isGpuTimingSupported} is false. While on, {@link EngineContext.gpuFrameTimeMs} is updated each
|
|
5773
|
+
* frame with the measured GPU time — the time the GPU spends on that frame's work, not CPU/wall-clock
|
|
5774
|
+
* time — a frame or two behind via an async, non-blocking readback.
|
|
5775
|
+
*
|
|
5776
|
+
* Implementation: the timer module is dynamic-imported on the first enable, so engines that never call
|
|
5777
|
+
* this ship none of it. Once loaded, three tiny per-frame hooks are installed on the engine; while timing
|
|
5778
|
+
* is off they are undefined and {@link renderFrame} only optional-chains them (a no-op short-circuit), so
|
|
5779
|
+
* scenes that never enable timing pay effectively nothing. The opening/closing timestamps are written into
|
|
5780
|
+
* the frame's command encoder so the GPU runs them contiguously around just that frame's passes. The first
|
|
5781
|
+
* enable takes effect a microtask later (the GPU resources are created lazily, then reused); subsequent
|
|
5782
|
+
* toggles are synchronous. */
|
|
5783
|
+
export declare function setGpuTimingEnabled(engine: EngineContext, enabled: boolean): void;
|
|
5784
|
+
|
|
5785
|
+
/** Override the URL of the KTX2/Basis decoder script (and, optionally, the URLs of the WASM/JS transcoder
|
|
5786
|
+
* modules it pulls). Call before the first KHR_texture_basisu texture loads. */
|
|
5787
|
+
export declare function setKtx2DecoderUrl(url: string, wasmUrls?: Record<string, Record<string, string>>): void;
|
|
5788
|
+
|
|
3990
5789
|
/** Raise (or lower) the maximum number of scene lights in the shared lights UBO.
|
|
3991
5790
|
* Must be called BEFORE scene pipelines are compiled — existing pipelines
|
|
3992
5791
|
* and UBOs bake the cap into their WGSL/layout. */
|
|
@@ -4011,13 +5810,48 @@ export declare function setNavigationRandomSeed(plugin: NavigationPlugin, seed:
|
|
|
4011
5810
|
*/
|
|
4012
5811
|
export declare function setParent(child: Mesh, parent: IWorldMatrixProvider | null): void;
|
|
4013
5812
|
|
|
5813
|
+
/**
|
|
5814
|
+
* Set a body's angular velocity (rad/s).
|
|
5815
|
+
*/
|
|
5816
|
+
export declare function setPhysicsBodyAngularVelocity(world: PhysicsWorld, body: PhysicsBody, velocity: Vec3): void;
|
|
5817
|
+
|
|
5818
|
+
/**
|
|
5819
|
+
* Set a body's linear velocity (m/s) directly — e.g. to impart a throw velocity on release.
|
|
5820
|
+
*/
|
|
5821
|
+
export declare function setPhysicsBodyLinearVelocity(world: PhysicsWorld, body: PhysicsBody, velocity: Vec3): void;
|
|
5822
|
+
|
|
4014
5823
|
/**
|
|
4015
5824
|
* Sets a body's mass and a matching diagonal inertia tensor.
|
|
4016
5825
|
* @param world - The physics world.
|
|
4017
5826
|
* @param body - The body to update.
|
|
4018
5827
|
* @param mass - Mass in kilograms.
|
|
5828
|
+
* @param centerOfMass - Optional body-local centre of mass (defaults to the origin). Use this when the
|
|
5829
|
+
* collision shape is offset from the body's reference frame (e.g. a prop whose body origin sits at
|
|
5830
|
+
* its base but whose shape is centred on its middle) so it tumbles around its real centre.
|
|
5831
|
+
*/
|
|
5832
|
+
export declare function setPhysicsBodyMass(world: PhysicsWorld, body: PhysicsBody, mass: number, centerOfMass?: Vec3): void;
|
|
5833
|
+
|
|
5834
|
+
/**
|
|
5835
|
+
* Sets a body's mass properties, preserving Havok's shape-derived values for omitted fields.
|
|
5836
|
+
* @param world - The physics world.
|
|
5837
|
+
* @param body - The body to update.
|
|
5838
|
+
* @param properties - Mass-property overrides.
|
|
5839
|
+
*/
|
|
5840
|
+
export declare function setPhysicsBodyMassProperties(world: PhysicsWorld, body: PhysicsBody, properties: PhysicsMassProperties): void;
|
|
5841
|
+
|
|
5842
|
+
/**
|
|
5843
|
+
* Switch a body's motion type at runtime (e.g. ANIMATED/kinematic while a prop is grabbed, then
|
|
5844
|
+
* DYNAMIC on release). Mutates `body.motionType` so the per-frame step syncs it the right way
|
|
5845
|
+
* (ANIMATED: node → body before the step; DYNAMIC: body → node after).
|
|
5846
|
+
*/
|
|
5847
|
+
export declare function setPhysicsBodyMotionType(world: PhysicsWorld, body: PhysicsBody, motionType: PhysicsMotionType): void;
|
|
5848
|
+
|
|
5849
|
+
/**
|
|
5850
|
+
* Enable or disable pre-step synchronization from a node transform to its Havok body.
|
|
5851
|
+
* @param body - The physics body to update.
|
|
5852
|
+
* @param enabled - When true, the node transform is written to Havok before each physics step.
|
|
4019
5853
|
*/
|
|
4020
|
-
export declare function
|
|
5854
|
+
export declare function setPhysicsBodyPreStep(body: PhysicsBody, enabled: boolean): void;
|
|
4021
5855
|
|
|
4022
5856
|
/**
|
|
4023
5857
|
* Assigns a collision shape to a body.
|
|
@@ -4028,11 +5862,36 @@ export declare function setPhysicsBodyMass(world: PhysicsWorld, body: PhysicsBod
|
|
|
4028
5862
|
export declare function setPhysicsBodyShape(world: PhysicsWorld, body: PhysicsBody, shape: PhysicsShape): void;
|
|
4029
5863
|
|
|
4030
5864
|
/**
|
|
4031
|
-
*
|
|
5865
|
+
* Teleport a body to a world position + orientation (a pure transform set — velocities are left
|
|
5866
|
+
* unchanged). For grab-follow, save-restore, and undo. Also updates the bound node so a render that
|
|
5867
|
+
* reads the node before the next physics step stays consistent.
|
|
5868
|
+
*/
|
|
5869
|
+
export declare function setPhysicsBodyTransform(world: PhysicsWorld, body: PhysicsBody, position: Vec3, rotation: Quat): void;
|
|
5870
|
+
|
|
5871
|
+
/**
|
|
5872
|
+
* Sets gravity for the world, or for a single region when `worldPosition` is given.
|
|
5873
|
+
* Passing a position is useful for planetary scenarios where gravity direction varies by location.
|
|
4032
5874
|
* @param world - The physics world.
|
|
4033
5875
|
* @param gravity - Gravity acceleration in m/s².
|
|
5876
|
+
* @param worldPosition - Optional world position selecting the region to update; omit to update all regions.
|
|
5877
|
+
*/
|
|
5878
|
+
export declare function setPhysicsGravity(world: PhysicsWorld, gravity: Vec3, worldPosition?: Vec3): void;
|
|
5879
|
+
|
|
5880
|
+
/**
|
|
5881
|
+
* Sets the Havok filter collide mask for a collision shape.
|
|
5882
|
+
* @param world - The physics world.
|
|
5883
|
+
* @param shape - The shape to update.
|
|
5884
|
+
* @param collideMask - Bitmask describing which collision groups this shape collides with.
|
|
4034
5885
|
*/
|
|
4035
|
-
export declare function
|
|
5886
|
+
export declare function setPhysicsShapeFilterCollideMask(world: PhysicsWorld, shape: PhysicsShape, collideMask: number): void;
|
|
5887
|
+
|
|
5888
|
+
/**
|
|
5889
|
+
* Sets the Havok filter membership mask for a collision shape.
|
|
5890
|
+
* @param world - The physics world.
|
|
5891
|
+
* @param shape - The shape to update.
|
|
5892
|
+
* @param membershipMask - Bitmask describing which collision group this shape belongs to.
|
|
5893
|
+
*/
|
|
5894
|
+
export declare function setPhysicsShapeFilterMembershipMask(world: PhysicsWorld, shape: PhysicsShape, membershipMask: number): void;
|
|
4036
5895
|
|
|
4037
5896
|
/**
|
|
4038
5897
|
* Sets a shape's surface material properties.
|
|
@@ -4058,6 +5917,23 @@ export declare function setPhysicsTimestep(world: PhysicsWorld, dt: number): voi
|
|
|
4058
5917
|
*/
|
|
4059
5918
|
export declare function setPhysicsVelocityLimits(world: PhysicsWorld, maxLinear: number, maxAngular: number): void;
|
|
4060
5919
|
|
|
5920
|
+
export declare function setPositionGizmoLocalCoordinates(gizmo: PositionGizmo, useLocal: boolean): void;
|
|
5921
|
+
|
|
5922
|
+
/** Enable or disable per-frame-graph-task GPU timing.
|
|
5923
|
+
*
|
|
5924
|
+
* The profiling implementation is loaded with a dynamic import on first enable. Engines that never call this
|
|
5925
|
+
* function do not fetch the profiler chunk or carry task-timing code in the always-fetched frame graph.
|
|
5926
|
+
* The returned snapshot is `unsupported` if the device lacks WebGPU `timestamp-query`, `pending` immediately
|
|
5927
|
+
* after enable, and `available` once a later frame's async timestamp readback completes.
|
|
5928
|
+
*/
|
|
5929
|
+
export declare function setRenderTaskGpuTimingEnabled(engine: EngineContext, enabled: boolean): Promise<RenderTaskGpuTimings>;
|
|
5930
|
+
|
|
5931
|
+
export declare function setRotationGizmoLocalCoordinates(gizmo: RotationGizmo, useLocal: boolean): void;
|
|
5932
|
+
|
|
5933
|
+
/** Toggle local-coord mode on the per-axis scale arrows. The uniform-scale
|
|
5934
|
+
* gizmo (centre) is always uniform so it ignores the flag. */
|
|
5935
|
+
export declare function setScaleGizmoLocalCoordinates(gizmo: ScaleGizmo, useLocal: boolean): void;
|
|
5936
|
+
|
|
4061
5937
|
/** Set a declared `f32` uniform. Convenience wrapper over `setShaderUniform()`. */
|
|
4062
5938
|
export declare function setShaderFloat(material: ShaderMaterial, name: string, value: number): void;
|
|
4063
5939
|
|
|
@@ -4067,6 +5943,9 @@ export declare function setShaderFloat(material: ShaderMaterial, name: string, v
|
|
|
4067
5943
|
* straight into a matrix uniform without laundering through a typed array. */
|
|
4068
5944
|
export declare function setShaderMatrix(material: ShaderMaterial, name: string, value: Float32Array | Mat4): void;
|
|
4069
5945
|
|
|
5946
|
+
/** Bind (or clear) a declared read-only storage buffer. */
|
|
5947
|
+
export declare function setShaderStorageBuffer(material: ShaderMaterial, name: string, buffer: GPUBuffer | null): void;
|
|
5948
|
+
|
|
4070
5949
|
/** Bind (or clear) the texture for a declared sampler, enforcing that depth and
|
|
4071
5950
|
* non-depth samplers receive a matching `Texture2D`.
|
|
4072
5951
|
* @param material - Target material.
|
|
@@ -4121,6 +6000,18 @@ export declare function setSprite2DShaderParams(layer: Sprite2DLayer, params: re
|
|
|
4121
6000
|
*/
|
|
4122
6001
|
export declare function setSprite2DUvOffset(layer: Sprite2DLayer, index: number, uvOffset: readonly [number, number]): void;
|
|
4123
6002
|
|
|
6003
|
+
/**
|
|
6004
|
+
* Redirect a sprite renderer's output to an offscreen render {@link Texture2D} `target` (for
|
|
6005
|
+
* render-to-texture / post-processing), or pass `null` to render to the swapchain (the
|
|
6006
|
+
* default). Pair with {@link createRenderTexture2D} at its default format and the renderer's
|
|
6007
|
+
* target size. The target's texture must be the engine's swapchain format: sprite pipelines
|
|
6008
|
+
* are baked with `engine.format`, so a target of any OTHER format fails WebGPU validation at
|
|
6009
|
+
* render-pass begin. A second renderer can then sample that texture (e.g. a fullscreen
|
|
6010
|
+
* custom-shader layer) and present it. Renderers registered later run later, so register the
|
|
6011
|
+
* offscreen scene pass before the presenting pass.
|
|
6012
|
+
*/
|
|
6013
|
+
export declare function setSpriteRendererTarget(sr: SpriteRenderer, target: Texture2D | null): void;
|
|
6014
|
+
|
|
4124
6015
|
/** Set `visible` on `node` and all descendants (via `node.children`). glTF
|
|
4125
6016
|
* KHR_node_visibility specifies that children inherit their parent's
|
|
4126
6017
|
* invisibility — we materialize this at set-time so the render hot-path
|
|
@@ -4129,9 +6020,34 @@ declare function setSubtreeVisible(node: SceneNode, v: boolean): void;
|
|
|
4129
6020
|
export { setSubtreeVisible as setMeshVisible }
|
|
4130
6021
|
export { setSubtreeVisible }
|
|
4131
6022
|
|
|
6023
|
+
/** Set this surface's swapchain backing-store size directly, in device pixels. Use this
|
|
6024
|
+
* when the surface renders into an `OffscreenCanvas` whose layout size is only known
|
|
6025
|
+
* on another thread (the host posts the CSS size × devicePixelRatio). When the size
|
|
6026
|
+
* changes, asks every rendering context registered on this surface to rebuild its
|
|
6027
|
+
* canvas-sized GPU resources via the optional `_resize` hook. */
|
|
6028
|
+
export declare function setSurfaceSize(surface: SurfaceContext, widthPx: number, heightPx: number): void;
|
|
6029
|
+
|
|
6030
|
+
/** Update the layer's pixel position. Convenience wrapper. */
|
|
6031
|
+
export declare function setTextLayerPosition(layer: TextLayer, x: number, y: number): void;
|
|
6032
|
+
|
|
6033
|
+
/** Update ONE instance's RGBA color in place — the color twin of `setThinInstanceMatrix`. Only the
|
|
6034
|
+
* touched span re-uploads (dirty-range), so per-instance color churn (e.g. streamed instances carrying
|
|
6035
|
+
* per-slot animation timestamps) stays cheap on large pools. Requires colors to have been set via
|
|
6036
|
+
* `setThinInstanceColors` first. */
|
|
6037
|
+
export declare function setThinInstanceColor(mesh: Mesh, index: number, r: number, g: number, b: number, a: number): void;
|
|
6038
|
+
|
|
4132
6039
|
/** Set per-instance RGBA colors for a thin-instanced mesh. */
|
|
4133
6040
|
export declare function setThinInstanceColors(mesh: Mesh, colors: Float32Array): void;
|
|
4134
6041
|
|
|
6042
|
+
/** Update ONLY the active instance count (and re-upload the [0,count) matrix range), leaving `_capacity`
|
|
6043
|
+
* — and therefore the already-allocated GPU buffer — untouched. This is the way to vary how many instances
|
|
6044
|
+
* draw FRAME-TO-FRAME on an established thin-instanced mesh WITHOUT recreating the GPU buffer (which would
|
|
6045
|
+
* invalidate any cached render/shadow bundle that captured the old buffer handle). Pre-size the buffer once
|
|
6046
|
+
* with `setThinInstances(mesh, matrices, capacity)`, then call this each update with `count <= capacity`.
|
|
6047
|
+
* The draw reads `count` live, so the bundle stays valid. Caller must keep writing into the SAME `matrices`
|
|
6048
|
+
* array the mesh already references. No-op if the mesh isn't thin-instanced yet. */
|
|
6049
|
+
export declare function setThinInstanceCount(mesh: Mesh, count: number): void;
|
|
6050
|
+
|
|
4135
6051
|
/** Update one instance's matrix. */
|
|
4136
6052
|
export declare function setThinInstanceMatrix(mesh: Mesh, index: number, matrix: Mat4): void;
|
|
4137
6053
|
|
|
@@ -4170,6 +6086,7 @@ export declare interface ShaderMaterial extends Material {
|
|
|
4170
6086
|
readonly attributes: readonly ShaderAttributeName[];
|
|
4171
6087
|
readonly uniformDecls: readonly ShaderUniformDecl[];
|
|
4172
6088
|
readonly samplerDecls: readonly ShaderSamplerDecl[];
|
|
6089
|
+
readonly storageBufferDecls: readonly ShaderStorageBufferDecl[];
|
|
4173
6090
|
readonly defines: readonly ShaderDefine[];
|
|
4174
6091
|
readonly needAlphaBlending: boolean;
|
|
4175
6092
|
readonly blendMode: "alpha" | "additive";
|
|
@@ -4178,7 +6095,10 @@ export declare interface ShaderMaterial extends Material {
|
|
|
4178
6095
|
readonly needAlphaTesting: boolean;
|
|
4179
6096
|
readonly backFaceCulling: boolean;
|
|
4180
6097
|
readonly depthWrite: boolean;
|
|
4181
|
-
readonly depthCompare: GPUCompareFunction;
|
|
6098
|
+
readonly depthCompare: GPUCompareFunction;
|
|
6099
|
+
readonly depthOnlyFragment: boolean;
|
|
6100
|
+
readonly depthBias: number;
|
|
6101
|
+
readonly depthBiasSlopeScale: number;
|
|
4182
6102
|
|
|
4183
6103
|
/** Options describing a ShaderMaterial: WGSL sources, attributes, uniforms,
|
|
4184
6104
|
* samplers, defines, and blend/depth state. Passed to `createShaderMaterial()`. */
|
|
@@ -4189,6 +6109,7 @@ export declare interface ShaderMaterialOptions {
|
|
|
4189
6109
|
readonly attributes: readonly ShaderAttributeName[];
|
|
4190
6110
|
readonly uniforms?: readonly ShaderUniformOption[];
|
|
4191
6111
|
readonly samplers?: readonly ShaderSamplerOption[];
|
|
6112
|
+
readonly storageBuffers?: readonly ShaderStorageBufferOption[];
|
|
4192
6113
|
readonly defines?: ShaderDefineMap;
|
|
4193
6114
|
readonly needAlphaBlending?: boolean;
|
|
4194
6115
|
/** Blend equation used when `needAlphaBlending` is set. "alpha" (default) is
|
|
@@ -4206,6 +6127,32 @@ export declare interface ShaderMaterialOptions {
|
|
|
4206
6127
|
readonly backFaceCulling?: boolean;
|
|
4207
6128
|
readonly depthWrite?: boolean;
|
|
4208
6129
|
readonly depthCompare?: GPUCompareFunction;
|
|
6130
|
+
/** Compile/run the fragment stage even for depth-only render targets (no colour attachments).
|
|
6131
|
+
* Use for depth-only casters that need `discard` (alpha/clip masks). The fragment shader must not
|
|
6132
|
+
* declare colour outputs when drawn into a depth-only target. Default false. */
|
|
6133
|
+
readonly depthOnlyFragment?: boolean;
|
|
6134
|
+
/** Constant depth-bias added in the pipeline's depth-stencil state (units of the depth format's minimum
|
|
6135
|
+
* representable value). Lets a surface that hugs another (e.g. tiles overlapping a cone, decals) win the
|
|
6136
|
+
* depth test consistently and avoid z-fighting. Default 0 (no bias). */
|
|
6137
|
+
readonly depthBias?: number;
|
|
6138
|
+
/** Slope-scaled depth bias — extra bias proportional to the depth gradient, so steeply-angled (grazing)
|
|
6139
|
+
* surfaces get more bias. Pairs with `depthBias` to kill z-fighting at oblique angles. Default 0. */
|
|
6140
|
+
readonly depthBiasSlopeScale?: number;
|
|
6141
|
+
}
|
|
6142
|
+
|
|
6143
|
+
/** Configuration for {@link createShaderNormalMaterialView}. */
|
|
6144
|
+
export declare interface ShaderNormalViewConfig {
|
|
6145
|
+
/** Name of the world-position varying the source vertex stage emits. Default `"vWorldPos"`. */
|
|
6146
|
+
readonly worldPosVarying?: string;
|
|
6147
|
+
/** `@location()` of that varying in the vertex output struct. Default `0`. */
|
|
6148
|
+
readonly worldPosLocation?: number;
|
|
6149
|
+
/** Output space of the encoded normal: `"view"` (default — ready for
|
|
6150
|
+
* Blender-style screen-space curvature) or `"world"`. */
|
|
6151
|
+
readonly space?: "view" | "world";
|
|
6152
|
+
/** When set, the output ALPHA encodes the fragment's view distance normalized by this range
|
|
6153
|
+
* (`clamp(viewZ / range, 0, 1)`) so a consumer can fade the effect with distance. Clear the target's
|
|
6154
|
+
* alpha to `1` as the "no geometry" sentinel. When omitted, alpha is a flat `1` (validity only). */
|
|
6155
|
+
readonly distanceEncodeRange?: number;
|
|
4209
6156
|
}
|
|
4210
6157
|
|
|
4211
6158
|
/** A sampler declaration: WGSL identifier and the bound texture's sample type. */
|
|
@@ -4223,6 +6170,15 @@ export declare interface ShaderSamplerDecl {
|
|
|
4223
6170
|
/** A sampler entry: either a bare sampler name or an explicit declaration. */
|
|
4224
6171
|
export declare type ShaderSamplerOption = string | ShaderSamplerDecl;
|
|
4225
6172
|
|
|
6173
|
+
/** A storage buffer declaration. `type` is the WGSL variable type, e.g. `array<vec4<f32>>`. */
|
|
6174
|
+
declare interface ShaderStorageBufferDecl {
|
|
6175
|
+
readonly name: string;
|
|
6176
|
+
readonly type: string;
|
|
6177
|
+
}
|
|
6178
|
+
|
|
6179
|
+
/** A storage-buffer entry: a read-only WGSL storage binding declaration. */
|
|
6180
|
+
declare type ShaderStorageBufferOption = ShaderStorageBufferDecl;
|
|
6181
|
+
|
|
4226
6182
|
/** Built-in uniform names automatically populated by the renderer each frame
|
|
4227
6183
|
* (transforms, camera position, screen size, alpha cutoff). */
|
|
4228
6184
|
export declare type ShaderSystemUniformName = "world" | "view" | "projection" | "viewProjection" | "worldView" | "worldViewProjection" | "cameraPosition" | "screenSize" | "alphaCutoff";
|
|
@@ -4251,6 +6207,91 @@ export declare interface ShadowTask extends Task {
|
|
|
4251
6207
|
readonly name: "shadow";
|
|
4252
6208
|
}
|
|
4253
6209
|
|
|
6210
|
+
/**
|
|
6211
|
+
* Sweep a shape from `startPosition` to `endPosition` (orientation fixed) and return the
|
|
6212
|
+
* first body it hits.
|
|
6213
|
+
*
|
|
6214
|
+
* `hitPoint` is the world-space contact point on the hit body; `fraction` is where along
|
|
6215
|
+
* the sweep contact first occurs. Run at least one physics step first so the broadphase exists.
|
|
6216
|
+
* @param world - The physics world to query.
|
|
6217
|
+
* @param query - Swept shape, orientation, and start/end positions.
|
|
6218
|
+
* @returns The cast result; `hasHit` is `false` when the sweep clears every body.
|
|
6219
|
+
*/
|
|
6220
|
+
export declare function shapeCast(world: PhysicsWorld, query: ShapeCastQuery): ShapeCastResult;
|
|
6221
|
+
|
|
6222
|
+
/** Query parameters for {@link shapeCast}. */
|
|
6223
|
+
export declare interface ShapeCastQuery {
|
|
6224
|
+
/** Shape to sweep through the world. */
|
|
6225
|
+
shape: PhysicsShape;
|
|
6226
|
+
/** World-space orientation held constant during the sweep. */
|
|
6227
|
+
rotation: Quat;
|
|
6228
|
+
/** World-space sweep start position. */
|
|
6229
|
+
startPosition: Vec3;
|
|
6230
|
+
/** World-space sweep end position. */
|
|
6231
|
+
endPosition: Vec3;
|
|
6232
|
+
/** Whether trigger volumes count as hits. Default `false`. */
|
|
6233
|
+
shouldHitTriggers?: boolean;
|
|
6234
|
+
}
|
|
6235
|
+
|
|
6236
|
+
/** Result of a {@link shapeCast} query. */
|
|
6237
|
+
export declare interface ShapeCastResult {
|
|
6238
|
+
/** Whether the swept shape hit a body. */
|
|
6239
|
+
hasHit: boolean;
|
|
6240
|
+
/** Fraction along the sweep (`startPosition`→`endPosition`) where contact first occurs. */
|
|
6241
|
+
fraction: number;
|
|
6242
|
+
/** Contact point on the swept shape (query-shape space). */
|
|
6243
|
+
inputHitPoint: Vec3;
|
|
6244
|
+
/** Contact point on the hit body (world space). */
|
|
6245
|
+
hitPoint: Vec3;
|
|
6246
|
+
/** Surface normal at the swept-shape contact. */
|
|
6247
|
+
inputHitNormal: Vec3;
|
|
6248
|
+
/** Surface normal at the hit-body contact. */
|
|
6249
|
+
hitNormal: Vec3;
|
|
6250
|
+
}
|
|
6251
|
+
|
|
6252
|
+
/**
|
|
6253
|
+
* Find the closest point between a query shape and the nearest body in the world.
|
|
6254
|
+
*
|
|
6255
|
+
* The query shape is positioned at `position`/`rotation` and tested against the world's
|
|
6256
|
+
* broadphase. When a body is found within `maxDistance`, `inputHitPoint` is the closest
|
|
6257
|
+
* point on the query shape and `hitPoint` is the closest point on the hit body (world
|
|
6258
|
+
* space). Run at least one physics step first so the broadphase exists.
|
|
6259
|
+
* @param world - The physics world to query.
|
|
6260
|
+
* @param query - Query shape, transform, and search distance.
|
|
6261
|
+
* @returns The proximity result; `hasHit` is `false` when nothing is within range.
|
|
6262
|
+
*/
|
|
6263
|
+
export declare function shapeProximity(world: PhysicsWorld, query: ShapeProximityQuery): ShapeProximityResult;
|
|
6264
|
+
|
|
6265
|
+
/** Query parameters for {@link shapeProximity}. */
|
|
6266
|
+
export declare interface ShapeProximityQuery {
|
|
6267
|
+
/** Shape to test for proximity. */
|
|
6268
|
+
shape: PhysicsShape;
|
|
6269
|
+
/** World-space position of the query shape. */
|
|
6270
|
+
position: Vec3;
|
|
6271
|
+
/** World-space orientation of the query shape. */
|
|
6272
|
+
rotation: Quat;
|
|
6273
|
+
/** Maximum distance to search for a nearby body. */
|
|
6274
|
+
maxDistance: number;
|
|
6275
|
+
/** Whether trigger volumes count as hits. Default `false`. */
|
|
6276
|
+
shouldHitTriggers?: boolean;
|
|
6277
|
+
}
|
|
6278
|
+
|
|
6279
|
+
/** Result of a {@link shapeProximity} query. */
|
|
6280
|
+
export declare interface ShapeProximityResult {
|
|
6281
|
+
/** Whether a body was found within `maxDistance`. */
|
|
6282
|
+
hasHit: boolean;
|
|
6283
|
+
/** Distance between the closest points. */
|
|
6284
|
+
distance: number;
|
|
6285
|
+
/** Closest point on the query shape (query-shape local space in a zero-offset world). */
|
|
6286
|
+
inputHitPoint: Vec3;
|
|
6287
|
+
/** Closest point on the hit body (world space). */
|
|
6288
|
+
hitPoint: Vec3;
|
|
6289
|
+
/** Surface normal at the query-shape closest point. */
|
|
6290
|
+
inputHitNormal: Vec3;
|
|
6291
|
+
/** Surface normal at the hit-body closest point. */
|
|
6292
|
+
hitNormal: Vec3;
|
|
6293
|
+
}
|
|
6294
|
+
|
|
4254
6295
|
/** Sheen layer properties. Maps to BJS PBRMaterial.sheen sub-object. */
|
|
4255
6296
|
declare interface SheenProps {
|
|
4256
6297
|
/** Whether sheen is active. Default false. */
|
|
@@ -4270,6 +6311,12 @@ declare interface SheenProps {
|
|
|
4270
6311
|
albedoScaling?: boolean;
|
|
4271
6312
|
}
|
|
4272
6313
|
|
|
6314
|
+
/** Shows a Havok Physics V2 body as a wireframe debug mesh. */
|
|
6315
|
+
export declare function showPhysicsBody(viewer: PhysicsViewer, body: PhysicsBody): Mesh | null;
|
|
6316
|
+
|
|
6317
|
+
/** Shows a simplified Physics V2 constraint overlay: local axes (with arrowheads) plus angular-limit disks. */
|
|
6318
|
+
export declare function showPhysicsConstraint(viewer: PhysicsViewer, constraint: PhysicsConstraintDebug): Mesh[];
|
|
6319
|
+
|
|
4273
6320
|
/** Connects a skeleton to its GPU bone texture for per-frame updates. */
|
|
4274
6321
|
declare interface SkeletonBinding {
|
|
4275
6322
|
readonly jointNodes: readonly number[];
|
|
@@ -4507,15 +6554,31 @@ export declare interface SpriteAtlas {
|
|
|
4507
6554
|
readonly texture: Texture2D;
|
|
4508
6555
|
readonly textureSizePx: readonly [number, number];
|
|
4509
6556
|
readonly frames: readonly SpriteFrame[];
|
|
4510
|
-
readonly premultipliedAlpha: boolean;
|
|
4511
|
-
}
|
|
6557
|
+
readonly premultipliedAlpha: boolean;
|
|
4512
6558
|
|
|
4513
|
-
/** One source frame for `createSpriteAtlasFromFrames`.
|
|
6559
|
+
/** One source frame for `createSpriteAtlasFromFrames` / `appendSpriteAtlasFrames`. The packed
|
|
6560
|
+
* region is `width × height` texels. By default the source is read as a tightly-packed RGBA8
|
|
6561
|
+
* buffer of exactly that size starting at byte 0; the optional `srcX` / `srcY` / `srcStrideBytes`
|
|
6562
|
+
* fields let the source describe a sub-rectangle of a larger buffer without forcing the caller
|
|
6563
|
+
* to copy out the sub-rect first. */
|
|
4514
6564
|
export declare interface SpriteAtlasFrameSource {
|
|
4515
|
-
/**
|
|
6565
|
+
/** RGBA8 bytes, row-major, top-to-bottom, straight alpha. When `srcX` / `srcY` /
|
|
6566
|
+
* `srcStrideBytes` are all defaulted, this must be exactly `width * height * 4` bytes;
|
|
6567
|
+
* when sub-rect fields are supplied, it must be large enough to cover the rect
|
|
6568
|
+
* (see those fields' docs). */
|
|
4516
6569
|
readonly pixels: Uint8Array;
|
|
6570
|
+
/** Width of the frame to pack (texels written to the atlas). */
|
|
4517
6571
|
readonly width: number;
|
|
6572
|
+
/** Height of the frame to pack (texels written to the atlas). */
|
|
4518
6573
|
readonly height: number;
|
|
6574
|
+
/** Top-left x of the sub-rect to pack, in texels into `pixels`. Default `0`. */
|
|
6575
|
+
readonly srcX?: number;
|
|
6576
|
+
/** Top-left y of the sub-rect to pack, in texels into `pixels`. Default `0`. */
|
|
6577
|
+
readonly srcY?: number;
|
|
6578
|
+
/** Bytes between consecutive rows of `pixels`. Default `width * 4` (tightly packed).
|
|
6579
|
+
* Must satisfy `(srcX + width) * 4 <= srcStrideBytes` — i.e. each row's sub-rect window
|
|
6580
|
+
* must fit within one stride, so reads do not spill into the next row. */
|
|
6581
|
+
readonly srcStrideBytes?: number;
|
|
4519
6582
|
/** Pivot in [0,1] of the frame. Default `[0.5, 0.5]`. */
|
|
4520
6583
|
readonly pivot?: readonly [number, number];
|
|
4521
6584
|
/** Recorded on the emitted `SpriteFrame.name`. */
|
|
@@ -4531,6 +6594,11 @@ export declare interface SpriteAtlasPackOptions {
|
|
|
4531
6594
|
/** Min/mag filter for the packed texture. Default `"nearest"`. */
|
|
4532
6595
|
sampling?: SpriteSampling;
|
|
4533
6596
|
premultipliedAlpha?: boolean;
|
|
6597
|
+
/** Pre-allocate the atlas texture at this `[width, height]` regardless of initial-content
|
|
6598
|
+
* size, leaving headroom for later `appendSpriteAtlasFrames` calls (which never grow the
|
|
6599
|
+
* texture). Required when `sources` is empty. Defaults to the size required by the initial
|
|
6600
|
+
* `sources` (no append headroom). */
|
|
6601
|
+
capacityPx?: readonly [number, number];
|
|
4534
6602
|
}
|
|
4535
6603
|
|
|
4536
6604
|
/**
|
|
@@ -4635,6 +6703,9 @@ export declare interface SpriteRendererOptions {
|
|
|
4635
6703
|
/** Texture sampling mode for a sprite atlas. */
|
|
4636
6704
|
export declare type SpriteSampling = "linear" | "nearest";
|
|
4637
6705
|
|
|
6706
|
+
/** Inverse of `linearToSrgbByte` — sRGB byte [0,255] → linear [0,1]. */
|
|
6707
|
+
export declare function srgbByteToLinear(b: number): number;
|
|
6708
|
+
|
|
4638
6709
|
/** Which shader stage an emitter writes into. Neutral blocks can run in either;
|
|
4639
6710
|
* the walker places them in the stage of their consumer (fragment by default). */
|
|
4640
6711
|
declare type Stage = "vertex" | "fragment";
|
|
@@ -4770,6 +6841,60 @@ export declare interface SubSurfaceProps {
|
|
|
4770
6841
|
refraction?: RefractionProps;
|
|
4771
6842
|
}
|
|
4772
6843
|
|
|
6844
|
+
/**
|
|
6845
|
+
* Per-canvas rendering surface — owns the GPU canvas context, swapchain format, MSAA
|
|
6846
|
+
* configuration, and the list of `RenderingContext`s (scenes, effect renderers,
|
|
6847
|
+
* frame-graph contexts, sprite/text renderers) that present to this canvas.
|
|
6848
|
+
*
|
|
6849
|
+
* The `EngineContext` *is itself a `SurfaceContext`* (the primary one, bound to the
|
|
6850
|
+
* canvas passed into `createEngine`). Additional surfaces for auxiliary canvases are
|
|
6851
|
+
* created via {@link createSurface}. GPU resources (textures, buffers, pipelines, bind
|
|
6852
|
+
* groups) live on the {@link EngineContext} (device-scoped) and are shared across all
|
|
6853
|
+
* surfaces of the same engine — only the swapchain output is per-surface.
|
|
6854
|
+
*/
|
|
6855
|
+
export declare interface SurfaceContext {
|
|
6856
|
+
/** Owning engine. For the engine's primary surface this points back to the engine
|
|
6857
|
+
* itself (`engine.engine === engine`). */
|
|
6858
|
+
readonly engine: EngineContext;
|
|
6859
|
+
/** Canvas this surface presents to. */
|
|
6860
|
+
readonly canvas: RenderCanvas;
|
|
6861
|
+
/** Swapchain texture format for this surface. Use as the `format` for offscreen
|
|
6862
|
+
* RTs that will be composited onto this surface. */
|
|
6863
|
+
readonly format: GPUTextureFormat;
|
|
6864
|
+
/** MSAA sample count for the main render pass into this surface (1 or 4). */
|
|
6865
|
+
readonly msaaSamples: number;
|
|
4773
6866
|
/**
|
|
6867
|
+
* Surface-owned color-only render target that wraps this canvas's swapchain texture.
|
|
6868
|
+
* Its `_colorTexture`/`_colorView` are re-acquired from `context.getCurrentTexture()`
|
|
6869
|
+
* once per frame (see `_refreshScRT`), so it is always single-sample and carries no
|
|
6870
|
+
* depth. Render/post-process/copy tasks target it (or resolve into it) to present to
|
|
6871
|
+
* the canvas. It is `_eager` — `buildRenderTarget` and `disposeRenderTarget` both
|
|
6872
|
+
* no-op on it and the surface owns its textures, so its shared `_descriptor` must
|
|
6873
|
+
* never be mutated.
|
|
6874
|
+
*/
|
|
6875
|
+
readonly scRT: RenderTarget;
|
|
6876
|
+
/** Clamps the effective device pixel ratio used for this surface's swapchain backing
|
|
6877
|
+
* store. The backing store is sized at `min(devicePixelRatio, maxDevicePixelRatio) * cssPixels`.
|
|
6878
|
+
* `maxDevicePixelRatio = 1` renders at native CSS-pixel resolution (no DPR upscaling);
|
|
6879
|
+
* the default `Infinity` is unclamped (full devicePixelRatio). Mutable at runtime — set
|
|
6880
|
+
* before the next `resizeSurface` to take effect (mirrors Babylon `setHardwareScalingRatio`). */
|
|
6881
|
+
maxDevicePixelRatio: number;
|
|
6882
|
+
|
|
6883
|
+
/** Options for {@link createSurface}, and for the per-surface portion of `createEngine`. */
|
|
6884
|
+
export declare interface SurfaceOptions {
|
|
6885
|
+
/** MSAA sample count for the main render pass. WebGPU only permits `1` (no MSAA)
|
|
6886
|
+
* or `4` (4x MSAA). Defaults to `4`. */
|
|
6887
|
+
msaaSamples?: 1 | 4;
|
|
6888
|
+
/** WebGPU canvas alpha mode. Use `"premultiplied"` to enable canvas transparency
|
|
6889
|
+
* (clear color with `alpha < 1` will let HTML content underneath show through).
|
|
6890
|
+
* Defaults to `"opaque"`. */
|
|
6891
|
+
alphaMode?: GPUCanvasAlphaMode;
|
|
6892
|
+
/** Override the swapchain format. Defaults to `navigator.gpu.getPreferredCanvasFormat()`. */
|
|
6893
|
+
format?: GPUTextureFormat;
|
|
6894
|
+
/** Clamps the effective device pixel ratio used for the swapchain backing store.
|
|
6895
|
+
* Defaults to unclamped (full devicePixelRatio). */
|
|
6896
|
+
maxDevicePixelRatio?: number;
|
|
6897
|
+
}
|
|
6898
|
+
|
|
4774
6899
|
declare type TargetPath = 0 | 1 | 2 | 3 | 4;
|
|
4775
6900
|
|
|
4776
6901
|
/** Polymorphic interface that all frame-graph tasks implement: records `Pass` objects during `record()` and is executed once per frame. */
|
|
@@ -4785,6 +6910,125 @@ export declare interface Task {
|
|
|
4785
6910
|
dispose(): void;
|
|
4786
6911
|
}
|
|
4787
6912
|
|
|
6913
|
+
export declare interface TextData {
|
|
6914
|
+
readonly [textDataBrand]: true;
|
|
6915
|
+
/** Live, in-insertion-order view of the runs currently rendered. Mutated by
|
|
6916
|
+
* `updateTextData`. Do not mutate from outside. */
|
|
6917
|
+
readonly runs: readonly GlyphRun[];
|
|
6918
|
+
|
|
6919
|
+
declare const textDataBrand: unique symbol;
|
|
6920
|
+
|
|
6921
|
+
/** Discriminated union driving `updateTextData`. Each variant's `update` field is the
|
|
6922
|
+
* discriminator. Arrays/maps passed inside any variant are *adopted* by the `TextData`
|
|
6923
|
+
* and must not be read or mutated by the caller afterward. */
|
|
6924
|
+
export declare type TextDataUpdate = {
|
|
6925
|
+
/** Rebuild runs and/or swap to a different storage. Both `runs` and `storage`
|
|
6926
|
+
* are optional; missing fields default to the TextData's current value, so
|
|
6927
|
+
* `{ update: "reset" }` with neither performs a pure compaction pass that
|
|
6928
|
+
* re-lays-out the slot allocator without dead slots or gaps.
|
|
6929
|
+
* Invalidates any previously-passed `GlyphRun` references when `runs` is set. */
|
|
6930
|
+
update: "reset";
|
|
6931
|
+
runs?: GlyphRun[];
|
|
6932
|
+
storage?: GlyphStorage;
|
|
6933
|
+
} | {
|
|
6934
|
+
/** Append a new run to the live runs list, or insert it before the run currently at
|
|
6935
|
+
* `insertBefore`. The run's `curveSet` must already exist in the bound storage. */
|
|
6936
|
+
update: "addRun";
|
|
6937
|
+
run: GlyphRun;
|
|
6938
|
+
/** Index in `data.runs` to insert before. Default = append at end. */
|
|
6939
|
+
insertBefore?: number;
|
|
6940
|
+
} | {
|
|
6941
|
+
/** Remove a previously-added run. Accepts either the `GlyphRun` reference or its
|
|
6942
|
+
* current index in `data.runs`. */
|
|
6943
|
+
update: "removeRun";
|
|
6944
|
+
run: GlyphRun | number;
|
|
6945
|
+
} | {
|
|
6946
|
+
/** Replace one run's contents in place. The new run takes the slot in `data.runs`
|
|
6947
|
+
* that the previous run occupied. Cheapest when the new run has the same glyph
|
|
6948
|
+
* count and the same `curveSet` as the previous one. */
|
|
6949
|
+
update: "replaceRun";
|
|
6950
|
+
previous: GlyphRun | number;
|
|
6951
|
+
run: GlyphRun;
|
|
6952
|
+
};
|
|
6953
|
+
|
|
6954
|
+
/** Pure-data 2D text layer. Mutate fields directly between frames. */
|
|
6955
|
+
export declare interface TextLayer {
|
|
4788
6956
|
readonly data: TextData;
|
|
6957
|
+
positionPx: {
|
|
6958
|
+
x: number;
|
|
6959
|
+
y: number;
|
|
6960
|
+
};
|
|
6961
|
+
rotationRad: number;
|
|
6962
|
+
scale: number;
|
|
6963
|
+
order: number;
|
|
6964
|
+
opacity: number;
|
|
6965
|
+
visible: boolean;
|
|
6966
|
+
|
|
6967
|
+
export declare interface TextLayerOptions {
|
|
6968
|
+
/** Top-left origin (in canvas pixels) for the layer's local coordinate frame. Default (0, 0). */
|
|
6969
|
+
readonly positionPx?: {
|
|
6970
|
+
readonly x: number;
|
|
6971
|
+
readonly y: number;
|
|
6972
|
+
};
|
|
6973
|
+
/** Z-axis rotation about `positionPx`, in radians. Default 0. */
|
|
6974
|
+
readonly rotationRad?: number;
|
|
6975
|
+
/** Uniform scale applied to the laid-out text. Default 1. */
|
|
6976
|
+
readonly scale?: number;
|
|
6977
|
+
/** Sort order within a renderer (lower draws first). Default 0. */
|
|
6978
|
+
readonly order?: number;
|
|
6979
|
+
/** Alpha multiplier in [0, 1]. Default 1. */
|
|
6980
|
+
readonly opacity?: number;
|
|
6981
|
+
/** Default true. */
|
|
6982
|
+
readonly visible?: boolean;
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6985
|
+
export declare type TextLayoutOptions = {
|
|
6986
|
+
/** Max line width in pixels before word-wrap. Default: Infinity. */
|
|
6987
|
+
readonly maxWidth?: number;
|
|
6988
|
+
/** Line-height multiplier. Default: 1.2. */
|
|
6989
|
+
readonly lineHeight?: number;
|
|
6990
|
+
/** Horizontal alignment. Default: "left". */
|
|
6991
|
+
readonly align?: "left" | "center" | "right";
|
|
6992
|
+
/** Extra spacing in font units. Default: 0. */
|
|
6993
|
+
readonly letterSpacing?: number;
|
|
6994
|
+
/** Tab size in spaces. Default: 4. */
|
|
6995
|
+
readonly tabSize?: number;
|
|
6996
|
+
};
|
|
6997
|
+
|
|
6998
|
+
export declare interface TextRenderable extends Renderable {
|
|
4789
6999
|
readonly position: ObservableVec3;
|
|
7000
|
+
readonly rotation: EulerProxy;
|
|
7001
|
+
readonly rotationQuaternion: ObservableQuat;
|
|
7002
|
+
readonly scaling: ObservableVec3;
|
|
7003
|
+
/** Whole-block opacity in [0,1]. Color is supplied per-glyph by the `TextData` descriptor. */
|
|
7004
|
+
opacity: number;
|
|
7005
|
+
ignoreDepth: boolean;
|
|
7006
|
+
order: number;
|
|
7007
|
+
|
|
7008
|
+
export declare interface TextRenderableOptions {
|
|
7009
|
+
readonly position?: Readonly<Vec3>;
|
|
7010
|
+
readonly rotationQuaternion?: {
|
|
7011
|
+
readonly x: number;
|
|
7012
|
+
readonly y: number;
|
|
7013
|
+
readonly z: number;
|
|
7014
|
+
readonly w: number;
|
|
7015
|
+
};
|
|
7016
|
+
readonly scaling?: Readonly<Vec3>;
|
|
7017
|
+
/** Whole-block opacity in [0,1]. Default 1. Per-glyph/per-run color comes from the `TextData`
|
|
7018
|
+
* descriptor (`PlacedGlyph.color` / `GlyphRun.defaultColor`), not from the renderable. */
|
|
7019
|
+
readonly opacity?: number;
|
|
7020
|
+
readonly ignoreDepth?: boolean;
|
|
7021
|
+
readonly order?: number;
|
|
7022
|
+
}
|
|
7023
|
+
|
|
7024
|
+
export declare interface TextRenderer extends RenderingContext_2 {
|
|
4790
7025
|
readonly layers: readonly TextLayer[];
|
|
7026
|
+
|
|
7027
|
+
export declare interface TextRendererOptions {
|
|
7028
|
+
layers: readonly TextLayer[];
|
|
7029
|
+
/** Default true. Set false for HUD overlays so the text pass preserves existing scene color. */
|
|
7030
|
+
clear?: boolean;
|
|
7031
|
+
/** Default `{ r: 0, g: 0, b: 0, a: 1 }`. */
|
|
7032
|
+
clearValue?: GPUColorDict;
|
|
7033
|
+
}
|
|
7034
|
+
|
|
4791
7035
|
/** A loaded 2D texture: the GPU texture, its default view and sampler, pixel
|
|
4792
7036
|
* dimensions, and an optional per-texture UV transform. This is the public
|
|
4793
7037
|
* texture handle returned by `loadTexture2D()`, `createSolidTexture2D()`, etc. */
|
|
@@ -4948,6 +7192,14 @@ export declare interface TransmissionOptions {
|
|
|
4948
7192
|
* stack) and just need the opaque scene color exposed to a custom transmissive
|
|
4949
7193
|
* `ShaderMaterial`. */
|
|
4950
7194
|
linear?: boolean;
|
|
7195
|
+
/** Override how many times the scene-colour grab is refreshed per frame. `0` means before every
|
|
7196
|
+
* transmissive draw; the default is once before the first transmissive draw. */
|
|
7197
|
+
copyCount?: number;
|
|
7198
|
+
/** Set false when the transmissive material never samples the scene-colour grab above mip 0. */
|
|
7199
|
+
generateMipmaps?: boolean;
|
|
7200
|
+
/** Cap the scene-colour grab mip chain. Use this when the material samples explicit low LODs only, so
|
|
7201
|
+
* unused tiny mips are not regenerated every frame. Ignored when `generateMipmaps` is false. */
|
|
7202
|
+
mipLevelCount?: number;
|
|
4951
7203
|
}
|
|
4952
7204
|
|
|
4953
7205
|
/** Options for `createTubeData`: a circular cross-section swept along a path. */
|
|
@@ -4990,18 +7242,21 @@ export declare interface UniformEffectWrapperOptions {
|
|
|
4990
7242
|
uniformByteLength: number;
|
|
4991
7243
|
}
|
|
4992
7244
|
|
|
4993
|
-
/** Unregister the effect renderer from its
|
|
7245
|
+
/** Unregister the effect renderer from its surface. No-op if not registered. */
|
|
4994
7246
|
export declare function unregisterEffectRenderer(er: EffectRenderer): void;
|
|
4995
7247
|
|
|
4996
|
-
/** Unregister the standalone frame-graph context from its
|
|
7248
|
+
/** Unregister the standalone frame-graph context from its surface. */
|
|
4997
7249
|
export declare function unregisterFrameGraphContext(ctx: FrameGraphContext): void;
|
|
4998
7250
|
|
|
4999
|
-
/** Remove a previously-registered scene. Idempotent. Does not dispose scene resources.
|
|
5000
|
-
|
|
7251
|
+
/** Remove a previously-registered scene. Idempotent. Does not dispose scene resources.
|
|
7252
|
+
* The scene is always removed from `scene.surface`. */
|
|
7253
|
+
export declare function unregisterScene(scene: SceneContext): void;
|
|
5001
7254
|
|
|
5002
7255
|
/** Splice the renderer out of its engine's `_renderingContexts`. No-op if not present. */
|
|
5003
7256
|
export declare function unregisterSpriteRenderer(sr: SpriteRenderer): void;
|
|
5004
7257
|
|
|
7258
|
+
export declare function unregisterTextRenderer(tr: TextRenderer): void;
|
|
7259
|
+
|
|
5005
7260
|
/** Advances every active task by `deltaMs` (or by `fixedDeltaMs` when set), running the category handler first.
|
|
5006
7261
|
* Ignores non-finite or negative steps. */
|
|
5007
7262
|
export declare function updateAnimationManager(manager: AnimationManager, deltaMs: number): void;
|
|
@@ -5023,6 +7278,28 @@ export declare function updateBillboardSprite(handle: BillboardSpriteHandle, pat
|
|
|
5023
7278
|
*/
|
|
5024
7279
|
export declare function updateBillboardSpriteIndex(system: BillboardSpriteSystem, index: number, patch: Partial<BillboardSpriteInit>): void;
|
|
5025
7280
|
|
|
7281
|
+
/** Re-shape `text` and apply the new run via `updateTextData(replaceRun)`. New glyphs are
|
|
7282
|
+
* added to the storage in place. When `textColor` is omitted, the live run's existing
|
|
7283
|
+
* `defaultColor` is preserved (so any caller-driven color override survives a text re-shape). */
|
|
7284
|
+
export declare function updateDefaultTextData(data: DefaultTextData, text: string, textColor?: readonly [number, number, number, number]): void;
|
|
7285
|
+
|
|
7286
|
+
/** Add glyphs to the named curve-set, creating it if it doesn't exist yet. Glyph ids
|
|
7287
|
+
* already present in the curve-set are skipped (the existing outline + atlas slot wins).
|
|
7288
|
+
* Safe to call between frames: the atlas grows in place and the next render uploads the
|
|
7289
|
+
* new glyphs. */
|
|
7290
|
+
export declare function updateGlyphStorage(storage: GlyphStorage, curveSetId: CurveSetId, curves: ReadonlyMap<number, GlyphCurves>): void;
|
|
7291
|
+
|
|
7292
|
+
/** Re-upload (part of) a mesh's COLOR buffer — the twin of `updateMeshNormals`/`updateMeshPositions`
|
|
7293
|
+
* for dynamically re-generated geometry whose per-vertex colors change (e.g. a procedural mesh whose
|
|
7294
|
+
* parts are re-tinted each rebuild). The color attribute is vec4 (16 bytes/vertex). No-op if the mesh
|
|
7295
|
+
* was created without colors. Zero-allocation GPU upload only. */
|
|
7296
|
+
export declare function updateMeshColors(engine: EngineContext, mesh: Mesh, colors: Float32Array, vertexOffset?: number): void;
|
|
7297
|
+
|
|
7298
|
+
/** Re-upload (part of) a mesh's NORMAL buffer — the twin of `updateMeshPositions` for dynamically
|
|
7299
|
+
* re-generated geometry whose per-vertex normals change (e.g. a swept tube re-fitted each rebuild).
|
|
7300
|
+
* No-op if the mesh was created without normals. Zero-allocation GPU upload only. */
|
|
7301
|
+
export declare function updateMeshNormals(engine: EngineContext, mesh: Mesh, normals: Float32Array, vertexOffset?: number): void;
|
|
7302
|
+
|
|
5026
7303
|
/** Update a mesh's GPU vertex positions in place (e.g. CPU vertex animation).
|
|
5027
7304
|
* `positions` must hold tightly-packed XYZ floats matching the mesh's vertex count.
|
|
5028
7305
|
* `vertexOffset` is the first vertex to overwrite (defaults to 0).
|
|
@@ -5030,6 +7307,24 @@ export declare function updateBillboardSpriteIndex(system: BillboardSpriteSystem
|
|
|
5030
7307
|
* Zero-allocation GPU upload only — CPU-side picking geometry is not refreshed. */
|
|
5031
7308
|
export declare function updateMeshPositions(engine: EngineContext, mesh: Mesh, positions: Float32Array, vertexOffset?: number): void;
|
|
5032
7309
|
|
|
7310
|
+
/** Re-upload (part of) a mesh's TANGENT buffer — the twin of `updateMeshColors` for dynamically
|
|
7311
|
+
* re-generated geometry whose per-vertex tangent (vec4) payload changes each rebuild (e.g. a procedural
|
|
7312
|
+
* batch that streams a per-vertex coordinate frame / mask through the tangent slot). The tangent attribute
|
|
7313
|
+
* is vec4 (16 bytes/vertex). No-op if the mesh was created without tangents. Zero-allocation GPU upload only. */
|
|
7314
|
+
export declare function updateMeshTangents(engine: EngineContext, mesh: Mesh, tangents: Float32Array, vertexOffset?: number): void;
|
|
7315
|
+
|
|
7316
|
+
/** Re-upload (part of) a mesh's second UV buffer (uv2) — the twin of `updateMeshUvs` for dynamically
|
|
7317
|
+
* re-generated geometry whose per-vertex uv2 payload changes each rebuild (e.g. a procedural batch that
|
|
7318
|
+
* re-bakes per-vertex AO / gradient data). The uv2 attribute is vec2 (8 bytes/vertex). No-op if the mesh
|
|
7319
|
+
* was created without uv2. Zero-allocation GPU upload only. */
|
|
7320
|
+
export declare function updateMeshUv2(engine: EngineContext, mesh: Mesh, uvs2: Float32Array, vertexOffset?: number): void;
|
|
7321
|
+
|
|
7322
|
+
/** Re-upload (part of) a mesh's UV buffer — the twin of `updateMeshNormals`/`updateMeshColors` for
|
|
7323
|
+
* dynamically re-generated geometry whose per-vertex UVs change (e.g. a procedural mesh whose parts
|
|
7324
|
+
* carry per-rebuild UV payloads). The uv attribute is vec2 (8 bytes/vertex). No-op if the mesh was
|
|
7325
|
+
* created without UVs. Zero-allocation GPU upload only. */
|
|
7326
|
+
export declare function updateMeshUvs(engine: EngineContext, mesh: Mesh, uvs: Float32Array, vertexOffset?: number): void;
|
|
7327
|
+
|
|
5033
7328
|
/** Advance the crowd simulation by `dt` seconds. */
|
|
5034
7329
|
export declare function updateNavCrowd(crowd: NavCrowd, dt: number): void;
|
|
5035
7330
|
|
|
@@ -5055,6 +7350,8 @@ export declare function updateSprite2DIndex(layer: Sprite2DLayer, index: number,
|
|
|
5055
7350
|
*/
|
|
5056
7351
|
export declare function updateSpriteAnimationManager(manager: SpriteAnimationManager, deltaMs: number): void;
|
|
5057
7352
|
|
|
7353
|
+
export declare function updateTextData(data: TextData, update: TextDataUpdate): void;
|
|
7354
|
+
|
|
5058
7355
|
/**
|
|
5059
7356
|
* Update a rectangular region of an existing `Texture2D` from a tightly-packed RGBA8 byte buffer.
|
|
5060
7357
|
*
|
|
@@ -5072,6 +7369,22 @@ export declare function updateSpriteAnimationManager(manager: SpriteAnimationMan
|
|
|
5072
7369
|
*/
|
|
5073
7370
|
export declare function updateTexture2DFromPixels(engine: EngineContext, tex: Texture2D, data: Uint8Array, x?: number, y?: number, width?: number, height?: number): void;
|
|
5074
7371
|
|
|
7372
|
+
/** UtilityLayer handle. The `scene` field is a regular `SceneContext` — pass it
|
|
7373
|
+
* to gizmo factories so their meshes are added there instead of the main
|
|
7374
|
+
* scene. */
|
|
7375
|
+
export declare interface UtilityLayer {
|
|
7376
|
+
readonly scene: SceneContext;
|
|
7377
|
+
readonly mainScene: SceneContext;
|
|
7378
|
+
}
|
|
7379
|
+
|
|
7380
|
+
export declare interface UtilityLayerOptions {
|
|
7381
|
+
/** Add a built-in hemispheric light so gizmo materials are visible without
|
|
7382
|
+
* the caller adding one. Defaults to true. */
|
|
7383
|
+
addDefaultLight?: boolean;
|
|
7384
|
+
/** Default light intensity when `addDefaultLight` is true. Defaults to 1.0. */
|
|
7385
|
+
lightIntensity?: number;
|
|
7386
|
+
}
|
|
7387
|
+
|
|
5075
7388
|
/** Per-mesh original + variant material entry. */
|
|
5076
7389
|
declare interface VariantMeshEntry {
|
|
5077
7390
|
mesh: Mesh;
|
|
@@ -5080,6 +7393,75 @@ declare interface VariantMeshEntry {
|
|
|
5080
7393
|
|
|
5081
7394
|
declare interface Varying {
|
|
5082
7395
|
|
|
7396
|
+
/** Result of baking — the GPU texture plus a per-clip row map for choosing playback params. */
|
|
7397
|
+
export declare interface VatBakeResult {
|
|
7398
|
+
readonly texture: GPUTexture;
|
|
7399
|
+
readonly boneCount: number;
|
|
7400
|
+
readonly frameCount: number;
|
|
7401
|
+
/** Clip name → row range, for building the per-mesh/per-instance (fromRow,toRow,offset,fps) params. */
|
|
7402
|
+
readonly clips: Record<string, VatClip>;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
/** Where one clip landed in the baked texture: its first row, its frame count, and its native fps. */
|
|
7406
|
+
export declare interface VatClip {
|
|
7407
|
+
readonly fromRow: number;
|
|
7408
|
+
readonly frameCount: number;
|
|
7409
|
+
readonly fps: number;
|
|
7410
|
+
}
|
|
7411
|
+
|
|
7412
|
+
/** VAT (Vertex Animation Texture) GPU data — BAKED skinning. Attached to `mesh.vat` by vat/vat-baker.ts.
|
|
7413
|
+
* The skeletal animation is pre-evaluated into `texture` (one frame per row); the shader reads bone
|
|
7414
|
+
* matrices from the current frame's row instead of a live per-frame upload, so the mesh thin-instances.
|
|
7415
|
+
* Reuses the same joints/weights vertex-buffer field names as SkeletonData so the renderable binds either. */
|
|
7416
|
+
declare interface VatData {
|
|
7417
|
+
readonly boneCount: number;
|
|
7418
|
+
/** Baked bone-matrix texture: rgba32float, (boneCount*4) × frameCount, one animation frame per row
|
|
7419
|
+
* (identical per-row layout to the live bone texture in skeleton/create-skeleton.ts). */
|
|
7420
|
+
readonly texture: GPUTexture;
|
|
7421
|
+
readonly frameCount: number;
|
|
7422
|
+
/** UBO consumed by the VAT vertex fragment: `params` vec4 = (fromRow, toRow, frameOffset, fps);
|
|
7423
|
+
* `clock` vec4 .x = elapsed seconds. Advanced by the VAT manager (vat/vat-baker.ts). */
|
|
7424
|
+
readonly settingsBuffer: GPUBuffer;
|
|
7425
|
+
readonly jointsBuffer: GPUBuffer;
|
|
7426
|
+
readonly weightsBuffer: GPUBuffer;
|
|
7427
|
+
readonly joints1Buffer: GPUBuffer | null;
|
|
7428
|
+
readonly weights1Buffer: GPUBuffer | null;
|
|
7429
|
+
/** Optional per-instance VAT params texture (rgba32float, (2*instanceCount) x 1): TWO texels per
|
|
7430
|
+
* thin-instance — A=(fromRow,toRow,offset,fps), B=(fromRow,toRow,blend,fps) — so each instance plays
|
|
7431
|
+
* its own clip + phase (and can blend two clips) from the one shared baked texture. Present + the mesh
|
|
7432
|
+
* thin-instanced ⇒ the VAT vertex path reads its frame rows from this texture indexed by
|
|
7433
|
+
* `@builtin(instance_index)` instead of the shared settings UBO. Set via the VatHandle. */
|
|
7434
|
+
instanceTexture?: GPUTexture | null;
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7437
|
+
/** Runtime VAT playback handle for one mesh (the analogue of BJS BakedVertexAnimationManager + the
|
|
7438
|
+
* per-mesh settings). Advance `update()` each frame; set the active clip with `play()`. */
|
|
7439
|
+
export declare interface VatHandle {
|
|
7440
|
+
/** The mesh this drives (its `mesh.vat` is set). */
|
|
7441
|
+
readonly mesh: Mesh;
|
|
7442
|
+
/** Baked clip row map. */
|
|
7443
|
+
readonly clips: Record<string, VatClip>;
|
|
7444
|
+
/** Select the clip to play (by name) or set explicit playback params. */
|
|
7445
|
+
play(clip: string, opts?: {
|
|
7446
|
+
offset?: number;
|
|
7447
|
+
fps?: number;
|
|
7448
|
+
}): void;
|
|
7449
|
+
/** Advance the animation clock by `dtSeconds` and upload it. */
|
|
7450
|
+
update(dtSeconds: number): void;
|
|
7451
|
+
/** Enable/refresh PER-INSTANCE VAT: upload one vec4 (fromRow, toRow, timeOffset, fps) per thin-instance,
|
|
7452
|
+
* so every instance plays its own clip + phase from the one shared baked texture (all instances in a
|
|
7453
|
+
* single draw call). `params.length` must be `4 * instanceCount`. Call this BEFORE registerScene the
|
|
7454
|
+
* first time — it sets `mesh.vat.instanceTexture`; a VAT mesh that is thin-instanced then takes the
|
|
7455
|
+
* per-instance vertex path. Later calls re-upload in place. Use `clips` to look up each clip's
|
|
7456
|
+
* fromRow/toRow/fps when building `params`. (Internally expanded to the dual-clip layout, blend 0.) */
|
|
7457
|
+
setInstances(params: Float32Array): void;
|
|
7458
|
+
/** PER-INSTANCE DUAL-CLIP VAT: like setInstances, but each instance carries TWO clips that are blended,
|
|
7459
|
+
* so gait cross-fades stay smooth. `params.length` must be `8 * instanceCount` — two vec4s per instance:
|
|
7460
|
+
* A = (fromRowA, toRowA, timeOffset, fpsA), B = (fromRowB, toRowB, blendWeight, fpsB), where blendWeight
|
|
7461
|
+
* in [0,1] lerps A→B and B reuses A's timeOffset. Same per-instance VAT path as setInstances. */
|
|
7462
|
+
setInstancesBlend(params: Float32Array): void;
|
|
7463
|
+
}
|
|
7464
|
+
|
|
5083
7465
|
/** 3-component vector (position, direction, color) */
|
|
5084
7466
|
export declare interface Vec3 {
|
|
5085
7467
|
x: number;
|