mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
OpenGL2: Fix dark lightmap on shader in mpteam6
Team Arena's mpteam6 map has a shader textures/base_wall2/space_concrete that contains an opaque stage, two non-lightmap blendfunc filter stages, a blendfunc add stage, and a lightmap stage. The lightmap was attached to all four of the non-lightmap stages causing the filter stages to darken the lightmap multiple times. Change setting up the lightall GLSL shader to only use lightmap if it's the first stage or not a blendfunc filter stage. Now only the opaque and blendfunc add stages of the mpteam6 shader use the lightmap. Reported by Alexander Nadeau (wareya).
This commit is contained in:
parent
0b6d97f849
commit
3d6aa05694
1 changed files with 12 additions and 1 deletions
|
@ -2421,6 +2421,8 @@ static int CollapseStagesToGLSL(void)
|
|||
|
||||
if (!skip)
|
||||
{
|
||||
qboolean usedLightmap = qfalse;
|
||||
|
||||
for (i = 0; i < MAX_SHADER_STAGES; i++)
|
||||
{
|
||||
shaderStage_t *pStage = &stages[i];
|
||||
|
@ -2478,8 +2480,17 @@ static int CollapseStagesToGLSL(void)
|
|||
|
||||
case ST_COLORMAP:
|
||||
if (pStage2->bundle[0].tcGen == TCGEN_LIGHTMAP)
|
||||
{
|
||||
int blendBits = pStage->stateBits & ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
|
||||
|
||||
// Only add lightmap to blendfunc filter stage if it's the first time lightmap is used
|
||||
// otherwise it will cause the shader to be darkened by the lightmap multiple times.
|
||||
if (!usedLightmap || (blendBits != (GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO)
|
||||
&& blendBits != (GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR)))
|
||||
{
|
||||
lightmap = pStage2;
|
||||
usedLightmap = qtrue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue