Пример #1
0
            internal static unsafe void ExecuteImpl(int2 pair, Tree dynamicTree, ref NativeStream.Writer pairWriter)
            {
                var bodyFilters   = (CollisionFilter *)dynamicTree.BodyFilters.GetUnsafeReadOnlyPtr();
                var bufferedPairs = new BodyPairWriter((NativeStream.Writer *)UnsafeUtility.AddressOf(ref pairWriter), bodyFilters, bodyFilters, 0, 0);

                new BoundingVolumeHierarchy(dynamicTree.Nodes, dynamicTree.NodeFilters).SelfBvhOverlap(ref bufferedPairs, pair.x, pair.y);
                bufferedPairs.Close();
            }
Пример #2
0
            internal static unsafe void ExecuteImpl(int2 pair, Tree staticTree, Tree dynamicTree, ref NativeStream.Writer pairWriter)
            {
                var staticBvh  = new BoundingVolumeHierarchy(staticTree.Nodes, staticTree.NodeFilters);
                var dynamicBvh = new BoundingVolumeHierarchy(dynamicTree.Nodes, dynamicTree.NodeFilters);

                var bodyPairWriter = new BodyPairWriter((NativeStream.Writer *)UnsafeUtility.AddressOf(ref pairWriter),
                                                        (CollisionFilter *)staticTree.BodyFilters.GetUnsafeReadOnlyPtr(), (CollisionFilter *)dynamicTree.BodyFilters.GetUnsafeReadOnlyPtr(),
                                                        dynamicTree.NumBodies, 0);

                staticBvh.BvhOverlap(ref bodyPairWriter, dynamicBvh, pair.x, pair.y);

                bodyPairWriter.Close();
            }