From 4243255b4a3a425d9c762106f88624c785a35cd3 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 22 Sep 2010 06:38:02 +0200 Subject: [PATCH] new funny option: -samplessearchboxsize, tunes the size of the search box of -samples (default 1 = "correct" size, can be up to 4) --- tools/quake3/q3map2/light.c | 12 ++++++++++++ tools/quake3/q3map2/light_ydnar.c | 3 +-- tools/quake3/q3map2/q3map2.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index 69f730b..868bb8d 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -2216,6 +2216,18 @@ int LightMain( int argc, char **argv ) i++; } + else if( !strcmp( argv[ i ], "-samplessearchboxsize" ) ) + { + lightSamplesSearchBoxSize = atoi( argv[ i + 1 ] ); + if( lightSamplesSearchBoxSize <= 0 ) + lightSamplesSearchBoxSize = 1; + if( lightSamplesSearchBoxSize > 4 ) + lightSamplesSearchBoxSize = 4; /* more makes no sense */ + else if( lightSamplesSearchBoxSize != 1 ) + Sys_Printf( "Adaptive supersampling uses %f times the normal search box size\n", lightSamplesSearchBoxSize ); + i++; + } + else if( !strcmp( argv[ i ], "-filter" ) ) { filter = qtrue; diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index 3587c47..1f81bf2 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -2203,8 +2203,7 @@ void IlluminateRawLightmap( int rawLightmapNum ) //% continue; /* subsample it */ - SubsampleRawLuxel_r( lm, &trace, origin, sx, sy, 0.25f, lightLuxel ); - /* will do: first -1/3 .. +1/3, then subsample these corners the same way -> -1/9 .. +1/9 around them, etc. -> 1/3 + 1/9 + 1/27 + ... = 0.5 */ + SubsampleRawLuxel_r( lm, &trace, origin, sx, sy, 0.25f * lightSamplesSearchBoxSize, lightLuxel ); /* debug code to colorize subsampled areas to yellow */ //% luxel = SUPER_LUXEL( lightmapNum, sx, sy ); diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 897bfdc..dbb39d7 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2183,6 +2183,7 @@ Q_EXTERN qboolean shade Q_ASSIGN( qfalse ); Q_EXTERN float shadeAngleDegrees Q_ASSIGN( 0.0f ); Q_EXTERN int superSample Q_ASSIGN( 0 ); Q_EXTERN int lightSamples Q_ASSIGN( 1 ); +Q_EXTERN int lightSamplesSearchBoxSize Q_ASSIGN( 1 ); Q_EXTERN qboolean filter Q_ASSIGN( qfalse ); Q_EXTERN qboolean dark Q_ASSIGN( qfalse ); Q_EXTERN qboolean sunOnly Q_ASSIGN( qfalse ); -- 2.39.2