Skip to content

Commit

Permalink
Merge pull request #4834 from microsoft/prerelease/2.0.0.rc2_stabiliz…
Browse files Browse the repository at this point in the history
…ation

RC2 Release
  • Loading branch information
wiwei authored Jun 12, 2019
2 parents acee452 + a6456b5 commit f3a9791
Show file tree
Hide file tree
Showing 1,298 changed files with 51,358 additions and 17,265 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ Assets/StreamingAssets.meta
# DocFX Generated #
# =============== #
doc/

# =========================================== #
# Asset Script Reference Retargeter Generated #
# =========================================== #
NuGet/
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,32 @@ public class BoundaryVisualizationDemo : MonoBehaviour, IMixedRealityBoundaryHan
[SerializeField]
private bool showBoundaryCeiling = true;

private IMixedRealityBoundarySystem boundarySystem = null;

private IMixedRealityBoundarySystem BoundarySystem
{
get
{
if (boundarySystem == null)
{
MixedRealityServiceRegistry.TryGetService<IMixedRealityBoundarySystem>(out boundarySystem);
}
return boundarySystem;
}
}

#region MonoBehaviour Implementation

private void Awake()
{
markerParent = new GameObject();
markerParent.name = "Boundary Demo Markers";
markerParent.transform.parent = MixedRealityToolkit.Instance.MixedRealityPlayspace;
MixedRealityPlayspace.AddChild(markerParent.transform);
}

