diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6bb9d6b9..dddc5896 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -60,6 +60,7 @@
+
interaction_profiles{
"/user/hand/right/input/thumbstick/touch",
"/user/hand/right/input/thumbrest/touch",
}},
+ interaction_profile{
+ "/interaction_profiles/htc/vive_xr_tracker",
+ {"XR_HTC_vive_xr_tracker_interaction", "XR_HTC_path_enumeration"},
+ {},
+ },
interaction_profile{
"/interaction_profiles/ext/eye_gaze_interaction",
{"XR_EXT_eye_gaze_interaction"},
@@ -895,6 +900,8 @@ void application::initialize_actions()
{
spdlog::debug("Initializing actions");
+ auto * htc_body = std::get_if(&body_tracker);
+
// Build an action set with all possible input sources
std::vector action_sets;
xr_actionset = xr::actionset(xr_instance, "all_actions", "All actions");
@@ -921,6 +928,18 @@ void application::initialize_actions()
profile.input_sources.push_back("/user/hand/right/input/palm_ext/pose");
}
+ // Dynamically add VIVE XR Trackers to the profile if available
+ if (htc_body && utils::contains(profile.required_extensions, XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME))
+ {
+ for (const auto & user_path: htc_body->get_paths())
+ {
+ for (const auto & input_path: htc_body->get_paths(user_path))
+ {
+ profile.input_sources.push_back(path_to_string(user_path) + path_to_string(input_path));
+ }
+ }
+ }
+
suggested_bindings.emplace(profile.profile_name, std::vector{});
for (const std::string & source: profile.input_sources)
@@ -957,6 +976,8 @@ void application::initialize_actions()
spaces[size_t(xr::spaces::palm_right)] = xr_session.create_action_space(a);
else if (name == "/user/hand/left/input/palm_ext/pose")
spaces[size_t(xr::spaces::palm_left)] = xr_session.create_action_space(a);
+ else if (name.contains("/input/entity_htc/pose") && htc_body)
+ htc_body->add(xr_session.create_action_space(a));
}
// Build an action set for each scene
@@ -1040,6 +1061,8 @@ void application::initialize()
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
opt_extensions.push_back(XR_HTC_PASSTHROUGH_EXTENSION_NAME);
opt_extensions.push_back(XR_HTC_FACIAL_TRACKING_EXTENSION_NAME);
+ opt_extensions.push_back(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME);
+ opt_extensions.push_back(XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_FACE_TRACKING2_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_BODY_TRACKING_EXTENSION_NAME);
opt_extensions.push_back(XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME);
@@ -1145,20 +1168,6 @@ void application::initialize()
htc_face_tracking_lip_supported = htc_face_properties.supportLipFacialTracking;
}
- if (utils::contains_all(xr_extensions, std::array{XR_FB_BODY_TRACKING_EXTENSION_NAME, XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME, XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME}))
- {
- XrSystemBodyTrackingPropertiesFB fb_body_properties = xr_system_id.fb_body_tracking_properties();
- spdlog::info(" FB body tracking support: {}", (bool)fb_body_properties.supportsBodyTracking);
- fb_body_tracking_supported = fb_body_properties.supportsBodyTracking;
- }
-
- if (utils::contains(xr_extensions, XR_BD_BODY_TRACKING_EXTENSION_NAME))
- {
- XrSystemBodyTrackingPropertiesBD bd_body_properties = xr_system_id.bd_body_tracking_properties();
- spdlog::info(" PICO body tracking support: {}", (bool)bd_body_properties.supportsBodyTracking);
- pico_body_tracking_supported = bd_body_properties.supportsBodyTracking;
- }
-
if (utils::contains(xr_extensions, XR_FB_COMPOSITION_LAYER_SETTINGS_EXTENSION_NAME))
{
spdlog::info(" OpenXR post-processing extension support: true");
@@ -1223,14 +1232,26 @@ void application::initialize()
pico_face_tracker = xr_session.create_pico_face_tracker();
}
- if (fb_body_tracking_supported)
+ if (utils::contains_all(xr_extensions, std::array{XR_FB_BODY_TRACKING_EXTENSION_NAME, XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME, XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME}))
{
- fb_body_tracker = xr_session.create_fb_body_tracker();
+ XrSystemBodyTrackingPropertiesFB fb_body_properties = xr_system_id.fb_body_tracking_properties();
+ spdlog::info(" FB body tracking support: {}", (bool)fb_body_properties.supportsBodyTracking);
+ if (fb_body_properties.supportsBodyTracking)
+ body_tracker = xr_session.create_fb_body_tracker();
}
- if (pico_body_tracking_supported)
+ if (std::holds_alternative(body_tracker) && utils::contains_all(xr_extensions, std::array{XR_HTC_PATH_ENUMERATION_EXTENSION_NAME, XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME}))
{
- pico_body_tracker = xr_session.create_pico_body_tracker();
+ spdlog::info(" HTC body tracking support: true");
+ body_tracker = xr_session.create_htc_body_tracker();
+ }
+
+ if (std::holds_alternative(body_tracker) && utils::contains(xr_extensions, XR_BD_BODY_TRACKING_EXTENSION_NAME))
+ {
+ XrSystemBodyTrackingPropertiesBD bd_body_properties = xr_system_id.bd_body_tracking_properties();
+ spdlog::info(" PICO body tracking support: {}", (bool)bd_body_properties.supportsBodyTracking);
+ if (bd_body_properties.supportsBodyTracking)
+ body_tracker = xr_session.create_pico_body_tracker();
}
vk::CommandPoolCreateInfo cmdpool_create_info;
@@ -1767,7 +1788,13 @@ void application::poll_events()
exit_requested = true;
}
break;
- case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED:
+ case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED: {
+ if (auto * htc_body = std::get_if(&body_tracker))
+ {
+ htc_body->update_active();
+ }
+ }
+ break;
case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING:
break;
case XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED: {
diff --git a/client/application.h b/client/application.h
index b429cf50..6a2d8af2 100644
--- a/client/application.h
+++ b/client/application.h
@@ -24,7 +24,9 @@
#include "xr/fb_body_tracker.h"
#include "xr/fb_face_tracker2.h"
#include "xr/hand_tracker.h"
+#include "xr/htc_body_tracker.h"
#include "xr/htc_face_tracker.h"
+#include "xr/pico_body_tracker.h"
#include "xr/pico_face_tracker.h"
#ifdef __ANDROID__
#include
@@ -138,10 +140,7 @@ class application : public singleton
bool pico_face_tracking_supported = false;
xr::pico_face_tracker pico_face_tracker;
- bool fb_body_tracking_supported = false;
- xr::fb_body_tracker fb_body_tracker;
- bool pico_body_tracking_supported = false;
- xr::pico_body_tracker pico_body_tracker;
+ std::variant body_tracker;
bool eye_gaze_supported = false;
@@ -451,14 +450,9 @@ public:
return instance().pico_face_tracking_supported;
}
- static bool get_fb_body_tracking_supported()
+ static bool get_body_tracking_supported()
{
- return instance().fb_body_tracking_supported;
- }
-
- static bool get_pico_body_tracking_supported()
- {
- return instance().pico_body_tracking_supported;
+ return !std::holds_alternative(instance().body_tracker);
}
static bool get_eye_gaze_supported()
@@ -501,14 +495,9 @@ public:
return instance().pico_face_tracker;
}
- static xr::fb_body_tracker & get_fb_body_tracker()
+ static auto & get_body_tracker()
{
- return instance().fb_body_tracker;
- }
-
- static xr::pico_body_tracker & get_pico_body_tracker()
- {
- return instance().pico_body_tracker;
+ return instance().body_tracker;
}
static const std::vector & get_xr_extensions()
diff --git a/client/configuration.cpp b/client/configuration.cpp
index ca8685e6..82b1f140 100644
--- a/client/configuration.cpp
+++ b/client/configuration.cpp
@@ -127,7 +127,13 @@ bool configuration::check_feature(feature f) const
{
case model::meta_quest_3:
case model::meta_quest_3s:
- if (not application::get_fb_body_tracking_supported())
+ if (not std::holds_alternative(application::get_body_tracker()))
+ return false;
+ break;
+ case model::htc_vive_focus_3:
+ case model::htc_vive_xr_elite:
+ case model::htc_vive_focus_vision:
+ if (not std::holds_alternative(application::get_body_tracker()))
return false;
break;
case model::pico_neo_3:
@@ -135,7 +141,7 @@ bool configuration::check_feature(feature f) const
case model::pico_4s:
case model::pico_4_pro:
case model::pico_4_enterprise:
- if (not application::get_pico_body_tracking_supported())
+ if (not std::holds_alternative(application::get_body_tracker()))
return false;
break;
default:
diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp
index 740c08fa..8eb550e9 100644
--- a/client/scenes/lobby_gui.cpp
+++ b/client/scenes/lobby_gui.cpp
@@ -32,6 +32,7 @@
#include "lobby.h"
#include "stream.h"
#include "utils/i18n.h"
+#include "utils/overloaded.h"
#include "version.h"
#include
#include
@@ -741,7 +742,7 @@ void scenes::lobby::gui_settings()
}
{
- ImGui::BeginDisabled(not(application::get_fb_body_tracking_supported() or application::get_pico_body_tracking_supported()));
+ ImGui::BeginDisabled(not application::get_body_tracking_supported());
bool enabled = config.check_feature(feature::body_tracking);
if (ImGui::Checkbox(_S("Enable body tracking"), &enabled))
{
@@ -757,16 +758,19 @@ void scenes::lobby::gui_settings()
}
else
{
- if (application::get_fb_body_tracking_supported())
- tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
- else if (application::get_pico_body_tracking_supported())
- tooltip(_("Uses the Pico Motion Trackers to track body joint positions"));
+ std::visit(utils::overloaded{
+ [](auto &) {},
+ [this](xr::fb_body_tracker &) {
+ tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
+ },
+ },
+ application::get_body_tracker());
}
}
vibrate_on_hover();
}
- if (application::get_fb_body_tracking_supported())
+ if (std::holds_alternative(application::get_body_tracker()))
{
ImGui::BeginDisabled(not config.check_feature(feature::body_tracking));
ImGui::Indent();
@@ -1485,7 +1489,7 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
});
}
- if (application::get_fb_body_tracking_supported() or application::get_pico_body_tracking_supported())
+ if (application::get_body_tracking_supported())
{
items.push_back({
.f = feature::body_tracking,
diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp
index c4a0aa88..e74954d3 100644
--- a/client/scenes/stream.cpp
+++ b/client/scenes/stream.cpp
@@ -18,6 +18,8 @@
*/
#include "utils/overloaded.h"
#include "xr/fb_body_tracker.h"
+#include "xr/htc_body_tracker.h"
+#include "xr/pico_body_tracker.h"
#define GLM_FORCE_RADIANS
#include "stream.h"
@@ -228,10 +230,15 @@ std::shared_ptr scenes::stream::create(std::unique_ptr
#include
#include
@@ -244,6 +246,7 @@ void scenes::stream::tracking()
const bool hand_tracking = config.check_feature(feature::hand_tracking);
from_headset::face_type face_tracking = from_headset::face_type::none;
+ const bool body_tracking = config.check_feature(feature::body_tracking);
if (config.check_feature(feature::face_tracking))
{
if (application::get_fb_face_tracking2_supported())
@@ -260,26 +263,17 @@ void scenes::stream::tracking()
}
}
- enum
+ auto & body_tracker = application::get_body_tracker();
+ if (body_tracking)
{
- body_none,
- body_fb,
- body_pico,
- } body_tracking = body_none;
-
- if (config.check_feature(feature::body_tracking))
- {
- if (application::get_fb_body_tracking_supported())
+ if (auto * body_fb = std::get_if(&body_tracker))
{
- body_tracking = body_fb;
// TODO maybe handle reconnection better, if the settings are changed since
// last connection to running server, the tracker count will mismatch and
// stuff might break
- application::get_fb_body_tracker().stop();
- application::get_fb_body_tracker().start(config.fb_lower_body, config.fb_hip);
+ body_fb->stop();
+ body_fb->start(config.fb_lower_body, config.fb_hip);
}
- else if (application::get_pico_body_tracking_supported())
- body_tracking = body_pico;
}
on_interaction_profile_changed({});
@@ -360,29 +354,26 @@ void scenes::stream::tracking()
locate_hands(application::get_right_hand(), world_space, t0 + Δt));
}
- if (body_tracking != body_none and t0 >= last_body_sample + period and
- (Δt == 0 or Δt >= prediction - 2 * period))
- {
- last_body_sample = t0;
- if (control.enabled[size_t(tid::generic_tracker)])
- {
- auto & body_packet = body.emplace_back(from_headset::body_tracking{
- .production_timestamp = t0,
- .timestamp = t0 + Δt,
- });
- switch (body_tracking)
- {
- case body_none:
- __builtin_unreachable();
- case body_fb:
- body_packet.poses = application::get_fb_body_tracker().locate_spaces(t0 + Δt, world_space);
- break;
- case body_pico:
- body_packet.poses = application::get_pico_body_tracker().locate_spaces(t0 + Δt, world_space);
- break;
- }
- }
- }
+ if (body_tracking)
+ std::visit(utils::overloaded{
+ [](std::monostate &) {},
+ [&](auto & b) {
+ if (t0 >= last_body_sample + period and
+ (Δt == 0 or Δt >= prediction - 2 * period))
+ {
+ last_body_sample = t0;
+ if (control.enabled[size_t(tid::generic_tracker)])
+ {
+ body.push_back(from_headset::body_tracking{
+ .production_timestamp = t0,
+ .timestamp = t0 + Δt,
+ .poses = b.locate_spaces(t0 + Δt, world_space),
+ });
+ }
+ }
+ },
+ },
+ body_tracker);
if (control.enabled[size_t(tid::face)])
{
diff --git a/client/xr/details/enumerate.h b/client/xr/details/enumerate.h
index b0d50d14..79d63740 100644
--- a/client/xr/details/enumerate.h
+++ b/client/xr/details/enumerate.h
@@ -26,6 +26,7 @@
#include "utils/typename.h"
#include "xr/check.h"
#include
+#include
#include
#include
#include
diff --git a/client/xr/fb_body_tracker.cpp b/client/xr/fb_body_tracker.cpp
index 34610190..f3d30dd1 100644
--- a/client/xr/fb_body_tracker.cpp
+++ b/client/xr/fb_body_tracker.cpp
@@ -17,6 +17,7 @@
*/
#include "fb_body_tracker.h"
+#include "application.h"
#include "spdlog/spdlog.h"
#include "xr/meta_body_tracking_fidelity.h"
#include "xr/xr.h"
@@ -82,6 +83,11 @@ void xr::fb_body_tracker::stop()
CHECK_XR(xrDestroyBodyTrackerFB(std::exchange(handle, nullptr)));
}
}
+size_t xr::fb_body_tracker::count() const
+{
+ const auto & config = application::get_config();
+ return get_whitelisted_joints(config.fb_lower_body, config.fb_hip).size();
+}
std::optional> xr::fb_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{
diff --git a/client/xr/fb_body_tracker.h b/client/xr/fb_body_tracker.h
index 70715ec3..94ca4fc9 100644
--- a/client/xr/fb_body_tracker.h
+++ b/client/xr/fb_body_tracker.h
@@ -65,6 +65,7 @@ public:
void start(bool lower_body, bool hip);
void stop();
+ size_t count() const;
std::optional> locate_spaces(XrTime time, XrSpace reference);
};
diff --git a/client/xr/htc_body_tracker.cpp b/client/xr/htc_body_tracker.cpp
new file mode 100644
index 00000000..b2d0b2ab
--- /dev/null
+++ b/client/xr/htc_body_tracker.cpp
@@ -0,0 +1,156 @@
+/*
+ * WiVRn VR streaming
+ * Copyright (C) 2025 Awzri
+ * Copyright (C) 2025 Sapphire
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "htc_body_tracker.h"
+#include "xr/details/enumerate.h"
+#include "xr/htc_exts.h"
+#include "xr/xr.h"
+#include
+
+// Note: This utilizes extensions not present in the OpenXR spec!
+// For more info see:
+// https://hub.vive.com/apidoc/api/VIVE.OpenXR.Tracker.ViveXRTracker.html
+// https://hub.vive.com/apidoc/api/VIVE.OpenXR.VivePathEnumerationHelper.xrEnumeratePathsForInteractionProfileHTCDelegate.html
+
+xr::vive_xr_tracker::vive_xr_tracker(xr::space && space) :
+ space(std::move(space)) {}
+void xr::vive_xr_tracker::set_active(bool active)
+{
+ is_active = active;
+}
+bool xr::vive_xr_tracker::get_active() const
+{
+ return is_active;
+}
+XrSpace xr::vive_xr_tracker::get_space() const
+{
+ return space;
+}
+
+static wivrn::from_headset::body_tracking::pose locate_space(XrSpace space, XrSpace reference, XrTime time)
+{
+ XrSpaceVelocity velocity{
+ .type = XR_TYPE_SPACE_VELOCITY,
+ };
+
+ XrSpaceLocation location{
+ .type = XR_TYPE_SPACE_LOCATION,
+ .next = &velocity,
+ };
+
+ xrLocateSpace(space, reference, time, &location);
+
+ wivrn::from_headset::body_tracking::pose res{
+ .pose = location.pose,
+ .flags = 0,
+ };
+
+ if (location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT)
+ res.flags |= wivrn::from_headset::body_tracking::orientation_valid;
+
+ if (location.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
+ res.flags |= wivrn::from_headset::body_tracking::position_valid;
+
+ if (location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT)
+ res.flags |= wivrn::from_headset::body_tracking::orientation_tracked;
+
+ if (location.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT)
+ res.flags |= wivrn::from_headset::body_tracking::position_tracked;
+
+ return res;
+}
+
+std::vector xr::htc_body_tracker::get_roles()
+{
+ auto paths = get_paths();
+ std::vector roles{};
+ roles.reserve(paths.size());
+
+ for (auto & path: paths)
+ {
+ XrInputSourceLocalizedNameGetInfo get_info{
+ .type = XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO,
+ .next = nullptr,
+ .sourcePath = path,
+ .whichComponents = XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT,
+ };
+
+ roles.emplace_back(xr::details::enumerate(xrGetInputSourceLocalizedName, s, &get_info));
+ }
+
+ return roles;
+}
+
+xr::htc_body_tracker::htc_body_tracker(instance & inst, session & s) :
+ inst(&inst),
+ s(s)
+{
+ xrEnumeratePathsForInteractionProfileHTC = inst.get_proc("xrEnumeratePathsForInteractionProfileHTC");
+}
+
+std::vector xr::htc_body_tracker::get_paths(XrPath user_path)
+{
+ assert(xrEnumeratePathsForInteractionProfileHTC);
+ XrPath tracker_profile = inst->string_to_path("/interaction_profiles/htc/vive_xr_tracker");
+
+ XrPathsForInteractionProfileEnumerateInfoHTC profile_info{
+ .type = XR_TYPE_UNKNOWN,
+ .next = nullptr,
+ .interactionProfile = tracker_profile,
+ .userPath = user_path,
+ };
+ return xr::details::enumerate(xrEnumeratePathsForInteractionProfileHTC, *inst, profile_info);
+}
+
+void xr::htc_body_tracker::add(xr::space && space)
+{
+ trackers.emplace_back(std::move(space));
+}
+size_t xr::htc_body_tracker::count() const
+{
+ return trackers.size();
+}
+
+void xr::htc_body_tracker::update_active()
+{
+ auto roles = get_roles();
+ assert(roles.size() >= trackers.size());
+ for (int i = 0; i < trackers.size(); i++)
+ trackers[i].set_active(!roles[i].contains('_'));
+}
+
+std::array xr::htc_body_tracker::locate_spaces(XrTime time, XrSpace reference)
+{
+ std::array poses{};
+
+ for (int i = 0; i < trackers.size(); i++)
+ {
+ auto & tracker = trackers.at(i);
+ wivrn::from_headset::body_tracking::pose pose{
+ .pose = {},
+ .flags = 0,
+ };
+ if (tracker.get_active())
+ pose = locate_space(tracker.get_space(), reference, time);
+
+ poses[i] = pose;
+ }
+
+ return poses;
+}
diff --git a/client/xr/htc_body_tracker.h b/client/xr/htc_body_tracker.h
new file mode 100644
index 00000000..d694f570
--- /dev/null
+++ b/client/xr/htc_body_tracker.h
@@ -0,0 +1,66 @@
+/*
+ * WiVRn VR streaming
+ * Copyright (C) 2025 Awzri
+ * Copyright (C) 2025 Sapphire
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include "wivrn_packets.h"
+#include "xr/htc_exts.h"
+#include "xr/space.h"
+#include
+#include
+#include
+
+namespace xr
+{
+class instance;
+class session;
+
+class vive_xr_tracker
+{
+ bool is_active = false;
+ xr::space space;
+
+public:
+ vive_xr_tracker(xr::space && s);
+ void set_active(bool active);
+ bool get_active() const;
+ XrSpace get_space() const;
+};
+
+class htc_body_tracker
+{
+ instance * inst;
+ XrSession s;
+ std::vector trackers;
+
+ PFN_xrEnumeratePathsForInteractionProfileHTC xrEnumeratePathsForInteractionProfileHTC{};
+
+ std::vector get_roles();
+
+public:
+ htc_body_tracker() = default;
+ htc_body_tracker(instance & inst, session & s);
+
+ std::vector get_paths(XrPath user_path = XR_NULL_PATH);
+ void add(xr::space && space);
+ size_t count() const;
+ void update_active();
+ std::array locate_spaces(XrTime time, XrSpace reference);
+};
+} // namespace xr
diff --git a/client/xr/pico_body_tracker.cpp b/client/xr/pico_body_tracker.cpp
index 983bdc7e..0c7ec71d 100644
--- a/client/xr/pico_body_tracker.cpp
+++ b/client/xr/pico_body_tracker.cpp
@@ -36,6 +36,10 @@ xr::pico_body_tracker::pico_body_tracker(instance & inst, XrBodyTrackerBD h)
xrLocateBodyJointsBD = inst.get_proc("xrLocateBodyJointsBD");
}
+size_t xr::pico_body_tracker::count() const
+{
+ return joint_whitelist.size();
+}
std::optional> xr::pico_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{
if (!xrLocateBodyJointsBD)
diff --git a/client/xr/pico_body_tracker.h b/client/xr/pico_body_tracker.h
index 3cb0dfbf..316135d3 100644
--- a/client/xr/pico_body_tracker.h
+++ b/client/xr/pico_body_tracker.h
@@ -50,6 +50,7 @@ public:
pico_body_tracker() = default;
pico_body_tracker(instance & inst, XrBodyTrackerBD h);
+ size_t count() const;
std::optional> locate_spaces(XrTime time, XrSpace reference);
};
} // namespace xr
diff --git a/client/xr/session.cpp b/client/xr/session.cpp
index 5c92a8e7..fe816159 100644
--- a/client/xr/session.cpp
+++ b/client/xr/session.cpp
@@ -24,6 +24,7 @@
#include "openxr/openxr.h"
#include "utils/contains.h"
#include "xr/fb_body_tracker.h"
+#include "xr/htc_body_tracker.h"
#include "xr/instance.h"
#include "xr/pico_body_tracker.h"
#include "xr/system.h"
@@ -149,6 +150,11 @@ xr::fb_body_tracker xr::session::create_fb_body_tracker()
return {*inst, *this};
}
+xr::htc_body_tracker xr::session::create_htc_body_tracker()
+{
+ return {*inst, *this};
+}
+
xr::pico_body_tracker xr::session::create_pico_body_tracker()
{
XrBodyTrackerCreateInfoBD create_info{
diff --git a/client/xr/session.h b/client/xr/session.h
index e3c31647..0086ce7f 100644
--- a/client/xr/session.h
+++ b/client/xr/session.h
@@ -29,6 +29,7 @@
#include "fb_body_tracker.h"
#include "fb_face_tracker2.h"
#include "hand_tracker.h"
+#include "htc_body_tracker.h"
#include "htc_face_tracker.h"
#include "passthrough.h"
#include "pico_body_tracker.h"
@@ -57,6 +58,7 @@ public:
htc_face_tracker create_htc_face_tracker(XrFacialTrackingTypeHTC);
pico_face_tracker create_pico_face_tracker();
fb_body_tracker create_fb_body_tracker();
+ htc_body_tracker create_htc_body_tracker();
pico_body_tracker create_pico_body_tracker();
std::vector get_swapchain_formats() const;
diff --git a/common/xr/htc_exts.h b/common/xr/htc_exts.h
new file mode 100644
index 00000000..2186293d
--- /dev/null
+++ b/common/xr/htc_exts.h
@@ -0,0 +1,36 @@
+// clang-format off
+#pragma once
+
+#include
+
+// XR_HTC_vive_xr_tracker_interaction is a preprocessor guard. Do not pass it to API calls.
+#define XR_HTC_vive_xr_tracker_interaction 1
+#define XR_HTC_vive_xr_tracker_interaction_SPEC_VERSION 1
+#define XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME "XR_HTC_vive_xr_tracker_interaction"
+
+// XR_HTC_path_enumeration is a preprocessor guard. Do not pass it to API calls.
+#define XR_HTC_path_enumeration 1
+#define XR_HTC_path_enumeration_SPEC_VERSION 1
+#define XR_HTC_PATH_ENUMERATION_EXTENSION_NAME "XR_HTC_path_enumeration"
+
+typedef struct XrPathsForInteractionProfileEnumerateInfoHTC {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrPath interactionProfile;
+ XrPath userPath;
+} XrPathsForInteractionProfileEnumerateInfoHTC;
+
+typedef XrResult (XRAPI_PTR *PFN_xrEnumeratePathsForInteractionProfileHTC)(XrInstance instance, XrPathsForInteractionProfileEnumerateInfoHTC createInfo, uint32_t pathCapacityInput, uint32_t* pathCountOutput, XrPath* paths);
+
+#ifndef XR_NO_PROTOTYPES
+#ifdef XR_EXTENSION_PROTOTYPES
+XRAPI_ATTR XrResult XRAPI_CALL xrEnumeratePathsForInteractionProfileHTC(
+ XrInstance instance,
+ XrPathsForInteractionProfileEnumerateInfoHTC createInfo,
+ uint32_t pathCapacityInput,
+ uint32_t* pathCountOutput,
+ XrPath* paths);
+#endif /* XR_EXTENSION_PROTOTYPES */
+#endif /* !XR_NO_PROTOTYPES */
+
+// clang-format on
diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp
index ac1ff5eb..8a520e90 100644
--- a/server/driver/wivrn_session.cpp
+++ b/server/driver/wivrn_session.cpp
@@ -230,6 +230,12 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection
{
U_LOG_I("Creating %d generic trackers", num_generic_trackers);
+ if (num_generic_trackers > generic_trackers.size())
+ throw std::out_of_range(
+ std::format("{} generic trackers is larger than maximum {}",
+ num_generic_trackers,
+ generic_trackers.size()));
+
for (int i = 0; i < num_generic_trackers; ++i)
{
auto dev = std::make_unique(i, &hmd, *this);