/// <summary> /// Builds the convex regions for a root node and all its children /// </summary> private void BuildConvexRegions( BspNode node ) { // Find the bounding box for the tree float[] bounds = new float[ 4 ] { float.MaxValue, float.MaxValue, float.MinValue, float.MinValue }; GetNodeBoundingRectangle( node, bounds ); // Expand bounds a bit float boundary = 1.0f; bounds[ 0 ] -= boundary; bounds[ 1 ] -= boundary; bounds[ 2 ] += boundary; bounds[ 3 ] += boundary; float width = bounds[ 2 ] - bounds[ 0 ]; float height = bounds[ 3 ] - bounds[ 1 ]; Tesselator tess = new Tesselator( ); Tesselator.Polygon boundingPoly = tess.CreateBoundingPolygon( bounds[ 0 ], bounds[ 1 ], width, height ); BuildConvexRegions( node, tess, boundingPoly ); m_Points = tess.Points.ToArray( ); }