using System;
using Cpp2IlInjected;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
	// Token: 0x02000616 RID: 1558
	[Token(Token = "0x2000616")]
	[ExecuteInEditMode]
	[RequireComponent(typeof(Camera))]
	[AddComponentMenu("Image Effects/Noise/Noise and Scratches")]
	public class NoiseAndScratches : MonoBehaviour
	{
		// Token: 0x060031ED RID: 12781 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60031ED")]
		[Address(RVA = "0xF1EEA0", Offset = "0xF1DEA0", VA = "0x180F1EEA0")]
		protected void Start()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x170003AC RID: 940
		// (get) Token: 0x060031EE RID: 12782 RVA: 0x0006BC2C File Offset: 0x00069E2C
		[Token(Token = "0x170003AC")]
		protected Material material
		{
			[Token(Token = "0x60031EE")]
			[Address(RVA = "0xF1F020", Offset = "0xF1E020", VA = "0x180F1F020")]
			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: 0x060031EF RID: 12783 RVA: 0x0006BCCC File Offset: 0x00069ECC
		[Token(Token = "0x60031EF")]
		[Address(RVA = "0xF1E6A0", Offset = "0xF1D6A0", VA = "0x180F1E6A0")]
		protected void OnDisable()
		{
			if (this.m_MaterialRGB)
			{
				UnityEngine.Object.DestroyImmediate(this.m_MaterialRGB);
			}
			if (this.m_MaterialYUV)
			{
				UnityEngine.Object.DestroyImmediate(this.m_MaterialYUV);
			}
		}

		// Token: 0x060031F0 RID: 12784 RVA: 0x0006BD0C File Offset: 0x00069F0C
		[Token(Token = "0x60031F0")]
		[Address(RVA = "0xF1EDC0", Offset = "0xF1DDC0", VA = "0x180F1EDC0")]
		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: 0x060031F1 RID: 12785 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60031F1")]
		[Address(RVA = "0xF1E790", Offset = "0xF1D790", VA = "0x180F1E790")]
		private void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060031F2 RID: 12786 RVA: 0x0006BE00 File Offset: 0x0006A000
		[Token(Token = "0x60031F2")]
		[Address(RVA = "0xF1EFE0", Offset = "0xF1DFE0", VA = "0x180F1EFE0")]
		public NoiseAndScratches()
		{
		}

		// Token: 0x04003BF5 RID: 15349
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003BF5")]
		public bool monochrome = true;

		// Token: 0x04003BF6 RID: 15350
		[FieldOffset(Offset = "0x19")]
		[Token(Token = "0x4003BF6")]
		private bool rgbFallback;

		// Token: 0x04003BF7 RID: 15351
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x4003BF7")]
		[Range(0f, 5f)]
		public float grainIntensityMin = 0.1f;

		// Token: 0x04003BF8 RID: 15352
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003BF8")]
		[Range(0f, 5f)]
		public float grainIntensityMax = 0.2f;

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

		// Token: 0x04003BFA RID: 15354
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003BFA")]
		[Range(0f, 5f)]
		public float scratchIntensityMin = 0.05f;

		// Token: 0x04003BFB RID: 15355
		[FieldOffset(Offset = "0x2C")]
		[Token(Token = "0x4003BFB")]
		[Range(0f, 5f)]
		public float scratchIntensityMax = 0.25f;

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

		// Token: 0x04003BFD RID: 15357
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x4003BFD")]
		[Range(0f, 1f)]
		public float scratchJitter = 0.01f;

		// Token: 0x04003BFE RID: 15358
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4003BFE")]
		public Texture grainTexture;

		// Token: 0x04003BFF RID: 15359
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4003BFF")]
		public Texture scratchTexture;

		// Token: 0x04003C00 RID: 15360
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4003C00")]
		public Shader shaderRGB;

		// Token: 0x04003C01 RID: 15361
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4003C01")]
		public Shader shaderYUV;

		// Token: 0x04003C02 RID: 15362
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4003C02")]
		private Material m_MaterialRGB;

		// Token: 0x04003C03 RID: 15363
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4003C03")]
		private Material m_MaterialYUV;

		// Token: 0x04003C04 RID: 15364
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x4003C04")]
		private float scratchTimeLeft;

		// Token: 0x04003C05 RID: 15365
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x4003C05")]
		private float scratchX;

		// Token: 0x04003C06 RID: 15366
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x4003C06")]
		private float scratchY;
	}
}
