// Token: 0x06000048 RID: 72 RVA: 0x00002F34 File Offset: 0x00001134 private QuantizedAxisAlignedBox3 Quantize(Aabb aabb) { Vector3 vector = aabb.Min - this.globalAabb.Min; Vector3 vector2 = aabb.Max - this.globalAabb.Min; return(new QuantizedAxisAlignedBox3(QuantizedAxisAlignedBox3Tree.RoundedQuantize(vector.X, this.bvhQuantization.X), QuantizedAxisAlignedBox3Tree.RoundedQuantize(vector2.X, this.bvhQuantization.X), QuantizedAxisAlignedBox3Tree.RoundedQuantize(vector.Y, this.bvhQuantization.Y), QuantizedAxisAlignedBox3Tree.RoundedQuantize(vector2.Y, this.bvhQuantization.Y), QuantizedAxisAlignedBox3Tree.RoundedQuantize(vector.Z, this.bvhQuantization.Z), QuantizedAxisAlignedBox3Tree.RoundedQuantize(vector2.Z, this.bvhQuantization.Z))); }
// Token: 0x06000031 RID: 49 RVA: 0x0000285C File Offset: 0x00000A5C public QuantizedAxisAlignedBox3Tree(IList <InputBox> inputBoxes) { this.globalAabb = QuantizedAxisAlignedBox3Tree.MergeBoxes(inputBoxes, 0, inputBoxes.Count); Vector3 vector = this.globalAabb.Max - this.globalAabb.Min; this.bvhQuantization = new Vector3(65535.0 / vector.X, 65535.0 / vector.Y, 65535.0 / vector.Z); int num = inputBoxes.Count * 2 - 1; this.quantizedAabbTreeNodes = new QuantizedAxisAlignedBox3TreeNode[num]; QuantizedAxisAlignedBox3 quantizedAxisAlignedBox; this.BuildSubTree(0, inputBoxes, 0, inputBoxes.Count, out quantizedAxisAlignedBox); }
// Token: 0x0600003B RID: 59 RVA: 0x00002D38 File Offset: 0x00000F38 private static int InPlaceSplitZ(IList <InputBox> inputBoxes, int left, int right, double pivotValue) { int num = left; for (int i = left; i < right; i++) { if (inputBoxes[i].Aabb.Center.Z > pivotValue) { QuantizedAxisAlignedBox3Tree.SwapInputBoxes(inputBoxes, i, num); num++; } } return(num); }
// Token: 0x0600004B RID: 75 RVA: 0x0000325C File Offset: 0x0000145C private int SplitByOneAxis(IList <InputBox> inputBoxes, int left, int right) { Vector3 right2 = QuantizedAxisAlignedBox3Tree.CalculateMeanOfCenterPoints(inputBoxes, left, right); Vector3 left2 = new Vector3(0.0, 0.0, 0.0); for (int i = left; i < right; i++) { Vector3 vector = inputBoxes[i].Aabb.Center - right2; Vector3 right3 = vector * vector; left2 += right3; } int num; if (left2.X > left2.Y) { if (left2.X > left2.Z) { num = QuantizedAxisAlignedBox3Tree.InPlaceSplitX(inputBoxes, left, right, right2.X); } else { num = QuantizedAxisAlignedBox3Tree.InPlaceSplitZ(inputBoxes, left, right, right2.Z); } } else if (left2.Y > left2.Z) { num = QuantizedAxisAlignedBox3Tree.InPlaceSplitY(inputBoxes, left, right, right2.Y); } else { num = QuantizedAxisAlignedBox3Tree.InPlaceSplitZ(inputBoxes, left, right, right2.Z); } int num2 = (right - left) / 3; if (num <= left + num2) { num = (left + right) / 2; } else if (num >= right - 1 - num2) { num = (left + right) / 2; } return(num); }