OpenGL2: Fix r_lightmap.

This commit is contained in:
SmileTheory 2016-03-14 06:45:51 -07:00
parent 93e1feaaad
commit eb7408ddac

View file

@ -1141,9 +1141,9 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
index |= LIGHTDEF_USE_SHADOWMAP;
}
if (r_lightmap->integer && index & LIGHTDEF_USE_LIGHTMAP)
if (r_lightmap->integer && ((index & LIGHTDEF_LIGHTTYPE_MASK) == LIGHTDEF_USE_LIGHTMAP))
{
index = LIGHTDEF_USE_LIGHTMAP;
index = LIGHTDEF_USE_TCGEN_AND_TCMOD;
}
sp = &pStage->glslShaderGroup[index];
@ -1232,6 +1232,18 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
GLSL_SetUniformVec4(sp, UNIFORM_FOGCOLORMASK, fogColorMask);
}
if (r_lightmap->integer)
{
vec4_t v;
VectorSet4(v, 1.0f, 0.0f, 0.0f, 1.0f);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, v);
VectorSet4(v, 0.0f, 0.0f, 0.0f, 0.0f);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, v);
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, TCGEN_LIGHTMAP);
}
else
{
ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb);
@ -1246,6 +1258,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
VectorCopy(pStage->bundle[0].tcGenVectors[1], vec);
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
}
}
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
@ -1294,7 +1307,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
{
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{
if (i == TB_LIGHTMAP)
if (i == TB_COLORMAP)
R_BindAnimatedImageToTMU( &pStage->bundle[TB_LIGHTMAP], i);
else
GL_BindToTMU( tr.whiteImage, i );
@ -1304,7 +1317,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
{
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{
if (i == TB_LIGHTMAP)
if (i == TB_COLORMAP)
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DELUXEMAP], i);
else
GL_BindToTMU( tr.whiteImage, i );