protected override void LoadSpecific()
        {
            // If a height map was set then load it 
            if (m_HeightMapName != "")
            {
                m_HeightMap = RenderManager.Instance.LoadTexture2D(m_HeightMapName);

                if (m_HeightMap != null)
                {
                    // Height map loaded so create quad vertex data
                    m_QuadTree = new QuadTree(this, m_HeightMap);
                   // m_TerrainInfo = new QuadTreeTerrainInfo(m_HeightMap);
                    
                    // Any extra information that is required...
                }
            }

            // Load any info after this
            base.LoadSpecific();
        }
Beispiel #2
0
        /// <summary>
        /// QuadNode constructor
        /// </summary>
        /// <param name="nodeType">Type of node.</param>
        /// <param name="nodeSize">Width/Height of node (# of vertices across - 1).</param>
        /// <param name="nodeDepth">Depth of current node</param>
        /// <param name="parent">Parent QuadNode</param>
        /// <param name="parentTree">Top level Tree.</param>
        /// <param name="positionIndex">Index of top left Vertice in the parent tree Vertices array</param>
        public QuadNode(QuadNodeType nodeType, int nodeSize, int nodeDepth, QuadNode parent, QuadTree parentTree, int positionIndex)
        {
            NodeType = nodeType;
            m_NodeSize = nodeSize;
            m_NodeDepth = nodeDepth;
            m_PositionIndex = positionIndex;

            m_ParentNode = parent;
            m_ParentTree = parentTree;

            // Add the 9 vertices
            AddVertices();

            m_BoundingBox = new BoundingBox(m_ParentTree[VertexTopLeft.Index].Position, m_ParentTree[VertexBottomLeft.Index].Position);
            m_BoundingBox.Min.Y = -950f;
            m_BoundingBox.Max.Y = 950f;

            if (m_NodeSize > 4)
                AddChildren();

            //Make call to UpdateNeighbors from the parent node.
            //This will update all neighbors recursively for the
            //children as well.  This ensures all nodes are created 
            //prior to updating neighbors.
            if (m_NodeDepth == 1)
            {
                AddNeighbours();

                // Activate nodes inside node
                m_VertexTopLeft.Activated = true;
                m_VertexTopRight.Activated = true;
                m_VertexCenter.Activated = true;
                m_VertexBottomLeft.Activated = true;
                m_VertexBottomRight.Activated = true;
            }
        }