Example #1
0
        public void Split()
        {
            if (this.CulledAway)
            {
                return;
            }

            if (Parent != null && !Parent.IsSplit)
            {
                Parent.Split();
            }

            if (CanBeSplit)
            {
                if (hasChildren)
                {
                    ChildTopLeft.Activate();
                    ChildTopRight.Activate();
                    ChildBottomLeft.Activate();
                    ChildBottomRight.Activate();
                    IsActive = false;
                }
                else
                {
                    IsActive = true;
                }
            }

            isSplit = true;
            VertexTopLeft.Activated     = true;
            VertexTopRight.Activated    = true;
            VertexBottomLeft.Activated  = true;
            VertexBottomRight.Activated = true;

            EnsureNeighborParentSplit(NeighborTop);
            EnsureNeighborParentSplit(NeighborBottom);
            EnsureNeighborParentSplit(NeighborLeft);
            EnsureNeighborParentSplit(NeighborRight);


            if (NeighborTop != null)
            {
                NeighborTop.VertexBottom.Activated = true;
            }

            if (NeighborRight != null)
            {
                NeighborRight.VertexLeft.Activated = true;
            }

            if (NeighborBottom != null)
            {
                NeighborBottom.VertexTop.Activated = true;
            }

            if (NeighborLeft != null)
            {
                NeighborLeft.VertexRight.Activated = true;
            }
        }