summaryrefslogtreecommitdiff
path: root/servers/xr
diff options
context:
space:
mode:
Diffstat (limited to 'servers/xr')
-rw-r--r--servers/xr/xr_interface.h2
-rw-r--r--servers/xr/xr_interface_extension.cpp21
-rw-r--r--servers/xr/xr_interface_extension.h6
3 files changed, 17 insertions, 12 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..7fdf90770d 100644
--- a/servers/xr/xr_interface_extension.cpp
+++ b/servers/xr/xr_interface_extension.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "xr_interface_extension.h"
+#include "servers/rendering/renderer_rd/renderer_storage_rd.h"
#include "servers/rendering/renderer_storage.h"
#include "servers/rendering/rendering_server_globals.h"
@@ -186,7 +187,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 +203,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!");
@@ -246,17 +247,21 @@ void XRInterfaceExtension::notification(int p_what) {
}
RID XRInterfaceExtension::get_render_target_texture(RID p_render_target) {
- RendererStorage *storage = RSG::storage;
- ERR_FAIL_NULL_V_MSG(storage, RID(), "Renderer storage not setup");
+ // In due time this will need to be enhance to return the correct INTERNAL RID for the chosen rendering engine.
+ // So once a GLES driver is implemented we'll return that and the implemented plugin needs to handle this correctly too.
+ RendererStorageRD *rd_storage = RendererStorageRD::base_singleton;
+ ERR_FAIL_NULL_V_MSG(rd_storage, RID(), "Renderer storage not setup");
- return storage->render_target_get_texture(p_render_target);
+ return rd_storage->render_target_get_rd_texture(p_render_target);
}
/*
RID XRInterfaceExtension::get_render_target_depth(RID p_render_target) {
- RendererStorage *storage = RSG::storage;
- ERR_FAIL_NULL_V_MSG(storage, RID(), "Renderer storage not setup");
+ // TODO implement this, the problem is that our depth texture isn't part of our render target as it is used for 3D rendering only
+ // but we don't have access to our render buffers from here....
+ RendererSceneRenderRD * rd_scene = ?????;
+ ERR_FAIL_NULL_V_MSG(rd_scene, RID(), "Renderer scene render not setup");
- return storage->render_target_get_depth(p_render_target);
+ return rd_scene->render_buffers_get_depth_texture(????????????);
}
*/
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 &);