diff options
Diffstat (limited to 'modules/openxr/openxr_api.cpp')
-rw-r--r-- | modules/openxr/openxr_api.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 7b777a9845..14a1aaa686 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -56,7 +56,6 @@ #include "extensions/openxr_composition_layer_depth_extension.h" #include "extensions/openxr_fb_display_refresh_rate_extension.h" #include "extensions/openxr_fb_foveation_extension.h" -#include "extensions/openxr_fb_passthrough_extension_wrapper.h" #include "extensions/openxr_fb_update_swapchain_extension.h" #ifdef ANDROID_ENABLED @@ -3099,11 +3098,30 @@ bool OpenXRAPI::is_environment_blend_mode_supported(XrEnvironmentBlendMode p_ble } bool OpenXRAPI::set_environment_blend_mode(XrEnvironmentBlendMode p_blend_mode) { + if (emulate_environment_blend_mode_alpha_blend && p_blend_mode == XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND) { + requested_environment_blend_mode = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND; + environment_blend_mode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE; + return true; + } // We allow setting this when not initialized and will check if it is supported when initializing. // After OpenXR is initialized we verify we're setting a supported blend mode. - if (!is_initialized() || is_environment_blend_mode_supported(p_blend_mode)) { + else if (!is_initialized() || is_environment_blend_mode_supported(p_blend_mode)) { + requested_environment_blend_mode = p_blend_mode; environment_blend_mode = p_blend_mode; return true; } return false; } + +void OpenXRAPI::set_emulate_environment_blend_mode_alpha_blend(bool p_enabled) { + emulate_environment_blend_mode_alpha_blend = p_enabled; +} + +OpenXRAPI::OpenXRAlphaBlendModeSupport OpenXRAPI::is_environment_blend_mode_alpha_blend_supported() { + if (is_environment_blend_mode_supported(XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND)) { + return OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL; + } else if (emulate_environment_blend_mode_alpha_blend) { + return OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING; + } + return OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE; +} |