1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Adding getters to RenderTarget and implementing override functionality for XR

This commit is contained in:
Bastiaan Olij
2022-09-01 18:10:53 +10:00
parent 4eb9e3326e
commit c7656978ba
30 changed files with 803 additions and 330 deletions

View File

@@ -74,6 +74,15 @@ void XRInterfaceExtension::_bind_methods() {
GDVIRTUAL_BIND(_set_anchor_detection_is_enabled, "enabled");
GDVIRTUAL_BIND(_get_camera_feed_id);
// override output methods
GDVIRTUAL_BIND(_get_color_texture);
GDVIRTUAL_BIND(_get_depth_texture);
GDVIRTUAL_BIND(_get_velocity_texture);
ClassDB::bind_method(D_METHOD("get_color_texture"), &XRInterfaceExtension::get_color_texture);
ClassDB::bind_method(D_METHOD("get_depth_texture"), &XRInterfaceExtension::get_depth_texture);
ClassDB::bind_method(D_METHOD("get_velocity_texture"), &XRInterfaceExtension::get_velocity_texture);
// helper methods
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);
ClassDB::bind_method(D_METHOD("get_render_target_texture", "render_target"), &XRInterfaceExtension::get_render_target_texture);
@@ -283,6 +292,33 @@ RID XRInterfaceExtension::get_vrs_texture() {
}
}
RID XRInterfaceExtension::get_color_texture() {
RID texture;
if (GDVIRTUAL_CALL(_get_color_texture, texture)) {
return texture;
} else {
return RID();
}
}
RID XRInterfaceExtension::get_depth_texture() {
RID texture;
if (GDVIRTUAL_CALL(_get_depth_texture, texture)) {
return texture;
} else {
return RID();
}
}
RID XRInterfaceExtension::get_velocity_texture() {
RID texture;
if (GDVIRTUAL_CALL(_get_velocity_texture, texture)) {
return texture;
} else {
return RID();
}
}
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;