// Token: 0x06000034 RID: 52 RVA: 0x0000291C File Offset: 0x00000B1C
        public ICollection <int> BoxQuery(AxisAlignedBox3 box)
        {
            List <int> list = new List <int>();
            QuantizedAxisAlignedBox3 quantizedAabb = this.Quantize(box);
            int i = 0;

            while (i < this.quantizedAabbTreeNodes.Length)
            {
                bool flag  = this.TestQuantizedBoxOverlap(i, quantizedAabb);
                bool flag2 = this.IsDataNode(i);
                if (flag2 && flag)
                {
                    list.Add(this.GetNodeDataValue(i));
                    i++;
                }
                else if (flag2 || flag)
                {
                    i++;
                }
                else
                {
                    i += this.GetBranchNodeWidth(i);
                }
            }
            return(list);
        }
        // Token: 0x0600004A RID: 74 RVA: 0x0000313C File Offset: 0x0000133C
        private int BuildSubTree(int outputIndex, IList <InputBox> inputBoxes, int left, int right, out QuantizedAxisAlignedBox3 subTreeBoundingBox)
        {
            if (right - left == 1)
            {
                QuantizedAxisAlignedBox3 quantizedAxisAlignedBox = this.Quantize(inputBoxes[left].Aabb);
                this.CreateDataNode(outputIndex, quantizedAxisAlignedBox, inputBoxes[left].Data);
                subTreeBoundingBox = quantizedAxisAlignedBox;
                return(1);
            }
            if (right - left == 2)
            {
                QuantizedAxisAlignedBox3 quantizedAabb = this.Quantize(inputBoxes[left].Aabb);
                this.CreateDataNode(outputIndex + 1, quantizedAabb, inputBoxes[left].Data);
                QuantizedAxisAlignedBox3 quantizedAxisAlignedBox2 = this.Quantize(inputBoxes[left + 1].Aabb);
                this.CreateDataNode(outputIndex + 2, quantizedAxisAlignedBox2, inputBoxes[left + 1].Data);
                subTreeBoundingBox = quantizedAabb.CreateMergedWith(quantizedAxisAlignedBox2);
                this.CreateBranchNode(outputIndex, subTreeBoundingBox, 3);
                return(3);
            }
            int num = this.SplitByOneAxis(inputBoxes, left, right);
            QuantizedAxisAlignedBox3 quantizedAxisAlignedBox3;
            int num2 = this.BuildSubTree(outputIndex + 1, inputBoxes, left, num, out quantizedAxisAlignedBox3);
            QuantizedAxisAlignedBox3 other;
            int num3 = this.BuildSubTree(outputIndex + num2 + 1, inputBoxes, num, right, out other);

            subTreeBoundingBox = quantizedAxisAlignedBox3.CreateMergedWith(other);
            int num4 = num2 + num3 + 1;

            this.CreateBranchNode(outputIndex, subTreeBoundingBox, num4);
            return(num4);
        }
        // Token: 0x06000049 RID: 73 RVA: 0x00003000 File Offset: 0x00001200
        private Aabb Unquantize(QuantizedAxisAlignedBox3 value)
        {
            Vector3 right  = new Vector3((double)value.MinX / this.bvhQuantization.X + this.globalAabb.Min.X, (double)value.MinY / this.bvhQuantization.Y + this.globalAabb.Min.Y, (double)value.MinZ / this.bvhQuantization.Z + this.globalAabb.Min.Z);
            Vector3 left   = new Vector3((double)value.MaxX / this.bvhQuantization.X + this.globalAabb.Min.X, (double)value.MaxY / this.bvhQuantization.Y + this.globalAabb.Min.Y, (double)value.MaxZ / this.bvhQuantization.Z + this.globalAabb.Min.Z);
            Vector3 center = (left + right) / 2.0;
            Vector3 extent = (left - right) / 2.0;

            return(new Aabb(center, extent));
        }
 // Token: 0x06000025 RID: 37 RVA: 0x00002450 File Offset: 0x00000650
 public QuantizedAxisAlignedBox3 CreateMergedWith(QuantizedAxisAlignedBox3 other)
 {
     return(new QuantizedAxisAlignedBox3(Math.Min(this.MinX, other.MinX), Math.Max(this.MaxX, other.MaxX), Math.Min(this.MinY, other.MinY), Math.Max(this.MaxY, other.MaxY), Math.Min(this.MinZ, other.MinZ), Math.Max(this.MaxZ, other.MaxZ)));
 }
 // Token: 0x06000044 RID: 68 RVA: 0x00002EE2 File Offset: 0x000010E2
 private void CreateDataNode(int nodeIndex, QuantizedAxisAlignedBox3 quantizedAabb, int dataValue)
 {
     this.quantizedAabbTreeNodes[nodeIndex].SetAsDataValue(dataValue, quantizedAabb);
 }
 // Token: 0x06000045 RID: 69 RVA: 0x00002EF7 File Offset: 0x000010F7
 private void CreateBranchNode(int nodeIndex, QuantizedAxisAlignedBox3 quantizedAabb, int width)
 {
     this.quantizedAabbTreeNodes[nodeIndex].SetAsBranch(width, quantizedAabb);
 }
        // Token: 0x06000043 RID: 67 RVA: 0x00002EBC File Offset: 0x000010BC
        private Aabb GetAabb(int nodeIndex)
        {
            QuantizedAxisAlignedBox3 quantizedAabb = this.quantizedAabbTreeNodes[nodeIndex].GetQuantizedAabb();

            return(this.Unquantize(quantizedAabb));
        }
 // Token: 0x06000040 RID: 64 RVA: 0x00002E81 File Offset: 0x00001081
 private bool TestQuantizedBoxOverlap(int nodeIndex, QuantizedAxisAlignedBox3 quantizedAabb)
 {
     return(this.quantizedAabbTreeNodes[nodeIndex].TestQuantizedBoxOverlap(quantizedAabb));
 }
Beispiel #9
0
 // Token: 0x06000052 RID: 82 RVA: 0x000033B4 File Offset: 0x000015B4
 public bool TestQuantizedBoxOverlap(QuantizedAxisAlignedBox3 aabb)
 {
     return(this.quantizedAabb.MinX < aabb.MaxX && this.quantizedAabb.MaxX > aabb.MinX && this.quantizedAabb.MinY < aabb.MaxY && this.quantizedAabb.MaxY > aabb.MinY && this.quantizedAabb.MinZ < aabb.MaxZ && this.quantizedAabb.MaxZ > aabb.MinZ);
 }
Beispiel #10
0
 // Token: 0x06000051 RID: 81 RVA: 0x000033A2 File Offset: 0x000015A2
 public void SetAsDataValue(int dataValue, QuantizedAxisAlignedBox3 aabb)
 {
     this.widthOrValue  = dataValue;
     this.quantizedAabb = aabb;
 }
Beispiel #11
0
 // Token: 0x06000050 RID: 80 RVA: 0x00003391 File Offset: 0x00001591
 public void SetAsBranch(int width, QuantizedAxisAlignedBox3 aabb)
 {
     this.widthOrValue  = -width;
     this.quantizedAabb = aabb;
 }