From a27eb6c1800e792e099249d594b34245d8ac8c0e Mon Sep 17 00:00:00 2001 From: rpolzer Date: Mon, 22 Sep 2008 11:07:44 +0000 Subject: [PATCH] -minsamplesize git-svn-id: svn://svn.icculus.org/netradiant/trunk@99 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/bsp.c | 8 ++++++++ tools/quake3/q3map2/light.c | 8 ++++++++ tools/quake3/q3map2/q3map2.h | 4 ++++ tools/quake3/q3map2/surface.c | 4 +++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index aeaf736..00fd1fe 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -732,6 +732,14 @@ int BSPMain( int argc, char **argv ) i++; Sys_Printf( "Lightmap sample size set to %dx%d units\n", sampleSize, sampleSize ); } + else if( !strcmp( argv[ i ], "-minsamplesize" ) ) + { + minSampleSize = atoi( argv[ i + 1 ] ); + if( minSampleSize < 1 ) + minSampleSize = 1; + i++; + Sys_Printf( "Minimum lightmap sample size set to %dx%d units\n", minSampleSize, minSampleSize ); + } else if( !strcmp( argv[ i ], "-custinfoparms") ) { Sys_Printf( "Custom info parms enabled\n" ); diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index ffaf40c..e5e526f 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -2216,6 +2216,14 @@ int LightMain( int argc, char **argv ) i++; Sys_Printf( "Default lightmap sample size set to %dx%d units\n", sampleSize, sampleSize ); } + else if( !strcmp( argv[ i ], "-minsamplesize" ) ) + { + minSampleSize = atoi( argv[ i + 1 ] ); + if( minSampleSize < 1 ) + minSampleSize = 1; + i++; + Sys_Printf( "Minimum lightmap sample size set to %dx%d units\n", minSampleSize, minSampleSize ); + } else if( !strcmp( argv[ i ], "-novertex" ) ) { noVertexLighting = qtrue; diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 18db5b1..a454593 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -248,6 +248,7 @@ constants #define GRID_EPSILON 0.0f #define DEFAULT_LIGHTMAP_SAMPLE_SIZE 16 +#define DEFAULT_LIGHTMAP_MIN_SAMPLE_SIZE 0 #define DEFAULT_LIGHTMAP_SAMPLE_OFFSET 1.0f #define DEFAULT_SUBDIVIDE_THRESHOLD 1.0f @@ -1656,6 +1657,7 @@ int GetSurfaceExtraEntityNum( int num ); int GetSurfaceExtraCastShadows( int num ); int GetSurfaceExtraRecvShadows( int num ); int GetSurfaceExtraSampleSize( int num ); +int GetSurfaceExtraMinSampleSize( int num ); float GetSurfaceExtraLongestCurve( int num ); void GetSurfaceExtraLightmapAxis( int num, vec3_t lightmapAxis ); @@ -1953,6 +1955,7 @@ Q_EXTERN char source[ 1024 ]; Q_EXTERN char outbase[ 32 ]; Q_EXTERN int sampleSize; /* lightmap sample size in units */ +Q_EXTERN int minSampleSize; /* minimum sample size to use at all */ Q_EXTERN int mapEntityNum Q_ASSIGN( 0 ); @@ -2079,6 +2082,7 @@ Q_EXTERN qboolean loMem Q_ASSIGN( qfalse ); Q_EXTERN qboolean noStyles Q_ASSIGN( qfalse ); Q_EXTERN int sampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_SAMPLE_SIZE ); +Q_EXTERN int minSampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_MIN_SAMPLE_SIZE ); Q_EXTERN qboolean noVertexLighting Q_ASSIGN( qfalse ); Q_EXTERN qboolean noGridLighting Q_ASSIGN( qfalse ); diff --git a/tools/quake3/q3map2/surface.c b/tools/quake3/q3map2/surface.c index 5415ae1..30b4be5 100644 --- a/tools/quake3/q3map2/surface.c +++ b/tools/quake3/q3map2/surface.c @@ -640,7 +640,9 @@ void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ) ds->sampleSize *= ds->lightmapScale; if( ds->sampleSize <= 0 ) ds->sampleSize = 1; - else if( ds->sampleSize > 16384 ) /* powers of 2 are preferred */ + if(ds->sampleSize < minSampleSize) + ds->sampleSize = minSampleSize; + if( ds->sampleSize > 16384 ) /* powers of 2 are preferred */ ds->sampleSize = 16384; } } -- 2.39.2