public void Apply(int pass) { shaderParams.Set(brightThresholdKey, BrightThreshold); shaderParams.Set(darkThresholdKey, DarkThreshold); shaderParams.Set(softLightKey, SoftLight); PlatformRenderer.SetBlendState(!Opaque ? Blending.Alpha.GetBlendState() : disabledBlendingState); PlatformRenderer.SetShaderProgram(NoiseShaderProgram.GetInstance(Opaque)); PlatformRenderer.SetShaderParams(shaderParamsArray); }
public static NoiseShaderProgram GetInstance(bool opaque = false) { var key = GetInstanceKey(false); return(instances.TryGetValue(key, out var shaderProgram) ? shaderProgram : (instances[key] = new NoiseShaderProgram(opaque))); }