From 25b38e8a0e22f3e8e4feba2e0045e43320081d62 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 22 May 2009 14:14:09 +0000 Subject: [PATCH] new option -rawlightmapsizelimit to limit the size of RAW lightmaps (so you can use large lightmap size and still get small lightmap size-like limiting) git-svn-id: svn://svn.icculus.org/netradiant/trunk@372 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/light.c | 8 ++++++++ tools/quake3/q3map2/lightmaps_ydnar.c | 4 ++-- tools/quake3/q3map2/q3map2.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index 1517ba96..35f7f720 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -2122,6 +2122,14 @@ int LightMain( int argc, char **argv ) } } + else if( !strcmp( argv[ i ], "-rawlightmapsizelimit" ) ) + { + lmLimitSize = atoi( argv[ i + 1 ] ); + + i++; + Sys_Printf( "Raw lightmap size limit set to %d x %d pixels\n", lmLimitSize, lmLimitSize ); + } + else if( !strcmp( argv[ i ], "-lightmapdir" ) ) { lmCustomDir = argv[i + 1]; diff --git a/tools/quake3/q3map2/lightmaps_ydnar.c b/tools/quake3/q3map2/lightmaps_ydnar.c index 3c1eed65..252188e9 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.c +++ b/tools/quake3/q3map2/lightmaps_ydnar.c @@ -678,14 +678,14 @@ qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm ) size[ i ] = (maxs[ i ] - mins[ i ]) / sampleSize + 1.0f; /* hack (god this sucks) */ - if( size[ i ] > lm->customWidth || size[ i ] > lm->customHeight ) + if( size[ i ] > lm->customWidth || size[ i ] > lm->customHeight || size[i] > lmLimitSize) { i = -1; sampleSize += 1.0f; } } - if(sampleSize != lm->sampleSize) + if(sampleSize != lm->sampleSize && lmLimitSize == 0) { Sys_FPrintf(SYS_VRB,"WARNING: surface at (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) too large for desired samplesize/lightmapsize/lightmapscale combination, increased samplesize from %d to %d\n", info->mins[0], diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index cf8eefd6..1a63487f 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2184,6 +2184,7 @@ Q_EXTERN qboolean exportLightmaps Q_ASSIGN( qfalse ); Q_EXTERN qboolean externalLightmaps Q_ASSIGN( qfalse ); Q_EXTERN int lmCustomSize Q_ASSIGN( LIGHTMAP_WIDTH ); Q_EXTERN char * lmCustomDir Q_ASSIGN( NULL ); +Q_EXTERN int lmLimitSize Q_ASSIGN( 0 ); Q_EXTERN qboolean dirty Q_ASSIGN( qfalse ); Q_EXTERN qboolean dirtDebug Q_ASSIGN( qfalse ); -- 2.39.2