@babylonjs/lite 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/index.js +512 -512
  2. package/dist/index.js.map +1 -1
  3. package/index.d.ts +829 -28
  4. package/lib/audio/analyzer.js +65 -0
  5. package/lib/audio/analyzer.js.map +1 -0
  6. package/lib/audio/audio-bus.js +38 -0
  7. package/lib/audio/audio-bus.js.map +1 -0
  8. package/lib/audio/audio-engine.js +188 -0
  9. package/lib/audio/audio-engine.js.map +1 -0
  10. package/lib/audio/audio-fetch.js +18 -0
  11. package/lib/audio/audio-fetch.js.map +1 -0
  12. package/lib/audio/audio-param.js +96 -0
  13. package/lib/audio/audio-param.js.map +1 -0
  14. package/lib/audio/audio-signal.js +46 -0
  15. package/lib/audio/audio-signal.js.map +1 -0
  16. package/lib/audio/bus.js +33 -0
  17. package/lib/audio/bus.js.map +1 -0
  18. package/lib/audio/host-types.js +2 -0
  19. package/lib/audio/host-types.js.map +1 -0
  20. package/lib/audio/index.js +12 -0
  21. package/lib/audio/index.js.map +1 -0
  22. package/lib/audio/sound-buffer.js +59 -0
  23. package/lib/audio/sound-buffer.js.map +1 -0
  24. package/lib/audio/sound-source.js +57 -0
  25. package/lib/audio/sound-source.js.map +1 -0
  26. package/lib/audio/sound-sub-graph.js +72 -0
  27. package/lib/audio/sound-sub-graph.js.map +1 -0
  28. package/lib/audio/spatial.js +466 -0
  29. package/lib/audio/spatial.js.map +1 -0
  30. package/lib/audio/static-sound.js +313 -0
  31. package/lib/audio/static-sound.js.map +1 -0
  32. package/lib/audio/stereo.js +40 -0
  33. package/lib/audio/stereo.js.map +1 -0
  34. package/lib/audio/streaming-sound.js +377 -0
  35. package/lib/audio/streaming-sound.js.map +1 -0
  36. package/lib/audio/unmute-ui.js +72 -0
  37. package/lib/audio/unmute-ui.js.map +1 -0
  38. package/lib/audio/visualizer.js +101 -0
  39. package/lib/audio/visualizer.js.map +1 -0
  40. package/lib/camera/geospatial-camera-controls.js +22 -0
  41. package/lib/camera/geospatial-camera-controls.js.map +1 -1
  42. package/lib/camera/geospatial-camera-fly.js +2 -1
  43. package/lib/camera/geospatial-camera-fly.js.map +1 -1
  44. package/lib/effect/effect-renderer.js +1 -1
  45. package/lib/effect/effect-renderer.js.map +1 -1
  46. package/lib/engine/engine.js +1 -1
  47. package/lib/index.js +15 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/light/types.js.map +1 -1
  50. package/lib/loader-gltf/animation-pointer-basecolor.js +25 -0
  51. package/lib/loader-gltf/animation-pointer-basecolor.js.map +1 -0
  52. package/lib/loader-gltf/animation-pointer-ext.js +244 -0
  53. package/lib/loader-gltf/animation-pointer-ext.js.map +1 -0
  54. package/lib/loader-gltf/animation-pointer-lights.js +46 -0
  55. package/lib/loader-gltf/animation-pointer-lights.js.map +1 -0
  56. package/lib/loader-gltf/animation-pointer.js +4 -1
  57. package/lib/loader-gltf/animation-pointer.js.map +1 -1
  58. package/lib/loader-gltf/gltf-animation.js +5 -3
  59. package/lib/loader-gltf/gltf-animation.js.map +1 -1
  60. package/lib/loader-gltf/gltf-color-normalize.js +10 -1
  61. package/lib/loader-gltf/gltf-color-normalize.js.map +1 -1
  62. package/lib/loader-gltf/gltf-feature-animation-pointer.js +67 -47
  63. package/lib/loader-gltf/gltf-feature-animation-pointer.js.map +1 -1
  64. package/lib/loader-gltf/gltf-feature-lights-punctual.js +51 -9
  65. package/lib/loader-gltf/gltf-feature-lights-punctual.js.map +1 -1
  66. package/lib/loader-gltf/gltf-feature-primitive.js +20 -0
  67. package/lib/loader-gltf/gltf-feature-primitive.js.map +1 -0
  68. package/lib/loader-gltf/gltf-feature-registry.js +25 -0
  69. package/lib/loader-gltf/gltf-feature-registry.js.map +1 -1
  70. package/lib/loader-gltf/gltf-feature-skeleton.js +18 -3
  71. package/lib/loader-gltf/gltf-feature-skeleton.js.map +1 -1
  72. package/lib/loader-gltf/gltf-interleave.js +3 -2
  73. package/lib/loader-gltf/gltf-interleave.js.map +1 -1
  74. package/lib/loader-gltf/gltf-light-pointer-state.js +18 -0
  75. package/lib/loader-gltf/gltf-light-pointer-state.js.map +1 -0
  76. package/lib/loader-gltf/gltf-parser.js +7 -1
  77. package/lib/loader-gltf/gltf-parser.js.map +1 -1
  78. package/lib/loader-gltf/gltf-pbr-builder-ext.js +1 -1
  79. package/lib/loader-gltf/gltf-pbr-builder-ext.js.map +1 -1
  80. package/lib/loader-gltf/gltf-pbr-builder.js +1 -1
  81. package/lib/loader-gltf/gltf-pbr-builder.js.map +1 -1
  82. package/lib/loader-gltf/gltf-sampler-denorm.js +20 -0
  83. package/lib/loader-gltf/gltf-sampler-denorm.js.map +1 -0
  84. package/lib/loader-gltf/gltf-sampler-desc.js +11 -2
  85. package/lib/loader-gltf/gltf-sampler-desc.js.map +1 -1
  86. package/lib/loader-gltf/gltf-uv-denorm.js +28 -0
  87. package/lib/loader-gltf/gltf-uv-denorm.js.map +1 -0
  88. package/lib/loader-gltf/load-gltf.js +15 -6
  89. package/lib/loader-gltf/load-gltf.js.map +1 -1
  90. package/lib/material/material-rebuild.js +4 -0
  91. package/lib/material/material-rebuild.js.map +1 -1
  92. package/lib/material/mesh-features.js +8 -1
  93. package/lib/material/mesh-features.js.map +1 -1
  94. package/lib/material/pbr/fragments/reflectance-fragment.js +1 -1
  95. package/lib/material/pbr/fragments/reflectance-fragment.js.map +1 -1
  96. package/lib/material/pbr/fragments/refraction-rtt-fragment.js +1 -1
  97. package/lib/material/pbr/fragments/refraction-rtt-fragment.js.map +1 -1
  98. package/lib/material/pbr/pbr-pipeline.js +7 -3
  99. package/lib/material/pbr/pbr-pipeline.js.map +1 -1
  100. package/lib/material/pbr/pbr-primitive-resolver.js +34 -0
  101. package/lib/material/pbr/pbr-primitive-resolver.js.map +1 -0
  102. package/lib/material/pbr/pbr-renderable.js +1 -1
  103. package/lib/material/pbr/pbr-renderable.js.map +1 -1
  104. package/lib/material/shader/shader-material.js +9 -5
  105. package/lib/material/shader/shader-material.js.map +1 -1
  106. package/lib/material/shader/shader-thin-instance.js +1 -1
  107. package/lib/material/shader/shader-thin-instance.js.map +1 -1
  108. package/lib/material/standard/standard-renderable.js +1 -1
  109. package/lib/material/standard/standard-renderable.js.map +1 -1
  110. package/lib/mesh/mesh-dispose.js +1 -0
  111. package/lib/mesh/mesh-dispose.js.map +1 -1
  112. package/lib/mesh/thin-instance-cull-binding.js +15 -6
  113. package/lib/mesh/thin-instance-cull-binding.js.map +1 -1
  114. package/lib/post-process/taa.js +193 -0
  115. package/lib/post-process/taa.js.map +1 -0
  116. package/lib/scene/scene-core.js +1 -0
  117. package/lib/scene/scene-core.js.map +1 -1
  118. package/lib/scene/scene-material-swap.js +2 -0
  119. package/lib/scene/scene-material-swap.js.map +1 -1
  120. package/lib/shadow/csm-shadow-task-hooks.js +67 -9
  121. package/lib/shadow/csm-shadow-task-hooks.js.map +1 -1
  122. package/lib/sprite/billboard-custom-shader.js +32 -32
  123. package/lib/sprite/billboard-custom-shader.js.map +1 -1
  124. package/lib/sprite/billboard-pipeline.js +54 -56
  125. package/lib/sprite/billboard-pipeline.js.map +1 -1
  126. package/lib/sprite/custom-shader-core.js +1 -1
  127. package/lib/sprite/custom-shader-core.js.map +1 -1
  128. package/lib/sprite/shared/sprite-atlas.js +2 -2
  129. package/lib/sprite/shared/sprite-atlas.js.map +1 -1
  130. package/lib/sprite/sprite-2d-coverage-gamma.js +58 -0
  131. package/lib/sprite/sprite-2d-coverage-gamma.js.map +1 -0
  132. package/lib/sprite/sprite-2d-uvscroll.js +39 -0
  133. package/lib/sprite/sprite-2d-uvscroll.js.map +1 -0
  134. package/lib/sprite/sprite-2d.js +6 -36
  135. package/lib/sprite/sprite-2d.js.map +1 -1
  136. package/lib/sprite/sprite-coverage-gamma-hook.js +10 -0
  137. package/lib/sprite/sprite-coverage-gamma-hook.js.map +1 -0
  138. package/lib/sprite/sprite-custom-shader.js +2 -2
  139. package/lib/sprite/sprite-custom-shader.js.map +1 -1
  140. package/lib/sprite/sprite-pipeline.js +61 -73
  141. package/lib/sprite/sprite-pipeline.js.map +1 -1
  142. package/lib/sprite/sprite-renderable.js +5 -5
  143. package/lib/sprite/sprite-renderable.js.map +1 -1
  144. package/lib/sprite/sprite-renderer.js +4 -4
  145. package/lib/sprite/sprite-renderer.js.map +1 -1
  146. package/lib/sprite/sprite-scene.js +1 -1
  147. package/lib/sprite/sprite-scene.js.map +1 -1
  148. package/lib/text/_gpu/text-pipeline.js +1 -1
  149. package/lib/text/_gpu/text-pipeline.js.map +1 -1
  150. package/lib/text/text-renderer.js +3 -1
  151. package/lib/text/text-renderer.js.map +1 -1
  152. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -668,6 +668,7 @@ export declare function attachFreeControl(camera: FreeCamera, canvas: HTMLCanvas
668
668
  * - Touch: single-finger drag = pan; two-finger pinch = zoom toward the centroid,
669
669
  * promoting to a pan once the centroid drifts ≥ 20 px.
670
670
  * - Keyboard: arrows = pan, Ctrl+arrows = tilt (pitch/yaw), +/- = zoom along the look vector.
671
+ * - Double-click (primary button): fly the centre to the point under the cursor.
671
672
  *
672
673
  * Movement uses Babylon.js's framerate-independent physics model (velocity +
673
674
  * inertial decay). Globe picking is analytic ray-sphere against the planet
