From 5d60f6035a74ff2d4e44c34b2671ea3fc4861afd Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 10 Feb 2024 14:50:35 -0600 Subject: [PATCH] OpenGL2: Fix hack for tcMod transform on merged lightmaps When using merged lightmaps, only change tcMod transform for tcGen lightmap. --- code/renderergl2/tr_shader.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/renderergl2/tr_shader.c b/code/renderergl2/tr_shader.c index ba075510..b08a9328 100644 --- a/code/renderergl2/tr_shader.c +++ b/code/renderergl2/tr_shader.c @@ -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; + } } }