+
+ // interpretation of brightness and contrast:
+ // color range := brightness .. (brightness + contrast)
+ // i.e. "c *= contrast; c += brightness"
+ // plausible values for brightness thus range from -contrast to 1
+
+ // apply pre-brightness (subtractive brightness, for where contrast was >= 1)
+ if (vid.support.ext_blend_subtract)
+ {
+ if (v_color_enable.integer)
+ {
+ c[0] = -v_color_black_r.value / v_color_white_r.value;
+ c[1] = -v_color_black_g.value / v_color_white_g.value;
+ c[2] = -v_color_black_b.value / v_color_white_b.value;
+ }
+ else
+ c[0] = c[1] = c[2] = -v_brightness.value / v_contrast.value;
+ if (c[0] >= 0.01f || c[1] >= 0.01f || c[2] >= 0.01f)
+ {
+ // need SUBTRACTIVE blending to do this!
+ GL_BlendEquationSubtract(true);
+ GL_BlendFunc(GL_ONE, GL_ONE);
+ GL_Color(c[0], c[1], c[2], 1);
+ R_Mesh_PrepareVertices_Generic_Arrays(3, blendvertex3f, NULL, NULL);
+ R_Mesh_Draw(0, 3, 0, 1, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
+ GL_BlendEquationSubtract(false);
+ }
+ }
+
+ // apply contrast