public sealed override void EnumerateConnectedBodyIndices <TEnumerator>(ref TypeBatch typeBatch, int indexInTypeBatch, ref TEnumerator enumerator) { BundleIndexing.GetBundleIndices(indexInTypeBatch, out var constraintBundleIndex, out var constraintInnerIndex); enumerator.LoopBody(GatherScatter.Get(ref Buffer <Vector <int> > .Get(ref typeBatch.BodyReferences, constraintBundleIndex), constraintInnerIndex)); }
public abstract void EnumerateConnectedBodyIndices <TEnumerator>(ref TypeBatch typeBatch, int indexInTypeBatch, ref TEnumerator enumerator) where TEnumerator : IForEach <int>;
public abstract void Scramble(ref TypeBatch typeBatch, Random random, ref Buffer <ConstraintLocation> handlesToConstraints);
public void SolveIteration(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities) { SolveIteration(ref typeBatch, ref bodyVelocities, 0, typeBatch.BundleCount); }
public abstract void Remove(ref TypeBatch typeBatch, int index, ref Buffer <ConstraintLocation> handlesToConstraints);
public abstract void WarmStart(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities, int startBundle, int exclusiveEndBundle);
public void Prestep(ref TypeBatch typeBatch, Bodies bodies, float dt, float inverseDt) { Prestep(ref typeBatch, bodies, dt, inverseDt, 0, typeBatch.BundleCount); }
internal unsafe abstract void GatherActiveConstraints(Bodies bodies, Solver solver, ref QuickList <int> sourceHandles, int startIndex, int endIndex, ref TypeBatch targetTypeBatch);
internal unsafe abstract void AddWakingBodyHandlesToBatchReferences(ref TypeBatch typeBatch, ref IndexSet targetBatchReferencedHandles);
internal abstract void CopyToCache( ref TypeBatch typeBatch, int bundleStart, int localBundleStart, int bundleCount, int constraintStart, int localConstraintStart, int constraintCount, ref Buffer <int> indexToHandleCache, ref RawBuffer prestepCache, ref RawBuffer accumulatedImpulsesCache);
internal abstract void Regather( ref TypeBatch typeBatch, int constraintStart, int constraintCount, ref int firstSourceIndex, ref Buffer <int> indexToHandleCache, ref RawBuffer bodyReferencesCache, ref RawBuffer prestepCache, ref RawBuffer accumulatedImpulsesCache, ref Buffer <ConstraintLocation> handlesToConstraints);
public abstract void ScaleAccumulatedImpulses(ref TypeBatch typeBatch, float scale);
//The following covers the common loop logic for all one body constraints. Each iteration invokes the warm start function type. //This abstraction should, in theory, have zero overhead if the implementation of the interface is in a struct with aggressive inlining. //By providing the overrides at this level, the concrete implementation (assuming it inherits from one of the prestep-providing variants) //only has to specify *type* arguments associated with the interface-implementing struct-delegates. It's going to look very strange, but it's low overhead //and minimizes per-type duplication. public unsafe override void Prestep(ref TypeBatch typeBatch, Bodies bodies, float dt, float inverseDt, int startBundle, int exclusiveEndBundle) { ref var prestepBase = ref Unsafe.AsRef <TPrestepData>(typeBatch.PrestepData.Memory);
internal sealed override void VerifySortRegion(ref TypeBatch typeBatch, int bundleStartIndex, int constraintCount, ref Buffer <int> sortedKeys, ref Buffer <int> sortedSourceIndices) { VerifySortRegion <OneBodySortKeyGenerator>(ref typeBatch, bundleStartIndex, constraintCount, ref sortedKeys, ref sortedSourceIndices); }
public abstract void Resize(ref TypeBatch typeBatch, int newCapacity, BufferPool pool);
public abstract void JacobiPrestep(ref TypeBatch typeBatch, Bodies bodies, ref FallbackBatch jacobiBatch, float dt, float inverseDt, int startBundle, int exclusiveEndBundle);
public abstract void Prestep(ref TypeBatch typeBatch, Bodies bodies, float dt, float inverseDt, int startBundle, int exclusiveEndBundle);
public abstract void JacobiSolveIteration(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities, ref FallbackTypeBatchResults jacobiResults, int startBundle, int exclusiveEndBundle);
public abstract void SolveIteration(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities, int startBundle, int exclusiveEndBundle);
public void ApplyDescription(ref TypeBatch batch, int bundleIndex, int innerIndex) { ConstraintChecker.AssertUnitLength(LocalAxisA, nameof(AngularAxisMotor), nameof(LocalAxisA)); ConstraintChecker.AssertValid(Settings, nameof(AngularAxisMotor)); Debug.Assert(ConstraintTypeId == batch.TypeId, "The type batch passed to the description must match the description's expected type."); ref var target = ref GetOffsetInstance(ref Buffer <AngularAxisMotorPrestepData> .Get(ref batch.PrestepData, bundleIndex), innerIndex);
public void WarmStart(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities) { WarmStart(ref typeBatch, ref bodyVelocities, 0, typeBatch.BundleCount); }
public void ApplyDescription(ref TypeBatch batch, int bundleIndex, int innerIndex) { Debug.Assert(ConstraintTypeId == batch.TypeId, "The type batch passed to the description must match the description's expected type."); ref var target = ref GetOffsetInstance(ref Buffer <HingePrestepData> .Get(ref batch.PrestepData, bundleIndex), innerIndex);
/// <summary> /// Allocates a slot in the batch. /// </summary> /// <param name="typeBatch">Type batch to allocate in.</param> /// <param name="handle">Handle of the constraint to allocate. Establishes a link from the allocated constraint to its handle.</param> /// <param name="bodyIndices">Pointer to a list of body indices (not handles!) with count equal to the type batch's expected number of involved bodies.</param> /// <param name="pool">Allocation provider to use if the type batch has to be resized.</param> /// <returns>Index of the slot in the batch.</returns> public unsafe abstract int Allocate(ref TypeBatch typeBatch, int handle, int *bodyIndices, BufferPool pool);
internal abstract void VerifySortRegion(ref TypeBatch typeBatch, int bundleStartIndex, int constraintCount, ref Buffer <int> sortedKeys, ref Buffer <int> sortedSourceIndices);
/// <summary> /// Moves a constraint from one ConstraintBatch's TypeBatch to another ConstraintBatch's TypeBatch of the same type. /// </summary> /// <param name="sourceBatchIndex">Index of the batch that owns the type batch that is the source of the constraint transfer.</param> /// <param name="indexInTypeBatch">Index of the constraint to move in the current type batch.</param> /// <param name="solver">Solver that owns the batches.</param> /// <param name="bodies">Bodies set that owns all the constraint's bodies.</param> /// <param name="targetBatchIndex">Index of the ConstraintBatch in the solver to copy the constraint into.</param> public unsafe abstract void TransferConstraint(ref TypeBatch typeBatch, int sourceBatchIndex, int indexInTypeBatch, Solver solver, Bodies bodies, int targetBatchIndex);
internal abstract int GetBodyReferenceCount(ref TypeBatch typeBatch, int body);
public abstract void UpdateForBodyMemoryMove(ref TypeBatch typeBatch, int indexInTypeBatch, int bodyIndexInConstraint, int newBodyLocation);
public abstract void Initialize(ref TypeBatch typeBatch, int initialCapacity, BufferPool pool);
internal abstract void GenerateSortKeysAndCopyReferences( ref TypeBatch typeBatch, int bundleStart, int localBundleStart, int bundleCount, int constraintStart, int localConstraintStart, int constraintCount, ref int firstSortKey, ref int firstSourceIndex, ref RawBuffer bodyReferencesCache);
public sealed unsafe override void EnumerateConnectedBodyIndices <TEnumerator>(ref TypeBatch typeBatch, int indexInTypeBatch, ref TEnumerator enumerator) { BundleIndexing.GetBundleIndices(indexInTypeBatch, out var constraintBundleIndex, out var constraintInnerIndex); ref var indices = ref GatherScatter.GetOffsetInstance(ref Buffer <FourBodyReferences> .Get(typeBatch.BodyReferences.Memory, constraintBundleIndex), constraintInnerIndex);