Skip to content

Commit 2ac5ad6

Browse files
committed
tr_shader: merge legacy lightmap stage into diffusestage
- avoid double shadowing - avoid to paint shadow over glowmap
1 parent 5ff40f7 commit 2ac5ad6

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
@@ -3936,6 +3936,7 @@ static void CollapseStages()
39363936
int specularStage = -1;
39373937
int materialStage = -1;
39383938
int reflectionStage = -1;
3939+
int lightStage = -1;
39393940
int glowStage = -1;
39403941

39413942
for ( int i = 0; i < MAX_SHADER_STAGES; i++ )
@@ -3960,6 +3961,10 @@ static void CollapseStages()
39603961
{
39613962
reflectionStage = i;
39623963
}
3964+
else if ( stages[ i ].type == stageType_t::ST_LIGHTMAP )
3965+
{
3966+
lightStage = i;
3967+
}
39633968
else if ( stages[ i ].type == stageType_t::ST_GLOWMAP )
39643969
{
39653970
glowStage = i;
@@ -4035,6 +4040,14 @@ static void CollapseStages()
40354040
// disable since it's merged
40364041
stages[ materialStage ].active = false;
40374042
}
4043+
if ( lightStage != -1 )
4044+
{
4045+
// merge with diffuse stage
4046+
stages[ diffuseStage ].rgbGen = stages[ lightStage ].rgbGen;
4047+
stages[ diffuseStage ].alphaGen = stages[ lightStage ].alphaGen;
4048+
// disable since it's merged
4049+
stages[ lightStage ].active = false;
4050+
}
40384051
if ( glowStage != -1 )
40394052
{
40404053
// merge with diffuse stage

0 commit comments

Comments
 (0)