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; 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]; sp = &pStage->glslShaderGroup[index];
@ -1232,19 +1232,32 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
GLSL_SetUniformVec4(sp, UNIFORM_FOGCOLORMASK, fogColorMask); GLSL_SetUniformVec4(sp, UNIFORM_FOGCOLORMASK, fogColorMask);
} }
ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb ); if (r_lightmap->integer)
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb);
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen);
if (pStage->bundle[0].tcGen == TCGEN_VECTOR)
{ {
vec3_t vec; 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);
VectorCopy(pStage->bundle[0].tcGenVectors[0], vec); GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, TCGEN_LIGHTMAP);
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR0, vec); }
VectorCopy(pStage->bundle[0].tcGenVectors[1], vec); else
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec); {
ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb);
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen);
if (pStage->bundle[0].tcGen == TCGEN_VECTOR)
{
vec3_t vec;
VectorCopy(pStage->bundle[0].tcGenVectors[0], vec);
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR0, vec);
VectorCopy(pStage->bundle[0].tcGenVectors[1], vec);
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
}
} }
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix); 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++) for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{ {
if (i == TB_LIGHTMAP) if (i == TB_COLORMAP)
R_BindAnimatedImageToTMU( &pStage->bundle[TB_LIGHTMAP], i); R_BindAnimatedImageToTMU( &pStage->bundle[TB_LIGHTMAP], i);
else else
GL_BindToTMU( tr.whiteImage, i ); GL_BindToTMU( tr.whiteImage, i );
@ -1304,7 +1317,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
{ {
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++) for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{ {
if (i == TB_LIGHTMAP) if (i == TB_COLORMAP)
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DELUXEMAP], i); R_BindAnimatedImageToTMU( &pStage->bundle[TB_DELUXEMAP], i);
else else
GL_BindToTMU( tr.whiteImage, i ); GL_BindToTMU( tr.whiteImage, i );