diff options
-rw-r--r-- | modules/mobile_vr/mobile_vr_interface.cpp | 30 | ||||
-rw-r--r-- | modules/mobile_vr/mobile_vr_interface.h | 46 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.cpp | 2 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.h | 2 | ||||
-rw-r--r-- | servers/xr/xr_interface.h | 2 | ||||
-rw-r--r-- | servers/xr/xr_interface_extension.cpp | 4 | ||||
-rw-r--r-- | servers/xr/xr_interface_extension.h | 6 | ||||
-rw-r--r-- | servers/xr_server.cpp | 4 | ||||
-rw-r--r-- | servers/xr_server.h | 6 |
9 files changed, 51 insertions, 51 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; diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h index 4f5d4bad10..534fa18d8a 100644 --- a/servers/xr/xr_interface.h +++ b/servers/xr/xr_interface.h @@ -110,7 +110,7 @@ public: virtual uint32_t get_view_count() = 0; /* returns the view count we need (1 is monoscopic, 2 is stereoscopic but can be more) */ virtual Transform3D get_camera_transform() = 0; /* returns the position of our camera for updating our camera node. For monoscopic this is equal to the views transform, for stereoscopic this should be an average */ virtual Transform3D get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) = 0; /* get each views transform */ - virtual CameraMatrix get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) = 0; /* get each view projection matrix */ + virtual CameraMatrix get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) = 0; /* get each view projection matrix */ // note, external color/depth/vrs texture support will be added here soon. diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp index 6340485bde..315442fc57 100644 --- a/servers/xr/xr_interface_extension.cpp +++ b/servers/xr/xr_interface_extension.cpp @@ -186,7 +186,7 @@ Transform3D XRInterfaceExtension::get_transform_for_view(uint32_t p_view, const return Transform3D(); } -CameraMatrix XRInterfaceExtension::get_projection_for_view(uint32_t p_view, real_t p_aspect, real_t p_z_near, real_t p_z_far) { +CameraMatrix XRInterfaceExtension::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) { CameraMatrix cm; PackedFloat64Array arr; @@ -202,7 +202,7 @@ CameraMatrix XRInterfaceExtension::get_projection_for_view(uint32_t p_view, real return CameraMatrix(); } -void XRInterfaceExtension::add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer, uint32_t p_layer, bool p_apply_lens_distortion, Vector2 p_eye_center, float p_k1, float p_k2, float p_upscale, float p_aspect_ratio) { +void XRInterfaceExtension::add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer, uint32_t p_layer, bool p_apply_lens_distortion, Vector2 p_eye_center, double p_k1, double p_k2, double p_upscale, double p_aspect_ratio) { BlitToScreen blit; ERR_FAIL_COND_MSG(!can_add_blits, "add_blit can only be called from an XR plugin from within _commit_views!"); diff --git a/servers/xr/xr_interface_extension.h b/servers/xr/xr_interface_extension.h index 94914a7b3f..3b7af4c0a2 100644 --- a/servers/xr/xr_interface_extension.h +++ b/servers/xr/xr_interface_extension.h @@ -83,15 +83,15 @@ 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; GDVIRTUAL0R(Size2, _get_render_target_size); GDVIRTUAL0R(uint32_t, _get_view_count); GDVIRTUAL0R(Transform3D, _get_camera_transform); GDVIRTUAL2R(Transform3D, _get_transform_for_view, uint32_t, const Transform3D &); - GDVIRTUAL4R(PackedFloat64Array, _get_projection_for_view, uint32_t, real_t, real_t, real_t); + GDVIRTUAL4R(PackedFloat64Array, _get_projection_for_view, uint32_t, double, double, double); - void add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer = false, uint32_t p_layer = 0, bool p_apply_lens_distortion = false, Vector2 p_eye_center = Vector2(), float p_k1 = 0.0, float p_k2 = 0.0, float p_upscale = 1.0, float p_aspect_ratio = 1.0); + void add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer = false, uint32_t p_layer = 0, bool p_apply_lens_distortion = false, Vector2 p_eye_center = Vector2(), double p_k1 = 0.0, double p_k2 = 0.0, double p_upscale = 1.0, double p_aspect_ratio = 1.0); virtual Vector<BlitToScreen> commit_views(RID p_render_target, const Rect2 &p_screen_rect) override; GDVIRTUAL2(_commit_views, RID, const Rect2 &); diff --git a/servers/xr_server.cpp b/servers/xr_server.cpp index c18a9f8b4e..f6e6e5953f 100644 --- a/servers/xr_server.cpp +++ b/servers/xr_server.cpp @@ -86,11 +86,11 @@ void XRServer::_bind_methods() { ADD_SIGNAL(MethodInfo("tracker_removed", PropertyInfo(Variant::STRING_NAME, "tracker_name"), PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::INT, "id"))); }; -real_t XRServer::get_world_scale() const { +double XRServer::get_world_scale() const { return world_scale; }; -void XRServer::set_world_scale(real_t p_world_scale) { +void XRServer::set_world_scale(double p_world_scale) { if (p_world_scale < 0.01) { p_world_scale = 0.01; } else if (p_world_scale > 1000.0) { diff --git a/servers/xr_server.h b/servers/xr_server.h index af183e175d..6d07263755 100644 --- a/servers/xr_server.h +++ b/servers/xr_server.h @@ -81,7 +81,7 @@ private: Ref<XRInterface> primary_interface; /* we'll identify one interface as primary, this will be used by our viewports */ - real_t world_scale; /* scale by which we multiply our tracker positions */ + double world_scale; /* scale by which we multiply our tracker positions */ Transform3D world_origin; /* our world origin point, maps a location in our virtual world to the origin point in our real world tracking volume */ Transform3D reference_frame; /* our reference frame */ @@ -107,8 +107,8 @@ public: I may remove access to this property in GDScript in favour of exposing it on the XROrigin3D node */ - real_t get_world_scale() const; - void set_world_scale(real_t p_world_scale); + double get_world_scale() const; + void set_world_scale(double p_world_scale); /* The world maps the 0,0,0 coordinate of our real world coordinate system for our tracking volume to a location in our |