diff options
Diffstat (limited to 'modules/webxr')
-rw-r--r-- | modules/webxr/godot_webxr.h | 2 | ||||
-rw-r--r-- | modules/webxr/native/library_godot_webxr.js | 6 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.cpp | 28 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.h | 7 |
4 files changed, 11 insertions, 32 deletions
diff --git a/modules/webxr/godot_webxr.h b/modules/webxr/godot_webxr.h index 41a690f473..7aac0a6508 100644 --- a/modules/webxr/godot_webxr.h +++ b/modules/webxr/godot_webxr.h @@ -62,7 +62,7 @@ extern void godot_webxr_initialize( extern void godot_webxr_uninitialize(); extern int godot_webxr_get_view_count(); -extern int *godot_webxr_get_render_targetsize(); +extern int *godot_webxr_get_render_target_size(); extern float *godot_webxr_get_transform_for_eye(int p_eye); extern float *godot_webxr_get_projection_for_eye(int p_eye); extern int godot_webxr_get_external_texture_for_eye(int p_eye); diff --git a/modules/webxr/native/library_godot_webxr.js b/modules/webxr/native/library_godot_webxr.js index 6e19a8ac6e..c4b21defce 100644 --- a/modules/webxr/native/library_godot_webxr.js +++ b/modules/webxr/native/library_godot_webxr.js @@ -406,9 +406,9 @@ const GodotWebXR = { return GodotWebXR.pose.views.length; }, - godot_webxr_get_render_targetsize__proxy: 'sync', - godot_webxr_get_render_targetsize__sig: 'i', - godot_webxr_get_render_targetsize: function () { + godot_webxr_get_render_target_size__proxy: 'sync', + godot_webxr_get_render_target_size__sig: 'i', + godot_webxr_get_render_target_size: function () { if (!GodotWebXR.session || !GodotWebXR.pose) { return 0; } diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 099e769303..2d699961ae 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -199,7 +199,7 @@ StringName WebXRInterfaceJS::get_name() const { return "WebXR"; }; -int WebXRInterfaceJS::get_capabilities() const { +uint32_t WebXRInterfaceJS::get_capabilities() const { return XRInterface::XR_STEREO | XRInterface::XR_MONO; }; @@ -254,9 +254,9 @@ bool WebXRInterfaceJS::initialize() { void WebXRInterfaceJS::uninitialize() { if (initialized) { XRServer *xr_server = XRServer::get_singleton(); - if (xr_server != nullptr) { + if (xr_server != nullptr && xr_server->get_primary_interface() == this) { // no longer our primary interface - xr_server->clear_primary_interface_if(this); + xr_server->set_primary_interface(nullptr); } godot_webxr_uninitialize(); @@ -285,12 +285,12 @@ Transform3D WebXRInterfaceJS::_js_matrix_to_transform(float *p_js_matrix) { return transform; } -Size2 WebXRInterfaceJS::get_render_targetsize() { +Size2 WebXRInterfaceJS::get_render_target_size() { if (render_targetsize.width != 0 && render_targetsize.height != 0) { return render_targetsize; } - int *js_size = godot_webxr_get_render_targetsize(); + int *js_size = godot_webxr_get_render_target_size(); if (!initialized || js_size == nullptr) { // As a temporary default (until WebXR is fully initialized), use half the window size. Size2 temp = DisplayServer::get_singleton()->window_get_size(); @@ -365,20 +365,6 @@ CameraMatrix WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, real_t p return eye; } -unsigned int WebXRInterfaceJS::get_external_texture_for_eye(XRInterface::Eyes p_eye) { - if (!initialized) { - return 0; - } - return godot_webxr_get_external_texture_for_eye(p_eye); -} - -void WebXRInterfaceJS::commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { - if (!initialized) { - return; - } - godot_webxr_commit_for_eye(p_eye); -} - Vector<BlitToScreen> WebXRInterfaceJS::commit_views(RID p_render_target, const Rect2 &p_screen_rect) { Vector<BlitToScreen> blit_to_screen; @@ -474,10 +460,6 @@ void WebXRInterfaceJS::_on_controller_changed() { } } -void WebXRInterfaceJS::notification(int p_what) { - // Nothing to do here. -} - WebXRInterfaceJS::WebXRInterfaceJS() { initialized = false; session_mode = "inline"; diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h index f9368582b7..82307190db 100644 --- a/modules/webxr/webxr_interface_js.h +++ b/modules/webxr/webxr_interface_js.h @@ -76,23 +76,20 @@ public: virtual PackedVector3Array get_bounds_geometry() const override; virtual StringName get_name() const override; - virtual int get_capabilities() const override; + virtual uint32_t get_capabilities() const override; virtual bool is_initialized() const override; virtual bool initialize() override; virtual void uninitialize() override; - virtual Size2 get_render_targetsize() override; + virtual Size2 get_render_target_size() override; virtual uint32_t get_view_count() override; virtual Transform3D get_camera_transform() override; virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) override; virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) override; - virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye) override; - virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override; virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) override; virtual void process() override; - virtual void notification(int p_what) override; void _on_controller_changed(); |