]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/light.c
-lightmapsearchpower
[xonotic/netradiant.git] / tools / quake3 / q3map2 / light.c
index eacfba3162800f1b34b7ab10547feb0a57ebaa82..1517ba962eef050a059ee19300662f8ed6a0c2af 100644 (file)
@@ -1845,6 +1845,7 @@ int LightMain( int argc, char **argv )
        float           f;
        char            mapSource[ 1024 ];
        const char      *value;
+       int lightmapMergeSize = 0;
        
        
        /* note it */
@@ -2171,10 +2172,24 @@ int LightMain( int argc, char **argv )
 
                else if( !strcmp( argv[ i ], "-nolightmapsearch" ) )
                {
-                       noLightmapSearch = qtrue;
+                       lightmapSearchBlockSize = 1;
                        Sys_Printf( "No lightmap searching - all lightmaps will be sequential\n" );
                }
                
+               else if( !strcmp( argv[ i ], "-lightmapsearchpower" ) )
+               {
+                       lightmapMergeSize = (game->lightmapSize << atoi(argv[i+1]));
+                       ++i;
+                       Sys_Printf( "Restricted lightmap searching enabled - optimize for lightmap merge power %d (size %d)\n", atoi(argv[i]), lightmapMergeSize );
+               }
+               
+               else if( !strcmp( argv[ i ], "-lightmapsearchblocksize" ) )
+               {
+                       lightmapSearchBlockSize = atoi(argv[i+1]);
+                       ++i;
+                       Sys_Printf( "Restricted lightmap searching enabled - block size set to %d\n", lightmapSearchBlockSize );
+               }
+               
                else if( !strcmp( argv[ i ], "-shade" ) )
                {
                        shade = qtrue;
@@ -2467,6 +2482,16 @@ int LightMain( int argc, char **argv )
                }
 
        }
+
+       /* fix up lightmap search power */
+       if(lightmapMergeSize)
+       {
+               lightmapSearchBlockSize = (lightmapMergeSize / lmCustomSize) * (lightmapMergeSize / lmCustomSize);
+               if(lightmapSearchBlockSize < 1)
+                       lightmapSearchBlockSize = 1;
+
+               Sys_Printf( "Restricted lightmap searching enabled - block size adjusted to %d\n", lightmapSearchBlockSize );
+       }
        
        /* clean up map name */
        strcpy( source, ExpandArg( argv[ i ] ) );