예제 #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);
 }