passthru EXT_eye_gaze_interaction
This commit is contained in:
@@ -250,6 +250,12 @@ static std::vector<interaction_profile> interaction_profiles{
|
||||
"/user/hand/right/input/thumbstick/touch",
|
||||
"/user/hand/right/input/thumbrest/touch",
|
||||
}},
|
||||
interaction_profile{
|
||||
"/interaction_profiles/ext/eye_gaze_interaction",
|
||||
{"XR_EXT_eye_gaze_interaction"},
|
||||
{
|
||||
"/user/eyes_ext/input/gaze_ext/pose",
|
||||
}},
|
||||
};
|
||||
|
||||
static const std::pair<std::string_view, XrActionType> action_suffixes[] =
|
||||
@@ -648,6 +654,8 @@ void application::initialize_actions()
|
||||
right_grip_space = xr_session.create_action_space(a);
|
||||
else if (name == "/user/hand/right/input/aim/pose")
|
||||
right_aim_space = xr_session.create_action_space(a);
|
||||
else if (name == "/user/eyes_ext/input/gaze_ext/pose")
|
||||
eye_gaze_space = xr_session.create_action_space(a);
|
||||
}
|
||||
|
||||
// Build an action set for each scene
|
||||
@@ -727,6 +735,7 @@ void application::initialize()
|
||||
std::vector<std::string> opt_extensions;
|
||||
opt_extensions.push_back(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_HAND_TRACKING_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
|
||||
opt_extensions.push_back(XR_HTC_PASSTHROUGH_EXTENSION_NAME);
|
||||
|
||||
@@ -781,6 +790,13 @@ void application::initialize()
|
||||
hand_tracking_supported = hand_tracking_properties.supportsHandTracking;
|
||||
}
|
||||
|
||||
if (utils::contains(xr_extensions, XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME))
|
||||
{
|
||||
XrSystemEyeGazeInteractionPropertiesEXT eye_gaze_properties = xr_system_id.eye_gaze_interaction_properties();
|
||||
spdlog::info(" Eye gaze support: {}", (bool)eye_gaze_properties.supportsEyeGazeInteraction);
|
||||
eye_gaze_supported = eye_gaze_properties.supportsEyeGazeInteraction;
|
||||
}
|
||||
|
||||
switch (xr_system_id.passthrough_supported())
|
||||
{
|
||||
case xr::system::passthrough_type::no_passthrough:
|
||||
|
||||
@@ -121,11 +121,14 @@ class application : public singleton<application>
|
||||
xr::space left_aim_space;
|
||||
xr::space right_grip_space;
|
||||
xr::space right_aim_space;
|
||||
xr::space eye_gaze_space;
|
||||
|
||||
bool hand_tracking_supported = false;
|
||||
xr::hand_tracker left_hand;
|
||||
xr::hand_tracker right_hand;
|
||||
|
||||
bool eye_gaze_supported = false;
|
||||
|
||||
bool session_running = false;
|
||||
bool session_focused = false;
|
||||
bool session_visible = false;
|
||||
@@ -304,6 +307,10 @@ public:
|
||||
{
|
||||
return instance().right_aim_space;
|
||||
};
|
||||
static XrSpace eye_gaze()
|
||||
{
|
||||
return instance().eye_gaze_space;
|
||||
};
|
||||
|
||||
static void ignore_debug_reports_for(void * object)
|
||||
{
|
||||
@@ -404,6 +411,11 @@ public:
|
||||
return instance().hand_tracking_supported;
|
||||
}
|
||||
|
||||
static bool get_eye_gaze_supported()
|
||||
{
|
||||
return instance().eye_gaze_supported;
|
||||
}
|
||||
|
||||
static xr::hand_tracker & get_left_hand()
|
||||
{
|
||||
return instance().left_hand;
|
||||
|
||||
@@ -120,6 +120,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
spdlog::warn("Unable to detect refresh rates");
|
||||
|
||||
info.hand_tracking = application::get_hand_tracking_supported();
|
||||
info.eye_gaze = application::get_eye_gaze_supported();
|
||||
|
||||
audio::get_audio_description(info);
|
||||
if (not application::get_config().microphone)
|
||||
|
||||
@@ -146,6 +146,9 @@ void scenes::stream::tracking()
|
||||
{device_id::RIGHT_AIM, application::right_aim()},
|
||||
{device_id::RIGHT_GRIP, application::right_grip()}};
|
||||
|
||||
if (application::get_eye_gaze_supported())
|
||||
spaces.push_back({device_id::EYE_GAZE, application::eye_gaze()});
|
||||
|
||||
XrSpace view_space = application::view();
|
||||
XrDuration tracking_period = 1'000'000; // Send tracking data every 1ms
|
||||
const XrDuration dt = 100'000; // Wake up 0.1ms before measuring the position
|
||||
|
||||
@@ -87,6 +87,24 @@ XrSystemHandTrackingPropertiesEXT xr::system::hand_tracking_properties() const
|
||||
return hand_tracking_prop;
|
||||
}
|
||||
|
||||
XrSystemEyeGazeInteractionPropertiesEXT xr::system::eye_gaze_interaction_properties() const
|
||||
{
|
||||
if (!id)
|
||||
throw std::invalid_argument("this");
|
||||
|
||||
XrSystemEyeGazeInteractionPropertiesEXT eye_gaze_prop{
|
||||
.type = XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT,
|
||||
};
|
||||
|
||||
XrSystemProperties prop{
|
||||
.type = XR_TYPE_SYSTEM_PROPERTIES,
|
||||
.next = &eye_gaze_prop,
|
||||
};
|
||||
CHECK_XR(xrGetSystemProperties(*inst, id, &prop));
|
||||
|
||||
return eye_gaze_prop;
|
||||
}
|
||||
|
||||
xr::system::passthrough_type xr::system::passthrough_supported() const
|
||||
{
|
||||
if (utils::contains(environment_blend_modes(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO), XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND))
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
|
||||
XrSystemProperties properties() const;
|
||||
XrSystemHandTrackingPropertiesEXT hand_tracking_properties() const;
|
||||
XrSystemEyeGazeInteractionPropertiesEXT eye_gaze_interaction_properties() const;
|
||||
passthrough_type passthrough_supported() const;
|
||||
|
||||
XrGraphicsRequirementsVulkan2KHR graphics_requirements() const;
|
||||
|
||||
Reference in New Issue
Block a user