summaryrefslogtreecommitdiff
path: root/servers/xr
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2021-09-07 09:21:13 +1000
committerGitHub <noreply@github.com>2021-09-07 09:21:13 +1000
commit461d31427c39776ba1bda631f1ce1726c71559a0 (patch)
tree669416b4f423a4c6a066f2aca9d2d07862b311d5 /servers/xr
parent76b83ff615fed6c77766778ad74d277c72dc054b (diff)
parentfbac863bfbe7590cdd30a7e182c67ab372f4e49f (diff)
Merge pull request #52205 from BastiaanOlij/blit_source_rect
Add source rectangle to blit
Diffstat (limited to 'servers/xr')
-rw-r--r--servers/xr/xr_interface_extension.cpp7
-rw-r--r--servers/xr/xr_interface_extension.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp
index 0afbc453fa..5c90139375 100644
--- a/servers/xr/xr_interface_extension.cpp
+++ b/servers/xr/xr_interface_extension.cpp
@@ -41,7 +41,7 @@ void XRInterfaceExtension::_bind_methods() {
GDVIRTUAL_BIND(_get_tracking_status);
- ClassDB::bind_method(D_METHOD("add_blit", "render_target", "rect", "use_layer", "layer", "apply_lens_distortion", "eye_center", "k1", "k2", "upscale", "aspect_ratio"), &XRInterfaceExtension::add_blit);
+ ClassDB::bind_method(D_METHOD("add_blit", "render_target", "src_rect", "dst_rect", "use_layer", "layer", "apply_lens_distortion", "eye_center", "k1", "k2", "upscale", "aspect_ratio"), &XRInterfaceExtension::add_blit);
GDVIRTUAL_BIND(_get_render_target_size);
GDVIRTUAL_BIND(_get_view_count);
@@ -198,13 +198,14 @@ CameraMatrix XRInterfaceExtension::get_projection_for_view(uint32_t p_view, real
return CameraMatrix();
}
-void XRInterfaceExtension::add_blit(RID p_render_target, Rect2i p_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, float p_k1, float p_k2, float p_upscale, float 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!");
blit.render_target = p_render_target;
- blit.rect = p_rect;
+ blit.src_rect = p_src_rect;
+ blit.dst_rect = p_dst_rect;
blit.multi_view.use_layer = p_use_layer;
blit.multi_view.layer = p_layer;
diff --git a/servers/xr/xr_interface_extension.h b/servers/xr/xr_interface_extension.h
index ab4d90bfe6..df6f5f8e35 100644
--- a/servers/xr/xr_interface_extension.h
+++ b/servers/xr/xr_interface_extension.h
@@ -91,7 +91,7 @@ public:
GDVIRTUAL2R(Transform3D, _get_transform_for_view, uint32_t, const Transform3D &);
GDVIRTUAL4R(PackedFloat64Array, _get_projection_for_view, uint32_t, real_t, real_t, real_t);
- void add_blit(RID p_render_target, Rect2i p_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(), float p_k1 = 0.0, float p_k2 = 0.0, float p_upscale = 1.0, float 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 &);