q3map2: switch back to fastallocate option name to reduce diff with NRC, keep compati...
authorThomas Debesse <dev@illwieckz.net>
Mon, 3 May 2021 01:08:34 +0000 (03:08 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 3 May 2021 06:15:40 +0000 (08:15 +0200)
tools/quake3/q3map2/help.c
tools/quake3/q3map2/light.c
tools/quake3/q3map2/lightmaps_ydnar.c
tools/quake3/q3map2/q3map2.h

index e56b99a08391533bd0c573e11837ac57c453adce..96409f42f2721162b7789a5c2a50ba5557bb3156 100644 (file)
@@ -214,11 +214,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", "Deprecated alias for `-fastlightmapsearch`"},
+               {"-fastallocate",  "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)"},
                {"-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)"},
+               {"-fastlightmapsearch", "Deprecated alias for `-fastallocate`"},
                {"-fast", "Ignore tiny light contributions"},
                {"-fill", "Fill lightmap colors from surrounding pixels to improve JPEG compression"},
                {"-filter", "Lightmap filtering"},
@@ -266,6 +266,7 @@ void HelpLight()
                {"-shadeangle <A>", "Angle for phong shading"},
                {"-shade", "Enable phong shading at default shade angle"},
                {"-skyscale <F, `-sky` F>", "Scaling factor for sky and sun light"},
+               {"-slowallocate", "Use old (a bit more careful, but much slower) lightmaps packing algorithm (default)"},
                {"-smooth", "Deprecated alias for `-samples 2`"},
                {"-sphericalscale <F, `-spherical` F>", "Scaling factor for spherical point light entities"},
                {"-spotscale <F, `-spot` F>", "Scaling factor for spot point light entities"},
index bedc3f1770bf603d766d5126a84d5e575fe85418..99d794840f6787fa836f2450ea2060afc44a1b37 100644 (file)
@@ -1895,7 +1895,7 @@ void SetupGrid( void ){
    does what it says...
  */
 
-void LightWorld( const char *BSPFilePath, qboolean fastLightmapSearch, qboolean noBounceStore ){
+void LightWorld( const char *BSPFilePath, qboolean fastAllocate, qboolean noBounceStore ){
        vec3_t color;
        float f;
        int b, bt;
@@ -2041,7 +2041,7 @@ void LightWorld( const char *BSPFilePath, qboolean fastLightmapSearch, qboolean
                qboolean storeForReal = !noBounceStore;
 
                /* store off the bsp between bounces */
-               StoreSurfaceLightmaps( fastLightmapSearch, storeForReal );
+               StoreSurfaceLightmaps( fastAllocate, storeForReal );
                UnparseEntities();
 
                if ( storeForReal ) {
@@ -2113,7 +2113,7 @@ void LightWorld( const char *BSPFilePath, qboolean fastLightmapSearch, qboolean
        }
 
        /* ydnar: store off lightmaps */
-       StoreSurfaceLightmaps( fastLightmapSearch, qtrue );
+       StoreSurfaceLightmaps( fastAllocate, qtrue );
 }
 
 
@@ -2153,7 +2153,7 @@ int LightMain( int argc, char **argv ){
        const char  *value;
        int lightmapMergeSize = 0;
        qboolean lightSamplesInsist = qfalse;
-       qboolean fastLightmapSearch = qfalse;
+       qboolean fastAllocate = qfalse;
        qboolean noBounceStore = qfalse;
 
        /* note it */
@@ -2682,17 +2682,22 @@ int LightMain( int argc, char **argv ){
                        Sys_Printf( "Faster mode enabled\n" );
                }
 
-               else if ( !strcmp( argv[ i ], "-fastlightmapsearch" ) || !strcmp( argv[ i ], "-fastallocate") ) {
-                       fastLightmapSearch = qtrue;
+               else if ( !strcmp( argv[ i ], "-fastallocate" ) || !strcmp( argv[ i ], "-fastlightmapsearch" ) ) {
+                       fastAllocate = qtrue;
 
-                       if ( !strcmp( argv[ i ], "-fastallocate" ) ) {
-                               Sys_Printf( "The -fastallocate argument is deprecated, use \"-fastlightmapsearch\" instead\n" );
+                       if ( !strcmp( argv[ i ], "-fastlightmapsearch" ) ) {
+                               Sys_Printf( "The -fastlightmapsearch argument is deprecated, use \"-fastallocate\" instead\n" );
                        }
                        else {
-                               Sys_Printf( "Fast lightmap search enabled\n" );
+                               Sys_Printf( "Fast lightmap allocation mode enabled\n" );
                        }
                }
 
+               else if ( !strcmp( argv[ i ], "-slowallocate" ) ) {
+                       fastAllocate = qfalse;
+                       Sys_Printf( "Slow lightmap allocation mode enabled (default)\n" );
+               }
+
                else if ( !strcmp( argv[ i ], "-fastgrid" ) ) {
                        fastgrid = qtrue;
                        Sys_Printf( "Fast grid lighting enabled\n" );
@@ -3059,7 +3064,7 @@ int LightMain( int argc, char **argv ){
        SetupTraceNodes();
 
        /* light the world */
-       LightWorld( BSPFilePath, fastLightmapSearch, noBounceStore );
+       LightWorld( BSPFilePath, fastAllocate, noBounceStore );
 
        /* write out the bsp */
        UnparseEntities();
index f6203f538652e52d9aefd4297ca56f9fa47f54d7..37bb6da4fc5c394048ed002089a21ec9b4493982 100644 (file)
@@ -1966,7 +1966,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){
  */
 
 #define LIGHTMAP_RESERVE_COUNT 1
-static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastLightmapSearch ){
+static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastAllocate ){
        int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy, offset;
        outLightmap_t       *olm;
        surfaceInfo_t       *info;
@@ -2085,7 +2085,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastLightmapSearch ){
                                }
 
                                /* if fast allocation, skip lightmap files that are more than 90% complete */
-                               if ( fastLightmapSearch == qtrue ) {
+                               if ( fastAllocate == qtrue ) {
                                        if (olm->freeLuxels < (olm->customWidth * olm->customHeight) / 10) {
                                                continue;
                                        }
@@ -2109,7 +2109,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastLightmapSearch ){
                                }
 
                                /* if fast allocation, do not test allocation on every pixels, especially for large lightmaps */
-                               if ( fastLightmapSearch == qtrue ) {
+                               if ( fastAllocate == qtrue ) {
                                        xIncrement = MAX(1, lm->w / 15);
                                        yIncrement = MAX(1, lm->h / 15);
                                }
@@ -2452,7 +2452,7 @@ void FillOutLightmap( outLightmap_t *olm ){
    stores the surface lightmaps into the bsp as byte rgb triplets
  */
 
-void StoreSurfaceLightmaps( qboolean fastLightmapSearch, qboolean storeForReal ){
+void StoreSurfaceLightmaps( qboolean fastAllocate, qboolean storeForReal ){
        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;
@@ -3070,7 +3070,7 @@ void StoreSurfaceLightmaps( qboolean fastLightmapSearch, qboolean storeForReal )
                for ( i = 0; i < numRawLightmaps; i++ )
                {
                        lm = &rawLightmaps[ sortLightmaps[ i ] ];
-                       FindOutLightmaps( lm, fastLightmapSearch );
+                       FindOutLightmaps( lm, fastAllocate );
                }
 
                /* set output numbers in twinned lightmaps */
index 767a118b02cd8fcceb88e8fc3c751a975707e5cf..eac4ec38cc32ec60ddaec94a39b01048f167f3d0 100644 (file)
@@ -1874,7 +1874,7 @@ int                         ImportLightmapsMain( int argc, char **argv );
 
 void                        SetupSurfaceLightmaps( void );
 void                        StitchSurfaceLightmaps( void );
-void                        StoreSurfaceLightmaps( qboolean fastLightmapSearch, qboolean storeForReal );
+void                        StoreSurfaceLightmaps( qboolean fastAllocate, qboolean storeForReal );
 
 
 /* exportents.c */