using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using cakeslice;
using Colorful;
using Kino;
using LOS;
using PI.NGSS;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
using UnityStandardAssets.CinematicEffects;
using UnityStandardAssets.ImageEffects;

// Token: 0x02000003 RID: 3
public class CameraEffects : MonoBehaviour
{
	// Token: 0x06000002 RID: 2 RVA: 0x00002101 File Offset: 0x00000301
	private void Awake()
	{
		this.cam = base.gameObject.GetComponent<Camera>();
		this.cam.enabled = true;
	}

	// Token: 0x06000003 RID: 3 RVA: 0x00002120 File Offset: 0x00000320
	private void Start()
	{
		this.cam = base.gameObject.GetComponent<Camera>();
		this.cam.depthTextureMode = DepthTextureMode.Depth;
		this.RemoveBuffer();
		this.ReleaseTextures();
		if (Links.x)
		{
			this.partyCharacters = Links.x.party;
			this.quads = Links.x.quads;
		}
		this.SetFog();
		this.pocketAlpha = 0f;
		Shader.SetGlobalFloat("_PocketAlpha", 0f);
		if (Application.isPlaying)
		{
			if (this.normalsCam)
			{
				this.normalsCam.allowMSAA = false;
			}
			if (this.normalsCharacterCam)
			{
				this.normalsCharacterCam.allowMSAA = false;
			}
			Shader.SetGlobalFloat("gamePlaying", 1f);
		}
		else
		{
			Shader.SetGlobalFloat("gamePlaying", 0f);
		}
		Shader.SetGlobalFloat("crawlScene", 0f);
		Shader.SetGlobalVector("_CinematicRevealPosition", new Vector3(-100000f, -100000f, -100000f));
		Shader.SetGlobalFloat("_CinematicGhostFow", 0f);
		Shader.SetGlobalFloat("_CinematicGhostFade", 0f);
		if (Links.x && Links.x.domeRenderer)
		{
			this.ChangeDomeState(false);
		}
		if (!this.moonlightMaterial)
		{
			this.moonlightMaterial = new Material(Shader.Find("Hidden/Moonlights"));
		}
		if (!this.depthOfFieldTarget)
		{
			foreach (object obj in base.transform)
			{
				Transform transform = (Transform)obj;
				if (transform.gameObject.name == "Depth of Field Target")
				{
					this.depthOfFieldTarget = transform;
				}
			}
			if (!this.depthOfFieldTarget)
			{
				GameObject gameObject = new GameObject("Depth of Field Target");
				this.depthOfFieldTarget = gameObject.transform;
				this.depthOfFieldTarget.SetParent(base.transform);
			}
		}
		this.renderDodge = true;
		this.interiorKeyword = GlobalKeyword.Create("INDOORS");
		this.exteriorKeyword = GlobalKeyword.Create("EXTERIOR");
		this.UpdateShaderVariables();
		this.bcg.enabled = Records.x.filming;
	}

	// Token: 0x06000004 RID: 4 RVA: 0x0000237C File Offset: 0x0000057C
	private void OnApplicationQuit()
	{
		this.moonlights.Clear();
		this.moonlights.Add(this.sunlight);
	}

	// Token: 0x06000005 RID: 5 RVA: 0x0000239C File Offset: 0x0000059C
	private void OnEnable()
	{
		this.RemoveBuffer();
		this.ReleaseTextures();
		this.SetFog();
		this.moonlights.Clear();
		this.moonlights.Add(this.sunlight);
		this.SceneSwitch();
		this.cam.depthTextureMode = DepthTextureMode.Depth;
	}

	// Token: 0x06000006 RID: 6 RVA: 0x000023E9 File Offset: 0x000005E9
	public void SetDepthOfFieldTarget(Transform newTarget)
	{
		this.depthOfFieldFollow = newTarget;
	}

	// Token: 0x06000007 RID: 7 RVA: 0x000023F2 File Offset: 0x000005F2
	private void OnDisable()
	{
		this.RemoveBuffer();
		this.ReleaseTextures();
		this.SetFog();
	}

	// Token: 0x06000008 RID: 8 RVA: 0x00002408 File Offset: 0x00000608
	public void SceneSwitch()
	{
		if (Links.x && Links.x.diorama && !Records.x.editor)
		{
			Debug.Log("Switching to scene: " + Links.x.diorama.sceneDisplayName);
		}
		this.CreateTexture(false);
		this.GetShadowMaterials();
		this.CreateNormalsCamera(false);
		if (false)
		{
			this.shadowEnvironment.enabled = true;
		}
		this.updateTimeOfDay = true;
	}

	// Token: 0x06000009 RID: 9 RVA: 0x00002488 File Offset: 0x00000688
	public void UpdateShaderVariables()
	{
		Shader.SetGlobalFloat("minimap", 0f);
		Shader.SetGlobalFloat("captures", 0f);
		Shader.SetGlobalTexture("_BlotchTex", this.blotches);
		Shader.SetGlobalTexture("_BlotchTexIntense", this.blotchesIntense);
		Shader.SetGlobalTexture("_DetailTex", this.detail);
		Shader.SetGlobalTexture("_PaperTex", this.paper);
		Shader.SetGlobalTexture("_RampTex", this.ramp);
		Shader.SetGlobalTexture("_RampTexCircle", this.rampCircle);
		Shader.SetGlobalTexture("_RampCircleStamina", this.rampCircleStamina);
		Shader.SetGlobalTexture("_RampCircleSwarm", this.rampCircleSwarm);
		Shader.SetGlobalColor("_Color", this.color);
		Shader.SetGlobalColor("_Color2", this.color2);
		Shader.SetGlobalColor("_InkCol", this.inkColor);
		Shader.SetGlobalFloat("_TintScale", this.tintScale);
		Shader.SetGlobalFloat("_PaperStrength", this.paperStrength);
		Shader.SetGlobalFloat("_BlotchMulti", this.blotchMultiply);
		Shader.SetGlobalFloat("_BlotchSub", this.blotchSubtract);
		Shader.SetGlobalTexture("_GhostNoise", this.ghostNoise);
		Shader.SetGlobalTexture("_GhostFilter", this.ghostFilter);
		Shader.SetGlobalTexture("_GhostFog", this.ghostFog);
		Shader.SetGlobalTexture("_SparkleTex", this.sparkleTexture);
		Shader.SetGlobalFloat("_SparkleTexScale", this.sparkleTextureScale);
	}

	// Token: 0x0600000A RID: 10 RVA: 0x000025F4 File Offset: 0x000007F4
	public void ToggleObscurance()
	{
		if (Records.x.InObscuranceMenu() || Links.x.creation || Records.x.dialogue)
		{
			base.StartCoroutine(this.EffectsWait());
		}
		else
		{
			if (!Links.x.worldCamera.orthographic)
			{
				this.obscurance.enabled = true;
			}
			else
			{
				this.obscurance.enabled = false;
			}
			this.aa.enabled = true;
		}
		Links.x.renderPortraits.ToggleDownsampling(this.PortraitObscuranceOn());
	}

	// Token: 0x0600000B RID: 11 RVA: 0x00002685 File Offset: 0x00000885
	private bool PortraitObscuranceOn()
	{
		return Records.x.InObscuranceMenu() || Links.x.creation || Records.x.dialogue;
	}

	// Token: 0x0600000C RID: 12 RVA: 0x000026B3 File Offset: 0x000008B3
	private IEnumerator EffectsWait()
	{
		yield return new WaitForSecondsRealtime(1f);
		if (Records.x.inMenus || Links.x.creation || Records.x.dialogue)
		{
			this.obscurance.enabled = false;
			this.aa.enabled = false;
		}
		else
		{
			if (!Links.x.worldCamera.orthographic)
			{
				this.obscurance.enabled = true;
			}
			else
			{
				this.obscurance.enabled = false;
			}
			this.aa.enabled = true;
		}
		Links.x.renderPortraits.ToggleDownsampling(this.PortraitObscuranceOn());
		yield break;
	}

	// Token: 0x0600000D RID: 13 RVA: 0x000026C4 File Offset: 0x000008C4
	public void FinishTransition(bool waitForLights)
	{
		if (Links.x.hasMain)
		{
			this.graphIndex = (uint)Links.x.main.desiredGraph;
		}
		if (this.graphIndex == 1U)
		{
			Links.x.cameraEffects.indoors = true;
		}
		else
		{
			Links.x.cameraEffects.indoors = false;
		}
		this.ngss.indoors = this.indoors;
		if (!this.indoors)
		{
			Links.x.gameplay.sunlightAnimator.SwitchToExterior();
		}
		else
		{
			Links.x.gameplay.sunlightAnimator.SwitchToInterior();
		}
		Links.x.hudControl.CheckIfInspecting();
		if (!Records.x.inspectCamera || !Records.x.inspecting)
		{
			Links.x.diorama.ToggleSceneCameras(this.indoors, "");
		}
		MoonlightSystem.UpdateActiveState(this.indoors);
		Links.x.sensory.UpdateCharactersIntExt(true);
		if (this.indoors && Links.x.fogOfWarInterior)
		{
			Links.x.fogOfWarInterior.UpdateInterior(Links.x.rtsCamera.coll);
		}
		if (Links.x.main)
		{
			Links.x.rtsCamera.Follow(Links.x.main.tr, this.followCharacter, true);
			this.followCharacter = null;
		}
		this.SetShadowInfo();
		if (Records.x.inspectCamera && Records.x.inspecting)
		{
			Links.x.diorama.ToggleSceneCameras(Records.x.inspectCamera.isInterior, Records.x.inspectCamera.id);
			Links.x.rtsCamera.CopyPerspectiveCamera(Records.x.inspectCamera.sceneCamera, null, null);
			Records.x.inspecting = true;
			Records.x.inspectCamera.On();
		}
		base.StartCoroutine(this.IntExtDelay(waitForLights));
		Links.x.cameraEffects.ToggleObscurance();
	}

	// Token: 0x0600000E RID: 14 RVA: 0x000028DC File Offset: 0x00000ADC
	public void FinishFade()
	{
		this.gameFade.gameObject.GetComponent<Image>().enabled = false;
		this.gameFade.enabled = false;
	}

	// Token: 0x0600000F RID: 15 RVA: 0x00002900 File Offset: 0x00000B00
	public void SetShadowInfo()
	{
		this.ngss.interior = Links.x.rtsCamera.currentBoundsName;
		if (Links.x.diorama)
		{
			this.ngss.sceneName = Links.x.diorama.sceneName;
		}
	}

	// Token: 0x06000010 RID: 16 RVA: 0x00002954 File Offset: 0x00000B54
	public void ToggleInteriorExterior(Character character)
	{
		if (!character)
		{
			return;
		}
		if (this.transitioning)
		{
			return;
		}
		this.transitioning = true;
		bool flag = false;
		this.graphIndex = 0U;
		if (!character.sailing)
		{
			if (character.node == null)
			{
				Debug.LogWarning("Character node is null for " + ((character != null) ? character.ToString() : null) + " cannot set up interior/exterior correctly");
			}
			else
			{
				if (this.graphIndex != character.node.GraphIndex)
				{
					flag = true;
				}
				if (character.node.GraphIndex == 1U && character.indoorID != Links.x.rtsCamera.currentBoundsName)
				{
					flag = true;
				}
				this.graphIndex = character.node.GraphIndex;
			}
		}
		this.followCharacter = character;
		if ((this.gameFade.GetCurrentAnimatorStateInfo(0).IsName("FadeInLoop") || !this.gameFade.enabled) && flag)
		{
			this.gameFade.enabled = true;
			this.gameFade.Play("FadeQuick", -1, 0f);
		}
		else
		{
			this.FinishTransition(false);
		}
		Links.x.cameraEffects.ToggleObscurance();
	}

