steamvr_lh support
This commit is contained in:
@@ -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