From: divverent Date: Thu, 20 Aug 2009 07:34:50 +0000 (+0000) Subject: fix lightmap merging with external lightmaps X-Git-Tag: xonotic-v0.1.0preview~1496 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=55a5d72bf63b2d0a47059e0d2504bfd03a67d3a7;p=xonotic%2Fdarkplaces.git fix lightmap merging with external lightmaps git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9133 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index 69e683a5..f2657c0e 100644 --- a/model_brush.c +++ b/model_brush.c @@ -4615,13 +4615,15 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump) // figure out what the most reasonable merge power is within limits loadmodel->brushq3.num_lightmapmergepower = 0; - for (power = 1;power <= mod_q3bsp_lightmapmergepower.integer && (128 << power) <= gl_max_texture_size && (1 << (power * 2)) < 4 * (count >> loadmodel->brushq3.deluxemapping);power++) + for (power = 1;power <= mod_q3bsp_lightmapmergepower.integer && (128 << power) <= gl_max_texture_size; power++) loadmodel->brushq3.num_lightmapmergepower = power; // as the lightmap size may actually be another power of 2, adjust for this // (and interpret it as the power for 128x128 lightmaps above) for(i = 0; (128 << i) < size; ++i) loadmodel->brushq3.num_lightmapmergepower -= 1; + while ((1 << (loadmodel->brushq3.num_lightmapmergepower * 2)) >= 4 * (count >> loadmodel->brushq3.deluxemapping)) + loadmodel->brushq3.num_lightmapmergepower -= 1; if(loadmodel->brushq3.num_lightmapmergepower < 0) loadmodel->brushq3.num_lightmapmergepower = 0;