From 96b707215dea18bce739c60f3486cceade4c4f4f Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Sun, 27 Jun 2021 21:51:30 +1000 Subject: Add support for returning the play area from XRInterface --- modules/mobile_vr/doc_classes/MobileVRInterface.xml | 1 + modules/mobile_vr/mobile_vr_interface.cpp | 13 +++++++++++++ modules/mobile_vr/mobile_vr_interface.h | 4 ++++ 3 files changed, 18 insertions(+) (limited to 'modules/mobile_vr') diff --git a/modules/mobile_vr/doc_classes/MobileVRInterface.xml b/modules/mobile_vr/doc_classes/MobileVRInterface.xml index 04ba82ef51..18a77c8b8d 100644 --- a/modules/mobile_vr/doc_classes/MobileVRInterface.xml +++ b/modules/mobile_vr/doc_classes/MobileVRInterface.xml @@ -37,5 +37,6 @@ The oversample setting. Because of the lens distortion we have to render our buffers at a higher resolution then the screen can natively handle. A value between 1.5 and 2.0 often provides good results but at the cost of performance. + diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index 7dd26c6905..ba7353ace2 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -370,6 +370,19 @@ void MobileVRInterface::uninitialize() { }; }; +bool MobileVRInterface::supports_play_area_mode(XRInterface::PlayAreaMode p_mode) { + // This interface has no positional tracking so fix this to 3DOF + return p_mode == XR_PLAY_AREA_3DOF; +} + +XRInterface::PlayAreaMode MobileVRInterface::get_play_area_mode() const { + return XR_PLAY_AREA_3DOF; +} + +bool MobileVRInterface::set_play_area_mode(XRInterface::PlayAreaMode p_mode) { + return p_mode == XR_PLAY_AREA_3DOF; +} + Size2 MobileVRInterface::get_render_target_size() { _THREAD_SAFE_METHOD_ diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h index 34bd1da43b..b5bf966247 100644 --- a/modules/mobile_vr/mobile_vr_interface.h +++ b/modules/mobile_vr/mobile_vr_interface.h @@ -143,6 +143,10 @@ public: virtual bool initialize() override; virtual void uninitialize() override; + virtual bool supports_play_area_mode(XRInterface::PlayAreaMode p_mode) override; + virtual XRInterface::PlayAreaMode get_play_area_mode() const override; + virtual bool set_play_area_mode(XRInterface::PlayAreaMode p_mode) override; + virtual Size2 get_render_target_size() override; virtual uint32_t get_view_count() override; virtual Transform3D get_camera_transform() override; -- cgit v1.2.3