mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
soft: speedup colorlight=0
colorlight>0 is regressed little bit.
This commit is contained in:
parent
a0da1717cc
commit
020ce27109
2 changed files with 14 additions and 7 deletions
|
@ -586,7 +586,7 @@ R_AliasSetupLighting(entity_t *currententity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(r_colorlight->value == 0)
|
if(r_colorlight->value < 2)
|
||||||
{
|
{
|
||||||
float temp = (light[0] + light[1] + light[2]) / 3;
|
float temp = (light[0] + light[1] + light[2]) / 3;
|
||||||
|
|
||||||
|
|
|
@ -332,8 +332,6 @@ static byte *d_16to8table = NULL; // 16 to 8 bit conversion table
|
||||||
/*
|
/*
|
||||||
* Apply color light to texture pixel
|
* Apply color light to texture pixel
|
||||||
*
|
*
|
||||||
* vid_colormap[pix + ( llight & 0xFF00 )];
|
|
||||||
*
|
|
||||||
* TODO: -22% fps lost
|
* TODO: -22% fps lost
|
||||||
*/
|
*/
|
||||||
pixel_t
|
pixel_t
|
||||||
|
@ -341,9 +339,18 @@ R_ApplyLight(pixel_t pix, const light3_t light)
|
||||||
{
|
{
|
||||||
byte b_r, b_g, b_b;
|
byte b_r, b_g, b_b;
|
||||||
int i_c;
|
int i_c;
|
||||||
|
light3_t light_masked;
|
||||||
|
|
||||||
|
light_masked[0] = light[0] & LIGHTMASK;
|
||||||
|
light_masked[1] = light[1] & LIGHTMASK;
|
||||||
|
light_masked[2] = light[2] & LIGHTMASK;
|
||||||
|
|
||||||
|
/* same light or colorlight == 0 */
|
||||||
|
if (light_masked[0] == light_masked[1] && light_masked[0] == light_masked[2])
|
||||||
|
return vid_colormap[pix + light_masked[0]];
|
||||||
|
|
||||||
/* full light, code could skip light processing */
|
/* full light, code could skip light processing */
|
||||||
if (((light[0] | light[1] | light[2]) & LIGHTMASK) <= vid_lightthreshold)
|
if ((light_masked[0] | light_masked[1] | light_masked[2]) <= vid_lightthreshold)
|
||||||
return pix;
|
return pix;
|
||||||
|
|
||||||
/* get color component for each component */
|
/* get color component for each component */
|
||||||
|
@ -352,9 +359,9 @@ R_ApplyLight(pixel_t pix, const light3_t light)
|
||||||
b_b = d_8to24table[pix * 4 + 2];
|
b_b = d_8to24table[pix * 4 + 2];
|
||||||
|
|
||||||
/* scale by light */
|
/* scale by light */
|
||||||
b_r = vid_lightmap[(light[0] & LIGHTMASK) + b_r];
|
b_r = vid_lightmap[light_masked[0] + b_r];
|
||||||
b_g = vid_lightmap[(light[1] & LIGHTMASK) + b_g];
|
b_g = vid_lightmap[light_masked[1] + b_g];
|
||||||
b_b = vid_lightmap[(light[2] & LIGHTMASK) + b_b];
|
b_b = vid_lightmap[light_masked[2] + b_b];
|
||||||
|
|
||||||
/* convert back to indexed color */
|
/* convert back to indexed color */
|
||||||
b_r = ( b_r >> 3 ) & 31;
|
b_r = ( b_r >> 3 ) & 31;
|
||||||
|
|
Loading…
Reference in a new issue