示例#1
0
        /// <summary>
        /// Search a node of the <c>OcTree</c> structure.
        /// </summary>
        /// <param name="box">Bounding box covered by the node.</param>
        /// <returns>Reference to the node searched.</returns>
        public void Move(Vector3 distance)
        {
            List <OcTreeNode> nodes = new List <OcTreeNode>();

            nodes.Add(_rootNode);

            while (nodes.Count != 0)
            {
                OcTreeNode node = nodes[0];
                nodes.Remove(node);

                if (node.ChildList.Count != 0)
                {
                    foreach (OcTreeNode childNode in node.ChildList)
                    {
                        nodes.Add(childNode);
                    }
                }
                else
                {
                    foreach (KeyValuePair <NodeType, DrawableModel> model in node.ModelList)
                    {
                        model.Value.Position += distance;
                    }

                    node.Center += distance;

                    node.CalcBoundingBox();
                    node.CalcVertex();
                    //node.BoundingBox = new BoundingBox(node.BoundingBox.Min + distance,
                    //    node.BoundingBox.Max + distance);
                }
            }
        }