Beispiel #1
0
 internal GridPopulatedLeafNode(GridUnpopulatedLeafNode unpopulated)
 {
     this.Parent = unpopulated.Parent;
     this.Rectangle = unpopulated.Rectangle;
     this.BoundingRectangle = GridBounds.Uninitialized;
     this.VisibleLeafNodes = null;
     this.StaticOpaqueObjects = new StaticOpaqueObject[] { null };
     this.StaticOpaqueObjectCount = 0;
     this.DisplayList = new DisplayList();
     this.TransparentFaces = new object[1];
     this.TransparentFaceCount = 0;
 }
Beispiel #2
0
 /// <summary>Finalizes the bounding rectangles for the specified node and all its child nodes.</summary>
 /// <param name="node">The node for which to finalize visiblity lists.</param>
 /// <remarks>This function is used to get rid of uninitialized bounding rectangles.</remarks>
 private void FinalizeBoundingRectangles(GridNode node)
 {
     if (node is GridInternalNode) {
         GridInternalNode intern = (GridInternalNode)node;
         for (int i = 0; i < intern.Children.Length; i++) {
             FinalizeBoundingRectangles(intern.Children[i]);
         }
     } else if (node is GridLeafNode) {
         GridLeafNode leaf = (GridLeafNode)node;
         if (leaf.BoundingRectangle.Left > leaf.BoundingRectangle.Right | leaf.BoundingRectangle.Near > leaf.BoundingRectangle.Far) {
             if (leaf is GridPopulatedLeafNode) {
                 GridUnpopulatedLeafNode unpopulated = new GridUnpopulatedLeafNode(leaf.Parent, leaf.Rectangle);
                 unpopulated.BoundingRectangle = unpopulated.Rectangle;
                 for (int i = 0; i < leaf.Parent.Children.Length; i++) {
                     if (unpopulated.Parent.Children[i] == leaf) {
                         unpopulated.Parent.Children[i] = unpopulated;
                     }
                 }
                 unpopulated.Parent.UpdateBoundingRectangle();
             } else {
                 leaf.BoundingRectangle = leaf.Rectangle;
                 leaf.Parent.UpdateBoundingRectangle();
             }
         }
     }
 }