[Web] Fix Emscripten for WebXR and update minimum version

This commit is contained in:
Adam Scott
2025-06-12 13:12:46 -04:00
parent 71a9948157
commit 793258919b
4 changed files with 35 additions and 23 deletions

View File

@ -29,7 +29,7 @@
/**************************************************************************/
const GodotWebXR = {
$GodotWebXR__deps: ['$Browser', '$GL', '$GodotRuntime', '$runtimeKeepalivePush', '$runtimeKeepalivePop'],
$GodotWebXR__deps: ['$MainLoop', '$GL', '$GodotRuntime', '$runtimeKeepalivePush', '$runtimeKeepalivePop'],
$GodotWebXR: {
gl: null,
@ -64,9 +64,9 @@ const GodotWebXR = {
},
monkeyPatchRequestAnimationFrame: (enable) => {
if (GodotWebXR.orig_requestAnimationFrame === null) {
GodotWebXR.orig_requestAnimationFrame = Browser.requestAnimationFrame;
GodotWebXR.orig_requestAnimationFrame = MainLoop.requestAnimationFrame;
}
Browser.requestAnimationFrame = enable
MainLoop.requestAnimationFrame = enable
? GodotWebXR.requestAnimationFrame
: GodotWebXR.orig_requestAnimationFrame;
},
@ -76,11 +76,11 @@ const GodotWebXR = {
// enabled or disabled. When using the WebXR API Emulator, this
// gets picked up automatically, however, in the Oculus Browser
// on the Quest, we need to pause and resume the main loop.
Browser.mainLoop.pause();
MainLoop.pause();
runtimeKeepalivePush();
window.setTimeout(function () {
runtimeKeepalivePop();
Browser.mainLoop.resume();
MainLoop.resume();
}, 0);
},