diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-21 15:16:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 15:16:52 +0200 |
commit | d7b68f376de6463a4ff5152e5714dfa549112abf (patch) | |
tree | 7661700caeeeb3052d8560753ca2138ed077ad0b /servers | |
parent | dc2b06260901249f1510eaafe11d7db91ed5a579 (diff) | |
parent | c527078634dbed724ab487000aea6f3d96b33752 (diff) |
Merge pull request #52177 from BastiaanOlij/xr_doubles
Change to using doubles in XR classes
Diffstat (limited to 'servers')
-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 |
5 files changed, 11 insertions, 11 deletions
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 |