Force OpenGL path for light primitives

This fixes a long standing and until now unnoticed bug with negative
colored dynamic lights. Since we never set the OpenGL renderer as out
renderer, remaining softrenderer code was executed and the corresponding
effects never rendered. This manifested itself in missing darkness
around the "gravity well" in rogue.
This commit is contained in:
Yamagi Burmeister 2014-02-12 19:39:23 +01:00
parent 37dd396f36
commit 5ce3a266e9
4 changed files with 8 additions and 69 deletions

View file

@ -2053,14 +2053,6 @@ CL_ColorFlash(vec3_t pos, int ent, float intensity, float r, float g, float b)
{
cdlight_t *dl;
if ((vidref_val == VIDREF_SOFT) && ((r < 0) || (g < 0) || (b < 0)))
{
intensity = -intensity;
r = -r;
g = -g;
b = -b;
}
dl = CL_AllocDlight(ent);
VectorCopy(pos, dl->origin);
dl->radius = intensity;
@ -2305,11 +2297,8 @@ CL_Heatbeam(vec3_t start, vec3_t forward)
VectorCopy(cl.v_right, right);
VectorCopy(cl.v_up, up);
if (vidref_val == VIDREF_GL)
{
VectorMA(move, -0.5, right, move);
VectorMA(move, -0.5, up, move);
}
VectorMA(move, -0.5, right, move);
VectorMA(move, -0.5, up, move);
time = (float)cl.time;

View file

@ -28,7 +28,6 @@
#include "header/client.h"
extern struct model_s *cl_mod_powerscreen;
int vidref_val;
struct model_s *
S_RegisterSexedModel(entity_state_t *ent, char *base)
@ -599,17 +598,7 @@ CL_AddPacketEntities(frame_t *frame)
float intensity;
intensity = 50 + (500 * ((float)sin(cl.time / 500.0f) + 1.0f));
if (vidref_val == VIDREF_GL)
{
V_AddLight(ent.origin, intensity, -1.0, -1.0, -1.0);
}
else
{
V_AddLight(ent.origin, -1.0f * intensity,
1.0f, 1.0f, 1.0f);
}
V_AddLight(ent.origin, intensity, -1.0, -1.0, -1.0);
}
else
{
@ -620,16 +609,7 @@ CL_AddPacketEntities(frame_t *frame)
else if (effects & EF_TRACKER)
{
CL_TrackerTrail(cent->lerp_origin, ent.origin, 0);
if (vidref_val == VIDREF_GL)
{
V_AddLight(ent.origin, 200, -1, -1, -1);
}
else
{
V_AddLight(ent.origin, -200, 1, 1, 1);
}
V_AddLight(ent.origin, 200, -1, -1, -1);
}
else if (effects & EF_IONRIPPER)
{

View file

@ -205,38 +205,14 @@ CL_AddDLights(void)
dl = cl_dlights;
if (vidref_val == VIDREF_GL)
for (i = 0; i < MAX_DLIGHTS; i++, dl++)
{
for (i = 0; i < MAX_DLIGHTS; i++, dl++)
if (!dl->radius)
{
if (!dl->radius)
{
continue;
}
V_AddLight(dl->origin, dl->radius, dl->color[0], dl->color[1], dl->color[2]);
continue;
}
}
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]);
}
V_AddLight(dl->origin, dl->radius, dl->color[0], dl->color[1], dl->color[2]);
}
}

View file

@ -1106,12 +1106,6 @@ typedef struct
short stats[MAX_STATS]; /* fast status bar updates */
} player_state_t;
#define VIDREF_GL 1
#define VIDREF_SOFT 2
#define VIDREF_OTHER 3
extern int vidref_val;
size_t verify_fread(void *, size_t, size_t, FILE *);
size_t verify_fwrite(void *, size_t, size_t, FILE *);