Commit d1aab4b5 authored by Lachlan Ford's avatar Lachlan Ford Committed by Commit Bot

Implemented generic-hand-select over OpenXR

Implemented generic-hand-select using the MSFT hand interaction
extension.

Change-Id: I25595dfcf05fd0e23fb7ee9484c333321746fa0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2469836Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Commit-Queue: Lachlan Ford <laford@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#817138}
parent 121b9217
...@@ -27,7 +27,8 @@ enum class OpenXrInteractionProfileType { ...@@ -27,7 +27,8 @@ enum class OpenXrInteractionProfileType {
kHTCVive = 4, kHTCVive = 4,
kSamsungOdyssey = 5, kSamsungOdyssey = 5,
kHPReverbG2 = 6, kHPReverbG2 = 6,
kCount = 7, kHandSelect = 7,
kCount = 8,
}; };
enum class OpenXrButtonType { enum class OpenXrButtonType {
...@@ -93,6 +94,7 @@ struct OpenXrControllerInteractionProfile { ...@@ -93,6 +94,7 @@ struct OpenXrControllerInteractionProfile {
// Valve index controller. // Valve index controller.
// HTC vive controller // HTC vive controller
// HP Reverb G2 controller // HP Reverb G2 controller
// MSFT Hand Interaction
// Declare OpenXR input profile bindings for other runtimes when they become // Declare OpenXR input profile bindings for other runtimes when they become
// available. // available.
constexpr const char* kMicrosoftMotionInputProfiles[] = { constexpr const char* kMicrosoftMotionInputProfiles[] = {
...@@ -116,6 +118,9 @@ constexpr const char* kSamsungOdysseyInputProfiles[] = { ...@@ -116,6 +118,9 @@ constexpr const char* kSamsungOdysseyInputProfiles[] = {
constexpr const char* kHPReverbG2InputProfiles[] = { constexpr const char* kHPReverbG2InputProfiles[] = {
"hp-mixed-reality", "oculus-touch", "generic-trigger-squeeze"}; "hp-mixed-reality", "oculus-touch", "generic-trigger-squeeze"};
constexpr const char* kGenericHandSelectInputProfile[] = {
"generic-hand-select"};
constexpr OpenXrButtonPathMap kMicrosoftMotionControllerButtonPathMaps[] = { constexpr OpenXrButtonPathMap kMicrosoftMotionControllerButtonPathMaps[] = {
{OpenXrButtonType::kTrigger, {OpenXrButtonType::kTrigger,
{ {
...@@ -273,6 +278,12 @@ constexpr OpenXrButtonPathMap kHPReverbG2RightControllerButtonPathMaps[] = { ...@@ -273,6 +278,12 @@ constexpr OpenXrButtonPathMap kHPReverbG2RightControllerButtonPathMaps[] = {
1}, 1},
}; };
constexpr OpenXrButtonPathMap kGenericHandSelectButtonPathMaps[] = {
{OpenXrButtonType::kTrigger,
{{OpenXrButtonActionType::kValue, "/input/select/value"}},
1},
};
constexpr OpenXrAxisPathMap kMicrosoftMotionControllerAxisPathMaps[] = { constexpr OpenXrAxisPathMap kMicrosoftMotionControllerAxisPathMaps[] = {
{OpenXrAxisType::kTrackpad, "/input/trackpad"}, {OpenXrAxisType::kTrackpad, "/input/trackpad"},
{OpenXrAxisType::kThumbstick, "/input/thumbstick"}, {OpenXrAxisType::kThumbstick, "/input/thumbstick"},
...@@ -394,12 +405,31 @@ constexpr OpenXrControllerInteractionProfile kHPReverbG2InteractionProfile = { ...@@ -394,12 +405,31 @@ constexpr OpenXrControllerInteractionProfile kHPReverbG2InteractionProfile = {
kHPReverbG2ControllerAxisPathMaps, kHPReverbG2ControllerAxisPathMaps,
base::size(kHPReverbG2ControllerAxisPathMaps)}; base::size(kHPReverbG2ControllerAxisPathMaps)};
constexpr OpenXrControllerInteractionProfile
kHandInteractionMSFTInteractionProfile = {
OpenXrInteractionProfileType::kHandSelect,
"/interaction_profiles/microsoft/hand_interaction",
XR_MSFT_HAND_INTERACTION_EXTENSION_NAME,
GamepadMapping::kNone,
kGenericHandSelectInputProfile,
base::size(kGenericHandSelectInputProfile),
kGenericHandSelectButtonPathMaps,
base::size(kGenericHandSelectButtonPathMaps),
kGenericHandSelectButtonPathMaps,
base::size(kGenericHandSelectButtonPathMaps),
nullptr,
0};
constexpr OpenXrControllerInteractionProfile constexpr OpenXrControllerInteractionProfile
kOpenXrControllerInteractionProfiles[] = { kOpenXrControllerInteractionProfiles[] = {
kMicrosoftMotionInteractionProfile, kKHRSimpleInteractionProfile, kMicrosoftMotionInteractionProfile,
kOculusTouchInteractionProfile, kValveIndexInteractionProfile, kKHRSimpleInteractionProfile,
kHTCViveInteractionProfile, kSamsungOdysseyInteractionProfile, kOculusTouchInteractionProfile,
kHPReverbG2InteractionProfile}; kValveIndexInteractionProfile,
kHTCViveInteractionProfile,
kSamsungOdysseyInteractionProfile,
kHPReverbG2InteractionProfile,
kHandInteractionMSFTInteractionProfile};
} // namespace device } // namespace device
......
...@@ -125,6 +125,13 @@ XrResult CreateInstance( ...@@ -125,6 +125,13 @@ XrResult CreateInstance(
extensions.push_back(XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME); extensions.push_back(XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
} }
const bool handInteractionExtensionSupported =
extension_enumeration.ExtensionSupported(
XR_MSFT_HAND_INTERACTION_EXTENSION_NAME);
if (handInteractionExtensionSupported) {
extensions.push_back(XR_MSFT_HAND_INTERACTION_EXTENSION_NAME);
}
instance_create_info.enabledExtensionCount = instance_create_info.enabledExtensionCount =
static_cast<uint32_t>(extensions.size()); static_cast<uint32_t>(extensions.size());
instance_create_info.enabledExtensionNames = extensions.data(); instance_create_info.enabledExtensionNames = extensions.data();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment