Ejemplo n.º 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;
            }
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public WaterWavesSpectrumData(Water water, WaterWavesSpectrum spectrum)
 {
     this.water     = water;
     this.windWaves = water.GetComponent <WindWaves>();
     this.spectrum  = spectrum;
 }
Ejemplo n.º 4
0
 public void CacheSpectrum(WaterWavesSpectrum spectrum)
 {
     GetSpectrumData(spectrum);
 }