34 static cvar_t *cl_add_lights;
35 static cvar_t *cl_show_lights;
41 static cvar_t *cl_testparticles;
42 static cvar_t *cl_testentities;
44 static cvar_t *cl_testlights;
46 static cvar_t *cl_testblend;
48 static cvar_t *cl_stats;
55 dlight_t r_dlights[MAX_DLIGHTS];
65 lightstyle_t r_lightstyles[MAX_LIGHTSTYLES];
124 if (r_numdlights >= MAX_DLIGHTS)
126 dl = &r_dlights[r_numdlights++];
127 VectorCopy(org, dl->origin);
138 VectorCopy(dl->origin, part->origin);
139 part->radius = radius;
140 part->brightness = max(r, max(g, b));
142 part->rgba.u8[0] = (uint8_t)max(0.f, min(255.f, r / part->brightness * 255.f));
143 part->rgba.u8[1] = (uint8_t)max(0.f, min(255.f, g / part->brightness * 255.f));
144 part->rgba.u8[2] = (uint8_t)max(0.f, min(255.f, b / part->brightness * 255.f));
145 part->rgba.u8[3] = 255;
163 void V_AddLightStyle(
int style, vec4_t value)
167 if (style < 0 || style >= MAX_LIGHTSTYLES)
168 Com_Error(ERR_DROP,
"Bad light style %i", style);
169 ls = &r_lightstyles[style];
172 ls->rgb[0] = value[0];
173 ls->rgb[1] = value[1];
174 ls->rgb[2] = value[2];
175 ls->white = value[3];
188 static void V_TestParticles(
void)
197 r = 4 * ((i & 7) - 3.5);
198 u = 4 * (((i >> 3) & 7) - 3.5);
201 for (j = 0; j < 3; j++)
206 p->alpha = cl_testparticles->value;
217 static void V_TestEntities(
void)
229 r = 64 * ((i % 4) - 1.5);
230 f = 64 * (i / 4) + 128;
232 for (j = 0; j < 3; j++)
249 static void V_TestLights(
void)
255 if (cl_testlights->integer != 1) {
260 if (cl_testlights->integer == -1)
261 VectorSet(dl->color, -1, -1, -1);
263 VectorSet(dl->color, 1, 1, 1);
269 memset(r_dlights, 0,
sizeof(r_dlights));
271 for (i = 0; i < r_numdlights; i++) {
274 r = 64 * ((i % 4) - 1.5);
275 f = 64 * (i / 4) + 128;
277 for (j = 0; j < 3; j++)
280 dl->color[0] = ((i % 6) + 1) & 1;
281 dl->color[1] = (((i % 6) + 1) & 2) >> 1;
282 dl->color[2] = (((i % 6) + 1) & 4) >> 2;
326 char name[MAX_QPATH];
340 const entity_t *a = (
const entity_t *)_a;
341 const entity_t *b = (
const entity_t *)_b;
344 if (a->model == b->model)
345 return a->skin - b->skin;
347 return a->model - b->model;
384 if (fov_x < 1 || fov_x > 179)
385 Com_Error(ERR_DROP,
"%s: bad fov: %f", __func__, fov_x);
387 x =
width / tan(fov_x / 360 * M_PI);
415 if (cl_testparticles->integer)
417 if (cl_testentities->integer)
420 if (cl_testlights->integer)
423 if (cl_testblend->integer) {
465 if (!cl_add_lights->integer)
476 cl.
refdef.num_dlights = r_numdlights;
480 cl.
refdef.lightstyles = r_lightstyles;
491 if (cl_stats->integer)
510 Com_Printf(
"(%i %i %i) : %i\n", (
int)
cl.
refdef.vieworg[0],
538 cl_testblend =
Cvar_Get(
"cl_testblend",
"0", 0);
539 cl_testparticles =
Cvar_Get(
"cl_testparticles",
"0", 0);
540 cl_testentities =
Cvar_Get(
"cl_testentities",
"0", 0);
542 cl_testlights =
Cvar_Get(
"cl_testlights",
"0", CVAR_CHEAT);
545 cl_stats =
Cvar_Get(
"cl_stats",
"0", 0);
549 cl_add_lights =
Cvar_Get(
"cl_lights",
"1", 0);
550 cl_show_lights =
Cvar_Get(
"cl_show_lights",
"0", 0);