Ejemplo n.º 1
0
        /// <summary>
        /// Create a new tree node
        /// </summary>
        public CollisionTreeNode(CollisionBox collisionBox, uint subdivLevel)
        {
            if (collisionBox == null)
            {
                throw new ArgumentNullException("collisionBox");
            }

            // save node box
            box = collisionBox;

            // if subdivision needed
            if (subdivLevel > 0)
            {
                // decrease subdivision level
                subdivLevel--;

                // create the 8 children
                children = new CollisionTreeNode[8];
                CollisionBox[] childrenBox = box.GetChildren();
                for (uint i = 0; i < 8; i++)
                {
                    children[i] = new CollisionTreeNode(childrenBox[i], subdivLevel);
                }
            }
        }
 public CollisionTreeNode(CollisionBox b,uint subdiv_level)
 {
     box = b;
     if (subdiv_level>0)
     {
         subdiv_level--;
         childs = new CollisionTreeNode[8];
         CollisionBox[] childs_box = box.GetChilds();
         for( uint i=0;i<8;i++ )
             childs[i] = new CollisionTreeNode(childs_box[i], subdiv_level);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new tree node
        /// </summary>
        public CollisionTreeNode(CollisionBox collisionBox, uint subdivLevel)
        {
            if (collisionBox == null)
            {
                throw new ArgumentNullException("collisionBox");
            }

            // save node box
            box = collisionBox;

            // if subdivision needed
            if (subdivLevel > 0)
            {
                // decrease subdivision level
                subdivLevel--;

                // create the 8 children
                children = new CollisionTreeNode[8];
                CollisionBox[] childrenBox = box.GetChildren();
                for (uint i = 0; i < 8; i++)
                    children[i] = new CollisionTreeNode(childrenBox[i], subdivLevel);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Add the dynamic element to the node
 /// </summary>
 public override void AddToNode(CollisionTreeNode n)
 {
     nodes.Add(n);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Virtual function when adding the element to a node
 /// </summary>
 public virtual void AddToNode(CollisionTreeNode n)
 {
 }
Ejemplo n.º 6
0
 public CollisionTree(CollisionBox box, uint subdivLevel)
 {
     root = new CollisionTreeNode(box, subdivLevel);
     recurseId = 0;
 }
Ejemplo n.º 7
0
 public CollisionTree(CollisionBox box, uint subdivLevel)
 {
     root      = new CollisionTreeNode(box, subdivLevel);
     recurseId = 0;
 }
 public override void AddToNode(CollisionTreeNode n)
 {
     nodes.Add(n);
 }
 public virtual void AddToNode(CollisionTreeNode n)
 {
 }