From 10dfced6cb5a767730adcec17bc156a2a371b43b Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 21 Oct 2010 20:35:35 +0200 Subject: [PATCH] -randomsamples: special handling of -samples 1, 2, 3, 4 as quality presets (to be more consistent with typical -samples use) --- tools/quake3/q3map2/light.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index 59ceab8..b531089 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -2050,6 +2050,7 @@ int LightMain( int argc, char **argv ) char mapSource[ 1024 ]; const char *value; int lightmapMergeSize = 0; + qboolean lightSamplesInsist = qfalse; /* note it */ @@ -2255,6 +2256,8 @@ int LightMain( int argc, char **argv ) else if( !strcmp( argv[ i ], "-samples" ) ) { + if(*argv[i+1] == '+') + lightSamplesInsist = qtrue; lightSamples = atoi( argv[ i + 1 ] ); if( lightSamples < 1 ) lightSamples = 1; @@ -2757,6 +2760,29 @@ int LightMain( int argc, char **argv ) } + /* fix up samples count */ + if(lightRandomSamples) + { + if(!lightSamplesInsist) + { + /* approximately match -samples in quality */ + switch(lightSamples) + { + /* somewhat okay */ + case 1: + case 2: lightSamples = 16; break; + + /* good */ + case 3: lightSamples = 64; break; + + /* perfect */ + case 4: lightSamples = 256; break; + + default: break; + } + } + } + /* fix up lightmap search power */ if(lightmapMergeSize) { -- 2.39.2