Example #1
0
        public AABBTreeNode(BinaryReader br)
        {
            aabb.Min.X = br.ReadSingle();
            aabb.Min.Y = br.ReadSingle();
            aabb.Min.Z = br.ReadSingle();

            aabb.Max.X = br.ReadSingle();
            aabb.Max.Y = br.ReadSingle();
            aabb.Max.Z = br.ReadSingle();

            int childrenCount = br.ReadInt32();

            if (childrenCount == 0)
            {
                faceData = new TreeFace();
                faceData.ReadData(br);
            }
            else
            {
                children = new BaseTreeNode[childrenCount];
                for (int i = 0; i < childrenCount; i++)
                {
                    children[i] = new AABBTreeNode(br);
                }
            }
        }
Example #2
0
 public void Dispose()
 {
     if (children != null)
     {
         for (int i = 0; i < children.Length; i++)
         {
             children[i].Dispose();
             children[i] = null;
         }
     }
     faceData = null;
     //if (childrenUBound != -1)
     //{
     //    for (int i = 0; i <= childrenUBound; i++)
     //    {
     //        ((IDisposable)children[i]).Dispose();
     //        children[i] = null;
     //    }
     //    children = null;
     //}
     //else
     //    faceData = null;
 }
Example #3
0
        public BBTreeNode(BinaryReader br)
        {
            ball.Center.X = br.ReadSingle();
            ball.Center.Y = br.ReadSingle();
            ball.Center.Z = br.ReadSingle();

            ball.Radius = br.ReadSingle();

            int childrenCount = br.ReadInt32();

            if (childrenCount == 0)
            {
                faceData = new TreeFace();
                faceData.ReadData(br);
            }
            else
            {
                children = new BaseTreeNode[childrenCount];
                for (int i = 0; i < childrenCount; i++)
                {
                    children[i] = new AABBTreeNode(br);
                }
            }
        }