summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2021-08-28 14:32:40 +1000
committerBastiaan Olij <mux213@gmail.com>2021-09-21 22:46:31 +1000
commitc527078634dbed724ab487000aea6f3d96b33752 (patch)
tree7661700caeeeb3052d8560753ca2138ed077ad0b /modules
parentdc2b06260901249f1510eaafe11d7db91ed5a579 (diff)
Change to using doubles in XR classes
Diffstat (limited to 'modules')
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp30
-rw-r--r--modules/mobile_vr/mobile_vr_interface.h46
-rw-r--r--modules/webxr/webxr_interface_js.cpp2
-rw-r--r--modules/webxr/webxr_interface_js.h2
4 files changed, 40 insertions, 40 deletions
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index bbf1db689d..fc1a118e4f 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -244,59 +244,59 @@ void MobileVRInterface::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "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) {
+void MobileVRInterface::set_eye_height(const double p_eye_height) {
eye_height = p_eye_height;
}
-real_t MobileVRInterface::get_eye_height() const {
+double MobileVRInterface::get_eye_height() const {
return eye_height;
}
-void MobileVRInterface::set_iod(const real_t p_iod) {
+void MobileVRInterface::set_iod(const double p_iod) {
intraocular_dist = p_iod;
};
-real_t MobileVRInterface::get_iod() const {
+double MobileVRInterface::get_iod() const {
return intraocular_dist;
};
-void MobileVRInterface::set_display_width(const real_t p_display_width) {
+void MobileVRInterface::set_display_width(const double p_display_width) {
display_width = p_display_width;
};
-real_t MobileVRInterface::get_display_width() const {
+double MobileVRInterface::get_display_width() const {
return display_width;
};
-void MobileVRInterface::set_display_to_lens(const real_t p_display_to_lens) {
+void MobileVRInterface::set_display_to_lens(const double p_display_to_lens) {
display_to_lens = p_display_to_lens;
};
-real_t MobileVRInterface::get_display_to_lens() const {
+double MobileVRInterface::get_display_to_lens() const {
return display_to_lens;
};
-void MobileVRInterface::set_oversample(const real_t p_oversample) {
+void MobileVRInterface::set_oversample(const double p_oversample) {
oversample = p_oversample;
};
-real_t MobileVRInterface::get_oversample() const {
+double MobileVRInterface::get_oversample() const {
return oversample;
};
-void MobileVRInterface::set_k1(const real_t p_k1) {
+void MobileVRInterface::set_k1(const double p_k1) {
k1 = p_k1;
};
-real_t MobileVRInterface::get_k1() const {
+double MobileVRInterface::get_k1() const {
return k1;
};
-void MobileVRInterface::set_k2(const real_t p_k2) {
+void MobileVRInterface::set_k2(const double p_k2) {
k2 = p_k2;
};
-real_t MobileVRInterface::get_k2() const {
+double MobileVRInterface::get_k2() const {
return k2;
};
@@ -422,7 +422,7 @@ Transform3D MobileVRInterface::get_transform_for_view(uint32_t p_view, const Tra
return transform_for_eye;
};
-CameraMatrix MobileVRInterface::get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
+CameraMatrix MobileVRInterface::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
_THREAD_SAFE_METHOD_
CameraMatrix eye;
diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h
index 48b76ec187..a843e1188b 100644
--- a/modules/mobile_vr/mobile_vr_interface.h
+++ b/modules/mobile_vr/mobile_vr_interface.h
@@ -56,17 +56,17 @@ private:
Basis orientation;
// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
- float eye_height = 1.85;
+ double eye_height = 1.85;
uint64_t last_ticks = 0;
- real_t intraocular_dist = 6.0;
- real_t display_width = 14.5;
- real_t display_to_lens = 4.0;
- real_t oversample = 1.5;
+ double intraocular_dist = 6.0;
+ double display_width = 14.5;
+ double display_to_lens = 4.0;
+ double oversample = 1.5;
- real_t k1 = 0.215;
- real_t k2 = 0.215;
- real_t aspect = 1.0;
+ double k1 = 0.215;
+ double k2 = 0.215;
+ double aspect = 1.0;
/*
logic for processing our sensor data, this was originally in our positional tracker logic but I think
@@ -110,26 +110,26 @@ protected:
static void _bind_methods();
public:
- void set_eye_height(const real_t p_eye_height);
- real_t get_eye_height() const;
+ void set_eye_height(const double p_eye_height);
+ double get_eye_height() const;
- void set_iod(const real_t p_iod);
- real_t get_iod() const;
+ void set_iod(const double p_iod);
+ double get_iod() const;
- void set_display_width(const real_t p_display_width);
- real_t get_display_width() const;
+ void set_display_width(const double p_display_width);
+ double get_display_width() const;
- void set_display_to_lens(const real_t p_display_to_lens);
- real_t get_display_to_lens() const;
+ void set_display_to_lens(const double p_display_to_lens);
+ double get_display_to_lens() const;
- void set_oversample(const real_t p_oversample);
- real_t get_oversample() const;
+ void set_oversample(const double p_oversample);
+ double get_oversample() const;
- void set_k1(const real_t p_k1);
- real_t get_k1() const;
+ void set_k1(const double p_k1);
+ double get_k1() const;
- void set_k2(const real_t p_k2);
- real_t get_k2() const;
+ void set_k2(const double p_k2);
+ double get_k2() const;
virtual StringName get_name() const override;
virtual uint32_t get_capabilities() const override;
@@ -144,7 +144,7 @@ public:
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 CameraMatrix get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) override;
virtual void process() override;
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp
index 2d699961ae..10c17aa672 100644
--- a/modules/webxr/webxr_interface_js.cpp
+++ b/modules/webxr/webxr_interface_js.cpp
@@ -341,7 +341,7 @@ Transform3D WebXRInterfaceJS::get_transform_for_view(uint32_t p_view, const Tran
return p_cam_transform * xr_server->get_reference_frame() * transform_for_eye;
};
-CameraMatrix WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
+CameraMatrix WebXRInterfaceJS::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
CameraMatrix eye;
float *js_matrix = godot_webxr_get_projection_for_eye(p_view + 1);
diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h
index 82307190db..eb77f35f39 100644
--- a/modules/webxr/webxr_interface_js.h
+++ b/modules/webxr/webxr_interface_js.h
@@ -86,7 +86,7 @@ public:
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 CameraMatrix get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) override;
virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) override;
virtual void process() override;