using System; using UnityEngine; namespace UnityStandardAssets.ImageEffects { // Token: 0x02000063 RID: 99 [ExecuteInEditMode] [RequireComponent(typeof(Camera))] [AddComponentMenu("Image Effects/Color Adjustments/Contrast Enhance (Unsharp Mask)")] public class ContrastEnhance : PostEffectsBase { // Token: 0x06000109 RID: 265 RVA: 0x0000B75C File Offset: 0x00009B5C public override bool CheckResources() { base.CheckSupport(false); this.contrastCompositeMaterial = base.CheckShaderAndCreateMaterial(this.contrastCompositeShader, this.contrastCompositeMaterial); this.separableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.separableBlurMaterial); if (!this.isSupported) { base.ReportAutoDisable(); } return this.isSupported; } // Token: 0x0600010A RID: 266 RVA: 0x0000B7B8 File Offset: 0x00009BB8 private void OnRenderImage(RenderTexture source, RenderTexture destination) { if (!this.CheckResources()) { Graphics.Blit(source, destination); return; } int width = source.width; int height = source.height; RenderTexture temporary = RenderTexture.GetTemporary(width / 2, height / 2, 0); Graphics.Blit(source, temporary); RenderTexture renderTexture = RenderTexture.GetTemporary(width / 4, height / 4, 0); Graphics.Blit(temporary, renderTexture); RenderTexture.ReleaseTemporary(temporary); this.separableBlurMaterial.SetVector("offsets", new Vector4(0f, this.blurSpread * 1f / (float)renderTexture.height, 0f, 0f)); RenderTexture temporary2 = RenderTexture.GetTemporary(width / 4, height / 4, 0); Graphics.Blit(renderTexture, temporary2, this.separableBlurMaterial); RenderTexture.ReleaseTemporary(renderTexture); this.separableBlurMaterial.SetVector("offsets", new Vector4(this.blurSpread * 1f / (float)renderTexture.width, 0f, 0f, 0f)); renderTexture = RenderTexture.GetTemporary(width / 4, height / 4, 0); Graphics.Blit(temporary2, renderTexture, this.separableBlurMaterial); RenderTexture.ReleaseTemporary(temporary2); this.contrastCompositeMaterial.SetTexture("_MainTexBlurred", renderTexture); this.contrastCompositeMaterial.SetFloat("intensity", this.intensity); this.contrastCompositeMaterial.SetFloat("threshold", this.threshold); Graphics.Blit(source, destination, this.contrastCompositeMaterial); RenderTexture.ReleaseTemporary(renderTexture); } // Token: 0x04000239 RID: 569 [Range(0f, 1f)] public float intensity = 0.5f; // Token: 0x0400023A RID: 570 [Range(0f, 0.999f)] public float threshold; // Token: 0x0400023B RID: 571 private Material separableBlurMaterial; // Token: 0x0400023C RID: 572 private Material contrastCompositeMaterial; // Token: 0x0400023D RID: 573 [Range(0f, 1f)] public float blurSpread = 1f; // Token: 0x0400023E RID: 574 public Shader separableBlurShader; // Token: 0x0400023F RID: 575 public Shader contrastCompositeShader; } }