	// Token: 0x06000011 RID: 17 RVA: 0x00002A79 File Offset: 0x00000C79
	private IEnumerator IntExtDelay(bool waitForLights)
	{
		yield return new WaitForSecondsRealtime(0.2f);
		float realtimeSinceStartup = Time.realtimeSinceStartup;
		if (waitForLights && !this.gameFade.enabled)
		{
			this.gameFade.enabled = true;
			this.gameFade.Play("FadeQuickIn", -1, 0f);
			Debug.Log("Play fade quick in");
		}
		Links.x.fellowship.SetMainSelectedForSection();
		if (Links.x.gaia.sceneLoaded)
		{
			Links.x.rtsCamera.Jump(Links.x.main.tr.position);
		}
		Links.x.sensory.UpdateCharactersIntExt(true);
		this.transitioning = false;
		yield break;
	}

	// Token: 0x06000012 RID: 18 RVA: 0x00002A8F File Offset: 0x00000C8F
	public void GetShadowMaterials()
	{
	}

	// Token: 0x06000013 RID: 19 RVA: 0x00002A91 File Offset: 0x00000C91
	public int HoverCount()
	{
		return this.hovers.Count;
	}

	// Token: 0x06000014 RID: 20 RVA: 0x00002A9E File Offset: 0x00000C9E
	public int BubbleCount()
	{
		return this.bubbles.Count;
	}

