steamvr_lh support
This commit is contained in:
@@ -40,6 +40,8 @@ auto_option(WIVRN_USE_X264 "Enable x264 software encoder" AUTO)
|
||||
auto_option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" AUTO)
|
||||
auto_option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" AUTO)
|
||||
|
||||
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
|
||||
|
||||
option(WIVRN_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH OFF)
|
||||
|
||||
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
|
||||
|
||||
@@ -29,4 +29,6 @@
|
||||
#cmakedefine WIVRN_USE_PIPEWIRE
|
||||
#cmakedefine WIVRN_USE_PULSEAUDIO
|
||||
|
||||
#cmakedefine WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
||||
|
||||
#define WIVRN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||
|
||||
@@ -15,7 +15,7 @@ set(XRT_BUILD_DRIVER_REMOTE OFF)
|
||||
set(XRT_BUILD_DRIVER_RIFT_S OFF)
|
||||
set(XRT_BUILD_DRIVER_ROKID OFF)
|
||||
set(XRT_BUILD_DRIVER_SIMULATED OFF)
|
||||
set(XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE OFF)
|
||||
set(XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE ${WIVRN_FEATURE_STEAMVR_LIGHTHOUSE})
|
||||
set(XRT_BUILD_DRIVER_TWRAP OFF)
|
||||
set(XRT_BUILD_DRIVER_VF OFF)
|
||||
set(XRT_BUILD_DRIVER_VIVE OFF)
|
||||
@@ -29,9 +29,6 @@ set(XRT_FEATURE_SERVICE_SYSTEMD OFF)
|
||||
set(XRT_FEATURE_SLAM OFF)
|
||||
set(XRT_FEATURE_STEAMVR_PLUGIN OFF)
|
||||
set(XRT_FEATURE_WINDOW_PEEK OFF)
|
||||
set(XRT_FEATURE_STEAMVR_PLUGIN OFF)
|
||||
set(XRT_FEATURE_WINDOW_PEEK OFF)
|
||||
set(XRT_FEATURE_WINDOW_PEEK OFF)
|
||||
set(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB ON)
|
||||
|
||||
set(XRT_HAVE_BLUETOOTH OFF)
|
||||
@@ -101,6 +98,11 @@ target_include_directories(wivrn-server PRIVATE .)
|
||||
|
||||
target_link_libraries(wivrn-server PRIVATE CLI11::CLI11)
|
||||
|
||||
if (WIVRN_FEATURE_STEAMVR_LIGHTHOUSE)
|
||||
target_include_directories(wivrn-server SYSTEM PRIVATE ${monado_SOURCE_DIR}/src/xrt/drivers/steamvr_lh/)
|
||||
target_link_libraries(wivrn-server PRIVATE drv_steamvr_lh)
|
||||
endif()
|
||||
|
||||
if(WIVRN_USE_NVENC)
|
||||
target_sources(wivrn-server PRIVATE encoder/video_encoder_nvenc.cpp)
|
||||
endif()
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "audio/audio_setup.h"
|
||||
#include "wivrn_comp_target.h"
|
||||
#include "wivrn_config.h"
|
||||
#include "wivrn_controller.h"
|
||||
#include "wivrn_eye_tracker.h"
|
||||
#include "wivrn_fb_face2_tracker.h"
|
||||
@@ -44,6 +45,10 @@
|
||||
#include <magic_enum.hpp>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#ifdef WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
||||
#include "steamvr_lh_interface.h"
|
||||
#endif
|
||||
|
||||
struct wivrn_comp_target_factory : public comp_target_factory
|
||||
{
|
||||
std::shared_ptr<wivrn_session> session;
|
||||
@@ -162,13 +167,43 @@ xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wi
|
||||
if (self->hmd->face_tracking_supported)
|
||||
usysds->base.base.static_roles.face = self->hmd.get();
|
||||
|
||||
if (self->left_hand)
|
||||
xrt_device * active_left_hand = nullptr;
|
||||
xrt_device * active_right_hand = nullptr;
|
||||
|
||||
#ifdef WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
|
||||
auto use_steamvr_lh = std::getenv("WIVRN_USE_STEAMVR_LH");
|
||||
xrt_system_devices * lhdevs = NULL;
|
||||
|
||||
if (use_steamvr_lh && steamvr_lh_create_devices(&lhdevs) == XRT_SUCCESS)
|
||||
{
|
||||
for (int i = 0; i < lhdevs->xdev_count; i++)
|
||||
{
|
||||
auto lhdev = lhdevs->xdevs[i];
|
||||
devices->xdevs[n++] = lhdev;
|
||||
switch (lhdev->device_type)
|
||||
{
|
||||
case XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER:
|
||||
active_left_hand = lhdev;
|
||||
break;
|
||||
case XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER:
|
||||
active_right_hand = lhdev;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (self->left_hand && !active_left_hand)
|
||||
{
|
||||
active_left_hand = self->left_hand.get();
|
||||
devices->xdevs[n++] = self->left_hand.get();
|
||||
usysds->base.base.static_roles.hand_tracking.left = self->left_hand.get();
|
||||
}
|
||||
if (self->right_hand)
|
||||
if (self->right_hand && !active_right_hand)
|
||||
{
|
||||
active_right_hand = self->right_hand.get();
|
||||
devices->xdevs[n++] = self->right_hand.get();
|
||||
usysds->base.base.static_roles.hand_tracking.right = self->right_hand.get();
|
||||
}
|
||||
@@ -187,7 +222,7 @@ xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wi
|
||||
}
|
||||
devices->xdev_count = n;
|
||||
|
||||
u_system_devices_static_finalize(usysds, self->left_hand.get(), self->right_hand.get());
|
||||
u_system_devices_static_finalize(usysds, active_left_hand, active_right_hand);
|
||||
|
||||
wivrn_comp_target_factory ctf(self, self->info.preferred_refresh_rate);
|
||||
auto xret = comp_main_create_system_compositor(self->hmd.get(), &ctf, out_xsysc);
|
||||
|
||||
Reference in New Issue
Block a user