예제 #1
0
 /// <summary>
 /// To be called OnDestroy() of a given StkMesh to ensure it's respective MeshCluster is notified.
 /// Operates on name to not be nullified when Mesh object is deleted and also because Clusters operate on mesh names.
 /// </summary>
 internal void QueueForUpdate(string meshName, SoundToolKitMeshCluster cluster)
 {
     if (cluster != null)
     {
         m_meshMeshClusterPairs.Add(meshName, cluster);
         m_updateQueued = true;
     }
 }
예제 #2
0
        /// <summary>
        /// Unloads a given MeshCluster from the scene. Unloaded Clusters do not take part in sound processing.
        /// </summary>
        public void UnloadMeshCluster(SoundToolKitMeshCluster meshCluster)
        {
            if (meshCluster != null && meshCluster.Model != null && SoundToolKitManager.Instance != null)
            {
                SoundToolKitManager.Instance.StkAudioEngine.Scene.RemoveModel(meshCluster.Model);
            }

            meshCluster.OnMeshesModified -= ReloadMeshCluster;
            meshCluster.ClearInternalModel();
        }
예제 #3
0
        internal void ReloadMeshCluster(SoundToolKitMeshCluster meshCluster)
        {
            var scene = SoundToolKitManager.Instance.StkAudioEngine.Scene;

            meshCluster.ClearSerializedData();

            if (meshCluster.Model != null)
            {
                scene.RemoveModel(meshCluster.Model);
                meshCluster.ClearInternalModel();
            }

            if (meshCluster.AcousticMeshNames.Any())
            {
                meshCluster.CreateInternalModel();
                scene.AddModel(meshCluster.Model);
            }
        }
예제 #4
0
        /// <summary>
        /// Load a given MeshCluster into the scene. Only MeshClusters that are loaded take part in acoustic processing.
        /// </summary>
        public void LoadMeshCluster(SoundToolKitMeshCluster meshCluster)
        {
            if (meshCluster == null)
            {
                MeshClusters.Remove(meshCluster);
                return;
            }

            if (!meshCluster.AcousticMeshNames.Any())
            {
                SoundToolKitDebug.LogWarning("Cannot load a MeshCluster that contains no SoundToolKitMeshes. " +
                                             "Please assign SoundToolKitMeshes to a cluster prior to loading it. (Trying to load " +
                                             meshCluster.name + " MeshCluster)");
                return;
            }

            if (meshCluster.Model == null)
            {
                meshCluster.CreateInternalModel();
            }

            SoundToolKitManager.Instance.StkAudioEngine.Scene.AddModel(meshCluster.Model);
            meshCluster.OnMeshesModified += ReloadMeshCluster;
        }