public ProbeArray(ProbeArray probeArray) { mProbeArray = API.iplProbeArrayRetain(probeArray.mProbeArray); }
public void GenerateProbes() { SteamAudioManager.Initialize(ManagerInitReason.GeneratingProbes); SteamAudioManager.LoadScene(SceneManager.GetActiveScene(), SteamAudioManager.Context, false); var scene = SteamAudioManager.CurrentScene; SteamAudioStaticMesh staticMeshComponent = null; var rootObjects = SceneManager.GetActiveScene().GetRootGameObjects(); foreach (var rootObject in rootObjects) { staticMeshComponent = rootObject.GetComponentInChildren <SteamAudioStaticMesh>(); if (staticMeshComponent) { break; } } if (staticMeshComponent == null || staticMeshComponent.asset == null) { Debug.LogError(string.Format("Scene {0} has not been exported. Click Steam Audio > Export Active Scene to do so.", SceneManager.GetActiveScene().name)); return; } var staticMesh = new StaticMesh(SteamAudioManager.Context, scene, staticMeshComponent.asset); staticMesh.AddToScene(scene); scene.Commit(); var probeArray = new ProbeArray(SteamAudioManager.Context); var probeGenerationParams = new ProbeGenerationParams { }; probeGenerationParams.type = placementStrategy; probeGenerationParams.spacing = horizontalSpacing; probeGenerationParams.height = heightAboveFloor; probeGenerationParams.transform = Common.TransposeMatrix(Common.ConvertTransform(gameObject.transform)); // Probe generation requires a transposed matrix. probeArray.GenerateProbes(scene, probeGenerationParams); var numProbes = probeArray.GetNumProbes(); mProbeSpheres = new Sphere[numProbes]; for (var i = 0; i < numProbes; ++i) { mProbeSpheres[i] = probeArray.GetProbe(i); } var probeBatch = new ProbeBatch(SteamAudioManager.Context); probeBatch.AddProbeArray(probeArray); probeDataSize = probeBatch.Save(GetAsset()); probeBatch.Release(); probeArray.Release(); staticMesh.Release(); SteamAudioManager.ShutDown(); DestroyImmediate(SteamAudioManager.Singleton.gameObject); ResetLayers(); Debug.Log("Generated " + mProbeSpheres.Length + " probes for game object " + gameObject.name + "."); // Redraw scene view for probes to show up instantly. #if UNITY_EDITOR SceneView.RepaintAll(); #endif }
public void AddProbeArray(ProbeArray probeArray) { API.iplProbeBatchAddProbeArray(mProbeBatch, probeArray.Get()); }