예제 #1
0
        /// <summary>
        /// Builds the convex region for a node and its children
        /// </summary>
        private static void BuildConvexRegions( BspNode node, Tesselator tess, Tesselator.Polygon poly )
        {
            Tesselator.Polygon behindPoly;
            Tesselator.Polygon inFrontPoly;
            tess.Split( node.Plane, poly, out behindPoly, out inFrontPoly );

            if ( node.Behind != null )
            {
                BuildConvexRegions( node.Behind, tess, behindPoly );
            }
            if ( node.InFront != null )
            {
                BuildConvexRegions( node.InFront, tess, inFrontPoly );
            }
            else
            {
                node.ConvexRegion = inFrontPoly.Indices;
            }
        }