Store eye gaze relative to view
This commit is contained in:
@@ -366,21 +366,6 @@ void scenes::stream::tracking()
|
||||
if (not std::ranges::contains(pattern, device_id::HEAD, &to_headset::tracking_control::sample::device))
|
||||
pattern.push_back({.device = device_id::HEAD});
|
||||
|
||||
// FIXME: eye tracking shouldn't had a special case
|
||||
// eye-tracked foveation needs eye and head pose in the same tracking packet
|
||||
if (spaces[device_id::EYE_GAZE])
|
||||
{
|
||||
size_t sz = pattern.size();
|
||||
for (size_t i = 0; i < sz; ++i)
|
||||
{
|
||||
if (pattern[i].device == device_id::HEAD)
|
||||
pattern.push_back({
|
||||
.device = device_id::EYE_GAZE,
|
||||
.prediction_ns = pattern[i].prediction_ns,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (hand_tracking)
|
||||
{
|
||||
if (std::ranges::contains(pattern, device_id::LEFT_HAND, &to_headset::tracking_control::sample::device))
|
||||
@@ -478,12 +463,13 @@ void scenes::stream::tracking()
|
||||
const auto & item = pattern[pattern_position];
|
||||
auto at_time = t0 + item.prediction_ns;
|
||||
|
||||
// Don't merge items that are too far from the current one
|
||||
if (std::abs(tracking.timestamp - at_time) > 1'000'000)
|
||||
break;
|
||||
|
||||
switch (item.device)
|
||||
{
|
||||
case device_id::HEAD:
|
||||
// Don't merge items that are too far from the current one
|
||||
if (std::abs(tracking.timestamp - at_time) > 1'000'000)
|
||||
goto subpattern_end;
|
||||
tracking.view_flags = session.locate_views(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, tracking.timestamp, view_space, views);
|
||||
assert(views.size() == tracking.views.size());
|
||||
for (auto [i, j]: std::views::zip(views, tracking.views))
|
||||
@@ -503,15 +489,13 @@ void scenes::stream::tracking()
|
||||
case wivrn::device_id::LEFT_POKE:
|
||||
case wivrn::device_id::RIGHT_PINCH_POSE:
|
||||
case wivrn::device_id::RIGHT_POKE:
|
||||
case wivrn::device_id::EYE_GAZE:
|
||||
// Don't merge items that are too far from the current one
|
||||
if (std::abs(tracking.timestamp - at_time) > 1'000'000)
|
||||
goto subpattern_end;
|
||||
locate_spaces.add_space(item.device, spaces[item.device], tracking.timestamp, tracking.device_poses);
|
||||
break;
|
||||
case wivrn::device_id::EYE_GAZE:
|
||||
// Eye gaze uses view pose as the origin
|
||||
tracking.device_poses.push_back(locate_space(item.device, spaces[item.device], spaces[wivrn::device_id::HEAD], tracking.timestamp));
|
||||
break;
|
||||
case wivrn::device_id::FACE:
|
||||
if (std::abs(tracking.timestamp - at_time) > 1'000'000)
|
||||
goto subpattern_end;
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](auto & ft) {
|
||||
@@ -557,7 +541,6 @@ void scenes::stream::tracking()
|
||||
break;
|
||||
}
|
||||
}
|
||||
subpattern_end:
|
||||
locate_spaces.resolve(session, tracking.timestamp, tracking.device_poses);
|
||||
}
|
||||
catch (const std::system_error & e)
|
||||
|
||||
Reference in New Issue
Block a user