Esempio n. 1
0
/*
====================
FilterBrushIntoTree_r

====================
*/
int FilterBrushIntoTree_r( uBrush_t *b, node_t *node )
{
	uBrush_t		*front, *back;
	int				c;
	
	if( !b )
	{
		return 0;
	}
	
	// add it to the leaf list
	if( node->planenum == PLANENUM_LEAF )
	{
		b->next = node->brushlist;
		node->brushlist = b;
		
		// classify the leaf by the structural brush
		if( b->opaque )
		{
			node->opaque = true;
		}
		return 1;
	}
	
	// split it by the node plane
	SplitBrush( b, node->planenum, &front, &back );
	FreeBrush( b );
	
	c = 0;
	c += FilterBrushIntoTree_r( front, node->children[0] );
	c += FilterBrushIntoTree_r( back, node->children[1] );
	
	return c;
}
Esempio n. 2
0
/*
   =====================
   FilterStructuralBrushesIntoTree

   Mark the leafs as opaque and areaportals
   =====================
 */
void FilterStructuralBrushesIntoTree( entity_t *e, tree_t *tree ) {
	brush_t         *b, *newb;
	int r;
	int c_unique, c_clusters;
	int i;

	Sys_FPrintf( SYS_VRB, "--- FilterStructuralBrushesIntoTree ---\n" );

	c_unique = 0;
	c_clusters = 0;
	for ( b = e->brushes ; b ; b = b->next ) {
		if ( b->detail ) {
			continue;
		}
		c_unique++;
		newb = CopyBrush( b );
		r = FilterBrushIntoTree_r( newb, tree->headnode );
		c_clusters += r;

		// mark all sides as visible so drawsurfs are created
		if ( r ) {
			for ( i = 0 ; i < b->numsides ; i++ ) {
				if ( b->sides[i].winding ) {
					b->sides[i].visible = qtrue;
				}
			}
		}
	}

	/* emit some statistics */
	Sys_FPrintf( SYS_VRB, "%9d structural brushes\n", c_unique );
	Sys_FPrintf( SYS_VRB, "%9d cluster references\n", c_clusters );
}
Esempio n. 3
0
/*
=====================
FilterBrushesIntoTree

Mark the leafs as opaque and areaportals and put brush
fragments in each leaf so portal surfaces can be matched
to materials
=====================
*/
void FilterBrushesIntoTree( uEntity_t *e )
{
	primitive_t			*prim;
	uBrush_t			*b, *newb;
	int					r;
	int					c_unique, c_clusters;
	
	common->Printf( "----- FilterBrushesIntoTree -----\n" );
	
	c_unique = 0;
	c_clusters = 0;
	
	for( prim = e->primitives; prim; prim = prim->next )
	{
		b = prim->brush;
		
		if( !b )
		{
			continue;
		}
		c_unique++;
		newb = CopyBrush( b );
		r = FilterBrushIntoTree_r( newb, e->tree->headnode );
		c_clusters += r;
	}
	common->Printf( "%5i total brushes\n", c_unique );
	common->Printf( "%5i cluster references\n", c_clusters );
}
Esempio n. 4
0
void FilterStructuralBrushesIntoTree( entity_t *e, tree_t *tree, qboolean quiet )
{
    brush_t *b, *newb;
    int r, i;

    if( !quiet )
        Sys_FPrintf (SYS_VRB, "--- FilterStructuralBrushesIntoTree ---\n");

    c_unique = 0;
    c_clusters = 0;
    for ( b = e->brushes ; b ; b = b->next )
    {
        if ( b->detail == qtrue || b->nonsolid == qtrue)
            continue;
        c_unique++;
        newb = CopyBrush( b );
        r = FilterBrushIntoTree_r( newb, tree->headnode );
        c_clusters += r;

        // mark all sides as visible so drawsurfs are created
        if ( r ) {
            for ( i = 0 ; i < b->numsides ; i++ ) {
                if ( b->sides[i].winding ) {
                    b->sides[i].visible = qtrue;
                }
            }
        }
    }

    /* emit some statistics */
    if( !quiet )
        FilterStructuralBrushesIntoTreeStats();
}
Esempio n. 5
0
File: brush.c Progetto: otty/cake3
/*
====================
FilterBrushIntoTree_r
====================
*/
int FilterBrushIntoTree_r(bspBrush_t * b, node_t * node)
{
	bspBrush_t     *front, *back;
	int             c;

	if(!b)
	{
		return 0;
	}

	// add it to the leaf list
	if(node->planenum == PLANENUM_LEAF)
	{
		b->next = node->brushlist;
		node->brushlist = b;

		// classify the leaf by the structural brush
		if(!b->detail)
		{
			if(b->opaque)
			{
				node->opaque = qtrue;
				node->areaportal = qfalse;
			}
			else if(b->contents & CONTENTS_AREAPORTAL)
			{
				if(!node->opaque)
				{
					node->areaportal = qtrue;
				}
			}
		}

		return 1;
	}

	// split it by the node plane
	SplitBrush(b, node->planenum, &front, &back);
	FreeBrush(b);

	c = 0;
	c += FilterBrushIntoTree_r(front, node->children[0]);
	c += FilterBrushIntoTree_r(back, node->children[1]);

	return c;
}
Esempio n. 6
0
int FilterBrushIntoTree_r( brush_t *b, node_t *node )
{
    brush_t		*front, *back;
    int			c;

    /* dummy check */
    if( b == NULL )
        return 0;

    /* add it to the leaf list */
    if( node->planenum == PLANENUM_LEAF )
    {
        /* something somewhere is hammering brushlist */
        b->next = node->brushlist;
        node->brushlist = b;

        /* classify the leaf by the structural brush */
        if( !b->detail )
        {
            if( b->opaque )
            {
                node->opaque = qtrue;
                node->areaportal = qfalse;
            }
            else if( b->compileFlags & C_AREAPORTAL )
            {
                if( !node->opaque )
                    node->areaportal = qtrue;
            }
        }

        return 1;
    }

    /* split it by the node plane */
    c = b->numsides;
    SplitBrush( b, node->planenum, &front, &back );
    FreeBrush( b );

    c = 0;
    c += FilterBrushIntoTree_r( front, node->children[ 0 ] );
    c += FilterBrushIntoTree_r( back, node->children[ 1 ] );

    return c;
}
Esempio n. 7
0
void FilterDetailBrushesIntoTree( entity_t *e, tree_t *tree )
{
    brush_t				*b, *newb;
    int					r;
    int					c_unique, c_clusters;
    int					i;

    /* note it */
    Sys_FPrintf( SYS_VRB,  "--- FilterDetailBrushesIntoTree ---\n" );

    /* walk the list of brushes */
    c_unique = 0;
    c_clusters = 0;
    for( b = e->brushes; b; b = b->next )
    {
        if( b->detail == qfalse || b->nonsolid == qtrue )
            continue;
        c_unique++;
        newb = CopyBrush( b );
        r = FilterBrushIntoTree_r( newb, tree->headnode );
        c_clusters += r;

        /* mark all sides as visible so drawsurfs are created */
        if( r )
        {
            for( i = 0; i < b->numsides; i++ )
            {
                if( b->sides[ i ].winding )
                    b->sides[ i ].visible = qtrue;
            }
        }
    }

    /* emit some statistics */
    Sys_FPrintf( SYS_VRB, "%9d detail brushes\n", c_unique );
    Sys_FPrintf( SYS_VRB, "%9d cluster references\n", c_clusters );
}