using System;
using System.Collections.Generic;
using Cpp2IlInjected;
using UnityEngine;

namespace Obi
{
	// Token: 0x020004AC RID: 1196
	[Token(Token = "0x20004AC")]
	[Serializable]
	public abstract class ObiConstraintBatch
	{
		// Token: 0x170002E0 RID: 736
		// (get) Token: 0x06002A5E RID: 10846 RVA: 0x0005C330 File Offset: 0x0005A530
		[Token(Token = "0x170002E0")]
		public IntPtr OniBatch
		{
			[Token(Token = "0x6002A5E")]
			[Address(RVA = "0x2B4010", Offset = "0x2B2E10", VA = "0x1802B4010")]
			get
			{
				return this.batch;
			}
		}

		// Token: 0x170002E1 RID: 737
		// (get) Token: 0x06002A5F RID: 10847 RVA: 0x0005C344 File Offset: 0x0005A544
		[Token(Token = "0x170002E1")]
		public int ConstraintCount
		{
			[Token(Token = "0x6002A5F")]
			[Address(RVA = "0x3835C0", Offset = "0x3823C0", VA = "0x1803835C0")]
			get
			{
				return this.constraintCount;
			}
		}

		// Token: 0x170002E2 RID: 738
		// (get) Token: 0x06002A60 RID: 10848 RVA: 0x0005C358 File Offset: 0x0005A558
		[Token(Token = "0x170002E2")]
		public bool IsCooked
		{
			[Token(Token = "0x6002A60")]
			[Address(RVA = "0x3FC660", Offset = "0x3FB460", VA = "0x1803FC660")]
			get
			{
				return this.cooked;
			}
		}

		// Token: 0x170002E3 RID: 739
		// (get) Token: 0x06002A61 RID: 10849 RVA: 0x0005C36C File Offset: 0x0005A56C
		[Token(Token = "0x170002E3")]
		public bool SharesParticles
		{
			[Token(Token = "0x6002A61")]
			[Address(RVA = "0x6206E0", Offset = "0x61F4E0", VA = "0x1806206E0")]
			get
			{
				return this.sharesParticles;
			}
		}

