private void CreateSpectrum() { switch (spectrumType) { case WaterSpectrumType.Unified: { spectrum = new UnifiedSpectrum(tileSize, -gravity, windSpeed, wavesAmplitude, fetch); break; } case WaterSpectrumType.Phillips: { spectrum = new PhillipsSpectrum(tileSize, -gravity, windSpeed, wavesAmplitude, phillipsCutoffFactor); break; } } }
public WaterWavesSpectrumData GetSpectrumData(WaterWavesSpectrum spectrum) { WaterWavesSpectrumData spectrumData; if (!spectraDataCache.TryGetValue(spectrum, out spectrumData)) { lock (spectraDataCache) { spectraDataCache[spectrum] = spectrumData = new WaterWavesSpectrumData(water, spectrum); } spectrumData.ValidateSpectrumData(); cpuWavesDirty = true; lock (spectraDataList) { spectraDataList.Add(spectrumData); } } return(spectrumData); }
public WaterWavesSpectrumData(Water water, WaterWavesSpectrum spectrum) { this.water = water; this.windWaves = water.GetComponent <WindWaves>(); this.spectrum = spectrum; }
public void CacheSpectrum(WaterWavesSpectrum spectrum) { GetSpectrumData(spectrum); }