Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Dev spatial awareness (#20)
Browse files Browse the repository at this point in the history
* added initial files for spatial awareness

* Implemented LuminSpatialObserver

* blocked out platform support

* removed a few more base profile references
  • Loading branch information
StephenHodgson authored May 10, 2019
1 parent a196ab9 commit 87b61fa
Show file tree
Hide file tree
Showing 11 changed files with 417 additions and 7 deletions.
14 changes: 14 additions & 0 deletions Inspectors/LuminSpatialMeshObserverProfileInspector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEditor;
using XRTK.Inspectors.Profiles.SpatialAwareness;
using XRTK.Lumin.Profiles;

namespace XRTK.Lumin.Inspectors
{
[CustomEditor(typeof(LuminSpatialMeshObserverProfile))]
public class LuminSpatialMeshObserverProfileInspector : BaseMixedRealitySpatialMeshObserverProfileInspector
{
}
}
11 changes: 11 additions & 0 deletions Inspectors/LuminSpatialMeshObserverProfileInspector.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions LuminApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#if PLATFORM_LUMIN

using System;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Experimental.XR;
using UnityEngine.XR.MagicLeap;

namespace XRTK.Lumin
{
/// <summary>
/// Shamelessly lifted from the UnityEngine.XR.MagicLeap packages, but Unity had to make their class internal. Boo.
/// </summary>
internal static class LuminApi
{
private const string UNITY_MAGIC_LEAP_DLL = "UnityMagicLeap";

[DllImport(UNITY_MAGIC_LEAP_DLL)]
public static extern void UnityMagicLeap_MeshingUpdateSettings(MeshingSettings newSettings);

[DllImport(UNITY_MAGIC_LEAP_DLL)]
public static extern void UnityMagicLeap_MeshingSetLod(MLSpatialMapper.LevelOfDetail lod);

[DllImport(UNITY_MAGIC_LEAP_DLL)]
public static extern void UnityMagicLeap_MeshingSetBounds(Vector3 center, Quaternion rotation, Vector3 extents);

[DllImport(UNITY_MAGIC_LEAP_DLL)]
public static extern void UnityMagicLeap_MeshingSetBatchSize(int batchSize);

[DllImport(UNITY_MAGIC_LEAP_DLL)]
public static extern IntPtr UnityMagicLeap_MeshingAcquireConfidence(TrackableId meshId, out int count);

[DllImport(UNITY_MAGIC_LEAP_DLL)]
public static extern void UnityMagicLeap_MeshingReleaseConfidence(TrackableId meshId);

[Flags]
public enum MeshingFlags
{
None = 0,
PointCloud = 1,
ComputeNormals = 2,
ComputeConfidence = 4,
Planarize = 8,
RemoveMeshSkirt = 16, // 0x00000010
IndexOrderCCW = 32, // 0x00000020
}

[StructLayout(LayoutKind.Sequential)]
public struct MeshingSettings
{
public MeshingFlags flags;
public float fillHoleLength;
public float disconnectedComponentArea;
}
}
}

#endif // PLATFORM_LUMIN
11 changes: 11 additions & 0 deletions LuminApi.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Profiles/LuminSpatialMeshObserverProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using XRTK.Definitions.Utilities;
using XRTK.Providers.SpatialObservers;

namespace XRTK.Lumin.Profiles
{
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Spatial Observers/Lumin Spatial Mesh Data Provider Profile", fileName = "LuminMeshObserverProfile", order = (int)CreateProfileMenuItemIndices.SpatialAwarenessDataProviders)]
public class LuminSpatialMeshObserverProfile : BaseMixedRealitySpatialMeshObserverProfile { }
}
11 changes: 11 additions & 0 deletions Profiles/LuminSpatialMeshObserverProfile.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 87b61fa

Please sign in to comment.