using System;
using Cpp2IlInjected;
using UnityEngine;

namespace XftWeapon
{
	// Token: 0x020003D8 RID: 984
	[Token(Token = "0x20003D8")]
	public class VertexPool
	{
		// Token: 0x17000206 RID: 518
		// (get) Token: 0x060024BE RID: 9406 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x17000206")]
		public Mesh MyMesh
		{
			[Token(Token = "0x60024BE")]
			[Address(RVA = "0x4B0A40", Offset = "0x4AFA40", VA = "0x1804B0A40")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x060024BF RID: 9407 RVA: 0x0005622C File Offset: 0x0005442C
		[Token(Token = "0x60024BF")]
		[Address(RVA = "0x4B07C0", Offset = "0x4AF7C0", VA = "0x1804B07C0")]
		public void RecalculateBounds()
		{
			this.MyMesh.RecalculateBounds();
		}

		// Token: 0x060024C0 RID: 9408 RVA: 0x0005624C File Offset: 0x0005444C
		[Token(Token = "0x60024C0")]
		[Address(RVA = "0x4B07F0", Offset = "0x4AF7F0", VA = "0x1804B07F0")]
		public void SetMeshObjectActive(bool flag)
		{
			MeshFilter meshFilter = this._meshFilter;
			int num = 0;
			if (!(meshFilter == num))
			{
				this._meshFilter.gameObject.SetActive(flag);
			}
		}

		// Token: 0x060024C1 RID: 9409 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60024C1")]
		[Address(RVA = "0x4AFD10", Offset = "0x4AED10", VA = "0x1804AFD10")]
		private void CreateMeshObj(XWeaponTrail owner, Material material)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060024C2 RID: 9410 RVA: 0x00056284 File Offset: 0x00054484
		[Token(Token = "0x60024C2")]
		[Address(RVA = "0x4B0090", Offset = "0x4AF090", VA = "0x1804B0090")]
		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: 0x060024C3 RID: 9411 RVA: 0x000562D8 File Offset: 0x000544D8
		[Token(Token = "0x60024C3")]
		[Address(RVA = "0x4B0890", Offset = "0x4AF890", VA = "0x1804B0890")]
		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: 0x060024C4 RID: 9412 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60024C4")]
		[Address(RVA = "0x4B0320", Offset = "0x4AF320", VA = "0x1804B0320")]
		public VertexPool.VertexSegment GetVertices(int vcount, int icount)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060024C5 RID: 9413 RVA: 0x0005639C File Offset: 0x0005459C
		[Token(Token = "0x60024C5")]
		[Address(RVA = "0x4B0440", Offset = "0x4AF440", VA = "0x1804B0440")]
		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: 0x060024C6 RID: 9414 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60024C6")]
		[Address(RVA = "0x4B0180", Offset = "0x4AF180", VA = "0x1804B0180")]
		public void EnlargeArrays(int count, int icount)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x060024C7 RID: 9415 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x60024C7")]
		[Address(RVA = "0x4B0520", Offset = "0x4AF520", VA = "0x1804B0520")]
		public void LateUpdate()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x04002E24 RID: 11812
		[FieldOffset(Offset = "0x10")]
		[Token(Token = "0x4002E24")]
		public Vector3[] Vertices;

		// Token: 0x04002E25 RID: 11813
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4002E25")]
		public int[] Indices;

		// Token: 0x04002E26 RID: 11814
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4002E26")]
		public Vector2[] UVs;

		// Token: 0x04002E27 RID: 11815
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4002E27")]
		public Color[] Colors;

		// Token: 0x04002E28 RID: 11816
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4002E28")]
		public bool IndiceChanged;

		// Token: 0x04002E29 RID: 11817
		[FieldOffset(Offset = "0x31")]
		[Token(Token = "0x4002E29")]
		public bool ColorChanged;

		// Token: 0x04002E2A RID: 11818
		[FieldOffset(Offset = "0x32")]
		[Token(Token = "0x4002E2A")]
		public bool UVChanged;

		// Token: 0x04002E2B RID: 11819
		[FieldOffset(Offset = "0x33")]
		[Token(Token = "0x4002E2B")]
		public bool VertChanged;

		// Token: 0x04002E2C RID: 11820
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x4002E2C")]
		public bool UV2Changed;

		// Token: 0x04002E2D RID: 11821
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4002E2D")]
		protected int VertexTotal;

		// Token: 0x04002E2E RID: 11822
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x4002E2E")]
		protected int VertexUsed;

		// Token: 0x04002E2F RID: 11823
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x4002E2F")]
		protected int IndexTotal;

		// Token: 0x04002E30 RID: 11824
		[FieldOffset(Offset = "0x44")]
		[Token(Token = "0x4002E30")]
		protected int IndexUsed;

		// Token: 0x04002E31 RID: 11825
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x4002E31")]
		public bool FirstUpdate = true;

		// Token: 0x04002E32 RID: 11826
		[FieldOffset(Offset = "0x49")]
		[Token(Token = "0x4002E32")]
		protected bool VertCountChanged;

		// Token: 0x04002E33 RID: 11827
		[Token(Token = "0x4002E33")]
		public const int BlockSize = 108;

		// Token: 0x04002E34 RID: 11828
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x4002E34")]
		public float BoundsScheduleTime = 1f;

		// Token: 0x04002E35 RID: 11829
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x4002E35")]
		public float ElapsedTime;

		// Token: 0x04002E36 RID: 11830
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x4002E36")]
		protected XWeaponTrail _owner;

		// Token: 0x04002E37 RID: 11831
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4002E37")]
		protected MeshFilter _meshFilter;

		// Token: 0x04002E38 RID: 11832
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x4002E38")]
		protected Mesh _mesh2d;

		// Token: 0x04002E39 RID: 11833
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x4002E39")]
		protected Material _material;

		// Token: 0x020003D9 RID: 985
		[Token(Token = "0x20003D9")]
		public class VertexSegment
		{
			// Token: 0x060024C8 RID: 9416 RVA: 0x000563F4 File Offset: 0x000545F4
			[Token(Token = "0x60024C8")]
			[Address(RVA = "0x6D7EB0", Offset = "0x6D6EB0", VA = "0x1806D7EB0")]
			public VertexSegment(int start, int count, int istart, int icount, VertexPool pool)
			{
				/*
An exception occurred when decompiling this method (060024C8)

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: 0x060024C9 RID: 9417 RVA: 0x0005642C File Offset: 0x0005462C
			[Token(Token = "0x60024C9")]
			[Address(RVA = "0x6D7E30", Offset = "0x6D6E30", VA = "0x1806D7E30")]
			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: 0x04002E3A RID: 11834
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4002E3A")]
			public int VertStart;

			// Token: 0x04002E3B RID: 11835
			[FieldOffset(Offset = "0x14")]
			[Token(Token = "0x4002E3B")]
			public int IndexStart;

			// Token: 0x04002E3C RID: 11836
			[FieldOffset(Offset = "0x18")]
			[Token(Token = "0x4002E3C")]
			public int VertCount;

			// Token: 0x04002E3D RID: 11837
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x4002E3D")]
			public int IndexCount;

			// Token: 0x04002E3E RID: 11838
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x4002E3E")]
			public VertexPool Pool;
		}
	}
}
