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

namespace Obi
{
	// Token: 0x02000504 RID: 1284
	[Token(Token = "0x2000504")]
	[Serializable]
	public abstract class ObiConstraintBatch
	{
		// Token: 0x17000305 RID: 773
		// (get) Token: 0x06002D27 RID: 11559 RVA: 0x000636AC File Offset: 0x000618AC
		[Token(Token = "0x17000305")]
		public IntPtr OniBatch
		{
			[Token(Token = "0x6002D27")]
			[Address(RVA = "0x32FD80", Offset = "0x32ED80", VA = "0x18032FD80")]
			get
			{
				return this.batch;
			}
		}

		// Token: 0x17000306 RID: 774
		// (get) Token: 0x06002D28 RID: 11560 RVA: 0x000636C0 File Offset: 0x000618C0
		[Token(Token = "0x17000306")]
		public int ConstraintCount
		{
			[Token(Token = "0x6002D28")]
			[Address(RVA = "0x3EC1A0", Offset = "0x3EB1A0", VA = "0x1803EC1A0")]
			get
			{
				return this.constraintCount;
			}
		}

		// Token: 0x17000307 RID: 775
		// (get) Token: 0x06002D29 RID: 11561 RVA: 0x000636D4 File Offset: 0x000618D4
		[Token(Token = "0x17000307")]
		public bool IsCooked
		{
			[Token(Token = "0x6002D29")]
			[Address(RVA = "0x41F3F0", Offset = "0x41E3F0", VA = "0x18041F3F0")]
			get
			{
				return this.cooked;
			}
		}

		// Token: 0x17000308 RID: 776
		// (get) Token: 0x06002D2A RID: 11562 RVA: 0x000636E8 File Offset: 0x000618E8
		[Token(Token = "0x17000308")]
		public bool SharesParticles
		{
			[Token(Token = "0x6002D2A")]
			[Address(RVA = "0x61C4A0", Offset = "0x61B4A0", VA = "0x18061C4A0")]
			get
			{
				return this.sharesParticles;
			}
		}

