OpenGL2: Fix TCGEN_ENVIRONMENT stages not rendering correctly.

This commit is contained in:
SmileTheory 2013-10-10 03:41:31 -07:00
parent a836c2db89
commit f8355ba2fb
7 changed files with 34 additions and 19 deletions

View file

@ -2282,7 +2282,7 @@ static qboolean CollapseStagesToGLSL(void)
{
// if 2+ stages and first stage is lightmap, switch them
// this makes it easier for the later bits to process
if (stages[0].active && stages[0].bundle[0].isLightmap && stages[1].active)
if (stages[0].active && stages[0].bundle[0].tcGen == TCGEN_LIGHTMAP && stages[1].active)
{
int blendBits = stages[1].stateBits & ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
@ -2319,7 +2319,7 @@ static qboolean CollapseStagesToGLSL(void)
break;
}
if (pStage->bundle[0].isLightmap)
if (pStage->bundle[0].tcGen == TCGEN_LIGHTMAP)
{
int blendBits = pStage->stateBits & ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
@ -2370,7 +2370,7 @@ static qboolean CollapseStagesToGLSL(void)
continue;
// skip lightmaps
if (pStage->bundle[0].isLightmap)
if (pStage->bundle[0].tcGen == TCGEN_LIGHTMAP)
continue;
diffuse = pStage;
@ -2412,7 +2412,7 @@ static qboolean CollapseStagesToGLSL(void)
break;
case ST_COLORMAP:
if (pStage2->bundle[0].isLightmap)
if (pStage2->bundle[0].tcGen == TCGEN_LIGHTMAP)
{
lightmap = pStage2;
}
@ -2454,7 +2454,7 @@ static qboolean CollapseStagesToGLSL(void)
if (!pStage->active)
continue;
if (pStage->bundle[0].isLightmap)
if (pStage->bundle[0].tcGen == TCGEN_LIGHTMAP)
{
pStage->active = qfalse;
}
@ -2520,7 +2520,7 @@ static qboolean CollapseStagesToGLSL(void)
if (pStage->adjustColorsForFog)
continue;
if (pStage->bundle[TB_DIFFUSEMAP].isLightmap)
if (pStage->bundle[TB_DIFFUSEMAP].tcGen == TCGEN_LIGHTMAP)
{
pStage->glslShaderGroup = tr.lightallShader;
pStage->glslShaderIndex = LIGHTDEF_USE_LIGHTMAP;
@ -2550,6 +2550,9 @@ static qboolean CollapseStagesToGLSL(void)
{
pStage->glslShaderGroup = tr.lightallShader;
pStage->glslShaderIndex = LIGHTDEF_USE_LIGHT_VECTOR;
if (pStage->bundle[0].tcGen != TCGEN_TEXTURE || pStage->bundle[0].numTexMods != 0)
pStage->glslShaderIndex |= LIGHTDEF_USE_TCGEN_AND_TCMOD;
}
}
}