Beispiel #1
0
/*
===============
SV_EdictIsVisible

Checks if edict is potentially visible from the given PVS row.
===============
*/
qboolean SV_EdictIsVisible(cm_t *cm, edict_t *ent, byte *mask)
{
    int i;

    if (ent->num_clusters == -1) {
        // too many leafs for individual check, go by headnode
        return CM_HeadnodeVisible(CM_NodeNum(cm, ent->headnode), mask);
    }

    // check individual leafs
    for (i = 0; i < ent->num_clusters; i++) {
        if (Q_IsBitSet(mask, ent->clusternums[i])) {
            return qtrue;
        }
    }

    return qfalse;  // not visible
}
Beispiel #2
0
/*
* CM_HeadnodeVisible
* Returns true if any leaf under headnode has a cluster that
* is potentially visible
*/
qboolean CM_HeadnodeVisible( cmodel_state_t *cms, int nodenum, qbyte *visbits )
{
	int cluster;
	cnode_t	*node;

	while( nodenum >= 0 )
	{
		node = &cms->map_nodes[nodenum];
		if( CM_HeadnodeVisible( cms, node->children[0], visbits ) )
			return qtrue;
		nodenum = node->children[1];
	}

	cluster = cms->map_leafs[-1 - nodenum].cluster;
	if( cluster == -1 )
		return qfalse;
	if( visbits[cluster>>3] & ( 1<<( cluster&7 ) ) )
		return qtrue;
	return qfalse;
}