Skip to content

Commit

Permalink
Remove support for preview MROpenXR versions
Browse files Browse the repository at this point in the history
Now that 1.0.0 is out, we should only support that and newer
  • Loading branch information
keveleigh committed Jul 29, 2021
1 parent eebbfe7 commit 4a2b9b5
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 83 deletions.
15 changes: 0 additions & 15 deletions Assets/MRTK/Providers/OpenXR/MRTK.OpenXR.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@
"expression": "",
"define": "MSFT_OPENXR"
},
{
"name": "com.microsoft.mixedreality.openxr",
"expression": "0.9.4-preview",
"define": "MSFT_OPENXR_0_9_4_OR_NEWER"
},
{
"name": "com.microsoft.mixedreality.openxr",
"expression": "0.2.0",
"define": "MSFT_OPENXR_0_2_0_OR_NEWER"
},
{
"name": "com.microsoft.mixedreality.openxr",
"expression": "0.1.3",
"define": "MSFT_OPENXR_0_1_3_OR_NEWER"
},
{
"name": "com.unity.xr.openxr",
"expression": "",
Expand Down
4 changes: 2 additions & 2 deletions Assets/MRTK/Providers/OpenXR/Scripts/HPReverbG2Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected override void UpdatePoseData(MixedRealityInteractionMapping interactio
}
}

#if MSFT_OPENXR_0_9_4_OR_NEWER
#if MSFT_OPENXR
private MicrosoftControllerModelProvider controllerModelProvider;

/// <inheritdoc />
Expand Down Expand Up @@ -114,6 +114,6 @@ private async void TryRenderControllerModelWithModelProvider()
controllerModel.SetActive(false);
}
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER
#endif // MSFT_OPENXR
}
}
28 changes: 2 additions & 26 deletions Assets/MRTK/Providers/OpenXR/Scripts/MicrosoftArticulatedHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,10 @@
using Unity.Profiling;
using UnityEngine;
using UnityEngine.XR;
using Handedness = Microsoft.MixedReality.Toolkit.Utilities.Handedness;

#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR_0_1_3_OR_NEWER
using FrameTime = Microsoft.MixedReality.OpenXR.FrameTime;
#else
using FrameTime = Microsoft.MixedReality.OpenXR.Preview.FrameTime;
#endif // MSFT_OPENXR_0_1_3_OR_NEWER

#if MSFT_OPENXR_0_2_0_OR_NEWER
using HandJoint = Microsoft.MixedReality.OpenXR.HandJoint;
using HandJointLocation = Microsoft.MixedReality.OpenXR.HandJointLocation;
using HandTracker = Microsoft.MixedReality.OpenXR.HandTracker;
#else
using HandJoint = Microsoft.MixedReality.OpenXR.Preview.HandJoint;
using HandJointLocation = Microsoft.MixedReality.OpenXR.Preview.HandJointLocation;
using HandTracker = Microsoft.MixedReality.OpenXR.Preview.HandTracker;
using Preview = Microsoft.MixedReality.OpenXR.Preview;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER
using Microsoft.MixedReality.OpenXR;
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

namespace Microsoft.MixedReality.Toolkit.XRSDK.OpenXR
Expand All @@ -52,11 +38,7 @@ public MicrosoftArticulatedHand(TrackingState trackingState, Handedness controll
handMeshProvider?.SetInputSource(inputSource);

#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR_0_2_0_OR_NEWER
handTracker = controllerHandedness == Handedness.Left ? HandTracker.Left : HandTracker.Right;
#else
handTracker = new HandTracker(controllerHandedness == Handedness.Left ? Preview.Handedness.Left : Preview.Handedness.Right, Preview.HandPoseType.Tracked);
#endif
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
}

Expand Down Expand Up @@ -266,15 +248,9 @@ private void UpdateHandData(InputDevice inputDevice)

// We want input sources to follow the playspace, so fold in the playspace transform here to
// put the pose into world space.
#if MSFT_OPENXR_0_2_0_OR_NEWER
Vector3 position = MixedRealityPlayspace.TransformPoint(handJointLocation.Pose.position);
Quaternion rotation = MixedRealityPlayspace.Rotation * handJointLocation.Pose.rotation;

#else
Vector3 position = MixedRealityPlayspace.TransformPoint(handJointLocation.Position);
Quaternion rotation = MixedRealityPlayspace.Rotation * handJointLocation.Rotation;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER

