engine/EngineVideoFog.c
/*	Calculates fog color for this frame, taking into account fade times
*/
Calculates fog color for this frame, taking into account fade times
Calculates fog color for this frame taking into account fade times
float *Fog_GetColor (void)
{
	static float c[4];
	float f;
	int i;
	if (fade_done > cl.time)
	{
		f = (fade_done - cl.time) / fade_time;
		c[0] = f * old_red + (1.0 - f) * fog_red;
		c[1] = f * old_green + (1.0 - f) * fog_green;
		c[2] = f * old_blue + (1.0 - f) * fog_blue;
		c[3] = 1.0;
	}
	else
	{
		c[0] = fog_red;
		c[1] = fog_green;
		c[2] = fog_blue;
		c[3] = 1.0;
	}
	for (i=0;i<3;i++)
		c[i] = (float)(pMath_RINT(c[i] * 255)) / 255.0f;
	return c;
}
float * Fog_GetColor ( void ) { static float c [ 4 ] ; float f ; int i ; if ( fade_done > cl . time ) { f = ( fade_done - cl . time ) / fade_time ; c [ 0 ] = f * old_red + ( 1.0 - f ) * fog_red ; c [ 1 ] = f * old_green + ( 1.0 - f ) * fog_green ; c [ 2 ] = f * old_blue + ( 1.0 - f ) * fog_blue ; c [ 3 ] = 1.0 ; } else { c [ 0 ] = fog_red ; c [ 1 ] = fog_green ; c [ 2 ] = fog_blue ; c [ 3 ] = 1.0 ; } for ( i = 0 ; i < 3 ; i ++ ) c [ i ] = ( float ) ( pMath_RINT ( c [ i ] * 255 ) ) / 255.0f ; return c ; }
Calculates fog color for this frame, taking into account fade times
Calculates fog color for this frame taking into account fade times
//find closest 24-bit RGB value, so solid-colored sky can match the fog perfectly