From: Rudolf Polzer Date: Wed, 14 Dec 2011 08:36:30 +0000 (+0100) Subject: sRGB convert all shader specified colors X-Git-Tag: xonotic-v0.6.0~39 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2b560b83483c8b450bcd0d5599e754790af63e8c;p=xonotic%2Fnetradiant.git sRGB convert all shader specified colors --- diff --git a/tools/quake3/q3map2/shaders.c b/tools/quake3/q3map2/shaders.c index 5203c9d6..ebe91fd8 100644 --- a/tools/quake3/q3map2/shaders.c +++ b/tools/quake3/q3map2/shaders.c @@ -1300,6 +1300,13 @@ static void ParseShaderFile( const char *filename ) sun->color[ 1 ] = atof( token ); GetTokenAppend( shaderText, qfalse ); sun->color[ 2 ] = atof( token ); + + if(colorsRGB) + { + sun->color[0] = Image_LinearFloatFromsRGBFloat(sun->color[0]); + sun->color[1] = Image_LinearFloatFromsRGBFloat(sun->color[1]); + sun->color[2] = Image_LinearFloatFromsRGBFloat(sun->color[2]); + } /* normalize it */ VectorNormalize( sun->color, sun->color ); @@ -1492,6 +1499,12 @@ static void ParseShaderFile( const char *filename ) si->color[ 1 ] = atof( token ); GetTokenAppend( shaderText, qfalse ); si->color[ 2 ] = atof( token ); + if(colorsRGB) + { + si->color[0] = Image_LinearFloatFromsRGBFloat(si->color[0]); + si->color[1] = Image_LinearFloatFromsRGBFloat(si->color[1]); + si->color[2] = Image_LinearFloatFromsRGBFloat(si->color[2]); + } ColorNormalize( si->color, si->color ); } @@ -1527,6 +1540,13 @@ static void ParseShaderFile( const char *filename ) si->floodlightIntensity = atof( token ); GetTokenAppend( shaderText, qfalse ); si->floodlightDirectionScale = atof( token ); + if(colorsRGB) + { + si->floodlightRGB[0] = Image_LinearFloatFromsRGBFloat(si->floodlightRGB[0]); + si->floodlightRGB[1] = Image_LinearFloatFromsRGBFloat(si->floodlightRGB[1]); + si->floodlightRGB[2] = Image_LinearFloatFromsRGBFloat(si->floodlightRGB[2]); + } + VectorNormalize(si->floodlightRGB); } /* jal: q3map_nodirty : skip dirty */ @@ -1806,6 +1826,12 @@ static void ParseShaderFile( const char *filename ) { cm->type = CM_COLOR_SET; Parse1DMatrixAppend( shaderText, 3, cm->data ); + if(colorsRGB) + { + cm->data[0] = Image_LinearFloatFromsRGBFloat(cm->data[0]); + cm->data[1] = Image_LinearFloatFromsRGBFloat(cm->data[1]); + cm->data[2] = Image_LinearFloatFromsRGBFloat(cm->data[2]); + } } /* alpha scale A */