engine: common: use Mod_PointInLeaf in Mod_GetPVSForPoint instead of traversing nodes manually
This commit is contained in:
parent
6cbac51731
commit
3ca15250e8
1 changed files with 2 additions and 13 deletions
|
@ -684,22 +684,11 @@ NOTE: can return NULL
|
||||||
*/
|
*/
|
||||||
byte *Mod_GetPVSForPoint( const vec3_t p )
|
byte *Mod_GetPVSForPoint( const vec3_t p )
|
||||||
{
|
{
|
||||||
mnode_t *node;
|
mleaf_t *leaf;
|
||||||
mleaf_t *leaf = NULL;
|
|
||||||
|
|
||||||
ASSERT( worldmodel != NULL );
|
ASSERT( worldmodel != NULL );
|
||||||
|
|
||||||
node = worldmodel->nodes;
|
leaf = Mod_PointInLeaf( p, worldmodel->nodes );
|
||||||
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
if( node->contents < 0 )
|
|
||||||
{
|
|
||||||
leaf = (mleaf_t *)node;
|
|
||||||
break; // we found a leaf
|
|
||||||
}
|
|
||||||
node = node->children[PlaneDiff( p, node->plane ) <= 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( leaf && leaf->cluster >= 0 )
|
if( leaf && leaf->cluster >= 0 )
|
||||||
return Mod_DecompressPVS( leaf->compressed_vis, world.visbytes );
|
return Mod_DecompressPVS( leaf->compressed_vis, world.visbytes );
|
||||||
|
|
Loading…
Add table
Reference in a new issue