Skip to content

Commit 67f2048

Browse files
committed
tr_shader: merge legacy lightmap stage into diffusestage
- avoid double shadowing - avoid to paint shadow over glowmap
1 parent ef39da2 commit 67f2048

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/engine/renderer/tr_shader.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,6 +3938,7 @@ static void CollapseStages()
39383938
int specularStage = -1;
39393939
int materialStage = -1;
39403940
int reflectionStage = -1;
3941+
int lightStage = -1;
39413942
int glowStage = -1;
39423943

39433944
for ( int i = 0; i < MAX_SHADER_STAGES; i++ )
@@ -3962,6 +3963,10 @@ static void CollapseStages()
39623963
{
39633964
reflectionStage = i;
39643965
}
3966+
else if ( stages[ i ].type == stageType_t::ST_LIGHTMAP )
3967+
{
3968+
lightStage = i;
3969+
}
39653970
else if ( stages[ i ].type == stageType_t::ST_GLOWMAP )
39663971
{
39673972
glowStage = i;
@@ -4038,6 +4043,14 @@ static void CollapseStages()
40384043
// disable since it's merged
40394044
stages[ materialStage ].active = false;
40404045
}
4046+
if ( lightStage != -1 )
4047+
{
4048+
// merge with diffuse stage
4049+
stages[ diffuseStage ].rgbGen = stages[ lightStage ].rgbGen;
4050+
stages[ diffuseStage ].alphaGen = stages[ lightStage ].alphaGen;
4051+
// disable since it's merged
4052+
stages[ lightStage ].active = false;
4053+
}
40414054
if ( glowStage != -1 )
40424055
{
40434056
// merge with diffuse stage

0 commit comments

Comments
 (0)