コード例 #1
0
void Video_DrawClientBoundingBox(ClientEntity_t *clEntity)
{
	MathVector3f_t vMins, vMaxs;

	if (!clEntity->model || ((clEntity == &cl_entities[cl.viewentity]) && !chase_active.bValue) || (clEntity == &cl.viewent))
		return;

	Math_VectorAdd(clEntity->model->rmins, clEntity->origin, vMins);
	Math_VectorAdd(clEntity->model->rmaxs, clEntity->origin, vMaxs);

	switch (clEntity->model->type)
	{
	case MODEL_TYPE_LEVEL:
		// Only draw wires for the BSP, since otherwise it's difficult to see anything else.
		glColor4f(0, 0, 0, 0);
		R_EmitWireBox(vMins, vMaxs, 0, 1, 0);
		break;
	default:
		glColor4f(0.5f, 0, 0, 0.5f);
		R_EmitWireBox(vMins, vMaxs, 1, 0, 0);
	}
}
コード例 #2
0
/*
================
R_ShowBoundingBoxes -- johnfitz

draw bounding boxes -- the server-side boxes, not the renderer cullboxes
================
*/
void R_ShowBoundingBoxes (void)
{
	extern		edict_t *sv_player;
	vec3_t		mins,maxs;
	edict_t		*ed;
	int			i;

	if (!r_showbboxes.value || cl.maxclients > 1 || !r_drawentities.value || !sv.active)
		return;

	glDisable (GL_DEPTH_TEST);
	glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
	GL_PolygonOffset (OFFSET_SHOWTRIS);
	glDisable (GL_TEXTURE_2D);
	glDisable (GL_CULL_FACE);
	glColor3f (1,1,1);

	for (i=0, ed=NEXT_EDICT(sv.edicts) ; i<sv.num_edicts ; i++, ed=NEXT_EDICT(ed))
	{
		if (ed == sv_player)
			continue; //don't draw player's own bbox

//		if (r_showbboxes.value != 2)
//			if (!SV_VisibleToClient (sv_player, ed, sv.worldmodel))
//				continue; //don't draw if not in pvs

		if (ed->v.mins[0] == ed->v.maxs[0] && ed->v.mins[1] == ed->v.maxs[1] && ed->v.mins[2] == ed->v.maxs[2])
		{
			//point entity
			R_EmitWirePoint (ed->v.origin);
		}
		else
		{
			//box entity
			VectorAdd (ed->v.mins, ed->v.origin, mins);
			VectorAdd (ed->v.maxs, ed->v.origin, maxs);
			R_EmitWireBox (mins, maxs);
		}
	}

	glColor3f (1,1,1);
	glEnable (GL_TEXTURE_2D);
	glEnable (GL_CULL_FACE);
	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
	GL_PolygonOffset (OFFSET_NONE);
	glEnable (GL_DEPTH_TEST);

	Sbar_Changed (); //so we don't get dots collecting on the statusbar
}
コード例 #3
0
/*	draw bounding boxes -- the server-side boxes, not the renderer cullboxes
*/
void Video_ShowBoundingBoxes(void)
{
	extern ServerEntity_t	*sv_player;
	MathVector3f_t			mins, maxs;
	ClientEntity_t			*clEntity;
	ServerEntity_t			*ed;
	int						i;

	if (!r_showbboxes.value || (cl.maxclients > 1) || !r_drawentities.value || (!sv.active && !g_state.embedded))
		return;

	VideoLayer_Disable(VIDEO_DEPTH_TEST | VIDEO_TEXTURE_2D);
	VideoLayer_Enable(VIDEO_BLEND);

	for (i=0, ed=NEXT_EDICT(sv.edicts) ; i<sv.num_edicts ; i++, ed=NEXT_EDICT(ed))
	{
		if(ed == sv_player && !chase_active.value)
			continue;

		glColor3f(1,1,1);

		R_EmitWirePoint (ed->v.origin);

		Math_VectorAdd(ed->v.mins,ed->v.origin,mins);
		Math_VectorAdd(ed->v.maxs,ed->v.origin,maxs);

		glColor4f(0, 0.5f, 0, 0.5f);

		R_EmitWireBox(mins,maxs, 1, 1, 1);
	}

	// Cycle through client-side entities.
	for (i = 0, clEntity = cl_entities; i < cl.num_entities; i++, clEntity++)
		Video_DrawClientBoundingBox(clEntity);
	for (i = 0, clEntity = cl_temp_entities; i < cl_numvisedicts; i++, clEntity++)
		Video_DrawClientBoundingBox(clEntity);

	VideoLayer_Disable(VIDEO_BLEND);
	VideoLayer_Enable(VIDEO_TEXTURE_2D | VIDEO_DEPTH_TEST);
}