示例#1
0
 //Every single collision task type will mirror this general layout.
 public unsafe override void ExecuteBatch <TContinuations, TFilters>(ref UntypedList batch, ref StreamingBatcher batcher, ref TContinuations continuations, ref TFilters filters)
 {
     CollisionTaskCommon.ExecuteBatch
     <TContinuations, TFilters,
      Sphere, SphereWide, Box, BoxWide, OneOrientationTestPairWide <Sphere, SphereWide, Box, BoxWide>,
      Convex1ContactManifoldWide, SphereBoxTester>(ref batch, ref batcher, ref continuations, ref filters);
 }
示例#2
0
 //Every single collision task type will mirror this general layout.
 public unsafe override void ExecuteBatch <TContinuations, TFilters>(ref UntypedList batch, ref StreamingBatcher batcher, ref TContinuations continuations, ref TFilters filters)
 {
     CollisionTaskCommon.ExecuteBatch
     <TContinuations, TFilters,
      Capsule, CapsuleWide, Capsule, CapsuleWide, UnflippableTestPairWide <Capsule, CapsuleWide, Capsule, CapsuleWide>,
      Convex2ContactManifoldWide, CapsulePairTester>(ref batch, ref batcher, ref continuations, ref filters);
 }
示例#3
0
        public unsafe override void ExecuteBatch <TCallbacks>(ref UntypedList batch, ref CollisionBatcher <TCallbacks> batcher)
        {
            var testPairs = batch.Buffer.As <FliplessPair>();

            for (int i = 0; i < batch.Count; ++i)
            {
                ref var pair = ref testPairs[i];
                ref var a    = ref Unsafe.AsRef <Compound>(pair.A);
        public unsafe override void ExecuteBatch <TCallbacks>(ref UntypedList batch, ref CollisionBatcher <TCallbacks> batcher)
        {
            var testPairs = batch.Buffer.As <CollisionPair>();

            for (int i = 0; i < batch.Count; ++i)
            {
                ref var pair = ref testPairs[i];
                Debug.Assert(pair.Continuation.ChildA == 0 && pair.Continuation.ChildB == 0 && pair.Continuation.Type == CollisionContinuationType.Direct,
                             "Compound-involving pairs cannot be marked as children of compound pairs. Convex-convex children of such pairs will be.");
                ref var b            = ref Unsafe.AsRef <Compound>(pair.B);
        public unsafe override void ExecuteBatch <TCallbacks>(ref UntypedList batch, ref CollisionBatcher <TCallbacks> batcher)
        {
            var            pairs         = batch.Buffer.As <BoundsTestedPair>();
            TOverlapFinder overlapFinder = default;

            //We perform all necessary bounding box computations and lookups up front. This helps avoid some instruction pipeline pressure at the cost of some extra data cache requirements.
            //Because of this, you need to be careful with the batch size on this collision task.
            overlapFinder.FindLocalOverlaps(ref pairs, batch.Count, batcher.Pool, batcher.Shapes, batcher.Dt, out var overlaps);
            for (int i = 0; i < batch.Count; ++i)
            {
                ref var pairOverlaps = ref overlaps.GetOverlapsForPair(i);
                if (pairOverlaps.Count > 0)
                {
                    ref var pair         = ref pairs[i];
                    ref var compound     = ref Unsafe.AsRef <TCompound>(pair.B);
        public unsafe override void ExecuteBatch <TCallbacks>(ref UntypedList batch, ref CollisionBatcher <TCallbacks> batcher)
        {
            var            pairs         = batch.Buffer.As <BoundsTestedPair>();
            TOverlapFinder overlapFinder = default;

            //We perform all necessary bounding box computations and lookups up front. This helps avoid some instruction pipeline pressure at the cost of some extra data cache requirements.
            //Because of this, you need to be careful with the batch size on this collision task.
            overlapFinder.FindLocalOverlaps(ref pairs, batch.Count, batcher.Pool, batcher.Shapes, batcher.Dt, out var overlaps);
            for (int pairIndex = 0; pairIndex < batch.Count; ++pairIndex)
            {
                overlaps.GetPairOverlaps(pairIndex, out var pairOverlaps);
                var totalOverlapCountForPair = pairOverlaps[0].Count;
                for (int j = 1; j < pairOverlaps.Length; ++j)
                {
                    totalOverlapCountForPair += pairOverlaps[j].Count;
                }
                if (totalOverlapCountForPair > 0)
                {
                    ref var pair         = ref pairs[pairIndex];
                    ref var compoundA    = ref Unsafe.AsRef <TCompoundA>(pair.A);
                    ref var compoundB    = ref Unsafe.AsRef <TCompoundB>(pair.B);