diff --git a/CMakeLists.txt b/CMakeLists.txt index 1deb5c551..2710dd849 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -410,6 +410,9 @@ endif() if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_VIVE_COSMOS) set(XRT_FEATURE_OPENXR_INTERACTION_VIVE_COSMOS ON) endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3) + set(XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3 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 8d7f7e565..31d0ad22f 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -84,6 +84,7 @@ EXTENSIONS = ( ['XR_EXTX_overlay', 'XRT_FEATURE_OPENXR_OVERLAY'], ['XR_HTCX_vive_tracker_interaction', 'ALWAYS_DISABLED'], ['XR_HTC_vive_cosmos_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_VIVE_COSMOS'], + ['XR_HTC_vive_focus3_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3'], ['XR_MNDX_ball_on_a_stick_controller', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], ['XR_MNDX_egl_enable', 'XR_USE_PLATFORM_EGL', 'XR_USE_GRAPHICS_API_OPENGL'], ['XR_MNDX_force_feedback_curl', 'XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL'], diff --git a/src/xrt/auxiliary/bindings/bindings.json b/src/xrt/auxiliary/bindings/bindings.json index 475299872..97e663cda 100644 --- a/src/xrt/auxiliary/bindings/bindings.json +++ b/src/xrt/auxiliary/bindings/bindings.json @@ -2294,6 +2294,147 @@ } } } + }, + + "/interaction_profiles/htc/vive_focus3_controller": { + "title": "HTC Vive Focus 3 Controller", + "type": "tracked_controller", + "extension": "HTC_vive_focus3_controller_interaction", + "openxr_version": { + "promoted": { + "major": "1", + "minor": "1" + } + }, + "monado_device": "XRT_DEVICE_VIVE_FOCUS3_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"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_X_CLICK" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_Y_CLICK" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_MENU_CLICK" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_A_CLICK" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_B_CLICK" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_SYSTEM_CLICK" + } + }, + "/input/squeeze": { + "type": "button", + "localized_name": "Squeeze", + "components": ["click", "touch", "value"], + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_SQUEEZE_CLICK", + "touch": "XRT_INPUT_VIVE_FOCUS3_SQUEEZE_TOUCH", + "value": "XRT_INPUT_VIVE_FOCUS3_SQUEEZE_VALUE" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["click", "value", "touch"], + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_TRIGGER_CLICK", + "value": "XRT_INPUT_VIVE_FOCUS3_TRIGGER_VALUE", + "touch": "XRT_INPUT_VIVE_FOCUS3_TRIGGER_TOUCH" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "activate": "click", + "center": true + }, + "monado_bindings": { + "click": "XRT_INPUT_VIVE_FOCUS3_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_VIVE_FOCUS3_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_VIVE_FOCUS3_THUMBSTICK" + } + }, + "/input/thumbrest": { + "type": "button", + "localized_name": "Thumb Rest", + "components": ["touch"], + "monado_bindings": { + "touch": "XRT_INPUT_VIVE_FOCUS3_THUMBREST_TOUCH" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_VIVE_FOCUS3_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_VIVE_FOCUS3_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_VIVE_FOCUS3_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 de4f099ca..b8bc33fff 100644 --- a/src/xrt/include/xrt/xrt_config_build.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_build.h.cmake_in @@ -45,6 +45,7 @@ #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_WINMR #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_BYTEDANCE #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_VIVE_COSMOS +#cmakedefine XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3 #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 ee01291c1..f79c9ee30 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -765,6 +765,7 @@ enum xrt_device_name XRT_DEVICE_PICO_G3_CONTROLLER, XRT_DEVICE_VIVE_COSMOS_CONTROLLER, + XRT_DEVICE_VIVE_FOCUS3_CONTROLLER, }; /*! @@ -1201,7 +1202,26 @@ enum xrt_input_type _(XRT_INPUT_VIVE_COSMOS_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x0B0B, BOOLEAN)) \ _(XRT_INPUT_VIVE_COSMOS_THUMBSTICK , XRT_INPUT_NAME(0x0B0C, VEC2_MINUS_ONE_TO_ONE)) \ _(XRT_INPUT_VIVE_COSMOS_GRIP_POSE , XRT_INPUT_NAME(0x0B0D, POSE)) \ - _(XRT_INPUT_VIVE_COSMOS_AIM_POSE , XRT_INPUT_NAME(0x0B0E, POSE)) + _(XRT_INPUT_VIVE_COSMOS_AIM_POSE , XRT_INPUT_NAME(0x0B0E, POSE)) \ +\ + _(XRT_INPUT_VIVE_FOCUS3_X_CLICK , XRT_INPUT_NAME(0x0C00, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_Y_CLICK , XRT_INPUT_NAME(0x0C01, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_MENU_CLICK , XRT_INPUT_NAME(0x0C02, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_A_CLICK , XRT_INPUT_NAME(0x0C03, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_B_CLICK , XRT_INPUT_NAME(0x0C04, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_SYSTEM_CLICK , XRT_INPUT_NAME(0x0C05, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_SQUEEZE_CLICK , XRT_INPUT_NAME(0x0C06, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_SQUEEZE_TOUCH , XRT_INPUT_NAME(0x0C07, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_SQUEEZE_VALUE , XRT_INPUT_NAME(0x0C08, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_VIVE_FOCUS3_TRIGGER_CLICK , XRT_INPUT_NAME(0x0C09, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_TRIGGER_TOUCH , XRT_INPUT_NAME(0x0C0A, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_TRIGGER_VALUE , XRT_INPUT_NAME(0x0C0B, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_VIVE_FOCUS3_THUMBSTICK_CLICK , XRT_INPUT_NAME(0x0C0C, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x0C0D, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_THUMBSTICK , XRT_INPUT_NAME(0x0C0E, VEC2_MINUS_ONE_TO_ONE)) \ + _(XRT_INPUT_VIVE_FOCUS3_THUMBREST_TOUCH , XRT_INPUT_NAME(0x0C0F, BOOLEAN)) \ + _(XRT_INPUT_VIVE_FOCUS3_GRIP_POSE , XRT_INPUT_NAME(0x0C10, POSE)) \ + _(XRT_INPUT_VIVE_FOCUS3_AIM_POSE , XRT_INPUT_NAME(0x0C11, POSE)) // clang-format on @@ -1642,6 +1662,7 @@ enum xrt_output_name XRT_OUTPUT_NAME_PICO4_HAPTIC = XRT_OUTPUT_NAME(0x0100, VIBRATION), XRT_OUTPUT_NAME_VIVE_COSMOS_HAPTIC = XRT_OUTPUT_NAME(0x0200, VIBRATION), + XRT_OUTPUT_NAME_VIVE_FOCUS3_HAPTIC = XRT_OUTPUT_NAME(0x0300, 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 65d765f67..869fba544 100644 --- a/src/xrt/state_trackers/oxr/oxr_extension_support.h +++ b/src/xrt/state_trackers/oxr/oxr_extension_support.h @@ -601,6 +601,18 @@ #endif +/* + * XR_HTC_vive_focus3_controller_interaction + */ +#if defined(XR_HTC_vive_focus3_controller_interaction) && defined(XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3) +#define OXR_HAVE_HTC_vive_focus3_controller_interaction +#define OXR_EXTENSION_SUPPORT_HTC_vive_focus3_controller_interaction(_) \ + _(HTC_vive_focus3_controller_interaction, HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION) +#else +#define OXR_EXTENSION_SUPPORT_HTC_vive_focus3_controller_interaction(_) +#endif + + /* * XR_MNDX_ball_on_a_stick_controller */ @@ -742,6 +754,7 @@ OXR_EXTENSION_SUPPORT_EXTX_overlay(_) \ OXR_EXTENSION_SUPPORT_HTCX_vive_tracker_interaction(_) \ OXR_EXTENSION_SUPPORT_HTC_vive_cosmos_controller_interaction(_) \ + OXR_EXTENSION_SUPPORT_HTC_vive_focus3_controller_interaction(_) \ OXR_EXTENSION_SUPPORT_MNDX_ball_on_a_stick_controller(_) \ OXR_EXTENSION_SUPPORT_MNDX_egl_enable(_) \ OXR_EXTENSION_SUPPORT_MNDX_force_feedback_curl(_) \