Move passthrough object in xr::session
This commit is contained in:
+6
-24
@@ -28,7 +28,6 @@
|
|||||||
#include "render/scene_data.h"
|
#include "render/scene_data.h"
|
||||||
#include "render/scene_renderer.h"
|
#include "render/scene_renderer.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "utils/contains.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "wivrn_client.h"
|
#include "wivrn_client.h"
|
||||||
#include "wivrn_packets.h"
|
#include "wivrn_packets.h"
|
||||||
@@ -884,7 +883,7 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
|||||||
[&](auto & p) {
|
[&](auto & p) {
|
||||||
layers_with_z_index.emplace_back(constants::lobby::zindex_passthrough, p.layer());
|
layers_with_z_index.emplace_back(constants::lobby::zindex_passthrough, p.layer());
|
||||||
}},
|
}},
|
||||||
passthrough);
|
session.get_passthrough());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dimming settings if a popup window is displayed
|
// Dimming settings if a popup window is displayed
|
||||||
@@ -1120,27 +1119,10 @@ void scenes::lobby::on_focused()
|
|||||||
|
|
||||||
void scenes::lobby::setup_passthrough()
|
void scenes::lobby::setup_passthrough()
|
||||||
{
|
{
|
||||||
auto & passthrough_enabled = application::get_config().passthrough_enabled;
|
if (application::get_config().passthrough_enabled)
|
||||||
if (not passthrough_enabled)
|
session.enable_passthrough(system);
|
||||||
{
|
else
|
||||||
passthrough.emplace<std::monostate>();
|
session.disable_passthrough();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void scenes::lobby::on_unfocused()
|
void scenes::lobby::on_unfocused()
|
||||||
@@ -1164,7 +1146,7 @@ void scenes::lobby::on_unfocused()
|
|||||||
swapchains_lobby_depth.clear();
|
swapchains_lobby_depth.clear();
|
||||||
swapchains_controllers_depth.clear();
|
swapchains_controllers_depth.clear();
|
||||||
swapchain_imgui = xr::swapchain();
|
swapchain_imgui = xr::swapchain();
|
||||||
passthrough.emplace<std::monostate>();
|
session.disable_passthrough();
|
||||||
multicast.reset();
|
multicast.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "wivrn_discover.h"
|
#include "wivrn_discover.h"
|
||||||
#include <vulkan/vulkan_raii.hpp>
|
#include <vulkan/vulkan_raii.hpp>
|
||||||
|
|
||||||
#include "xr/passthrough.h"
|
|
||||||
#include "xr/system.h"
|
#include "xr/system.h"
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -88,7 +87,6 @@ class lobby : public scene_impl<lobby>
|
|||||||
vk::Format swapchain_format;
|
vk::Format swapchain_format;
|
||||||
vk::Format depth_format;
|
vk::Format depth_format;
|
||||||
xr::system::passthrough_type passthrough_supported;
|
xr::system::passthrough_type passthrough_supported;
|
||||||
xr::passthrough passthrough;
|
|
||||||
XrViewConfigurationView stream_view;
|
XrViewConfigurationView stream_view;
|
||||||
|
|
||||||
#if WIVRN_CLIENT_DEBUG_MENU
|
#if WIVRN_CLIENT_DEBUG_MENU
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
|
#include "application.h"
|
||||||
#include "details/enumerate.h"
|
#include "details/enumerate.h"
|
||||||
#include "xr/instance.h"
|
#include "xr/instance.h"
|
||||||
|
#include "utils/contains.h"
|
||||||
#include "xr/system.h"
|
#include "xr/system.h"
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
@@ -342,3 +344,27 @@ void xr::session::sync_actions(XrActionSet action_set, const std::string & subac
|
|||||||
{
|
{
|
||||||
sync_actions(action_set, inst->string_to_path(subaction_path));
|
sync_actions(action_set, inst->string_to_path(subaction_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xr::session::enable_passthrough(xr::system & system)
|
||||||
|
{
|
||||||
|
if (system.passthrough_supported() == xr::system::passthrough_type::no_passthrough)
|
||||||
|
return;
|
||||||
|
|
||||||
|
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>(*inst, *this);
|
||||||
|
}
|
||||||
|
else if (utils::contains(application::get_xr_extensions(), XR_HTC_PASSTHROUGH_EXTENSION_NAME))
|
||||||
|
{
|
||||||
|
passthrough.emplace<xr::passthrough_htc>(*inst, *this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void xr::session::disable_passthrough()
|
||||||
|
{
|
||||||
|
passthrough.emplace<std::monostate>();
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "fb_face_tracker2.h"
|
#include "fb_face_tracker2.h"
|
||||||
#include "hand_tracker.h"
|
#include "hand_tracker.h"
|
||||||
|
#include "passthrough.h"
|
||||||
#include "space.h"
|
#include "space.h"
|
||||||
|
|
||||||
namespace xr
|
namespace xr
|
||||||
@@ -38,6 +39,7 @@ class system;
|
|||||||
class session : public utils::handle<XrSession, xrDestroySession>
|
class session : public utils::handle<XrSession, xrDestroySession>
|
||||||
{
|
{
|
||||||
instance * inst = nullptr;
|
instance * inst = nullptr;
|
||||||
|
xr::passthrough passthrough;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
session() = default;
|
session() = default;
|
||||||
@@ -77,5 +79,12 @@ public:
|
|||||||
void sync_actions(XrActionSet action_set, const std::string & subaction_path);
|
void sync_actions(XrActionSet action_set, const std::string & subaction_path);
|
||||||
|
|
||||||
void sync_actions(std::span<XrActionSet> action_sets);
|
void sync_actions(std::span<XrActionSet> action_sets);
|
||||||
|
|
||||||
|
void enable_passthrough(xr::system &);
|
||||||
|
void disable_passthrough();
|
||||||
|
xr::passthrough & get_passthrough()
|
||||||
|
{
|
||||||
|
return passthrough;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace xr
|
} // namespace xr
|
||||||
|
|||||||
Reference in New Issue
Block a user