diff options
Diffstat (limited to 'servers/xr/xr_interface_extension.cpp')
-rw-r--r-- | servers/xr/xr_interface_extension.cpp | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp index 7395cd5ad4..0d4a53d287 100644 --- a/servers/xr/xr_interface_extension.cpp +++ b/servers/xr/xr_interface_extension.cpp @@ -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); @@ -264,7 +273,7 @@ Projection XRInterfaceExtension::get_projection_for_view(uint32_t p_view, double if (GDVIRTUAL_CALL(_get_projection_for_view, p_view, p_aspect, p_z_near, p_z_far, arr)) { ERR_FAIL_COND_V_MSG(arr.size() != 16, Projection(), "Projection matrix must contain 16 floats"); - real_t *m = (real_t *)cm.matrix; + real_t *m = (real_t *)cm.columns; for (int i = 0; i < 16; i++) { m[i] = arr[i]; } @@ -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; @@ -358,9 +394,5 @@ RID XRInterfaceExtension::get_render_target_texture(RID p_render_target) { RID XRInterfaceExtension::get_render_target_depth(RID p_render_target) { // 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 rd_scene->render_buffers_get_depth_texture(????????????); } */ |