		// Token: 0x17000309 RID: 777
		// (get) Token: 0x06002D2B RID: 11563 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x17000309")]
		public IEnumerable<int> ActiveConstraints
		{
			[Token(Token = "0x6002D2B")]
			[Address(RVA = "0x10A04A0", Offset = "0x109F4A0", VA = "0x1810A04A0")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x06002D2C RID: 11564
		[Token(Token = "0x6002D2C")]
		[Address(Slot = "4")]
		public abstract Oni.ConstraintType GetConstraintType();

		// Token: 0x06002D2D RID: 11565
		[Token(Token = "0x6002D2D")]
		[Address(Slot = "5")]
		public abstract void Clear();

		// Token: 0x06002D2E RID: 11566 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002D2E")]
		[Address(RVA = "0x29E8B0", Offset = "0x29D8B0", VA = "0x18029E8B0", Slot = "6")]
		public virtual void Cook()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002D2F RID: 11567
		[Token(Token = "0x6002D2F")]
		[Address(Slot = "7")]
		protected abstract void OnAddToSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002D30 RID: 11568
		[Token(Token = "0x6002D30")]
		[Address(Slot = "8")]
		protected abstract void OnRemoveFromSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002D31 RID: 11569
		[Token(Token = "0x6002D31")]
		[Address(Slot = "9")]
		public abstract void PushDataToSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002D32 RID: 11570
		[Token(Token = "0x6002D32")]
		[Address(Slot = "10")]
		public abstract void PullDataFromSolver(ObiBatchedConstraints constraints);

		// Token: 0x06002D33 RID: 11571
		[Token(Token = "0x6002D33")]
		[Address(Slot = "11")]
		public abstract List<int> GetConstraintsInvolvingParticle(int particleIndex);

		// Token: 0x06002D34 RID: 11572 RVA: 0x000636FC File Offset: 0x000618FC
		[Token(Token = "0x6002D34")]
		[Address(RVA = "0x10A0250", Offset = "0x109F250", VA = "0x1810A0250")]
		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: 0x06002D35 RID: 11573 RVA: 0x00063740 File Offset: 0x00061940
		[Token(Token = "0x6002D35")]
		[Address(RVA = "0x109FFB0", Offset = "0x109EFB0", VA = "0x18109FFB0")]
		public void ActivateConstraint(int index)
		{
			if (!this.activeConstraints.Contains(index))
			{
				this.activeConstraints.Add(index);
			}
		}

		// Token: 0x06002D36 RID: 11574 RVA: 0x00063770 File Offset: 0x00061970
		[Token(Token = "0x6002D36")]
		[Address(RVA = "0x10A00C0", Offset = "0x109F0C0", VA = "0x1810A00C0")]
		public void DeactivateConstraint(int index)
		{
			bool flag = this.activeConstraints.Remove(index);
		}

		// Token: 0x06002D37 RID: 11575 RVA: 0x00063790 File Offset: 0x00061990
		[Token(Token = "0x6002D37")]
		[Address(RVA = "0x10A03C0", Offset = "0x109F3C0", VA = "0x1810A03C0")]
		public ObiConstraintBatch(bool cooked, bool sharesParticles)
		{
			this.maxYoungModulus = 0.02f;
			this.minYoungModulus = 0.0001f;
			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: 0x06002D38 RID: 11576 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002D38")]
		[Address(RVA = "0x10A02C0", Offset = "0x109F2C0", VA = "0x1810A02C0")]
		public ObiConstraintBatch(bool cooked, bool sharesParticles, float minYoungModulus, float maxYoungModulus)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002D39 RID: 11577 RVA: 0x000637E4 File Offset: 0x000619E4
		[Token(Token = "0x6002D39")]
		[Address(RVA = "0x10A0030", Offset = "0x109F030", VA = "0x1810A0030")]
		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: 0x06002D3A RID: 11578 RVA: 0x00063840 File Offset: 0x00061A40
		[Token(Token = "0x6002D3A")]
		[Address(RVA = "0x10A0140", Offset = "0x109F140", VA = "0x1810A0140")]
		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: 0x06002D3B RID: 11579 RVA: 0x00063884 File Offset: 0x00061A84
		[Token(Token = "0x6002D3B")]
		[Address(RVA = "0x10A01D0", Offset = "0x109F1D0", VA = "0x1810A01D0")]
		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: 0x06002D3C RID: 11580 RVA: 0x000638C4 File Offset: 0x00061AC4
		[Token(Token = "0x6002D3C")]
		[Address(RVA = "0x10A0130", Offset = "0x109F130", VA = "0x1810A0130")]
		public void Enable()
		{
			bool flag = Oni.EnableBatch(this.batch, true);
		}

		// Token: 0x06002D3D RID: 11581 RVA: 0x000638E0 File Offset: 0x00061AE0
		[Token(Token = "0x6002D3D")]
		[Address(RVA = "0x10A0120", Offset = "0x109F120", VA = "0x1810A0120")]
		public void Disable()
		{
			IntPtr intPtr = this.batch;
			int num = 0;
			bool flag = Oni.EnableBatch(intPtr, num != 0);
		}

		// Token: 0x04003630 RID: 13872
		[FieldOffset(Offset = "0x10")]
		[Token(Token = "0x4003630")]
		protected IntPtr batch;

		// Token: 0x04003631 RID: 13873
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003631")]
		public float maxYoungModulus;

		// Token: 0x04003632 RID: 13874
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x4003632")]
		public float minYoungModulus;

		// Token: 0x04003633 RID: 13875
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003633")]
		[SerializeField]
		[HideInInspector]
		protected int constraintCount;

		// Token: 0x04003634 RID: 13876
		[FieldOffset(Offset = "0x24")]
		[Token(Token = "0x4003634")]
		[HideInInspector]
		[SerializeField]
		protected bool cooked;

		// Token: 0x04003635 RID: 13877
		[FieldOffset(Offset = "0x25")]
		[Token(Token = "0x4003635")]
		[SerializeField]
		[HideInInspector]
		protected bool sharesParticles;

		// Token: 0x04003636 RID: 13878
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003636")]
		[SerializeField]
		[HideInInspector]
		protected List<int> activeConstraints;

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