public void OnCopyModeChanged() { if (windWaves != null && windWaves.CopyFrom != null) { FreeResources(); windWaves.CopyFrom.DynamicSmoothness.ValidateVarianceTextures(windWaves.CopyFrom); windWaves.GetComponent <Water>().WaterMaterial.SetTexture("_SlopeVariance", windWaves.CopyFrom.DynamicSmoothness.varianceTexture); } }
public SpectrumResolver(WindWaves windWaves, Shader spectrumShader) : base(windWaves, 4) { this.water = windWaves.GetComponent <Water>(); this.windWaves = windWaves; renderTimeId = Shader.PropertyToID("_RenderTime"); animationMaterial = new Material(spectrumShader); animationMaterial.hideFlags = HideFlags.DontSave; animationMaterial.SetFloat(renderTimeId, Time.time); }
public SpectrumResolverCPU(WindWaves windWaves, int numScales) { this.water = windWaves.GetComponent <Water>(); this.windWaves = windWaves; this.spectraDataCache = new Dictionary <WaterWavesSpectrum, WaterWavesSpectrumData>(); this.spectraDataList = new List <WaterWavesSpectrumData>(); this.filteredCpuWaves = new WaterWave[0]; this.numTiles = numScales; this.cachedSeed = windWaves.GetComponent <Water>().Seed; if (fftComputationCosts == null) { PrecomputeFFTCosts(); } CreateSpectraLevels(); }
internal void Enable(WindWaves windWaves) { if (enabled) { return; } enabled = true; this.water = windWaves.GetComponent <Water>(); this.windWaves = windWaves; if (Application.isPlaying) { water.ProfilesChanged.AddListener(OnProfilesChanged); FindBestWaves(); } }
private void ValidateVarianceTextures(WindWaves windWaves) { if (varianceTexture == null) { varianceTexture = CreateVarianceTexture(RenderTextureFormat.RGHalf); } if (!varianceTexture.IsCreated()) { varianceTexture.Create(); var water = windWaves.GetComponent <Water>(); water.WaterMaterial.SetTexture("_SlopeVariance", varianceTexture); varianceShader.SetTexture(0, "_Variance", varianceTexture); lastResetIndex = 0; currentIndex = 0; } }
internal void Enable(WindWaves windWaves) { if (enabled) { return; } if (dx11FFT != null) { defaultDx11Fft = dx11FFT; } else { dx11FFT = defaultDx11Fft; } enabled = true; this.water = windWaves.GetComponent <Water>(); this.windWaves = windWaves; OnCopyModeChanged(); if (Application.isPlaying) { if (lastCopyFrom == null) { ValidateResources(); } windWaves.ResolutionChanged.AddListener(OnResolutionChanged); } OnValidate(windWaves); water.InvalidateMaterialKeywords(); fftUtilitiesMaterial = new Material(fftUtilitiesShader); fftUtilitiesMaterial.hideFlags = HideFlags.DontSave; }
public WaterTileSpectrum(WindWaves windWaves, int index) { this.windWaves = windWaves; this.water = windWaves.GetComponent <Water>(); this.tileIndex = index; }