]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/light.c
q3map2/light: rename -fastallocate to -fastlightmapsearch
[xonotic/netradiant.git] / tools / quake3 / q3map2 / light.c
index 0bbb5e7be21ac65aee3033978db5f22af081c599..dd906c1ca89f369291a351ad65a2f6459aeb2601 100644 (file)
@@ -1159,7 +1159,7 @@ int LightContributionToSample( trace_t *trace ){
                /* return to sender */
                return 1;
        }
-       else{
+       else {
                Error( "Light of undefined type!" );
        }
 
@@ -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;
@@ -1913,6 +1913,7 @@ void LightWorld( const char *BSPFilePath, qboolean fastAllocate ){
        if ( VectorLength( color ) == 0.0f ) {
                VectorSet( color, 1.0, 1.0, 1.0 );
        }
+
        if ( colorsRGB ) {
                color[0] = Image_LinearFloatFromsRGBFloat( color[0] );
                color[1] = Image_LinearFloatFromsRGBFloat( color[1] );
@@ -2033,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 );
@@ -2098,7 +2099,27 @@ void LightWorld( const char *BSPFilePath, qboolean fastAllocate ){
                b++;
        }
        /* ydnar: store off lightmaps */
-       StoreSurfaceLightmaps( fastAllocate );
+       StoreSurfaceLightmaps( fastLightmapSearch );
+}
+
+
+
+/*
+   LoadSurfaceFlags()
+   added by spoon to get back the changed surfaceflags
+   from tex file
+*/
+
+void LoadSurfaceFlags( char *filename ) {
+       int i;
+
+       for( i = 0; i < numBSPShaders; i++ ) {
+               shaderInfo_t *si;
+
+               si = ShaderInfoForShader( bspShaders[i].shader );
+
+               bspShaders[ i ].surfaceFlags = si->surfaceFlags;
+       }
 }
 
 
@@ -2118,8 +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" );
@@ -2486,6 +2506,7 @@ int LightMain( int argc, char **argv ){
                        }
                        i++;
                }
+
                else if ( !strcmp( argv[ i ], "-deluxe" ) || !strcmp( argv[ i ], "-deluxemap" ) ) {
                        deluxemap = qtrue;
                        Sys_Printf( "Generating deluxemaps for average light direction\n" );
@@ -2639,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" ) ) {
@@ -2778,6 +2805,14 @@ int LightMain( int argc, char **argv ){
                        loMem = qtrue;
                        Sys_Printf( "Enabling low-memory (potentially slower) lighting mode\n" );
                }
+               else if ( !strcmp( argv[ i ], "-lightsubdiv" ) ) {
+                       defaultLightSubdivide = atoi( argv[ i + 1 ] );
+                       if ( defaultLightSubdivide < 1 ) {
+                               defaultLightSubdivide = 1;
+                       }
+                       i++;
+                       Sys_Printf( "Default light subdivision set to %d\n", defaultLightSubdivide );
+               }
                else if ( !strcmp( argv[ i ], "-lightanglehl" ) ) {
                        if ( ( atoi( argv[ i + 1 ] ) != 0 ) != lightAngleHL ) {
                                lightAngleHL = ( atoi( argv[ i + 1 ] ) != 0 );
@@ -2993,7 +3028,7 @@ int LightMain( int argc, char **argv ){
        SetupTraceNodes();
 
        /* light the world */
-       LightWorld( BSPFilePath, fastAllocate );
+       LightWorld( BSPFilePath, fastLightmapSearch );
 
        /* write out the bsp */
        UnparseEntities();