コード例 #1
0
 protected override void OnRecycle()
 {
     _partition = null;
     _enumerator.Dispose();
     _enumerator = null;
     Pool.Recycle(this);
 }
コード例 #2
0
            public static IEnumerable <Pair <T> > Create(BasePartition <T> partition, ISpatialPartition <T> otherPartition)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition      = partition;
                enumerable._otherPartition = otherPartition;
                enumerable._candidates     = partition.GetOverlaps(otherPartition.Aabb).GetEnumerator();
                return(enumerable);
            }
コード例 #3
0
            public static IEnumerable <T> Create(BasePartition <T> partition, T item)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition = partition;
                enumerable._item      = item;
                Aabb aabb = partition.GetAabbForItem(item);

                enumerable._enumerator = partition.GetOverlaps(aabb).GetEnumerator();
                return(enumerable);
            }
コード例 #4
0
        /// <inheritdoc/>
        protected override void CloneCore(BasePartition <T> source)
        {
            // Clone BasePartition<T> properties.
            base.CloneCore(source);

            // Clone DualPartition<T> properties.
            var sourceTyped = (DualPartition <T>)source;

            sourceTyped.StaticPartition  = sourceTyped.StaticPartition.Clone();
            sourceTyped.DynamicPartition = sourceTyped.DynamicPartition.Clone();
        }
コード例 #5
0
 protected override void OnRecycle()
 {
     _partition      = null;
     _otherPartition = null;
     _candidates.Dispose();
     _candidates = null;
     if (_otherCandidates != null)
     {
         _otherCandidates.Dispose();
         _otherCandidates = null;
     }
     Pool.Recycle(this);
 }
コード例 #6
0
        /// <inheritdoc/>
        protected override void CloneCore(BasePartition <T> source)
        {
            // Clone BasePartition<T> properties.
            base.CloneCore(source);

            // Clone DynamicAabbTree<T> properties.
            var sourceTyped = (DynamicAabbTree <T>)source;

            EnableMotionPrediction = sourceTyped.EnableMotionPrediction;
            MotionPrediction       = sourceTyped.MotionPrediction;
            OptimizationPerFrame   = sourceTyped.OptimizationPerFrame;
            RelativeMargin         = sourceTyped.RelativeMargin;
        }
コード例 #7
0
            public static IEnumerable <Pair <T> > Create(BasePartition <T> partition,
                                                         ISpatialPartition <T> otherPartition, IEnumerable <T> candidates,
                                                         ref Vector3 scale, ref Vector3 otherScaleInverse, ref Pose toOther)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition         = partition;
                enumerable._otherPartition    = otherPartition;
                enumerable._candidates        = candidates.GetEnumerator();
                enumerable._scale             = scale;
                enumerable._otherScaleInverse = otherScaleInverse;
                enumerable._toOther           = toOther;
                return(enumerable);
            }
コード例 #8
0
            public static IEnumerable <T> Create(BasePartition <T> partition, ref Ray ray)
            {
                var enumerable = Pool.Obtain();

                enumerable._partition           = partition;
                enumerable._ray                 = ray;
                enumerable._rayDirectionInverse = new Vector3(1 / ray.Direction.X,
                                                              1 / ray.Direction.Y,
                                                              1 / ray.Direction.Z);
                enumerable._epsilon = Numeric.EpsilonF * (1 + partition.Aabb.Extent.Length);

                Aabb rayAabb = new Aabb(ray.Origin, ray.Origin);

                rayAabb.Grow(ray.Origin + ray.Direction * ray.Length);
                enumerable._enumerator = partition.GetOverlaps(rayAabb).GetEnumerator();
                return(enumerable);
            }
コード例 #9
0
 /// <inheritdoc/>
 protected override void CloneCore(BasePartition <T> source)
 {
     base.CloneCore(source);
 }
コード例 #10
0
 protected virtual void CloneCore(BasePartition <T> source)
 {
     EnableSelfOverlaps = source.EnableSelfOverlaps;
     Filter             = source.Filter;
     GetAabbForItem     = source.GetAabbForItem;
 }