示例#1
0
        public void RebuildQuadTree(int maxDepth, int minNodeSize)
        {
            m_minNodeSize = minNodeSize;
            m_maxDepth    = maxDepth;

            m_rootQuadTreeNode = new QuadTreeNode();

            int xAxis = 0;
            int yAxis = 1;
            int zAxis = 2;

            float min = 100000f;
            float max = -100000f;

            if (m_upAxis == 0)
            {
                xAxis = 1;
                yAxis = 0;
                zAxis = 2;
            }
            else if (m_upAxis == 2)
            {
                xAxis = 0;
                yAxis = 2;
                zAxis = 1;
            }

            m_rootQuadTreeNode.vmin = m_localAabbMin;
            m_rootQuadTreeNode.vmax = m_localAabbMax;

            BuildNodes(m_rootQuadTreeNode, 0, maxDepth, minNodeSize, xAxis, yAxis, zAxis);
            // cheat second pass to rebuild heights.
            // adjust heights.
            m_rootQuadTreeNode.AdjustHeightValues(xAxis, yAxis, zAxis, ref min, ref max, this);
        }
        public void RebuildQuadTree(int maxDepth,int minNodeSize)
        {
            m_minNodeSize = minNodeSize;
            m_maxDepth = maxDepth;

            m_rootQuadTreeNode = new QuadTreeNode();

            int xAxis = 0;
            int yAxis = 1;
            int zAxis = 2;

            float min = 100000f;
            float max = -100000f;

            if (m_upAxis == 0)
            {
                xAxis = 1;
                yAxis = 0;
                zAxis = 2;
            }
            else if (m_upAxis == 2)
            {
                xAxis = 0;
                yAxis = 2;
                zAxis = 1;
            }

            m_rootQuadTreeNode.vmin = m_localAabbMin;
            m_rootQuadTreeNode.vmax = m_localAabbMax;

            BuildNodes(m_rootQuadTreeNode, 0, maxDepth, minNodeSize, xAxis, yAxis, zAxis);
            // cheat second pass to rebuild heights.
            // adjust heights.
            m_rootQuadTreeNode.AdjustHeightValues(xAxis,yAxis, zAxis,ref min, ref max,this);

        }