unityJointPoses[ConvertToTrackedHandJoint(handJoint)] = new MixedRealityPose(position, rotation);
}
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
using System.Threading.Tasks;
using UnityEngine;

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
using Microsoft.MixedReality.OpenXR;
using Microsoft.MixedReality.Toolkit.Utilities.Gltf.Serialization;
using System.Collections.Generic;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

namespace Microsoft.MixedReality.Toolkit.XRSDK.OpenXR
{
Expand All @@ -19,15 +19,15 @@ internal class MicrosoftControllerModelProvider
{
public MicrosoftControllerModelProvider(Utilities.Handedness handedness)
{
#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
controllerModelProvider = handedness == Utilities.Handedness.Left ? ControllerModel.Left : ControllerModel.Right;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
}

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
private static readonly Dictionary<ulong, GameObject> ControllerModelDictionary = new Dictionary<ulong, GameObject>(2);
private readonly ControllerModel controllerModelProvider;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

// Disables "This async method lacks 'await' operators and will run synchronously." when the correct OpenXR package isn't installed
#pragma warning disable CS1998
Expand All @@ -39,7 +39,7 @@ public async Task<GameObject> TryGenerateControllerModelFromPlatformSDK()
{
GameObject gltfGameObject = null;

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
if (!controllerModelProvider.TryGetControllerModelKey(out ulong modelKey))
{
Debug.LogError("Failed to obtain controller model key from platform.");
Expand Down Expand Up @@ -76,7 +76,7 @@ public async Task<GameObject> TryGenerateControllerModelFromPlatformSDK()
ControllerModelDictionary.Add(modelKey, gltfGameObject);
}
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

return gltfGameObject;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected override void UpdatePoseData(MixedRealityInteractionMapping interactio
}
}

#if MSFT_OPENXR_0_9_4_OR_NEWER
#if MSFT_OPENXR
private MicrosoftControllerModelProvider controllerModelProvider;

/// <inheritdoc />
Expand Down Expand Up @@ -118,6 +118,6 @@ private async void TryRenderControllerModelWithModelProvider()
controllerModel.SetActive(false);
}
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER
#endif // MSFT_OPENXR
}
}
20 changes: 10 additions & 10 deletions Assets/MRTK/Providers/OpenXR/Scripts/OpenXRDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
using UnityEngine.XR.OpenXR;
#endif // UNITY_OPENXR

#if MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#if MSFT_OPENXR && WINDOWS_UWP
using Microsoft.MixedReality.OpenXR;
using Microsoft.MixedReality.Toolkit.Windows.Input;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#endif // MSFT_OPENXR && WINDOWS_UWP

namespace Microsoft.MixedReality.Toolkit.XRSDK.OpenXR
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public OpenXRDeviceManager(
false;
#endif // UNITY_OPENXR

#if MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#if MSFT_OPENXR && WINDOWS_UWP
private GestureRecognizer gestureRecognizer;
private GestureRecognizer navigationGestureRecognizer;
private GestureEventData eventData;
Expand All @@ -61,7 +61,7 @@ public OpenXRDeviceManager(
private MixedRealityInputAction navigationAction = MixedRealityInputAction.None;
private MixedRealityInputAction manipulationAction = MixedRealityInputAction.None;
private MixedRealityInputAction selectAction = MixedRealityInputAction.None;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#endif // MSFT_OPENXR && WINDOWS_UWP

/// <inheritdoc />
public override void Enable()
Expand All @@ -78,9 +78,9 @@ public override void Enable()
return;
}

#if MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#if MSFT_OPENXR && WINDOWS_UWP
CreateGestureRecognizers();
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#endif // MSFT_OPENXR && WINDOWS_UWP

base.Enable();
}
Expand All @@ -94,7 +94,7 @@ private async void EnableIfLoaderBecomesActive()
}
}

