Skip to content

Commit

Permalink
Add support for Pico Neo3 controllers
Browse files Browse the repository at this point in the history
This brings support for the PicoNeo3 device using the OpenXR backend.
Newly imported 3D controller models are used. The WebXR support was
previously added to Gecko in Igalia/wolvic-gecko-patches@bbffd2d

Fixes #557
  • Loading branch information
svillar committed Jan 16, 2024
1 parent f8426c2 commit c9c3bfd
Show file tree
Hide file tree
Showing 13 changed files with 22,085 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/src/main/cpp/DeviceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ device::DeviceType DeviceUtils::GetDeviceTypeFromSystem(bool is6DoF) {
deviceNamesMap.emplace("Quest Pro", device::MetaQuestPro);
deviceNamesMap.emplace("VRX", device::LenovoVRX);
deviceNamesMap.emplace("Magic Leap 2", device::MagicLeap2);
deviceNamesMap.emplace("Pico Neo 3", device::PicoNeo3);
}

auto device = deviceNamesMap.find(model);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/ExternalVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ mozilla::gfx::VRControllerType GetVRControllerTypeByDevice(device::DeviceType aT
result = mozilla::gfx::VRControllerType::PicoG2;
break;
case device::PicoNeo3:
result = mozilla::gfx::VRControllerType::PicoNeo2;
result = mozilla::gfx::VRControllerType::PicoNeo3;
break;
case device::Pico4x:
result = mozilla::gfx::VRControllerType::Pico4;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/moz_external_vr.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ enum class VRControllerType : uint8_t {
PicoGaze,
PicoG2,
PicoNeo2,
PicoNeo3,
Pico4,
MetaQuest3,
_end
Expand Down
29 changes: 27 additions & 2 deletions app/src/openxr/cpp/OpenXRInputMappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,31 @@ namespace crow {
},
};

const OpenXRInputMapping PicoNeo3 {
"/interaction_profiles/pico/neo3_controller",
IS_6DOF,
"vr_controller_piconeo3_left.obj",
"vr_controller_piconeo3_right.obj",
device::PicoNeo3,
std::vector<OpenXRInputProfile> { "pico-neo3", "generic-trigger-squeeze-thumbstick" },
std::vector<OpenXRButton> {
{ OpenXRButtonType::Trigger, kPathTrigger, OpenXRButtonFlags::ValueTouch, OpenXRHandFlags::Both },
{ OpenXRButtonType::Squeeze, kPathSqueeze, OpenXRButtonFlags::Value, OpenXRHandFlags::Both },
{ OpenXRButtonType::Thumbstick, kPathThumbstick, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Both },
{ OpenXRButtonType::ButtonX, kPathButtonX, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Left },
{ OpenXRButtonType::ButtonY, kPathButtonY, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Left, },
{ OpenXRButtonType::ButtonA, kPathButtonA, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Right },
{ OpenXRButtonType::ButtonB, kPathButtonB, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Right },
{ OpenXRButtonType::Back, kPathBack, OpenXRButtonFlags::Click, OpenXRHandFlags::Left, ControllerDelegate::Button::BUTTON_APP, true }
},
std::vector<OpenXRAxis> {
{ OpenXRAxisType::Thumbstick, kPathThumbstick, OpenXRHandFlags::Both },
},
std::vector<OpenXRHaptic> {
{ kPathHaptic, OpenXRHandFlags::Both },
},
};

// HVR 3DOF: https://github.com/immersive-web/webxr-input-profiles/blob/master/packages/registry/profiles/generic/generic-trigger-touchpad.json
const OpenXRInputMapping Hvr3DOF {
"/interaction_profiles/huawei/controller",
Expand Down Expand Up @@ -383,8 +408,8 @@ namespace crow {
},
};

const std::array<OpenXRInputMapping, 10> OpenXRInputMappings {
OculusTouch, OculusTouch2, MetaQuestTouchPro, Pico4x, Hvr6DOF, Hvr3DOF, LenovoVRX, MagicLeap2, MetaTouchPlus, KHRSimple
const std::array<OpenXRInputMapping, 11> OpenXRInputMappings {
OculusTouch, OculusTouch2, MetaQuestTouchPro, Pico4x, PicoNeo3, Hvr6DOF, Hvr3DOF, LenovoVRX, MagicLeap2, MetaTouchPlus, KHRSimple
};

} // namespace crow
13 changes: 13 additions & 0 deletions app/src/picoxr/assets/vr_controller_piconeo3_left.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Blender MTL File: 'None'
# Material Count: 1

newmtl lambert2SG
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd vr_controller_piconeo3_left_tex.jpeg
Loading

0 comments on commit c9c3bfd

Please sign in to comment.