Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 public abstract void EnumerateConnectedBodyIndices <TEnumerator>(ref TypeBatch typeBatch, int indexInTypeBatch, ref TEnumerator enumerator) where TEnumerator : IForEach <int>;
Ejemplo n.º 3
0
 public abstract void Scramble(ref TypeBatch typeBatch, Random random, ref Buffer <ConstraintLocation> handlesToConstraints);
Ejemplo n.º 4
0
 public void SolveIteration(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities)
 {
     SolveIteration(ref typeBatch, ref bodyVelocities, 0, typeBatch.BundleCount);
 }
Ejemplo n.º 5
0
 public abstract void Remove(ref TypeBatch typeBatch, int index, ref Buffer <ConstraintLocation> handlesToConstraints);
Ejemplo n.º 6
0
 public abstract void WarmStart(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities, int startBundle, int exclusiveEndBundle);
Ejemplo n.º 7
0
 public void Prestep(ref TypeBatch typeBatch, Bodies bodies, float dt, float inverseDt)
 {
     Prestep(ref typeBatch, bodies, dt, inverseDt, 0, typeBatch.BundleCount);
 }
Ejemplo n.º 8
0
 internal unsafe abstract void GatherActiveConstraints(Bodies bodies, Solver solver, ref QuickList <int> sourceHandles, int startIndex, int endIndex, ref TypeBatch targetTypeBatch);
Ejemplo n.º 9
0
 internal unsafe abstract void AddWakingBodyHandlesToBatchReferences(ref TypeBatch typeBatch, ref IndexSet targetBatchReferencedHandles);
Ejemplo n.º 10
0
 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);
Ejemplo n.º 11
0
 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);
Ejemplo n.º 12
0
 public abstract void ScaleAccumulatedImpulses(ref TypeBatch typeBatch, float scale);
Ejemplo n.º 13
0
        //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);
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 15
0
 public abstract void Resize(ref TypeBatch typeBatch, int newCapacity, BufferPool pool);
Ejemplo n.º 16
0
 public abstract void JacobiPrestep(ref TypeBatch typeBatch, Bodies bodies, ref FallbackBatch jacobiBatch, float dt, float inverseDt, int startBundle, int exclusiveEndBundle);
Ejemplo n.º 17
0
 public abstract void Prestep(ref TypeBatch typeBatch, Bodies bodies, float dt, float inverseDt, int startBundle, int exclusiveEndBundle);
Ejemplo n.º 18
0
 public abstract void JacobiSolveIteration(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities, ref FallbackTypeBatchResults jacobiResults, int startBundle, int exclusiveEndBundle);
Ejemplo n.º 19
0
 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);
Ejemplo n.º 21
0
 public void WarmStart(ref TypeBatch typeBatch, ref Buffer <BodyVelocity> bodyVelocities)
 {
     WarmStart(ref typeBatch, ref bodyVelocities, 0, typeBatch.BundleCount);
 }
Ejemplo n.º 22
0
 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);
Ejemplo n.º 23
0
 /// <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);
Ejemplo n.º 24
0
 internal abstract void VerifySortRegion(ref TypeBatch typeBatch, int bundleStartIndex, int constraintCount, ref Buffer <int> sortedKeys, ref Buffer <int> sortedSourceIndices);
Ejemplo n.º 25
0
 /// <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);
Ejemplo n.º 26
0
 internal abstract int GetBodyReferenceCount(ref TypeBatch typeBatch, int body);
Ejemplo n.º 27
0
 public abstract void UpdateForBodyMemoryMove(ref TypeBatch typeBatch, int indexInTypeBatch, int bodyIndexInConstraint, int newBodyLocation);
Ejemplo n.º 28
0
 public abstract void Initialize(ref TypeBatch typeBatch, int initialCapacity, BufferPool pool);
Ejemplo n.º 29
0
 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);
Ejemplo n.º 30
0
 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);