X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Flight.c;h=39e5c7adbd0826552769fcac9af8c5fb96189392;hb=614fde1f8431e944632e57f47936213217a93937;hp=79098148cbe5c503b33cf27497ed6c33fe486ec8;hpb=d0ddc5a3a4e1de4436c2c0d2650a9cc6f4643f10;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index 79098148..39e5c7ad 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -1771,7 +1771,17 @@ void TraceGrid( int num ){ } /* vortex: apply gridscale and gridambientscale here */ - ColorToBytes( color, bgp->ambient[ i ], gridScale * gridAmbientScale ); + if (gp->directed[i][0] || gp->directed[i][1] || gp->directed[i][2]) { + /* + * HACK: if there's a non-zero directed component, this + * lightgrid cell is useful. However, ioq3 skips grid + * cells with zero ambient. So let's force ambient to be + * nonzero unless directed is zero too. + */ + ColorToBytesNonZero(color, bgp->ambient[i], gridScale * gridAmbientScale); + } else { + ColorToBytes(color, bgp->ambient[i], gridScale * gridAmbientScale); + } ColorToBytes( gp->directed[ i ], bgp->directed[ i ], gridScale ); } @@ -1885,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; @@ -2031,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 ) { @@ -2103,7 +2113,7 @@ void LightWorld( const char *BSPFilePath, qboolean fastLightmapSearch, qboolean } /* ydnar: store off lightmaps */ - StoreSurfaceLightmaps( fastLightmapSearch, qtrue ); + StoreSurfaceLightmaps( fastAllocate, qtrue ); } @@ -2143,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 */ @@ -2536,6 +2546,12 @@ int LightMain( int argc, char **argv ){ Sys_Printf( "Storing all lightmaps externally\n" ); } + else if ( !strcmp( argv[ i ], "-externalnames" ) ) { + externalLightmaps = qtrue; + externalLightmapNames = qtrue; + Sys_Printf( "Writing lightstyle shader using external lightmap names\n" ); + } + else if ( !strcmp( argv[ i ], "-lightmapsize" ) ) { lmCustomSize = atoi( argv[ i + 1 ] ); @@ -2563,7 +2579,9 @@ int LightMain( int argc, char **argv ){ else if ( !strcmp( argv[ i ], "-lightmapdir" ) ) { lmCustomDir = argv[i + 1]; + argv[ i ] = NULL; i++; + argv[ i ] = NULL; Sys_Printf( "Lightmap directory set to %s\n", lmCustomDir ); externalLightmaps = qtrue; Sys_Printf( "Storing all lightmaps externally\n" ); @@ -2670,17 +2688,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" ); @@ -2919,13 +2942,17 @@ int LightMain( int argc, char **argv ){ else if ( !strcmp( argv[ i ], "-bspfile" ) ) { strcpy( BSPFilePath, argv[i + 1] ); + argv[ i ] = NULL; i++; + argv[ i ] = NULL; Sys_Printf( "Use %s as bsp file\n", BSPFilePath ); } else if ( !strcmp( argv[ i ], "-srffile" ) ) { strcpy( surfaceFilePath, argv[i + 1] ); + argv[ i ] = NULL; i++; + argv[ i ] = NULL; Sys_Printf( "Use %s as surface file\n", surfaceFilePath ); } /* unhandled args */ @@ -3043,7 +3070,7 @@ int LightMain( int argc, char **argv ){ SetupTraceNodes(); /* light the world */ - LightWorld( BSPFilePath, fastLightmapSearch, noBounceStore ); + LightWorld( BSPFilePath, fastAllocate, noBounceStore ); /* write out the bsp */ UnparseEntities();