Skip to content

Commit 22ab0be

Browse files
authored
Merge pull request #7093 from keveleigh/cherrypicked-input-helpers
XR SDK input helpers
2 parents 2e07623 + 0dcef78 commit 22ab0be

File tree

8 files changed

+108
-1
lines changed

8 files changed

+108
-1
lines changed

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/Shared/Extensions.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
5+
using Microsoft.MixedReality.Toolkit.Utilities;
6+
using Windows.UI.Input.Spatial;
7+
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
8+
9+
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality
10+
{
11+
/// <summary>
12+
/// Provides useful extensions for Windows-defined types.
13+
/// </summary>
14+
public static class WindowsExtensions
15+
{
16+
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
17+
/// <summary>
18+
/// Converts a platform <see cref="SpatialInteractionSourceHandedness"/> into
19+
/// the equivalent value in MRTK's defined <see cref="Handedness"/>.
20+
/// </summary>
21+
/// <param name="handedness">The handedness value to convert.</param>
22+
/// <returns>The converted value in the new type.</returns>
23+
public static Handedness ToMRTKHandedness(this SpatialInteractionSourceHandedness handedness)
24+
{
25+
switch (handedness)
26+
{
27+
case SpatialInteractionSourceHandedness.Left:
28+
return Handedness.Left;
29+
case SpatialInteractionSourceHandedness.Right:
30+
return Handedness.Right;
31+
case SpatialInteractionSourceHandedness.Unspecified:
32+
default:
33+
return Handedness.None;
34+
}
35+
}
36+
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
37+
}
38+
}

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/Shared/Extensions/WindowsExtensions.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XR2018/WindowsMixedRealityUtilitiesProvider.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality
1212
{
13+
/// <summary>
14+
/// An implementation of <see cref="IWindowsMixedRealityUtilitiesProvider"/> for Unity's in-box XR pipeline.
15+
/// </summary>
1316
public class WindowsMixedRealityUtilitiesProvider : IWindowsMixedRealityUtilitiesProvider
1417
{
1518
/// <inheritdoc />
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.MixedReality.Toolkit.WindowsMixedReality;
5+
using System;
6+
7+
#if WMR_ENABLED
8+
using UnityEngine.XR.WindowsMR;
9+
#endif // WMR_ENABLED
10+
11+
namespace Microsoft.MixedReality.Toolkit.XRSDK.WindowsMixedReality
12+
{
13+
/// <summary>
14+
/// An implementation of <see cref="Toolkit.WindowsMixedReality.IWindowsMixedRealityUtilitiesProvider"/> for Unity's XR SDK pipeline.
15+
/// </summary>
16+
public class XRSDKWindowsMixedRealityUtilitiesProvider : IWindowsMixedRealityUtilitiesProvider
17+
{
18+
/// <inheritdoc />
19+
IntPtr IWindowsMixedRealityUtilitiesProvider.ISpatialCoordinateSystemPtr =>
20+
#if WMR_ENABLED
21+
WindowsMREnvironment.OriginSpatialCoordinateSystem;
22+
#else
23+
IntPtr.Zero;
24+
#endif
25+
26+
/// <inheritdoc />
27+
IntPtr IWindowsMixedRealityUtilitiesProvider.IHolographicFramePtr
28+
{
29+
get
30+
{
31+
// NOTE: Currently unable to access HolographicFrame in XR SDK.
32+
return IntPtr.Zero;
33+
}
34+
}
35+
}
36+
}

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XRSDK/XRSDKWindowsMixedRealityUtilitiesProvider.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit.Providers/XRSDK/Profiles/DefaultXRSDKToolkitConfigurationProfile.asset renamed to Assets/MixedRealityToolkit.Providers/XRSDK/Profiles/DefaultXRSDKConfigurationProfile.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MonoBehaviour:
1010
m_Enabled: 1
1111
m_EditorHideFlags: 0
1212
m_Script: {fileID: 11500000, guid: 7612acbc1a4a4ed0afa5f4ccbe42bee4, type: 3}
13-
m_Name: DefaultXRSDKToolkitConfigurationProfile
13+
m_Name: DefaultXRSDKConfigurationProfile
1414
m_EditorClassIdentifier:
1515
isCustomProfile: 0
1616
targetExperienceScale: 3

Assets/MixedRealityToolkit.Providers/XRSDK/Profiles/DefaultXRSDKToolkitConfigurationProfile.asset.meta renamed to Assets/MixedRealityToolkit.Providers/XRSDK/Profiles/DefaultXRSDKConfigurationProfile.asset.meta

File renamed without changes.

0 commit comments

Comments
 (0)