public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums) : base(multiThreadTask) { if (spectrums == null || spectrums.Length != 4) { throw new ArgumentException("Spectrums array must have a length of 4"); } m_spectrums = spectrums; Condition = condition; Size = condition.Key.Size; GridSizes = condition.GridSizes; WaveAmps = condition.WaveAmps; NumGrids = condition.Key.NumGrids; //OYM: 这里 m_rnd = new System.Random(0); //OYM: 创建一个random m_distibution = SPECTRUM_DISTRIBUTION.LINEAR; //OYM: 分配模式 float factor = 2.0f * Mathf.PI * Size; //OYM: 工厂? InverseGridSizes = new Vector4(factor / GridSizes.x, factor / GridSizes.y, factor / GridSizes.z, factor / GridSizes.w); m_spectrum01 = new Color[Size * Size]; //OYM: 一个color数组 if (NumGrids > 2) { m_spectrum23 = new Color[Size * Size]; //OYM: 又一个? } m_wtable = new Color[Size * Size]; //OYM: 这一堆玩意没写注释 }
public void CreateAndCacheCondition(int fourierSize, float windSpeed, float windDir, float waveAge) { if (this.m_conditionCache == null) { return; } if (this.m_conditionCache.Count >= this.m_maxConditionCacheSize) { Ocean.LogWarning("Condition cache full. Condition not cached."); return; } if (!Mathf.IsPowerOfTwo(fourierSize) || fourierSize < 32 || fourierSize > 512) { Ocean.LogWarning("Fourier size must be a pow2 number from 32 to 512. Condition not cached."); return; } WaveSpectrumCondition waveSpectrumCondition = this.NewSpectrumCondition(fourierSize, windSpeed, windDir, waveAge); if (this.m_conditionCache.ContainsKey(waveSpectrumCondition.Key)) { return; } IThreadedTask createSpectrumConditionTask = waveSpectrumCondition.GetCreateSpectrumConditionTask(); createSpectrumConditionTask.Start(); createSpectrumConditionTask.Run(); createSpectrumConditionTask.End(); this.m_conditionCache.AddFirst(waveSpectrumCondition.Key, waveSpectrumCondition); }
public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums) : base(multiThreadTask) { if (spectrums == null || spectrums.Length != 4) throw new ArgumentException("Spectrums array must have a length of 4"); m_spectrums = spectrums; Condition = condition; Size = condition.Key.Size; GridSizes = condition.GridSizes; WaveAmps = condition.WaveAmps; NumGrids = condition.Key.NumGrids; m_rnd = new System.Random(0); m_distibution = SPECTRUM_DISTRIBUTION.LINEAR; float factor = 2.0f * Mathf.PI * Size; InverseGridSizes = new Vector4(factor / GridSizes.x, factor / GridSizes.y, factor / GridSizes.z, factor / GridSizes.w); m_spectrum01 = new Color[Size * Size]; if(NumGrids > 2) m_spectrum23 = new Color[Size * Size]; m_wtable = new Color[Size * Size]; }
public override void Run(WaveSpectrumCondition condition, float time) { base.TimeValue = time; base.HasRun = true; base.BeenSampled = false; if (this.m_samplingEnabled) { throw new InvalidOperationException("Can not run if sampling enabled"); } this.UpdateEnabledData(); this.CreateTextures(); int count = this.m_enabledData.Count; if (count == 0) { return; } this.Initilize(condition, time); if (count == 1) { this.m_index = this.m_fourier.PeformFFT(this.m_enabledData[0]); } else if (count == 2) { this.m_index = this.m_fourier.PeformFFT(this.m_enabledData[0], this.m_enabledData[1]); } else if (count == 3) { this.m_index = this.m_fourier.PeformFFT(this.m_enabledData[0], this.m_enabledData[1], this.m_enabledData[2]); } else if (count == 4) { this.m_index = this.m_fourier.PeformFFT(this.m_enabledData[0], this.m_enabledData[1], this.m_enabledData[2], this.m_enabledData[3]); } }
public override void Run(WaveSpectrumCondition condition, float time) { if (!this.IsDone()) { throw new InvalidOperationException("Can not run when there are tasks that have not finished"); } base.TimeValue = time; base.HasRun = true; base.BeenSampled = false; if (this.EnabledBuffers() == 0) { return; } this.Initilize(condition, time); if (Ocean.DISABLE_FOURIER_MULTITHREADING) { this.m_initTask.Start(); this.m_initTask.Run(); this.m_initTask.End(); } int num = this.m_buffers.Length; for (int i = 0; i < num; i++) { if (!this.m_buffers[i].disabled) { if (this.m_fourierTasks[i] == null) { this.m_fourierTasks[i] = new FourierTask(this, this.m_fourier, i, this.m_initTask.NumGrids); } else { this.m_fourierTasks[i].Reset(i, this.m_initTask.NumGrids); } FourierTask fourierTask = this.m_fourierTasks[i]; if (fourierTask.Done) { throw new InvalidOperationException("Fourier task should not be done before running"); } if (Ocean.DISABLE_FOURIER_MULTITHREADING) { fourierTask.Start(); fourierTask.Run(); fourierTask.End(); } else { fourierTask.RunOnStopWaiting = true; fourierTask.WaitOn(this.m_initTask); this.m_scheduler.AddWaiting(fourierTask); } } } if (!Ocean.DISABLE_FOURIER_MULTITHREADING) { this.m_initTask.NoFinish = true; this.m_scheduler.Run(this.m_initTask); } }
protected override void Initilize(WaveSpectrumCondition condition, float time) { if (base.InitMaterial == null) { throw new InvalidOperationException("GPU buffer has not had its Init material set"); } if (base.InitPass == -1) { throw new InvalidOperationException("GPU buffer has not had its Init material pass set"); } base.InitMaterial.SetTexture("Ceto_Spectrum01", (!(condition.Spectrum01 != null)) ? Texture2D.blackTexture : condition.Spectrum01); base.InitMaterial.SetTexture("Ceto_Spectrum23", (!(condition.Spectrum23 != null)) ? Texture2D.blackTexture : condition.Spectrum23); base.InitMaterial.SetTexture("Ceto_WTable", condition.WTable); base.InitMaterial.SetVector("Ceto_InverseGridSizes", condition.InverseGridSizes()); base.InitMaterial.SetVector("Ceto_GridSizes", condition.GridSizes); base.InitMaterial.SetVector("Ceto_Offset", this.m_offset); base.InitMaterial.SetFloat("Ceto_Time", time); this.m_tmpList.Clear(); int num = this.m_buffers.Length; for (int i = 0; i < num; i++) { if (!this.m_buffers[i].disabled) { this.m_tmpList.Add(this.m_buffers[i].data[1]); } } num = this.m_tmpList.Count; if (num == 0) { return; } if (num == 1) { Graphics.Blit(null, this.m_tmpList[0], base.InitMaterial, base.InitPass); } else if (num == 2) { this.m_tmpBuffer2[0] = this.m_tmpList[0].colorBuffer; this.m_tmpBuffer2[1] = this.m_tmpList[1].colorBuffer; RTUtility.MultiTargetBlit(this.m_tmpBuffer2, this.m_tmpList[0].depthBuffer, base.InitMaterial, base.InitPass); } else if (num == 3) { this.m_tmpBuffer3[0] = this.m_tmpList[0].colorBuffer; this.m_tmpBuffer3[1] = this.m_tmpList[1].colorBuffer; this.m_tmpBuffer3[2] = this.m_tmpList[2].colorBuffer; RTUtility.MultiTargetBlit(this.m_tmpBuffer3, this.m_tmpList[0].depthBuffer, base.InitMaterial, base.InitPass); } else if (num == 4) { this.m_tmpBuffer4[0] = this.m_tmpList[0].colorBuffer; this.m_tmpBuffer4[1] = this.m_tmpList[1].colorBuffer; this.m_tmpBuffer4[2] = this.m_tmpList[2].colorBuffer; this.m_tmpBuffer4[3] = this.m_tmpList[3].colorBuffer; RTUtility.MultiTargetBlit(this.m_tmpBuffer4, this.m_tmpList[0].depthBuffer, base.InitMaterial, base.InitPass); } }
public InitSpectrumDisplacementsTask(DisplacementBufferCPU buffer, WaveSpectrumCondition condition, float time) : base(true) { this.Buffer = buffer; this.NumGrids = condition.Key.NumGrids; this.Size = condition.Key.Size; this.SpectrumType = condition.Key.SpectrumType; this.TimeValue = time; this.Reset(condition, time); this.CreateKTables(condition.InverseGridSizes()); }
public InitSpectrumDisplacementsTask(DisplacementBufferCPU buffer, WaveSpectrumCondition condition, float time) : base(true) { Buffer = buffer; NumGrids = condition.Key.NumGrids; Size = condition.Key.Size; SpectrumType = condition.Key.SpectrumType; TimeValue = time; Reset(condition, time); CreateKTables(condition.InverseGridSizes()); }
/// <summary> /// Initialize the enabled buffers with the current conditions spectrum for this time. /// </summary> protected override void Initilize(WaveSpectrumCondition condition, float time) { if (InitMaterial == null) { throw new InvalidOperationException("GPU buffer has not had its Init material set"); } if (InitPass == -1) { throw new InvalidOperationException("GPU buffer has not had its Init material pass set"); } InitMaterial.SetTexture("Ceto_Spectrum01", (condition.Spectrum01 != null) ? condition.Spectrum01 : Texture2D.blackTexture); InitMaterial.SetTexture("Ceto_Spectrum23", (condition.Spectrum23 != null) ? condition.Spectrum23 : Texture2D.blackTexture); InitMaterial.SetTexture("Ceto_WTable", condition.WTable); InitMaterial.SetVector("Ceto_InverseGridSizes", condition.InverseGridSizes()); InitMaterial.SetVector("Ceto_GridSizes", condition.GridSizes); InitMaterial.SetVector("Ceto_Offset", m_offset); InitMaterial.SetFloat("Ceto_Time", time); m_tmpList.Clear(); int count = m_buffers.Length; for (int i = 0; i < count; i++) { if (!m_buffers[i].disabled) { m_tmpList.Add(m_buffers[i].data[1]); } } count = m_tmpList.Count; if (count == 0) { return; } else if (count == 1) { Graphics.Blit(null, m_tmpList[0], InitMaterial, InitPass); } else { RTUtility.MultiTargetBlit(m_tmpList, InitMaterial, InitPass); } }
private void CacheCondition(WaveSpectrumCondition condition) { if (condition == null || this.m_conditionCache == null) { return; } if (this.m_conditionCache.ContainsKey(condition.Key)) { return; } this.m_conditionCache.AddFirst(condition.Key, condition); while (this.m_conditionCache.Count != 0 && this.m_conditionCache.Count > this.m_maxConditionCacheSize) { WaveSpectrumCondition waveSpectrumCondition = this.m_conditionCache.RemoveLast(); waveSpectrumCondition.Release(); } }
/// <summary> /// Creates the data for this conditions spectrum for this time value. /// </summary> public override void Run(WaveSpectrumCondition condition, float time) { TimeValue = time; HasRun = true; BeenSampled = false; if (m_samplingEnabled) { throw new InvalidOperationException("Can not run if sampling enabled"); } UpdateEnabledData(); CreateTextures(); //There are no buffers enabled return. int count = m_enabledData.Count; if (count == 0) { return; } //Initialize buffers. Initilize(condition, time); //Perform the FFT. Supports running the FFT on 1-4 buffers at one. if (count == 1) { m_index = m_fourier.PeformFFT(m_enabledData[0]); } else if (count == 2) { m_index = m_fourier.PeformFFT(m_enabledData[0], m_enabledData[1]); } else if (count == 3) { m_index = m_fourier.PeformFFT(m_enabledData[0], m_enabledData[1], m_enabledData[2]); } else if (count == 4) { m_index = m_fourier.PeformFFT(m_enabledData[0], m_enabledData[1], m_enabledData[2], m_enabledData[3]); } }
protected override void Initilize(WaveSpectrumCondition condition, float time) { InterpolatedArray2f[] writeDisplacements = this.GetWriteDisplacements(); writeDisplacements[0].Clear(); writeDisplacements[1].Clear(); writeDisplacements[2].Clear(); writeDisplacements[3].Clear(); if (this.m_initTask == null) { this.m_initTask = condition.GetInitSpectrumDisplacementsTask(this, time); } else if (this.m_initTask.SpectrumType != condition.Key.SpectrumType || this.m_initTask.NumGrids != condition.Key.NumGrids) { this.m_initTask = condition.GetInitSpectrumDisplacementsTask(this, time); } else { this.m_initTask.Reset(condition, time); } }
public SpectrumTask(WaveSpectrumCondition condition, bool multiThreadTask, ISpectrum[] spectrums) : base(multiThreadTask) { if (spectrums == null || spectrums.Length != 4) { throw new ArgumentException("Spectrums array must have a length of 4"); } this.m_spectrums = spectrums; this.Condition = condition; this.Size = condition.Key.Size; this.GridSizes = condition.GridSizes; this.WaveAmps = condition.WaveAmps; this.NumGrids = condition.Key.NumGrids; this.m_rnd = new System.Random(0); this.m_distibution = SPECTRUM_DISTRIBUTION.LINEAR; float num = 6.28318548f * (float)this.Size; this.InverseGridSizes = new Vector4(num / this.GridSizes.x, num / this.GridSizes.y, num / this.GridSizes.z, num / this.GridSizes.w); this.m_spectrum01 = new Color[this.Size * this.Size]; if (this.NumGrids > 2) { this.m_spectrum23 = new Color[this.Size * this.Size]; } this.m_wtable = new Color[this.Size * this.Size]; }
/// <summary> /// Run the buffer with the spectrum for these conditions at this time. /// </summary> public abstract void Run(WaveSpectrumCondition condition, float time);
/// <summary> /// Caches the condition and trims cache to max size. /// </summary> void CacheCondition(WaveSpectrumCondition condition) { if(condition == null || m_conditionCache == null) return; if(m_conditionCache.ContainsKey(condition.Key)) return; m_conditionCache.AddFirst(condition.Key, condition); //Trim cache to the max size. while (m_conditionCache.Count != 0 && m_conditionCache.Count > m_maxConditionCacheSize) { var tmp = m_conditionCache.RemoveLast(); tmp.Release(); } }
/// <summary> /// Creates the data for this conditions spectrum for this time value. /// </summary> public override void Run(WaveSpectrumCondition condition, float time) { //Can only run if all tasks have finished. if (!IsDone()) { throw new InvalidOperationException("Can not run when there are tasks that have not finished"); } TimeValue = time; HasRun = true; BeenSampled = false; //If no buffers are enabled nothing to do. if (EnabledBuffers() == 0) { return; } //Create the Initialization task. //This is created by the superclass //to the m_initTask object. Initilize(condition, time); //Must run init task first if mutithreading disabled if (Ocean.DISABLE_FOURIER_MULTITHREADING) { //Multithreading disabled, run now on this thread. m_initTask.Start(); m_initTask.Run(); m_initTask.End(); } int numBuffers = m_buffers.Length; //float t = Time.realtimeSinceStartup; //for each buffer run a fourier task. for (int i = 0; i < numBuffers; i++) { if (m_buffers[i].disabled) { continue; } if (m_fourierTasks[i] == null) { m_fourierTasks[i] = new FourierTask(this, m_fourier, i, m_initTask.NumGrids); } else { m_fourierTasks[i].Reset(i, m_initTask.NumGrids); } FourierTask task = m_fourierTasks[i]; if (task.Done) { throw new InvalidOperationException("Fourier task should not be done before running"); } if (Ocean.DISABLE_FOURIER_MULTITHREADING) { //Multithreading disabled, run now on this thread. task.Start(); task.Run(); task.End(); } else { //Multithreading enabled, run now on another thread. //If init task has not finished yet the //fourier task must wait on it to finish. task.RunOnStopWaiting = true; task.WaitOn(m_initTask); m_scheduler.AddWaiting(task); } } //Debug.Log("Run Fourier time = " + (Time.realtimeSinceStartup - t) * 1000.0f + " tasks = " + m_fourierTasks.Count); //Must run init task last if mutithreading not disabled if (!Ocean.DISABLE_FOURIER_MULTITHREADING) { //Must run init task after tasks the are waiting //have been added. Otherwise init task may finish //before there other tasks have been added and a //exception will be thrown. m_initTask.NoFinish = true; m_scheduler.Run(m_initTask); } }
/// <summary> /// Initialized the buffer with the spectrum for these conditions at this time. /// </summary> protected abstract void Initilize(WaveSpectrumCondition condition, float time);
protected abstract void Initilize(WaveSpectrumCondition condition, float time);
public void Reset(WaveSpectrumCondition condition, float time) { if (condition.Key.SpectrumType != SpectrumType) throw new InvalidOperationException("Trying to reset a Unified InitSpectrum task with wrong condition type = " + condition.Key.SpectrumType); if (condition.Key.Size != Size) throw new InvalidOperationException("Trying to reset a Unified InitSpectrum task with wrong condition size = " + condition.Key.Size); base.Reset(); int S2 = Size * Size; if (m_spectrum01 == null) m_spectrum01 = new Color[S2]; if (m_spectrum23 == null && NumGrids > 2) m_spectrum23 = new Color[S2]; if (m_wtable == null) m_wtable = new Color[S2]; TimeValue = time; Data0 = Buffer.GetReadBuffer(0); Data1 = Buffer.GetReadBuffer(1); Data2 = Buffer.GetReadBuffer(2); var buffer0 = Buffer.GetBuffer(0); var buffer1 = Buffer.GetBuffer(1); var buffer2 = Buffer.GetBuffer(2); if (buffer0 != null) { if(NumGrids > 2) buffer0.doublePacked = true; else buffer0.doublePacked = false; } if (buffer1 != null) { if (NumGrids > 1) buffer1.doublePacked = true; else buffer1.doublePacked = false; } if (buffer2 != null) { if(NumGrids > 3) buffer2.doublePacked = true; else buffer2.doublePacked = false; } if (LastUpdated != condition.LastUpdated) { LastUpdated = condition.LastUpdated; if(m_spectrum01 != null && condition.SpectrumData01 != null) System.Array.Copy(condition.SpectrumData01, m_spectrum01, S2); if (m_spectrum23 != null && condition.SpectrumData23 != null) System.Array.Copy(condition.SpectrumData23, m_spectrum23, S2); if (m_wtable != null && condition.WTableData != null) System.Array.Copy(condition.WTableData, m_wtable, S2); } }
/// <summary> /// Initialize the enabled buffers with the current conditions spectrum for this time. /// </summary> protected override void Initilize(WaveSpectrumCondition condition, float time) { if (InitMaterial == null) throw new InvalidOperationException("GPU buffer has not had its Init material set"); if (InitPass == -1) throw new InvalidOperationException("GPU buffer has not had its Init material pass set"); InitMaterial.SetTexture("Ceto_Spectrum01", (condition.Spectrum01 != null) ? condition.Spectrum01 : Texture2D.blackTexture ); InitMaterial.SetTexture("Ceto_Spectrum23", (condition.Spectrum23 != null) ? condition.Spectrum23 : Texture2D.blackTexture ); InitMaterial.SetTexture("Ceto_WTable", condition.WTable); InitMaterial.SetVector("Ceto_InverseGridSizes", condition.InverseGridSizes()); InitMaterial.SetVector("Ceto_GridSizes", condition.GridSizes); InitMaterial.SetVector("Ceto_Offset", m_offset); InitMaterial.SetFloat("Ceto_Time", time); m_tmpList.Clear(); int count = m_buffers.Length; for (int i = 0; i < count; i++) { if(!m_buffers[i].disabled) m_tmpList.Add(m_buffers[i].data[1]); } count = m_tmpList.Count; if (count == 0) { return; } else if(count == 1) { Graphics.Blit(null, m_tmpList[0], InitMaterial, InitPass); } else { RTUtility.MultiTargetBlit(m_tmpList, InitMaterial, InitPass); } }
/// <summary> /// Creates the data for this conditions spectrum for this time value. /// </summary> public override void Run(WaveSpectrumCondition condition, float time) { TimeValue = time; HasRun = true; BeenSampled = false; if(m_samplingEnabled) throw new InvalidOperationException("Can not run if sampling enabled"); UpdateEnabledData(); CreateTextures(); //There are no buffers enabled return. int count = m_enabledData.Count; if(count == 0) return; //Initialize buffers. Initilize(condition, time); //Perform the FFT. Supports running the FFT on 1-4 buffers at one. if(count == 1) { m_index = m_fourier.PeformFFT(m_enabledData[0]); } else if(count == 2) { m_index = m_fourier.PeformFFT(m_enabledData[0], m_enabledData[1]); } else if(count == 3) { m_index = m_fourier.PeformFFT(m_enabledData[0], m_enabledData[1], m_enabledData[2]); } else if(count == 4) { m_index = m_fourier.PeformFFT(m_enabledData[0], m_enabledData[1], m_enabledData[2], m_enabledData[3]); } }
public void Reset(WaveSpectrumCondition condition, float time) { if (condition.Key.SpectrumType != this.SpectrumType) { throw new InvalidOperationException("Trying to reset a Unified InitSpectrum task with wrong condition type = " + condition.Key.SpectrumType); } if (condition.Key.Size != this.Size) { throw new InvalidOperationException("Trying to reset a Unified InitSpectrum task with wrong condition size = " + condition.Key.Size); } base.Reset(); int num = this.Size * this.Size; if (this.m_spectrum01 == null) { this.m_spectrum01 = new Color[num]; } if (this.m_spectrum23 == null && this.NumGrids > 2) { this.m_spectrum23 = new Color[num]; } if (this.m_wtable == null) { this.m_wtable = new Color[num]; } this.TimeValue = time; this.Data0 = this.Buffer.GetReadBuffer(0); this.Data1 = this.Buffer.GetReadBuffer(1); this.Data2 = this.Buffer.GetReadBuffer(2); WaveSpectrumBufferCPU.Buffer buffer = this.Buffer.GetBuffer(0); WaveSpectrumBufferCPU.Buffer buffer2 = this.Buffer.GetBuffer(1); WaveSpectrumBufferCPU.Buffer buffer3 = this.Buffer.GetBuffer(2); if (buffer != null) { if (this.NumGrids > 2) { buffer.doublePacked = true; } else { buffer.doublePacked = false; } } if (buffer2 != null) { if (this.NumGrids > 1) { buffer2.doublePacked = true; } else { buffer2.doublePacked = false; } } if (buffer3 != null) { if (this.NumGrids > 3) { buffer3.doublePacked = true; } else { buffer3.doublePacked = false; } } if (this.LastUpdated != condition.LastUpdated) { this.LastUpdated = condition.LastUpdated; if (this.m_spectrum01 != null && condition.SpectrumData01 != null) { Array.Copy(condition.SpectrumData01, this.m_spectrum01, num); } if (this.m_spectrum23 != null && condition.SpectrumData23 != null) { Array.Copy(condition.SpectrumData23, this.m_spectrum23, num); } if (this.m_wtable != null && condition.WTableData != null) { Array.Copy(condition.WTableData, this.m_wtable, num); } } }
public void Reset(WaveSpectrumCondition condition, float time) { if (condition.Key.SpectrumType != SpectrumType) { throw new InvalidOperationException("Trying to reset a Unified InitSpectrum task with wrong condition type = " + condition.Key.SpectrumType); } if (condition.Key.Size != Size) { throw new InvalidOperationException("Trying to reset a Unified InitSpectrum task with wrong condition size = " + condition.Key.Size); } base.Reset(); int S2 = Size * Size; if (m_spectrum01 == null) { m_spectrum01 = new Color[S2]; } if (m_spectrum23 == null && NumGrids > 2) { m_spectrum23 = new Color[S2]; } if (m_wtable == null) { m_wtable = new Color[S2]; } TimeValue = time; Data0 = Buffer.GetReadBuffer(0); Data1 = Buffer.GetReadBuffer(1); Data2 = Buffer.GetReadBuffer(2); var buffer0 = Buffer.GetBuffer(0); var buffer1 = Buffer.GetBuffer(1); var buffer2 = Buffer.GetBuffer(2); if (buffer0 != null) { if (NumGrids > 2) { buffer0.doublePacked = true; } else { buffer0.doublePacked = false; } } if (buffer1 != null) { if (NumGrids > 1) { buffer1.doublePacked = true; } else { buffer1.doublePacked = false; } } if (buffer2 != null) { if (NumGrids > 3) { buffer2.doublePacked = true; } else { buffer2.doublePacked = false; } } if (LastUpdated != condition.LastUpdated) { LastUpdated = condition.LastUpdated; if (m_spectrum01 != null && condition.SpectrumData01 != null) { System.Array.Copy(condition.SpectrumData01, m_spectrum01, S2); } if (m_spectrum23 != null && condition.SpectrumData23 != null) { System.Array.Copy(condition.SpectrumData23, m_spectrum23, S2); } if (m_wtable != null && condition.WTableData != null) { System.Array.Copy(condition.WTableData, m_wtable, S2); } } }
protected override void Initilize(WaveSpectrumCondition condition, float time) { InterpolatedArray2f[] displacements = GetWriteDisplacements(); displacements[0].Clear(); displacements[1].Clear(); displacements[2].Clear(); displacements[3].Clear(); if (m_initTask == null) { m_initTask = condition.GetInitSpectrumDisplacementsTask(this, time); } else if(m_initTask.SpectrumType != condition.Key.SpectrumType || m_initTask.NumGrids != condition.Key.NumGrids) { m_initTask = condition.GetInitSpectrumDisplacementsTask(this, time); } else { m_initTask.Reset(condition, time); } }
public override void Run(WaveSpectrumCondition condition, float time) { SwapDisplacements(); base.Run(condition, time); }
public abstract void Run(WaveSpectrumCondition condition, float time);