Пример #1
0
        /// <summary>
        /// Calculates the bounding box for a set of bounding boxes.
        /// </summary>
        /// <param name="items">The list of all the bounding boxes.</param>
        /// <param name="minIndex">The first bounding box in the list to get the extends of.</param>
        /// <param name="maxIndex">The last bounding box in the list to get the extends of.</param>
        /// <param name="bounds">The extends of all the bounding boxes.</param>
        private static void CalcExtends(BoundingVolumeTreeNode[] items, int minIndex, int maxIndex, out BoundingBoxInt bounds)
        {
            bounds = items[minIndex].Bounds;

            for (int i = minIndex + 1; i < maxIndex; i++)
            {
                var it = items[i];
                bounds.Min = Vector3Int.ComponentMin(it.Bounds.Min, bounds.Min);
                bounds.Max = Vector3Int.ComponentMax(it.Bounds.Max, bounds.Max);
            }
        }