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

namespace Obi
{
	// Token: 0x02000489 RID: 1161
	[Token(Token = "0x2000489")]
	public class ShadowmapExposer : MonoBehaviour
	{
		// Token: 0x06002923 RID: 10531 RVA: 0x0005A618 File Offset: 0x00058818
		[Token(Token = "0x6002923")]
		[Address(RVA = "0x11F11C0", Offset = "0x11EFFC0", VA = "0x1811F11C0")]
		public void Awake()
		{
			/*
An exception occurred when decompiling this method (06002923)

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: 0x06002924 RID: 10532 RVA: 0x0005A634 File Offset: 0x00058834
		[Token(Token = "0x6002924")]
		[Address(RVA = "0x11F1260", Offset = "0x11F0060", VA = "0x1811F1260")]
		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: 0x06002925 RID: 10533 RVA: 0x0005A69C File Offset: 0x0005889C
		[Token(Token = "0x6002925")]
		[Address(RVA = "0x11F1210", Offset = "0x11F0010", VA = "0x1811F1210")]
		public void OnDisable()
		{
			CommandBuffer commandBuffer = this.afterShadow;
			if (commandBuffer != 0)
			{
				this.light.RemoveCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer);
			}
		}

		// Token: 0x06002926 RID: 10534 RVA: 0x0005A6C8 File Offset: 0x000588C8
		[Token(Token = "0x6002926")]
		[Address(RVA = "0x11F1210", Offset = "0x11F0010", VA = "0x1811F1210")]
		private void Cleanup()
		{
			CommandBuffer commandBuffer = this.afterShadow;
			if (commandBuffer != 0)
			{
				this.light.RemoveCommandBuffer(LightEvent.AfterShadowMapPass, commandBuffer);
			}
		}

		// Token: 0x06002927 RID: 10535 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002927")]
		[Address(RVA = "0x11F1340", Offset = "0x11F0140", VA = "0x1811F1340")]
		public void SetupFluidShadowsCommandBuffer()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002928 RID: 10536 RVA: 0x0005A6F4 File Offset: 0x000588F4
		[Token(Token = "0x6002928")]
		[Address(RVA = "0x11F15B0", Offset = "0x11F03B0", VA = "0x1811F15B0")]
		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: 0x06002929 RID: 10537 RVA: 0x0005A764 File Offset: 0x00058964
		[Token(Token = "0x6002929")]
		[Address(RVA = "0x3088F0", Offset = "0x3076F0", VA = "0x1803088F0")]
		public ShadowmapExposer()
		{
		}

		// Token: 0x04003272 RID: 12914
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003272")]
		private Light light;

		// Token: 0x04003273 RID: 12915
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003273")]
		private CommandBuffer afterShadow;

		// Token: 0x04003274 RID: 12916
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003274")]
		public ObiParticleRenderer[] particleRenderers;
	}
}