	// Token: 0x06000015 RID: 21 RVA: 0x00002AAC File Offset: 0x00000CAC
	public void BeforeImageEffectsTopCam()
	{
		if (this.opaqueBufferTop == null)
		{
			this.opaqueBufferTop = new CommandBuffer();
			this.opaqueBufferTop.name = "Hannah Image Effects Top";
			Links.x.rtsCamera.topCam.AddCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, this.opaqueBufferTop);
		}
		this.opaqueBufferTop.Clear();
		RenderTargetIdentifier renderTargetIdentifier = new RenderTargetIdentifier(this.fleshStencilTexture);
		if (!this.fleshStencilMaterial)
		{
			this.fleshStencilMaterial = new Material(this.characterShader);
		}
		this.opaqueBufferTop.SetRenderTarget(renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget);
		this.opaqueBufferTop.ClearRenderTarget(false, true, Color.clear);
		if (!this.screenQuad)
		{
			Vector3[] array = new Vector3[]
			{
				new Vector3(-0.5f, -0.5f, 0f),
				new Vector3(0.5f, 0.5f, 0f),
				new Vector3(0.5f, -0.5f, 0f),
				new Vector3(-0.5f, 0.5f, 0f)
			};
			Vector2[] array2 = new Vector2[]
			{
				new Vector2(0f, 0f),
				new Vector2(1f, 1f),
				new Vector2(1f, 0f),
				new Vector2(0f, 1f)
			};
			int[] array3 = new int[] { 0, 1, 2, 1, 0, 3 };
			this.screenQuad = new Mesh
			{
				vertices = array,
				uv = array2,
				triangles = array3
			};
			this.screenQuad.RecalculateNormals();
			this.screenQuad.RecalculateBounds();
			this.screenQuad.hideFlags = HideFlags.HideAndDontSave;
		}
		this.opaqueBufferTop.DrawMesh(this.screenQuad, Matrix4x4.identity, this.fleshStencilMaterial, 0, 1);
		this.opaqueBufferTop.DrawMesh(this.screenQuad, Matrix4x4.identity, this.fleshStencilMaterial, 0, 0);
		this.opaqueBufferTop.DrawMesh(this.screenQuad, Matrix4x4.identity, this.fleshStencilMaterial, 0, 2);
		this.opaqueBufferTop.SetGlobalTexture("_CharacterMask", this.fleshStencilTexture);
	}

	// Token: 0x06000016 RID: 22 RVA: 0x00002D00 File Offset: 0x00000F00
	public void BeforeImageEffects()
	{
		if (this.opaqueBuffer == null)
		{
			this.opaqueBuffer = new CommandBuffer();
			this.opaqueBuffer.name = "Hannah Image Effects";
			this.cam.AddCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, this.opaqueBuffer);
		}
		this.opaqueBuffer.Clear();
		bool flag = false;
		this.opaqueBuffer.SetGlobalVector("_ShadowColor", this.shadowColor);
		this.opaqueBuffer.SetGlobalFloat("_Vignette", this.vignette);
		RenderTargetIdentifier renderTargetIdentifier = new RenderTargetIdentifier(this.combatCharacterTexture);
		Shader.SetGlobalTexture("_Noiseee", this.noiseTexture);
		if (!this.moonlightMaterial)
		{
			this.moonlightMaterial = new Material(this.moonlightShader);
		}
		this.opaqueBuffer.SetGlobalFloat("_CombatCount", (float)this.combats.Count);
		if (this.removingPocket)
		{
			if (this.combatFX <= 0f)
			{
				this.removingPocket = false;
				this.opaqueBuffer.SetGlobalFloat("_CombatFxType", 0f);
			}
			else
			{
				this.combatTime += Time.deltaTime * 1f;
			}
		}
		if (Records.x.pocketPause && !Links.x.main.inAction && !Links.x.main.inRecovery && !Links.x.combat.inPocketAttack && !Links.x.combat.miniEvent)
		{
			if (this.pocketAlpha < 1f)
			{
				this.pocketAlpha = Mathf.Lerp(this.pocketAlpha, 1f, Time.unscaledDeltaTime * 15f);
				Shader.SetGlobalFloat("_PocketAlpha", this.pocketAlpha);
			}
		}
		else if (this.pocketAlpha > 0f)
		{
			bool flag2 = false;
			if (Links.x.main.timelineIcon && Links.x.main.timelineIcon.overridePause)
			{
				flag2 = true;
			}
			if (!Records.x.InCombat(false) || !Records.x.pocketPause || Links.x.combat.inPocketAttack || Links.x.combat.miniEvent)
			{
				flag2 = true;
			}
			if (flag2)
			{
				this.pocketAlpha = Mathf.Lerp(this.pocketAlpha, 0f, Time.unscaledDeltaTime * 15f);
				Shader.SetGlobalFloat("_PocketAlpha", this.pocketAlpha);
			}
		}
		if (this.combats.Count > 0 || this.removingPocket)
		{
			renderTargetIdentifier = new RenderTargetIdentifier(this.combatCharacterTexture);
			this.opaqueBuffer.SetRenderTarget(renderTargetIdentifier);
			this.opaqueBuffer.ClearRenderTarget(true, true, Color.clear);
			bool flag3 = false;
			if (Records.x.pocketPause)
			{
				if (Links.x.main.inAction || this.mainCharacterInSheen || Links.x.combat.inPocketAttack)
				{
					flag3 = true;
				}
				if (Links.x.main.hasActions && Links.x.main.actions.vine)
				{
					flag3 = true;
				}
			}
			if (flag3 || this.mainCharacterInSheen)
			{
				this.combatTime += Time.deltaTime * 8f;
				this.combatFX = Mathf.Lerp(0f, 1f, this.combatTime);
				this.opaqueBuffer.SetGlobalFloat("_CombatFxType", this.combatFX);
			}
			else if (Records.x.pocketPause)
			{
				this.combatFX = 0f;
				this.opaqueBuffer.SetGlobalFloat("_CombatFxType", 0f);
			}
			else
			{
				this.combatFX = Mathf.Lerp(1f, 0f, this.combatTime);
				this.opaqueBuffer.SetGlobalFloat("_CombatFxType", this.combatFX);
			}
			for (int i = 0; i < this.combats.Count; i++)
			{
				if (this.combats[i])
				{
					if (this.combats[i].sharedMaterial.shader.name.Contains("Motion"))
					{
						this.mats = this.combats[i].sharedMaterials;
						int num = 0;
						foreach (Material material in this.mats)
						{
							this.opaqueBuffer.DrawRenderer(this.combats[i], material, num, 0);
							num++;
						}
					}
					else
					{
						this.opaqueBuffer.DrawRenderer(this.combats[i], Links.x.hoverMaterial1, 0, 0);
					}
				}
			}
			this.opaqueBuffer.SetGlobalTexture("_CombatCharacters", this.combatCharacterTexture);
		}
		else
		{
			this.opaqueBuffer.SetGlobalFloat("_CombatFxType", 0f);
		}
		renderTargetIdentifier = new RenderTargetIdentifier(this.ghostTexture);
		this.opaqueBuffer.SetRenderTarget(renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget);
		this.opaqueBuffer.ClearRenderTarget(false, true, Color.black);
		int num2 = this.ghosts.Count;
		for (int k = 0; k < num2; k++)
		{
			Renderer renderer = this.ghosts[k];
			if (renderer && renderer.gameObject.activeInHierarchy && renderer)
			{
				this.opaqueBuffer.DrawRenderer(renderer, renderer.sharedMaterial, 0, 0);
			}
		}
		if (num2 > 0)
		{
			float num3 = 3f;
			float num4 = 0.5f;
			float num5 = 1f / (1f * (1f / num3));
			this.opaqueBuffer.SetGlobalVector("_BlurParameter", new Vector4(num4 * num5, -num4 * num5, 0f, 0f));
			int num6 = Mathf.RoundToInt((float)Screen.width / num3);
			int num7 = Mathf.RoundToInt((float)Screen.height / num3);
			int num8 = Shader.PropertyToID("_Temp");
			this.opaqueBuffer.GetTemporaryRT(num8, num6, num7, 0, FilterMode.Bilinear, RenderTextureFormat.R8);
			this.opaqueBuffer.Blit(this.ghostTexture, num8, this.blurMaterial, 0);
			int num9 = 0;
			float num10 = (float)0 * 1f;
			this.opaqueBuffer.SetGlobalVector("_BlurParameter", new Vector4(num4 * num5 + num10, -num4 * num5 - num10, 0f, 0f));
			int num11 = Shader.PropertyToID("_Temp2");
			this.opaqueBuffer.GetTemporaryRT(num11, num6, num7, 0, FilterMode.Bilinear, RenderTextureFormat.R8);
			this.opaqueBuffer.Blit(num8, num11, this.blurMaterial, 1 + num9);
			this.opaqueBuffer.ReleaseTemporaryRT(num8);
			int num12 = Shader.PropertyToID("_Temp3");
			this.opaqueBuffer.GetTemporaryRT(num12, num6, num7, 0, FilterMode.Bilinear, RenderTextureFormat.R8);
			this.opaqueBuffer.Blit(num11, num12, this.blurMaterial, 2 + num9);
			this.opaqueBuffer.ReleaseTemporaryRT(num11);
			num10 = (float)1 * 1f;
			this.opaqueBuffer.SetGlobalVector("_BlurParameter", new Vector4(num4 * num5 + num10, -num4 * num5 - num10, 0f, 0f));
			int num13 = Shader.PropertyToID("_Temp4");
			this.opaqueBuffer.GetTemporaryRT(num13, num6, num7, 0, FilterMode.Bilinear, RenderTextureFormat.R8);
			this.opaqueBuffer.Blit(num12, num13, this.blurMaterial, 1 + num9);
			this.opaqueBuffer.ReleaseTemporaryRT(num12);
			this.opaqueBuffer.Blit(num13, this.ghostBlurTexture, this.blurMaterial, 2 + num9);
			this.opaqueBuffer.ReleaseTemporaryRT(num13);
			this.opaqueBuffer.SetGlobalTexture("_Ghosts", this.ghostBlurTexture);
		}
		else
		{
			this.opaqueBuffer.SetGlobalTexture("_Ghosts", this.ghostTexture);
		}
		if (!this.noCircle)
		{
			renderTargetIdentifier = new RenderTargetIdentifier(this.groups);
			this.opaqueBuffer.SetRenderTarget(renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget);
			this.opaqueBuffer.ClearRenderTarget(false, true, Color.black);
			if (this.groupTiles.Count > 0)
			{
				this.tileMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(Vector3.zero), new Vector3(3.75f, 3.75f, 3.75f));
			}
			for (int l = 0; l < this.groupTiles.Count; l++)
			{
				Vector3 vector = this.groupTiles[l];
				Vector3 vector2 = this.groupTiles[l];
				this.tileMatrix.m03 = vector2.x;
				this.tileMatrix.m13 = vector2.y;
				this.tileMatrix.m23 = vector2.z;
				Object @object = this.groupID[l];
				Material material2 = this.circleMaterials[l];
				if (@object)
				{
					material2.SetVector("_Color", new Color(0f, 1f, 0f, 1f));
				}
				else
				{
					material2.SetVector("_Color", new Color(1f, 0f, 0f, 1f));
				}
				this.opaqueBuffer.DrawMesh(this.tileMesh, this.tileMatrix, material2);
			}
			renderTargetIdentifier = new RenderTargetIdentifier(this.groupsMask);
			this.opaqueBuffer.SetRenderTarget(renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget);
			this.opaqueBuffer.ClearRenderTarget(false, true, Color.black);
			if (this.groupTiles.Count > 0)
			{
				this.tileMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(Vector3.zero), new Vector3(5f, 5f, 5f));
			}
			for (int m = 0; m < this.groupTiles.Count; m++)
			{
				Vector3 vector3 = this.groupTiles[m];
				Vector3 vector4 = this.groupTiles[m];
				this.tileMatrix.m03 = vector4.x;
				this.tileMatrix.m13 = vector4.y;
				this.tileMatrix.m23 = vector4.z;
				Material material3 = this.circleMaterialsMask[m];
				EnemyGroup enemyGroup = this.groupID[m];
				if (enemyGroup)
				{
					if (!enemyGroup.aggressive)
					{
						if (!enemyGroup.staminaFilling)
						{
							material3.SetFloat("_Type", 0.25f);
						}
						else
						{
							material3.SetFloat("_Type", 0.5f);
						}
					}
					else
					{
						material3.SetFloat("_Type", 1f);
					}
					if (enemyGroup.morale > 33 && enemyGroup.morale < 66)
					{
						material3.SetFloat("_Morale", 0.5f);
					}
					if (enemyGroup.morale <= 33)
					{
						material3.SetFloat("_Morale", 0.1f);
					}
					if (enemyGroup.morale >= 66)
					{
						material3.SetFloat("_Morale", 1f);
					}
					if (enemyGroup.fading)
					{
						material3.SetFloat("_DoFade", 1f);
					}
					else
					{
						material3.SetFloat("_DoFade", 0f);
					}
					if (enemyGroup.pulsing)
					{
						material3.SetFloat("_DoPulse", 1f);
					}
					else
					{
						material3.SetFloat("_DoPulse", 0f);
					}
					material3.SetFloat("_Fade", enemyGroup.currentDither);
					material3.SetFloat("_Pulse", enemyGroup.pulse);
				}
				else
				{
					material3.SetFloat("_Type", 0f);
					if (Links.x.fellowship.morale > 33 && Links.x.fellowship.morale < 66)
					{
						material3.SetFloat("_Morale", 0.5f);
					}
					if (Links.x.fellowship.morale <= 33)
					{
						material3.SetFloat("_Morale", 0.1f);
					}
					if (Links.x.fellowship.morale >= 66)
					{
						material3.SetFloat("_Morale", 1f);
					}
					if (Links.x.fellowship.fading)
					{
						material3.SetFloat("_DoFade", 1f);
					}
					else
					{
						material3.SetFloat("_DoFade", 0f);
					}
					material3.SetFloat("_Fade", Links.x.fellowship.currentDither);
				}
				this.opaqueBuffer.DrawMesh(this.tileMesh, this.tileMatrix, material3);
			}
		}
		RenderTargetIdentifier renderTargetIdentifier2 = BuiltinRenderTextureType.CameraTarget;
		if (Links.x)
		{
			if (!this.usesTimeOfDay || this.indoors)
			{
				this.opaqueBuffer.SetGlobalFloat("_Interior", 1f);
			}
			else
			{
				this.opaqueBuffer.SetGlobalFloat("_Interior", 0f);
			}
		}
		if (flag)
		{
			this.opaqueBuffer.SetGlobalTexture("_Albedo", this.albedoTexture);
			this.matrix = default(Matrix4x4);
			Quaternion quaternion = Quaternion.Euler(this.cam.transform.rotation.eulerAngles);
			this.matrix.SetTRS(Vector3.zero, quaternion, new Vector3(0f, 0f, 0f));
			this.matrix.SetRow(3, new Vector4(0f, 0f, 0f, 1f));
			Vector4 vector5 = new Vector4(0f, 0f, 0f, 1f);
			Vector3 vector6 = Vector3.zero;
			new Vector4(0f, 0f, 0f, 0f);
			Color color = new Color(0f, 0f, 0f, 0f);
			Vector3 zero = Vector3.zero;
			this.opaqueBuffer.SetGlobalVector("_ShadowColor", this.shadowColor);
			renderTargetIdentifier = new RenderTargetIdentifier(this.moonlightTexture);
			this.opaqueBuffer.SetRenderTarget(renderTargetIdentifier);
			this.opaqueBuffer.ClearRenderTarget(true, true, new Color(0f, 0f, 0f, 0f));
			if (!this.cam.orthographic)
			{
				this.opaqueBuffer.SetGlobalFloat("_Perspective", 0f);
			}
			else
			{
				this.opaqueBuffer.SetGlobalFloat("_Perspective", 1f);
			}
			if (this.hasDirectionalLight)
			{
				this.opaqueBuffer.SetGlobalFloat("_DirectionalLight", 1f);
			}
			else
			{
				this.opaqueBuffer.SetGlobalFloat("_DirectionalLight", 0f);
			}
			num2 = this.moonlights.Count;
			if (this.moonlights.Count > 0)
			{
				for (int n = 0; n < num2; n++)
				{
					Light light = this.moonlights[n];
					if (light && light.type != LightType.Directional)
					{
						vector6 = light.transform.position;
						if (this.TestPlanesAABBInternalFast(vector6, light.range * 1.2f) || !this.cam.orthographic)
						{
							vector5.x = vector6.x;
							vector5.y = vector6.y;
							vector5.z = vector6.z;
							float num14;
							if (!this.cam.orthographic)
							{
								num14 = light.range * this.perspectiveLightScale;
							}
							else
							{
								num14 = light.range * this.orthoLightScale;
							}
							zero.x = num14;
							zero.y = num14;
							zero.z = num14;
							this.matrix.SetTRS(vector5, quaternion, zero);
							color = light.color * light.intensity;
							color.a = 1f;
							this.opaqueBuffer.SetGlobalFloat("_MoonlightRange", light.range);
							this.opaqueBuffer.SetGlobalVector("_MoonlightColor", color);
							this.opaqueBuffer.SetGlobalVector("_MoonlightPos", vector5);
							this.opaqueBuffer.DrawMesh(this.quadMesh, this.matrix, this.moonlightMaterial, 0, 0);
						}
					}
				}
			}
			if (!this.usesTimeOfDay && !this.hasDirectionalLight)
			{
				if (Links.x.diorama && Links.x.diorama.scenePointLight)
				{
					this.opaqueBuffer.SetGlobalVector("_SunlightColor", Links.x.diorama.scenePointLight.color);
				}
				this.opaqueBuffer.SetGlobalVector("_MoonLightDir", -this.sunlight.transform.forward);
			}
			else
			{
				this.sunlight.color = this.morningColor;
				Color color2 = this.sunlight.color;
				color2.r = Mathf.Clamp(color2.r, 0.3f, 1f);
				color2.g = Mathf.Clamp(color2.g, 0.3f, 1f);
				color2.b = Mathf.Clamp(color2.b, 0.3f, 1f);
				this.opaqueBuffer.SetGlobalVector("_SunlightColor", color2);
				this.opaqueBuffer.SetGlobalVector("_MoonLightDir", -this.sunlight.transform.forward);
			}
			if (Links.x)
			{
				this.opaqueBuffer.SetGlobalVector("_DomeCenter", Links.x.combat.domeCenter);
			}
			this.opaqueBuffer.SetGlobalVector("_MoonlightColor", this.partyLightColor);
			new Vector3(0f, 2f, 0f);
			if (this.partyCharacters == null && Links.x)
			{
				this.partyCharacters = Links.x.party;
			}
			Vector3 vector7 = Vector3.zero;
			Vector3 vector8 = new Vector3(10000f, 10000f, 10000f);
			if (this.partyCharacters != null && Links.x)
			{
				float num15 = 0f;
				float num16 = 0f;
				float num17 = 0f;
				for (int num18 = 0; num18 < 4; num18++)
				{
					Character character = null;
					if (num18 < this.partyCharacters.Count)
					{
						character = this.partyCharacters[num18];
					}
					float num19 = this.partyLightRange;
					if (num18 == 0)
					{
						if (character)
						{
							vector7 = character.tr.position;
							if (character.outsideDome)
							{
								num16 = 0f;
							}
							else
							{
								num16 = 1f;
							}
							if (character.hovering && !Links.x.fellowship.drawingSquare)
							{
								num17 = 1f;
							}
							else
							{
								num17 = 0f;
							}
							this.opaqueBuffer.SetGlobalVector("_DirectionalLightPosition", character.tr.position + this.sunlight.transform.forward * -10f);
						}
						this.opaqueBuffer.SetGlobalVector("_PartyPos1", vector7);
						this.opaqueBuffer.SetGlobalVector("_PartyParams1", new Vector4(num16, num15, num17, num19));
					}
					if (num18 == 1)
					{
						if (character)
						{
							vector7 = character.tr.position;
							if (character.outsideDome)
							{
								num16 = 0f;
							}
							else
							{
								num16 = 1f;
							}
							if (character.hovering && !Links.x.fellowship.drawingSquare)
							{
								num17 = 1f;
							}
							else
							{
								num17 = 0f;
							}
						}
						else
						{
							vector7 = vector8;
						}
						this.opaqueBuffer.SetGlobalVector("_PartyPos2", vector7);
						this.opaqueBuffer.SetGlobalVector("_PartyParams2", new Vector4(num16, num15, num17, num19));
					}
					if (num18 == 2)
					{
						if (character)
						{
							vector7 = character.tr.position;
							if (character.outsideDome)
							{
								num16 = 0f;
							}
							else
							{
								num16 = 1f;
							}
							if (character.hovering && !Links.x.fellowship.drawingSquare)
							{
								num17 = 1f;
							}
							else
							{
								num17 = 0f;
							}
						}
						else
						{
							vector7 = vector8;
						}
						this.opaqueBuffer.SetGlobalVector("_PartyPos3", vector7);
						this.opaqueBuffer.SetGlobalVector("_PartyParams3", new Vector4(num16, num15, num17, num19));
					}
					if (num18 == 3)
					{
						if (character)
						{
							vector7 = character.tr.position;
							if (character.outsideDome)
							{
								num16 = 0f;
							}
							else
							{
								num16 = 1f;
							}
							if (character.hovering && !Links.x.fellowship.drawingSquare)
							{
								num17 = 1f;
							}
							else
							{
								num17 = 0f;
							}
						}
						else
						{
							vector7 = vector8;
						}
						this.opaqueBuffer.SetGlobalVector("_PartyPos4", vector7);
						this.opaqueBuffer.SetGlobalVector("_PartyParams4", new Vector4(num16, num15, num17, num19));
					}
				}
			}
			this.opaqueBuffer.DrawMesh(this.screenQuad, Matrix4x4.identity, this.moonlightMaterial, 0, 1);
			this.opaqueBuffer.SetGlobalTexture("_MoonlightsPoint", this.moonlightTexture);
			this.opaqueBuffer.Blit(this.moonlightTexture, renderTargetIdentifier2, this.moonlightMaterial, 2);
			return;
		}
		this.opaqueBuffer.SetGlobalTexture("_LookupTex", this.LookupTexture);
		this.opaqueBuffer.SetGlobalFloat("_LookupAmount", this.LookupTextureAmount);
		this.opaqueBuffer.SetGlobalTexture("_LookupTex2", this.LookupTexture2);
		this.opaqueBuffer.SetGlobalFloat("_LookupAmount2", this.LookupTextureAmount2);
		if (this.indoors)
		{
			this.opaqueBuffer.Blit(renderTargetIdentifier2, this.lightInteriorTexture, this.moonlightMaterial, 7);
			this.opaqueBuffer.SetGlobalTexture("_Moonlights", this.lightInteriorTexture);
			return;
		}
		this.opaqueBuffer.Blit(renderTargetIdentifier2, this.lightTexture, this.moonlightMaterial, 6);
		this.opaqueBuffer.SetGlobalTexture("_Moonlights", this.lightTexture);
	}

	// Token: 0x06000017 RID: 23 RVA: 0x000043A4 File Offset: 0x000025A4
	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		if (this.groupTiles.Count > 0 && !this.noCircle)
		{
			int num = 0;
			if (Records.x.circle)
			{
				num++;
			}
			if (num > 0)
			{
				for (int i = 0; i < this.groupTiles.Count; i++)
				{
					if (this.groupID[i])
					{
						num++;
						break;
					}
				}
			}
			if (num > 1)
			{
				Graphics.Blit(this.groups, this.groupsSeparated, this.outlineShaderMaterial, 0);
				this.blur.OnRenderImage(this.groupsSeparated, this.blurred2);
			}
			else
			{
				this.blur.OnRenderImage(this.groups, this.blurred2);
			}
			this.outlineShaderMaterial.SetTexture("_PreBlur", this.groups);
			this.outlineShaderMaterial.SetTexture("_FinalOutlineSource", this.blurred2);
			this.outlineShaderMaterial.SetTexture("_Mask", this.groupsMask);
			Graphics.Blit(source, destination, this.outlineShaderMaterial, 1);
			return;
		}
		Graphics.Blit(source, destination);
		this.noCircle = false;
	}

	// Token: 0x06000018 RID: 24 RVA: 0x000044C0 File Offset: 0x000026C0
	public void AfterImageEffects()
	{
		if (this.afterImageEffects == null)
		{
			this.afterImageEffects = new CommandBuffer();
			this.afterImageEffects.name = "Grab the scene";
			if (!this.cam)
			{
				this.cam = base.gameObject.GetComponent<Camera>();
			}
			this.cam.AddCommandBuffer(CameraEvent.AfterImageEffects, this.afterImageEffects);
		}
		this.afterImageEffects.Clear();
		RenderTargetIdentifier renderTargetIdentifier = BuiltinRenderTextureType.CameraTarget;
		RenderTargetIdentifier renderTargetIdentifier2 = new RenderTargetIdentifier(this.scene);
		this.afterImageEffects.SetRenderTarget(renderTargetIdentifier2, BuiltinRenderTextureType.CameraTarget);
		this.afterImageEffects.ClearRenderTarget(false, true, Color.black);
		this.afterImageEffects.Blit(renderTargetIdentifier, this.scene);
		this.afterImageEffects.SetGlobalTexture("_Scene", this.scene);
	}

	// Token: 0x06000019 RID: 25 RVA: 0x00004598 File Offset: 0x00002798
	public void BeforeForwardOpaque()
	{
		if (this.beforeOpaqueBuffer == null)
		{
			this.beforeOpaqueBuffer = new CommandBuffer();
			this.beforeOpaqueBuffer.name = "Before Forward Pass";
			this.cam.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, this.beforeOpaqueBuffer);
			this.renderDodge = true;
		}
		this.beforeOpaqueBuffer.Clear();
		if (this.dodges.Count <= 0)
		{
			bool flag = this.renderDodge;
		}
		if (this.indoors)
		{
			this.beforeOpaqueBuffer.Blit(null, this.fowInteriorTexture, this.moonlightMaterial, 9);
			this.beforeOpaqueBuffer.SetGlobalTexture("_FOWTex0Combined", this.fowInteriorTexture);
			if (Links.x.fogOfWarInterior)
			{
				Shader.SetGlobalVector("_FOWParamsCombined", Links.x.fogOfWarInterior.GetParams());
				return;
			}
		}
		else
		{
			this.beforeOpaqueBuffer.Blit(null, this.fowTexture, this.moonlightMaterial, 8);
			this.beforeOpaqueBuffer.SetGlobalTexture("_FOWTex0Combined", this.fowTexture);
			if (Links.x.fogOfWar)
			{
				Shader.SetGlobalVector("_FOWParamsCombined", Links.x.fogOfWar.GetParams());
			}
		}
	}

	// Token: 0x0600001A RID: 26 RVA: 0x000046D4 File Offset: 0x000028D4
	public void ToTexture2D(RenderTexture rTex)
	{
		if (!this.characters2D || !this.collisionCharacters)
		{
			this.characters2D = new Texture2D(1, 1, TextureFormat.RGBAFloat, false);
			this.collisionCharacters = new RenderTexture(1, 1, 0, RenderTextureFormat.ARGBFloat);
			this.characters2D.filterMode = FilterMode.Point;
			this.collisionCharacters.filterMode = FilterMode.Point;
		}
		Vector2 vector = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
		if (vector.x < (float)Screen.width && vector.x > 0f && vector.y < (float)Screen.height && vector.y > 0f)
		{
			int num = (int)vector.x;
			int num2 = (int)vector.y;
			Graphics.CopyTexture(rTex, 0, 0, num, num2, 1, 1, this.collisionCharacters, 0, 0, 0, 0);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = this.collisionCharacters;
			this.characters2D.ReadPixels(new Rect(0f, 0f, 1f, 1f), 0, 0, false);
			RenderTexture.active = active;
		}
	}

	// Token: 0x0600001B RID: 27 RVA: 0x000047EC File Offset: 0x000029EC
	public Body GetCharacterFromMask(float rValue)
	{
		if (rValue == 0f)
		{
			return null;
		}
		foreach (Character character in this.hoverCharacters)
		{
			if (character && character.body.maskNumber > rValue - 0.0005f && character.body.maskNumber < rValue + 0.0005f)
			{
				return character.body;
			}
		}
		return null;
	}

	// Token: 0x0600001C RID: 28 RVA: 0x00004880 File Offset: 0x00002A80
	private void Update()
	{
		if (this.phase > 1000f)
		{
			this.phase = 10f;
		}
		if (this.unscaledTime > 1000f)
		{
			this.unscaledTime = 10f;
		}
		if (this.seed > 10f)
		{
			this.seed = 0.5f;
		}
		this.seed += Time.unscaledDeltaTime * 0.25f;
		Shader.SetGlobalFloat("_Seed", this.seed);
		if (Records.x)
		{
			if (Records.x.filming)
			{
				this.phase += Time.unscaledDeltaTime * 0.25f / Records.x.filmingAnimatorSpeed;
				this.unscaledTime = Time.realtimeSinceStartup / Records.x.filmingAnimatorSpeed;
			}
			else
			{
				this.phase += Time.unscaledDeltaTime * 0.25f;
				this.unscaledTime = Time.realtimeSinceStartup;
			}
		}
		Shader.SetGlobalVector("_AnaParams2", new Vector4(this.phase, 0f, 0f, 0f));
		Shader.SetGlobalFloat("_UnscaledTime", this.unscaledTime);
		if (Links.x.main)
		{
			Shader.SetGlobalVector("_MousePos", Links.x.main.tr.position);
		}
		bool flag = false;
		int count = this.ghosts.Count;
		for (int i = 0; i < count; i++)
		{
			if (!this.ghosts[i])
			{
				flag = true;
			}
			else if (!this.ghosts[i].gameObject.activeSelf)
			{
				this.ghosts[i] = null;
				flag = true;
			}
		}
		if (flag)
		{
			this.ghosts.RemoveAll((Renderer item) => item == null);
		}
		Shader.SetGlobalVector("_SharpParams", new Vector4(this.sharpStrength, this.sharpClamp, 1f / (float)Screen.width, 1f / (float)Screen.height));
		Shader.SetGlobalFloat("_ScreenWidth", (float)Screen.width);
		Shader.SetGlobalTexture("_GhostNoise", this.ghostNoise);
		Shader.SetGlobalTexture("_GhostFilter", this.ghostFilter);
		Shader.SetGlobalTexture("_GhostFog", this.ghostFog);
		if (false)
		{
			this.normalsCam.depthTextureMode = DepthTextureMode.None;
			if (true)
			{
				this.moonlightMaterial.SetFloat("_Enviro_tcp2RampThreshold", this.enviroRampThreshold);
				this.moonlightMaterial.SetFloat("_Enviro_tcp2RampSmoothness", this.enviroRampSmoothness);
				this.moonlightMaterial.SetFloat("_Enviro_tcp2specSmooth", this.enviroSpecSmooth);
				this.moonlightMaterial.SetFloat("_Enviro_tcp2specBlend", this.enviroSpecBlend);
				this.moonlightMaterial.SetVector("_Enviro_tcp2HighlightColor", this.enviroHighlightColor);
				this.moonlightMaterial.SetVector("_Enviro_tcp2ShadowColor", this.enviroShadowColor);
				this.moonlightMaterial.SetVector("_Enviro_rimParams", new Vector3(this.enviroRimMin, this.enviroRimMax, this.enviroRimStrength));
				this.moonlightMaterial.SetFloat("_Character_tcp2RampThreshold", this.characterRampThreshold);
				this.moonlightMaterial.SetFloat("_Character_tcp2RampSmoothness", this.characterRampSmoothness);
				this.moonlightMaterial.SetFloat("_Character_tcp2specSmooth", this.characterSpecSmooth);
				this.moonlightMaterial.SetFloat("_Character_tcp2specBlend", this.characterSpecBlend);
				this.moonlightMaterial.SetVector("_Character_tcp2HighlightColor", this.characterHighlightColor);
				this.moonlightMaterial.SetVector("_Charactertcp2ShadowColor", this.characterShadowColor);
				this.moonlightMaterial.SetVector("_Character_rimParams", new Vector3(this.characterRimMin, this.characterRimMax, this.characterRimStrength));
			}
		}
	}

	// Token: 0x0600001D RID: 29 RVA: 0x00004C60 File Offset: 0x00002E60
	private void OnPreRender()
	{
		if (!this.cam)
		{
			this.cam = base.gameObject.GetComponent<Camera>();
		}
		if (this.cam)
		{
			Matrix4x4 cameraToWorldMatrix = this.cam.cameraToWorldMatrix;
			Shader.SetGlobalMatrix("_CamToWorld", this.cam.cameraToWorldMatrix);
			if (!this.groups)
			{
				this.CreateTexture(false);
			}
			if (this.groups && (this.groups.width != Screen.width || this.groups.height != Screen.height))
			{
				this.CreateTexture(false);
			}
			if (this.shadowCaster)
			{
				this.shadowCaster.OnPreRender();
				if (Links.x.gameplay)
				{
					this.shadowCaster.transform.rotation = Links.x.gameplay.sunlightAnimator.transform.rotation;
				}
			}
			bool flag = false;
			this.planes = GeometryUtility.CalculateFrustumPlanes(this.cam);
			this.UpdateShaderVariables();
			if (flag)
			{
				if (!this.normalsCam)
				{
					this.CreateNormalsCamera(false);
				}
				if (this.normalsCam)
				{
					if (this.cam.orthographicSize != this.savedSize || this.cam.fieldOfView != this.savedFov)
					{
						this.CreateNormalsCamera(false);
					}
					QualitySettings.shadows = ShadowQuality.Disable;
					this.normalsCam.targetTexture = this.depthNormalsTexture;
					this.normalsCam.depthTextureMode = DepthTextureMode.None;
					this.normalsCam.cullingMask = this.cam.cullingMask;
					this.specularCharacterCam.targetTexture = this.specularCharacters;
					this.specularCharacterCam.farClipPlane = this.normalsCam.farClipPlane;
					this.specularCharacterCam.depthTextureMode = DepthTextureMode.None;
					QualitySettings.shadows = ShadowQuality.All;
				}
			}
			this.BeforeForwardOpaque();
			this.BeforeImageEffects();
			this.BeforeImageEffectsTopCam();
			this.AfterImageEffects();
			if (Links.x && Links.x.hasMain && Links.x.main && Links.x.main.tr)
			{
				this.v = Links.x.main.tr.position;
			}
		}
	}

	// Token: 0x0600001E RID: 30 RVA: 0x00004EAC File Offset: 0x000030AC
	private bool CheckCamBounds(Vector3 point)
	{
		this._x = this.v.x - point.x;
		if (this._x < 0f)
		{
			this._x *= -1f;
		}
		if (this._x < 40f)
		{
			this._z = this.v.z - point.z;
			if (this._z < 0f)
			{
				this._z *= -1f;
			}
			if (this._z < 40f)
			{
				return true;
			}
		}
		return false;
	}

	// Token: 0x0600001F RID: 31 RVA: 0x00004F44 File Offset: 0x00003144
	public void ReleaseTextures()
	{
		if (this.depthNormalsTexture != null)
		{
			this.depthNormalsTexture.Release();
		}
		if (this.depthNormalsLrgTexture != null)
		{
			this.depthNormalsLrgTexture.Release();
		}
		if (this.depthNormalsCharacters != null)
		{
			this.depthNormalsCharacters.Release();
		}
		if (this.lightTexture != null)
		{
			this.lightTexture.Release();
		}
		if (this.lightInteriorTexture != null)
		{
			this.lightInteriorTexture.Release();
		}
		if (this.specularCharacters != null)
		{
			this.specularCharacters.Release();
		}
		if (this.moonlightTexture != null)
		{
			this.moonlightTexture.Release();
		}
		if (this.albedoTexture != null)
		{
			this.albedoTexture.Release();
		}
		if (this.moonlightShadowTexture != null)
		{
			this.moonlightShadowTexture.Release();
		}
		if (this.fleshStencilTexture != null)
		{
			this.fleshStencilTexture.Release();
		}
		if (this.hoverTexture != null)
		{
			this.hoverTexture.Release();
		}
		if (this.combatCharacterTexture != null)
		{
			this.combatCharacterTexture.Release();
		}
		if (this.fowInteriorTexture != null)
		{
			this.fowInteriorTexture.Release();
		}
		if (this.fowTexture != null)
		{
			this.fowTexture.Release();
		}
		if (this.groups != null)
		{
			this.groups.Release();
		}
		if (this.groupsMask != null)
		{
			this.groupsMask.Release();
		}
		if (this.groupsSeparated != null)
		{
			this.groupsSeparated.Release();
		}
		if (this.blurred2 != null)
		{
			this.blurred2.Release();
		}
		if (this.ghostBlurTexture != null)
		{
			this.ghostBlurTexture.Release();
			this.ghostTexture.Release();
		}
		if (this.combinedShadows)
		{
			this.combinedShadows.Release();
		}
		if (this.scene)
		{
			this.scene.Release();
		}
	}

	// Token: 0x06000020 RID: 32 RVA: 0x00005168 File Offset: 0x00003368
	public void CreateTexture(bool callbackObject)
	{
		this.ReleaseTextures();
		this.width = Screen.width;
		this.height = Screen.height;
		if (false)
		{
			if (this.cam.orthographic)
			{
				this.depthNormalsLrgTexture = new RenderTexture(Mathf.RoundToInt((float)this.width * this.lrgTextureMult), Mathf.RoundToInt((float)this.height * this.lrgTextureMult), 16, RenderTextureFormat.ARGBFloat);
			}
			else
			{
				this.depthNormalsLrgTexture = new RenderTexture(Mathf.RoundToInt((float)this.width), Mathf.RoundToInt((float)this.height), 24, RenderTextureFormat.ARGBFloat);
			}
			this.depthNormalsTexture = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.ARGBFloat);
			this.albedoTexture = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
			this.moonlightShadowTexture = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
			this.specularCharacters = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.ARGB32);
			this.moonlightTexture = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
			this.hoverTexture = new RenderTexture(this.width, this.height, 16, RenderTextureFormat.ARGB32);
			this.combatCharacterTexture = new RenderTexture(this.width, this.height, 16, RenderTextureFormat.R8);
			Shader.SetGlobalFloat("_LrgTextureMult", this.lrgTextureMult);
			this.CreateNormalsCamera(callbackObject);
		}
		else
		{
			int num = 1;
			if (QualitySettings.antiAliasing == 2)
			{
				num = 2;
			}
			if (QualitySettings.antiAliasing == 4)
			{
				num = 4;
			}
			if (QualitySettings.antiAliasing == 8)
			{
				num = 8;
			}
			this.lightTexture = new RenderTexture(256, 256, 0, RenderTextureFormat.ARGB32);
			this.lightInteriorTexture = new RenderTexture(256, 256, 0, RenderTextureFormat.ARGB32);
			this.fowTexture = new RenderTexture(256, 256, 0, RenderTextureFormat.ARGB32);
			this.fowInteriorTexture = new RenderTexture(256, 256, 0, RenderTextureFormat.ARGB32);
			this.moonlightTexture = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
			this.combatCharacterTexture = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.ARGB32);
			this.combatCharacterTexture.antiAliasing = num;
			this.fleshStencilTexture = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
			this.fleshStencilTexture.antiAliasing = num;
			this.ghostBlurTexture = new RenderTexture(this.width / 2, this.height / 2, 0, RenderTextureFormat.R8);
			this.ghostTexture = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.R8);
			this.ghostTexture.antiAliasing = num;
			this.combinedShadows = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.ARGB32);
			this.scene = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
			this.groups = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.ARGB32);
			this.groups.antiAliasing = num;
			this.groupsMask = new RenderTexture(this.width, this.height, 24, RenderTextureFormat.ARGB32);
			this.groupsMask.antiAliasing = num;
			this.groupsSeparated = new RenderTexture(this.width / 2, this.height / 2, 0, RenderTextureFormat.ARGB32);
			this.blurred2 = new RenderTexture(this.width, this.height, 0, RenderTextureFormat.ARGB32);
		}
		this.UpdateShaderVariables();
		if (Links.x && Links.x.rtsCamera)
		{
			Links.x.rtsCamera.UpdatePerspectiveCameraSize();
		}
	}

	// Token: 0x06000021 RID: 33 RVA: 0x000054E0 File Offset: 0x000036E0
	public void CreateNormalsCamera(bool callbackObject)
	{
		if (false && this.cam)
		{
			GameObject gameObject = null;
			GameObject gameObject2 = null;
			GameObject gameObject3 = null;
			GameObject gameObject4 = null;
			this.GetNormalsCamera(callbackObject, out gameObject, out gameObject3, out gameObject4, out gameObject2);
			if (!gameObject)
			{
				this.normalsCamObj = new GameObject("Normals Camera");
				this.normalsCam = this.normalsCamObj.AddComponent<Camera>();
			}
			else
			{
				this.normalsCamObj = gameObject;
				this.normalsCam = this.normalsCamObj.GetComponent<Camera>();
			}
			this.normalsCamObj.transform.SetParent(this.cam.gameObject.transform);
			this.normalsCamObj.transform.localPosition = Vector3.zero;
			this.normalsCamObj.transform.localRotation = Quaternion.Euler(Vector3.zero);
			this.normalsCam.CopyFrom(this.cam);
			this.normalsCam.orthographic = this.cam.orthographic;
			this.normalsCam.cullingMask = this.cam.cullingMask;
			this.normalsCam.enabled = false;
			this.normalsCam.targetTexture = this.depthNormalsLrgTexture;
			this.normalsCam.depthTextureMode = DepthTextureMode.None;
			this.savedSize = this.normalsCam.orthographicSize;
			this.savedFov = this.normalsCam.fieldOfView;
			this.normalsCam.nearClipPlane = this.cam.nearClipPlane;
			this.normalsCam.farClipPlane = this.cam.farClipPlane;
			this.normalsCam.orthographicSize = this.savedSize * this.lrgTextureMult;
			this.normalsCam.depthTextureMode = DepthTextureMode.None;
			if (!gameObject4)
			{
				this.specularCharacterCamObj = new GameObject("Specular Character Camera");
				this.specularCharacterCam = this.specularCharacterCamObj.AddComponent<Camera>();
			}
			else
			{
				this.specularCharacterCamObj = gameObject4;
				this.specularCharacterCam = this.specularCharacterCamObj.GetComponent<Camera>();
			}
			this.specularCharacterCamObj.transform.SetParent(this.cam.gameObject.transform);
			this.specularCharacterCamObj.transform.localPosition = Vector3.zero;
			this.specularCharacterCamObj.transform.localRotation = Quaternion.Euler(Vector3.zero);
			this.specularCharacterCam.CopyFrom(this.cam);
			this.specularCharacterCam.clearFlags = CameraClearFlags.Color;
			this.specularCharacterCam.backgroundColor = Color.black;
			this.specularCharacterCam.orthographic = this.cam.orthographic;
			this.specularCharacterCam.cullingMask = 1050688;
			this.specularCharacterCam.enabled = false;
			this.specularCharacterCam.targetTexture = this.specularCharacters;
			this.specularCharacterCam.depthTextureMode = DepthTextureMode.None;
			this.specularCharacterCam.nearClipPlane = this.cam.nearClipPlane;
			this.specularCharacterCam.farClipPlane = this.cam.farClipPlane;
		}
	}

	// Token: 0x06000022 RID: 34 RVA: 0x000057C0 File Offset: 0x000039C0
	private void RemoveBuffer()
	{
		if (this.beforeOpaqueBuffer != null)
		{
			this.cam.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, this.beforeOpaqueBuffer);
		}
		this.beforeOpaqueBuffer = null;
		if (this.opaqueBuffer != null)
		{
			this.cam.RemoveCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, this.opaqueBuffer);
		}
		this.opaqueBuffer = null;
		if (this.opaqueBufferTop != null)
		{
			Links.x.rtsCamera.topCam.RemoveCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, this.opaqueBufferTop);
		}
		this.opaqueBufferTop = null;
		if (this.afterImageEffects != null)
		{
			this.cam.RemoveCommandBuffer(CameraEvent.AfterImageEffects, this.afterImageEffects);
		}
		this.afterImageEffects = null;
	}

	// Token: 0x06000023 RID: 35 RVA: 0x00005860 File Offset: 0x00003A60
	private void GetNormalsCamera(bool callbackObject, out GameObject prevNormalsCam, out GameObject prevNormalsCamCharacter, out GameObject prevSpecularCamCharacter, out GameObject prevNormalsNatureCam)
	{
		prevNormalsCam = null;
		prevNormalsCamCharacter = null;
		prevSpecularCamCharacter = null;
		prevNormalsNatureCam = null;
		if (!this.normalsCamObj && this && base.gameObject)
		{
			foreach (object obj in base.gameObject.transform)
			{
				Transform transform = (Transform)obj;
				if (transform)
				{
					if (transform.gameObject.name == "Normals Camera")
					{
						this.normalsCamObj = transform.gameObject;
					}
					if (transform.gameObject.name == "Normals Character Camera")
					{
						this.normalsCharacterCamObj = transform.gameObject;
					}
					if (transform.gameObject.name == "Specular Character Camera")
					{
						this.specularCharacterCamObj = transform.gameObject;
					}
					if (transform.gameObject.name == "Normals Nature Camera")
					{
						prevNormalsNatureCam = transform.gameObject;
					}
				}
			}
		}
		if (this.normalsCamObj)
		{
			prevNormalsCam = this.normalsCamObj;
		}
		if (this.normalsCharacterCamObj)
		{
			prevNormalsCamCharacter = this.normalsCharacterCamObj;
		}
		if (this.specularCharacterCamObj)
		{
			prevSpecularCamCharacter = this.specularCharacterCamObj;
		}
	}

	// Token: 0x06000024 RID: 36 RVA: 0x000059CC File Offset: 0x00003BCC
	public void Dodging(Renderer r, bool adding)
	{
		int num = this.dodges.IndexOf(r);
		if (num == -1 && adding)
		{
			this.dodges.Add(r);
		}
		if (num > -1 && !adding)
		{
			this.dodges.RemoveAt(num);
			this.renderDodge = true;
		}
	}

	// Token: 0x06000025 RID: 37 RVA: 0x00005A14 File Offset: 0x00003C14
	public void Hovering(Renderer r, int type, bool adding)
	{
		int num = this.hovers.IndexOf(r);
		if (num == -1 && adding)
		{
			this.hovers.Add(r);
			this.hoverTypes.Add(type);
		}
		if (num > -1 && !adding)
		{
			this.hovers.RemoveAt(num);
			this.hoverTypes.RemoveAt(num);
		}
	}

	// Token: 0x06000026 RID: 38 RVA: 0x00005A70 File Offset: 0x00003C70
	public void Bubble(Renderer r, int type, bool adding)
	{
		int num = this.bubbles.IndexOf(r);
		if (num == -1 && adding)
		{
			this.bubbles.Add(r);
			this.bubbleTypes.Add(type);
		}
		if (num > -1 && !adding)
		{
			this.bubbles.RemoveAt(num);
			this.bubbleTypes.RemoveAt(num);
		}
	}

	// Token: 0x06000027 RID: 39 RVA: 0x00005ACC File Offset: 0x00003CCC
	public void Combat(Renderer r, int num)
	{
		int num2 = this.combats.IndexOf(r);
		if (num2 == -1 && num > 0)
		{
			this.combats.Add(r);
		}
		if (num2 > -1 && num == 0)
		{
			this.combats.RemoveAt(num2);
		}
	}

	// Token: 0x06000028 RID: 40 RVA: 0x00005B10 File Offset: 0x00003D10
	public void GroupCharacters(Vector3 r, EnemyGroup g, bool state)
	{
		int num = this.groupTiles.IndexOf(r);
		if (num == -1 && state)
		{
			Material material;
			Material material2;
			if (this.openCircleMaterials.Count > 0)
			{
				material = this.openCircleMaterials[0];
				this.openCircleMaterials.RemoveAt(0);
				material2 = this.openCircleMaterialsMask[0];
				this.openCircleMaterialsMask.RemoveAt(0);
			}
			else
			{
				material = new Material(this.groupCircleShader);
				material2 = new Material(this.groupCircleMaskShader);
				material.SetTexture("_MainTex", this.circleTex);
				material2.SetTexture("_MainTex", this.circleTex);
			}
			if (!g)
			{
				material2.SetFloat("_Type", 0f);
				material2.SetFloat("_DoFade", 0f);
				material2.SetFloat("_Fade", 0f);
				material2.SetFloat("_Morale", 1f);
			}
			this.groupTiles.Add(r);
			this.groupID.Add(g);
			this.circleMaterials.Add(material);
			this.circleMaterialsMask.Add(material2);
		}
		if (num > -1 && !state && this.groupID[num] == g)
		{
			Debug.Log("Found tiles to remove " + ((g != null) ? g.ToString() : null));
			this.groupTiles.RemoveAt(num);
			this.groupID.RemoveAt(num);
			this.openCircleMaterials.Add(this.circleMaterials[num]);
			this.circleMaterials.RemoveAt(num);
			this.openCircleMaterialsMask.Add(this.circleMaterialsMask[num]);
			this.circleMaterialsMask.RemoveAt(num);
		}
	}

	// Token: 0x06000029 RID: 41 RVA: 0x00005CC8 File Offset: 0x00003EC8
	public void ClearEnemyGroupTiles(EnemyGroup g)
	{
		bool flag = false;
		for (int i = 0; i < this.groupID.Count; i++)
		{
			if (this.groupID[i] == g)
			{
				this.groupTiles[i] = Vector3.zero;
				this.openCircleMaterials.Add(this.circleMaterials[i]);
				this.circleMaterials[i] = null;
				this.openCircleMaterialsMask.Add(this.circleMaterialsMask[i]);
				this.circleMaterialsMask[i] = null;
				flag = true;
			}
		}
		if (flag)
		{
			this.groupID.RemoveAll((EnemyGroup item) => item == g);
			this.groupTiles.RemoveAll((Vector3 item) => item == Vector3.zero);
			this.circleMaterials.RemoveAll((Material item) => item == null);
			this.circleMaterialsMask.RemoveAll((Material item) => item == null);
		}
	}

	// Token: 0x0600002A RID: 42 RVA: 0x00005E10 File Offset: 0x00004010
	public void ClearPartyGroupTiles()
	{
		bool flag = false;
		for (int i = 0; i < this.groupID.Count; i++)
		{
			if (this.groupID[i] == null)
			{
				this.groupTiles[i] = Vector3.zero;
				this.openCircleMaterials.Add(this.circleMaterials[i]);
				this.circleMaterials[i] = null;
				this.openCircleMaterialsMask.Add(this.circleMaterialsMask[i]);
				this.circleMaterialsMask[i] = null;
				flag = true;
			}
		}
		if (flag)
		{
			this.groupID.RemoveAll((EnemyGroup item) => item == null);
			this.groupTiles.RemoveAll((Vector3 item) => item == Vector3.zero);
			this.circleMaterials.RemoveAll((Material item) => item == null);
			this.circleMaterialsMask.RemoveAll((Material item) => item == null);
		}
	}

	// Token: 0x0600002B RID: 43 RVA: 0x00005F5C File Offset: 0x0000415C
	public void AddRemoveDoor(MeshRenderer r, bool adding)
	{
		int num = this.doors.IndexOf(r);
		if (num == -1 && adding)
		{
			this.doors.Add(r);
		}
		if (num > -1 && !adding)
		{
			this.doors.RemoveAt(num);
		}
	}

	// Token: 0x0600002C RID: 44 RVA: 0x00005FA0 File Offset: 0x000041A0
	public void AddRemoveGhost(Renderer r, bool adding)
	{
		int num = this.ghosts.IndexOf(r);
		if (num == -1 && adding)
		{
			this.ghosts.Add(r);
		}
		if (num > -1 && !adding)
		{
			this.ghosts.RemoveAt(num);
		}
	}

	// Token: 0x0600002D RID: 45 RVA: 0x00005FE1 File Offset: 0x000041E1
	public void AddFog(MeshRenderer r)
	{
		if (this.incenseFog.IndexOf(r) == -1 && r)
		{
			this.incenseFog.Add(r);
			this.incenseFogTransforms.Add(r.gameObject.transform);
		}
	}

	// Token: 0x0600002E RID: 46 RVA: 0x0000601C File Offset: 0x0000421C
	public void RemoveFog(MeshRenderer r)
	{
		int num = this.incenseFog.IndexOf(r);
		if (num > -1)
		{
			this.incenseFog.RemoveAt(num);
			this.incenseFogTransforms.RemoveAt(num);
		}
	}

	// Token: 0x0600002F RID: 47 RVA: 0x00006052 File Offset: 0x00004252
	public void SetFog()
	{
		if (!this.cam)
		{
			this.cam = base.gameObject.GetComponent<Camera>();
		}
	}

	// Token: 0x06000030 RID: 48 RVA: 0x00006072 File Offset: 0x00004272
	public void ChangeDomeState(bool on)
	{
		Links.x.domeRenderer.gameObject.transform.parent.gameObject.SetActive(on);
	}

	// Token: 0x06000031 RID: 49 RVA: 0x00006098 File Offset: 0x00004298
	public void EndPocket()
	{
		if (this.combatFX > 0f)
		{
			this.combatTime = 0f;
		}
	}

	// Token: 0x06000032 RID: 50 RVA: 0x000060B2 File Offset: 0x000042B2
	public void RemoveCombatCharacters()
	{
		this.combats.Clear();
	}

	// Token: 0x06000033 RID: 51 RVA: 0x000060C0 File Offset: 0x000042C0
	public void Capture(string savename)
	{
		LayerMask layerMask = this.cam.cullingMask;
		RenderTexture targetTexture = this.cam.targetTexture;
		int num = (int)this.cam.pixelRect.width;
		int num2 = (int)this.cam.pixelRect.height;
		int num3 = (int)this.cam.pixelRect.width;
		int num4 = (int)this.cam.pixelRect.height;
		float num5 = (float)num;
		RenderTexture renderTexture = new RenderTexture(num, num2, 24);
		this.cam.targetTexture = renderTexture;
		Texture2D texture2D = new Texture2D(num3, num4, TextureFormat.RGB24, false);
		this.cam.cullingMask = -2147418027;
		this.tempGhosts.Clear();
		for (int i = 0; i < this.ghosts.Count; i++)
		{
			if (this.ghosts[i] && !this.ghosts[i].enabled && this.ghosts[i].gameObject.activeSelf)
			{
				this.tempGhosts.Add(this.ghosts[i].gameObject);
				this.ghosts[i].gameObject.SetActive(false);
			}
		}
		this.noCircle = true;
		this.cam.Render();
		this.noCircle = false;
		RenderTexture.active = renderTexture;
		texture2D.ReadPixels(new Rect(0f, 0f, (float)num3, (float)num4), 0, 0);
		this.cam.targetTexture = targetTexture;
		this.cam.cullingMask = layerMask;
		RenderTexture.active = null;
		Object.Destroy(renderTexture);
		Texture2D texture2D2 = this.ScaleTexture(texture2D, 960, 540);
		byte[] array = texture2D2.EncodeToPNG();
		File.WriteAllBytes(Application.persistentDataPath + "/" + savename + ".png", array);
		for (int j = 0; j < this.tempGhosts.Count; j++)
		{
			this.tempGhosts[j].gameObject.SetActive(true);
		}
		Object.Destroy(texture2D);
		Object.Destroy(texture2D2);
		this.noCircle = false;
	}

	// Token: 0x06000034 RID: 52 RVA: 0x00006304 File Offset: 0x00004504
	private Texture2D ScaleTexture(Texture2D source, int targetWidth, int targetHeight)
	{
		Texture2D texture2D = new Texture2D(targetWidth, targetHeight, source.format, true);
		Color[] pixels = texture2D.GetPixels(0);
		float num = 1f / (float)source.width * ((float)source.width / (float)targetWidth);
		float num2 = 1f / (float)source.height * ((float)source.height / (float)targetHeight);
		for (int i = 0; i < pixels.Length; i++)
		{
			pixels[i] = source.GetPixelBilinear(num * ((float)i % (float)targetWidth), num2 * Mathf.Floor((float)(i / targetWidth)));
		}
		texture2D.SetPixels(pixels, 0);
		texture2D.Apply();
		return texture2D;
	}

	// Token: 0x06000035 RID: 53 RVA: 0x0000639E File Offset: 0x0000459E
	public void AddMoonlight(Light l)
	{
		if (this.moonlights.IndexOf(l) == -1)
		{
			this.moonlights.Add(l);
		}
	}

	// Token: 0x06000036 RID: 54 RVA: 0x000063BC File Offset: 0x000045BC
	public void RemoveMoonlight(Light l)
	{
		int num = this.moonlights.IndexOf(l);
		if (num > -1)
		{
			this.moonlights.RemoveAt(num);
		}
	}

	// Token: 0x06000037 RID: 55 RVA: 0x000063E8 File Offset: 0x000045E8
	public bool TestPlanesAABBInternalFastBounds(Vector3 boundsMin, Vector3 boundsMax)
	{
		for (int i = 0; i < this.planes.Length; i++)
		{
			Vector3 normal = this.planes[i].normal;
			float distance = this.planes[i].distance;
			Vector3 vector;
			Vector3 vector2;
			if (normal.x < 0f)
			{
				vector.x = boundsMin.x;
				vector2.x = boundsMax.x;
			}
			else
			{
				vector.x = boundsMax.x;
				vector2.x = boundsMin.x;
			}
			if (normal.y < 0f)
			{
				vector.y = boundsMin.y;
				vector2.y = boundsMax.y;
			}
			else
			{
				vector.y = boundsMax.y;
				vector2.y = boundsMin.y;
			}
			if (normal.z < 0f)
			{
				vector.z = boundsMin.z;
				vector2.z = boundsMax.z;
			}
			else
			{
				vector.z = boundsMax.z;
				vector2.z = boundsMin.z;
			}
			if (normal.x * vector.x + normal.y * vector.y + normal.z * vector.z + distance < 0f)
			{
				return false;
			}
		}
		return true;
	}

	// Token: 0x06000038 RID: 56 RVA: 0x00006534 File Offset: 0x00004734
	public bool TestPlanesAABBInternalFast(Vector3 pt, float radius)
	{
		for (int i = 0; i < this.planes.Length; i++)
		{
			Vector3 normal = this.planes[i].normal;
			float distance = this.planes[i].distance;
			Vector3 vector;
			Vector3 vector2;
			if (normal.x < 0f)
			{
				vector.x = pt.x - radius;
				vector2.x = pt.x + radius;
			}
			else
			{
				vector.x = pt.x + radius;
				vector2.x = pt.x - radius;
			}
			if (normal.y < 0f)
			{
				vector.y = pt.y - radius;
				vector2.y = pt.y + radius;
			}
			else
			{
				vector.y = pt.y + radius;
				vector2.y = pt.y - radius;
			}
			if (normal.z < 0f)
			{
				vector.z = pt.z - radius;
				vector2.z = pt.z + radius;
			}
			else
			{
				vector.z = pt.z + radius;
				vector2.z = pt.z - radius;
			}
			if (normal.x * vector.x + normal.y * vector.y + normal.z * vector.z + distance < 0f)
			{
				return false;
			}
		}
		return true;
	}

	// Token: 0x06000039 RID: 57 RVA: 0x00006696 File Offset: 0x00004896
	public void PlayAnimation(string anim)
	{
		this.cameraAnimator.enabled = true;
		this.cameraAnimator.Play(anim);
	}

	// Token: 0x04000034 RID: 52
	[Header("SETTINGS")]
	public Mesh quadMesh;

	// Token: 0x04000035 RID: 53
	public Transform followObject;

	// Token: 0x04000036 RID: 54
	public float partyLightRange;

	// Token: 0x04000037 RID: 55
	public Color shadowColor;

	// Token: 0x04000038 RID: 56
	public Color partyLightColor;

	// Token: 0x04000039 RID: 57
	public Color morningColor;

	// Token: 0x0400003A RID: 58
	public Color afternoonColor;

	// Token: 0x0400003B RID: 59
	public Color eveningColor;

	// Token: 0x0400003C RID: 60
	public Color nightColor;

	// Token: 0x0400003D RID: 61
	public Color fogMorningColor;

	// Token: 0x0400003E RID: 62
	public Color fogAfternoonColor;

	// Token: 0x0400003F RID: 63
	public Color fogEveningColor;

	// Token: 0x04000040 RID: 64
	public Color fogNightColor;

	// Token: 0x04000041 RID: 65
	public Color blueFogColor;

	// Token: 0x04000042 RID: 66
	public float lrgTextureMult = 1.1f;

	// Token: 0x04000043 RID: 67
	public float perspectiveLightScale;

	// Token: 0x04000044 RID: 68
	public float orthoLightScale;

	// Token: 0x04000045 RID: 69
	public bool indoors;

	// Token: 0x04000046 RID: 70
	private uint graphIndex;

	// Token: 0x04000047 RID: 71
	private float unscaledTime;

	// Token: 0x04000048 RID: 72
	public float vignette = 0.35f;

	// Token: 0x04000049 RID: 73
	private float pocketAlpha;

	// Token: 0x0400004A RID: 74
	[Header("LISTS")]
	public List<Light> moonlights = new List<Light>();

	// Token: 0x0400004B RID: 75
	private List<Character> partyCharacters;

	// Token: 0x0400004C RID: 76
	public List<Renderer> hovers = new List<Renderer>();

	// Token: 0x0400004D RID: 77
	public List<int> hoverTypes = new List<int>();

	// Token: 0x0400004E RID: 78
	public List<Renderer> bubbles = new List<Renderer>();

	// Token: 0x0400004F RID: 79
	public List<int> bubbleTypes = new List<int>();

	// Token: 0x04000050 RID: 80
	public List<Renderer> dodges = new List<Renderer>();

	// Token: 0x04000051 RID: 81
	private List<Culling> quads;

	// Token: 0x04000052 RID: 82
	public List<Material> shadowMaterials = new List<Material>();

	// Token: 0x04000053 RID: 83
	private List<Character> hoverCharacters;

	// Token: 0x04000054 RID: 84
	private List<Renderer> fleshRenderers;

	// Token: 0x04000055 RID: 85
	public List<Renderer> combats = new List<Renderer>();

	// Token: 0x04000056 RID: 86
	public List<Vector3> groupTiles = new List<Vector3>();

	// Token: 0x04000057 RID: 87
	public List<EnemyGroup> groupID = new List<EnemyGroup>();

	// Token: 0x04000058 RID: 88
	public List<MeshRenderer> doors = new List<MeshRenderer>();

	// Token: 0x04000059 RID: 89
	public List<Renderer> ghosts = new List<Renderer>();

	// Token: 0x0400005A RID: 90
	public List<MeshRenderer> incenseFog = new List<MeshRenderer>();

	// Token: 0x0400005B RID: 91
	private List<Transform> incenseFogTransforms = new List<Transform>();

	// Token: 0x0400005C RID: 92
	private Material[] mats;

	// Token: 0x0400005D RID: 93
	[Header("MISC")]
	public Material moonlightMaterial;

	// Token: 0x0400005E RID: 94
	public Material blurMaterial;

	// Token: 0x0400005F RID: 95
	public Material foamMaterial;

	// Token: 0x04000060 RID: 96
	public Material groupMaterial;

	// Token: 0x04000061 RID: 97
	public Material outlineShaderMaterial;

	// Token: 0x04000062 RID: 98
	private Material doorMaterial;

	// Token: 0x04000063 RID: 99
	private Material incenseMaterial;

	// Token: 0x04000064 RID: 100
	private Material depthBackgroundsMaterial;

	// Token: 0x04000065 RID: 101
	private Material shadowMaterial;

	// Token: 0x04000066 RID: 102
	public PointLightShadows pointLightShadows;

	// Token: 0x04000067 RID: 103
	public Texture noiseTexture;

	// Token: 0x04000068 RID: 104
	public Texture paintTexture;

	// Token: 0x04000069 RID: 105
	public Animator cameraAnimator;

	// Token: 0x0400006A RID: 106
	public float Strength = 0.6f;

	// Token: 0x0400006B RID: 107
	public float Clamp = 0.05f;

	// Token: 0x0400006C RID: 108
	private bool currentFog;

	// Token: 0x0400006D RID: 109
	private Material[] materials;

	// Token: 0x0400006E RID: 110
	public float combatTime;

	// Token: 0x0400006F RID: 111
	public float combatFX;

	// Token: 0x04000070 RID: 112
	private bool removingPocket;

	// Token: 0x04000071 RID: 113
	public bool mainCharacterInSheen;

	// Token: 0x04000072 RID: 114
	public ShadowCaster shadowCaster;

	// Token: 0x04000073 RID: 115
	private float _x;

	// Token: 0x04000074 RID: 116
	private float _y;

	// Token: 0x04000075 RID: 117
	private float _z;

	// Token: 0x04000076 RID: 118
	public Shader moonlightShader;

	// Token: 0x04000077 RID: 119
	public Shader doorShader;

	// Token: 0x04000078 RID: 120
	public Shader characterShader;

	// Token: 0x04000079 RID: 121
	public Shader sceneMapFog;

	// Token: 0x0400007A RID: 122
	public Shader characterDepthShader;

	// Token: 0x0400007B RID: 123
	public Shader combineShadowShader;

	// Token: 0x0400007C RID: 124
	public Character followCharacter;

	// Token: 0x0400007D RID: 125
	public bool transitioning;

	// Token: 0x0400007E RID: 126
	public Animator gameFade;

	// Token: 0x0400007F RID: 127
	private float dodgeUpdateTime;

	// Token: 0x04000080 RID: 128
	private Vector2 dodge;

	// Token: 0x04000081 RID: 129
	private bool renderDodge;

	// Token: 0x04000082 RID: 130
	private float seed;

	// Token: 0x04000083 RID: 131
	public float sharpStrength;

	// Token: 0x04000084 RID: 132
	public float sharpClamp;

	// Token: 0x04000085 RID: 133
	public OutlineEffect outlineEffect;

	// Token: 0x04000086 RID: 134
	public Obscurance obscurance;

	// Token: 0x04000087 RID: 135
	public AntiAliasing aa;

	// Token: 0x04000088 RID: 136
	public Texture sparkleTexture;

	// Token: 0x04000089 RID: 137
	public float sparkleTextureScale;

	// Token: 0x0400008A RID: 138
	public BrightnessContrastGamma bcg;

	// Token: 0x0400008B RID: 139
	public NGSS_FrustumShadows ngss;

	// Token: 0x0400008C RID: 140
	public BlurOptimized blur;

	// Token: 0x0400008D RID: 141
	private Matrix4x4 tileMatrix;

	// Token: 0x0400008E RID: 142
	public Mesh tileMesh;

	// Token: 0x0400008F RID: 143
	public Shader groupCircleShader;

	// Token: 0x04000090 RID: 144
	public Shader groupCircleMaskShader;

	// Token: 0x04000091 RID: 145
	public Texture circleTex;

	// Token: 0x04000092 RID: 146
	public List<Material> openCircleMaterials = new List<Material>();

	// Token: 0x04000093 RID: 147
	public List<Material> circleMaterials = new List<Material>();

	// Token: 0x04000094 RID: 148
	public List<Material> openCircleMaterialsMask = new List<Material>();

	// Token: 0x04000095 RID: 149
	public List<Material> circleMaterialsMask = new List<Material>();

	// Token: 0x04000096 RID: 150
	private List<GameObject> tempGhosts = new List<GameObject>();

	// Token: 0x04000097 RID: 151
	[Header("WATERCOLOR")]
	public Texture2D blotches;

	// Token: 0x04000098 RID: 152
	public Texture2D blotchesIntense;

	// Token: 0x04000099 RID: 153
	public Texture2D detail;

	// Token: 0x0400009A RID: 154
	public Texture2D paper;

	// Token: 0x0400009B RID: 155
	public Texture2D ramp;

	// Token: 0x0400009C RID: 156
	public Texture2D rampCircle;

	// Token: 0x0400009D RID: 157
	public Texture2D rampCircleStamina;

	// Token: 0x0400009E RID: 158
	public Texture2D rampCircleSwarm;

	// Token: 0x0400009F RID: 159
	public Texture2D ghostNoise;

	// Token: 0x040000A0 RID: 160
	public Texture2D ghostFilter;

	// Token: 0x040000A1 RID: 161
	public Texture2D ghostFog;

	// Token: 0x040000A2 RID: 162
	public Color color;

	// Token: 0x040000A3 RID: 163
	public Color color2;

	// Token: 0x040000A4 RID: 164
	public Color inkColor;

	// Token: 0x040000A5 RID: 165
	public float tintScale;

	// Token: 0x040000A6 RID: 166
	public float paperStrength;

	// Token: 0x040000A7 RID: 167
	public float blotchMultiply;

	// Token: 0x040000A8 RID: 168
	public float blotchSubtract;

	// Token: 0x040000A9 RID: 169
	public Texture2D blotchesIncense;

	// Token: 0x040000AA RID: 170
	public Color colorIncense;

	// Token: 0x040000AB RID: 171
	public Color color2Incense;

	// Token: 0x040000AC RID: 172
	public Color inkColorIncense;

	// Token: 0x040000AD RID: 173
	public float blotchMultiplyIncense;

	// Token: 0x040000AE RID: 174
	public float blotchSubtractIncense;

	// Token: 0x040000AF RID: 175
	[Header("LIGHTING")]
	public Light sunlight;

	// Token: 0x040000B0 RID: 176
	public Light shadowEnvironment;

	// Token: 0x040000B1 RID: 177
	public Light cozyLight;

	// Token: 0x040000B2 RID: 178
	public Light moon;

	// Token: 0x040000B3 RID: 179
	public GameObject shadowCharacters;

	// Token: 0x040000B4 RID: 180
	public GameObject moonObject;

	// Token: 0x040000B5 RID: 181
	public bool usesTimeOfDay;

	// Token: 0x040000B6 RID: 182
	public bool hasDirectionalLight;

	// Token: 0x040000B7 RID: 183
	public bool timeTransition;

	// Token: 0x040000B8 RID: 184
	public bool updateTimeOfDay;

	// Token: 0x040000B9 RID: 185
	private bool nightLerp1;

	// Token: 0x040000BA RID: 186
	private Color transitionColorTo;

	// Token: 0x040000BB RID: 187
	private Color transitionColorFrom;

	// Token: 0x040000BC RID: 188
	private Color transitionFogTo;

	// Token: 0x040000BD RID: 189
	private Color transitionFogFrom;

	// Token: 0x040000BE RID: 190
	private Quaternion lightDirectionFrom;

	// Token: 0x040000BF RID: 191
	private Quaternion lightDirectionTo;

	// Token: 0x040000C0 RID: 192
	private float time;

	// Token: 0x040000C1 RID: 193
	private float nightTime;

	// Token: 0x040000C2 RID: 194
	public bool immediateTransition;

	// Token: 0x040000C3 RID: 195
	public bool updatingFog;

	// Token: 0x040000C4 RID: 196
	public Shader collectShadowMaps;

	// Token: 0x040000C5 RID: 197
	[Header("CHARACTER LIGHTING")]
	public float characterRampThreshold;

	// Token: 0x040000C6 RID: 198
	public float characterRampSmoothness;

	// Token: 0x040000C7 RID: 199
	public float characterSpecSmooth;

	// Token: 0x040000C8 RID: 200
	public float characterSpecBlend;

	// Token: 0x040000C9 RID: 201
	public float characterRimMin;

	// Token: 0x040000CA RID: 202
	public float characterRimMax;

	// Token: 0x040000CB RID: 203
	public float characterRimStrength;

	// Token: 0x040000CC RID: 204
	public Color characterHighlightColor;

	// Token: 0x040000CD RID: 205
	public Color characterShadowColor;

	// Token: 0x040000CE RID: 206
	[Header("ENVIRONMENT LIGHTING")]
	public float enviroRampThreshold;

	// Token: 0x040000CF RID: 207
	public float enviroRampSmoothness;

	// Token: 0x040000D0 RID: 208
	public float enviroSpecSmooth;

	// Token: 0x040000D1 RID: 209
	public float enviroSpecBlend;

	// Token: 0x040000D2 RID: 210
	public float enviroRimMin;

	// Token: 0x040000D3 RID: 211
	public float enviroRimMax;

	// Token: 0x040000D4 RID: 212
	public float enviroRimStrength;

	// Token: 0x040000D5 RID: 213
	public Color enviroHighlightColor;

	// Token: 0x040000D6 RID: 214
	public Color enviroShadowColor;

	// Token: 0x040000D7 RID: 215
	[Header("FILTER")]
	public Texture LookupTexture;

	// Token: 0x040000D8 RID: 216
	[Range(0f, 1f)]
	[Tooltip("Blending factor.")]
	public float LookupTextureAmount = 1f;

	// Token: 0x040000D9 RID: 217
	public Texture LookupTexture2;

	// Token: 0x040000DA RID: 218
	[Range(0f, 1f)]
	[Tooltip("Blending factor.")]
	public float LookupTextureAmount2 = 1f;

	// Token: 0x040000DB RID: 219
	[Header("DEBUGGING")]
	public RenderTexture depthNormalsLrgTexture;

	// Token: 0x040000DC RID: 220
	public RenderTexture depthNormalsCharacters;

	// Token: 0x040000DD RID: 221
	public RenderTexture specularCharacters;

	// Token: 0x040000DE RID: 222
	public RenderTexture depthNormalsTexture;

	// Token: 0x040000DF RID: 223
	public RenderTexture moonlightTexture;

	// Token: 0x040000E0 RID: 224
	public RenderTexture albedoTexture;

	// Token: 0x040000E1 RID: 225
	public RenderTexture moonlightShadowTexture;

	// Token: 0x040000E2 RID: 226
	public RenderTexture fleshStencilTexture;

	// Token: 0x040000E3 RID: 227
	public RenderTexture hoverTexture;

	// Token: 0x040000E4 RID: 228
	public RenderTexture bakedShadowCombinedTexture;

	// Token: 0x040000E5 RID: 229
	public RenderTexture collisionCharacters;

	// Token: 0x040000E6 RID: 230
	public RenderTexture combatCharacterTexture;

	// Token: 0x040000E7 RID: 231
	public RenderTexture lightTexture;

	// Token: 0x040000E8 RID: 232
	public RenderTexture lightInteriorTexture;

	// Token: 0x040000E9 RID: 233
	public RenderTexture doorTexture;

	// Token: 0x040000EA RID: 234
	public RenderTexture doorBlurTexture;

	// Token: 0x040000EB RID: 235
	public RenderTexture ghostTexture;

	// Token: 0x040000EC RID: 236
	public RenderTexture ghostBlurTexture;

	// Token: 0x040000ED RID: 237
	public RenderTexture fowTexture;

	// Token: 0x040000EE RID: 238
	public RenderTexture fowInteriorTexture;

	// Token: 0x040000EF RID: 239
	public RenderTexture combinedShadows;

	// Token: 0x040000F0 RID: 240
	public RenderTexture scene;

	// Token: 0x040000F1 RID: 241
	public RenderTexture groups;

	// Token: 0x040000F2 RID: 242
	public RenderTexture groupsMask;

	// Token: 0x040000F3 RID: 243
	public RenderTexture groupsSeparated;

	// Token: 0x040000F4 RID: 244
	public RenderTexture blurred2;

	// Token: 0x040000F5 RID: 245
	public Texture2D characters2D;

	// Token: 0x040000F6 RID: 246
	private RenderTexture characterDepthTexture;

	// Token: 0x040000F7 RID: 247
	private CommandBuffer beforeOpaqueBuffer;

	// Token: 0x040000F8 RID: 248
	private CommandBuffer opaqueBuffer;

	// Token: 0x040000F9 RID: 249
	private CommandBuffer afterImageEffects;

	// Token: 0x040000FA RID: 250
	private CommandBuffer opaqueBufferTop;

	// Token: 0x040000FB RID: 251
	private Material depthMaterial;

	// Token: 0x040000FC RID: 252
	private Material fleshStencilMaterial;

	// Token: 0x040000FD RID: 253
	private int width;

	// Token: 0x040000FE RID: 254
	private int height;

	// Token: 0x040000FF RID: 255
	private float savedSize;

	// Token: 0x04000100 RID: 256
	private float phase;

	// Token: 0x04000101 RID: 257
	private float savedFov;

	// Token: 0x04000102 RID: 258
	private Matrix4x4 matrix;

	// Token: 0x04000103 RID: 259
	private Camera cam;

	// Token: 0x04000104 RID: 260
	private Camera normalsCam;

	// Token: 0x04000105 RID: 261
	private Camera normalsCharacterCam;

	// Token: 0x04000106 RID: 262
	private Camera specularCharacterCam;

	// Token: 0x04000107 RID: 263
	private GameObject normalsCamObj;

	// Token: 0x04000108 RID: 264
	private GameObject normalsCharacterCamObj;

	// Token: 0x04000109 RID: 265
	private GameObject specularCharacterCamObj;

	// Token: 0x0400010A RID: 266
	private bool savedInterior;

	// Token: 0x0400010B RID: 267
	private Mesh screenQuad;

	// Token: 0x0400010C RID: 268
	private Vector3 v;

	// Token: 0x0400010D RID: 269
	private Plane[] planes = new Plane[0];

	// Token: 0x0400010E RID: 270
	private Transform depthOfFieldTarget;

	// Token: 0x0400010F RID: 271
	private Transform depthOfFieldFollow;

	// Token: 0x04000110 RID: 272
	public GlobalKeyword interiorKeyword;

	// Token: 0x04000111 RID: 273
	public GlobalKeyword doorKeyword;

	// Token: 0x04000112 RID: 274
	public GlobalKeyword exteriorKeyword;

	// Token: 0x04000113 RID: 275
	public bool noCircle;
}
