Example #1
0
        /// <summary>
        /// Obtener el nodo del mismo nivel a este
        /// </summary>
        /// <returns>Devuelve el nodo del mismo nivel al este</returns>
        public virtual SceneryNode GetEastNode()
        {
            if (this.Parent != null)
            {
                if (this == this.Parent.SouthEast)
                {
                    SceneryNode node = this.Parent.GetEastNode();
                    if (node != null)
                    {
                        return(node.SouthWest);
                    }
                }
                else if (this == this.Parent.SouthWest)
                {
                    return(this.Parent.SouthEast);
                }
                else if (this == this.Parent.NorthEast)
                {
                    SceneryNode node = this.Parent.GetEastNode();
                    if (node != null)
                    {
                        return(node.NorthWest);
                    }
                }
                else if (this == this.Parent.NorthWest)
                {
                    return(this.Parent.NorthEast);
                }
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Construye la jerarquía del nodo actual
        /// </summary>
        /// <param name="northWest">Nodo al noroeste</param>
        /// <param name="northEast">Nodo al noreste</param>
        /// <param name="southWest">Nodo al suroeste</param>
        /// <param name="southEast">Nodo al sureste</param>
        public virtual void Build(SceneryNode northWest, SceneryNode northEast, SceneryNode southWest, SceneryNode southEast)
        {
            northWest.Parent = this;
            northEast.Parent = this;
            southWest.Parent = this;
            southEast.Parent = this;

            Childs.Clear();

            Childs.Add(NodeHeads.NorthWest, northWest);
            Childs.Add(NodeHeads.NorthEast, northEast);
            Childs.Add(NodeHeads.SouthWest, southWest);
            Childs.Add(NodeHeads.SouthEast, southEast);

            BoundingBox northAABB = BoundingBox.CreateMerged(northWest.m_AABB, northEast.m_AABB);
            BoundingBox southAABB = BoundingBox.CreateMerged(southWest.m_AABB, southEast.m_AABB);

            m_AABB = BoundingBox.CreateMerged(northAABB, southAABB);

            BoundingSphere northSPH = BoundingSphere.CreateMerged(northWest.m_SPH, northEast.m_SPH);
            BoundingSphere southSPH = BoundingSphere.CreateMerged(southWest.m_SPH, southEast.m_SPH);

            m_SPH = BoundingSphere.CreateMerged(northSPH, southSPH);

            NodeCenter = Vector3.Divide(m_AABB.Max + m_AABB.Min, 2.0f);
        }
        /// <summary>
        /// Obtener el nodo del mismo nivel a este
        /// </summary>
        /// <returns>Devuelve el nodo del mismo nivel al este</returns>
        public new SceneryTriangleNode GetEastNode()
        {
            SceneryNode node = base.GetEastNode();

            if (node != null)
            {
                return(node as SceneryTriangleNode);
            }

            return(null);
        }
Example #4
0
        /// <summary>
        /// Obtener el nodo del mismo nivel a norte
        /// </summary>
        /// <returns>Devuelve el nodo del mismo nivel al norte</returns>
        public virtual SceneryNode GetNorthNode()
        {
            if (this.Parent != null)
            {
                if (this == this.Parent.NorthWest)
                {
                    // Obtener el nodo al norte
                    SceneryNode node = this.Parent.GetNorthNode();
                    if (node != null)
                    {
                        // Obtener el nodo al suroeste del nodo al norte
                        return(node.SouthWest);
                    }
                }
                else if (this == this.Parent.NorthEast)
                {
                    // Obtener el nodo al norte
                    SceneryNode node = this.Parent.GetNorthNode();
                    if (node != null)
                    {
                        // Obtener el nodo al sureste del nodo al norte
                        return(node.SouthEast);
                    }
                }
                else if (this == this.Parent.SouthWest)
                {
                    // Obtener el nodo al noroeste del nodo actual
                    return(this.Parent.NorthWest);
                }
                else if (this == this.Parent.SouthEast)
                {
                    // Obtener el nodo al noreste del nodo actual
                    return(this.Parent.NorthEast);
                }
            }

            return(null);
        }