Skip to content

Commit f3a9791

Browse files
authored
Merge pull request #4834 from microsoft/prerelease/2.0.0.rc2_stabilization
RC2 Release
2 parents acee452 + a6456b5 commit f3a9791

File tree

1,298 files changed

+51358
-17265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,298 files changed

+51358
-17265
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ Assets/StreamingAssets.meta
7373
# DocFX Generated #
7474
# =============== #
7575
doc/
76+
77+
# =========================================== #
78+
# Asset Script Reference Retargeter Generated #
79+
# =========================================== #
80+
NuGet/

Assets/MixedRealityToolkit.Examples/Demos/Boundary/Scripts/BoundaryVisualizationDemo.cs

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,32 @@ public class BoundaryVisualizationDemo : MonoBehaviour, IMixedRealityBoundaryHan
3232
[SerializeField]
3333
private bool showBoundaryCeiling = true;
3434

35+
private IMixedRealityBoundarySystem boundarySystem = null;
36+
37+
private IMixedRealityBoundarySystem BoundarySystem
38+
{
39+
get
40+
{
41+
if (boundarySystem == null)
42+
{
43+
MixedRealityServiceRegistry.TryGetService<IMixedRealityBoundarySystem>(out boundarySystem);
44+
}
45+
return boundarySystem;
46+
}
47+
}
48+
3549
#region MonoBehaviour Implementation
3650

3751
private void Awake()
3852
{
3953
markerParent = new GameObject();
4054
markerParent.name = "Boundary Demo Markers";
41-
markerParent.transform.parent = MixedRealityToolkit.Instance.MixedRealityPlayspace;
55+
MixedRealityPlayspace.AddChild(markerParent.transform);
4256
}
4357

