openxr: Add support for ContactGlove2+Magnetra2

This commit is contained in:
Beyley Cardellio 2026-08-01 19:59:25 -07:00 committed by galister
parent 29c5800a61
commit b85077b559
4 changed files with 136 additions and 1 deletions

View File

@ -95,7 +95,7 @@ pub(super) fn init_xr() -> Result<(xr::Instance, xr::SystemId), anyhow::Error> {
enabled_extensions.other.push(xr_extension);
}
let xr_extension = b"XR_VALVE_frame_controller_interaction".to_vec();
let xr_extension: Vec<u8> = b"XR_MND_contactglove2_interaction\0".to_vec();
if available_extensions.other.contains(&xr_extension) {
enabled_extensions.other.push(xr_extension);
}

View File

@ -500,5 +500,61 @@
left: "/user/hand/left/output/haptic",
right: "/user/hand/right/output/haptic"
}
},
{
profile: "/interaction_profiles/mnd/contactglove2_with_magnetra2_mnd",
pose: {
left: "/user/hand/left/input/aim/pose",
right: "/user/hand/right/input/aim/pose"
},
click: {
left: "/user/hand/left/input/trigger/value",
right: "/user/hand/right/input/trigger/value"
},
grab: {
left: "/user/hand/left/input/squeeze/value",
right: "/user/hand/right/input/squeeze/value"
},
show_hide: {
left: "/user/hand/left/input/system/click",
},
toggle_dashboard: {
right: "/user/hand/right/input/system/click",
},
space_drag: {
left: "/user/hand/left/input/pairing_mnd/click",
},
space_rotate: {
right: "/user/hand/right/input/pairing_mnd/click",
},
space_reset: {
left: "/user/hand/left/input/pairing_mnd/click",
right: "/user/hand/right/input/pairing_mnd/click",
double_click: true,
},
click_modifier_right: {
left: "/user/hand/left/input/y/click",
right: "/user/hand/right/input/y/click"
},
click_modifier_middle: {
left: "/user/hand/left/input/x/click",
right: "/user/hand/right/input/x/click"
},
move_mouse: {
left: "/user/hand/left/input/trigger/value",
right: "/user/hand/right/input/trigger/value",
},
scroll: {
left: "/user/hand/left/input/thumbstick/y",
right: "/user/hand/right/input/thumbstick/y"
},
scroll_horizontal: {
left: "/user/hand/left/input/thumbstick/x",
right: "/user/hand/right/input/thumbstick/x"
},
haptic: {
left: "/user/hand/left/output/haptic",
right: "/user/hand/right/output/haptic"
}
}
]

View File

@ -47,6 +47,7 @@ pub enum XrInputSubpathKind {
System,
Menu,
View,
PairingMnd,
Primary,
Secondary,

View File

@ -738,3 +738,81 @@ const KHR_GENERIC_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[
components: &[],
},
];
pub const MAGNETRA2_CONTROLLER_PROFILE: XrControllerProfile = XrControllerProfile {
display_name: "ContactGlove2 + Magnetra2",
extension: Some("XR_MND_contactglove2_interaction"),
profile_id: "/interaction_profiles/mnd/contactglove2_with_magnetra2_mnd",
user_paths: &[
XrControllerUserPath {
hand: XrInputSide::Left,
paths: MAGNETRA2_USER_PATHS,
},
XrControllerUserPath {
hand: XrInputSide::Right,
paths: MAGNETRA2_USER_PATHS,
},
],
};
const MAGNETRA2_USER_PATHS: &[XrInputSubpath] = &[
XrInputSubpath {
kind: XrInputSubpathKind::A,
components: &[XrInputComponent::Click],
},
XrInputSubpath {
kind: XrInputSubpathKind::B,
components: &[XrInputComponent::Click],
},
XrInputSubpath {
kind: XrInputSubpathKind::X,
components: &[XrInputComponent::Click],
},
XrInputSubpath {
kind: XrInputSubpathKind::Y,
components: &[XrInputComponent::Click],
},
XrInputSubpath {
kind: XrInputSubpathKind::System,
components: &[XrInputComponent::Click],
},
XrInputSubpath {
kind: XrInputSubpathKind::PairingMnd,
components: &[XrInputComponent::Click],
},
XrInputSubpath {
kind: XrInputSubpathKind::Squeeze,
components: &[XrInputComponent::Value],
},
XrInputSubpath {
kind: XrInputSubpathKind::Trigger,
components: &[
XrInputComponent::Click,
XrInputComponent::Value,
],
},
XrInputSubpath {
kind: XrInputSubpathKind::Thumbstick,
components: &[
XrInputComponent::Click,
XrInputComponent::X,
XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
],
},
XrInputSubpath {
kind: XrInputSubpathKind::Grip,
components: &[XrInputComponent::Pose],
},
XrInputSubpath {
kind: XrInputSubpathKind::Aim,
components: &[XrInputComponent::Pose],
},
XrInputSubpath {
kind: XrInputSubpathKind::Haptic,
components: &[],
},
];