using System;
using Cpp2IlInjected;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
	// Token: 0x020005BE RID: 1470
	[Token(Token = "0x20005BE")]
	[ExecuteInEditMode]
	[RequireComponent(typeof(Camera))]
	[AddComponentMenu("Image Effects/Noise/Noise and Scratches")]
	public class NoiseAndScratches : MonoBehaviour
	{
		// Token: 0x06002F24 RID: 12068 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F24")]
		[Address(RVA = "0xED2E00", Offset = "0xED1C00", VA = "0x180ED2E00")]
		protected void Start()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x17000387 RID: 903
		// (get) Token: 0x06002F25 RID: 12069 RVA: 0x00064970 File Offset: 0x00062B70
		[Token(Token = "0x17000387")]
		protected Material material
		{
			[Token(Token = "0x6002F25")]
			[Address(RVA = "0xED2F80", Offset = "0xED1D80", VA = "0x180ED2F80")]
			get
			{
				Material materialRGB = this.m_MaterialRGB;
				int num = 0;
				if (materialRGB == num)
				{
					Material material = new Material(this.shaderRGB);
					this.m_MaterialRGB = material;
					this.m_MaterialRGB.hideFlags = HideFlags.HideAndDontSave;
				}
				Material materialYUV = this.m_MaterialYUV;
				int num2 = 0;
				if (materialYUV == num2)
				{
					if (this.rgbFallback)
					{
						goto IL_85;
					}
					Material material2 = new Material(this.shaderYUV);
					this.m_MaterialYUV = material2;
					this.m_MaterialYUV.hideFlags = HideFlags.HideAndDontSave;
				}
				if (this.rgbFallback || !this.monochrome)
				{
				}
				IL_85:
				return this.m_MaterialRGB;
			}
		}

		// Token: 0x06002F26 RID: 12070 RVA: 0x00064A10 File Offset: 0x00062C10
		[Token(Token = "0x6002F26")]
		[Address(RVA = "0xED2600", Offset = "0xED1400", VA = "0x180ED2600")]
		protected void OnDisable()
		{
			if (this.m_MaterialRGB)
			{
				UnityEngine.Object.DestroyImmediate(this.m_MaterialRGB);
			}
			if (this.m_MaterialYUV)
			{
				UnityEngine.Object.DestroyImmediate(this.m_MaterialYUV);
			}
		}

		// Token: 0x06002F27 RID: 12071 RVA: 0x00064A50 File Offset: 0x00062C50
		[Token(Token = "0x6002F27")]
		[Address(RVA = "0xED2D20", Offset = "0xED1B20", VA = "0x180ED2D20")]
		private void SanitizeParameters()
		{
			float num = this.grainIntensityMin;
			int num2 = 0;
			float num3 = Mathf.Clamp(num, (float)num2, 5f);
			this.grainIntensityMin = num3;
			float num4 = this.grainIntensityMax;
			int num5 = 0;
			float num6 = Mathf.Clamp(num4, (float)num5, 5f);
			this.grainIntensityMax = num6;
			float num7 = this.scratchIntensityMin;
			int num8 = 0;
			float num9 = Mathf.Clamp(num7, (float)num8, 5f);
			this.scratchIntensityMin = num9;
			float num10 = this.scratchIntensityMax;
			int num11 = 0;
			float num12 = Mathf.Clamp(num10, (float)num11, 5f);
			this.scratchIntensityMax = num12;
			float num13 = Mathf.Clamp(this.scratchFPS, 1f, 30f);
			this.scratchFPS = num13;
			float num14 = this.scratchJitter;
			int num15 = 0;
			float num16 = Mathf.Clamp(num14, (float)num15, 1f);
			this.scratchJitter = num16;
			float num17 = Mathf.Clamp(this.grainSize, 0.1f, 50f);
			this.grainSize = num17;
		}

		// Token: 0x06002F28 RID: 12072 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F28")]
		[Address(RVA = "0xED26F0", Offset = "0xED14F0", VA = "0x180ED26F0")]
		private void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F29 RID: 12073 RVA: 0x00064B44 File Offset: 0x00062D44
		[Token(Token = "0x6002F29")]
		[Address(RVA = "0xED2F40", Offset = "0xED1D40", VA = "0x180ED2F40")]
		public NoiseAndScratches()
		{
		}

		// Token: 0x0400390B RID: 14603
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x400390B")]
		public bool monochrome = true;

		// Token: 0x0400390C RID: 14604
		[FieldOffset(Offset = "0x19")]
		[Token(Token = "0x400390C")]
		private bool rgbFallback;

		// Token: 0x0400390D RID: 14605
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x400390D")]
		[Range(0f, 5f)]
		public float grainIntensityMin = 0.1f;

		// Token: 0x0400390E RID: 14606
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x400390E")]
		[Range(0f, 5f)]
		public float grainIntensityMax = 0.2f;

		// Token: 0x0400390F RID: 14607
		[FieldOffset(Offset = "0x24")]
		[Token(Token = "0x400390F")]
		[Range(0.1f, 50f)]
		public float grainSize = 2f;

		// Token: 0x04003910 RID: 14608
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003910")]
		[Range(0f, 5f)]
		public float scratchIntensityMin = 0.05f;

		// Token: 0x04003911 RID: 14609
		[FieldOffset(Offset = "0x2C")]
		[Token(Token = "0x4003911")]
		[Range(0f, 5f)]
		public float scratchIntensityMax = 0.25f;

		// Token: 0x04003912 RID: 14610
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4003912")]
		[Range(1f, 30f)]
		public float scratchFPS = 10f;

		// Token: 0x04003913 RID: 14611
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x4003913")]
		[Range(0f, 1f)]
		public float scratchJitter = 0.01f;

		// Token: 0x04003914 RID: 14612
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4003914")]
		public Texture grainTexture;

		// Token: 0x04003915 RID: 14613
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4003915")]
		public Texture scratchTexture;

		// Token: 0x04003916 RID: 14614
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4003916")]
		public Shader shaderRGB;

		// Token: 0x04003917 RID: 14615
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4003917")]
		public Shader shaderYUV;

		// Token: 0x04003918 RID: 14616
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4003918")]
		private Material m_MaterialRGB;

		// Token: 0x04003919 RID: 14617
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4003919")]
		private Material m_MaterialYUV;

		// Token: 0x0400391A RID: 14618
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x400391A")]
		private float scratchTimeLeft;

		// Token: 0x0400391B RID: 14619
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x400391B")]
		private float scratchX;

		// Token: 0x0400391C RID: 14620
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x400391C")]
		private float scratchY;
	}
}