@@ -699,6 +700,16 @@ export declare function attachRotationGizmoToNode(gizmo: RotationGizmo, node: Sc
699
700
  /** Attach all scale sub-gizmos to a node, or detach them with `null`. */
700
701
  export declare function attachScaleGizmoToNode(gizmo: ScaleGizmo, node: SceneNode | null): void;
701
702
 
703
+ /**
704
+ * Attaches a spatial sound/bus — or the engine's listener — to a world
705
+ * transform. The position/rotation follow the target on each
706
+ * {@link updateSpatialAudio} (or auto-update) tick.
707
+ * @param target - A `StaticSound`, `AudioBus`, or the `AudioEngine` (listener).
708
+ * @param worldTarget - The transform to follow.
709
+ * @param type - Which transform components to follow. Defaults to `"positionAndRotation"`.
710
+ */
711
+ export declare function attachSpatialTarget(target: AudioGraphHost | AudioEngine, worldTarget: SpatialTarget, type?: SpatialAttachmentType): void;
712
+
702
713
  /**
703
714
  * Attaches a manager to a sprite renderer's update hooks so its animations advance each frame.
704
715
  * @param renderer - Sprite renderer whose update loop drives the manager.
@@ -729,6 +740,132 @@ export declare function attachSpriteAnimationsToScene(scene: SceneContext, manag
729
740
  */
730
741
  export declare function attachVat(engine: EngineContext, mesh: Mesh, baked: VatBakeResult, clip?: string): VatHandle;
731
742
 
743
+ /** Options for {@link enableAnalyzer}. */
744
+ export declare interface AudioAnalyzerOptions {
745
+ /** FFT window size (a power of two, `32`–`32768`). Defaults to `2048`. */
746
+ fftSize?: number;
747
+ /** Minimum power value for the dB range, in dBFS. Defaults to `-100`. */
748
+ minDecibels?: number;
749
+ /** Maximum power value for the dB range, in dBFS. Defaults to `-30`. */
750
+ maxDecibels?: number;
751
+ /** Time-averaging constant in `[0, 1]`. Defaults to `0.8`. */
752
+ smoothing?: number;
753
+ }
754
+
755
+ /** A generic mixer bus. Pure state — drive it with the bus functions. */
756
+ export declare interface AudioBus {
757
+ /** Bus name. */
758
+ readonly name: string;
759
+
760
+ /** Options for {@link createAudioBusAsync}. */
761
+ export declare interface AudioBusOptions {
762
+ /** Initial volume. Defaults to `1`. */
763
+ volume?: number;
764
+ /** Output bus. Defaults to the engine's default main bus. */
765
+ outBus?: PrimaryAudioBus;
766
+ }
767
+
768
+ /**
769
+ * A Babylon Lite audio engine. Pure state — operate on it with the audio
770
+ * functions (`createSoundAsync`, `setMasterVolume`, `disposeAudioEngine`, …).
771
+ */
772
+ export declare interface AudioEngine {
773
+ /** Current context state. Always `"running"` for an offline context. */
774
+ readonly state: AudioEngineState;
775
+ /** The audio context's current time, in seconds. */
776
+ readonly currentTime: number;
777
+ /** Fires whenever {@link state} changes. */
778
+ readonly onStateChanged: AudioSignal<AudioEngineState>;
779
+ /** Fires on every qualifying user gesture (click), not just the first. */
780
+ readonly onUserGesture: AudioSignal<void>;
781
+
782
+ /** Options for {@link createAudioEngineAsync}. */
783
+ export declare interface AudioEngineOptions {
784
+ /**
785
+ * The audio context to use. Pass an `OfflineAudioContext` for deterministic,
786
+ * faster-than-realtime rendering (used by the audio test suite). When omitted
787
+ * a real-time `AudioContext` is created.
788
+ */
789
+ audioContext?: BaseAudioContext;
790
+ /** Master output volume. Defaults to `1`. */
791
+ volume?: number;
792
+ /** Default parameter ramp smoothing, in seconds. Defaults to `0.01`. */
793
+ parameterRampDuration?: number;
794
+ /** Auto-resume the context on user interaction (click). Defaults to `true`. */
795
+ resumeOnInteraction?: boolean;
796
+ /** Auto-resume the context if the browser pauses playback. Defaults to `true`. */
797
+ resumeOnPause?: boolean;
798
+ /** Retry interval (ms) for `resumeOnPause`. Defaults to `1000`. */
799
+ resumeOnPauseRetryInterval?: number;
800
+ }
801
+
802
+ /** Audio context state, mirroring the Web Audio `AudioContextState` plus `"interrupted"`. */
803
+ export declare type AudioEngineState = "running" | "suspended" | "closed" | "interrupted";
804
+
805
+ /** A sound, source, or bus that can carry spatial, stereo, or analyzer sub-nodes. */
806
+ export declare type AudioGraphHost = StaticSound | StreamingSound | AudioBus | AudioInputSource;
807
+
808
+ /**
809
+ * A sound fed by a live or external Web Audio input node (e.g. a microphone).
810
+ * Accepted anywhere an {@link AudioGraphHost} is — enable spatial, stereo, or
811
+ * analyzer features on it directly.
812
+ */
813
+ export declare interface AudioInputSource {
814
+ /** The source name. */
815
+ readonly name: string;
816
+
817
+ /**
818
+ * Audio parameter ramping — faithful port of Babylon.js AudioV2
819
+ * `audioUtils._GetAudioParamCurveValues` + `_WebAudioParameterComponent`,
820
+ * re-shaped to pure functions + a small pure-state wrapper.
821
+ *
822
+ * The exponential/logarithmic normalized curves are cached via lazy-init
823
+ * (never at module scope) so this module has zero import-time side effects.
824
+ * The curve math is copied verbatim from AudioV2 to preserve identical output.
825
+ */
826
+ /** Ramp shape used when changing an audio parameter (volume, pan, position…). */
827
+ export declare type AudioRampShape = "none" | "linear" | "exponential" | "logarithmic";
828
+
829
+ /**
830
+ * Lightweight event signal — Babylon Lite's tree-shakable replacement for the
831
+ * core `Observable`. Pure state + standalone-ish callback set. No module-level
832
+ * side effects: the callback set is created lazily on first `add`.
833
+ *
834
+ * Behavioural parity with the subset of `Observable` the audio engine uses:
835
+ * `add`, `addOnce`, `removeCallback`, `notifyObservers`, `clear`, `hasObservers`.
836
+ */
837
+ /** Public read surface of a signal — consumers can only subscribe. */
838
+ export declare interface AudioSignal<T> {
839
+ /** Subscribe. Returns an unsubscribe function. */
840
+ add(callback: (value: T) => void): () => void;
841
+ /** Subscribe for a single notification. Returns an unsubscribe function. */
842
+ addOnce(callback: (value: T) => void): () => void;
843
+ }
844
+
845
+ /** Visualizer state. Pure state — driven by the visualizer functions. */
846
+ export declare interface AudioVisualizer {
847
+ /** The canvas being drawn to. */
848
+ readonly canvas: HTMLCanvasElement;
849
+
850
+ /** What to draw in the visualizer. */
851
+ export declare type AudioVisualizerMode = "bars" | "waveform" | "both";
852
+
853
+ /** Options for {@link createAudioVisualizer}. */
854
+ export declare interface AudioVisualizerOptions {
855
+ /** FFT window size (a power of two). Defaults to `2048`. */
856
+ fftSize?: number;
857
+ /** Analyzer time-averaging constant in `[0, 1]`. Defaults to `0.8`. */
858
+ smoothing?: number;
859
+ /** What to draw. Defaults to `"both"`. */
860
+ mode?: AudioVisualizerMode;
861
+ /** Canvas background fill. Defaults to `"#101014"`. */
862
+ backgroundColor?: string;
863
+ /** Frequency-bar color. Defaults to `"#4fc3f7"`. */
864
+ barColor?: string;
865
+ /** Waveform line color. Defaults to `"#ffffff"`. */
866
+ waveformColor?: string;
867
+ }
868
+
732
869
  /** A single arrow-shaped gizmo that translates its attached node along one axis. */
733
870
  export declare interface AxisDragGizmo {
734
871
  /** The root node — gizmo follows its `attachedNode` by copying world translation. */
@@ -1518,6 +1655,36 @@ export declare function createAnimationTask(update: AnimationTaskUpdate, options
1518
1655
  /** Create a bare ArcRotateCamera with given params. Pure data, no scene knowledge. */
1519
1656
  export declare function createArcRotateCamera(alpha: number, beta: number, radius: number, target: Vec3): ArcRotateCamera;
1520
1657
 
1658
+ /**
1659
+ * Creates a generic mixer bus routed to another bus (defaulting to the engine's
1660
+ * default main bus). Multiple sounds/buses can be routed through a bus to mix
1661
+ * and control their combined volume.
1662
+ * @param engine - The audio engine.
1663
+ * @param name - A name for the bus.
1664
+ * @param options - Bus options.
1665
+ * @returns A promise that resolves with the ready bus.
1666
+ */
1667
+ export declare function createAudioBusAsync(engine: AudioEngine, name: string, options?: AudioBusOptions): Promise<AudioBus>;
1668
+
1669
+ /**
1670
+ * Creates and initializes an audio engine.
1671
+ * @param options - Engine options.
1672
+ * @returns A promise that resolves with the ready-to-use engine.
1673
+ */
1674
+ export declare function createAudioEngineAsync(options?: AudioEngineOptions): Promise<AudioEngine>;
1675
+
1676
+ /**
1677
+ * Creates a real-time visualizer that taps the host's analyzer and draws to the
1678
+ * given canvas. Enables the analyzer on the host if it is not already enabled.
1679
+ * Call {@link startAudioVisualizer} to begin the animation loop.
1680
+ * @param host - A `StaticSound`, `StreamingSound`, `AudioBus`, or input source.
1681
+ * @param canvas - The destination 2D canvas.
1682
+ * @param options - Visualizer options.
1683
+ * @returns The visualizer handle; dispose it with {@link disposeAudioVisualizer}.
1684
+ * @throws If a 2D context cannot be obtained from the canvas.
1685
+ */
1686
+ export declare function createAudioVisualizer(host: AudioGraphHost, canvas: HTMLCanvasElement, options?: AudioVisualizerOptions): AudioVisualizer;
1687
+
1521
1688
  /** Build an axis-drag gizmo and attach it to the given utility layer. Call
1522
1689
  * `attachAxisDragGizmoToNode` to bind it to a node so it follows + drives it. */
1523
1690
  export declare function createAxisDragGizmo(engine: EngineContext, layer: UtilityLayer, options: AxisDragGizmoOptions): AxisDragGizmo;
@@ -1961,6 +2128,17 @@ export declare function createMeshFromCsg2(engine: EngineContext, solid: Csg2Sol
1961
2128
  * No material is assigned — the caller must set mesh.material before adding to scene. */
1962
2129
  export declare function createMeshFromData(engine: EngineContext, name: string, positions: Float32Array, normals: Float32Array, indices: Uint32Array, uvs?: Float32Array, uvs2?: Float32Array, tangents?: Float32Array, colors?: Float32Array): Mesh;
1963
2130
 
2131
+ /**
2132
+ * Requests microphone access and wraps the resulting stream as a sound source.
2133
+ * The source does not auto-connect to the main bus by default (to avoid
2134
+ * feedback); attach an analyzer or set an `outBus` to use it.
2135
+ * @param engine - The audio engine.
2136
+ * @param options - Source options.
2137
+ * @returns A promise that resolves with the ready microphone source.
2138
+ * @throws If microphone access is denied or unavailable.
2139
+ */
2140
+ export declare function createMicrophoneSoundSourceAsync(engine: AudioEngine, options?: SoundSourceOptions): Promise<AudioInputSource>;
2141
+
1964
2142
  /** Create morph target GPU data from parsed glTF targets.
1965
2143
  * @param engine - Engine context (provides GPU device)
1966
2144
  * @param targets - Array of `{positions, normals}` deltas per target
@@ -2264,6 +2442,35 @@ export declare function createShaderNormalMaterialView(source: ShaderMaterial, c
2264
2442
  * @returns A bilinear-sampled `Texture2D` backed by a tiny GPU texture. */
2265
2443
  export declare function createSolidTexture2D(engine: EngineContext, r: number, g: number, b: number, a?: number): Texture2D;
2266
2444
 
2445
+ /**
2446
+ * Creates a buffer-backed sound, routed to the given output bus (or the
2447
+ * engine's default main bus).
2448
+ * @param engine - The audio engine.
2449
+ * @param source - An `AudioBuffer`, `ArrayBuffer`, URL, URL list, or `SoundBuffer`.
2450
+ * @param options - Sound options.
2451
+ * @returns A promise that resolves with the ready sound.
2452
+ */
2453
+ export declare function createSoundAsync(engine: AudioEngine, source: SoundSource, options?: StaticSoundOptions): Promise<StaticSound>;
2454
+
2455
+ /**
2456
+ * Loads and decodes audio into a reusable {@link SoundBuffer}.
2457
+ * @param engine - The audio engine.
2458
+ * @param source - An `AudioBuffer`, `ArrayBuffer`, URL, or URL list.
2459
+ * @param options - Decode options.
2460
+ * @returns A promise that resolves with the decoded buffer.
2461
+ */
2462
+ export declare function createSoundBufferAsync(engine: AudioEngine, source: SoundSource, options?: SoundBufferOptions): Promise<SoundBuffer>;
2463
+
2464
+ /**
2465
+ * Wraps an arbitrary Web Audio node as a sound source, routed to the given
2466
+ * output bus (or the engine's default main bus).
2467
+ * @param engine - The audio engine.
2468
+ * @param node - The input node to wrap (its output is routed through the graph).
2469
+ * @param options - Source options.
2470
+ * @returns A promise that resolves with the ready source.
2471
+ */
2472
+ export declare function createSoundSourceAsync(engine: AudioEngine, node: AudioNode, options?: SoundSourceOptions): Promise<AudioInputSource>;
2473
+
2267
2474
  /** Create a sphere mesh. Caller must assign material. */
2268
2475
  export declare function createSphere(engine: EngineContext, options?: SphereOptions): Mesh;
2269
2476
 
@@ -2337,6 +2544,16 @@ export declare function createStandardMaterial(): StandardMaterialProps;
2337
2544
  * The view references the source; material state is never copied. */
2338
2545
  export declare function createStandardNoColorMaterialView(source: StandardMaterialProps): MaterialView;
2339
2546
 
2547
+ /**
2548
+ * Creates a streaming, media-element-backed sound routed to the given output bus
2549
+ * (or the engine's default main bus). Requires a real-time `AudioContext`.
2550
+ * @param engine - The audio engine.
2551
+ * @param source - A URL, a list of candidate URLs, or an `HTMLMediaElement`.
2552
+ * @param options - Streaming sound options.
2553
+ * @returns A promise that resolves with the ready sound.
2554
+ */
2555
+ export declare function createStreamingSoundAsync(engine: AudioEngine, source: StreamingSoundSource, options?: StreamingSoundOptions): Promise<StreamingSound>;
2556
+
2340
2557
  /**
2341
2558
  * Create an auxiliary rendering surface bound to an existing engine. The surface
2342
2559
  * configures its own `GPUCanvasContext` against `engine._device` and is appended to
@@ -2353,6 +2570,15 @@ export declare function createStandardNoColorMaterialView(source: StandardMateri
2353
2570
  */
2354
2571
  export declare function createSurface(engine: EngineContext, canvas: RenderCanvas, options?: SurfaceOptions): SurfaceContext;
2355
2572
 
2573
+ /**
2574
+ * Create a Temporal Anti-Aliasing post-process task.
2575
+ * @param config - Source texture + source render task, blend factor, sample count.
2576
+ * @param engine - The owning engine.
2577
+ * @param scene - Optional owning scene.
2578
+ * @returns The TAA post-process task. Add it at the end of the frame-graph chain.
2579
+ */
2580
+ export declare function createTaaPostProcessTask(config: TaaPostProcessTaskConfig, engine: EngineContext, scene?: SceneContext): TaaPostProcessTask;
2581
+
2356
2582
  /** Create a TextData bound to `storage`. If `runs` is omitted the TextData starts empty;
2357
2583
  * runs can be appended later via `updateTextData({ update: "addRun", … })`. */
2358
2584
  export declare function createTextData(storage: GlyphStorage, runs?: readonly GlyphRun[]): TextData;
@@ -2428,6 +2654,15 @@ export declare function createUniformEffectRenderTask(config: UniformEffectRende
2428
2654
  */
2429
2655
  export declare function createUniformEffectWrapper(engine: EngineContext, options: UniformEffectWrapperOptions): UniformEffectWrapper;
2430
2656
 
2657
+ /**
2658
+ * Creates and mounts the unmute button. It is shown while the engine's context
2659
+ * is not `"running"` and hidden once it resumes; clicking it unlocks the engine.
2660
+ * @param engine - The audio engine to unlock.
2661
+ * @param options - UI options (parent element).
2662
+ * @returns The UI handle; dispose it with {@link disposeUnmuteUI}.
2663
+ */
2664
+ export declare function createUnmuteUI(engine: AudioEngine, options?: UnmuteUIOptions): UnmuteUI;
2665
+
2431
2666
  /** Create a utility layer attached to the given engine + main scene.
2432
2667
  * The returned `scene` shares the main scene's camera so view + projection
2433
2668
  * remain in sync without manual mirroring. The utility scene renders with a
@@ -2636,6 +2871,13 @@ export declare interface DepthOfFieldPostProcessTaskConfig extends PostProcessTa
2636
2871
  depthNotNormalized?: boolean;
2637
2872
  }
2638
2873
 
2874
+ /**
2875
+ * Detaches a spatial sound/bus — or the engine's listener — from its world
2876
+ * transform.
2877
+ * @param target - A `StaticSound`, `AudioBus`, or the `AudioEngine` (listener).
2878
+ */
2879
+ export declare function detachSpatialTarget(target: AudioGraphHost | AudioEngine): void;
2880
+
2639
2881
  export declare interface DirectionalLight extends LightBase {
2640
2882
  readonly lightType: "directional";
2641
2883
  direction: ObservableVec3;
@@ -2653,6 +2895,23 @@ export declare interface DiscOptions {
2653
2895
  arc?: number;
2654
2896
  }
2655
2897
 
2898
+ /** Disposes a generic bus, releasing its sub-graph. */
2899
+ export declare function disposeAudioBus(bus: AudioBus): void;
2900
+
2901
+ /**
2902
+ * Disposes the audio engine: stops all sounds, tears down global hooks, and
2903
+ * closes the (non-offline) audio context.
2904
+ * @param engine - The audio engine to dispose.
2905
+ */
2906
+ export declare function disposeAudioEngine(engine: AudioEngine): void;
2907
+
2908
+ /**
2909
+ * Stops the render loop and releases the visualizer. The underlying analyzer tap
2910
+ * stays on the host (dispose the host to release it).
2911
+ * @param viz - The visualizer handle.
2912
+ */
2913
+ export declare function disposeAudioVisualizer(viz: AudioVisualizer): void;
2914
+
2656
2915
  /** Dispose the gizmo: remove meshes, unregister pointer-drag, drop materials. */
2657
2916
  export declare function disposeAxisDragGizmo(gizmo: AxisDragGizmo, layer: UtilityLayer): void;
2658
2917
 
@@ -2733,6 +2992,16 @@ export declare function disposeScaleGizmo(gizmo: ScaleGizmo, layer: UtilityLayer
2733
2992
  /** Release all GPU resources owned by this scene. */
2734
2993
  export declare function disposeScene(scene: SceneContext): void;
2735
2994
 
2995
+ /** Disposes the sound, stopping playback and releasing its graph. */
2996
+ export declare function disposeSound(sound: StaticSound): void;
2997
+
2998
+ /**
2999
+ * Disposes a sound source, stopping any microphone tracks and releasing its
3000
+ * graph.
3001
+ * @param source - The sound source.
3002
+ */
3003
+ export declare function disposeSoundSource(source: AudioInputSource): void;
3004
+
2736
3005
  /**
2737
3006
  * Detaches a binding created by {@link attachSpriteAnimationsToScene} or
2738
3007
  * {@link attachSpriteAnimationsToRenderer}. Safe to call more than once.
@@ -2748,6 +3017,9 @@ export declare function disposeSpriteAnimationBinding(binding: SpriteAnimationBi
2748
3017
  */
2749
3018
  export declare function disposeSpriteRenderer(sr: SpriteRenderer): void;
2750
3019
 
3020
+ /** Disposes the sound, stopping playback and releasing its graph and preloaded instances. */
3021
+ export declare function disposeStreamingSound(sound: StreamingSound): void;
3022
+
2751
3023
  /** Remove and unconfigure an auxiliary surface from its engine. Rendering contexts
2752
3024
  * registered on this surface are dropped from its list but not disposed — call their
2753
3025
  * own disposers (e.g. `disposeScene`) separately.
@@ -2770,6 +3042,12 @@ export declare function disposeTextRenderer(tr: TextRenderer): void;
2770
3042
  /** Destroy the uniform buffer and clear cached GPU objects owned by the uniform effect wrapper. */
2771
3043
  export declare function disposeUniformEffectWrapper(wrapper: UniformEffectWrapper): void;
2772
3044
 
3045
+ /**
3046
+ * Removes the unmute button and its styles and unsubscribes from engine state.
3047
+ * @param ui - The UI handle.
3048
+ */
3049
+ export declare function disposeUnmuteUI(ui: UnmuteUI): void;
3050
+
2773
3051
  /** Dispose the utility layer's underlying scene. Idempotent. */
2774
3052
  export declare function disposeUtilityLayer(utility: UtilityLayer): void;
2775
3053
 
@@ -2817,6 +3095,9 @@ export declare interface EffectBindingLayout {
2817
3095
  visibility?: GPUShaderStageFlags;
2818
3096
  uniformByteLength?: number;
2819
3097
  textureSampleType?: GPUTextureSampleType;
3098
+ /** Texture view dimension for a `texture` binding (default `"2d"`). Set `"2d-array"`/`"cube"`/… so a
3099
+ * fullscreen effect can sample an array/cube texture (e.g. the CSM cascade depth array). */
3100
+ viewDimension?: GPUTextureViewDimension;
2820
3101
  samplerType?: GPUSamplerBindingType;
2821
3102
  textureBinding?: string | number;
2822
3103
  }
@@ -2879,6 +3160,15 @@ export declare interface EffectWrapperOptions {
2879
3160
  blend?: GPUBlendState;
2880
3161
  }
2881
3162
 
3163
+ /**
3164
+ * Enables (or reconfigures) frequency/amplitude analysis on a sound or bus,
3165
+ * building the analyzer tap on first use. Pulls the analyzer module only when
3166
+ * called.
3167
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
3168
+ * @param options - Analyzer options (fftSize, dB range, smoothing).
3169
+ */
3170
+ export declare function enableAnalyzer(host: AudioGraphHost, options?: AudioAnalyzerOptions): void;
3171
+
2882
3172
  /** Enable advanced animation blending for a manager. Kept opt-in so manual-only weights do not pay for skeletal mixing code. */
2883
3173
  export declare function enableAnimationBlending(manager: AnimationManager): void;
2884
3174
 
@@ -2993,6 +3283,22 @@ export declare function enableRenderTaskTransmission(task: RenderTask, engine: E
2993
3283
  /** Enable scene-color transmission for every render task currently registered in a scene. PBR materials are marked for linear transmission, and a trailing image-processing task is appended when needed. */
2994
3284
  export declare function enableSceneTransmission(scene: SceneContext, engine: EngineContext): void;
2995
3285
 
3286
+ /**
3287
+ * Enables (or reconfigures) 3D spatial audio on a sound or bus, building the
3288
+ * panner sub-node on first use. Pulls the spatial module only when called.
3289
+ * @param host - A `StaticSound` or `AudioBus`.
3290
+ * @param options - Spatial options (position, distance model, cone, attach, …).
3291
+ */
3292
+ export declare function enableSpatial(host: AudioGraphHost, options?: SpatialSoundOptions): void;
3293
+
3294
+ /**
3295
+ * Enables (or reconfigures) stereo panning on a sound or bus, building the
3296
+ * stereo sub-node on first use. Pulls the stereo module only when called.
3297
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
3298
+ * @param options - Stereo options (pan).
3299
+ */
3300
+ export declare function enableStereo(host: AudioGraphHost, options?: StereoSoundOptions): void;
3301
+
2996
3302
  /** Enable or disable GPU frustum culling for an existing thin-instanced mesh.
2997
3303
  *
2998
3304
  * Call this after `setThinInstances()`/`addThinInstance()` and before `registerScene()`.
@@ -3447,6 +3753,14 @@ export declare interface GeospatialControlOptions {
3447
3753
  zoomToCursor?: boolean;
3448
3754
  /** Enable simple sphere collision so the camera cannot dip below the surface. Default false. */
3449
3755
  checkCollisions?: boolean;
3756
+ /** Duration (ms) of the fly-to animation triggered by a primary-pointer double tap. Default 1000. */
3757
+ doubleTapAnimationDurationMs?: number;
3758
+ /**
3759
+ * Optional easing applied to the double-tap fly-to animation (normalized progress `g` ∈ [0,1]).
3760
+ * A single function instance can be created once and reused across double taps. Default null
3761
+ * (uses the fly module's cubic ease-in-out).
3762
+ */
3763
+ doubleTapEasingFunction?: ((g: number) => number) | null;
3450
3764
  }
3451
3765
 
3452
3766
  /** Options for {@link flyGeospatialCameraToAsync}. Omitted target fields keep their current value. */
@@ -3463,6 +3777,8 @@ export declare interface GeospatialFlyOptions {
3463
3777
  durationMs?: number;
3464
3778
  /** Parabolic "hop" height scale for the centre animation (0 = none). */
3465
3779
  centerHopScale?: number;
3780
+ /** Easing applied to the normalized progress `g` ∈ [0,1]. Default cubic ease-in-out. */
3781
+ ease?: (g: number) => number;
3466
3782
  }
3467
3783
 
3468
3784
  /** Pitch/yaw/radius bounds for a {@link GeospatialCamera}.
@@ -3533,6 +3849,24 @@ export declare function getBillboardSpriteHandleIndex(handle: BillboardSpriteHan
3533
3849
  * When several joints share a name, the first in joint order is returned. */
3534
3850
  export declare function getBoneByName(skeleton: Skeleton, name: string): Bone | undefined;
3535
3851
 
3852
+ /**
3853
+ * Writes the current frequency-domain data as unsigned bytes into `out`,
3854
+ * building the analyzer tap on first use. `out` should be sized to the
3855
+ * analyzer's `frequencyBinCount` (`fftSize / 2`).
3856
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
3857
+ * @param out - Destination buffer; values are written in place.
3858
+ */
3859
+ export declare function getByteFrequencyData(host: AudioGraphHost, out: Uint8Array): void;
3860
+
3861
+ /**
3862
+ * Writes the current time-domain (waveform) data as unsigned bytes into `out`,
3863
+ * building the analyzer tap on first use. Each sample is centered on `128`.
3864
+ * `out` should be sized to the analyzer's `fftSize`.
3865
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
3866
+ * @param out - Destination buffer; values are written in place.
3867
+ */
3868
+ export declare function getByteTimeDomainData(host: AudioGraphHost, out: Uint8Array): void;
3869
+
3536
3870
  /** Get the world-space position of a camera. */
3537
3871
  export declare function getCameraPosition(camera: Camera): Vec3;
3538
3872
 
@@ -3559,15 +3893,36 @@ export declare function getEffectiveAspectRatio(camera: Camera | null | undefine
3559
3893
  */
3560
3894
  export declare function getEffectivePitchMax(limits: GeospatialLimits, currentRadius: number): number;
3561
3895
 
3896
+ /**
3897
+ * Writes the current frequency-domain data as floats (in dBFS) into `out`,
3898
+ * building the analyzer tap on first use. `out` should be sized to the
3899
+ * analyzer's `frequencyBinCount` (`fftSize / 2`).
3900
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
3901
+ * @param out - Destination buffer; values are written in place.
3902
+ */
3903
+ export declare function getFloatFrequencyData(host: AudioGraphHost, out: Float32Array): void;
3904
+
3562
3905
  /** Read the current floating-origin offset from a scene as a `Vec3`. The
3563
3906
  * offset is the active camera's world position. Returns the zero vector
3564
3907
  * when no camera is set (typical headless/precompute case). For non-LWR
3565
3908
  * engines this module is not imported, so the function is unreachable. */
3566
3909
  export declare function getFloatingOriginOffset(scene: SceneContext): Vec3;
3567
3910
 
3911
+ /**
3912
+ * Writes the current time-domain (waveform) data as floats in `[-1, 1]` into
3913
+ * `out`, building the analyzer tap on first use. `out` should be sized to the
3914
+ * analyzer's `fftSize`.
3915
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
3916
+ * @param out - Destination buffer; values are written in place.
3917
+ */
3918
+ export declare function getFloatTimeDomainData(host: AudioGraphHost, out: Float32Array): void;
3919
+
3568
3920
  /** Get the scene's frame graph. Always non-null — created in `createSceneContext`. */
3569
3921
  export declare function getFrameGraph(scene: SceneContext): FrameGraph;
3570
3922
 
3923
+ /** The master output volume. */
3924
+ export declare function getMasterVolume(engine: AudioEngine): number;
3925
+
3571
3926
  /** Get the current seed used by Recast's randomized queries. */
3572
3927
  export declare function getNavigationRandomSeed(plugin: NavigationPlugin): number;
3573
3928
 
@@ -4307,6 +4662,11 @@ export declare function loadSPZ(scene: SceneContext, url: string): Promise<Gauss
4307
4662
  * @returns A promise resolving to the uploaded `Texture2D`. */
4308
4663
  export declare function loadTexture2D(engine: EngineContext, url: string, opts?: Texture2DOptions): Promise<Texture2D>;
4309
4664
 
4665
+ /** A main audio bus. Sounds route here by default. Pure state — drive it with the bus functions. */
4666
+ export declare interface MainBus {
4667
+ /** Bus name. */
4668
+ readonly name: string;
4669
+
4310
4670
  /** Force the container's GPU light state to re-upload next frame. Call after mutating a light's
4311
4671
  * position / range / intensity / diffuse in place (e.g. animated lights such as drifting fireflies),
4312
4672
  * since those edits don't bump the container version on their own. */
@@ -4978,6 +5338,12 @@ export declare interface Pass {
4978
5338
  /** Pause playback of an animation group. */
4979
5339
  export declare function pauseAnimation(group: AnimationGroup): void;
4980
5340
 
5341
+ /** Pauses all of the sound's instances. */
5342
+ export declare function pauseSound(sound: StaticSound): void;
5343
+
5344
+ /** Pauses all of the sound's instances. */
5345
+ export declare function pauseStreamingSound(sound: StreamingSound): void;
5346
+
4981
5347
  /** User-facing properties for a physically based (metallic-roughness) material.
4982
5348
  * Create one manually via `createPbrMaterial()` or let `loadGltf()` build it.
4983
5349
  * Optional sub-feature objects (clearcoat, sheen, anisotropy, subsurface) are
@@ -5649,6 +6015,14 @@ export declare function playBillboardSpriteAnimation(manager: SpriteAnimationMan
5649
6015
  */
5650
6016
  export declare function playBillboardSpriteIndexAnimation(manager: SpriteAnimationManager, system: BillboardSpriteSystem, index: number, from: number, to: number, loop: boolean, delayMs: number, options?: PlaySpriteAnimationOptions): SpriteFrameAnimation;
5651
6017
 
6018
+ /**
6019
+ * Plays the sound. Spawns a new instance per call (subject to `maxInstances`).
6020
+ * A paused sound is resumed instead.
6021
+ * @param sound - The sound to play.
6022
+ * @param options - Per-play overrides.
6023
+ */
6024
+ export declare function playSound(sound: StaticSound, options?: StaticSoundPlayOptions): void;
6025
+
5652
6026
  /**
5653
6027
  * Plays a frame animation on a 2D sprite addressed by its stable handle.
5654
6028
  * The handle is resolved each tick, so the animation survives swap-remove reindexing.
@@ -5683,6 +6057,15 @@ export declare interface PlaySpriteAnimationOptions {
5683
6057
  /** Replay an animation; omit options to keep callbacks/removal, pass options to overwrite them, or `{}` to clear them. */
5684
6058
  export declare function playSpriteFrameAnimation(animation: SpriteFrameAnimation, from?: number, to?: number, loop?: boolean, delayMs?: number, options?: PlaySpriteAnimationOptions): void;
5685
6059
 
6060
+ /**
6061
+ * Plays the streaming sound. Reuses a preloaded instance when available,
6062
+ * otherwise spawns a new one (subject to `maxInstances`). A paused sound is
6063
+ * resumed instead.
6064
+ * @param sound - The sound to play.
6065
+ * @param options - Per-play overrides.
6066
+ */
6067
+ export declare function playStreamingSound(sound: StreamingSound, options?: StreamingSoundPlayOptions): void;
6068
+
5686
6069
  /** A texture + sampler pair contributed by a plugin. `texture`/`sampler` are the
5687
6070
  * WGSL variable names used by the plugin's custom code; the engine wires up the
5688
6071
  * GPU bindings in declaration order from {@link MaterialPlugin.bindTextures}. */
@@ -5866,12 +6249,21 @@ declare interface PostProcessVec2_2 {
5866
6249
  y: number;
5867
6250
  }
5868
6251
 
6252
+ /** Preloads a single instance of the sound and resolves once it can play through. */
6253
+ export declare function preloadStreamingInstanceAsync(sound: StreamingSound): Promise<void>;
6254
+
6255
+ /** Preloads the given number of instances and resolves once all can play through. */
6256
+ export declare function preloadStreamingInstancesAsync(sound: StreamingSound, count: number): Promise<void>;
6257
+
5869
6258
  /** Something that runs before the main render pass (shadow maps, compute, etc.). */
5870
6259
  export declare interface PrePassRenderable {
5871
6260
  /** Execute pre-pass work (e.g., render shadow depth map + blur). Returns the number of GPU draw calls issued. */
5872
6261
  execute(encoder: GPUCommandEncoder, engine: EngineContext): number;
5873
6262
  }
5874
6263
 
6264
+ /** A bus that sounds or other buses can output to (the engine main bus or a generic {@link AudioBus}). */
6265
+ export declare type PrimaryAudioBus = AudioBus | MainBus;
6266
+
5875
6267
  /** A reusable, target-independent set of compiled property tracks with a total duration. */
5876
6268
  export declare interface PropertyAnimationClip {
5877
6269
  readonly name: string;
@@ -5942,6 +6334,14 @@ export declare function quatFromLookDirectionRH(forward: Vec3, up: Vec3): Quat;
5942
6334
  */
5943
6335
  export declare function quatFromRotationMatrix(matrix: Mat4): Quat;
5944
6336
 
6337
+ /** Options for ramping an audio parameter's value. */
6338
+ export declare interface RampOptions {
6339
+ /** Ramp time, in seconds. Clamped to at least the engine's `parameterRampDuration`. */
6340
+ duration?: number;
6341
+ /** Ramp shape. Defaults to `"linear"`. */
6342
+ shape?: AudioRampShape;
6343
+ }
6344
+
5945
6345
  /** A ray defined by origin, direction, and length. */
5946
6346
  declare interface Ray {
5947
6347
  origin: [number, number, number];
@@ -6175,6 +6575,14 @@ export declare interface Renderable {
6175
6575
  bind(engine: EngineContext, target: RenderTargetSignature): DrawBinding;
6176
6576
  }
6177
6577
 
6578
+ /**
6579
+ * Draws a single visualizer frame from the current analyzer data. Safe to call
6580
+ * directly (e.g. from a custom loop or a test) without starting the built-in
6581
+ * animation loop.
6582
+ * @param viz - The visualizer handle.
6583
+ */
6584
+ export declare function renderAudioVisualizerFrame(viz: AudioVisualizer): void;
6585
+
6178
6586
  /**
6179
6587
  * A surface Babylon Lite can render into. Either a DOM canvas (main thread) or an
6180
6588
  * `OffscreenCanvas` (e.g. one transferred to a Web Worker via
@@ -6384,6 +6792,12 @@ export declare function resizeSurface(surface: SurfaceContext): void;
6384
6792
  * Babylon viewport y is normalized from the bottom; WebGPU viewport/scissor y is from the top. */
6385
6793
  export declare function resolveCameraViewport(camera: Camera | null | undefined, targetWidth: number, targetHeight: number): PixelViewport;
6386
6794
 
6795
+ /** Resumes a paused sound. */
6796
+ export declare function resumeSound(sound: StaticSound, options?: StaticSoundPlayOptions): void;
6797
+
6798
+ /** Resumes a paused streaming sound. */
6799
+ export declare function resumeStreamingSound(sound: StreamingSound, options?: StreamingSoundPlayOptions): void;
6800
+
6387
6801
  /** Options for `createRibbonData`: a set of parallel paths joined into a strip. */
6388
6802
  export declare interface RibbonOptions {
6389
6803
  pathArray: Vec3[][];
@@ -6599,6 +7013,9 @@ export declare function setBoneScaling(skeleton: Skeleton, bone: Bone, x: number
6599
7013
  * so the bone returns to its animated / rest scale. */
6600
7014
  export declare function setBoneVisible(skeleton: Skeleton, bone: Bone, visible: boolean): void;
6601
7015
 
7016
+ /** Sets a bus's output volume, optionally ramping. Works on a generic bus or the main bus. */
7017
+ export declare function setBusVolume(bus: PrimaryAudioBus, value: number, options?: RampOptions): void;
7018
+
6602
7019
  /**
6603
7020
  * Configure orbit/zoom limits on an ArcRotateCamera. This is fully opt-in and
6604
7021
  * self-contained: cameras that never call it pay zero cost and bundle no clamping
@@ -6714,6 +7131,14 @@ export declare function setHierarchyInstanceMatrix(pool: HierarchyInstancePool,
6714
7131
  * modules it pulls). Call before the first KHR_texture_basisu texture loads. */
6715
7132
  export declare function setKtx2DecoderUrl(url: string, wasmUrls?: Record<string, Record<string, string>>): void;
6716
7133
 
7134
+ /**
7135
+ * Sets the master output volume, optionally ramping to the new value.
7136
+ * @param engine - The audio engine.
7137
+ * @param value - Target volume (1 = unchanged).
7138
+ * @param options - Optional ramp shape/duration.
7139
+ */
7140
+ export declare function setMasterVolume(engine: AudioEngine, value: number, options?: RampOptions): void;
7141
+
6717
7142
  /** Raise (or lower) the maximum number of scene lights in the shared lights UBO.
6718
7143
  * Must be called BEFORE scene pipelines are compiled — existing pipelines
6719
7144
  * and UBOs bake the cap into their WGSL/layout. */
@@ -6950,6 +7375,75 @@ export declare function setShaderVector3(material: ShaderMaterial, name: string,
6950
7375
  /** Register scene-owned shadow caster inputs for a generator. */
6951
7376
  export declare function setShadowTaskCasterMeshes(shadowGenerator: ShadowGenerator, casterMeshes: readonly Mesh[]): void;
6952
7377
 
7378
+ /**
7379
+ * Sets the source volume, optionally ramping.
7380
+ * @param source - The sound source.
7381
+ * @param value - Linear gain (`1` = unity).
7382
+ * @param options - Optional ramp options.
7383
+ */
7384
+ export declare function setSoundSourceVolume(source: AudioInputSource, value: number, options?: RampOptions): void;
7385
+
7386
+ /** Sets the sound's output volume, optionally ramping. */
7387
+ export declare function setSoundVolume(sound: StaticSound, value: number, options?: RampOptions): void;
7388
+
7389
+ /**
7390
+ * Toggles a `requestAnimationFrame`-driven loop that calls
7391
+ * {@link updateSpatialAudio} automatically.
7392
+ * @param engine - The audio engine.
7393
+ * @param enabled - Whether to run the auto-update loop.
7394
+ * @param minUpdateMs - Minimum time between updates, in milliseconds. Defaults to `0`.
7395
+ */
7396
+ export declare function setSpatialAutoUpdate(engine: AudioEngine, enabled: boolean, minUpdateMs?: number): void;
7397
+
7398
+ /**
7399
+ * Configures the spatial listener (the "ears"). Builds it on first use.
7400
+ * @param engine - The audio engine.
7401
+ * @param options - Listener options.
7402
+ */
7403
+ export declare function setSpatialListener(engine: AudioEngine, options?: SpatialListenerOptions): void;
7404
+
7405
+ /** Sets the listener world position, building the listener on first use. */
7406
+ export declare function setSpatialListenerPosition(engine: AudioEngine, position: Vec3): void;
7407
+
7408
+ /**
7409
+ * Sets the facing orientation of a spatial sound/bus.
7410
+ * @param host - A `StaticSound` or `AudioBus`.
7411
+ * @param orientation - Facing direction.
7412
+ */
7413
+ export declare function setSpatialOrientation(host: AudioGraphHost, orientation: Vec3): void;
7414
+
7415
+ /**
7416
+ * Sets the world position of a spatial sound/bus, building the panner sub-node
7417
+ * on first use.
7418
+ * @param host - A `StaticSound` or `AudioBus`.
7419
+ * @param position - World-space position.
7420
+ */
7421
+ export declare function setSpatialPosition(host: AudioGraphHost, position: Vec3): void;
7422
+
7423
+ /**
7424
+ * Enable (or update) coverage gamma on a sprite layer for anti-aliased glyph "stem darkening".
7425
+ *
7426
+ * Coverage gamma raises the layer's sampled texture alpha to `1/coverageGamma` in the fragment
7427
+ * shader, thickening anti-aliased edges to mimic the gamma-space blending of native text
7428
+ * rasterizers (DirectWrite/CoreText). Intended for glyph-atlas (bitmap text) layers drawn into an
7429
+ * sRGB (linear-blended) surface, where correct linear AA otherwise makes text look lighter/thinner.
7430
+ * Values `> 1` thicken; `1` is a no-op (identity) and disables the effect. Non-finite or non-positive
7431
+ * values (`0`, negatives, `NaN`, `Infinity`) are also treated as disabled (the base shader is used).
7432
+ *
7433
+ * **Opt-in & tree-shakable:** importing this function is what pulls the coverage-gamma shader
7434
+ * permutation and UBO writer into the bundle. Sprite scenes that never call it ship zero gamma
7435
+ * bytes. The gamma value is stored internally on the layer and is *only* settable through this
7436
+ * function — there is no create-time option and no public field, so a value can never be written
7437
+ * that the renderer would silently ignore. Call it before `createSpriteRenderer` /
7438
+ * `addDepthHostedSpriteLayer` so the layer's first pipeline is built with the gamma permutation;
7439
+ * calling it later is also safe — the renderer re-fetches the pipeline each frame and rebuilds it
7440
+ * with the gamma permutation on the next frame.
7441
+ *
7442
+ * @param layer - The sprite layer to configure.
7443
+ * @param gamma - Coverage gamma. Typical text values are ~1.8–2.2; `1` disables the effect.
7444
+ */
7445
+ export declare function setSprite2DCoverageGamma(layer: Sprite2DLayer, gamma: number): void;
7446
+
6953
7447
  /**
6954
7448
  * Sets the atlas frame of the sprite referenced by `handle`.
6955
7449
  * @param handle - Handle of the sprite to update.
@@ -6975,12 +7469,19 @@ export declare function setSprite2DFrameIndex(layer: Sprite2DLayer, index: numbe
6975
7469
  export declare function setSprite2DShaderParams(layer: Sprite2DLayer, params: readonly [number, number, number, number]): void;
6976
7470
 
6977
7471
  /**
6978
- * Set the per-sprite UV scroll offset for one sprite of a `uvScroll` layer (live). The two floats
6979
- * are added to the sprite's sampled UV in the vertex stage — driving parallax / infinite-scroll
6980
- * backgrounds without re-uploading texture coordinates. Marks only this sprite's range dirty.
7472
+ * Set (and enable) the per-sprite UV scroll offset for one sprite of `layer`. The two floats are
7473
+ * added to the sprite's sampled UV in the vertex stage — driving parallax / infinite-scroll
7474
+ * backgrounds without re-uploading texture coordinates.
6981
7475
  *
6982
- * Throws if the layer was not created with `Sprite2DLayerOptions.uvScroll: true` (non-scroll layers
6983
- * carry no uvOffset slot) or if `index` is out of range.
7476
+ * **Opt-in & tree-shakable:** importing this function is what pulls the uvScroll widening into the
7477
+ * bundle. The **first** call on a layer enables scroll: it widens the layer's instance layout by
7478
+ * two floats per sprite (re-striding existing sprites once) and flips it to the wide layout;
7479
+ * subsequent calls just write the offset. There is no create-time option — a layer is always
7480
+ * created narrow and opts into scroll the first time this setter is used.
7481
+ *
7482
+ * @param layer - The sprite layer to scroll.
7483
+ * @param index - Index of the sprite within the layer.
7484
+ * @param uvOffset - The UV offset `[u, v]` added to the sprite's sampled UV.
6984
7485
  */
6985
7486
  export declare function setSprite2DUvOffset(layer: Sprite2DLayer, index: number, uvOffset: readonly [number, number]): void;
6986
7487
 
@@ -6996,6 +7497,18 @@ export declare function setSprite2DUvOffset(layer: Sprite2DLayer, index: number,
6996
7497
  */
6997
7498
  export declare function setSpriteRendererTarget(sr: SpriteRenderer, target: Texture2D | null): void;
6998
7499
 
7500
+ /**
7501
+ * Sets the stereo pan of a sound or bus, building the stereo sub-node on first
7502
+ * use.
7503
+ * @param host - A `StaticSound`, `StreamingSound`, or `AudioBus`.
7504
+ * @param pan - Pan in the range `[-1, 1]` (`-1` = full left, `1` = full right).
7505
+ * @param options - Optional ramp options for a smooth transition.
7506
+ */
7507
+ export declare function setStereoPan(host: AudioGraphHost, pan: number, options?: RampOptions): void;
7508
+
7509
+ /** Sets the sound's output volume, optionally ramping. */
7510
+ export declare function setStreamingSoundVolume(sound: StreamingSound, value: number, options?: RampOptions): void;
7511
+
6999
7512
  /** Set `visible` on `node` and all descendants (via `node.children`). glTF
7000
7513
  * KHR_node_visibility specifies that children inherit their parent's
7001
7514
  * invisibility — we materialize this at set-time so the render hot-path
@@ -7045,6 +7558,14 @@ export declare function setThinInstances(mesh: Mesh, matrices: Float32Array | Fl
7045
7558
  */
7046
7559
  export declare function setUniformEffectUniforms(wrapper: UniformEffectWrapper, data: ArrayBuffer | ArrayBufferView): void;
7047
7560
 
7561
+ /**
7562
+ * Enables or disables the unmute button. When disabled it is hidden; when
7563
+ * enabled it is shown if the engine is not running.
7564
+ * @param ui - The UI handle.
7565
+ * @param enabled - Whether the button may be shown.
7566
+ */
7567
+ export declare function setUnmuteUIEnabled(ui: UnmuteUI, enabled: boolean): void;
7568
+
7048
7569
  /** Vertex attribute names a ShaderMaterial can bind. */
7049
7570
  export declare type ShaderAttributeName = "position" | "normal" | "uv" | "uv2" | "tangent" | "color";
7050
7571
 
@@ -7346,6 +7867,114 @@ declare interface SkeletonData {
7346
7867
  readonly weights1: Float32Array | null;
7347
7868
  }
7348
7869
 
7870
+ /** A decoded audio buffer ready to be played by one or more sounds. */
7871
+ export declare interface SoundBuffer {
7349
7872
  /** Duration in seconds. */
7873
+ readonly duration: number;
7874
+ /** Sample rate in Hz. */
7875
+ readonly sampleRate: number;
7876
+ /** Number of channels. */
7877
+ readonly channelCount: number;
7878
+ /** Length in samples. */
7879
+ readonly length: number;
7880
+ }
7881
+
7882
+ /** Options for {@link createSoundBufferAsync}. */
7883
+ export declare interface SoundBufferOptions {
7884
+ /** Skip the browser codec check when selecting among multiple URLs. */
7885
+ skipCodecCheck?: boolean;
7886
+ }
7887
+
7888
+ /** Source accepted when creating a sound or sound buffer. */
7889
+ export declare type SoundSource = ArrayBuffer | AudioBuffer | SoundBuffer | string | string[];
7890
+
7891
+ /** Options for {@link createSoundSourceAsync} and {@link createMicrophoneSoundSourceAsync}. */
7892
+ export declare interface SoundSourceOptions {
7893
+ /** Optional name. */
7894
+ name?: string;
7895
+ /** Output bus. Defaults to the engine's main bus unless {@link outBusAutoDefault} is `false`. */
7896
+ outBus?: PrimaryAudioBus;
7897
+ /**
7898
+ * Whether the output bus defaults to the engine's main bus when {@link outBus}
7899
+ * is not set. Defaults to `true` for {@link createSoundSourceAsync} and `false`
7900
+ * for {@link createMicrophoneSoundSourceAsync} (a mic is usually analyzed, not
7901
+ * played back, to avoid feedback).
7902
+ */
7903
+ outBusAutoDefault?: boolean;
7904
+ /** Initial volume. Defaults to `1`. */
7905
+ volume?: number;
7906
+ }
7907
+
7908
+ /** Playback state of a sound or sound instance. Values match Babylon.js exactly. */
7909
+ export declare const SoundState: {
7910
+ readonly Stopping: 0;
7911
+ readonly Stopped: 1;
7912
+ readonly Starting: 2;
7913
+ readonly Started: 3;
7914
+ readonly FailedToStart: 4;
7915
+ readonly Paused: 5;
7916
+ };
7917
+
7918
+ export declare type SoundState = (typeof SoundState)[keyof typeof SoundState];
7919
+
7920
+ /** Which components of a target's world transform drive the spatial node. */
7921
+ export declare type SpatialAttachmentType = "position" | "rotation" | "positionAndRotation";
7922
+
7923
+ /** Spatial listener options. The listener orientation is derived from its rotation quaternion. */
7924
+ export declare interface SpatialListenerOptions {
7925
+ /** Listener world position. Defaults to `(0, 0, 0)`. */
7926
+ position?: Vec3;
7927
+ /** Listener rotation. Drives the listener forward/up vectors. */
7928
+ rotationQuaternion?: Quat;
7929
+ /** Follow a world transform. */
7930
+ attachedTo?: SpatialTarget;
7931
+ /** Which transform components to follow. Defaults to `"positionAndRotation"`. */
7932
+ attachmentType?: SpatialAttachmentType;
7933
+ }
7934
+
7935
+ /** Spatial (3D) options for a sound or bus. All fields optional; defaults match Babylon.js. */
7936
+ export declare interface SpatialSoundOptions {
7937
+ /** World position of the source. Defaults to `(0, 0, 0)`. */
7938
+ position?: Vec3;
7939
+ /** Facing direction of the source. Defaults to `(1, 0, 0)`. */
7940
+ orientation?: Vec3;
7941
+ /** Source rotation as a quaternion. When set, drives {@link orientation}. */
7942
+ rotationQuaternion?: Quat;
7943
+ /** Pan between left/right channels. Defaults to `true`. */
7944
+ panningEnabled?: boolean;
7945
+ /** Panning algorithm. Defaults to `"equalpower"`. */
7946
+ panningModel?: PanningModelType;
7947
+ /** Distance attenuation model. Defaults to `"linear"`. */
7948
+ distanceModel?: DistanceModelType;
7949
+ /** Reference distance for attenuation. Defaults to `1`. */
7950
+ minDistance?: number;
7951
+ /** Max distance (linear model). Defaults to `10000`. */
7952
+ maxDistance?: number;
7953
+ /** Attenuation roll-off factor. Defaults to `1`. */
7954
+ rolloffFactor?: number;
7955
+ /** Cone inner angle, in radians. Defaults to `2π`. */
7956
+ coneInnerAngle?: number;
7957
+ /** Cone outer angle, in radians. Defaults to `2π`. */
7958
+ coneOuterAngle?: number;
7959
+ /** Volume outside the cone outer angle. Defaults to `0`. */
7960
+ coneOuterVolume?: number;
7961
+ /** Follow a world transform's position and/or rotation. */
7962
+ attachedTo?: SpatialTarget;
7963
+ /** Which transform components to follow. Defaults to `"positionAndRotation"`. */
7964
+ attachmentType?: SpatialAttachmentType;
7965
+ }
7966
+
7967
+ /**
7968
+ * Anything exposing a world transform — typically a Lite `Mesh` or camera.
7969
+ * The spatial node reads `worldMatrix` each update; if `onDispose` is provided,
7970
+ * the node auto-detaches when the target is disposed.
7971
+ */
7972
+ export declare interface SpatialTarget {
7973
+ /** Column-major world matrix of the target. */
7974
+ readonly worldMatrix: Mat4;
7975
+ /** Optional dispose signal — firing it auto-detaches the spatial node. */
7976
+ readonly onDispose?: AudioSignal<unknown>;
7977
+ }
7978
+
7350
7979
  /** Procedural UV sphere — matches Babylon MeshBuilder.CreateSphere defaults.
7351
7980
  * Generates vertex positions, normals, and indices for a unit sphere.
7352
7981
  * Left-handed winding (CCW front face) to match Babylon. */
@@ -7467,21 +8096,6 @@ export declare interface Sprite2DLayerOptions {
7467
8096
  * depth-hosted sprite, call `updateSprite2DIndex(layer, idx, { z: … })`.
7468
8097
  */
7469
8098
  layerZ?: number;
7470
- /**
7471
- * Opt-in per-sprite UV scroll offset. When `true`, every sprite gains two extra instance
7472
- * floats (`uvOffset.xy`) added to its sampled UV in the vertex stage — enabling parallax /
7473
- * infinite-scroll backgrounds without re-uploading texture coordinates. Set the offset per
7474
- * sprite via `Sprite2DProps.uvOffset` (on add) or `setSprite2DUvOffset` (live).
7475
- *
7476
- * **Zero cross-scene cost:** layers created without `uvScroll` keep the narrow 13/14-float
7477
- * layout, the base vertex attributes, and the base WGSL — they ship none of the uvScroll
7478
- * widening. The wider stride, the extra `@location(7)` attribute, and the `+ iUvOffset` WGSL
7479
- * are gated directly on this per-layer flag. Defaults to `false`.
7480
- *
7481
- * Pairs naturally with a tileable atlas texture sampled in `repeat` wrap mode
7482
- * (`loadSpriteAtlas(..., { textureOptions: { addressModeU: "repeat", addressModeV: "repeat" } })`).
7483
- */
7484
- uvScroll?: boolean;
7485
8099
  }
7486
8100
 
7487
8101
  /** Per-sprite init record passed to `addSprite2DIndex` / `updateSprite2DIndex`. */
@@ -7507,14 +8121,6 @@ export declare interface Sprite2DProps {
7507
8121
  * only the dirty range.
7508
8122
  */
7509
8123
  z?: number;
7510
- /**
7511
- * Per-sprite UV scroll offset added to the sampled UV in the vertex stage. Only stored and
7512
- * consumed by `uvScroll` layers (created with `Sprite2DLayerOptions.uvScroll: true`); non-scroll
7513
- * layers use the narrow 13/14-float layout and do not allocate a uvOffset slot. When omitted on
7514
- * add for a uvScroll layer, defaults to `[0, 0]`. When omitted on update, the sprite's existing
7515
- * offset is preserved. Live updates: `setSprite2DUvOffset`.
7516
- */
7517
- uvOffset?: [number, number];
7518
8124
  }
7519
8125
 
7520
8126
  /** Per-layer 2D camera (pan / zoom / rotation). Identity = pixel-perfect HUD. */
@@ -7803,6 +8409,13 @@ export declare interface StandardMaterialProps extends Material {
7803
8409
  * @throws If `requestAnimationFrame` is unavailable in the host environment. */
7804
8410
  export declare function startAnimationManager(manager: AnimationManager): void;
7805
8411
 
8412
+ /**
8413
+ * Starts the `requestAnimationFrame` render loop. No-op if already running or if
8414
+ * `requestAnimationFrame` is unavailable (e.g. a non-browser environment).
8415
+ * @param viz - The visualizer handle.
8416
+ */
8417
+ export declare function startAudioVisualizer(viz: AudioVisualizer): void;
8418
+
7806
8419
  /**
7807
8420
  * Start the render loop. Resolves after the first frame has been rendered.
7808
8421
  * Scenes registered via `registerScene()` before this call are included in
@@ -7817,6 +8430,69 @@ export declare function startEngine(engine: EngineContext): Promise<void>;
7817
8430
  */
7818
8431
  export declare function startSpriteAnimationManager(manager: SpriteAnimationManager): void;
7819
8432
 
8433
+ /** A buffer-backed sound. Pure state — drive it with the sound functions. */
8434
+ export declare interface StaticSound {
8435
+ /** Optional name. */
8436
+ readonly name?: string;
8437
+ /** The decoded buffer this sound plays. */
8438
+ readonly buffer: SoundBuffer;
8439
+ /** Current playback state. */
8440
+ readonly state: SoundState;
8441
+ /** Number of live instances. */
8442
+ readonly instanceCount: number;
8443
+ /** Fires when the sound finishes (all instances ended). */
8444
+ readonly onEnded: AudioSignal<StaticSound>;
8445
+
8446
+ /** Options for {@link createSoundAsync}. */
8447
+ export declare interface StaticSoundOptions extends SoundBufferOptions {
8448
+ /** Play immediately once ready. Defaults to `false`. */
8449
+ autoplay?: boolean;
8450
+ /** Play duration in seconds (`0` = full buffer). Defaults to `0`. */
8451
+ duration?: number;
8452
+ /** Loop playback. Defaults to `false`. */
8453
+ loop?: boolean;
8454
+ /** Loop end point in seconds. Defaults to `0`. */
8455
+ loopEnd?: number;
8456
+ /** Loop start point in seconds. Defaults to `0`. */
8457
+ loopStart?: number;
8458
+ /** Maximum simultaneous instances. Defaults to `Infinity`. */
8459
+ maxInstances?: number;
8460
+ /** Output bus. Defaults to the engine's default main bus. */
8461
+ outBus?: PrimaryAudioBus;
8462
+ /** Detune in cents. Defaults to `0`. */
8463
+ pitch?: number;
8464
+ /** Playback rate multiplier. Defaults to `1`. */
8465
+ playbackRate?: number;
8466
+ /** Start offset in seconds. Defaults to `0`. */
8467
+ startOffset?: number;
8468
+ /** Initial volume. Defaults to `1`. */
8469
+ volume?: number;
8470
+ }
8471
+
8472
+ /** Per-play overrides for {@link playSound}. */
8473
+ export declare interface StaticSoundPlayOptions {
8474
+ /** Play duration in seconds (`0` = full buffer). */
8475
+ duration?: number;
8476
+ /** Loop playback. */
8477
+ loop?: boolean;
8478
+ /** Loop end point in seconds. */
8479
+ loopEnd?: number;
8480
+ /** Loop start point in seconds. */
8481
+ loopStart?: number;
8482
+ /** Start offset in seconds. */
8483
+ startOffset?: number;
8484
+ /** Per-instance volume. */
8485
+ volume?: number;
8486
+ /** Delay before playback starts, in seconds. */
8487
+ waitTime?: number;
8488
+ }
8489
+
8490
+ /** Options for {@link stopSound}. */
8491
+ export declare interface StaticSoundStopOptions {
8492
+ /** Delay before stopping, in seconds. */
8493
+ waitTime?: number;
8494
+ }
8495
+
7820
8496
  /** Optional stencil-test state baked into a material's main-pass pipeline. Shared by every concrete material kind
7821
8497
  * (Standard, PBR, Shader) so none has to depend on another. Lets one material WRITE the stencil buffer where it
7822
8498
  * draws (a mask) and another DISCARD fragments where the stencil was written — with NO dynamic stencil reference:
@@ -7840,15 +8516,30 @@ export declare interface StencilState {
7840
8516
  readonly writeMask?: number;
7841
8517
  }
7842
8518
 
8519
+ /** Options for {@link enableStereo}. */
8520
+ export declare interface StereoSoundOptions {
8521
+ /** Stereo pan in the range `[-1, 1]` (`-1` = full left, `1` = full right). Defaults to `0`. */
8522
+ pan?: number;
8523
+ }
8524
+
7843
8525
  /** Stop playback and reset to frame 0. */
7844
8526
  export declare function stopAnimation(group: AnimationGroup): void;
7845
8527
 
7846
8528
  /** Stops the manager's autonomous requestAnimationFrame loop. No-op if not running. */
7847
8529
  export declare function stopAnimationManager(manager: AnimationManager): void;
7848
8530
 
8531
+ /**
8532
+ * Stops the render loop if it is running.
8533
+ * @param viz - The visualizer handle.
8534
+ */
8535
+ export declare function stopAudioVisualizer(viz: AudioVisualizer): void;
8536
+
7849
8537
  /** Stop the render loop. */
7850
8538
  export declare function stopEngine(engine: EngineContext): void;
7851
8539
 
8540
+ /** Stops the sound (and all its instances). */
8541
+ export declare function stopSound(sound: StaticSound, options?: StaticSoundStopOptions): void;
8542
+
7852
8543
  /**
7853
8544
  * Pauses an animation without removing it; it can be resumed with `playSpriteFrameAnimation`.
7854
8545
  * @param animation - Animation to stop.
@@ -7861,6 +8552,53 @@ export declare function stopSpriteAnimation(animation: SpriteFrameAnimation): vo
7861
8552
  */
7862
8553
  export declare function stopSpriteAnimationManager(manager: SpriteAnimationManager): void;
7863
8554
 
8555
+ /** Stops the sound (and all its instances). */
8556
+ export declare function stopStreamingSound(sound: StreamingSound): void;
8557
+
8558
+ /** A streaming, media-element-backed sound. Pure state — drive it with the streaming-sound functions. */
8559
+ export declare interface StreamingSound {
8560
+ /** Optional name. */
8561
+ readonly name?: string;
8562
+ /** Current playback state. */
8563
+ readonly state: SoundState;
8564
+ /** Number of live instances. */
8565
+ readonly instanceCount: number;
8566
+ /** Number of instances that have finished preloading. */
8567
+ readonly preloadCompletedCount: number;
8568
+ /** Fires when the sound finishes (all instances ended). */
8569
+ readonly onEnded: AudioSignal<StreamingSound>;
8570
+
8571
+ /** Options for {@link createStreamingSoundAsync}. */
8572
+ export declare interface StreamingSoundOptions {
8573
+ /** Play immediately once ready. Defaults to `false`. */
8574
+ autoplay?: boolean;
8575
+ /** Loop playback. Defaults to `false`. */
8576
+ loop?: boolean;
8577
+ /** Maximum simultaneous instances. Defaults to `Infinity`. */
8578
+ maxInstances?: number;
8579
+ /** Output bus. Defaults to the engine's default main bus. */
8580
+ outBus?: PrimaryAudioBus;
8581
+ /** Number of instances to preload. Defaults to `1`. */
8582
+ preloadCount?: number;
8583
+ /** Start offset in seconds. Defaults to `0`. */
8584
+ startOffset?: number;
8585
+ /** Initial volume. Defaults to `1`. */
8586
+ volume?: number;
8587
+ }
8588
+
8589
+ /** Per-play overrides for {@link playStreamingSound}. */
8590
+ export declare interface StreamingSoundPlayOptions {
8591
+ /** Loop playback. */
8592
+ loop?: boolean;
8593
+ /** Start offset in seconds. */
8594
+ startOffset?: number;
8595
+ /** Per-instance volume. */
8596
+ volume?: number;
8597
+ }
8598
+
8599
+ /** A streaming sound source: a URL, a list of candidate URLs, or an existing media element. */
8600
+ export declare type StreamingSoundSource = string | string[] | HTMLMediaElement;
8601
+
7864
8602
  /** Subsurface configuration. Nested sub-features — presence = enabled. */
7865
8603
  export declare interface SubSurfaceProps {
7866
8604
  /** Translucency: light passing through thin surfaces. */
@@ -7953,6 +8691,37 @@ export declare interface SurfaceOptions {
7953
8691
  maxDevicePixelRatio?: number;
7954
8692
  }
7955
8693
 
8694
+ /** A Temporal Anti-Aliasing post-process task: accumulates jittered frames into an
8695
+ * anti-aliased image. Inject at the end of a frame-graph chain. */
8696
+ export declare interface TaaPostProcessTask extends Task, PostProcessTaskSettings {
8697
+ readonly name: string;
8698
+ sourceTexture: RenderTarget;
8699
+ targetTexture: RenderTarget | null;
8700
+ outputTexture: RenderTarget;
8701
+ /** Blend weight of the current frame (smaller = smoother / slower convergence). */
8702
+ factor: number;
8703
+ /** Number of Halton jitter samples. */
8704
+ readonly samples: number;
8705
+ /** Reset to the current frame whenever the camera moves. */
8706
+ disableOnCameraMove: boolean;
8707
+ /** Recompute and upload the blend pass uniforms from current settings. */
8708
+ updateUniforms(): void;
8709
+ }
8710
+
8711
+ /** Configuration for `createTaaPostProcessTask`. */
8712
+ export declare interface TaaPostProcessTaskConfig extends PostProcessTaskSettings {
8713
+ /** The render task that draws the scene into `sourceTexture`. TAA jitters this
8714
+ * task's camera projection each frame (mirrors BJS `FrameGraphTAATask.objectRendererTask`). */
8715
+ sourceRenderTask: RenderTask;
8716
+ /** Blend weight of the current frame against the accumulated history (default: 0.05). */
8717
+ factor?: number;
8718
+ /** Number of jitter samples in the Halton sequence (default: 8). */
8719
+ samples?: number;
8720
+ /** Force a one-frame reset (output == current) whenever the camera moves (default: true).
8721
+ * Avoids ghosting while the view changes. */
8722
+ disableOnCameraMove?: boolean;
8723
+ }
8724
+
7956
8725
  /** Lightweight public description of one target affected by an animation group. */
7957
8726
  export declare interface TargetedAnimation {
7958
8727
  /** Runtime target object when one is directly addressable. */
@@ -8032,6 +8801,8 @@ export declare interface TextLayer {
8032
8801
  readonly data: TextData;
8033
8802
  scale: number;
8034
8803
  order: number;
8035
8804
  opacity: number;
8805
+ /** Coverage gamma for anti-aliased edges (see `TextLayerOptions.coverageGamma`). Default 1. */
8806
+ coverageGamma: number;
8036
8807
  visible: boolean;
8037
8808
 
8038
8809
  /** Initial placement and compositing options for a 2D text layer in a standalone text renderer. */
@@ -8049,6 +8820,13 @@ export declare interface TextLayerOptions {
8049
8820
  readonly order?: number;
8050
8821
  /** Alpha multiplier in [0, 1]. Default 1. */
8051
8822
  readonly opacity?: number;
8823
+ /** Coverage gamma for anti-aliased edges. Raises per-pixel coverage to `1/coverageGamma`
8824
+ * before compositing, darkening/thickening anti-aliased edges to mimic the gamma-space
8825
+ * blending used by native text renderers (DirectWrite/CoreText "stem darkening"). Only
8826
+ * meaningful when rendering into an sRGB (linear-blended) surface, where correct linear
8827
+ * AA otherwise makes text look lighter/thinner than gamma-space rasterizers. Values \>1
8828
+ * thicken; 1 (default) is a no-op. Typical text values are ~1.8–2.2. */
8829
+ readonly coverageGamma?: number;
8052
8830
  /** Default true. */
8053
8831
  readonly visible?: boolean;
8054
8832
  }
@@ -8326,6 +9104,22 @@ export declare interface UniformEffectWrapperOptions {
8326
9104
  uniformByteLength: number;
8327
9105
  }
8328
9106
 
9107
+ /**
9108
+ * Unlocks (resumes) the audio engine. Browsers require a user gesture before a
9109
+ * real-time context can produce sound; call this from a click/tap handler.
9110
+ * @param engine - The audio engine.
9111
+ */
9112
+ export declare function unlockAudioEngineAsync(engine: AudioEngine): Promise<void>;
9113
+
9114
+ /** Unmute UI handle. Pure state — driven by the unmute-UI functions. */
9115
+ export declare interface UnmuteUI {
9116
+
9117
+ /** Options for {@link createUnmuteUI}. */
9118
+ export declare interface UnmuteUIOptions {
9119
+ /** Parent element for the button. Defaults to `document.body`. */
9120
+ parentElement?: HTMLElement;
9121
+ }
9122
+
8329
9123
  /** Unregister the effect renderer from its surface. No-op if not registered. */
8330
9124
  export declare function unregisterEffectRenderer(er: EffectRenderer): void;
8331
9125
 
@@ -8416,6 +9210,13 @@ export declare function updateNavCrowd(crowd: NavCrowd, dt: number): void;
8416
9210
  /** Run `tileCache.update()` until all pending obstacle requests are resolved. */
8417
9211
  export declare function updateNavMeshObstacles(plugin: NavigationPlugin): void;
8418
9212
 
9213
+ /**
9214
+ * Pumps one spatial update for every attached node and the listener. Call this
9215
+ * from your render loop, or enable {@link setSpatialAutoUpdate}.
9216
+ * @param engine - The audio engine.
9217
+ */
9218
+ export declare function updateSpatialAudio(engine: AudioEngine): void;
9219
+
8419
9220
  /**
8420
9221
  * Updates the properties of the sprite referenced by `handle`.
8421
9222
  * @param handle - Handle of the sprite to update.