the first parameter is the vector to put the result in. For this, I used d3d_fogcolor1
the second and third are the vectors to mix between. First vector is the source color, and the second is the target color.
the fourth vector is the interpolation factor (0 - 1). This is the percentage to mix each color. At 0, the first color will be used. At 1, then second color will be used. 0.5 would be a perfect mix between the two...
Code:
//evening
var fog_eve[3] = 250, 120, 60;
//night
var fog_night[3] = 4, 9, 14;
var fog_fade_speed = 0.08;
function fadeColors(&colTarget, &col1, &col2)
{
var i = 0;
while(i < 100)
{
i = min(i + fog_fade_speed*time_step, 100);
vec_lerp(colTarget, col1, col2, i/100);
wait(1);
}
}
var currentColor[3];
Function etc_startup()
{
fog_color = 1;
//
vec_set(currentColor, d3d_fogcolor1);
fadeColors(d3d_fogcolor1, currentColor, fog_eve);
//
wait(-2);
//
vec_set(currentColor, d3d_fogcolor1);
fadeColors(d3d_fogcolor1, currentColor, fog_night);
}
This code would fade the current fog color to the evening fog color, then wait 2 seconds, and then fade to the night colors.