Add sunlight/lightmap merging by multiply (r_sunlightMode 1)

Merge additive sunlight and map lighting into one GLSL shader (r_sunlightMode 2)
Change single lightmap blends to use lightall
This commit is contained in:
SmileTheory 2013-04-02 00:17:24 -07:00
parent 66acde6d60
commit 28e14c4546
8 changed files with 195 additions and 306 deletions

View file

@ -2493,6 +2493,30 @@ static qboolean CollapseStagesToGLSL(void)
if (numStages == i && i >= 2 && CollapseMultitexture())
numStages--;
// convert any remaining lightmap stages to a lighting pass with a white texture
// only do this with r_sunlightMode non-zero, as it's only for correct shadows.
if (r_sunlightMode->integer)
{
for (i = 0; i < MAX_SHADER_STAGES; i++)
{
shaderStage_t *pStage = &stages[i];
if (!pStage->active)
continue;
if (pStage->bundle[TB_DIFFUSEMAP].isLightmap)
{
pStage->glslShaderGroup = tr.lightallShader;
pStage->glslShaderIndex = LIGHTDEF_USE_LIGHTMAP;
if (r_deluxeMapping->integer && tr.worldDeluxeMapping)
pStage->glslShaderIndex |= LIGHTDEF_USE_DELUXEMAP;
pStage->bundle[TB_LIGHTMAP] = pStage->bundle[TB_DIFFUSEMAP];
pStage->bundle[TB_DIFFUSEMAP].image[0] = tr.whiteImage;
pStage->bundle[TB_DIFFUSEMAP].isLightmap = qfalse;
}
}
}
return numStages;
}