Add hand/left/grip and hand/right/grip devices;

This commit is contained in:
bjorn 2023-07-31 17:57:24 -07:00
parent c6cb5451ee
commit 5fddd28137
3 changed files with 29 additions and 23 deletions

View File

@ -24,6 +24,8 @@ StringEntry lovrDevice[] = {
[DEVICE_FLOOR] = ENTRY("floor"),
[DEVICE_HAND_LEFT] = ENTRY("hand/left"),
[DEVICE_HAND_RIGHT] = ENTRY("hand/right"),
[DEVICE_HAND_LEFT_GRIP] = ENTRY("hand/left/grip"),
[DEVICE_HAND_RIGHT_GRIP] = ENTRY("hand/right/grip"),
[DEVICE_HAND_LEFT_POINT] = ENTRY("hand/left/point"),
[DEVICE_HAND_RIGHT_POINT] = ENTRY("hand/right/point"),
[DEVICE_ELBOW_LEFT] = ENTRY("elbow/left"),

View File

@ -41,6 +41,8 @@ typedef enum {
DEVICE_FLOOR,
DEVICE_HAND_LEFT,
DEVICE_HAND_RIGHT,
DEVICE_HAND_LEFT_GRIP,
DEVICE_HAND_RIGHT_GRIP,
DEVICE_HAND_LEFT_POINT,
DEVICE_HAND_RIGHT_POINT,
DEVICE_ELBOW_LEFT,

View File

@ -125,7 +125,7 @@ XR_FOREACH(XR_DECLARE)
XR_FOREACH_PLATFORM(XR_DECLARE)
enum {
ACTION_HAND_POSE,
ACTION_GRIP_POSE,
ACTION_POINTER_POSE,
ACTION_TRACKER_POSE,
ACTION_GAZE_POSE,
@ -320,7 +320,9 @@ static XrAction getPoseActionForDevice(Device device) {
return XR_NULL_HANDLE; // Uses reference space
case DEVICE_HAND_LEFT:
case DEVICE_HAND_RIGHT:
return state.actions[ACTION_HAND_POSE];
case DEVICE_HAND_LEFT_GRIP:
case DEVICE_HAND_RIGHT_GRIP:
return state.actions[ACTION_GRIP_POSE];
case DEVICE_HAND_LEFT_POINT:
case DEVICE_HAND_RIGHT_POINT:
return state.actions[ACTION_POINTER_POSE];
@ -633,8 +635,8 @@ static bool openxr_init(HeadsetConfig* config) {
XR_INIT(xrStringToPath(state.instance, "/user/hand/left", &state.actionFilters[DEVICE_HAND_LEFT]), "Failed to create path");
XR_INIT(xrStringToPath(state.instance, "/user/hand/right", &state.actionFilters[DEVICE_HAND_RIGHT]), "Failed to create path");
state.actionFilters[DEVICE_HAND_LEFT_POINT] = state.actionFilters[DEVICE_HAND_LEFT];
state.actionFilters[DEVICE_HAND_RIGHT_POINT] = state.actionFilters[DEVICE_HAND_RIGHT];
state.actionFilters[DEVICE_HAND_LEFT_POINT] = state.actionFilters[DEVICE_HAND_LEFT_GRIP] = state.actionFilters[DEVICE_HAND_LEFT];
state.actionFilters[DEVICE_HAND_RIGHT_POINT] = state.actionFilters[DEVICE_HAND_RIGHT_GRIP] = state.actionFilters[DEVICE_HAND_RIGHT];
if (state.features.viveTrackers) {
XR_INIT(xrStringToPath(state.instance, "/user/vive_tracker_htcx/role/left_elbow", &state.actionFilters[DEVICE_ELBOW_LEFT]), "Failed to create path");
@ -672,7 +674,7 @@ static bool openxr_init(HeadsetConfig* config) {
};
XrActionCreateInfo actionInfo[] = {
{ 0, NULL, "hand_pose", XR_ACTION_TYPE_POSE_INPUT, 2, hands, "Hand Pose" },
{ 0, NULL, "grip_pose", XR_ACTION_TYPE_POSE_INPUT, 2, hands, "Grip Pose" },
{ 0, NULL, "pointer_pose", XR_ACTION_TYPE_POSE_INPUT, 2, hands, "Pointer Pose" },
{ 0, NULL, "tracker_pose", XR_ACTION_TYPE_POSE_INPUT, 12, trackers, "Tracker Pose" },
{ 0, NULL, "gaze_pose", XR_ACTION_TYPE_POSE_INPUT, 0, NULL, "Gaze Pose" },
@ -755,8 +757,8 @@ static bool openxr_init(HeadsetConfig* config) {
Binding* bindings[] = {
[PROFILE_SIMPLE] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/select/click" },
@ -768,8 +770,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_VIVE] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/click" },
@ -793,8 +795,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_TOUCH] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/value" },
@ -832,8 +834,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_GO] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/click" },
@ -849,8 +851,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_INDEX] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/click" },
@ -894,8 +896,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_WMR] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/value" },
@ -927,8 +929,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_ML2] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/click" },
@ -952,8 +954,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_PICO_NEO3] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/click" },
@ -989,8 +991,8 @@ static bool openxr_init(HeadsetConfig* config) {
{ 0, NULL }
},
[PROFILE_PICO4] = (Binding[]) {
{ ACTION_HAND_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_HAND_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/left/input/grip/pose" },
{ ACTION_GRIP_POSE, "/user/hand/right/input/grip/pose" },
{ ACTION_POINTER_POSE, "/user/hand/left/input/aim/pose" },
{ ACTION_POINTER_POSE, "/user/hand/right/input/aim/pose" },
{ ACTION_TRIGGER_DOWN, "/user/hand/left/input/trigger/value" },