mirror of
https://github.com/UberGames/ioef.git
synced 2025-01-18 23:21:37 +00:00
Fix OpenGL2 non-HDR map surface over brighting
Vertex lit map surfaces were saturating to white when r_mapOverBrightBits was increased and r_hdr was disabled. Now the color is normalized like lightmaps and lightgrid when r_hdr is disabled. Which is the same as OpenGL1. Noticeable on misc_model trisoup.
This commit is contained in:
parent
aa92f7e76a
commit
dde36d91ce
1 changed files with 21 additions and 4 deletions
|
@ -128,17 +128,34 @@ static void R_ColorShiftLightingBytes( byte in[4], byte out[4] ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_ColorShiftLightingBytes
|
R_ColorShiftLightingFloats
|
||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void R_ColorShiftLightingFloats(float in[4], float out[4], float scale )
|
static void R_ColorShiftLightingFloats(float in[4], float out[4], float scale )
|
||||||
{
|
{
|
||||||
|
float r, g, b;
|
||||||
|
|
||||||
scale *= pow(2.0f, r_mapOverBrightBits->integer - tr.overbrightBits);
|
scale *= pow(2.0f, r_mapOverBrightBits->integer - tr.overbrightBits);
|
||||||
|
|
||||||
out[0] = in[0] * scale;
|
r = in[0] * scale;
|
||||||
out[1] = in[1] * scale;
|
g = in[1] * scale;
|
||||||
out[2] = in[2] * scale;
|
b = in[2] * scale;
|
||||||
|
|
||||||
|
// normalize by color instead of saturating to white
|
||||||
|
if ( !r_hdr->integer && ( r > 1 || g > 1 || b > 1 ) ) {
|
||||||
|
float max;
|
||||||
|
|
||||||
|
max = r > g ? r : g;
|
||||||
|
max = max > b ? max : b;
|
||||||
|
r = r / max;
|
||||||
|
g = g / max;
|
||||||
|
b = b / max;
|
||||||
|
}
|
||||||
|
|
||||||
|
out[0] = r;
|
||||||
|
out[1] = g;
|
||||||
|
out[2] = b;
|
||||||
out[3] = in[3];
|
out[3] = in[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue