static void BeginBake()
		{
			Status = SoundFlowBakeStatus.Preprocessing;

			AcousticSceneExporter.ExportScene();
			Grid = GameObject.FindObjectOfType<AcousticGrid>().LoadGrid();

            bakeSettings = new IPLSoundFlowSettings();
            bakeSettings.rays = SoundFlowGlobalSettings.GetBakeSettings().Value.Rays;
            bakeSettings.bounces = SoundFlowGlobalSettings.GetBakeSettings().Value.Bounces;

            bakeReflection = SoundFlowGlobalSettings.GetBakeSettings().BakeReflection;
            bakeDiffraction = SoundFlowGlobalSettings.GetBakeSettings().BakeDiffraction;

            if (!bakeDiffraction)
                Status = SoundFlowBakeStatus.InProgress;

			PhononSoundFlowSource[] sourceObjects = GameObject.FindObjectsOfType<PhononSoundFlowSource>();
			SourcePositions = new Vector3[sourceObjects.Length];
            for (int i = 0; i < sourceObjects.Length; ++i)
            {
                SourcePositions[i] = Common.ConvertVector(sourceObjects[i].transform.position);
                sourceObjects[i].BakedSourceIndex = i;
            }

            PreprocessCallbackDelegate = new SoundFlowPreprocessCallback(AdvancePreprocessProgress);
            BakeCallbackDelegate = new SoundFlowBakeCallback(AdvanceProgress);
#if (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN)
            PreprocessCallbackPointer = Marshal.GetFunctionPointerForDelegate(PreprocessCallbackDelegate);
            PreprocessCallbackHandle = GCHandle.Alloc(PreprocessCallbackPointer);
            GC.Collect();

			BakeCallbackPointer = Marshal.GetFunctionPointerForDelegate(BakeCallbackDelegate);
			BakeCallbackHandle = GCHandle.Alloc(BakeCallbackPointer);
			GC.Collect();
#endif

			ThreadHandle = new Thread(new ThreadStart(BakeThread));
			ThreadHandle.Start();
		}
Beispiel #2
0
 public static extern Error iplLoadSoundFlow(IntPtr scene, IntPtr grid, IPLSoundFlowSettings settings, int numSources, Vector3[] sources, byte[] data, [In, Out] ref IntPtr baker);
Beispiel #3
0
		public static extern Error iplCreateSoundFlowEstimator(IntPtr scene, IPLSoundFlowSettings settings, Bool enableReflection, Bool enableDiffraction, [In, Out] ref IntPtr estimator);
Beispiel #4
0
 public static extern Error iplCreateSoundFlowBaker(IntPtr scene, IntPtr grid, IPLSoundFlowSettings settings, Bool enableReflection, Bool enableDiffraction, int numSources, Vector3[] sources, SoundFlowPreprocessCallback callback, [In, Out] ref IntPtr baker);