Sample hands at display frequency

This commit is contained in:
Patrick Nicolas
2024-12-16 12:03:55 +01:00
parent ebf4b68b8a
commit 8e9899383d
+5 -1
View File
@@ -187,6 +187,7 @@ void scenes::stream::tracking()
const XrDuration dt = 100'000; // Wake up 0.1ms before measuring the position
XrTime t0 = instance.now();
XrTime last_hand_sample = t0;
std::vector<from_headset::tracking> tracking;
std::vector<from_headset::hand_tracking> hands;
int skip_samples = 0;
@@ -249,8 +250,11 @@ void scenes::stream::tracking()
packet.device_poses.push_back(locate_space(device, space, world_space, t0 + Δt));
}
if (hand_tracking)
// Hand tracking data are very large, send fewer samples than other items
if (hand_tracking and t0 >= last_hand_sample + period and
(Δt == 0 or Δt >= prediction - 2 * period))
{
last_hand_sample = t0;
if (control.enabled[size_t(tid::left_hand)])
hands.emplace_back(
t0,