Adds a blending effect to the clients view.
(float r, float g, float b, float a,
float v_blend[])
| 406 | * Adds a blending effect to the clients view. |
| 407 | */ |
| 408 | private static void SV_AddBlend(float r, float g, float b, float a, |
| 409 | float v_blend[]) { |
| 410 | float a2, a3; |
| 411 | |
| 412 | if (a <= 0) |
| 413 | return; |
| 414 | a2 = v_blend[3] + (1 - v_blend[3]) * a; // new total alpha |
| 415 | a3 = v_blend[3] / a2; // fraction of color from old |
| 416 | |
| 417 | v_blend[0] = v_blend[0] * a3 + r * (1 - a3); |
| 418 | v_blend[1] = v_blend[1] * a3 + g * (1 - a3); |
| 419 | v_blend[2] = v_blend[2] * a3 + b * (1 - a3); |
| 420 | v_blend[3] = a2; |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Calculates the blending color according to the players environment. |