private void Start()
{

if (MixedRealityToolkit.BoundarySystem != null)
if (BoundarySystem != null)
{
if (markers.Count == 0)
{
Expand All @@ -55,25 +68,24 @@ private void Start()

private void Update()
{
if (MixedRealityToolkit.BoundarySystem != null)
if (BoundarySystem != null)
{
MixedRealityToolkit.BoundarySystem.ShowFloor = showFloor;
MixedRealityToolkit.BoundarySystem.ShowPlayArea = showPlayArea;
MixedRealityToolkit.BoundarySystem.ShowTrackedArea = showTrackedArea;
MixedRealityToolkit.BoundarySystem.ShowBoundaryWalls = showBoundaryWalls;
MixedRealityToolkit.BoundarySystem.ShowBoundaryCeiling = showBoundaryCeiling;
BoundarySystem.ShowFloor = showFloor;
BoundarySystem.ShowPlayArea = showPlayArea;
BoundarySystem.ShowTrackedArea = showTrackedArea;
BoundarySystem.ShowBoundaryWalls = showBoundaryWalls;
BoundarySystem.ShowBoundaryCeiling = showBoundaryCeiling;
}
}

private async void OnEnable()
private void OnEnable()
{
await new WaitUntil(() => MixedRealityToolkit.BoundarySystem != null);
MixedRealityToolkit.BoundarySystem.Register(gameObject);
BoundarySystem?.Register(gameObject);
}

private void OnDisable()
{
MixedRealityToolkit.BoundarySystem?.Unregister(gameObject);
BoundarySystem?.Unregister(gameObject);
}

#endregion MonoBehaviour Implementation
Expand All @@ -100,18 +112,30 @@ private void AddMarkers()
float widthRect;
float heightRect;

if (!MixedRealityToolkit.BoundarySystem.TryGetRectangularBoundsParams(out centerRect, out angleRect, out widthRect, out heightRect))
if (BoundarySystem == null) { return; }

if (!BoundarySystem.TryGetRectangularBoundsParams(out centerRect, out angleRect, out widthRect, out heightRect))
{
// If we have no boundary manager or rectangular bounds we will show no indicators
return;
}

MixedRealityBoundaryVisualizationProfile visualizationProfile = MixedRealityToolkit.Instance.ActiveProfile.BoundaryVisualizationProfile;
if (visualizationProfile == null)
// Get the materials needed for marker display
GameObject playArea = BoundarySystem.GetPlayAreaVisualization();
if (playArea == null)
{
// Failed to get the play area visualization;
return;
}
Material playAreaMaterial = playArea.GetComponent<Renderer>().sharedMaterial;

GameObject trackedArea = BoundarySystem.GetTrackedAreaVisualization();
if (trackedArea == null)
{
// We do not have a visualization profile configured, therefore do not render the indicators.
// Failed to get the tracked area visualization;
return;
}
Material trackedAreaMaterial = trackedArea.GetComponent<Renderer>().sharedMaterial;

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

Material material = null;
// Check inscribed rectangle first
if (MixedRealityToolkit.BoundarySystem.Contains(position, UnityBoundary.Type.PlayArea))
if (BoundarySystem.Contains(position, UnityBoundary.Type.PlayArea))
{
material = visualizationProfile.PlayAreaMaterial;
material = playAreaMaterial;
}
// Then check geometry
else if (MixedRealityToolkit.BoundarySystem.Contains(position, UnityBoundary.Type.TrackedArea))
else if (BoundarySystem.Contains(position, UnityBoundary.Type.TrackedArea))
{
material = visualizationProfile.TrackedAreaMaterial;
material = trackedAreaMaterial;
}

if (material != null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Microsoft.MixedReality.Toolkit.Diagnostics;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;

namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
public class DiagnosticsDemoControls : MonoBehaviour
{
private async void Start()
private IMixedRealityDiagnosticsSystem diagnosticsSystem = null;

private IMixedRealityDiagnosticsSystem DiagnosticsSystem
{
if (!MixedRealityToolkit.Instance.ActiveProfile.IsDiagnosticsSystemEnabled)
get
{
Debug.LogWarning("Diagnostics system is disabled. To run this demo, it needs to be enabled. Check your configuration settings.");
return;
if (diagnosticsSystem == null)
{
MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem);
}
return diagnosticsSystem;
}
}

await new WaitUntil(() => MixedRealityToolkit.DiagnosticsSystem != null);
private async void Start()
{
await new WaitUntil(() => DiagnosticsSystem != null);

// Turn on the diagnostic visualizations for this demo.
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = true;
// Ensure the diagnostic visualizations are turned on.
DiagnosticsSystem.ShowDiagnostics = true;
}

/// <summary>
/// Shows or hides all enabled diagnostics.
/// </summary>
public void OnToggleDiagnostics()
{
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = !MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics;
DiagnosticsSystem.ShowDiagnostics = !DiagnosticsSystem.ShowDiagnostics;
}

/// <summary>
/// Shows or hides the profiler display.
/// </summary>
public void OnToggleProfiler()
{
MixedRealityToolkit.DiagnosticsSystem.ShowProfiler = !MixedRealityToolkit.DiagnosticsSystem.ShowProfiler;
DiagnosticsSystem.ShowProfiler = !DiagnosticsSystem.ShowProfiler;
}
}
}

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Microsoft.MixedReality.Toolkit.Input;
using UnityEngine;

namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
{
/// <summary>
/// Sample for allowing the game object that this script is attached to follow the user's eye gaze
/// at a given distance of "DefaultDistanceInMeters".
/// </summary>
public class FollowEyeGazeGazeProvider : MonoBehaviour
{
[Tooltip("Display the game object along the eye gaze ray at a default distance (in meters).")]
[SerializeField]
private float defaultDistanceInMeters = 2f;

private IMixedRealityInputSystem inputSystem = null;

/// <summary>
/// The active instance of the input system.
/// </summary>
private IMixedRealityInputSystem InputSystem
{
get
{
if (inputSystem == null)
{
MixedRealityServiceRegistry.TryGetService<IMixedRealityInputSystem>(out inputSystem);
}
return inputSystem;
}
}

private void Update()
{
if (InputSystem?.GazeProvider != null)
{
gameObject.transform.position = InputSystem.GazeProvider.GazeOrigin + InputSystem.GazeProvider.GazeDirection.normalized * defaultDistanceInMeters;
}
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,40 @@ public abstract class PanZoomBase : MonoBehaviour,
protected Vector2 originalScale;
protected Vector2 originalOffset;

protected IMixedRealityEyeSaccadeProvider EyeSaccadeProvider => eyeSaccadeProvider ?? (eyeSaccadeProvider = MixedRealityToolkit.Instance.GetService<IMixedRealityEyeSaccadeProvider>());
private IMixedRealityEyeSaccadeProvider eyeSaccadeProvider = null;

protected IMixedRealityEyeSaccadeProvider EyeSaccadeProvider
{
get
{
if (eyeSaccadeProvider == null)
{
IMixedRealityEyeGazeDataProvider eyeGazeProvider = (InputSystem as IMixedRealityDataProviderAccess)?.GetDataProvider<IMixedRealityEyeGazeDataProvider>();
eyeSaccadeProvider = eyeGazeProvider?.SaccadeProvider;
}
return eyeSaccadeProvider;
}
}

#endregion

private IMixedRealityInputSystem inputSystem = null;

/// <summary>
/// The active instance of the input system.
/// </summary>
protected IMixedRealityInputSystem InputSystem
{
get
{
if (inputSystem == null)
{
MixedRealityServiceRegistry.TryGetService<IMixedRealityInputSystem>(out inputSystem);
}
return inputSystem;
}
}

public abstract void Initialize();
public abstract float ComputePanSpeed(float cursorPosInOneDir, float maxSpeed, float minDistFromCenterForAutoPan);
public abstract int ZoomDir(bool zoomIn);
Expand Down Expand Up @@ -285,7 +315,7 @@ private void NavigationUpdate(Vector3 normalizedOffset)
// Update is called once per frame
protected virtual void Update()
{
//# Let's make sure that the correct gameobject is targeted and update the pan and zoom parameters.
//# Let's make sure that the correct GameObject is targeted and update the pan and zoom parameters.
if (UpdateCursorPosInHitBox())
{
//# Dynamically increase hit box size once user looks at this target
Expand Down Expand Up @@ -547,10 +577,10 @@ void IMixedRealityPointerHandler.OnPointerDown(MixedRealityPointerEventData even
isZooming = true;
}

void IMixedRealityPointerHandler.OnPointerDragged(MixedRealityPointerEventData eventData) { }

void IMixedRealityPointerHandler.OnPointerClicked(MixedRealityPointerEventData eventData) { }

void IMixedRealityPointerHandler.OnPointerDragged(MixedRealityPointerEventData eventData) { }

void IMixedRealityFocusHandler.OnFocusEnter(FocusEventData eventData)
{
isFocused = true;
Expand All @@ -567,7 +597,7 @@ void IMixedRealitySourceStateHandler.OnSourceDetected(SourceStateEventData event

void IMixedRealitySourceStateHandler.OnSourceLost(SourceStateEventData eventData)
{
foreach (var pointer in MixedRealityToolkit.InputSystem.GazeProvider.GazeInputSource.Pointers)
foreach (var pointer in InputSystem.GazeProvider.GazeInputSource.Pointers)
{
pointer.IsFocusLocked = false;
}
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
/// This script allows to zoom into and pan the texture of a GameObject.
/// It also allows for scrolling by restricting panning to one direction.
/// </summary>
public class PanZoomBase_RectTransf : PanZoomBase
public class PanZoomBaseRectTransf : PanZoomBase
{
internal RectTransform navRectTransf = null;
internal RectTransform viewportRectTransf = null;
Expand Down Expand Up @@ -176,7 +176,7 @@ public override bool UpdateCursorPosInHitBox()
Vector3 halfsize = gameObject.transform.lossyScale / 2;

// Let's transform back to the origin: Translate & Rotate
Vector3 transfHitPnt = MixedRealityToolkit.InputSystem.EyeGazeProvider.HitPosition - center;
Vector3 transfHitPnt = InputSystem.EyeGazeProvider.HitPosition - center;

// Rotate around the y axis
transfHitPnt = Quaternion.AngleAxis(-(gameObject.transform.rotation.eulerAngles.y - 180), Vector3.up) * transfHitPnt;
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
/// This script allows to zoom into and pan the texture of a GameObject.
/// It also allows for scrolling by restricting panning to one direction.
/// </summary>
public class PanZoomBase_Texture : PanZoomBase
public class PanZoomBaseTexture : PanZoomBase
{
protected Renderer textureRenderer = null;

Expand Down Expand Up @@ -192,7 +192,7 @@ public override bool UpdateCursorPosInHitBox()
Vector3 halfsize = gameObject.transform.lossyScale / 2;

// Let's transform back to the origin: Translate & Rotate
Vector3 transfHitPnt = MixedRealityToolkit.InputSystem.EyeGazeProvider.HitPosition - center;
Vector3 transfHitPnt = InputSystem.EyeGazeProvider.HitPosition - center;

// Rotate around the y axis
transfHitPnt = Quaternion.AngleAxis(gameObject.transform.rotation.eulerAngles.y, Vector3.down) * transfHitPnt;
Expand Down

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

Loading

0 comments on commit f3a9791

Please sign in to comment.