/// <summary> /// Constructor. /// </summary> /// <param name="name"></param> /// <param name="priority"></param> /// <param name="profile"></param> protected BaseMixedRealitySpatialMeshObserver(string name, uint priority, BaseMixedRealitySpatialMeshObserverProfile profile) : base(name, priority, profile) { MeshPhysicsLayerOverride = profile.MeshPhysicsLayerOverride; MeshLevelOfDetail = profile.MeshLevelOfDetail; MeshTrianglesPerCubicMeter = profile.MeshTrianglesPerCubicMeter; MeshRecalculateNormals = profile.MeshRecalculateNormals; MeshDisplayOption = profile.MeshDisplayOption; MeshVisibleMaterial = profile.MeshVisibleMaterial; MeshOcclusionMaterial = profile.MeshOcclusionMaterial; ObservationExtents = profile.ObservationExtents; IsStationaryObserver = profile.IsStationaryObserver; spatialMeshObjectPool = new Stack <SpatialMeshObject>(); }
/// <inheritdoc /> protected BaseMixedRealitySpatialMeshObserver(string name, uint priority, BaseMixedRealitySpatialMeshObserverProfile profile, IMixedRealitySpatialAwarenessSystem parentService) : base(name, priority, profile, parentService) { if (profile.IsNull()) { profile = MixedRealityToolkit.Instance.ActiveProfile.SpatialAwarenessProfile.GlobalMeshObserverProfile; } if (profile.IsNull()) { throw new ArgumentNullException($"Missing a {profile.GetType().Name} profile for {name}"); } MeshLevelOfDetail = profile.MeshLevelOfDetail; MeshRecalculateNormals = profile.MeshRecalculateNormals; meshDisplayOption = MixedRealityToolkit.SpatialAwarenessSystem.SpatialMeshVisibility; MeshVisibleMaterial = profile.MeshVisibleMaterial; MeshOcclusionMaterial = profile.MeshOcclusionMaterial; ObservationExtents = profile.ObservationExtents; IsStationaryObserver = profile.IsStationaryObserver; var additionalComponents = profile.AdditionalComponents; meshObjectPrefab = profile.MeshObjectPrefab; spatialMeshObjectPool = new Stack <SpatialMeshObject>(); if (additionalComponents != null) { requiredMeshComponents = new Type[additionalComponents.Length + 3]; requiredMeshComponents[0] = typeof(MeshFilter); requiredMeshComponents[1] = typeof(MeshRenderer); requiredMeshComponents[2] = typeof(MeshCollider); for (int i = 3; i < additionalComponents.Length; i++) { var component = additionalComponents[i - 3].Type; Debug.Assert(component != null); requiredMeshComponents[i] = component; } } else { requiredMeshComponents = new[] { typeof(MeshFilter), typeof(MeshRenderer), typeof(MeshCollider) }; } }
/// <summary> /// Constructor. /// </summary> /// <param name="name"></param> /// <param name="priority"></param> /// <param name="profile"></param> protected BaseMixedRealitySpatialMeshObserver(string name, uint priority, BaseMixedRealitySpatialMeshObserverProfile profile) : base(name, priority, profile) { MeshPhysicsLayerOverride = profile.MeshPhysicsLayerOverride; MeshLevelOfDetail = profile.MeshLevelOfDetail; MeshTrianglesPerCubicMeter = profile.MeshTrianglesPerCubicMeter; MeshRecalculateNormals = profile.MeshRecalculateNormals; meshDisplayOption = MixedRealityToolkit.SpatialAwarenessSystem.SpatialMeshVisibility; MeshVisibleMaterial = profile.MeshVisibleMaterial; MeshOcclusionMaterial = profile.MeshOcclusionMaterial; ObservationExtents = profile.ObservationExtents; IsStationaryObserver = profile.IsStationaryObserver; var additionalComponents = profile.AdditionalComponents; meshObjectPrefab = profile.MeshObjectPrefab; spatialMeshObjectPool = new Stack <SpatialMeshObject>(); if (additionalComponents != null) { requiredMeshComponents = new Type[additionalComponents.Length + 3]; requiredMeshComponents[0] = typeof(MeshFilter); requiredMeshComponents[1] = typeof(MeshRenderer); requiredMeshComponents[2] = typeof(MeshCollider); for (int i = 3; i < additionalComponents.Length; i++) { var component = additionalComponents[i - 3].Type; Debug.Assert(component != null); requiredMeshComponents[i] = component; } } else { requiredMeshComponents = new[] { typeof(MeshFilter), typeof(MeshRenderer), typeof(MeshCollider) }; } }