support -sRGBcolor for all _color keys

This commit is contained in:
Rudolf Polzer 2011-12-14 09:31:18 +01:00
parent 870333585c
commit 084d085966

View File

@ -388,6 +388,12 @@ void CreateEntityLights( void )
if( _color && _color[ 0 ] ) if( _color && _color[ 0 ] )
{ {
sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] ); sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] );
if (colorsRGB)
{
light->color[0] = Image_LinearFloatFromsRGBFloat(light->color[0]);
light->color[1] = Image_LinearFloatFromsRGBFloat(light->color[1]);
light->color[2] = Image_LinearFloatFromsRGBFloat(light->color[2]);
}
if (!(light->flags & LIGHT_UNNORMALIZED)) if (!(light->flags & LIGHT_UNNORMALIZED))
{ {
ColorNormalize( light->color, light->color ); ColorNormalize( light->color, light->color );
@ -1850,6 +1856,12 @@ void LightWorld( void )
/* find the optional minimum lighting values */ /* find the optional minimum lighting values */
GetVectorForKey( &entities[ 0 ], "_color", color ); GetVectorForKey( &entities[ 0 ], "_color", color );
if (colorsRGB)
{
color[0] = Image_LinearFloatFromsRGBFloat(color[0]);
color[1] = Image_LinearFloatFromsRGBFloat(color[1]);
color[2] = Image_LinearFloatFromsRGBFloat(color[2]);
}
if( VectorLength( color ) == 0.0f ) if( VectorLength( color ) == 0.0f )
VectorSet( color, 1.0, 1.0, 1.0 ); VectorSet( color, 1.0, 1.0, 1.0 );