#if MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#if MSFT_OPENXR && WINDOWS_UWP
/// <inheritdoc />
public override void Initialize()
{
Expand Down Expand Up @@ -134,7 +134,7 @@ public override void Disable()

base.Disable();
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#endif // MSFT_OPENXR && WINDOWS_UWP

#region Controller Utilities

Expand Down Expand Up @@ -262,7 +262,7 @@ protected override SupportedControllerType GetCurrentControllerType(InputDevice

#region Gesture implementation

#if MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#if MSFT_OPENXR && WINDOWS_UWP
private void ReadProfile()
{
if (InputSystemProfile.GesturesProfile != null)
Expand Down Expand Up @@ -503,7 +503,7 @@ private GenericXRSDKController FindMatchingController(GestureHandedness gestureH

return null;
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && WINDOWS_UWP
#endif // MSFT_OPENXR && WINDOWS_UWP

#endregion Gesture implementation
}
Expand Down
20 changes: 10 additions & 10 deletions Assets/MRTK/Providers/OpenXR/Scripts/OpenXRHandMeshProvider.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
using Microsoft.MixedReality.OpenXR;
using System.Collections.Generic;
using UnityEngine;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

using Microsoft.MixedReality.Toolkit.Input;
using Unity.Profiling;
Expand All @@ -21,23 +21,23 @@ internal class OpenXRHandMeshProvider
/// The user's left hand.
/// </summary>
public static OpenXRHandMeshProvider Left { get; } =
#if MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
new OpenXRHandMeshProvider(HandMeshTracker.Left, Utilities.Handedness.Left);
#else
null;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

/// <summary>
/// The user's right hand.
/// </summary>
public static OpenXRHandMeshProvider Right { get; } =
#if MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
new OpenXRHandMeshProvider(HandMeshTracker.Right, Utilities.Handedness.Right);
#else
null;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

#if MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
private OpenXRHandMeshProvider(HandMeshTracker handMeshTracker, Utilities.Handedness handedness)
{
this.handMeshTracker = handMeshTracker;
Expand All @@ -57,7 +57,7 @@ private OpenXRHandMeshProvider(HandMeshTracker handMeshTracker, Utilities.Handed
private readonly List<int> triangles = new List<int>();

private Vector2[] handMeshUVs = null;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

private IMixedRealityInputSource inputSource = null;

Expand All @@ -74,7 +74,7 @@ private OpenXRHandMeshProvider(HandMeshTracker handMeshTracker, Utilities.Handed
/// </summary>
public void UpdateHandMesh()
{
#if MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
using (UpdateHandMeshPerfMarker.Auto())
{
MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile;
Expand Down Expand Up @@ -155,7 +155,7 @@ private Vector2[] InitializeUVs(Vector3[] neutralPoseVertices)
}

return uvs;
#endif // MSFT_OPENXR_0_2_0_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

using UnityEngine;

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
using Microsoft.MixedReality.OpenXR;
using System.Linq;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

namespace Microsoft.MixedReality.Toolkit.XRSDK.OpenXR
{
Expand All @@ -17,7 +17,7 @@ public class OpenXRReprojectionUpdater : MonoBehaviour
/// </summary>
public HolographicReprojectionMethod ReprojectionMethod { get; set; }

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
private ReprojectionSettings reprojectionSettings = default;

private void OnPostRender()
Expand Down Expand Up @@ -54,6 +54,6 @@ private ReprojectionMode MapMRTKReprojectionMethodToOpenXR(HolographicReprojecti
return ReprojectionMode.NoReprojection;
}
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
using Microsoft.MixedReality.OpenXR;
using Unity.Profiling;
using UnityEngine.XR.OpenXR;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

namespace Microsoft.MixedReality.Toolkit.XRSDK.OpenXR
{
Expand Down Expand Up @@ -40,13 +40,13 @@ public OpenXRSpatialAwarenessMeshObserver(
{ }

protected override bool? IsActiveLoader =>
#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
LoaderHelpers.IsLoaderActive<OpenXRLoaderBase>();
#else
false;
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

#if MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
private static readonly ProfilerMarker ApplyUpdatedMeshDisplayOptionPerfMarker = new ProfilerMarker($"[MRTK] {nameof(OpenXRSpatialAwarenessMeshObserver)}.ApplyUpdatedMeshDisplayOption");

/// <inheritdoc/>
Expand Down Expand Up @@ -107,6 +107,6 @@ private VisualMeshLevelOfDetail MapMRTKLevelOfDetailToOpenXR(SpatialAwarenessMes
return VisualMeshLevelOfDetail.Coarse;
}
}
#endif // MSFT_OPENXR_0_9_4_OR_NEWER && (UNITY_STANDALONE_WIN || UNITY_WSA)
#endif // MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)
}
}

0 comments on commit 4a2b9b5

Please sign in to comment.