Store body trackers in variant

This commit is contained in:
Sapphire
2025-06-16 19:42:36 +02:00
committed by xytovl
parent ad136eae43
commit eb0aa46b83
10 changed files with 97 additions and 124 deletions
+6
View File
@@ -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<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::fb_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{
+1
View File
@@ -65,6 +65,7 @@ public:
void start(bool lower_body, bool hip);
void stop();
size_t count() const;
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
};
+4
View File
@@ -36,6 +36,10 @@ xr::pico_body_tracker::pico_body_tracker(instance & inst, XrBodyTrackerBD h)
xrLocateBodyJointsBD = inst.get_proc<PFN_xrLocateBodyJointsBD>("xrLocateBodyJointsBD");
}
size_t xr::pico_body_tracker::count() const
{
return joint_whitelist.size();
}
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::pico_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{
if (!xrLocateBodyJointsBD)
+1
View File
@@ -50,6 +50,7 @@ public:
pico_body_tracker() = default;
pico_body_tracker(instance & inst, XrBodyTrackerBD h);
size_t count() const;
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
};
} // namespace xr