From 8ebd6ae7f32715aef7628188bd663f0c5a9f6abc Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 8 Apr 2024 21:34:41 +0200 Subject: [PATCH] Only setup passthrough if requested --- client/scenes/lobby.cpp | 9 +++++++++ client/scenes/lobby.h | 2 ++ client/scenes/lobby_gui.cpp | 1 + 3 files changed, 12 insertions(+) diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp index e5167c29..3a5b05c9 100644 --- a/client/scenes/lobby.cpp +++ b/client/scenes/lobby.cpp @@ -762,7 +762,16 @@ void scenes::lobby::on_focused() { about_picture = imgui_ctx->load_texture("wivrn.png"); } + setup_passthrough(); +} +void scenes::lobby::setup_passthrough() +{ + if (not passthrough_enabled) + { + passthrough.emplace(); + 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)) diff --git a/client/scenes/lobby.h b/client/scenes/lobby.h index 65450911..42850258 100644 --- a/client/scenes/lobby.h +++ b/client/scenes/lobby.h @@ -127,6 +127,8 @@ class lobby : public scene_impl void gui_about(); void gui_keyboard(ImVec2 size); + void setup_passthrough(); + void vibrate_on_hover(); void connect(server_data & data); diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 6a77c556..894414da 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -382,6 +382,7 @@ void scenes::lobby::gui_settings() ImGui::BeginDisabled(passthrough_supported == xr::system::passthrough_type::no_passthrough); if (ImGui::Checkbox("Enable video passthrough in lobby", &passthrough_enabled)) { + setup_passthrough(); save_config(); } vibrate_on_hover();