Exemplo n.º 1
0
    /// <summary>
    /// Set the render material on the meshes.
    /// </summary>
    /// <param name="mode">The render mode that should be used on the material.</param>
    public void SetRenderers(RenderMode mode)
    {
        if (_renderMode != mode)
        {
            // Set the render mode.
            _renderMode = mode;

            // Clear existing meshes to process the new mesh type.
            switch (_renderMode)
            {
            case RenderMode.Wireframe:
            case RenderMode.Occlusion:
            {
                _mlSpatialMapper.meshType = MLSpatialMapper.MeshType.Triangles;

                break;
            }

            case RenderMode.PointCloud:
            {
                _mlSpatialMapper.meshType = MLSpatialMapper.MeshType.PointCloud;

                break;
            }
            }

            _mlSpatialMapper.DestroyAllMeshes();
            _mlSpatialMapper.RefreshAllMeshes();
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Handle in charge of refreshing all meshes if map gets lost.
 /// </summary>
 /// <param name="mapEvents"> Map Events that happened. </param>
 private void OnHeadTrackingMapEvent(MLHeadTrackingMapEvent mapEvents)
 {
     if (mapEvents.IsLost())
     {
         _mlSpatialMapper.DestroyAllMeshes();
         _mlSpatialMapper.RefreshAllMeshes();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Handle in charge of refreshing all meshes if a new session occurs
 /// </summary>
 /// <param name="mapEvents"> Map Events that happened. </param>
 private void OnHeadTrackingMapEvent(MLHeadTracking.MapEvents mapEvents)
 {
     #if PLATFORM_LUMIN
     if (mapEvents.IsNewSession())
     {
         _mlSpatialMapper.DestroyAllMeshes();
         _mlSpatialMapper.RefreshAllMeshes();
     }
     #endif
 }
        /// <summary>
        /// Set the render material on the meshes.
        /// </summary>
        /// <param name="mode">The render mode that should be used on the material.</param>
        public void SetRenderers(RenderMode mode)
        {
            // Set the render mode.
            _renderMode = mode;

            // Clear existing meshes to process the new mesh type.
            switch (_renderMode)
            {
            case RenderMode.Wireframe:
            case RenderMode.Occlusion:
            {
                _mlSpatialMapper.DestroyAllMeshes();
                _mlSpatialMapper.RefreshAllMeshes();

                _mlSpatialMapper.meshType = MLSpatialMapper.MeshType.Triangles;

                break;
            }

            case RenderMode.PointCloud:
            {
                _mlSpatialMapper.DestroyAllMeshes();
                _mlSpatialMapper.RefreshAllMeshes();

                _mlSpatialMapper.meshType = MLSpatialMapper.MeshType.PointCloud;

                break;
            }
            }

            // Update the material applied to all the MeshRenderers.
            foreach (GameObject fragment in _mlSpatialMapper.meshIdToGameObjectMap.Values)
            {
                UpdateRenderer(fragment.GetComponent <MeshRenderer>());
            }
        }