Пример #1
0
        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;
            }
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
 public WaterWavesSpectrumData(Water water, WaterWavesSpectrum spectrum)
 {
     this.water     = water;
     this.windWaves = water.GetComponent <WindWaves>();
     this.spectrum  = spectrum;
 }
Пример #4
0
 public void CacheSpectrum(WaterWavesSpectrum spectrum)
 {
     GetSpectrumData(spectrum);
 }