Fast lights clean

This commit is contained in:
Denis Pauk 2019-01-30 23:19:10 +02:00
parent dcc2892de0
commit e43859de4a
2 changed files with 8 additions and 14 deletions

View file

@ -298,6 +298,7 @@ R_AddDynamicLights (drawsurf_t* drawsurf)
for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++)
{ {
light_t *plightdest = blocklights;
if (!(surf->dlightbits & (1<<lnum))) if (!(surf->dlightbits & (1<<lnum)))
continue; // not lit by this light continue; // not lit by this light
@ -355,17 +356,18 @@ R_AddDynamicLights (drawsurf_t* drawsurf)
if(!negativeLight) if(!negativeLight)
{ {
if (dist < minlight) if (dist < minlight)
blocklights[t*smax + s] += (rad - dist)*256; *plightdest += (rad - dist)*256;
} }
else else
{ {
if (dist < minlight) if (dist < minlight)
blocklights[t*smax + s] -= (rad - dist)*256; *plightdest -= (rad - dist)*256;
if(blocklights[t*smax + s] < minlight) if(*plightdest < minlight)
blocklights[t*smax + s] = minlight; *plightdest = minlight;
} }
//PGM //PGM
//==== //====
plightdest ++;
} }
} }
} }
@ -394,15 +396,12 @@ R_BuildLightMap (drawsurf_t* drawsurf)
if (r_fullbright->value || !r_worldmodel->lightdata) if (r_fullbright->value || !r_worldmodel->lightdata)
{ {
for (i=0 ; i<size ; i++) memset(blocklights, 0, size * sizeof(light_t));
blocklights[i] = 0;
return; return;
} }
// clear to no light // clear to no light
for (i=0 ; i<size ; i++) memset(blocklights, 0, size * sizeof(light_t));
blocklights[i] = 0;
// add all the lightmaps // add all the lightmaps
lightmap = surf->samples; lightmap = surf->samples;

View file

@ -190,11 +190,6 @@ zvalue_t *d_pzbuffer;
qboolean insubmodel; qboolean insubmodel;
static struct texture_buffer {
image_t image;
byte buffer[1024];
} r_notexture_buffer;
static void Draw_GetPalette (void); static void Draw_GetPalette (void);
static void RE_BeginFrame( float camera_separation ); static void RE_BeginFrame( float camera_separation );
static void Draw_BuildGammaTable(void); static void Draw_BuildGammaTable(void);