@babylonjs/core 8.27.0 → 8.27.2
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/Audio/audioEngine.js +5 -0
- package/Audio/audioEngine.js.map +1 -1
- package/Engines/WebGL/webGLHardwareTexture.d.ts +1 -0
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +6 -6
- package/Engines/constants.js +6 -6
- package/Engines/constants.js.map +1 -1
- package/Engines/thinEngine.js +11 -1
- package/Engines/thinEngine.js.map +1 -1
- package/Meshes/linesMesh.js +1 -0
- package/Meshes/linesMesh.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +2 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/screenshotTools.d.ts +9 -2
- package/Misc/screenshotTools.js +14 -3
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.js +1 -1
- package/Misc/tools.js.map +1 -1
- package/Particles/thinParticleSystem.js +2 -2
- package/Particles/thinParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
- package/Shaders/particles.vertex.js +2 -2
- package/Shaders/particles.vertex.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +7 -7
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/XR/webXRCamera.js +1 -0
- package/XR/webXRCamera.js.map +1 -1
- package/assets/Draco/draco_decoder.js +1 -1
- package/assets/Draco/draco_decoder_gltf.js +1 -1
- package/assets/Draco/draco_encoder.js +2 -0
- package/assets/Draco/draco_encoder_wasm_wrapper.js +1 -1
- package/assets/Draco/draco_wasm_wrapper.js +1 -1
- package/assets/Draco/draco_wasm_wrapper_gltf.js +1 -1
- package/package.json +1 -1
package/Audio/audioEngine.js
CHANGED
|
@@ -105,6 +105,11 @@ export class AudioEngine {
|
|
|
105
105
|
});
|
|
106
106
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then
|
|
107
107
|
v2._initAsync({ resumeOnInteraction: false }).then(() => {
|
|
108
|
+
const mainBusOutNode = v2.defaultMainBus._outNode;
|
|
109
|
+
if (mainBusOutNode) {
|
|
110
|
+
mainBusOutNode.disconnect(v2.mainOut._inNode);
|
|
111
|
+
mainBusOutNode.connect(this._masterGain);
|
|
112
|
+
}
|
|
108
113
|
v2.mainOut._inNode = this._masterGain;
|
|
109
114
|
v2.stateChangedObservable.notifyObservers(v2.state);
|
|
110
115
|
});
|
package/Audio/audioEngine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audioEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Audio/audioEngine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,8CAA8C;AAC9C,cAAc,CAAC,kBAAkB,GAAG,CAChC,WAAkC,EAClC,YAAoC,EACpC,gBAAkF,EACpF,EAAE;IACA,OAAO,IAAI,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;AACxE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAWpB;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAe;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;IACxD,CAAC;IAyBD;;;OAGG;IACH,IAAW,uBAAuB;QAC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IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,SAAiB;QACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,QAAkB;QACvC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;QAC9C,CAAC;QAED,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACnG,CAAC;IAEO,KAAK,CAAC,yBAAyB;QACnC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEtC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;CACJ","sourcesContent":["import type { Analyser } from \"./analyser\";\r\n\r\nimport type { Nullable } from \"../types\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { IAudioEngine } from \"./Interfaces/IAudioEngine\";\r\nimport { _WebAudioEngine } from \"../AudioV2/webAudio/webAudioEngine\";\r\n\r\n// Sets the default audio engine to Babylon.js\r\nAbstractEngine.AudioEngineFactory = (\r\n hostElement: Nullable<HTMLElement>,\r\n audioContext: Nullable<AudioContext>,\r\n audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>\r\n) => {\r\n return new AudioEngine(hostElement, audioContext, audioDestination);\r\n};\r\n\r\n/**\r\n * This represents the default audio engine used in babylon.\r\n * It is responsible to play, synchronize and analyse sounds throughout the application.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic\r\n */\r\nexport class AudioEngine implements IAudioEngine {\r\n private _audioContext: Nullable<AudioContext> = null;\r\n private _masterGain: GainNode;\r\n private _tryToRun = false;\r\n private _useCustomUnlockedButton: boolean = false;\r\n\r\n /**\r\n * Gets whether the current host supports Web Audio and thus could create AudioContexts.\r\n */\r\n public canUseWebAudio: boolean = true;\r\n\r\n /**\r\n * The master gain node defines the global audio volume of your audio engine.\r\n */\r\n public get masterGain(): GainNode {\r\n return this._masterGain;\r\n }\r\n\r\n public set masterGain(value: GainNode) {\r\n this._masterGain = this._v2.mainOut._inNode = value;\r\n }\r\n\r\n /**\r\n * Defines if Babylon should emit a warning if WebAudio is not supported.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public WarnedWebAudioUnsupported: boolean = false;\r\n\r\n /**\r\n * Gets whether or not mp3 are supported by your browser.\r\n */\r\n public isMP3supported: boolean = false;\r\n\r\n /**\r\n * Gets whether or not ogg are supported by your browser.\r\n */\r\n public isOGGsupported: boolean = false;\r\n\r\n /**\r\n * Gets whether audio has been unlocked on the device.\r\n * Some Browsers have strong restrictions about Audio and won't autoplay unless\r\n * a user interaction has happened.\r\n */\r\n public unlocked: boolean = false;\r\n\r\n /**\r\n * Defines if the audio engine relies on a custom unlocked button.\r\n * In this case, the embedded button will not be displayed.\r\n */\r\n public get useCustomUnlockedButton(): boolean {\r\n return this._useCustomUnlockedButton;\r\n }\r\n\r\n public set useCustomUnlockedButton(value: boolean) {\r\n this._useCustomUnlockedButton = value;\r\n this._v2._unmuteUIEnabled = !value;\r\n }\r\n\r\n /**\r\n * Event raised when audio has been unlocked on the browser.\r\n */\r\n public onAudioUnlockedObservable = new Observable<IAudioEngine>();\r\n\r\n /**\r\n * Event raised when audio has been locked on the browser.\r\n */\r\n public onAudioLockedObservable = new Observable<IAudioEngine>();\r\n\r\n /** @internal */\r\n public _v2: _WebAudioEngine;\r\n\r\n /**\r\n * Gets the current AudioContext if available.\r\n */\r\n public get audioContext(): Nullable<AudioContext> {\r\n if (this._v2.state === \"running\") {\r\n // Do not wait for the promise to unlock.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._triggerRunningStateAsync();\r\n }\r\n return this._v2._audioContext;\r\n }\r\n\r\n private _connectedAnalyser: Nullable<Analyser>;\r\n\r\n /**\r\n * Instantiates a new audio engine.\r\n *\r\n * @param hostElement defines the host element where to display the mute icon if necessary\r\n * @param audioContext defines the audio context to be used by the audio engine\r\n * @param audioDestination defines the audio destination node to be used by audio engine\r\n */\r\n constructor(\r\n hostElement: Nullable<HTMLElement> = null,\r\n audioContext: Nullable<AudioContext> = null,\r\n audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode> = null\r\n ) {\r\n const v2 = new _WebAudioEngine({\r\n audioContext: audioContext ? audioContext : undefined,\r\n defaultUIParentElement: hostElement?.parentElement ? hostElement.parentElement : undefined,\r\n });\r\n\r\n // Historically the unmute button is disabled until a sound tries to play and can't, which results in a call\r\n // to `AudioEngine.lock()`, which is where the unmute button is enabled if no custom UI is requested.\r\n v2._unmuteUIEnabled = false;\r\n\r\n this._masterGain = new GainNode(v2._audioContext);\r\n v2._audioDestination = audioDestination;\r\n\r\n v2.stateChangedObservable.add((state) => {\r\n if (state === \"running\") {\r\n this.unlocked = true;\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n } else {\r\n this.unlocked = false;\r\n this.onAudioLockedObservable.notifyObservers(this);\r\n }\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n v2._initAsync({ resumeOnInteraction: false }).then(() => {\r\n v2.mainOut._inNode = this._masterGain;\r\n v2.stateChangedObservable.notifyObservers(v2.state);\r\n });\r\n\r\n this.isMP3supported = v2.isFormatValid(\"mp3\");\r\n this.isOGGsupported = v2.isFormatValid(\"ogg\");\r\n\r\n this._v2 = v2;\r\n }\r\n\r\n /**\r\n * Flags the audio engine in Locked state.\r\n * This happens due to new browser policies preventing audio to autoplay.\r\n */\r\n public lock() {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._v2._audioContext.suspend();\r\n\r\n if (!this._useCustomUnlockedButton) {\r\n this._v2._unmuteUIEnabled = true;\r\n }\r\n }\r\n\r\n /**\r\n * Unlocks the audio engine once a user action has been done on the dom.\r\n * This is helpful to resume play once browser policies have been satisfied.\r\n */\r\n public unlock() {\r\n if (this._audioContext?.state === \"running\") {\r\n if (!this.unlocked) {\r\n // Notify users that the audio stack is unlocked/unmuted\r\n this.unlocked = true;\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n }\r\n\r\n return;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._triggerRunningStateAsync();\r\n }\r\n\r\n /** @internal */\r\n public _resumeAudioContextOnStateChange(): void {\r\n this._audioContext?.addEventListener(\r\n \"statechange\",\r\n () => {\r\n if (this.unlocked && this._audioContext?.state !== \"running\") {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._resumeAudioContextAsync();\r\n }\r\n },\r\n {\r\n once: true,\r\n passive: true,\r\n signal: AbortSignal.timeout(3000),\r\n }\r\n );\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n private _resumeAudioContextAsync(): Promise<void> {\r\n if (this._v2._isUsingOfflineAudioContext) {\r\n return Promise.resolve();\r\n }\r\n\r\n return this._v2._audioContext.resume();\r\n }\r\n\r\n /**\r\n * Destroy and release the resources associated with the audio context.\r\n */\r\n public dispose(): void {\r\n this._v2.dispose();\r\n\r\n this.onAudioUnlockedObservable.clear();\r\n this.onAudioLockedObservable.clear();\r\n }\r\n\r\n /**\r\n * Gets the global volume sets on the master gain.\r\n * @returns the global volume if set or -1 otherwise\r\n */\r\n public getGlobalVolume(): number {\r\n return this.masterGain.gain.value;\r\n }\r\n\r\n /**\r\n * Sets the global volume of your experience (sets on the master gain).\r\n * @param newVolume Defines the new global volume of the application\r\n */\r\n public setGlobalVolume(newVolume: number): void {\r\n this.masterGain.gain.value = newVolume;\r\n }\r\n\r\n /**\r\n * Connect the audio engine to an audio analyser allowing some amazing\r\n * synchronization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n public connectToAnalyser(analyser: Analyser): void {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n\r\n this._connectedAnalyser = analyser;\r\n this.masterGain.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this.masterGain, this._v2._audioContext.destination);\r\n }\r\n\r\n private async _triggerRunningStateAsync() {\r\n if (this._tryToRun) {\r\n return;\r\n }\r\n this._tryToRun = true;\r\n\r\n await this._resumeAudioContextAsync();\r\n\r\n this._tryToRun = false;\r\n this.unlocked = true;\r\n\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"audioEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Audio/audioEngine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGrE,8CAA8C;AAC9C,cAAc,CAAC,kBAAkB,GAAG,CAChC,WAAkC,EAClC,YAAoC,EACpC,gBAAkF,EACpF,EAAE;IACA,OAAO,IAAI,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,C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GAAG,IAAI,CAAC;QAEtB,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEtC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;CACJ","sourcesContent":["import type { Analyser } from \"./analyser\";\r\n\r\nimport type { Nullable } from \"../types\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { IAudioEngine } from \"./Interfaces/IAudioEngine\";\r\nimport { _WebAudioEngine } from \"../AudioV2/webAudio/webAudioEngine\";\r\nimport type { _WebAudioMainBus } from \"../AudioV2/webAudio/webAudioMainBus\";\r\n\r\n// Sets the default audio engine to Babylon.js\r\nAbstractEngine.AudioEngineFactory = (\r\n hostElement: Nullable<HTMLElement>,\r\n audioContext: Nullable<AudioContext>,\r\n audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode>\r\n) => {\r\n return new AudioEngine(hostElement, audioContext, audioDestination);\r\n};\r\n\r\n/**\r\n * This represents the default audio engine used in babylon.\r\n * It is responsible to play, synchronize and analyse sounds throughout the application.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic\r\n */\r\nexport class AudioEngine implements IAudioEngine {\r\n private _audioContext: Nullable<AudioContext> = null;\r\n private _masterGain: GainNode;\r\n private _tryToRun = false;\r\n private _useCustomUnlockedButton: boolean = false;\r\n\r\n /**\r\n * Gets whether the current host supports Web Audio and thus could create AudioContexts.\r\n */\r\n public canUseWebAudio: boolean = true;\r\n\r\n /**\r\n * The master gain node defines the global audio volume of your audio engine.\r\n */\r\n public get masterGain(): GainNode {\r\n return this._masterGain;\r\n }\r\n\r\n public set masterGain(value: GainNode) {\r\n this._masterGain = this._v2.mainOut._inNode = value;\r\n }\r\n\r\n /**\r\n * Defines if Babylon should emit a warning if WebAudio is not supported.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public WarnedWebAudioUnsupported: boolean = false;\r\n\r\n /**\r\n * Gets whether or not mp3 are supported by your browser.\r\n */\r\n public isMP3supported: boolean = false;\r\n\r\n /**\r\n * Gets whether or not ogg are supported by your browser.\r\n */\r\n public isOGGsupported: boolean = false;\r\n\r\n /**\r\n * Gets whether audio has been unlocked on the device.\r\n * Some Browsers have strong restrictions about Audio and won't autoplay unless\r\n * a user interaction has happened.\r\n */\r\n public unlocked: boolean = false;\r\n\r\n /**\r\n * Defines if the audio engine relies on a custom unlocked button.\r\n * In this case, the embedded button will not be displayed.\r\n */\r\n public get useCustomUnlockedButton(): boolean {\r\n return this._useCustomUnlockedButton;\r\n }\r\n\r\n public set useCustomUnlockedButton(value: boolean) {\r\n this._useCustomUnlockedButton = value;\r\n this._v2._unmuteUIEnabled = !value;\r\n }\r\n\r\n /**\r\n * Event raised when audio has been unlocked on the browser.\r\n */\r\n public onAudioUnlockedObservable = new Observable<IAudioEngine>();\r\n\r\n /**\r\n * Event raised when audio has been locked on the browser.\r\n */\r\n public onAudioLockedObservable = new Observable<IAudioEngine>();\r\n\r\n /** @internal */\r\n public _v2: _WebAudioEngine;\r\n\r\n /**\r\n * Gets the current AudioContext if available.\r\n */\r\n public get audioContext(): Nullable<AudioContext> {\r\n if (this._v2.state === \"running\") {\r\n // Do not wait for the promise to unlock.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._triggerRunningStateAsync();\r\n }\r\n return this._v2._audioContext;\r\n }\r\n\r\n private _connectedAnalyser: Nullable<Analyser>;\r\n\r\n /**\r\n * Instantiates a new audio engine.\r\n *\r\n * @param hostElement defines the host element where to display the mute icon if necessary\r\n * @param audioContext defines the audio context to be used by the audio engine\r\n * @param audioDestination defines the audio destination node to be used by audio engine\r\n */\r\n constructor(\r\n hostElement: Nullable<HTMLElement> = null,\r\n audioContext: Nullable<AudioContext> = null,\r\n audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode> = null\r\n ) {\r\n const v2 = new _WebAudioEngine({\r\n audioContext: audioContext ? audioContext : undefined,\r\n defaultUIParentElement: hostElement?.parentElement ? hostElement.parentElement : undefined,\r\n });\r\n\r\n // Historically the unmute button is disabled until a sound tries to play and can't, which results in a call\r\n // to `AudioEngine.lock()`, which is where the unmute button is enabled if no custom UI is requested.\r\n v2._unmuteUIEnabled = false;\r\n\r\n this._masterGain = new GainNode(v2._audioContext);\r\n v2._audioDestination = audioDestination;\r\n\r\n v2.stateChangedObservable.add((state) => {\r\n if (state === \"running\") {\r\n this.unlocked = true;\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n } else {\r\n this.unlocked = false;\r\n this.onAudioLockedObservable.notifyObservers(this);\r\n }\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n v2._initAsync({ resumeOnInteraction: false }).then(() => {\r\n const mainBusOutNode = (v2.defaultMainBus as _WebAudioMainBus)._outNode;\r\n if (mainBusOutNode) {\r\n mainBusOutNode.disconnect(v2.mainOut._inNode);\r\n mainBusOutNode.connect(this._masterGain);\r\n }\r\n\r\n v2.mainOut._inNode = this._masterGain;\r\n v2.stateChangedObservable.notifyObservers(v2.state);\r\n });\r\n\r\n this.isMP3supported = v2.isFormatValid(\"mp3\");\r\n this.isOGGsupported = v2.isFormatValid(\"ogg\");\r\n\r\n this._v2 = v2;\r\n }\r\n\r\n /**\r\n * Flags the audio engine in Locked state.\r\n * This happens due to new browser policies preventing audio to autoplay.\r\n */\r\n public lock() {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._v2._audioContext.suspend();\r\n\r\n if (!this._useCustomUnlockedButton) {\r\n this._v2._unmuteUIEnabled = true;\r\n }\r\n }\r\n\r\n /**\r\n * Unlocks the audio engine once a user action has been done on the dom.\r\n * This is helpful to resume play once browser policies have been satisfied.\r\n */\r\n public unlock() {\r\n if (this._audioContext?.state === \"running\") {\r\n if (!this.unlocked) {\r\n // Notify users that the audio stack is unlocked/unmuted\r\n this.unlocked = true;\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n }\r\n\r\n return;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._triggerRunningStateAsync();\r\n }\r\n\r\n /** @internal */\r\n public _resumeAudioContextOnStateChange(): void {\r\n this._audioContext?.addEventListener(\r\n \"statechange\",\r\n () => {\r\n if (this.unlocked && this._audioContext?.state !== \"running\") {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._resumeAudioContextAsync();\r\n }\r\n },\r\n {\r\n once: true,\r\n passive: true,\r\n signal: AbortSignal.timeout(3000),\r\n }\r\n );\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n private _resumeAudioContextAsync(): Promise<void> {\r\n if (this._v2._isUsingOfflineAudioContext) {\r\n return Promise.resolve();\r\n }\r\n\r\n return this._v2._audioContext.resume();\r\n }\r\n\r\n /**\r\n * Destroy and release the resources associated with the audio context.\r\n */\r\n public dispose(): void {\r\n this._v2.dispose();\r\n\r\n this.onAudioUnlockedObservable.clear();\r\n this.onAudioLockedObservable.clear();\r\n }\r\n\r\n /**\r\n * Gets the global volume sets on the master gain.\r\n * @returns the global volume if set or -1 otherwise\r\n */\r\n public getGlobalVolume(): number {\r\n return this.masterGain.gain.value;\r\n }\r\n\r\n /**\r\n * Sets the global volume of your experience (sets on the master gain).\r\n * @param newVolume Defines the new global volume of the application\r\n */\r\n public setGlobalVolume(newVolume: number): void {\r\n this.masterGain.gain.value = newVolume;\r\n }\r\n\r\n /**\r\n * Connect the audio engine to an audio analyser allowing some amazing\r\n * synchronization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n public connectToAnalyser(analyser: Analyser): void {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n\r\n this._connectedAnalyser = analyser;\r\n this.masterGain.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this.masterGain, this._v2._audioContext.destination);\r\n }\r\n\r\n private async _triggerRunningStateAsync() {\r\n if (this._tryToRun) {\r\n return;\r\n }\r\n this._tryToRun = true;\r\n\r\n await this._resumeAudioContextAsync();\r\n\r\n this._tryToRun = false;\r\n this.unlocked = true;\r\n\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n }\r\n}\r\n"]}
|
|
@@ -5,6 +5,7 @@ export declare class WebGLHardwareTexture implements IHardwareTextureWrapper {
|
|
|
5
5
|
private _webGLTexture;
|
|
6
6
|
private _context;
|
|
7
7
|
private _MSAARenderBuffers;
|
|
8
|
+
memoryAllocated?: boolean;
|
|
8
9
|
get underlyingResource(): Nullable<WebGLTexture>;
|
|
9
10
|
constructor(existingTexture: Nullable<WebGLTexture> | undefined, context: WebGLRenderingContext);
|
|
10
11
|
setUsage(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webGLHardwareTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGL/webGLHardwareTexture.ts"],"names":[],"mappings":"AAGA,gBAAgB;AAChB,MAAM,OAAO,oBAAoB;
|
|
1
|
+
{"version":3,"file":"webGLHardwareTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/WebGL/webGLHardwareTexture.ts"],"names":[],"mappings":"AAGA,gBAAgB;AAChB,MAAM,OAAO,oBAAoB;IAY7B,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,YAAY,kBAA0C,IAAI,EAAE,OAA8B;QAZ1F,oHAAoH;QACpH,kGAAkG;QAClG,gEAAgE;QACxD,uBAAkB,GAAkC,IAAI,CAAC;QAU7D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,eAAe,EAAE,CAAC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AC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import type { IHardwareTextureWrapper } from \"../../Materials/Textures/hardwareTextureWrapper\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\n/** @internal */\r\nexport class WebGLHardwareTexture implements IHardwareTextureWrapper {\r\n private _webGLTexture: WebGLTexture;\r\n private _context: WebGLRenderingContext;\r\n\r\n // There can be multiple buffers for a single WebGL texture because different layers of a 2DArrayTexture / 3DTexture\r\n // or different faces of a cube texture can be bound to different render targets at the same time.\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private _MSAARenderBuffers: Nullable<WebGLRenderbuffer[]> = null;\r\n\r\n // Set to true once GPU memory has been allocated for the texture (used only for compressed textures with mipmaps).\r\n public memoryAllocated?: boolean;\r\n\r\n public get underlyingResource(): Nullable<WebGLTexture> {\r\n return this._webGLTexture;\r\n }\r\n\r\n constructor(existingTexture: Nullable<WebGLTexture> = null, context: WebGLRenderingContext) {\r\n this._context = context;\r\n if (!existingTexture) {\r\n existingTexture = context.createTexture();\r\n if (!existingTexture) {\r\n throw new Error(\"Unable to create webGL texture\");\r\n }\r\n }\r\n this.set(existingTexture);\r\n }\r\n\r\n public setUsage(): void {}\r\n\r\n public set(hardwareTexture: WebGLTexture) {\r\n this._webGLTexture = hardwareTexture;\r\n }\r\n\r\n public reset() {\r\n this._webGLTexture = null as any;\r\n this._MSAARenderBuffers = null;\r\n }\r\n\r\n public addMSAARenderBuffer(buffer: WebGLRenderbuffer) {\r\n if (!this._MSAARenderBuffers) {\r\n this._MSAARenderBuffers = [];\r\n }\r\n this._MSAARenderBuffers.push(buffer);\r\n }\r\n\r\n public releaseMSAARenderBuffers() {\r\n if (this._MSAARenderBuffers) {\r\n for (const buffer of this._MSAARenderBuffers) {\r\n this._context.deleteRenderbuffer(buffer);\r\n }\r\n this._MSAARenderBuffers = null;\r\n }\r\n }\r\n\r\n public getMSAARenderBuffer(index = 0) {\r\n return this._MSAARenderBuffers?.[index] ?? null;\r\n }\r\n\r\n public release() {\r\n this.releaseMSAARenderBuffers();\r\n\r\n if (this._webGLTexture) {\r\n this._context.deleteTexture(this._webGLTexture);\r\n }\r\n this.reset();\r\n }\r\n}\r\n"]}
|
|
@@ -794,13 +794,13 @@ export class AbstractEngine {
|
|
|
794
794
|
*/
|
|
795
795
|
// Not mixed with Version for tooling purpose.
|
|
796
796
|
static get NpmPackage() {
|
|
797
|
-
return "babylonjs@8.27.
|
|
797
|
+
return "babylonjs@8.27.2";
|
|
798
798
|
}
|
|
799
799
|
/**
|
|
800
800
|
* Returns the current version of the framework
|
|
801
801
|
*/
|
|
802
802
|
static get Version() {
|
|
803
|
-
return "8.27.
|
|
803
|
+
return "8.27.2";
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
806
806
|
* Gets the HTML canvas attached with the current webGL context
|