public void Apply(int pass) { shaderParams.Set(amountKey, new Vector4(ChromaticAberration * Red, ChromaticAberration * Green, ChromaticAberration * Blue, BarrelPincushion)); PlatformRenderer.SetBlendState(!Opaque ? Blending.GetBlendState() : disabledBlendingState); PlatformRenderer.SetShaderProgram(DistortionShaderProgram.GetInstance(Opaque)); PlatformRenderer.SetShaderParams(shaderParamsArray); }
public static DistortionShaderProgram GetInstance(bool opaque = false) { var key = GetInstanceKey(false); return(instances.TryGetValue(key, out var shaderProgram) ? shaderProgram : (instances[key] = new DistortionShaderProgram(opaque))); }