using System;
using Cpp2IlInjected;
using UnityEngine;
using UnityEngine.Rendering;

namespace Obi
{
	// Token: 0x020004E1 RID: 1249
	[Token(Token = "0x20004E1")]
	public class ShadowmapExposer : MonoBehaviour
	{
		// Token: 0x06002BEC RID: 11244 RVA: 0x000619BC File Offset: 0x0005FBBC
		[Token(Token = "0x6002BEC")]
		[Address(RVA = "0x1792130", Offset = "0x1791130", VA = "0x181792130")]
		public void Awake()
		{
			/*
An exception occurred when decompiling this method (06002BEC)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void Obi.ShadowmapExposer::Awake()

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	stloc:Light(var_0_06, call:Light(Component::GetComponent, ldloc:ShadowmapExposer[exp:Component](this))); 	stfld:Light(ShadowmapExposer::light, ldloc:ShadowmapExposer(this), ldloc:Light(var_0_06)); }; 
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1810
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 344
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
		}

		// Token: 0x06002BED RID: 11245 RVA: 0x000619D8 File Offset: 0x0005FBD8
		[Token(Token = "0x6002BED")]
		[Address(RVA = "0x17921D0", Offset = "0x17911D0", VA = "0x1817921D0")]
		public void OnEnable()
		{
			CommandBuffer commandBuffer = this.afterShadow;
			if (commandBuffer != 0)
			{
				this.light.RemoveCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer);
				this.afterShadow = (ulong)0L;
			}
			CommandBuffer commandBuffer2 = new CommandBuffer();
			this.afterShadow = commandBuffer2;
			this.afterShadow.name = "FluidShadows";
			Light light = this.light;
			CommandBuffer commandBuffer3 = this.afterShadow;
			light.AddCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer3);
		}

		// Token: 0x06002BEE RID: 11246 RVA: 0x00061A40 File Offset: 0x0005FC40
		[Token(Token = "0x6002BEE")]
		[Address(RVA = "0x1792180", Offset = "0x1791180", VA = "0x181792180")]
		public void OnDisable()
		{
			CommandBuffer commandBuffer = this.afterShadow;
			if (commandBuffer != 0)
			{
				this.light.RemoveCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer);
			}
		}

		// Token: 0x06002BEF RID: 11247 RVA: 0x00061A6C File Offset: 0x0005FC6C
		[Token(Token = "0x6002BEF")]
		[Address(RVA = "0x1792180", Offset = "0x1791180", VA = "0x181792180")]
		private void Cleanup()
		{
			CommandBuffer commandBuffer = this.afterShadow;
			if (commandBuffer != 0)
			{
				this.light.RemoveCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer);
			}
		}

		// Token: 0x06002BF0 RID: 11248 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BF0")]
		[Address(RVA = "0x17922B0", Offset = "0x17912B0", VA = "0x1817922B0")]
		public void SetupFluidShadowsCommandBuffer()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BF1 RID: 11249 RVA: 0x00061A98 File Offset: 0x0005FC98
		[Token(Token = "0x6002BF1")]
		[Address(RVA = "0x1792520", Offset = "0x1791520", VA = "0x181792520")]
		private void Update()
		{
			if (base.gameObject.activeInHierarchy && base.enabled)
			{
				ObiParticleRenderer[] array = this.particleRenderers;
				if (array != 0 && array.Length != 0)
				{
					if (this.afterShadow != (ulong)0L)
					{
						this.SetupFluidShadowsCommandBuffer();
					}
					return;
				}
			}
			CommandBuffer commandBuffer = this.afterShadow;
			while (commandBuffer == 0)
			{
			}
			this.light.RemoveCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer);
			this.afterShadow = (ulong)0L;
			throw new NullReferenceException();
		}

		// Token: 0x06002BF2 RID: 11250 RVA: 0x00061B08 File Offset: 0x0005FD08
		[Token(Token = "0x6002BF2")]
		[Address(RVA = "0x328C40", Offset = "0x327C40", VA = "0x180328C40")]
		public ShadowmapExposer()
		{
		}

		// Token: 0x0400355C RID: 13660
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x400355C")]
		private Light light;

		// Token: 0x0400355D RID: 13661
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x400355D")]
		private CommandBuffer afterShadow;

		// Token: 0x0400355E RID: 13662
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x400355E")]
		public ObiParticleRenderer[] particleRenderers;
	}
}