		// Token: 0x170002E4 RID: 740
		// (get) Token: 0x06002A62 RID: 10850 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x170002E4")]
		public IEnumerable<int> ActiveConstraints
		{
			[Token(Token = "0x6002A62")]
			[Address(RVA = "0x100D170", Offset = "0x100BF70", VA = "0x18100D170")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x06002A63 RID: 10851
		[Token(Token = "0x6002A63")]
		[Address(Slot = "4")]
		public abstract Oni.ConstraintType GetConstraintType();

		// Token: 0x06002A64 RID: 10852
		[Token(Token = "0x6002A64")]
		[Address(Slot = "5")]
		public abstract void Clear();

		// Token: 0x06002A65 RID: 10853 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002A65")]
		[Address(RVA = "0x297F00", Offset = "0x296D00", VA = "0x180297F00", Slot = "6")]
		public virtual void Cook()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002A66 RID: 10854
		[Token(Token = "0x6002A66")]
		[Address(Slot = "7")]
		protected abstract void OnAddToSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002A67 RID: 10855
		[Token(Token = "0x6002A67")]
		[Address(Slot = "8")]
		protected abstract void OnRemoveFromSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002A68 RID: 10856
		[Token(Token = "0x6002A68")]
		[Address(Slot = "9")]
		public abstract void PushDataToSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002A69 RID: 10857
		[Token(Token = "0x6002A69")]
		[Address(Slot = "10")]
		public abstract void PullDataFromSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002A6A RID: 10858
		[Token(Token = "0x6002A6A")]
		[Address(Slot = "11")]
		public abstract List<int> GetConstraintsInvolvingParticle(int particleIndex);

		// Token: 0x06002A6B RID: 10859 RVA: 0x0005C380 File Offset: 0x0005A580
		[Token(Token = "0x6002A6B")]
		[Address(RVA = "0x100CF20", Offset = "0x100BD20", VA = "0x18100CF20")]
		protected float StiffnessToCompliance(float stiffness)
		{
			float num = Mathf.Max(this.minYoungModulus, 1E-05f);
			float num2 = this.minYoungModulus;
			float num3 = Mathf.Max(this.maxYoungModulus, num2);
			return Mathf.Lerp(1f, 1f, stiffness);
		}

		// Token: 0x06002A6C RID: 10860 RVA: 0x0005C3C4 File Offset: 0x0005A5C4
		[Token(Token = "0x6002A6C")]
		[Address(RVA = "0x100CC80", Offset = "0x100BA80", VA = "0x18100CC80")]
		public void ActivateConstraint(int index)
		{
			if (!this.activeConstraints.Contains(index))
			{
				this.activeConstraints.Add(index);
			}
		}

		// Token: 0x06002A6D RID: 10861 RVA: 0x0005C3F4 File Offset: 0x0005A5F4
		[Token(Token = "0x6002A6D")]
		[Address(RVA = "0x100CD90", Offset = "0x100BB90", VA = "0x18100CD90")]
		public void DeactivateConstraint(int index)
		{
			bool flag = this.activeConstraints.Remove(index);
		}

		// Token: 0x06002A6E RID: 10862 RVA: 0x0005C414 File Offset: 0x0005A614
		[Token(Token = "0x6002A6E")]
		[Address(RVA = "0x100D090", Offset = "0x100BE90", VA = "0x18100D090")]
		public ObiConstraintBatch(bool cooked, bool sharesParticles)
		{
			List<int> list = new List();
			this.activeConstraints = list;
			List<int> list2 = new List();
			this.phaseSizes = list2;
			this.Cook();
			this.cooked = cooked;
			this.sharesParticles = sharesParticles;
		}

		// Token: 0x06002A6F RID: 10863 RVA: 0x0005C468 File Offset: 0x0005A668
		[Token(Token = "0x6002A6F")]
		[Address(RVA = "0x100CF90", Offset = "0x100BD90", VA = "0x18100CF90")]
		public ObiConstraintBatch(bool cooked, bool sharesParticles, float minYoungModulus, float maxYoungModulus)
		{
			List<int> list = new List();
			this.activeConstraints = list;
			List<int> list2 = new List();
			this.phaseSizes = list2;
			this.Cook();
			this.minYoungModulus = minYoungModulus;
			this.cooked = cooked;
			this.sharesParticles = sharesParticles;
			this.maxYoungModulus = (float)0;
		}

		// Token: 0x06002A70 RID: 10864 RVA: 0x0005C4C8 File Offset: 0x0005A6C8
		[Token(Token = "0x6002A70")]
		[Address(RVA = "0x100CD00", Offset = "0x100BB00", VA = "0x18100CD00")]
		public void AddToSolver(ObiBatchedConstraints constraints)
		{
			Oni.ConstraintType constraintType = this.GetConstraintType();
			bool flag = this.cooked;
			IntPtr intPtr = Oni.CreateBatch((int)constraintType, flag);
			this.batch = intPtr;
			ObiSolver solver = constraints.actor.solver;
			bool flag2 = this.sharesParticles;
			IntPtr intPtr2 = Oni.AddBatch(solver.oniSolver, intPtr, flag2);
			Oni.ConstraintType constraintType2 = this.GetConstraintType();
		}

		// Token: 0x06002A71 RID: 10865 RVA: 0x0005C524 File Offset: 0x0005A724
		[Token(Token = "0x6002A71")]
		[Address(RVA = "0x100CE10", Offset = "0x100BC10", VA = "0x18100CE10")]
		public void RemoveFromSolver(ObiBatchedConstraints constraints)
		{
			this.OnRemoveFromSolver(constraints);
			ObiSolver solver = constraints.actor.solver;
			IntPtr intPtr = this.batch;
			Oni.RemoveBatch(solver.oniSolver, intPtr);
			this.batch = (IntPtr)((ulong)0L);
		}

		// Token: 0x06002A72 RID: 10866 RVA: 0x0005C568 File Offset: 0x0005A768
		[Token(Token = "0x6002A72")]
		[Address(RVA = "0x100CEA0", Offset = "0x100BCA0", VA = "0x18100CEA0")]
		public void SetActiveConstraints()
		{
			List<int> list = this.activeConstraints;
			IntPtr intPtr = this.batch;
			int[] array = list.ToArray();
			int size = this.activeConstraints._size;
			int num = Oni.SetActiveConstraints(intPtr, array, size);
		}

		// Token: 0x06002A73 RID: 10867 RVA: 0x0005C5A8 File Offset: 0x0005A7A8
		[Token(Token = "0x6002A73")]
		[Address(RVA = "0x100CE00", Offset = "0x100BC00", VA = "0x18100CE00")]
		public void Enable()
		{
			bool flag = Oni.EnableBatch(this.batch, true);
		}

		// Token: 0x06002A74 RID: 10868 RVA: 0x0005C5C4 File Offset: 0x0005A7C4
		[Token(Token = "0x6002A74")]
		[Address(RVA = "0x100CDF0", Offset = "0x100BBF0", VA = "0x18100CDF0")]
		public void Disable()
		{
			IntPtr intPtr = this.batch;
			int num = 0;
			bool flag = Oni.EnableBatch(intPtr, num != 0);
		}

		// Token: 0x04003346 RID: 13126
		[FieldOffset(Offset = "0x10")]
		[Token(Token = "0x4003346")]
		protected IntPtr batch;

		// Token: 0x04003347 RID: 13127
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003347")]
		public float maxYoungModulus = 0.02f;

		// Token: 0x04003348 RID: 13128
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x4003348")]
		public float minYoungModulus = 0.0001f;

		// Token: 0x04003349 RID: 13129
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003349")]
		[HideInInspector]
		[SerializeField]
		protected int constraintCount;

		// Token: 0x0400334A RID: 13130
		[FieldOffset(Offset = "0x24")]
		[Token(Token = "0x400334A")]
		[HideInInspector]
		[SerializeField]
		protected bool cooked;

		// Token: 0x0400334B RID: 13131
		[FieldOffset(Offset = "0x25")]
		[Token(Token = "0x400334B")]
		[SerializeField]
		[HideInInspector]
		protected bool sharesParticles;

		// Token: 0x0400334C RID: 13132
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x400334C")]
		[HideInInspector]
		[SerializeField]
		protected List<int> activeConstraints;

		// Token: 0x0400334D RID: 13133
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x400334D")]
		[HideInInspector]
		[SerializeField]
		protected List<int> phaseSizes;
	}
}
