Class BaseSpatialMeshObserver
Class providing a base implementation of the IMixedRealitySpatialAwarenessMeshObserver interface.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.SpatialAwareness
Assembly: cs.temp.dll.dll
Syntax
public abstract class BaseSpatialMeshObserver : BaseSpatialObserver, IMixedRealitySpatialAwarenessMeshObserver, IMixedRealitySpatialAwarenessObserver, IMixedRealityDataProvider, IMixedRealityService, IDisposable, IMixedRealityEventSource, IEqualityComparer
Constructors
BaseSpatialMeshObserver(IMixedRealitySpatialAwarenessSystem, String, UInt32, BaseMixedRealityProfile)
Constructor.
Declaration
protected BaseSpatialMeshObserver(IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem, string name = null, uint priority = 10U, BaseMixedRealityProfile profile = null)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealitySpatialAwarenessSystem | spatialAwarenessSystem | The IMixedRealitySpatialAwarenessSystem to which the observer is providing data. |
String | name | The friendly name of the data provider. |
UInt32 | priority | The registration priority of the data provider. |
BaseMixedRealityProfile | profile | The configuration profile for the data provider. |
Fields
meshes
The backing field for Meshes, to allow the mesh observer implementation to track its meshes.
Declaration
protected readonly Dictionary<int, SpatialAwarenessMeshObject> meshes
Field Value
Type | Description |
---|---|
Dictionary<Int32, SpatialAwarenessMeshObject> |
meshEventData
Declaration
protected MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject> meshEventData
Field Value
Type | Description |
---|---|
MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject> |
OnMeshAdded
Event sent whenever a mesh is added.
Declaration
protected static readonly ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> OnMeshAdded
Field Value
Type | Description |
---|---|
ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> |
OnMeshRemoved
Event sent whenever a mesh is discarded.
Declaration
protected static readonly ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> OnMeshRemoved
Field Value
Type | Description |
---|---|
ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> |
OnMeshUpdated
Event sent whenever a mesh is updated.
Declaration
protected static readonly ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> OnMeshUpdated
Field Value
Type | Description |
---|---|
ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> |
Properties
DisplayOption
Gets or sets a value indicating how the mesh subsystem is to display surface meshes within the application.
Declaration
public SpatialAwarenessMeshDisplayOptions DisplayOption { get; set; }
Property Value
Type | Description |
---|---|
SpatialAwarenessMeshDisplayOptions |
Remarks
Applications that wish to process the Meshes should set this value to None.
LevelOfDetail
Gets or sets the level of detail, as a MixedRealitySpatialAwarenessMeshLevelOfDetail value, for the returned spatial mesh. Setting this value to Custom, implies that the developer is specifying a custom value for MeshTrianglesPerCubicMeter.
Declaration
public SpatialAwarenessMeshLevelOfDetail LevelOfDetail { get; set; }
Property Value
Type | Description |
---|---|
SpatialAwarenessMeshLevelOfDetail |
Remarks
Specifying any other value will cause TrianglesPerCubicMeter to be overwritten.
Meshes
Gets the collection of SpatialAwarenessMeshObjects being managed by the observer.
Declaration
public IReadOnlyDictionary<int, SpatialAwarenessMeshObject> Meshes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<Int32, SpatialAwarenessMeshObject> |
MeshPhysicsLayer
Get or sets the desired Unity Physics Layer on which to set the spatial mesh.
Declaration
public int MeshPhysicsLayer { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
If not explicitly set, it is recommended that implementations return DefaultPhysicsLayer.
MeshPhysicsLayerMask
Gets the bit mask that corresponds to the value specified in MeshPhysicsLayer.
Declaration
public int MeshPhysicsLayerMask { get; }
Property Value
Type | Description |
---|---|
Int32 |
ObservedObjectParent
The parent GameObject for all observed meshes to be placed under.
Declaration
protected virtual GameObject ObservedObjectParent { get; }
Property Value
Type | Description |
---|---|
GameObject |
OcclusionMaterial
Declaration
public Material OcclusionMaterial { get; set; }
Property Value
Type | Description |
---|---|
Material |
RecalculateNormals
Indicates whether or not mesh normals should be recalculated by the observer.
Declaration
public bool RecalculateNormals { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
TrianglesPerCubicMeter
Gets or sets the level of detail, in triangles per cubic meter, for the returned spatial mesh.
Declaration
public int TrianglesPerCubicMeter { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
When specifying a LevelOfDetail other than Custom, this value will be automatically overwritten with system default values.
VisibleMaterial
Declaration
public Material VisibleMaterial { get; set; }
Property Value
Type | Description |
---|---|
Material |
Methods
ApplyUpdatedMeshDisplayOption(SpatialAwarenessMeshDisplayOptions)
Applies the mesh display option to existing meshes when modified at runtime.
Declaration
protected virtual void ApplyUpdatedMeshDisplayOption(SpatialAwarenessMeshDisplayOptions option)
Parameters
Type | Name | Description |
---|---|---|
SpatialAwarenessMeshDisplayOptions | option | The SpatialAwarenessMeshDisplayOptions value to be used to determine the appropriate material. |
ApplyUpdatedPhysicsLayer()
Updates the mesh physics layer for current mesh observations.
Declaration
protected virtual void ApplyUpdatedPhysicsLayer()
Initialize()
Initializes event data and creates the observer.
Declaration
public override void Initialize()
Overrides
LookupTriangleDensity(SpatialAwarenessMeshLevelOfDetail)
Declaration
protected virtual int LookupTriangleDensity(SpatialAwarenessMeshLevelOfDetail levelOfDetail)
Parameters
Type | Name | Description |
---|---|---|
SpatialAwarenessMeshLevelOfDetail | levelOfDetail | The desired level of density for the spatial mesh. |
Returns
Type | Description |
---|---|
Int32 | The number of triangles per cubic meter that will result in the desired level of density. |
ReadProfile()
Declaration
protected virtual void ReadProfile()