diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java index a01152b98..0602dbf6a 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java @@ -1162,7 +1162,7 @@ public int getPointerColor() { @Keep @SuppressWarnings("unused") private void setDeviceType(int aType) { - if (DeviceType.isOculusBuild()) { + if (DeviceType.isOculusBuild() || DeviceType.isWaveBuild()) { runOnUiThread(() -> DeviceType.setType(aType)); } } diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WebXRInterstitialWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WebXRInterstitialWidget.java index 461484b8b..713a143f9 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WebXRInterstitialWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WebXRInterstitialWidget.java @@ -93,6 +93,8 @@ private void initializeControllers() { addController(DeviceType.PicoNeo2, WebXRInterstitialController.HAND_RIGHT); } else if (deviceType == DeviceType.PicoG2) { addController(DeviceType.PicoG2, WebXRInterstitialController.HAND_NONE); + } else if (deviceType == DeviceType.ViveFocus) { + addController(DeviceType.ViveFocus, WebXRInterstitialController.HAND_NONE); } else if (deviceType == DeviceType.ViveFocusPlus) { addController(DeviceType.ViveFocusPlus, WebXRInterstitialController.HAND_LEFT); addController(DeviceType.ViveFocusPlus, WebXRInterstitialController.HAND_RIGHT); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/utils/DeviceType.java b/app/src/common/shared/org/mozilla/vrbrowser/utils/DeviceType.java index 9a43e6c14..55446b4a1 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/utils/DeviceType.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/utils/DeviceType.java @@ -8,14 +8,15 @@ public class DeviceType { // These values need to match those in Device.h - @IntDef(value = { Unknown, OculusGo, OculusQuest, ViveFocusPlus, PicoNeo2, PicoG2 }) + @IntDef(value = { Unknown, OculusGo, OculusQuest, ViveFocus, ViveFocusPlus, PicoNeo2, PicoG2 }) public @interface Type {} public static final int Unknown = 0; public static final int OculusGo = 1; public static final int OculusQuest = 2; - public static final int ViveFocusPlus = 3; - public static final int PicoNeo2 = 4; - public static final int PicoG2 = 5; + public static final int ViveFocus = 3; + public static final int ViveFocusPlus = 4; + public static final int PicoNeo2 = 6; + public static final int PicoG2 = 7; private static @Type int mType = Unknown; @@ -28,6 +29,9 @@ public static void setType(@Type int aType) { case OculusQuest: name = "Oculus Quest"; break; + case ViveFocus: + name = "Vive Focus"; + break; case ViveFocusPlus: name = "Vive Focus Plus"; break; diff --git a/app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp b/app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp index d7ef518a8..2351b98aa 100644 --- a/app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp +++ b/app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp @@ -90,6 +90,7 @@ struct DeviceDelegateWaveVR::State { GestureDelegatePtr gestures; std::array controllers; ImmersiveDisplayPtr immersiveDisplay; + device::DeviceType deviceType; bool lastSubmitDiscarded; bool recentered; vrb::Matrix reorientMatrix; @@ -110,6 +111,7 @@ struct DeviceDelegateWaveVR::State { , renderHeight(0) , devicePairs {} , controllers {} + , deviceType(device::UnknownType) , lastSubmitDiscarded(false) , recentered(false) , ignoreNextRecenter(false) @@ -132,6 +134,11 @@ struct DeviceDelegateWaveVR::State { sixDoFControllerCount++; } } + if (sixDoFControllerCount) { + deviceType = device::ViveFocusPlus; + } else { + deviceType = device::ViveFocus; + } reorientMatrix = vrb::Matrix::Identity(); } @@ -454,6 +461,11 @@ DeviceDelegateWaveVR::Create(vrb::RenderContextPtr& aContext) { return result; } +device::DeviceType +DeviceDelegateWaveVR::GetDeviceType() { + return m.deviceType; +} + void DeviceDelegateWaveVR::SetRenderMode(const device::RenderMode aMode) { if (aMode == m.renderMode) { diff --git a/app/src/wavevr/cpp/DeviceDelegateWaveVR.h b/app/src/wavevr/cpp/DeviceDelegateWaveVR.h index 9fd86bff1..f4e32e93b 100644 --- a/app/src/wavevr/cpp/DeviceDelegateWaveVR.h +++ b/app/src/wavevr/cpp/DeviceDelegateWaveVR.h @@ -15,6 +15,7 @@ class DeviceDelegateWaveVR : public DeviceDelegate { public: static DeviceDelegateWaveVRPtr Create(vrb::RenderContextPtr& aContext); // DeviceDelegate interface + device::DeviceType GetDeviceType() override; void SetRenderMode(const device::RenderMode aMode) override; device::RenderMode GetRenderMode() override; void RegisterImmersiveDisplay(ImmersiveDisplayPtr aDisplay) override; diff --git a/app/src/wavevr/java/org/mozilla/vrbrowser/PlatformActivity.java b/app/src/wavevr/java/org/mozilla/vrbrowser/PlatformActivity.java index ea353f3f4..6f27e0033 100644 --- a/app/src/wavevr/java/org/mozilla/vrbrowser/PlatformActivity.java +++ b/app/src/wavevr/java/org/mozilla/vrbrowser/PlatformActivity.java @@ -36,7 +36,6 @@ public PlatformActivity() { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - DeviceType.setType(DeviceType.ViveFocusPlus); queueRunnable(new Runnable() { @Override diff --git a/app/src/wavevr/res/drawable/controller_focus.png b/app/src/wavevr/res/drawable/controller_focus.png new file mode 100644 index 000000000..2f005a538 Binary files /dev/null and b/app/src/wavevr/res/drawable/controller_focus.png differ diff --git a/app/src/wavevr/res/drawable/controller_focus_left.png b/app/src/wavevr/res/drawable/controller_focus_plus_left.png similarity index 100% rename from app/src/wavevr/res/drawable/controller_focus_left.png rename to app/src/wavevr/res/drawable/controller_focus_plus_left.png diff --git a/app/src/wavevr/res/drawable/controller_focus_right.png b/app/src/wavevr/res/drawable/controller_focus_plus_right.png similarity index 100% rename from app/src/wavevr/res/drawable/controller_focus_right.png rename to app/src/wavevr/res/drawable/controller_focus_plus_right.png diff --git a/app/src/wavevr/res/layout/webxr_interstitial_controller.xml b/app/src/wavevr/res/layout/webxr_interstitial_controller.xml index f60e74420..a6c078ec3 100644 --- a/app/src/wavevr/res/layout/webxr_interstitial_controller.xml +++ b/app/src/wavevr/res/layout/webxr_interstitial_controller.xml @@ -20,8 +20,8 @@ android:background="#00000000" android:padding="5dp"> - - + + - + + + + + + + \ No newline at end of file