Ejemplo n.º 1
0
/*
=============
Portal_VisFlood

Returns true if the portal is empty or translucent, allowing
the PVS calculation to see through it.
The nodes on either side of the portal may actually be clusters,
not leafs, so all contents should be ored together
=============
*/
qboolean Portal_VisFlood (portal_t *p)
{
	int		c1, c2;

	if (!p->onnode)
		return false;	// to global outsideleaf

	c1 = ClusterContents(p->nodes[0]);
	c2 = ClusterContents(p->nodes[1]);

	if (!VisibleContents (c1^c2))
		return true;

	if (c1 & (CONTENTS_TRANSLUCENT|CONTENTS_DETAIL))
		c1 = 0;
	if (c2 & (CONTENTS_TRANSLUCENT|CONTENTS_DETAIL))
		c2 = 0;

	if ( (c1|c2) & CONTENTS_SOLID )
		return false;		// can't see through solid

	if (! (c1 ^ c2))
		return true;		// identical on both sides

	if (!VisibleContents (c1^c2))
		return true;
	return false;
}
Ejemplo n.º 2
0
//===========================================================================
// Returns true if the portal is empty or translucent, allowing
// the PVS calculation to see through it.
// The nodes on either side of the portal may actually be clusters,
// not leaves, so all contents should be ored together
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
qboolean Portal_VisFlood( portal_t *p ) {
	int c1, c2;

	if ( !p->onnode ) {
		return false;   // to global outsideleaf

	}
	c1 = ClusterContents( p->nodes[0] );
	c2 = ClusterContents( p->nodes[1] );

	if ( !VisibleContents( c1 ^ c2 ) ) {
		return true;
	}

	if ( c1 & ( CONTENTS_Q2TRANSLUCENT | CONTENTS_DETAIL ) ) {
		c1 = 0;
	}
	if ( c2 & ( CONTENTS_Q2TRANSLUCENT | CONTENTS_DETAIL ) ) {
		c2 = 0;
	}

	if ( ( c1 | c2 ) & CONTENTS_SOLID ) {
		return false;       // can't see through solid

	}
	if ( !( c1 ^ c2 ) ) {
		return true;        // identical on both sides

	}
	if ( !VisibleContents( c1 ^ c2 ) ) {
		return true;
	}
	return false;
} //end of the function Portal_VisFlood
Ejemplo n.º 3
0
/*
 * ===============
 * ClusterContents
 * ===============
 */
static int32_t ClusterContents(const node_t * node) {
    int32_t c1, c2, c;

    if (node->plane_num == PLANENUM_LEAF)
        return node->contents;

    c1 = ClusterContents(node->children[0]);
    c2 = ClusterContents(node->children[1]);
    c = c1 | c2;

    // a cluster may include some solid detail areas, but
    // still be seen into
    if (!(c1 & CONTENTS_SOLID) || !(c2 & CONTENTS_SOLID))
        c &= ~CONTENTS_SOLID;
    return c;
}
Ejemplo n.º 4
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int ClusterContents( node_t *node ) {
	int c1, c2, c;

	if ( node->planenum == PLANENUM_LEAF ) {
		return node->contents;
	}

	c1 = ClusterContents( node->children[0] );
	c2 = ClusterContents( node->children[1] );
	c = c1 | c2;

	// a cluster may include some solid detail areas, but
	// still be seen into
	if ( !( c1 & CONTENTS_SOLID ) || !( c2 & CONTENTS_SOLID ) ) {
		c &= ~CONTENTS_SOLID;
	}
	return c;
} //end of the function ClusterContents