mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
soft: use vid_lightthreshold for skip apply light
This commit is contained in:
parent
c73eac63b3
commit
ff1814922e
4 changed files with 12 additions and 1 deletions
|
@ -98,6 +98,7 @@ extern pixel_t *vid_buffer; // invisible buffer
|
|||
extern pixel_t *vid_colormap; // 256 * VID_GRADES size
|
||||
extern pixel_t *vid_alphamap; // 256 * 256 translucency map
|
||||
extern byte *vid_lightmap; // 64 light grades for 256 colors
|
||||
extern light_t vid_lightthreshold; // full light distance maximum
|
||||
extern char shift_size; // shift size in fixed-point
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -340,6 +340,10 @@ R_ApplyLight(pixel_t pix, const light3_t light)
|
|||
byte b_r, b_g, b_b;
|
||||
int i_c;
|
||||
|
||||
/* full light, code could skip light processing */
|
||||
if (((light[0] | light[1] | light[2]) & 0xFF00) <= vid_lightthreshold)
|
||||
return pix;
|
||||
|
||||
/* get color component for each component */
|
||||
b_r = d_8to24table[pix * 4 + 0];
|
||||
b_g = d_8to24table[pix * 4 + 1];
|
||||
|
|
|
@ -41,6 +41,7 @@ espan_t *vid_polygon_spans = NULL;
|
|||
pixel_t *vid_colormap = NULL;
|
||||
pixel_t *vid_alphamap = NULL;
|
||||
byte *vid_lightmap = NULL;
|
||||
light_t vid_lightthreshold = 0;
|
||||
static int vid_minu, vid_minv, vid_maxu, vid_maxv;
|
||||
static int vid_zminu, vid_zminv, vid_zmaxu, vid_zmaxv;
|
||||
|
||||
|
@ -1805,6 +1806,10 @@ Draw_GetPalette (void)
|
|||
d_8to24table[vid_colormap[i * 256 + white] * 4 + 2]
|
||||
) / 3;
|
||||
|
||||
/* full light distance maximum */
|
||||
if (scale == 255)
|
||||
vid_lightthreshold = i * 256;
|
||||
|
||||
for(j=0; j < 256; j++)
|
||||
vid_lightmap[i * 256 + j] = (j * scale) / 255;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ static void
|
|||
R_DrawSurfaceBlock8_anymip (int level, int surfrowbytes)
|
||||
{
|
||||
int v, i, b, size;
|
||||
unsigned char pix, *psource, *prowdest;
|
||||
unsigned char *psource, *prowdest;
|
||||
|
||||
size = 1 << level;
|
||||
psource = pbasesource;
|
||||
|
@ -111,6 +111,7 @@ R_DrawSurfaceBlock8_anymip (int level, int surfrowbytes)
|
|||
|
||||
for (b=(size-1); b>=0; b--)
|
||||
{
|
||||
pixel_t pix;
|
||||
pix = psource[b];
|
||||
prowdest[b] = R_ApplyLight(pix, light);
|
||||
|
||||
|
|
Loading…
Reference in a new issue