Move passthrough object in xr::session

This commit is contained in:
Patrick Nicolas
2024-11-06 19:46:28 +01:00
parent 6aa28c718e
commit 462b823a52
4 changed files with 41 additions and 26 deletions
+6 -24
View File
@@ -28,7 +28,6 @@
#include "render/scene_data.h"
#include "render/scene_renderer.h"
#include "stream.h"
#include "utils/contains.h"
#include "version.h"
#include "wivrn_client.h"
#include "wivrn_packets.h"
@@ -884,7 +883,7 @@ void scenes::lobby::render(const XrFrameState & frame_state)
[&](auto & p) {
layers_with_z_index.emplace_back(constants::lobby::zindex_passthrough, p.layer());
}},
passthrough);
session.get_passthrough());
}
// Dimming settings if a popup window is displayed
@@ -1120,27 +1119,10 @@ void scenes::lobby::on_focused()
void scenes::lobby::setup_passthrough()
{
auto & passthrough_enabled = application::get_config().passthrough_enabled;
if (not passthrough_enabled)
{
passthrough.emplace<std::monostate>();
return;
}
if (passthrough_supported != xr::system::passthrough_type::no_passthrough)
{
if (utils::contains(system.environment_blend_modes(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO), XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND))
{
passthrough.emplace<xr::passthrough_alpha_blend>();
}
else if (utils::contains(application::get_xr_extensions(), XR_FB_PASSTHROUGH_EXTENSION_NAME))
{
passthrough.emplace<xr::passthrough_fb>(instance, session);
}
else if (utils::contains(application::get_xr_extensions(), XR_HTC_PASSTHROUGH_EXTENSION_NAME))
{
passthrough.emplace<xr::passthrough_htc>(instance, session);
}
}
if (application::get_config().passthrough_enabled)
session.enable_passthrough(system);
else
session.disable_passthrough();
}
void scenes::lobby::on_unfocused()
@@ -1164,7 +1146,7 @@ void scenes::lobby::on_unfocused()
swapchains_lobby_depth.clear();
swapchains_controllers_depth.clear();
swapchain_imgui = xr::swapchain();
passthrough.emplace<std::monostate>();
session.disable_passthrough();
multicast.reset();
}