示例#1
0
		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();
		}
示例#2
0
		public static extern void iplBakeSoundFlow(IntPtr baker, SoundFlowBakeCallback callback);