summaryrefslogtreecommitdiff
path: root/modules/mobile_vr/mobile_vr_interface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mobile_vr/mobile_vr_interface.cpp')
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index 78cc667718..dc7ed03548 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -31,7 +31,7 @@
#include "mobile_vr_interface.h"
#include "core/os/input.h"
#include "core/os/os.h"
-#include "servers/visual/visual_server_global.h"
+#include "servers/visual/visual_server_globals.h"
StringName MobileVRInterface::get_name() const {
return "Native mobile";
@@ -200,6 +200,9 @@ void MobileVRInterface::set_position_from_sensors() {
};
void MobileVRInterface::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_eye_height", "eye_height"), &MobileVRInterface::set_eye_height);
+ ClassDB::bind_method(D_METHOD("get_eye_height"), &MobileVRInterface::get_eye_height);
+
ClassDB::bind_method(D_METHOD("set_iod", "iod"), &MobileVRInterface::set_iod);
ClassDB::bind_method(D_METHOD("get_iod"), &MobileVRInterface::get_iod);
@@ -218,6 +221,7 @@ void MobileVRInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_k2", "k"), &MobileVRInterface::set_k2);
ClassDB::bind_method(D_METHOD("get_k2"), &MobileVRInterface::get_k2);
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "eye_height", PROPERTY_HINT_RANGE, "0.0,3.0,0.1"), "set_eye_height", "get_eye_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "iod", PROPERTY_HINT_RANGE, "4.0,10.0,0.1"), "set_iod", "get_iod");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "display_width", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_width", "get_display_width");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "display_to_lens", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_to_lens", "get_display_to_lens");
@@ -226,6 +230,14 @@ void MobileVRInterface::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "k2", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k2", "get_k2");
}
+void MobileVRInterface::set_eye_height(const real_t p_eye_height) {
+ eye_height = p_eye_height;
+}
+
+real_t MobileVRInterface::get_eye_height() const {
+ return eye_height;
+}
+
void MobileVRInterface::set_iod(const real_t p_iod) {
intraocular_dist = p_iod;
};
@@ -328,6 +340,7 @@ Size2 MobileVRInterface::get_render_targetsize() {
// we use half our window size
Size2 target_size = OS::get_singleton()->get_window_size();
+
target_size.x *= 0.5 * oversample;
target_size.y *= oversample;