OpenGL2: Add option in code for alternate overbright method.

This commit is contained in:
SmileTheory 2015-12-08 05:17:05 -08:00
parent e5aabdaff6
commit 92d4b20129
5 changed files with 35 additions and 7 deletions

View file

@ -444,9 +444,22 @@ static void ProjectDlightTexture( void ) {
static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t vertColor, int blend )
{
qboolean isBlend = ((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_DST_COLOR)
|| ((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR)
|| ((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR)
|| ((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);
qboolean isWorldDraw = !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL);
#if defined(USE_OVERBRIGHT)
float exactLight = 1.0f;
#else
float exactLight = (isBlend || !isWorldDraw) ? 1.0f : (float)(1 << r_mapOverBrightBits->integer);
#endif
baseColor[0] =
baseColor[1] =
baseColor[2] =
baseColor[2] = exactLight;
baseColor[3] = 1.0f;
vertColor[0] =
@ -473,7 +486,7 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t
vertColor[0] =
vertColor[1] =
vertColor[2] =
vertColor[2] = exactLight;
vertColor[3] = 1.0f;
break;
case CGEN_CONST:
@ -601,11 +614,7 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t
}
// multiply color by overbrightbits if this isn't a blend
if (tr.overbrightBits
&& !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_DST_COLOR)
&& !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR)
&& !((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR)
&& !((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_ONE_MINUS_SRC_COLOR))
if (tr.overbrightBits && !isBlend)
{
float scale = 1 << tr.overbrightBits;