From b101db37052aad7ce6045db61ae8572515145c60 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Thu, 14 Mar 2024 15:04:56 +0100 Subject: [PATCH] a/bindings,xrt: Add Touch Plus controller Part-of: --- CMakeLists.txt | 3 + scripts/generate_oxr_ext_support.py | 1 + src/xrt/auxiliary/bindings/bindings.json | 317 ++++++++++++++++++ .../include/xrt/xrt_config_build.h.cmake_in | 1 + src/xrt/include/xrt/xrt_defines.h | 29 +- .../oxr/oxr_extension_support.h | 12 + 6 files changed, 362 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68e3aa88c..41f006428 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -419,6 +419,9 @@ endif() if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO) set(XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO ON) endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PLUS) + set(XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PLUS ON) +endif() # Defaults for OpenXR layer support if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH) diff --git a/scripts/generate_oxr_ext_support.py b/scripts/generate_oxr_ext_support.py index 893f30d66..22d1cdd1c 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -77,6 +77,7 @@ EXTENSIONS = ( ['XR_FB_touch_controller_pro', 'XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO'], ['XR_FB_touch_controller_proximity', 'XRT_FEATURE_OPENXR_INTERACTION_FB_PROXIMITY'], ['XR_HTC_facial_tracking', 'XRT_FEATURE_OPENXR_FACIAL_TRACKING_HTC'], + ['XR_META_touch_controller_plus', 'XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PLUS'], ['XR_ML_ml2_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_ML2'], ['XR_MND_headless', 'XRT_FEATURE_OPENXR_HEADLESS'], ['XR_MND_swapchain_usage_input_attachment_bit'], diff --git a/src/xrt/auxiliary/bindings/bindings.json b/src/xrt/auxiliary/bindings/bindings.json index 14737e614..f34f97bdb 100644 --- a/src/xrt/auxiliary/bindings/bindings.json +++ b/src/xrt/auxiliary/bindings/bindings.json @@ -2865,6 +2865,323 @@ } } } + }, + + "/interaction_profiles/facebook/touch_controller_plus": { + "title": "Meta Quest Touch Plus Controller", + "type": "tracked_controller", + "extension": "XR_META_touch_controller_plus", + "steamvr_controllertype": "oculus_touch", + "monado_device": "XRT_DEVICE_TOUCH_PLUS_CONTROLLER", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "subaction_paths": [ + "/user/hand/left", + "/user/hand/right" + ], + "subpaths": { + "/input/x": { + "type": "button", + "localized_name": "X", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_X_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_Y_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_Y_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_MENU_CLICK" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_A_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_B_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_B_TOUCH" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_SYSTEM_CLICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PLUS_SQUEEZE_VALUE" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["touch", "value", "force", "curl_meta", "slide_meta", "proximity_meta"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PLUS_TRIGGER_TOUCH", + "value": "XRT_INPUT_TOUCH_PLUS_TRIGGER_VALUE", + "force": "XRT_INPUT_TOUCH_PLUS_TRIGGER_FORCE", + "curl": "XRT_INPUT_TOUCH_PLUS_TRIGGER_CURL", + "slide": "XRT_INPUT_TOUCH_PLUS_TRIGGER_SLIDE", + "proximity": "XRT_INPUT_TOUCH_PLUS_TRIGGER_PROXIMITY" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_TOUCH_PLUS_THUMBSTICK" + } + }, + "/input/thumbrest": { + "type": "button", + "localized_name": "Thumb Rest", + "components": ["touch"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PLUS_THUMBREST_TOUCH" + } + }, + "/input/thumb_meta": { + "type": "button", + "localized_name": "Thumb", + "components": ["proximity_meta"], + "monado_bindings": { + "force": "XRT_INPUT_TOUCH_PLUS_THUMB_PROXIMITY" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PLUS_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PLUS_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC" + } + } + } + }, + + "/interaction_profiles/meta/touch_plus_controller": { + "title": "Meta Touch Plus Controller", + "type": "tracked_controller", + "openxr_version": { + "promoted": { + "major": "1", + "minor": "1" + } + }, + "steamvr_controllertype": "oculus_touch", + "monado_device": "XRT_DEVICE_TOUCH_PLUS_CONTROLLER", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "subaction_paths": [ + "/user/hand/left", + "/user/hand/right" + ], + "subpaths": { + "/input/x": { + "type": "button", + "localized_name": "X", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_X_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_Y_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_Y_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_MENU_CLICK" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_A_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_B_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_B_TOUCH" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_SYSTEM_CLICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PLUS_SQUEEZE_VALUE" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["touch", "value", "force", "proximity"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PLUS_TRIGGER_TOUCH", + "value": "XRT_INPUT_TOUCH_PLUS_TRIGGER_VALUE", + "force": "XRT_INPUT_TOUCH_PLUS_TRIGGER_FORCE", + "curl": "XRT_INPUT_TOUCH_PLUS_TRIGGER_CURL", + "slide": "XRT_INPUT_TOUCH_PLUS_TRIGGER_SLIDE", + "proximity": "XRT_INPUT_TOUCH_PLUS_TRIGGER_PROXIMITY" + } + }, + "/input/trigger_curl": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PLUS_TRIGGER_CURL" + } + }, + "/input/trigger_slide": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PLUS_TRIGGER_SLIDE" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PLUS_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_TOUCH_PLUS_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_TOUCH_PLUS_THUMBSTICK" + } + }, + "/input/thumbrest": { + "type": "button", + "localized_name": "Thumb Rest", + "components": ["touch"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PLUS_THUMBREST_TOUCH" + } + }, + "/input/thumb_resting_surfaces": { + "type": "button", + "localized_name": "Thumb", + "components": ["proximity"], + "monado_bindings": { + "force": "XRT_INPUT_TOUCH_PLUS_THUMB_PROXIMITY" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PLUS_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PLUS_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC" + } + } + } } diff --git a/src/xrt/include/xrt/xrt_config_build.h.cmake_in b/src/xrt/include/xrt/xrt_config_build.h.cmake_in index fd608ae9e..4dc18fc69 100644 --- a/src/xrt/include/xrt/xrt_config_build.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_build.h.cmake_in @@ -48,6 +48,7 @@ #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3 #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_FB_PROXIMITY #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO +#cmakedefine XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PLUS #cmakedefine XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS #cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE #cmakedefine XRT_FEATURE_OPENXR_LAYER_CYLINDER diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index 6e086268c..c546775ef 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -768,6 +768,7 @@ enum xrt_device_name XRT_DEVICE_VIVE_FOCUS3_CONTROLLER, XRT_DEVICE_TOUCH_PRO_CONTROLLER, + XRT_DEVICE_TOUCH_PLUS_CONTROLLER, }; /*! @@ -1251,7 +1252,32 @@ enum xrt_input_type _(XRT_INPUT_TOUCH_PRO_THUMB_PROXIMITY , XRT_INPUT_NAME(0x0D15, BOOLEAN)) \ _(XRT_INPUT_TOUCH_PRO_TRIGGER_CURL , XRT_INPUT_NAME(0x0D16, VEC1_ZERO_TO_ONE)) \ _(XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE , XRT_INPUT_NAME(0x0D17, VEC1_ZERO_TO_ONE)) \ - _(XRT_INPUT_TOUCH_PRO_STYLUS_FORCE , XRT_INPUT_NAME(0x0D18, VEC1_ZERO_TO_ONE)) + _(XRT_INPUT_TOUCH_PRO_STYLUS_FORCE , XRT_INPUT_NAME(0x0D18, VEC1_ZERO_TO_ONE)) \ +\ + _(XRT_INPUT_TOUCH_PLUS_X_CLICK , XRT_INPUT_NAME(0x0E00, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_X_TOUCH , XRT_INPUT_NAME(0x0E01, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_Y_CLICK , XRT_INPUT_NAME(0x0E02, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_Y_TOUCH , XRT_INPUT_NAME(0x0E03, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_MENU_CLICK , XRT_INPUT_NAME(0x0E04, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_A_CLICK , XRT_INPUT_NAME(0x0E05, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_A_TOUCH , XRT_INPUT_NAME(0x0E06, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_B_CLICK , XRT_INPUT_NAME(0x0E07, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_B_TOUCH , XRT_INPUT_NAME(0x0E08, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_SYSTEM_CLICK , XRT_INPUT_NAME(0x0E09, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_SQUEEZE_VALUE , XRT_INPUT_NAME(0x0E0A, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PLUS_TRIGGER_TOUCH , XRT_INPUT_NAME(0x0E0B, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_TRIGGER_PROXIMITY , XRT_INPUT_NAME(0x0E0C, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_TRIGGER_VALUE , XRT_INPUT_NAME(0x0E0D, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PLUS_TRIGGER_FORCE , XRT_INPUT_NAME(0x0E0E, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PLUS_THUMBSTICK_CLICK , XRT_INPUT_NAME(0x0E0F, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x0E10, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_THUMBSTICK , XRT_INPUT_NAME(0x0E11, VEC2_MINUS_ONE_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PLUS_THUMBREST_TOUCH , XRT_INPUT_NAME(0x0E12, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_GRIP_POSE , XRT_INPUT_NAME(0x0E13, POSE)) \ + _(XRT_INPUT_TOUCH_PLUS_AIM_POSE , XRT_INPUT_NAME(0x0E14, POSE)) \ + _(XRT_INPUT_TOUCH_PLUS_THUMB_PROXIMITY , XRT_INPUT_NAME(0x0E15, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PLUS_TRIGGER_CURL , XRT_INPUT_NAME(0x0E16, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PLUS_TRIGGER_SLIDE , XRT_INPUT_NAME(0x0E17, VEC1_ZERO_TO_ONE)) // clang-format on @@ -1697,6 +1723,7 @@ enum xrt_output_name XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC = XRT_OUTPUT_NAME(0x0400, VIBRATION), XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER = XRT_OUTPUT_NAME(0x0500, VIBRATION), XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB = XRT_OUTPUT_NAME(0x0600, VIBRATION), + XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC = XRT_OUTPUT_NAME(0x0700, VIBRATION) // clang-format on }; diff --git a/src/xrt/state_trackers/oxr/oxr_extension_support.h b/src/xrt/state_trackers/oxr/oxr_extension_support.h index c186b4b11..022b5eed0 100644 --- a/src/xrt/state_trackers/oxr/oxr_extension_support.h +++ b/src/xrt/state_trackers/oxr/oxr_extension_support.h @@ -520,6 +520,17 @@ #endif +/* + * XR_META_touch_controller_plus + */ +#if defined(XR_META_touch_controller_plus) && defined(XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PLUS) +#define OXR_HAVE_META_touch_controller_plus +#define OXR_EXTENSION_SUPPORT_META_touch_controller_plus(_) _(META_touch_controller_plus, META_TOUCH_CONTROLLER_PLUS) +#else +#define OXR_EXTENSION_SUPPORT_META_touch_controller_plus(_) +#endif + + /* * XR_ML_ml2_controller_interaction */ @@ -770,6 +781,7 @@ OXR_EXTENSION_SUPPORT_FB_touch_controller_pro(_) \ OXR_EXTENSION_SUPPORT_FB_touch_controller_proximity(_) \ OXR_EXTENSION_SUPPORT_HTC_facial_tracking(_) \ + OXR_EXTENSION_SUPPORT_META_touch_controller_plus(_) \ OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_) \ OXR_EXTENSION_SUPPORT_MND_headless(_) \ OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_) \