From 43455e1842d5346deaef95571cac95a3e24991b0 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sun, 22 Sep 2019 02:24:08 +0200 Subject: [PATCH] q3map2/light: rename -fastallocate to -fastlightmapsearch --- tools/quake3/q3map2/help.c | 3 ++- tools/quake3/q3map2/light.c | 22 ++++++++++++++-------- tools/quake3/q3map2/lightmaps_ydnar.c | 10 +++++----- tools/quake3/q3map2/q3map2.h | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c index 1c99d3c4..28690061 100644 --- a/tools/quake3/q3map2/help.c +++ b/tools/quake3/q3map2/help.c @@ -207,10 +207,11 @@ void HelpLight() {"-extravisnudge", "Broken feature to nudge the luxel origin to a better vis cluster"}, {"-extrawide", "Deprecated alias for `-super 2 -filter`"}, {"-extra", "Deprecated alias for `-super 2`"}, - {"-fastallocate", "Use `-fastallocate` to trade lightmap size against allocation time (useful with hi res lightmaps on large maps: reduce allocation time from days to minutes for only some extra bytes)"}, + {"-fastallocate", "Deprecated alias for `-fastlightmapsearch`"}, {"-fastbounce", "Use `-fast` style lighting for radiosity"}, {"-faster", "Use a faster falloff curve for lighting; also implies `-fast`"}, {"-fastgrid", "Use `-fast` style lighting for the light grid"}, + {"-fastlightmapsearch", "Use `-fastlightmapsearch` to trade lightmap size against packing time (useful with hi res lightmaps on large maps: reduce allocation time from days to minutes for only some extra bytes)"}, {"-fast", "Ignore tiny light contributions"}, {"-fill", "Fill lightmap colors from surrounding pixels to improve JPEG compression"}, {"-filter", "Lightmap filtering"}, diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index 6b60e737..dd906c1c 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -1890,7 +1890,7 @@ void SetupGrid( void ){ does what it says... */ -void LightWorld( const char *BSPFilePath, qboolean fastAllocate ){ +void LightWorld( const char *BSPFilePath, qboolean fastLightmapSearch ){ vec3_t color; float f; int b, bt; @@ -2034,7 +2034,7 @@ void LightWorld( const char *BSPFilePath, qboolean fastAllocate ){ while ( bounce > 0 ) { /* store off the bsp between bounces */ - StoreSurfaceLightmaps( fastAllocate ); + StoreSurfaceLightmaps( fastLightmapSearch ); UnparseEntities(); Sys_Printf( "Writing %s\n", BSPFilePath ); WriteBSPFile( BSPFilePath ); @@ -2099,7 +2099,7 @@ void LightWorld( const char *BSPFilePath, qboolean fastAllocate ){ b++; } /* ydnar: store off lightmaps */ - StoreSurfaceLightmaps( fastAllocate ); + StoreSurfaceLightmaps( fastLightmapSearch ); } @@ -2139,7 +2139,7 @@ int LightMain( int argc, char **argv ){ const char *value; int lightmapMergeSize = 0; qboolean lightSamplesInsist = qfalse; - qboolean fastAllocate = qfalse; + qboolean fastLightmapSearch = qfalse; /* note it */ Sys_Printf( "--- Light ---\n" ); @@ -2660,9 +2660,15 @@ int LightMain( int argc, char **argv ){ Sys_Printf( "Faster mode enabled\n" ); } - else if ( !strcmp( argv[ i ], "-fastallocate" ) ) { - fastAllocate = qtrue; - Sys_Printf( "Fast allocation mode enabled\n" ); + else if ( !strcmp( argv[ i ], "-fastlightmapsearch" ) || !strcmp( argv[ i ], "-fastallocate") ) { + fastLightmapSearch = qtrue; + + if ( !strcmp( argv[ i ], "-fastallocate" ) ) { + Sys_Printf( "The -fastallocate argument is deprecated, use \"-fastlightmapsearch\" instead\n" ); + } + else { + Sys_Printf( "Fast lightmap search enabled\n" ); + } } else if ( !strcmp( argv[ i ], "-fastgrid" ) ) { @@ -3022,7 +3028,7 @@ int LightMain( int argc, char **argv ){ SetupTraceNodes(); /* light the world */ - LightWorld( BSPFilePath, fastAllocate ); + LightWorld( BSPFilePath, fastLightmapSearch ); /* write out the bsp */ UnparseEntities(); diff --git a/tools/quake3/q3map2/lightmaps_ydnar.c b/tools/quake3/q3map2/lightmaps_ydnar.c index fc8dcced..d169c21f 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.c +++ b/tools/quake3/q3map2/lightmaps_ydnar.c @@ -1975,7 +1975,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){ */ #define LIGHTMAP_RESERVE_COUNT 1 -static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastAllocate ){ +static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastLightmapSearch ){ int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy, offset; outLightmap_t *olm; surfaceInfo_t *info; @@ -2095,7 +2095,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastAllocate ){ } /* if fast allocation, skip lightmap files that are more than 90% complete */ - if ( fastAllocate == qtrue ) { + if ( fastLightmapSearch == qtrue ) { if (olm->freeLuxels < (olm->customWidth * olm->customHeight) / 10) { continue; } @@ -2119,7 +2119,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastAllocate ){ } /* if fast allocation, do not test allocation on every pixels, especially for large lightmaps */ - if ( fastAllocate == qtrue ) { + if ( fastLightmapSearch == qtrue ) { xIncrement = MAX(1, lm->w / 15); yIncrement = MAX(1, lm->h / 15); } @@ -2462,7 +2462,7 @@ void FillOutLightmap( outLightmap_t *olm ){ stores the surface lightmaps into the bsp as byte rgb triplets */ -void StoreSurfaceLightmaps( qboolean fastAllocate ){ +void StoreSurfaceLightmaps( qboolean fastLightmapSearch ){ int i, j, k, x, y, lx, ly, sx, sy, *cluster, mappedSamples; int style, size, lightmapNum, lightmapNum2; float *normal, *luxel, *bspLuxel, *bspLuxel2, *radLuxel, samples, occludedSamples; @@ -3080,7 +3080,7 @@ void StoreSurfaceLightmaps( qboolean fastAllocate ){ for ( i = 0; i < numRawLightmaps; i++ ) { lm = &rawLightmaps[ sortLightmaps[ i ] ]; - FindOutLightmaps( lm, fastAllocate ); + FindOutLightmaps( lm, fastLightmapSearch ); } /* set output numbers in twinned lightmaps */ diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 38ee560a..4220725d 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1858,7 +1858,7 @@ int ImportLightmapsMain( int argc, char **argv ); void SetupSurfaceLightmaps( void ); void StitchSurfaceLightmaps( void ); -void StoreSurfaceLightmaps( qboolean fastAllocate ); +void StoreSurfaceLightmaps( qboolean fastLightmapSearch ); /* exportents.c */ -- 2.39.2