|
|
@ -20,7 +20,6 @@ GNU General Public License for more details. |
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Gamma conversion support
|
|
|
|
// Gamma conversion support
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
static byte texgammatable[256]; // palette is sent through this to convert to screen gamma
|
|
|
|
|
|
|
|
static byte lightgammatable[256]; |
|
|
|
static byte lightgammatable[256]; |
|
|
|
static int lineargammatable[1024]; |
|
|
|
static int lineargammatable[1024]; |
|
|
|
static int screengammatable[1024]; |
|
|
|
static int screengammatable[1024]; |
|
|
@ -60,13 +59,6 @@ void BuildGammaTable( float lightgamma, float brightness ) |
|
|
|
lightgammatable[i] = bound( 0, inf, 255 ); |
|
|
|
lightgammatable[i] = bound( 0, inf, 255 ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < 256; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
f = 255.0f * pow(( float )i / 255.0f, TEXGAMMA ); |
|
|
|
|
|
|
|
inf = (int)(f + 0.5f); |
|
|
|
|
|
|
|
texgammatable[i] = bound( 0, inf, 255 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < 1024; i++ ) |
|
|
|
for( i = 0; i < 1024; i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// convert from screen gamma space to linear space
|
|
|
|
// convert from screen gamma space to linear space
|
|
|
@ -84,11 +76,3 @@ byte LightToTexGamma( byte b ) |
|
|
|
else |
|
|
|
else |
|
|
|
return lightgammatable[b]; |
|
|
|
return lightgammatable[b]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
byte TextureToGamma( byte b ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE )) |
|
|
|
|
|
|
|
return b; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return texgammatable[b]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|