summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-02 12:24:40 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-02 12:24:40 +0100
commit7ef9947d0efecafdfc4817960d0777a432362436 (patch)
tree21d82ff57fdda2281225311a4f0de11dfa7c7691 /platform
parent8c094207a0ae486ab0e81290bd9d48bfb56dd0c3 (diff)
parent310bf39cd3f8c0e9ac6602e37fa9d65ca0d1c2e1 (diff)
Merge pull request #68870 from dsnopek/master-webxr-input
Get WebXR fully working in Godot 4!
Diffstat (limited to 'platform')
-rw-r--r--platform/web/SCsub9
-rw-r--r--platform/web/js/libs/library_godot_webgl2.externs.js36
-rw-r--r--platform/web/js/libs/library_godot_webgl2.js5
3 files changed, 46 insertions, 4 deletions
diff --git a/platform/web/SCsub b/platform/web/SCsub
index 077024507a..e44e59bfb9 100644
--- a/platform/web/SCsub
+++ b/platform/web/SCsub
@@ -38,15 +38,20 @@ sys_env.AddJSLibraries(
"js/libs/library_godot_webgl2.js",
]
)
+sys_env.AddJSExterns(
+ [
+ "js/libs/library_godot_webgl2.externs.js",
+ ]
+)
if env["javascript_eval"]:
sys_env.AddJSLibraries(["js/libs/library_godot_javascript_singleton.js"])
for lib in sys_env["JS_LIBS"]:
sys_env.Append(LINKFLAGS=["--js-library", lib.abspath])
-for js in env["JS_PRE"]:
+for js in sys_env["JS_PRE"]:
sys_env.Append(LINKFLAGS=["--pre-js", js.abspath])
-for ext in env["JS_EXTERNS"]:
+for ext in sys_env["JS_EXTERNS"]:
sys_env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.abspath
build = []
diff --git a/platform/web/js/libs/library_godot_webgl2.externs.js b/platform/web/js/libs/library_godot_webgl2.externs.js
new file mode 100644
index 0000000000..18d8d0815a
--- /dev/null
+++ b/platform/web/js/libs/library_godot_webgl2.externs.js
@@ -0,0 +1,36 @@
+
+/**
+ * @constructor OVR_multiview2
+ */
+function OVR_multiview2() {}
+
+/**
+ * @type {number}
+ */
+OVR_multiview2.prototype.FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR;
+
+/**
+ * @type {number}
+ */
+OVR_multiview2.prototype.FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR;
+
+/**
+ * @type {number}
+ */
+OVR_multiview2.prototype.MAX_VIEWS_OVR;
+
+/**
+ * @type {number}
+ */
+OVR_multiview2.prototype.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
+
+/**
+ * @param {number} target
+ * @param {number} attachment
+ * @param {WebGLTexture} texture
+ * @param {number} level
+ * @param {number} baseViewIndex
+ * @param {number} numViews
+ * @return {void}
+ */
+OVR_multiview2.prototype.framebufferTextureMultiviewOVR = function(target, attachment, texture, level, baseViewIndex, numViews) {};
diff --git a/platform/web/js/libs/library_godot_webgl2.js b/platform/web/js/libs/library_godot_webgl2.js
index 365f712be7..ba990b3ee0 100644
--- a/platform/web/js/libs/library_godot_webgl2.js
+++ b/platform/web/js/libs/library_godot_webgl2.js
@@ -37,14 +37,15 @@ const GodotWebGL2 = {
godot_webgl2_glFramebufferTextureMultiviewOVR: function (target, attachment, texture, level, base_view_index, num_views) {
const context = GL.currentContext;
if (typeof context.multiviewExt === 'undefined') {
- const ext = context.GLctx.getExtension('OVR_multiview2');
+ const /** OVR_multiview2 */ ext = context.GLctx.getExtension('OVR_multiview2');
if (!ext) {
console.error('Trying to call glFramebufferTextureMultiviewOVR() without the OVR_multiview2 extension');
return;
}
context.multiviewExt = ext;
}
- context.multiviewExt.framebufferTextureMultiviewOVR(target, attachment, GL.textures[texture], level, base_view_index, num_views);
+ const /** OVR_multiview2 */ ext = context.multiviewExt;
+ ext.framebufferTextureMultiviewOVR(target, attachment, GL.textures[texture], level, base_view_index, num_views);
},
};