public static WaveShaderProgram GetInstance(WaveType type = WaveType.Sinusoidal, bool isClamped = false) { var key = GetInstanceKey(type, isClamped); return(instances.TryGetValue(key, out var shaderProgram) ? shaderProgram : (instances[key] = new WaveShaderProgram(type, isClamped))); }
public void Apply(int pass) { shaderParams.Set(phaseKey, Phase * Mathf.TwoPi); shaderParams.Set(frequencyKey, Frequency); shaderParams.Set(pivotKey, Pivot); shaderParams.Set(amplitudeKey, Amplitude); shaderParams.Set(uv0Key, UV0); shaderParams.Set(uv1Key, UV1); PlatformRenderer.SetBlendState(Blending.GetBlendState()); PlatformRenderer.SetShaderProgram(WaveShaderProgram.GetInstance(Type, IsClamped)); PlatformRenderer.SetShaderParams(shaderParamsArray); }