The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

st/oxr: Add eye gaze support

authored by

Drew Chien (Te-Ju) and committed by
Jakob Bornecrantz
9f1cf952 aefeeb14

+65 -4
+11
src/xrt/state_trackers/oxr/oxr_api_action.c
··· 292 292 subpath_fn = oxr_verify_microsoft_hand_interaction_subpath; 293 293 dpad_path_fn = oxr_verify_microsoft_hand_interaction_dpad_path; 294 294 dpad_emulator_fn = oxr_verify_microsoft_hand_interaction_dpad_emulator; 295 + } else if (ip == inst->path_cache.ext_eye_gaze_interaction) { 296 + if (!inst->extensions.EXT_eye_gaze_interaction) { 297 + return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED, 298 + "(suggestedBindings->interactionProfile == \"%s\") used but " 299 + "EXT_eye_gaze_interaction not enabled", 300 + ip_str); 301 + } 302 + 303 + subpath_fn = oxr_verify_ext_eye_gaze_interaction_subpath; 304 + dpad_path_fn = oxr_verify_ext_eye_gaze_interaction_dpad_path; 305 + dpad_emulator_fn = oxr_verify_ext_eye_gaze_interaction_dpad_emulator; 295 306 } else { 296 307 return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED, 297 308 "(suggestedBindings->interactionProfile == \"%s\") is not "
-2
src/xrt/state_trackers/oxr/oxr_api_space.c
··· 140 140 OXR_VERIFY_SPACE_NOT_NULL(&log, baseSpace, baseSpc); 141 141 OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, location, XR_TYPE_SPACE_LOCATION); 142 142 143 - OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(&log, ((XrSpaceVelocity *)location->next), XR_TYPE_SPACE_VELOCITY); 144 - 145 143 if (time <= (XrTime)0) { 146 144 return oxr_error(&log, XR_ERROR_TIME_INVALID, "(time == %" PRIi64 ") is not a valid time.", time); 147 145 }
+5
src/xrt/state_trackers/oxr/oxr_binding.c
··· 246 246 *out_subaction_path = OXR_SUB_ACTION_PATH_GAMEPAD; 247 247 return true; 248 248 } 249 + if (length >= 14 && strncmp("/user/eyes_ext", str, 14) == 0) { 250 + *out_subaction_path = OXR_SUB_ACTION_PATH_EYES; 251 + return true; 252 + } 249 253 250 254 return false; 251 255 } ··· 332 336 case XRT_DEVICE_SAMSUNG_ODYSSEY_CONTROLLER: FIND_PROFILE(samsung_odyssey_controller); return; 333 337 case XRT_DEVICE_ML2_CONTROLLER: FIND_PROFILE(ml_ml2_controller); return; 334 338 case XRT_DEVICE_HAND_INTERACTION: FIND_PROFILE(msft_hand_interaction); return; 339 + case XRT_DEVICE_EYE_GAZE_INTERACTION: FIND_PROFILE(ext_eye_gaze_interaction); return; 335 340 336 341 // no interaction 337 342 default:
+1
src/xrt/state_trackers/oxr/oxr_defines.h
··· 57 57 OXR_SUB_ACTION_PATH_LEFT, 58 58 OXR_SUB_ACTION_PATH_RIGHT, 59 59 OXR_SUB_ACTION_PATH_GAMEPAD, 60 + OXR_SUB_ACTION_PATH_EYES, 60 61 }; 61 62 62 63 /*!
+10
src/xrt/state_trackers/oxr/oxr_extension_support.h
··· 245 245 #define OXR_EXTENSION_SUPPORT_EXT_dpad_binding(_) 246 246 #endif 247 247 248 + /* 249 + * XR_EXT_eye_gaze_interaction 250 + */ 251 + #if defined(XR_EXT_eye_gaze_interaction) 252 + #define OXR_HAVE_EXT_eye_gaze_interaction 253 + #define OXR_EXTENSION_SUPPORT_EXT_eye_gaze_interaction(_) _(EXT_eye_gaze_interaction, EXT_EYE_GAZE_INTERACTION) 254 + #else 255 + #define OXR_EXTENSION_SUPPORT_EXT_eye_gaze_interaction(_) 256 + #endif 248 257 249 258 /* 250 259 * XR_EXT_hand_tracking ··· 415 424 OXR_EXTENSION_SUPPORT_KHR_win32_convert_performance_counter_time(_) \ 416 425 OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \ 417 426 OXR_EXTENSION_SUPPORT_EXT_dpad_binding(_) \ 427 + OXR_EXTENSION_SUPPORT_EXT_eye_gaze_interaction(_) \ 418 428 OXR_EXTENSION_SUPPORT_EXT_hand_tracking(_) \ 419 429 OXR_EXTENSION_SUPPORT_EXT_hp_mixed_reality_controller(_) \ 420 430 OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_) \
+1
src/xrt/state_trackers/oxr/oxr_instance.c
··· 238 238 cache_path(log, inst, "/interaction_profiles/ml/ml2_controller", &inst->path_cache.ml_ml2_controller); 239 239 cache_path(log, inst, "/interaction_profiles/mndx/ball_on_a_stick_controller", &inst->path_cache.mndx_ball_on_a_stick_controller); 240 240 cache_path(log, inst, "/interaction_profiles/microsoft/hand_interaction", &inst->path_cache.msft_hand_interaction); 241 + cache_path(log, inst, "/interaction_profiles/ext/eye_gaze_interaction", &inst->path_cache.ext_eye_gaze_interaction); 241 242 242 243 // clang-format on 243 244
+4
src/xrt/state_trackers/oxr/oxr_objects.h
··· 889 889 oxr_system_get_hand_tracking_support(struct oxr_logger *log, struct oxr_instance *inst); 890 890 891 891 bool 892 + oxr_system_get_eye_gaze_support(struct oxr_logger *log, struct oxr_instance *inst); 893 + 894 + bool 892 895 oxr_system_get_force_feedback_support(struct oxr_logger *log, struct oxr_instance *inst); 893 896 894 897 /* ··· 1362 1365 XrPath ml_ml2_controller; 1363 1366 XrPath mndx_ball_on_a_stick_controller; 1364 1367 XrPath msft_hand_interaction; 1368 + XrPath ext_eye_gaze_interaction; 1365 1369 } path_cache; 1366 1370 1367 1371 struct
+9
src/xrt/state_trackers/oxr/oxr_space.c
··· 230 230 231 231 // Used in a lot of places. 232 232 XrSpaceVelocity *vel = OXR_GET_OUTPUT_FROM_CHAIN(location->next, XR_TYPE_SPACE_VELOCITY, XrSpaceVelocity); 233 + XrEyeGazeSampleTimeEXT *gaze_sample_time = 234 + OXR_GET_OUTPUT_FROM_CHAIN(location->next, XR_TYPE_EYE_GAZE_SAMPLE_TIME_EXT, XrEyeGazeSampleTimeEXT); 235 + if (gaze_sample_time) { 236 + gaze_sample_time->time = 0; 237 + } 233 238 234 239 235 240 /* ··· 296 301 297 302 OXR_XRT_POSE_TO_XRPOSEF(result.pose, location->pose); 298 303 location->locationFlags = xrt_to_xr_space_location_flags(result.relation_flags); 304 + 305 + if (gaze_sample_time) { 306 + (void)gaze_sample_time; //! @todo Implement. 307 + } 299 308 300 309 if (vel) { 301 310 vel->velocityFlags = 0;
+4 -2
src/xrt/state_trackers/oxr/oxr_subaction.h
··· 24 24 _(left) \ 25 25 _(right) \ 26 26 _(head) \ 27 - _(gamepad) 27 + _(gamepad) \ 28 + _(eyes) 28 29 29 30 30 31 /*! ··· 56 57 _(left, LEFT, "/user/hand/left") \ 57 58 _(right, RIGHT, "/user/hand/right") \ 58 59 _(head, HEAD, "/user/head") \ 59 - _(gamepad, GAMEPAD, "/user/gamepad") 60 + _(gamepad, GAMEPAD, "/user/gamepad") \ 61 + _(eyes, EYES, "/user/eyes_ext") 60 62 61 63 /*! 62 64 * Expansion macro (x-macro) that calls the macro you pass for each subaction
+20
src/xrt/state_trackers/oxr/oxr_system.c
··· 200 200 } 201 201 202 202 bool 203 + oxr_system_get_eye_gaze_support(struct oxr_logger *log, struct oxr_instance *inst) 204 + { 205 + struct oxr_system *sys = &inst->system; 206 + struct xrt_device *eyes = GET_XDEV_BY_ROLE(sys, eyes); 207 + 208 + return eyes && eyes->eye_gaze_supported; 209 + } 210 + 211 + bool 203 212 oxr_system_get_force_feedback_support(struct oxr_logger *log, struct oxr_instance *inst) 204 213 { 205 214 struct oxr_system *sys = &inst->system; ··· 246 255 247 256 if (hand_tracking_props) { 248 257 hand_tracking_props->supportsHandTracking = oxr_system_get_hand_tracking_support(log, sys->inst); 258 + } 259 + 260 + XrSystemEyeGazeInteractionPropertiesEXT *eye_gaze_props = NULL; 261 + if (sys->inst->extensions.EXT_eye_gaze_interaction) { 262 + eye_gaze_props = 263 + OXR_GET_OUTPUT_FROM_CHAIN(properties, XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT, 264 + XrSystemEyeGazeInteractionPropertiesEXT); 265 + } 266 + 267 + if (eye_gaze_props) { 268 + eye_gaze_props->supportsEyeGazeInteraction = oxr_system_get_eye_gaze_support(log, sys->inst); 249 269 } 250 270 251 271 XrSystemForceFeedbackCurlPropertiesMNDX *force_feedback_props = NULL;