Skip to content

Commit

Permalink
OpenGL2: Fix hack for tcMod transform on merged lightmaps
Browse files Browse the repository at this point in the history
When using merged lightmaps, only change tcMod transform for tcGen
lightmap.
  • Loading branch information
zturtleman committed Feb 10, 2024
1 parent e3abcff commit 5d60f60
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions code/renderergl2/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -2946,12 +2946,14 @@ static void FixFatLightmapTexCoords(void)

if ( pStage->bundle[0].isLightmap ) {
// fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles
for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) {
tmi = &pStage->bundle[0].texMods[i];
if ( pStage->bundle[0].tcGen == TCGEN_LIGHTMAP ) {
for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) {
tmi = &pStage->bundle[0].texMods[i];

if ( tmi->type == TMOD_TRANSFORM ) {
tmi->translate[0] /= (float)tr.fatLightmapCols;
tmi->translate[1] /= (float)tr.fatLightmapRows;
if ( tmi->type == TMOD_TRANSFORM ) {
tmi->translate[0] /= (float)tr.fatLightmapCols;
tmi->translate[1] /= (float)tr.fatLightmapRows;
}
}
}

Expand Down

0 comments on commit 5d60f60

Please sign in to comment.