passthru EXT_eye_gaze_interaction

This commit is contained in:
galister
2024-08-01 12:08:05 +02:00
committed by xytovl
parent 4cfdc4fa24
commit f0ca7ff8da
11 changed files with 78 additions and 7 deletions
+15 -7
View File
@@ -180,7 +180,7 @@ bool wivrn_hmd::wivrn_hmd_compute_distortion(xrt_device * xdev, uint32_t view_in
wivrn_hmd::wivrn_hmd(std::shared_ptr<xrt::drivers::wivrn::wivrn_session> cnx,
const from_headset::headset_info_packet & info) :
xrt_device{}, cnx(cnx)
xrt_device{}, gaze(device_id::EYE_GAZE), cnx(cnx)
{
xrt_device * base = this;
@@ -196,6 +196,7 @@ wivrn_hmd::wivrn_hmd(std::shared_ptr<xrt::drivers::wivrn::wivrn_session> cnx,
orientation_tracking_supported = true;
// hand_tracking_supported = true;
position_tracking_supported = true;
eye_gaze_supported = info.eye_gaze;
// Print name.
strcpy(str, "WiVRn HMD");
@@ -245,20 +246,27 @@ void wivrn_hmd::update_inputs()
xrt_space_relation wivrn_hmd::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns)
{
if (name != XRT_INPUT_GENERIC_HEAD_POSE)
if (name == XRT_INPUT_GENERIC_HEAD_POSE)
{
U_LOG_E("Unknown input name");
return {};
auto [extrapolation_time, res] = views.get_at(at_timestamp_ns);
cnx->add_predict_offset(extrapolation_time);
return res.relation;
}
auto [extrapolation_time, res] = views.get_at(at_timestamp_ns);
cnx->add_predict_offset(extrapolation_time);
return res.relation;
if (name == XRT_INPUT_GENERIC_EYE_GAZE_POSE)
{
auto [_, relation] = gaze.get_at(at_timestamp_ns);
return relation;
}
U_LOG_E("Unknown input name");
return {};
}
void wivrn_hmd::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset)
{
views.update_tracking(tracking, offset);
gaze.update_tracking(tracking, offset);
}
void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
+1
View File
@@ -47,6 +47,7 @@ class wivrn_hmd : public xrt_device
};
view_list views;
pose_list gaze;
std::array<to_headset::video_stream_description::foveation_parameter, 2> foveation_parameters{};
std::shared_ptr<xrt::drivers::wivrn::wivrn_session> cnx;
+4
View File
@@ -142,6 +142,10 @@ xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wi
int n = 0;
if (self->hmd)
usysds->base.base.static_roles.head = devices->xdevs[n++] = self->hmd.get();
if (self->hmd->eye_gaze_supported)
usysds->base.base.static_roles.eyes = self->hmd.get();
if (self->left_hand)
{
devices->xdevs[n++] = self->left_hand.get();