using System;
using Cpp2IlInjected;
using UnityEngine;

namespace XftWeapon
{
	// Token: 0x02000380 RID: 896
	[Token(Token = "0x2000380")]
	public class VertexPool
	{
		// Token: 0x170001E1 RID: 481
		// (get) Token: 0x060021F5 RID: 8693 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x170001E1")]
		public Mesh MyMesh
		{
			[Token(Token = "0x60021F5")]
			[Address(RVA = "0x8C7840", Offset = "0x8C6640", VA = "0x1808C7840")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x060021F6 RID: 8694 RVA: 0x0004EF90 File Offset: 0x0004D190
		[Token(Token = "0x60021F6")]
		[Address(RVA = "0x8C75C0", Offset = "0x8C63C0", VA = "0x1808C75C0")]
		public void RecalculateBounds()
		{
			this.MyMesh.RecalculateBounds();
		}

		// Token: 0x060021F7 RID: 8695 RVA: 0x0004EFB0 File Offset: 0x0004D1B0
		[Token(Token = "0x60021F7")]
		[Address(RVA = "0x8C75F0", Offset = "0x8C63F0", VA = "0x1808C75F0")]
		public void SetMeshObjectActive(bool flag)
		{
			MeshFilter meshFilter = this._meshFilter;
			int num = 0;
			if (!(meshFilter == num))
			{
				this._meshFilter.gameObject.SetActive(flag);
			}
		}

		// Token: 0x060021F8 RID: 8696 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60021F8")]
		[Address(RVA = "0x8C6B10", Offset = "0x8C5910", VA = "0x1808C6B10")]
		private void CreateMeshObj(XWeaponTrail owner, Material material)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060021F9 RID: 8697 RVA: 0x0004EFE8 File Offset: 0x0004D1E8
		[Token(Token = "0x60021F9")]
		[Address(RVA = "0x8C6E90", Offset = "0x8C5C90", VA = "0x1808C6E90")]
		public void Destroy()
		{
			if (!this._owner.UseWith2D)
			{
				UnityEngine.Object.DestroyImmediate(this._mesh2d);
				return;
			}
			MeshFilter meshFilter = this._meshFilter;
			int num = 0;
			if (meshFilter != num)
			{
				UnityEngine.Object.Destroy(this._meshFilter.gameObject);
				return;
			}
		}

		// Token: 0x060021FA RID: 8698 RVA: 0x0004F03C File Offset: 0x0004D23C
		[Token(Token = "0x60021FA")]
		[Address(RVA = "0x8C7690", Offset = "0x8C6490", VA = "0x1808C7690")]
		public VertexPool(Material material, XWeaponTrail owner)
		{
			int num = 0;
			this._owner = owner;
			this.VertexTotal = num;
			this.VertCountChanged = num != 0;
			if (!owner.UseWith2D)
			{
				Mesh mesh = new Mesh();
				this._mesh2d = mesh;
			}
			this.CreateMeshObj(owner, material);
			this._material = material;
			Vector3[] array = new Vector3[4];
			this.Vertices = array;
			Vector2[] array2 = new Vector2[4];
			this.UVs = array2;
			Color[] array3 = new Color[4];
			this.Colors = array3;
			int[] array4 = new int[6];
			this.Indices = array4;
			this.VertexTotal = (int)((ulong)4L);
			this.IndexTotal = (int)((ulong)6L);
			this.ColorChanged = true;
			this.IndiceChanged = true;
		}

		// Token: 0x060021FB RID: 8699 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60021FB")]
		[Address(RVA = "0x8C7120", Offset = "0x8C5F20", VA = "0x1808C7120")]
		public VertexPool.VertexSegment GetVertices(int vcount, int icount)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060021FC RID: 8700 RVA: 0x0004F100 File Offset: 0x0004D300
		[Token(Token = "0x60021FC")]
		[Address(RVA = "0x8C7240", Offset = "0x8C6040", VA = "0x1808C7240")]
		protected void InitArrays()
		{
			Vector3[] array = new Vector3[4];
			this.Vertices = array;
			Vector2[] array2 = new Vector2[4];
			this.UVs = array2;
			Color[] array3 = new Color[4];
			this.Colors = array3;
			int[] array4 = new int[6];
			this.Indices = array4;
			this.VertexTotal = (int)((ulong)4L);
			this.IndexTotal = (int)((ulong)6L);
		}

		// Token: 0x060021FD RID: 8701 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60021FD")]
		[Address(RVA = "0x8C6F80", Offset = "0x8C5D80", VA = "0x1808C6F80")]
		public void EnlargeArrays(int count, int icount)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060021FE RID: 8702 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60021FE")]
		[Address(RVA = "0x8C7320", Offset = "0x8C6120", VA = "0x1808C7320")]
		public void LateUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x04002B3A RID: 11066
		[FieldOffset(Offset = "0x10")]
		[Token(Token = "0x4002B3A")]
		public Vector3[] Vertices;

		// Token: 0x04002B3B RID: 11067
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4002B3B")]
		public int[] Indices;

		// Token: 0x04002B3C RID: 11068
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4002B3C")]
		public Vector2[] UVs;

		// Token: 0x04002B3D RID: 11069
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002B3D")]
		public Color[] Colors;

		// Token: 0x04002B3E RID: 11070
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4002B3E")]
		public bool IndiceChanged;

		// Token: 0x04002B3F RID: 11071
		[FieldOffset(Offset = "0x31")]
		[Token(Token = "0x4002B3F")]
		public bool ColorChanged;

		// Token: 0x04002B40 RID: 11072
		[FieldOffset(Offset = "0x32")]
		[Token(Token = "0x4002B40")]
		public bool UVChanged;

		// Token: 0x04002B41 RID: 11073
		[FieldOffset(Offset = "0x33")]
		[Token(Token = "0x4002B41")]
		public bool VertChanged;

		// Token: 0x04002B42 RID: 11074
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x4002B42")]
		public bool UV2Changed;

		// Token: 0x04002B43 RID: 11075
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4002B43")]
		protected int VertexTotal;

		// Token: 0x04002B44 RID: 11076
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x4002B44")]
		protected int VertexUsed;

		// Token: 0x04002B45 RID: 11077
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4002B45")]
		protected int IndexTotal;

		// Token: 0x04002B46 RID: 11078
		[FieldOffset(Offset = "0x44")]
		[Token(Token = "0x4002B46")]
		protected int IndexUsed;

		// Token: 0x04002B47 RID: 11079
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4002B47")]
		public bool FirstUpdate = true;

		// Token: 0x04002B48 RID: 11080
		[FieldOffset(Offset = "0x49")]
		[Token(Token = "0x4002B48")]
		protected bool VertCountChanged;

		// Token: 0x04002B49 RID: 11081
		[Token(Token = "0x4002B49")]
		public const int BlockSize = 108;

		// Token: 0x04002B4A RID: 11082
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x4002B4A")]
		public float BoundsScheduleTime = 1f;

		// Token: 0x04002B4B RID: 11083
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4002B4B")]
		public float ElapsedTime;

		// Token: 0x04002B4C RID: 11084
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4002B4C")]
		protected XWeaponTrail _owner;

		// Token: 0x04002B4D RID: 11085
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4002B4D")]
		protected MeshFilter _meshFilter;

		// Token: 0x04002B4E RID: 11086
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x4002B4E")]
		protected Mesh _mesh2d;

		// Token: 0x04002B4F RID: 11087
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x4002B4F")]
		protected Material _material;

		// Token: 0x02000381 RID: 897
		[Token(Token = "0x2000381")]
		public class VertexSegment
		{
			// Token: 0x060021FF RID: 8703 RVA: 0x0004F158 File Offset: 0x0004D358
			[Token(Token = "0x60021FF")]
			[Address(RVA = "0x1337B10", Offset = "0x1336910", VA = "0x181337B10")]
			public VertexSegment(int start, int count, int istart, int icount, VertexPool pool)
			{
				/*
An exception occurred when decompiling this method (060021FF)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void XftWeapon.VertexPool/VertexSegment::.ctor(System.Int32,System.Int32,System.Int32,System.Int32,XftWeapon.VertexPool)

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	call:void(object::.ctor, ldloc:VertexSegment[exp:object](this)); 	stfld:VertexPool(VertexSegment::Pool, ldloc:VertexSegment(this), ldc.i4:int32[exp:VertexPool](0)); 	stfld:int32(VertexSegment::VertStart, ldloc:VertexSegment(this), ldloc:int32(start)); 	stfld:int32(VertexSegment::VertCount, ldloc:VertexSegment(this), ldloc:int32(count)); 	stfld:int32(VertexSegment::IndexCount, ldloc:VertexSegment(this), ldc.i4:int32(0)); 	stfld:int32(VertexSegment::IndexStart, ldloc:VertexSegment(this), ldloc:int32(istart)); }; 
   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: 0x06002200 RID: 8704 RVA: 0x0004F190 File Offset: 0x0004D390
			[Token(Token = "0x6002200")]
			[Address(RVA = "0x1337A90", Offset = "0x1336890", VA = "0x181337A90")]
			public void ClearIndices()
			{
				int num = this.IndexStart;
				int num2 = this.IndexCount;
				num2 += num;
				if (num < num2)
				{
					int num3 = 0;
					int[] indices = this.Pool.Indices;
					num++;
					indices[0] = num3;
					int indexCount = this.IndexCount;
				}
				this.Pool.IndiceChanged = true;
			}

			// Token: 0x04002B50 RID: 11088
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4002B50")]
			public int VertStart;

			// Token: 0x04002B51 RID: 11089
			[FieldOffset(Offset = "0x14")]
			[Token(Token = "0x4002B51")]
			public int IndexStart;

			// Token: 0x04002B52 RID: 11090
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x4002B52")]
			public int VertCount;

			// Token: 0x04002B53 RID: 11091
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x4002B53")]
			public int IndexCount;

			// Token: 0x04002B54 RID: 11092
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x4002B54")]
			public VertexPool Pool;
		}
	}
}
