Beispiel #1
0
/*
===============
CL_AddDLights

===============
*/
void CL_AddDLights (void)
{
	int			i;
	cdlight_t	*dl;

	dl = cl_dlights;

//=====
//PGM
#ifdef GL_QUAKE
	for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
	{
		if (!dl->radius)
			continue;
		V_AddLight (dl->origin, dl->radius,	dl->color[0], dl->color[1], dl->color[2]);
	}
#else
	for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
	{
		if (!dl->radius)
			continue;

		// negative light in software. only black allowed
		if ((dl->color[0] < 0) || (dl->color[1] < 0) || (dl->color[2] < 0))
		{
			dl->radius = -(dl->radius);
			dl->color[0] = dl->color[1] = dl->color[2] = 1;
		}
		V_AddLight (dl->origin, dl->radius,	dl->color[0], dl->color[1], dl->color[2]);
	}
#endif
}
Beispiel #2
0
void CL_AddDLights (void) {
	int			i;
	cdlight_t	*dl;

	dl = cl_dlights;

	if(vidref_val == VIDREF_GL) {
		for (i=0 ; i<MAX_DLIGHTS ; i++, dl++) {
			if (!dl->radius)
				continue;

			V_AddLight (dl->origin, dl->radius,
			            dl->color[0], dl->color[1], dl->color[2]);
		}

	} else {
		for (i=0 ; i<MAX_DLIGHTS ; i++, dl++) {
			if (!dl->radius)
				continue;

			/* negative light in software. only black allowed */
			if ((dl->color[0] < 0) || (dl->color[1] < 0) || (dl->color[2] < 0)) {
				dl->radius = -(dl->radius);
				dl->color[0] = 1;
				dl->color[1] = 1;
				dl->color[2] = 1;
			}

			V_AddLight (dl->origin, dl->radius,
			            dl->color[0], dl->color[1], dl->color[2]);
		}
	}
}
Beispiel #3
0
/*
===============
CL_AddDLights

===============
*/
void CL_AddDLights (void)
{
	int			i;
	cdlight_t	*dl;

	dl = cl_dlights;

	for (i = 0; i < MAX_LIGHTS; i++, dl++)
	{
		if (!dl->radius)
			continue;

		V_AddLight (dl->origin, dl->radius, dl->color[0], dl->color[1], dl->color[2]);
	}
}
Beispiel #4
0
static void DrawSurfInfo()
{
	static const flagInfo_t surfNames[] = {
#define T(name)		{SURF_##name, #name}
		T(LIGHT), T(SLICK), T(SKY), T(WARP),
		T(TRANS33), T(TRANS66), T(FLOWING), T(NODRAW),
		// Kingpin flags
		T(ALPHA), T(DIFFUSE), T(SPECULAR),
		// new flags (temp ??)
		T(AUTOFLARE)
#undef T
	};

	static const char *materialNames[MATERIAL_COUNT] = {
		"silent",
		"concrete",
		"fabric",
		"gravel",
		"metal",
		"metal_l",
		"snow",
		"tin",
		"tile",
		"wood",
		"water",
		"glass",
		"dirt"
	};

	CVec3 start, end;
	start = cl.refdef.vieworg;
	Euler2Vecs(cl.refdef.viewangles, &end, NULL, NULL);
	end.Scale(500);
	end.Add(start);

	unsigned cont = r_surfinfo->integer & 4 ? MASK_ALL : MASK_SHOT|MASK_WATER;
	trace_t	trace;
#if TRACE_DEBUG
	cm_showTrace = true;
#endif
//static CBox nullBox = {{-2,-2,-2},{2,2,2}};
//static CBox nullBox = {{-10,-10,-10},{10,10,10}};
//static CBox nullBox = {{-20,-20,-20},{20,20,20}};
	CM_BoxTrace(trace, start, end, nullBox, 0, cont);
	CM_ClipTraceToModels(trace, start, end, nullBox, cont);
#if TRACE_DEBUG
	cm_showTrace = false;
#endif
	if (!(r_surfinfo->integer & 2))
		CL_EntityTrace(trace, start, end, nullBox, cont);
	V_AddLight(trace.endpos, 5, 0.3, 0.6, 0.3);	//?? keep or remove? intens > trace bounds!

	if (trace.fraction < 1.0)
	{
		if (trace.brushNum >= 0)
		{
			// brush
			RE_DrawTextLeft(va("BrushNum: %d", trace.brushNum), RGB(0.2,0.4,0.1));
			if (r_surfinfo->integer & 8)
			{
				// visualize brush
				if (!debugMem) debugMem = new CMemoryChain;
				CBrush *brush = CM_BuildBrush(trace.brushNum, debugMem);
				if (brush)
					RE_DrawBrush(brush, "brush", trace.brushNum);
				else
					RE_DrawTextLeft(va("brush %d: error", trace.brushNum), RGB(1,0,0));
			}
		}
		RE_DrawTextLeft("Surface info:\n-------------", RGB(0.4,0.4,0.6));
		RE_DrawTextLeft(va("Point: %g  %g  %g", VECTOR_ARG(trace.endpos)), RGB(0.2,0.4,0.1));
		csurface_t *surf = trace.surface;
		RE_DrawTextLeft(va("Normal: %g  %g  %g", VECTOR_ARG(trace.plane.normal)), RGB(0.2,0.4,0.1));
		if (surf->fullName[0])		// non-null surface
		{
			RE_DrawTextLeft(va("Texture: %s", surf->fullName), RGB(0.2,0.4,0.1));
			if (surf->value)
				RE_DrawTextLeft(va("Value: %d", surf->value), RGB(0.2,0.4,0.1));
			DrawFlag(surf->flags, ARRAY_ARG(surfNames), "SURF_");
			// material
			const char *s = (surf->material > 0 && surf->material < MATERIAL_COUNT) ?
				materialNames[surf->material] : "?? bad ??";
			RE_DrawTextLeft(va("Material: %s", s), RGB(0.3,0.6,0.4));
		}
		DecodeContents(trace.contents);
		if (trace.ent)
		{
			clEntityState_t *ent = (clEntityState_t*)trace.ent;
			RE_DrawTextLeft("\nEntity:\n-------", RGB(0.4,0.4,0.6));
			RE_DrawTextLeft(va("Origin: %g %g %g", VECTOR_ARG(ent->origin)), RGB(0.2,0.4,0.1));
			RE_DrawTextLeft(va("fx: %X  rfx: %X", ent->effects, ent->renderfx), RGB(0.2,0.4,0.1));
			if (ent->modelindex)	RE_DrawTextLeft(va("model: %s", ModelName(ent->modelindex)), RGB(0.2,0.4,0.1));
			if (ent->modelindex2)	RE_DrawTextLeft(va("model2: %s", ModelName(ent->modelindex2)), RGB(0.2,0.4,0.1));
			if (ent->modelindex3)	RE_DrawTextLeft(va("model3: %s", ModelName(ent->modelindex3)), RGB(0.2,0.4,0.1));
			if (ent->modelindex4)	RE_DrawTextLeft(va("model4: %s", ModelName(ent->modelindex4)), RGB(0.2,0.4,0.1));

			CL_AddEntityBox(ent, RGB(1,0.1,0.1));
		}
		RE_DrawTextLeft("");	// empty line
	}
}