From 875c1ad5c097120accbe2af8d3c1c8d01b313292 Mon Sep 17 00:00:00 2001
From: Adam Mollis <36461279+AMollis@users.noreply.github.com>
Date: Sat, 10 Jun 2023 11:11:56 -0700
Subject: [PATCH] Adding in some missing documentation to the MRTK3 source.
(#11614)
Adding in some missing documentation to the MRTK3 source.
This also replaces some `ref` parameters with `in` parameters, in cases where it was obvious that only "const refs" were needed. This also removed the `InterpolationType.Hermite` since it was never handled or used.
The following were documentated:
- [x] `CameraSettings` class
- [x] `LabelWidthAttribute` class
- [x] `MathExtensions.PowerOfTwoGreate=rThanOrEqualTo`
- [x] `MathExtensions.CubicToLinearIndex`
- [x] `MathExtensions.LinearToCubicIndex`
- [x] `MathExtensions.ClampComponentWise`
- [x] `RayStep` struct and some functions
- [x] `StatefulInteractable` class
- [x] `SystemInterfaceType` constructors
- [x] `SystemType` public functions
- [x] `TimedFlag` class definition
- [x] `UXBindingProfileTemplate` properties
- [x] `VectorExtensions` some functions
- [x] `TextToSpeechSubsystem.Provider` class definition
- [x] `BezierInertia` class definition, serialized field tooltips
- [x] `FuzzyGazeInteractor.GazeRaycastHitResult` struct definition and public members
- [x] `HandJointInteractor` public method
- [x] `HandshapeTypes` class definition
- [x] `InputActionPoseSource` serialized field tooltips.
- [x] `InteractionMode` struct definition and serialized field tooltips and properties
- [x] `InteractionModeDefinition` serialized field tooltips and properties
- [x] `InteractionModeManager` public method
- [x] `InterpolationType` enum values
- [x] `MRTKHandsAggregatorSubsystem.MRTKAggregator` class definition and public members
## Bugs
- https://github.com/microsoft/MixedRealityToolkit-Unity/issues/11596
- https://github.com/microsoft/MixedRealityToolkit-Unity/issues/1159
---
.../Assets/Scripts/ScrollRectCurve.cs | 2 +-
.../Camera/CameraSettings.cs | 14 +-
.../UXBindingProfileTemplate.cs | 13 +-
.../Interactables/StatefulInteractable.cs | 23 ++-
.../Subsystems/MRTKSubsystemProvider.cs | 11 ++
.../Attributes/LabelWidthAttribute.cs | 13 ++
.../Utilities/Extensions/MathfExtensions.cs | 71 +++++++--
.../Utilities/Extensions/VectorExtensions.cs | 145 +++++++++++++++++-
com.microsoft.mrtk.core/Utilities/RayStep.cs | 70 +++++++--
.../Utilities/SystemInterfaceType.cs | 11 ++
.../Utilities/SystemType.cs | 88 ++++++++++-
.../Utilities/TimedFlag.cs | 5 +
.../InteractionModeManagerEditor.cs | 7 +
.../InteractionModePropertyDrawer.cs | 4 +
.../InteractionModes/InteractionMode.cs | 13 ++
.../InteractionModeDefinition.cs | 20 ++-
.../InteractionModeManager.cs | 17 ++
.../Interactors/Gaze/FuzzyGazeInteractor.cs | 15 ++
.../Interactors/HandJointInteractor.cs | 14 +-
.../Lines/DataProviders/BezierDataProvider.cs | 6 +
.../Lines/DataProviders/BezierInertia.cs | 16 +-
.../Lines/Definitions/InterpolationType.cs | 10 +-
.../MRTKHandsAggregatorSubsystem.cs | 8 +
.../Utilities/HandshapeTypes.cs | 3 +
.../PoseSource/InputActionPoseSource.cs | 10 +-
.../Solvers/SurfaceMagnetism.cs | 2 +-
.../Solvers/TapToPlace.cs | 2 +-
.../Keyboard/KeyboardPreview.cs | 26 ++--
28 files changed, 569 insertions(+), 70 deletions(-)
diff --git a/UnityProjects/MRTKDevTemplate/Assets/Scripts/ScrollRectCurve.cs b/UnityProjects/MRTKDevTemplate/Assets/Scripts/ScrollRectCurve.cs
index b0dc8ff83c9..5a283bceb80 100644
--- a/UnityProjects/MRTKDevTemplate/Assets/Scripts/ScrollRectCurve.cs
+++ b/UnityProjects/MRTKDevTemplate/Assets/Scripts/ScrollRectCurve.cs
@@ -19,7 +19,7 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos
/// look great on items that are vertically large, as items are curved at a
/// GameObject level. Their contents will remain flat.
///
- [AddComponentMenu("MRTX/Examples/Scroll Rect Curve")]
+ [AddComponentMenu("MRTK/Examples/Scroll Rect Curve")]
public class ScrollRectCurve : MonoBehaviour
{
[SerializeField]
diff --git a/com.microsoft.mrtk.core/Camera/CameraSettings.cs b/com.microsoft.mrtk.core/Camera/CameraSettings.cs
index fe8c689f460..472889fe724 100644
--- a/com.microsoft.mrtk.core/Camera/CameraSettings.cs
+++ b/com.microsoft.mrtk.core/Camera/CameraSettings.cs
@@ -6,18 +6,21 @@
namespace Microsoft.MixedReality.Toolkit
{
+ ///
+ /// Class that contains settings which are applied to CameraSettingsManager.
+ ///
[Serializable]
[AddComponentMenu("MRTK/Core/Camera Settings")]
public class CameraSettings
{
///
- /// Constructor.
+ /// Initializes a new instance of the class.
///
public CameraSettings() : this(DisplayType.Transparent)
{ }
///
- /// Constructor.
+ /// Initializes a new instance of the class.
///
///
/// value describing the device display.
@@ -46,7 +49,14 @@ public CameraSettings(DisplayType displayType)
}
}
+ ///
+ /// The default clear mode used for opaque displays.
+ ///
public static readonly CameraClearFlags DefaultClearModeOpaque = CameraClearFlags.Skybox;
+
+ ///
+ /// The default clear mode used for transparent displays.
+ ///
public static readonly CameraClearFlags DefaultClearModeTransparent = CameraClearFlags.SolidColor;
[SerializeField]
diff --git a/com.microsoft.mrtk.core/Data/Binding Templates/UXBindingProfileTemplate.cs b/com.microsoft.mrtk.core/Data/Binding Templates/UXBindingProfileTemplate.cs
index 0cfe7502e14..5047d8400ff 100644
--- a/com.microsoft.mrtk.core/Data/Binding Templates/UXBindingProfileTemplate.cs
+++ b/com.microsoft.mrtk.core/Data/Binding Templates/UXBindingProfileTemplate.cs
@@ -7,9 +7,9 @@ namespace Microsoft.MixedReality.Toolkit
{
///
/// This profile combines binding profiles for all Data Consumers used in the MRTK UXComponents components and
- /// is used by the BindingConfigurator that can be dropped on any prefab (or gameobject hierarchy)
+ /// is used by the BindingConfigurator that can be dropped on any prefab (or game object hierarchy)
/// to automatically configure all Data Consumers that will be needed to make those game objects data bindable
- /// and themable.
+ /// and capable of theming.
///
[CreateAssetMenu(fileName = "MRTK_UX_BindingProfile", menuName = "MRTK/Data Binding/UXBindingProfile")]
public class UXBindingProfileTemplate : ScriptableObject
@@ -17,11 +17,20 @@ public class UXBindingProfileTemplate : ScriptableObject
[Tooltip("Optional type specifiers for data sources to be injected into data consumers. This will typically be one data and one theme data source. If left empty, the default 'data' and 'theme' data sources will be used.")]
[SerializeField]
private string[] dataSourceTypes;
+
+ ///
+ /// Optional type specifiers for data sources to be injected into data consumers. This will typically be one data and one theme data source.
+ /// If left empty, the default 'data' and 'theme' data sources will be used.
+ ///
public string[] DataSourceTypes => dataSourceTypes;
[Tooltip("An array of binding profiles for specific classes, typically data consumers.")]
[SerializeField]
private ClassDataBindingProfile[] classBindings;
+
+ ///
+ /// An array of binding profiles for specific classes, typically data consumers.
+ ///
public ClassDataBindingProfile[] ClassBindings => classBindings;
}
}
diff --git a/com.microsoft.mrtk.core/Interactables/StatefulInteractable.cs b/com.microsoft.mrtk.core/Interactables/StatefulInteractable.cs
index 56a50019917..4dca1291b9b 100644
--- a/com.microsoft.mrtk.core/Interactables/StatefulInteractable.cs
+++ b/com.microsoft.mrtk.core/Interactables/StatefulInteractable.cs
@@ -9,7 +9,11 @@
using UnityEngine.XR.Interaction.Toolkit;
namespace Microsoft.MixedReality.Toolkit
-{
+{
+ ///
+ /// An extended version of MRTKBaseInteractable that adds additional
+ /// functionality such as speech support, gaze support, and toggle behaviors.
+ ///
[AddComponentMenu("MRTK/Core/Stateful Interactable")]
public class StatefulInteractable : MRTKBaseInteractable
{
@@ -20,12 +24,21 @@ public class StatefulInteractable : MRTKBaseInteractable
///
public enum ToggleType
{
- // Interactable will not enter toggle states
- // unless forced by code (ForceSetToggle)
+ ///
+ /// The interactable will not enter toggle states unless forces by code
+ /// using the function.
+ ///
Button,
- // User can toggle on and off
+
+ ///
+ /// The user can toggle on and off the interactable.
+ ///
Toggle,
- // User can only toggle on, not off. Useful for radio buttons.
+
+ ///
+ /// The User can only toggle on the interactable, but not toggle off.
+ /// This value is useful for radio buttons.
+ ///
OneWayToggle
}
diff --git a/com.microsoft.mrtk.core/Subsystems/MRTKSubsystemProvider.cs b/com.microsoft.mrtk.core/Subsystems/MRTKSubsystemProvider.cs
index e3d00c4bc10..658d62f1b6d 100644
--- a/com.microsoft.mrtk.core/Subsystems/MRTKSubsystemProvider.cs
+++ b/com.microsoft.mrtk.core/Subsystems/MRTKSubsystemProvider.cs
@@ -30,8 +30,19 @@ public virtual void LateUpdate() { }
///
public virtual void FixedUpdate() { }
+ ///
+ /// Destroys this instance of a Unity subsystem.
+ ///
public override void Destroy() { }
+
+ ///
+ /// Starts an instance of a Unity subsystem.
+ ///
public override void Start() { }
+
+ ///
+ /// Stops an instance of a Unity subsystem.
+ ///
public override void Stop() { }
}
}
diff --git a/com.microsoft.mrtk.core/Utilities/Attributes/LabelWidthAttribute.cs b/com.microsoft.mrtk.core/Utilities/Attributes/LabelWidthAttribute.cs
index beaaac30668..21223e3003c 100644
--- a/com.microsoft.mrtk.core/Utilities/Attributes/LabelWidthAttribute.cs
+++ b/com.microsoft.mrtk.core/Utilities/Attributes/LabelWidthAttribute.cs
@@ -6,11 +6,24 @@
namespace Microsoft.MixedReality.Toolkit
{
+ ///
+ /// Indicates that the serializable property's label should be of a particular width when rendered in the Unity inspector window.
+ ///
+ ///
+ /// This attribute does not indicate a font size change, and is only applicable to applications running in the Unity Editor.
+ ///
[AttributeUsage(AttributeTargets.Field)]
public class LabelWidthAttribute : PropertyAttribute
{
+ ///
+ /// Get the width to apply to the serializable property's label when the label is rendered in the Unity inspector window.
+ ///
public float Width { get; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The width to apply to the serializable property's label when the label is rendered in the Unity inspector window.
public LabelWidthAttribute(float width)
{
Width = width;
diff --git a/com.microsoft.mrtk.core/Utilities/Extensions/MathfExtensions.cs b/com.microsoft.mrtk.core/Utilities/Extensions/MathfExtensions.cs
index f6e9728a7bd..1ade7529838 100644
--- a/com.microsoft.mrtk.core/Utilities/Extensions/MathfExtensions.cs
+++ b/com.microsoft.mrtk.core/Utilities/Extensions/MathfExtensions.cs
@@ -10,6 +10,13 @@ namespace Microsoft.MixedReality.Toolkit
///
public static class MathExtensions
{
+ ///
+ /// Get the most significant bit from the input value.
+ ///
+ /// The input value to examine.
+ ///
+ /// Integer value that is equal to the most significant bit within the input value.
+ ///
public static int MostSignificantBit(this int x)
{
x |= (x >> 1);
@@ -21,25 +28,59 @@ public static int MostSignificantBit(this int x)
return x & ~(x >> 1);
}
- public static int PowerOfTwoGreaterThanOrEqualTo(this int v)
+ ///
+ /// Get the value that is the next power of two at or after the input value.
+ ///
+ /// The value to test.
+ ///
+ /// If the input value is a power of two, the input value is returned.
+ /// Otherwise the next power of two, after the input value, is returned.
+ ///
+ public static int PowerOfTwoGreaterThanOrEqualTo(this int input)
{
- return Mathf.IsPowerOfTwo(v) ? v : Mathf.NextPowerOfTwo(v);
+ return Mathf.IsPowerOfTwo(input) ? input : Mathf.NextPowerOfTwo(input);
}
- public static Vector3Int PowerOfTwoGreaterThanOrEqualTo(this Vector3Int v)
+ ///
+ /// For each component in a `Vector3Int`, get the component value that is the next power of two at or
+ /// after the input component value.
+ ///
+ /// The vector containing the component values to test.
+ ///
+ /// A Vector3Int containing components that are a power of two. If an input's component value is a power of two,
+ /// than that component value is in the returned in the corresponding vector position. Otherwise the next
+ /// power of two, after the component value, is returned in the corresponding vector position.
+ ///
+ public static Vector3Int PowerOfTwoGreaterThanOrEqualTo(this Vector3Int inputVector)
{
- return new Vector3Int(PowerOfTwoGreaterThanOrEqualTo(v.x),
- PowerOfTwoGreaterThanOrEqualTo(v.y),
- PowerOfTwoGreaterThanOrEqualTo(v.z));
+ return new Vector3Int(PowerOfTwoGreaterThanOrEqualTo(inputVector.x),
+ PowerOfTwoGreaterThanOrEqualTo(inputVector.y),
+ PowerOfTwoGreaterThanOrEqualTo(inputVector.z));
}
- public static int CubicToLinearIndex(Vector3Int ndx, Vector3Int size)
+ ///
+ /// Convert a 3D texture's cubic index to its linear representation.
+ ///
+ /// A cubic index into a 3D texture.
+ /// The 3D texture's dimensions or size.
+ ///
+ /// The linear index for the given cubic index and size.
+ ///
+ public static int CubicToLinearIndex(Vector3Int cubicIndex, Vector3Int size)
{
- return (ndx.x) +
- (ndx.y * size.x) +
- (ndx.z * size.x * size.y);
+ return (cubicIndex.x) +
+ (cubicIndex.y * size.x) +
+ (cubicIndex.z * size.x * size.y);
}
+ ///
+ /// Convert a 3D texture's linear index to its cubic representation.
+ ///
+ /// A linear index into a 3D texture.
+ /// The 3D texture's dimensions or size.
+ ///
+ /// The cubic index for the given linear index and size.
+ ///
public static Vector3Int LinearToCubicIndex(int linearIndex, Vector3Int size)
{
return new Vector3Int((linearIndex / 1) % size.x,
@@ -47,6 +88,16 @@ public static Vector3Int LinearToCubicIndex(int linearIndex, Vector3Int size)
(linearIndex / (size.x * size.y)) % size.z);
}
+ ///
+ /// Preform a component wise clamp on a given vector. Each input component will be clamped by its
+ /// corresponding minimum and maximum component as specified by the `min` and `max` input vectors.
+ ///
+ /// The vector whose components will be clamped by the given minimum and maximum vectors.
+ /// The vector whose components define the minimum value for the corresponding input vector component.
+ /// The vector whose components define the maximum value for the corresponding input vector component.
+ ///
+ /// Returns a new vector whose components have been clamped by the specified minimum and maximum values.
+ ///
public static Vector3 ClampComponentWise(Vector3 value, Vector3 min, Vector3 max)
{
return new Vector3(Mathf.Clamp(value.x, min.x, max.x),
diff --git a/com.microsoft.mrtk.core/Utilities/Extensions/VectorExtensions.cs b/com.microsoft.mrtk.core/Utilities/Extensions/VectorExtensions.cs
index 02f38c72004..ad051b97338 100644
--- a/com.microsoft.mrtk.core/Utilities/Extensions/VectorExtensions.cs
+++ b/com.microsoft.mrtk.core/Utilities/Extensions/VectorExtensions.cs
@@ -12,47 +12,127 @@ namespace Microsoft.MixedReality.Toolkit
///
public static class VectorExtensions
{
+ ///
+ /// Multiple 2D vector components together to returned a new scaled vector.
+ ///
+ /// The 2D vector to be scaled.
+ /// The 2D vector used to scale the value.
+ ///
+ /// A new 3D vector containing the product or scaled components.
+ ///
public static Vector2 Mul(this Vector2 value, Vector2 scale)
{
return new Vector2(value.x * scale.x, value.y * scale.y);
}
- public static Vector2 Div(this Vector2 value, Vector2 scale)
+ ///
+ /// Divide 2D vector components by the given divisor components.
+ ///
+ /// The 2D vector containing the divided components.
+ /// The 2D vector containing the divisor components.
+ ///
+ /// A new 2D vector containing the quotient components.
+ ///
+ public static Vector2 Div(this Vector2 value, Vector2 divisor)
{
- return new Vector2(value.x / scale.x, value.y / scale.y);
+ return new Vector2(value.x / divisor.x, value.y / divisor.y);
}
+ ///
+ /// Multiple 3D vector components together to returned a new scaled vector.
+ ///
+ /// The 3D vector to be scaled.
+ /// The 3D vector used to scale the value.
+ ///
+ /// A new 3D vector containing the product or scaled components.
+ ///
public static Vector3 Mul(this Vector3 value, Vector3 scale)
{
return new Vector3(value.x * scale.x, value.y * scale.y, value.z * scale.z);
}
- public static Vector3 Div(this Vector3 value, Vector3 scale)
+ ///
+ /// Divide 3D vector components by the given divisor components.
+ ///
+ /// The 3D vector containing the divided components.
+ /// The 3D vector containing the divisor components.
+ ///
+ /// A new 3D vector containing the quotient components.
+ ///
+ public static Vector3 Div(this Vector3 value, Vector3 divisor)
{
- return new Vector3(value.x / scale.x, value.y / scale.y, value.z / scale.z);
+ return new Vector3(value.x / divisor.x, value.y / divisor.y, value.z / divisor.z);
}
+ ///
+ /// Rotate a given point around a pivot at a particular rotation.
+ ///
+ /// The 3D point to be rotated.
+ /// The 3D point that is the pivot.
+ /// The quaternion representing the rotation to be preformed.
+ ///
+ /// A new 3D vector containing the rotated point.
+ ///
public static Vector3 RotateAround(this Vector3 point, Vector3 pivot, Quaternion rotation)
{
return rotation * (point - pivot) + pivot;
}
+ ///
+ /// Rotate a given point around a pivot at a particular rotation.
+ ///
+ /// The 3D point to be rotated.
+ /// The 3D point that is the pivot.
+ /// The 3D vector containing the Euler representation of the rotation to be preformed.
+ ///
+ /// A new 3D vector containing the rotated point.
+ ///
public static Vector3 RotateAround(this Vector3 point, Vector3 pivot, Vector3 eulerAngles)
{
return RotateAround(point, pivot, Quaternion.Euler(eulerAngles));
}
+ ///
+ /// Apply a transformation to a given point using the specified translation, rotation and scale.
+ ///
+ /// The 3D point to be altered.
+ /// The 3D vector containing the translation amount.
+ /// The quaternion representing the rotation to be preformed.
+ /// The 3D vector containing the scale amount.
+ ///
+ /// A new 3D vector containing the altered point.
+ ///
public static Vector3 TransformPoint(this Vector3 point, Vector3 translation, Quaternion rotation, Vector3 lossyScale)
{
return rotation * Vector3.Scale(lossyScale, point) + translation;
}
+ ///
+ /// Apply an inverse transformation to a given point using the specified translation, rotation and scale.
+ ///
+ ///
+ /// This will preform the inverse operations of the function.
+ ///
+ /// The 3D point to be altered.
+ /// The 3D vector containing the translation amount.
+ /// The quaternion representing the rotation to be preformed.
+ /// The 3D vector containing the scale amount.
+ ///
+ /// A new 3D vector containing the altered point.
+ ///
public static Vector3 InverseTransformPoint(this Vector3 point, Vector3 translation, Quaternion rotation, Vector3 lossyScale)
{
var scaleInv = new Vector3(1 / lossyScale.x, 1 / lossyScale.y, 1 / lossyScale.z);
return Vector3.Scale(scaleInv, (Quaternion.Inverse(rotation) * (point - translation)));
}
+ ///
+ /// Given a collection of 2D vectors, calculate the averages for each vector component.
+ ///
+ /// The collection of 2D vectors used when calculating the component-wise average.
+ ///
+ /// A 2D vector containing averages for all vector components.
+ ///
public static Vector2 Average(this IEnumerable vectors)
{
float x = 0f;
@@ -69,6 +149,13 @@ public static Vector2 Average(this IEnumerable vectors)
return new Vector2(x / count, y / count);
}
+ ///
+ /// Given a collection of 3D vectors, calculate the averages for each vector component.
+ ///
+ /// The collection of 3D vectors used when calculating the component-wise average.
+ ///
+ /// A 3D vector containing averages for all vector components.
+ ///
public static Vector3 Average(this IEnumerable vectors)
{
float x = 0f;
@@ -87,6 +174,13 @@ public static Vector3 Average(this IEnumerable vectors)
return new Vector3(x / count, y / count, z / count);
}
+ ///
+ /// Given a collection of 2D vectors, calculate the averages for each vector component.
+ ///
+ /// The collection of 2D vectors used when calculating the component-wise average.
+ ///
+ /// A 2D vector containing averages for all vector components.
+ ///
public static Vector2 Average(this ICollection vectors)
{
int count = vectors.Count;
@@ -107,6 +201,13 @@ public static Vector2 Average(this ICollection vectors)
return new Vector2(x / count, y / count);
}
+ ///
+ /// Given a collection of 3D vectors, calculate the averages for each vector component.
+ ///
+ /// The collection of 3D vectors used when calculating the component-wise average.
+ ///
+ /// A 3D vector containing averages for all vector components.
+ ///
public static Vector3 Average(this ICollection vectors)
{
int count = vectors.Count;
@@ -130,6 +231,13 @@ public static Vector3 Average(this ICollection vectors)
return new Vector3(x / count, y / count, z / count);
}
+ ///
+ /// Given a collection of 2D vectors, calculate the medians for each vector component.
+ ///
+ /// The collection of 2D vectors used when calculating the component-wise median.
+ ///
+ /// A 2D vector containing medians for all vector components.
+ ///
public static Vector2 Median(this IEnumerable vectors)
{
var enumerable = vectors as Vector2[] ?? vectors.ToArray();
@@ -137,6 +245,13 @@ public static Vector2 Median(this IEnumerable vectors)
return count == 0 ? Vector2.zero : enumerable.OrderBy(v => v.sqrMagnitude).ElementAt(count / 2);
}
+ ///
+ /// Given a collection of 3D vectors, calculate the medians for each vector component.
+ ///
+ /// The collection of 3D vectors used when calculating the component-wise median.
+ ///
+ /// A 3D vector containing medians for all vector components.
+ ///
public static Vector3 Median(this IEnumerable vectors)
{
var enumerable = vectors as Vector3[] ?? vectors.ToArray();
@@ -144,18 +259,39 @@ public static Vector3 Median(this IEnumerable vectors)
return count == 0 ? Vector3.zero : enumerable.OrderBy(v => v.sqrMagnitude).ElementAt(count / 2);
}
+ ///
+ /// Given a collection of 2D vectors, calculate the medians for each vector component.
+ ///
+ /// The collection of 2D vectors used when calculating the component-wise median.
+ ///
+ /// A 2D vector containing medians for all vector components.
+ ///
public static Vector2 Median(this ICollection vectors)
{
int count = vectors.Count;
return count == 0 ? Vector2.zero : vectors.OrderBy(v => v.sqrMagnitude).ElementAt(count / 2);
}
+ ///
+ /// Given a collection of 3D vectors, calculate the medians for each vector component.
+ ///
+ /// The collection of 3D vectors used when calculating the component-wise median.
+ ///
+ /// A 3D vector containing medians for all vector components.
+ ///
public static Vector3 Median(this ICollection vectors)
{
int count = vectors.Count;
return count == 0 ? Vector3.zero : vectors.OrderBy(v => v.sqrMagnitude).ElementAt(count / 2);
}
+ ///
+ /// Validates that each 3D vector components is a number and is not infinite.
+ ///
+ /// The 3D vector whose components will be tested.
+ ///
+ /// `true` is all 3D vector components are a numbers and are not infinite, otherwise `false`.
+ ///
public static bool IsValidVector(this Vector3 vector)
{
return !float.IsNaN(vector.x) && !float.IsNaN(vector.y) && !float.IsNaN(vector.z) &&
@@ -250,6 +386,5 @@ public static Vector3 ScatterMapping(this Vector3 source, float radius)
source.y = UnityEngine.Random.Range(-radius, radius);
return source;
}
-
}
}
diff --git a/com.microsoft.mrtk.core/Utilities/RayStep.cs b/com.microsoft.mrtk.core/Utilities/RayStep.cs
index e57fb9ce3cd..26a7dd3c0f9 100644
--- a/com.microsoft.mrtk.core/Utilities/RayStep.cs
+++ b/com.microsoft.mrtk.core/Utilities/RayStep.cs
@@ -6,6 +6,9 @@
namespace Microsoft.MixedReality.Toolkit
{
+ ///
+ /// Represents a raycast that is a portion of a longer raycast.
+ ///
[Serializable]
public struct RayStep
{
@@ -14,21 +17,48 @@ public struct RayStep
private static Vector3 dir;
private static Vector3 pos;
+
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The origin position of the raycast step.
+ /// The end position of the raycast step.
public RayStep(Vector3 origin, Vector3 terminus) : this()
{
- UpdateRayStep(ref origin, ref terminus);
+ UpdateRayStep(in origin, in terminus);
epsilon = 0.01f;
}
+ ///
+ /// Get the origin position of the raycast step.
+ ///
public Vector3 Origin { get; private set; }
+
+ ///
+ /// Get the end position of the raycast step.
+ ///
public Vector3 Terminus { get; private set; }
+
+ ///
+ /// Get the direction of the raycast step. This direction will be a normalized vector from the origin to the terminus.
+ ///
public Vector3 Direction { get; private set; }
+ ///
+ /// The length or magnitude of the raycast step. This is the distance from the origin to the terminus.
+ ///
public float Length { get; private set; }
private readonly float epsilon;
+ ///
+ /// Get a point along the raycast, at a specified distance from the origin.
+ ///
+ /// The returned point will be at this distance from the origin.
+ ///
+ /// A new point that is at the specified distance from the origin.
+ ///
public Vector3 GetPoint(float distance)
{
if (Length <= distance || Length == 0f)
@@ -44,12 +74,14 @@ public Vector3 GetPoint(float distance)
}
///
- /// Update current raystep with new origin and terminus points.
- /// Pass by ref to avoid unnecessary struct copy into function since values will be copied anyways locally
+ /// Update the ray step with new origin and terminus points.
///
- /// beginning of raystep origin
- /// end of raystep
- public void UpdateRayStep(ref Vector3 origin, ref Vector3 terminus)
+ ///
+ /// Vectors are passed by reference to avoid unnecessary struct copies. The input values will be copied locally.
+ ///
+ /// The origin position of the ray step.
+ /// The end position of the ray step.
+ public void UpdateRayStep(in Vector3 origin, in Vector3 terminus)
{
Origin = origin;
Terminus = terminus;
@@ -74,9 +106,16 @@ public void UpdateRayStep(ref Vector3 origin, ref Vector3 terminus)
Direction = dir;
}
- public void CopyRay(Ray ray, float rayLength)
+ ///
+ /// Copy the given ray structure to this raycast step, along with the specified length.
+ ///
+ ///
+ /// The new length for this raycast step. The length or magnitude of the raycast step.
+ /// This is the distance from the ray's origin to the terminus.
+ ///
+ public void CopyRay(Ray ray, float length)
{
- Length = rayLength;
+ Length = length;
Origin = ray.origin;
Direction = ray.direction;
@@ -87,6 +126,13 @@ public void CopyRay(Ray ray, float rayLength)
Terminus = pos;
}
+ ///
+ /// Test if the raycast step contain the specified point.
+ ///
+ /// The point to test.
+ ///
+ /// True if the point is contained along the raycast step. Otherwise false is returned.
+ ///
public bool Contains(Vector3 point)
{
dist.x = Origin.x - point.x;
@@ -105,9 +151,13 @@ public bool Contains(Vector3 point)
return (sqrMagOriginPoint + sqrMagPointTerminus) - sqrLength > sqrEpsilon;
}
- public static implicit operator Ray(RayStep r)
+ ///
+ /// Create a copy of the given raycast step.
+ ///
+ /// The raycast step to copy.
+ public static implicit operator Ray(RayStep rayStep)
{
- return new Ray(r.Origin, r.Direction);
+ return new Ray(rayStep.Origin, rayStep.Direction);
}
#region static utility functions
diff --git a/com.microsoft.mrtk.core/Utilities/SystemInterfaceType.cs b/com.microsoft.mrtk.core/Utilities/SystemInterfaceType.cs
index a048b34aeaa..b1b45249499 100644
--- a/com.microsoft.mrtk.core/Utilities/SystemInterfaceType.cs
+++ b/com.microsoft.mrtk.core/Utilities/SystemInterfaceType.cs
@@ -13,8 +13,19 @@ namespace Microsoft.MixedReality.Toolkit
[Serializable]
public sealed class SystemInterfaceType : SystemType
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Assembly qualified class name.
public SystemInterfaceType(string assemblyQualifiedClassName) : base(assemblyQualifiedClassName) { }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Class type.
+ ///
+ /// If is not a class type.
+ ///
public SystemInterfaceType(Type type) : base(type) { }
///
diff --git a/com.microsoft.mrtk.core/Utilities/SystemType.cs b/com.microsoft.mrtk.core/Utilities/SystemType.cs
index 7aef812459d..569fa42617d 100644
--- a/com.microsoft.mrtk.core/Utilities/SystemType.cs
+++ b/com.microsoft.mrtk.core/Utilities/SystemType.cs
@@ -18,6 +18,15 @@ public class SystemType : ISerializationCallbackReceiver
private Type type;
+ ///
+ /// Create a reference string from the given type's assembly qualified class name. The reference
+ /// string will contain the full name and assembly name from the given type.
+ ///
+ /// The class type to track.
+ ///
+ /// A new reference string. Will return an empty string if the type is null,
+ /// or if the assembly qualified name is null or empty.
+ ///
public static string GetReference(Type type)
{
if (type == null || string.IsNullOrEmpty(type.AssemblyQualifiedName))
@@ -28,6 +37,15 @@ public static string GetReference(Type type)
return GetReference(type.AssemblyQualifiedName);
}
+ ///
+ /// Create a reference string from the given assembly qualified class name. The reference
+ /// string will contain the full name and assembly name from the given assembly qualified name.
+ ///
+ /// Assembly qualified class name.
+ ///
+ /// A new reference string. Will return an empty string if the assembly qualified
+ /// name is null or empty.
+ ///
public static string GetReference(string assemblyQualifiedName)
{
if (string.IsNullOrEmpty(assemblyQualifiedName))
@@ -64,7 +82,7 @@ public SystemType(string assemblyQualifiedClassName)
///
/// Initializes a new instance of the class.
///
- /// Class type.
+ /// The class type to track.
///
/// If is not a class type.
///
@@ -76,24 +94,47 @@ public SystemType(Type type)
// Override hash code and equality so we can
// key dictionaries with the type reference.
+
+ ///
+ /// Gets the hash code for the .
+ ///
+ ///
+ /// Obtains the hash from the underlying reference string.
+ ///
+ ///
+ /// The hash value generated for this .
+ ///
public override int GetHashCode()
{
return reference.GetHashCode();
}
+ ///
+ /// Compares two instances for equality.
+ ///
+ ///
+ /// Obtains the equality from the underlying reference string.
+ ///
+ ///
+ /// `true` if the two instances represent the same ; otherwise, `false`.
+ ///
public override bool Equals(object other)
{
var otherType = other as SystemType;
if (otherType == null)
+ {
return false;
+ }
return reference.Equals(otherType.reference);
}
-
#region ISerializationCallbackReceiver Members
+ ///
+ /// Implemented so to receive a callback after Unity deserializes this object.
+ ///
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
// Class references may move between asmdef or be renamed throughout MRTK development
@@ -103,6 +144,12 @@ void ISerializationCallbackReceiver.OnAfterDeserialize()
type = !string.IsNullOrEmpty(reference) ? Type.GetType(reference) : null;
}
+ ///
+ /// Implemented so to receive a callback before Unity deserializes this object.
+ ///
+ ///
+ /// This is currently not utilized, and no operation will be preformed when called.
+ ///
void ISerializationCallbackReceiver.OnBeforeSerialize() { }
#endregion ISerializationCallbackReceiver Members
@@ -135,35 +182,60 @@ public Type Type
///
/// An overridable constraint to determine whether a type is valid to serialize.
///
- /// Type to validate.
+ /// Type to validate.
/// True if the type is valid, or false.
- protected virtual bool ValidConstraint(Type t)
+ protected virtual bool ValidConstraint(Type type)
{
- return t != null && t.IsValueType && !t.IsEnum && !t.IsAbstract || t.IsClass;
+ return type != null && type.IsValueType && !type.IsEnum && !type.IsAbstract || type.IsClass;
}
+ ///
+ /// Returns the reference string for the type represented by this .
+ ///
public static implicit operator string(SystemType type)
{
return type.reference;
}
+ ///
+ /// Returns the type represented by this .
+ ///
public static implicit operator Type(SystemType type)
{
return type.Type;
}
+ ///
+ /// Create an instance of for the given type.
+ ///
+ /// The class type to track.
+ ///
+ /// If is not a class type.
+ ///
public static implicit operator SystemType(Type type)
{
return new SystemType(type);
}
+ ///
+ /// Returns a string that represents this .
+ ///
+ ///
+ /// The full name for the type represented by this , or
+ /// "(None)" if the type is null.
+ ///
public override string ToString()
{
- return Type?.FullName ?? "(None)";
+ return type?.FullName ?? "(None)";
}
- // Key == original reference string entry, value == new migrated placement
- // String values are broken into {namespace.classname, asmdef}
+ ///
+ /// A dictionary containing mappings from the original reference string entry to
+ /// the new migrated placement value.
+ ///
+ ///
+ /// String values are broken into {Full Name, Assembly Definition}
+ ///
private static Dictionary ReferenceMappings = new Dictionary()
{
// Empty for now.
diff --git a/com.microsoft.mrtk.core/Utilities/TimedFlag.cs b/com.microsoft.mrtk.core/Utilities/TimedFlag.cs
index 80cfdd02c9b..9dd0c5d0761 100644
--- a/com.microsoft.mrtk.core/Utilities/TimedFlag.cs
+++ b/com.microsoft.mrtk.core/Utilities/TimedFlag.cs
@@ -11,6 +11,11 @@ namespace Microsoft.MixedReality.Toolkit
///
public class EditableTimedFlagAttribute : PropertyAttribute { }
+ ///
+ /// Represents a flag that can be activated or deactivated, and whose active duration is tracked and
+ /// obtained via the function. Instances of this object
+ /// will also raise and events when their activate state is altered.
+ ///
[System.Serializable]
public class TimedFlag
{
diff --git a/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs b/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs
index dfc98957a71..01f7cc8822c 100644
--- a/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs
+++ b/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs
@@ -7,12 +7,19 @@
namespace Microsoft.MixedReality.Toolkit.Input.Editor
{
+ ///
+ /// A custom class used when rendering a Unity inspector window editor for a InteractionModeManager
+ /// class.
+ ///
[CustomEditor(typeof(InteractionModeManager))]
public class InteractionModeManagerEditor : UnityEditor.Editor
{
private const string InitControllers = "Init Controllers";
private const string InitSubtypes = "Populate Modes Definitions with Subtypes";
+ ///
+ /// Implemented so to make a custom inspector inside Unity's inspector window.
+ ///
public override void OnInspectorGUI()
{
Color prevColor = GUI.color;
diff --git a/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModePropertyDrawer.cs b/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModePropertyDrawer.cs
index 09daebf632e..fcab22790d5 100644
--- a/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModePropertyDrawer.cs
+++ b/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModePropertyDrawer.cs
@@ -7,6 +7,10 @@
namespace Microsoft.MixedReality.Toolkit.Input.Editor
{
+ ///
+ /// A custom drawer used when rendering information about a InteractionMode
+ /// property within a Unity inspector window.
+ ///
[CustomPropertyDrawer(typeof(InteractionMode))]
public class InteractionModePropertyDrawer : PropertyDrawer
{
diff --git a/com.microsoft.mrtk.input/InteractionModes/InteractionMode.cs b/com.microsoft.mrtk.input/InteractionModes/InteractionMode.cs
index a820bc20a3c..6472aac7c22 100644
--- a/com.microsoft.mrtk.input/InteractionModes/InteractionMode.cs
+++ b/com.microsoft.mrtk.input/InteractionModes/InteractionMode.cs
@@ -2,17 +2,30 @@
// Licensed under the MIT License.
using System;
+using UnityEngine;
using UnityEngine.Serialization;
namespace Microsoft.MixedReality.Toolkit.Input
{
+ ///
+ /// A structure representing an interactor's mode or state.
+ ///
[Serializable]
public struct InteractionMode
{
+ [Tooltip("The name of the interaction mode.")]
public string name;
+
[FormerlySerializedAs("id")]
+ [Tooltip("The priority of the interaction mode.")]
public int priority;
+ ///
+ /// Returns a string that represents this .
+ ///
+ ///
+ /// The `name` field for this .
+ ///
public override string ToString()
{
return name;
diff --git a/com.microsoft.mrtk.input/InteractionModes/InteractionModeDefinition.cs b/com.microsoft.mrtk.input/InteractionModes/InteractionModeDefinition.cs
index 0ff2baf4433..be715c420cc 100644
--- a/com.microsoft.mrtk.input/InteractionModes/InteractionModeDefinition.cs
+++ b/com.microsoft.mrtk.input/InteractionModes/InteractionModeDefinition.cs
@@ -10,26 +10,30 @@
namespace Microsoft.MixedReality.Toolkit.Input
{
///
- /// Describes the types of interaction modes an interactor can belong to
+ /// Describes the types of interaction modes an interactor can belong to.
///
- /// todo: improve naming here...
[Serializable]
public class InteractionModeDefinition : ISerializationCallbackReceiver
{
[SerializeField]
+ [Tooltip("Get the mode name that this Interaction Mode Definition instance is targeting.")]
private string modeName = string.Empty;
+ ///
+ /// Get the mode name that this instance is targeting.
+ ///
public string ModeName => modeName;
// private field to ensure serialization
[SerializeField]
[Extends(typeof(XRBaseControllerInteractor), TypeGrouping.ByNamespaceFlat)]
+ [Tooltip("The class types of the interactors that this Interaction Mode Definition instance is targeting.")]
private List associatedTypes = new List();
private HashSet associatedTypesHashSet = new HashSet();
///
- /// Stores the types associated with this Interaction Mode Definition
+ /// Stores the types associated with this Interaction Mode Definition.
///
internal HashSet AssociatedTypes => associatedTypesHashSet;
@@ -55,12 +59,20 @@ internal void InitializeAssociatedTypes()
}
}
+ ///
+ /// Implemented so to receive a callback after Unity deserializes this object.
+ ///
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
InitializeAssociatedTypes();
}
- // We don't need to do anything before serialization
+ ///
+ /// Implemented so to receive a callback before Unity deserializes this object.
+ ///
+ ///
+ /// This is currently not utilized, and no operation will be preformed when called.
+ ///
void ISerializationCallbackReceiver.OnBeforeSerialize() { }
}
}
diff --git a/com.microsoft.mrtk.input/InteractionModes/InteractionModeManager.cs b/com.microsoft.mrtk.input/InteractionModes/InteractionModeManager.cs
index c5af1d50cb6..d10071feac9 100644
--- a/com.microsoft.mrtk.input/InteractionModes/InteractionModeManager.cs
+++ b/com.microsoft.mrtk.input/InteractionModes/InteractionModeManager.cs
@@ -24,8 +24,12 @@ public class InteractionModeManager : MonoBehaviour
private class ManagedInteractorStatus
{
[SerializeField]
+ [Tooltip("A value representing interactor mode or state that is being targeted by this Managed Interactor Status.")]
private InteractionMode currentMode;
+ ///
+ /// Get or set the value representing interactor mode or state that is being targeted by the instance.
+ ///
public InteractionMode CurrentMode
{
get => currentMode;
@@ -33,8 +37,12 @@ public InteractionMode CurrentMode
}
[SerializeField]
+ [Tooltip("The interactor mode or state that is being targeted by this Managed Interactor Status.")]
private List interactors = new List();
+ ///
+ /// The interactor mode or state that is being targeted by the instance.
+ ///
public List Interactors => interactors;
}
@@ -72,6 +80,15 @@ public void InitializeControllers()
}
}
+ ///
+ /// Expands this object's property with base and sub types associated with
+ /// the current value stored in the property.
+ ///
+ ///
+ /// This function is only intended for use in Unity's inspector window. See
+ /// InteractionModeManagerEditor
+ /// documentation for more details.
+ ///
public void PopulateModesWithSubtypes()
{
List newPrioritizedInteractionModes = new List();
diff --git a/com.microsoft.mrtk.input/Interactors/Gaze/FuzzyGazeInteractor.cs b/com.microsoft.mrtk.input/Interactors/Gaze/FuzzyGazeInteractor.cs
index fee33b6b078..30437eda1b2 100644
--- a/com.microsoft.mrtk.input/Interactors/Gaze/FuzzyGazeInteractor.cs
+++ b/com.microsoft.mrtk.input/Interactors/Gaze/FuzzyGazeInteractor.cs
@@ -174,10 +174,25 @@ private static int ConecastScoreCompare(GazeRaycastHitResult a, GazeRaycastHitRe
// TODO: remove or refactor this section out when the XRRayInteractor exposes the raycast hits
// Otherwise, it's mimicking the logic found in XRRayInteractor
+ ///
+ /// A structure representing a raycast hit result that originated
+ /// from a FuzzyGazeInteractor object.
+ ///
public struct GazeRaycastHitResult
{
+ ///
+ /// The raycast hit for fuzzy gaze interactor.
+ ///
public RaycastHit raycastHit;
+
+ ///
+ /// The interactable object that was hit by the gaze's raycast.
+ ///
public IXRInteractable targetInteractable;
+
+ ///
+ /// The precision level of the fuzzy gaze's raycast.
+ ///
public int precisionLevel;
///
diff --git a/com.microsoft.mrtk.input/Interactors/HandJointInteractor.cs b/com.microsoft.mrtk.input/Interactors/HandJointInteractor.cs
index 8c659f109e7..cdc1ee902e5 100644
--- a/com.microsoft.mrtk.input/Interactors/HandJointInteractor.cs
+++ b/com.microsoft.mrtk.input/Interactors/HandJointInteractor.cs
@@ -42,7 +42,9 @@ public abstract class HandJointInteractor :
///
private bool interactionPointTracked;
- ///
+ ///
+ /// Indicates whether this Interactor is in a state where it could hover.
+ ///
public override bool isHoverActive
{
// Only be available for hovering if the controller is tracked or we have joint data.
@@ -56,6 +58,16 @@ public override bool isHoverActive
private static readonly ProfilerMarker ProcessInteractorPerfMarker =
new ProfilerMarker("[MRTK] HandJointInteractor.ProcessInteractor");
+ ///
+ /// Unity's XRInteractionManager
+ /// or containing IXRInteractionGroup
+ /// calls this method to update the Interactor before interaction events occur. See Unity's documentation for more information.
+ ///
+ /// The update phase this is called during.
+ ///
+ /// Please see the XRInteractionManager documentation for more
+ /// details on update order.
+ ///
public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
{
base.ProcessInteractor(updatePhase);
diff --git a/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierDataProvider.cs b/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierDataProvider.cs
index eb6c1e8ef5f..d84f2f6ed16 100644
--- a/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierDataProvider.cs
+++ b/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierDataProvider.cs
@@ -6,9 +6,15 @@
namespace Microsoft.MixedReality.Toolkit.Input
{
+ ///
+ /// Represents a set parametric curve points.
+ ///
[AddComponentMenu("MRTK/Input/Bezier Data Provider")]
internal class BezierDataProvider : BaseMixedRealityLineDataProvider
{
+ ///
+ /// A structure that holds four 3D points along a parametric curve.
+ ///
[Serializable]
private struct BezierPointSet
{
diff --git a/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierInertia.cs b/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierInertia.cs
index ab7abf0a851..b8be54b248e 100644
--- a/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierInertia.cs
+++ b/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/DataProviders/BezierInertia.cs
@@ -5,22 +5,36 @@
namespace Microsoft.MixedReality.Toolkit.Input
{
+ ///
+ /// Represents a parametric curve of an inertial type movement. The parametric curve positions are updated each frame
+ /// before rendering line visuals, using a linear interpolation function, until the positions reach their specified targets.
+ ///
[RequireComponent(typeof(BezierDataProvider))]
[AddComponentMenu("MRTK/Input/Bezier Inertia")]
public class BezierInertia : MonoBehaviour
- {
+ {
[SerializeField]
+ [Tooltip("A set parametric curve points.")]
private BezierDataProvider bezier;
+
[SerializeField]
+ [Tooltip("The inertial value of the inertial movement.")]
private float inertia = 15f;
+
[SerializeField]
+ [Tooltip("The dampen value of the inertial movement.")]
private float dampen = 6f;
+
[SerializeField]
+ [Tooltip("The scalar value to apply to the time delta when updating the parametric curve point positions.")]
private float seekTargetStrength = 5f;
[SerializeField]
+ [Tooltip("The target value for the first parametric curve point position.")]
private Vector3 p1Target = new Vector3(0, 0, 0.33f);
+
[SerializeField]
+ [Tooltip("The target value for the second parametric curve point position.")]
private Vector3 p2Target = new Vector3(0, 0, 0.66f);
private Vector3 p1Velocity;
diff --git a/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/Definitions/InterpolationType.cs b/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/Definitions/InterpolationType.cs
index c05656f57c0..0fc7ba8040f 100644
--- a/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/Definitions/InterpolationType.cs
+++ b/com.microsoft.mrtk.input/Interactors/InteractorVisuals/Lines/Definitions/InterpolationType.cs
@@ -8,8 +8,14 @@ namespace Microsoft.MixedReality.Toolkit.Input
///
public enum InterpolationType
{
+ ///
+ /// Interpolation using BĂ©zier parametric curve.
+ ///
Bezier = 0,
- CatmullRom,
- Hermite,
+
+ ///
+ /// Interpolation using a Catmull–Rom spline.
+ ///
+ CatmullRom
}
}
diff --git a/com.microsoft.mrtk.input/Subsystems/HandsAggregator/MRTKHandsAggregatorSubsystem.cs b/com.microsoft.mrtk.input/Subsystems/HandsAggregator/MRTKHandsAggregatorSubsystem.cs
index a6f7df9cb48..59f1481ecb0 100644
--- a/com.microsoft.mrtk.input/Subsystems/HandsAggregator/MRTKHandsAggregatorSubsystem.cs
+++ b/com.microsoft.mrtk.input/Subsystems/HandsAggregator/MRTKHandsAggregatorSubsystem.cs
@@ -197,9 +197,15 @@ internal bool TryGetIndexFingerLength(out float length)
}
}
+ ///
+ /// A Unity subsystem provider used with the MRTKHandsAggregatorSubsystem subsystem.
+ ///
[Preserve]
protected class MRTKAggregator : Provider
{
+ ///
+ /// Get the current configuration for this .
+ ///
protected MRTKHandsAggregatorConfig Config { get; private set; }
private Dictionary hands = null;
@@ -207,6 +213,7 @@ protected class MRTKAggregator : Provider
// Reusable pinch pose structs to reduce allocs.
private HandJointPose leftPinchPose, rightPinchPose;
+ ///
public override void Start()
{
base.Start();
@@ -222,6 +229,7 @@ public override void Start()
InputSystem.onBeforeUpdate += ResetHands;
}
+ ///
public override void Stop()
{
ResetHands();
diff --git a/com.microsoft.mrtk.input/Utilities/HandshapeTypes.cs b/com.microsoft.mrtk.input/Utilities/HandshapeTypes.cs
index d4f16758530..3009928feb5 100644
--- a/com.microsoft.mrtk.input/Utilities/HandshapeTypes.cs
+++ b/com.microsoft.mrtk.input/Utilities/HandshapeTypes.cs
@@ -3,6 +3,9 @@
namespace Microsoft.MixedReality.Toolkit.Input
{
+ ///
+ /// A static class containing types related to hand shapes.
+ ///
public static class HandshapeTypes
{
diff --git a/com.microsoft.mrtk.input/Utilities/PoseSource/InputActionPoseSource.cs b/com.microsoft.mrtk.input/Utilities/PoseSource/InputActionPoseSource.cs
index 5f73edaaad1..c72063649c5 100644
--- a/com.microsoft.mrtk.input/Utilities/PoseSource/InputActionPoseSource.cs
+++ b/com.microsoft.mrtk.input/Utilities/PoseSource/InputActionPoseSource.cs
@@ -8,24 +8,26 @@
namespace Microsoft.MixedReality.Toolkit.Input
{
- [Serializable]
-
///
- /// A pose source which gets the pose composed of a tracked position and rotation input action
+ /// A pose source which gets the pose composed of a tracked position and rotation input action.
///
+ [Serializable]
public class InputActionPoseSource : IPoseSource
{
[SerializeField]
+ [Tooltip("The input action property used when obtaining the tracking information for the current pose.")]
InputActionProperty trackingStateActionProperty;
[SerializeField]
+ [Tooltip("The input action property used when obtaining the position information for the current pose.")]
InputActionProperty positionActionProperty;
[SerializeField]
+ [Tooltip("The input action property used when obtaining the rotation information for the current pose.")]
InputActionProperty rotationActionProperty;
///
- /// Tries to get the pose in worldspace composed of the provided input action properties when the position and rotation are tracked
+ /// Tries to get the pose in world space composed of the provided input action properties when the position and rotation are tracked.
///
public bool TryGetPose(out Pose pose)
{
diff --git a/com.microsoft.mrtk.spatialmanipulation/Solvers/SurfaceMagnetism.cs b/com.microsoft.mrtk.spatialmanipulation/Solvers/SurfaceMagnetism.cs
index fc7bc1073af..4cfda7e2676 100644
--- a/com.microsoft.mrtk.spatialmanipulation/Solvers/SurfaceMagnetism.cs
+++ b/com.microsoft.mrtk.spatialmanipulation/Solvers/SurfaceMagnetism.cs
@@ -461,7 +461,7 @@ public override void SolverUpdate()
// Determine raycast params. Update struct to skip instantiation
Vector3 origin = RaycastOrigin;
Vector3 endpoint = RaycastEndPoint;
- currentRayStep.UpdateRayStep(ref origin, ref endpoint);
+ currentRayStep.UpdateRayStep(in origin, in endpoint);
// Skip if there isn't a valid direction
if (currentRayStep.Direction == Vector3.zero)
diff --git a/com.microsoft.mrtk.spatialmanipulation/Solvers/TapToPlace.cs b/com.microsoft.mrtk.spatialmanipulation/Solvers/TapToPlace.cs
index 0171ea28ddf..7bd0351371f 100644
--- a/com.microsoft.mrtk.spatialmanipulation/Solvers/TapToPlace.cs
+++ b/com.microsoft.mrtk.spatialmanipulation/Solvers/TapToPlace.cs
@@ -407,7 +407,7 @@ protected virtual void PerformRaycast()
Vector3 origin = transform.position;
Vector3 endpoint = transform.position + transform.forward;
- CurrentRay.UpdateRayStep(ref origin, ref endpoint);
+ CurrentRay.UpdateRayStep(in origin, in endpoint);
// Check if the current ray hits a magnetic surface
DidHitSurface = MixedRealityRaycaster.RaycastSimplePhysicsStep(CurrentRay, MaxRaycastDistance, MagneticSurfaces, false, out CurrentHit);
diff --git a/com.microsoft.mrtk.uxcore/Keyboard/KeyboardPreview.cs b/com.microsoft.mrtk.uxcore/Keyboard/KeyboardPreview.cs
index e51c5cabdc5..8e10c72efba 100644
--- a/com.microsoft.mrtk.uxcore/Keyboard/KeyboardPreview.cs
+++ b/com.microsoft.mrtk.uxcore/Keyboard/KeyboardPreview.cs
@@ -214,8 +214,8 @@ private void UpdateLayout()
}
var lineInfo = textInfo.lineInfo[prevChar.lineNumber];
- ScrollView(textInfo, ref lineInfo, ref prevChar, ref nextChar);
- UpdateCaret(textInfo, ref lineInfo, ref prevChar);
+ ScrollView(textInfo, in lineInfo, in prevChar, in nextChar);
+ UpdateCaret(textInfo, in lineInfo, in prevChar);
}
///
@@ -226,8 +226,8 @@ private void UpdateLayout()
///
private void UpdateCaret(
TMP_TextInfo textInfo,
- ref TMP_LineInfo lineInfo,
- ref TMP_CharacterInfo prevChar)
+ in TMP_LineInfo lineInfo,
+ in TMP_CharacterInfo prevChar)
{
// get line info
float focusedLineWidth = lineInfo.width;
@@ -251,12 +251,12 @@ private void UpdateCaret(
float caretPositionY = lineInfo.baseline - textInfo.lineInfo[0].baseline;
// if at end of line, text info doesn't go to a new line info, so account for this.
- if (AtEmptyNewLine(ref lineInfo, ref prevChar))
+ if (AtEmptyNewLine(in lineInfo, in prevChar))
{
caretPositionX = focusedLineStart;
caretPositionY -= lineInfo.lineHeight;
}
- else if (AtStartOfLine(ref lineInfo, ref prevChar))
+ else if (AtStartOfLine(in lineInfo, in prevChar))
{
caretPositionX = focusedLineStart;
}
@@ -294,9 +294,9 @@ private void ResetCaret()
///
private void ScrollView(
TMP_TextInfo textInfo,
- ref TMP_LineInfo lineInfo,
- ref TMP_CharacterInfo prevChar,
- ref TMP_CharacterInfo nextChar)
+ in TMP_LineInfo lineInfo,
+ in TMP_CharacterInfo prevChar,
+ in TMP_CharacterInfo nextChar)
{
// get line info
float focusedLineWidth = lineInfo.width;
@@ -311,7 +311,7 @@ private void ScrollView(
float textPositionY = focusedLineOffset;
// if at end of line, text info doesn't go to a new line info, so account for this.
- if (AtEmptyNewLine(ref lineInfo, ref prevChar))
+ if (AtEmptyNewLine(in lineInfo, in prevChar))
{
textPositionX = 0;
textPositionY += lineInfo.lineHeight;
@@ -339,7 +339,7 @@ private void ResetView()
///
/// Is the cursor at the start of new empty line, that is not the very first line.
///
- private bool AtEmptyNewLine(ref TMP_LineInfo lineInfo, ref TMP_CharacterInfo prevChar)
+ private bool AtEmptyNewLine(in TMP_LineInfo lineInfo, in TMP_CharacterInfo prevChar)
{
return prevChar.character == '\n' && prevChar.index == lineInfo.lastCharacterIndex;
}
@@ -347,7 +347,7 @@ private bool AtEmptyNewLine(ref TMP_LineInfo lineInfo, ref TMP_CharacterInfo pre
///
/// Is the cursor at a start of the line
///
- private bool AtStartOfLine(ref TMP_LineInfo lineInfo, ref TMP_CharacterInfo prevChar)
+ private bool AtStartOfLine(in TMP_LineInfo lineInfo, in TMP_CharacterInfo prevChar)
{
return lineInfo.characterCount == 0 ? true : lineInfo.firstCharacterIndex > prevChar.index;
}
@@ -355,7 +355,7 @@ private bool AtStartOfLine(ref TMP_LineInfo lineInfo, ref TMP_CharacterInfo prev
///
/// Is the cursor at the end of a line
///
- private bool AtEndOfLine(ref TMP_LineInfo lineInfo, ref TMP_CharacterInfo prevChar)
+ private bool AtEndOfLine(in TMP_LineInfo lineInfo, in TMP_CharacterInfo prevChar)
{
return lineInfo.lastCharacterIndex <= prevChar.index;
}