4458
private void Start()
4559
{
46-
47-
if (MixedRealityToolkit.BoundarySystem != null)
60+
if (BoundarySystem != null)
4861
{
4962
if (markers.Count == 0)
5063
{
@@ -55,25 +68,24 @@ private void Start()
5568

5669
private void Update()
5770
{
58-
if (MixedRealityToolkit.BoundarySystem != null)
71+
if (BoundarySystem != null)
5972
{
60-
MixedRealityToolkit.BoundarySystem.ShowFloor = showFloor;
61-
MixedRealityToolkit.BoundarySystem.ShowPlayArea = showPlayArea;
62-
MixedRealityToolkit.BoundarySystem.ShowTrackedArea = showTrackedArea;
63-
MixedRealityToolkit.BoundarySystem.ShowBoundaryWalls = showBoundaryWalls;
64-
MixedRealityToolkit.BoundarySystem.ShowBoundaryCeiling = showBoundaryCeiling;
73+
BoundarySystem.ShowFloor = showFloor;
74+
BoundarySystem.ShowPlayArea = showPlayArea;
75+
BoundarySystem.ShowTrackedArea = showTrackedArea;
76+
BoundarySystem.ShowBoundaryWalls = showBoundaryWalls;
77+
BoundarySystem.ShowBoundaryCeiling = showBoundaryCeiling;
6578
}
6679
}
6780

68-
private async void OnEnable()
81+
private void OnEnable()
6982
{
70-
await new WaitUntil(() => MixedRealityToolkit.BoundarySystem != null);
71-
MixedRealityToolkit.BoundarySystem.Register(gameObject);
83+
BoundarySystem?.Register(gameObject);
7284
}
7385

7486
private void OnDisable()
7587
{
76-
MixedRealityToolkit.BoundarySystem?.Unregister(gameObject);
88+
BoundarySystem?.Unregister(gameObject);
7789
}
7890

7991
#endregion MonoBehaviour Implementation
@@ -100,18 +112,30 @@ private void AddMarkers()
100112
float widthRect;
101113
float heightRect;
102114

103-
if (!MixedRealityToolkit.BoundarySystem.TryGetRectangularBoundsParams(out centerRect, out angleRect, out widthRect, out heightRect))
115+
if (BoundarySystem == null) { return; }
116+
117+
if (!BoundarySystem.TryGetRectangularBoundsParams(out centerRect, out angleRect, out widthRect, out heightRect))
104118
{
105119
// If we have no boundary manager or rectangular bounds we will show no indicators
106120
return;
107121
}
108122

109-
MixedRealityBoundaryVisualizationProfile visualizationProfile = MixedRealityToolkit.Instance.ActiveProfile.BoundaryVisualizationProfile;
110-
if (visualizationProfile == null)
123+
// Get the materials needed for marker display
124+
GameObject playArea = BoundarySystem.GetPlayAreaVisualization();
125+
if (playArea == null)
126+
{
127+
// Failed to get the play area visualization;
128+
return;
129+
}
130+
Material playAreaMaterial = playArea.GetComponent<Renderer>().sharedMaterial;
131+
132+
GameObject trackedArea = BoundarySystem.GetTrackedAreaVisualization();
133+
if (trackedArea == null)
111134
{
112-
// We do not have a visualization profile configured, therefore do not render the indicators.
135+
// Failed to get the tracked area visualization;
113136
return;
114137
}
138+
Material trackedAreaMaterial = trackedArea.GetComponent<Renderer>().sharedMaterial;
115139

116140
const int indicatorCount = 20;
117141
const float indicatorDistance = 0.2f;
@@ -131,14 +155,14 @@ private void AddMarkers()
131155

132156
Material material = null;
133157
// Check inscribed rectangle first
134-
if (MixedRealityToolkit.BoundarySystem.Contains(position, UnityBoundary.Type.PlayArea))
158+
if (BoundarySystem.Contains(position, UnityBoundary.Type.PlayArea))
135159
{
136-
material = visualizationProfile.PlayAreaMaterial;
160+
material = playAreaMaterial;
137161
}
138162
// Then check geometry
139-
else if (MixedRealityToolkit.BoundarySystem.Contains(position, UnityBoundary.Type.TrackedArea))
163+
else if (BoundarySystem.Contains(position, UnityBoundary.Type.TrackedArea))
140164
{
141-
material = visualizationProfile.TrackedAreaMaterial;
165+
material = trackedAreaMaterial;
142166
}
143167

144168
if (material != null)
Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4+
using Microsoft.MixedReality.Toolkit.Diagnostics;
45
using Microsoft.MixedReality.Toolkit.Utilities;
56
using UnityEngine;
67

78
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
89
{
910
public class DiagnosticsDemoControls : MonoBehaviour
1011
{
11-
private async void Start()
12+
private IMixedRealityDiagnosticsSystem diagnosticsSystem = null;
13+
14+
private IMixedRealityDiagnosticsSystem DiagnosticsSystem
1215
{
13-
if (!MixedRealityToolkit.Instance.ActiveProfile.IsDiagnosticsSystemEnabled)
16+
get
1417
{
15-
Debug.LogWarning("Diagnostics system is disabled. To run this demo, it needs to be enabled. Check your configuration settings.");
16-
return;
18+
if (diagnosticsSystem == null)
19+
{
20+
MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem);
21+
}
22+
return diagnosticsSystem;
1723
}
24+
}
1825

19-
await new WaitUntil(() => MixedRealityToolkit.DiagnosticsSystem != null);
26+
private async void Start()
27+
{
28+
await new WaitUntil(() => DiagnosticsSystem != null);
2029

21-
// Turn on the diagnostic visualizations for this demo.
22-
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = true;
30+
// Ensure the diagnostic visualizations are turned on.
31+
DiagnosticsSystem.ShowDiagnostics = true;
2332
}
2433

2534
/// <summary>
2635
/// Shows or hides all enabled diagnostics.
2736
/// </summary>
2837
public void OnToggleDiagnostics()
2938
{
30-
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = !MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics;
39+
DiagnosticsSystem.ShowDiagnostics = !DiagnosticsSystem.ShowDiagnostics;
3140
}
3241

3342
/// <summary>
3443
/// Shows or hides the profiler display.
3544
/// </summary>
3645
public void OnToggleProfiler()
3746
{
38-
MixedRealityToolkit.DiagnosticsSystem.ShowProfiler = !MixedRealityToolkit.DiagnosticsSystem.ShowProfiler;
47+
DiagnosticsSystem.ShowProfiler = !DiagnosticsSystem.ShowProfiler;
3948
}
4049
}
4150
}

Assets/MixedRealityToolkit.Examples/Demos/Diagnostics/Scripts/DiagnosticsDemoControls.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_BasicSetup.meta renamed to Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/DemoBasicSetup.meta

File renamed without changes.

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_BasicSetup/Materials.meta renamed to Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/DemoBasicSetup/Materials.meta

File renamed without changes.

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_BasicSetup/Materials/EyeGazeCursor.mat renamed to Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/DemoBasicSetup/Materials/EyeGazeCursor.mat

File renamed without changes.

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_BasicSetup/Materials/EyeGazeCursor.mat.meta renamed to Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/DemoBasicSetup/Materials/EyeGazeCursor.mat.meta

File renamed without changes.

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_BasicSetup/Scripts.meta renamed to Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/DemoBasicSetup/Scripts.meta

File renamed without changes.

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_BasicSetup/Scripts/ColorTap.cs renamed to Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/DemoBasicSetup/Scripts/ColorTap.cs

File renamed without changes.

0 commit comments

Comments
 (0)