Skip to content

Commit

Permalink
[Pico] Rename PicoXR device type to Pico4x
Browse files Browse the repository at this point in the history
The PicoXR name was selected by the first contributor to the Pico4 port
hoping to cover multiple devices with a single name. However the idea
behind DeviceType is precisely to add per-device specific code/settings.
For platform stuff we always have the different build flavours (in the
case of Pico we'll keep using PicoXR as it's now).

This will allow us to eventually support more OpenXR Pico devices,
like the Neo3.

Apart from the rename we're removing duplicated code like the input
profile for the Pico 4E which is exactly equal to the Pico 4. Actually
we don't have any Pico4E specific code (nor even the android model)
so it does make sense to merge both in the Pico4x device type.
  • Loading branch information
svillar committed Jan 9, 2024
1 parent b254d1f commit 6e1c595
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ private void initializeControllers() {
} else if (deviceType == DeviceType.PicoNeo3) {
addController(DeviceType.PicoNeo3, WebXRInterstitialController.HAND_LEFT);
addController(DeviceType.PicoNeo3, WebXRInterstitialController.HAND_RIGHT);
} else if (deviceType == DeviceType.PicoXR) {
addController(DeviceType.PicoXR, WebXRInterstitialController.HAND_LEFT);
addController(DeviceType.PicoXR, WebXRInterstitialController.HAND_RIGHT);
} else if (deviceType == DeviceType.Pico4x) {
addController(DeviceType.Pico4x, WebXRInterstitialController.HAND_LEFT);
addController(DeviceType.Pico4x, WebXRInterstitialController.HAND_RIGHT);
} else if (DeviceType.isHVRBuild()) {
if (PlatformActivity.isPositionTrackingSupported()) {
addController(DeviceType.HVR6DoF, WebXRInterstitialController.HAND_LEFT);
Expand Down
9 changes: 4 additions & 5 deletions app/src/common/shared/com/igalia/wolvic/utils/DeviceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;

import androidx.annotation.IntDef;
Expand All @@ -12,7 +11,7 @@

public class DeviceType {
// These values need to match those in Device.h
@IntDef(value = {Unknown, OculusGo, OculusQuest, ViveFocus, ViveFocusPlus, PicoNeo2, PicoG2, PicoNeo3, OculusQuest2, HVR3DoF, HVR6DoF, PicoXR, MetaQuestPro, LynxR1, LenovoA3, LenovoVRX, MagicLeap2, MetaQuest3, VisionGlass})
@IntDef(value = {Unknown, OculusGo, OculusQuest, ViveFocus, ViveFocusPlus, PicoNeo2, PicoG2, PicoNeo3, OculusQuest2, HVR3DoF, HVR6DoF, Pico4x, MetaQuestPro, LynxR1, LenovoA3, LenovoVRX, MagicLeap2, MetaQuest3, VisionGlass})
public @interface Type {}
public static final int Unknown = 0;
public static final int OculusGo = 1;
Expand All @@ -25,7 +24,7 @@ public class DeviceType {
public static final int OculusQuest2 = 9;
public static final int HVR3DoF = 10;
public static final int HVR6DoF = 11;
public static final int PicoXR = 12;
public static final int Pico4x = 12;
public static final int MetaQuestPro = 13;
public static final int LynxR1 = 14;
public static final int LenovoA3 = 15;
Expand Down Expand Up @@ -66,8 +65,8 @@ public static void setType(@Type int aType) {
case PicoG2:
mDeviceName = "Pico G2";
break;
case PicoXR:
mDeviceName = "Pico XR";
case Pico4x:
mDeviceName = "Pico 4/4E";
break;
case LynxR1:
mDeviceName = "Lynx-R1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static Environment getExternalEnvironmentById(@NonNull Context context, @
public static String getEnvironmentPayload(Environment env) {
if (DeviceType.isPicoXR() || DeviceType.isOculusBuild()) {
String payload = env.getPayload();
String format = DeviceType.isOculusBuild() ? "_ktx" : "_misc"; // PicoXR doesn't support 'ktx'
String format = DeviceType.isOculusBuild() ? "_ktx" : "_misc"; // Pico4x doesn't support 'ktx'
int at = payload.lastIndexOf(".");
return payload.substring(0, at) + format + "_srgb" + payload.substring(at);
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DeviceType PicoNeo3 = 8;
const DeviceType OculusQuest2 = 9;
const DeviceType HVR3DoF = 10;
const DeviceType HVR6DoF = 11;
const DeviceType PicoXR = 12;
const DeviceType Pico4x = 12;
const DeviceType MetaQuestPro = 13;
const DeviceType LynxR1 = 14;
const DeviceType LenovoA3 = 15;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/DeviceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ device::DeviceType DeviceUtils::GetDeviceTypeFromSystem(bool is6DoF) {
deviceNamesMap.emplace("Quest 2", device::OculusQuest2);
deviceNamesMap.emplace("Quest 3", device::MetaQuest3);
// So far no need to differentiate between Pico4 and Pico4E
deviceNamesMap.emplace("A8110", device::PicoXR);
deviceNamesMap.emplace("A8110", device::Pico4x);
deviceNamesMap.emplace("Lynx-R1", device::LynxR1);
deviceNamesMap.emplace("motorola edge 30 pro", device::LenovoA3);
deviceNamesMap.emplace("Quest Pro", device::MetaQuestPro);
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 @@ -251,7 +251,7 @@ mozilla::gfx::VRControllerType GetVRControllerTypeByDevice(device::DeviceType aT
case device::PicoNeo3:
result = mozilla::gfx::VRControllerType::PicoNeo2;
break;
case device::PicoXR:
case device::Pico4x:
result = mozilla::gfx::VRControllerType::Pico4;
break;
case device::MagicLeap2:
Expand Down
6 changes: 3 additions & 3 deletions app/src/openxr/cpp/DeviceDelegateOpenXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ struct DeviceDelegateOpenXR::State {
#if OCULUSVR
return OculusTouch.path;
#elif PICOXR
return Pico4.path;
return Pico4x.path;
#else
if (deviceType == device::MagicLeap2)
return MagicLeap2.path;
Expand Down Expand Up @@ -648,9 +648,9 @@ struct DeviceDelegateOpenXR::State {
case device::MetaQuest3:
case device::OculusQuest2:
case device::MetaQuestPro:
// PicoXR default is 72hz, but has an experimental setting to set it to 90hz. If the setting
// Pico4x default is 72hz, but has an experimental setting to set it to 90hz. If the setting
// is disabled we'll select 72hz which is the only one advertised by OpenXR in that case.
case device::PicoXR:
case device::Pico4x:
suggestedRefreshRate = 90.0;
break;
case device::OculusQuest:
Expand Down
33 changes: 4 additions & 29 deletions app/src/openxr/cpp/OpenXRInputMappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,37 +243,12 @@ namespace crow {
};

// Pico controller: this definition was created for the Pico 4, but the Neo 3 will likely also be compatible
const OpenXRInputMapping Pico4 {
const OpenXRInputMapping Pico4x {
"/interaction_profiles/pico/neo3_controller",
IS_6DOF,
"vr_controller_pico4_left.obj",
"vr_controller_pico4_right.obj",
device::PicoXR,
std::vector<OpenXRInputProfile> { "pico-4", "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 },
},
};

const OpenXRInputMapping Pico4E {
"/interaction_profiles/pico/neo3_controller",
IS_6DOF,
"vr_controller_pico4_left.obj",
"vr_controller_pico4_right.obj",
device::PicoXR,
device::Pico4x,
std::vector<OpenXRInputProfile> { "pico-4", "generic-trigger-squeeze-thumbstick" },
std::vector<OpenXRButton> {
{ OpenXRButtonType::Trigger, kPathTrigger, OpenXRButtonFlags::ValueTouch, OpenXRHandFlags::Both },
Expand Down Expand Up @@ -408,8 +383,8 @@ namespace crow {
},
};

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

} // namespace crow

0 comments on commit 6e1c595

Please sign in to comment.