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); } }
/// <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; }