예제 #1
0
파일: sv_main.c 프로젝트: Izhido/qrevpak
void SV_AddToFatPVS (vec3_t org, mnode_t *node)
{
	int		i;
	byte	*pvs;
	mplane_t	*plane;
	float	d;

	while (1)
	{
	// if this is a leaf, accumulate the pvs bits
		if (node->contents < 0)
		{
			if (node->contents != CONTENTS_SOLID)
			{
				pvs = Mod_LeafPVS ( (mleaf_t *)node, sv.worldmodel);
				for (i=0 ; i<fatbytes ; i++)
					fatpvs[i] |= pvs[i];
			}
			return;
		}
	
		plane = node->plane;
		d = DotProduct (org, plane->normal) - plane->dist;
		if (d > 8)
			node = node->children[0];
		else if (d < -8)
			node = node->children[1];
		else
		{	// go down both
			SV_AddToFatPVS (org, node->children[0]);
			node = node->children[1];
		}
	}
}
예제 #2
0
void Server::SV_AddToFatPVS(vec3_t org, q1_bsp_node *node)
{
	int			i;
	byte		*pvs;
	q1_plane	*plane;
	vec3_fixed16 forg;
	fixed32p16 dd;
	
	forg = org;

	while (1)
	{
		// if this is a leaf, accumulate the pvs bits
		if (node->m_contents < 0)
		{
			if (node->m_contents != CONTENTS_SOLID)
			{
				q1_leaf_node *leaf = reinterpret_cast < q1_leaf_node *>(node);
				pvs = m_worldmodel->decompress_vis(leaf->m_compressed_vis);
				for (i = 0; i<fatbytes; i++)
					fatpvs[i] |= pvs[i];
			}
			return;
		}

		plane = node->m_plane;
		dd = (*plane) * forg;
		if (dd > fixed32p16(8<<16))
			node = node->m_children[0];
		else if (dd < fixed32p16(-8 << 16))
			node = node->m_children[1];
		else
		{	// go down both
			SV_AddToFatPVS(org, node->m_children[0]);
			node = node->m_children[1];
		}
	}
}