Refactor xr::handle

This commit is contained in:
Patrick Nicolas
2024-06-16 12:07:38 +02:00
parent a7e8b281d3
commit 03c12a9aaf
18 changed files with 98 additions and 151 deletions
+5 -4
View File
@@ -628,6 +628,9 @@ void scenes::lobby::render(const XrFrameState & frame_state)
{
std::visit(
overloaded{
[&](std::monostate &) {
assert(false);
},
[&](xr::passthrough_alpha_blend & p) {
blend_mode = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND;
},
@@ -744,7 +747,7 @@ void scenes::lobby::setup_passthrough()
auto & passthrough_enabled = application::get_config().passthrough_enabled;
if (not passthrough_enabled)
{
passthrough.emplace<xr::passthrough_fb>();
passthrough.emplace<std::monostate>();
return;
}
if (passthrough_supported != xr::system::passthrough_type::no_passthrough)
@@ -761,8 +764,6 @@ void scenes::lobby::setup_passthrough()
{
passthrough.emplace<xr::passthrough_htc>(instance, session);
}
std::visit([](auto & p) { p.start(); }, passthrough);
}
}
@@ -785,7 +786,7 @@ void scenes::lobby::on_unfocused()
swapchains_lobby.clear();
swapchains_controllers.clear();
swapchain_imgui = xr::swapchain();
passthrough.emplace<xr::passthrough_fb>(); // default constructor does no passthrough
passthrough.emplace<std::monostate>();
wifi_lock::want_multicast(false);
}
+1
View File
@@ -28,6 +28,7 @@
#include <vulkan/vulkan_raii.hpp>
#include "xr/passthrough.h"
#include "xr/system.h"
#include <optional>
#include <vector>
+1 -1
View File
@@ -76,7 +76,7 @@ private:
std::atomic<bool> exiting = false;
std::thread network_thread;
std::mutex local_floor_mutex;
xr::space local_floor = nullptr;
xr::space local_floor;
std::atomic<std::chrono::nanoseconds::rep> tracking_prediction_offset;
std::optional<std::thread> tracking_thread;