* support -extlmhacksize N N input for non square lightmaps, for example -extlmhacksize 2048 1024
also enables this for -lightmapsize, legitimacy is questionable here
This commit is contained in:
parent
5977a04550
commit
ae9fe08159
|
|
@ -2072,8 +2072,8 @@ int LightMain( int argc, char **argv ){
|
|||
Sys_Printf( " lightning model: quake3\n" );
|
||||
}
|
||||
|
||||
lmCustomSize = game->lightmapSize;
|
||||
Sys_Printf( " lightmap size: %d x %d pixels\n", lmCustomSize, lmCustomSize );
|
||||
lmCustomSizeW = lmCustomSizeH = game->lightmapSize;
|
||||
Sys_Printf( " lightmap size: %d x %d pixels\n", lmCustomSizeW, lmCustomSizeH );
|
||||
|
||||
lightmapGamma = game->lightmapGamma;
|
||||
Sys_Printf( " lightning gamma: %f\n", lightmapGamma );
|
||||
|
|
@ -2496,21 +2496,27 @@ int LightMain( int argc, char **argv ){
|
|||
|
||||
else if ( strEqual( argv[ i ], "-lightmapsize" )
|
||||
|| strEqual( argv[ i ], "-extlmhacksize" ) ) {
|
||||
lmCustomSize = atoi( argv[ i + 1 ] );
|
||||
const bool extlmhack = strEqual( argv[ i ], "-extlmhacksize" );
|
||||
|
||||
/* must be a power of 2 and greater than 2 */
|
||||
if ( ( ( lmCustomSize - 1 ) & lmCustomSize ) || lmCustomSize < 2 ) {
|
||||
Sys_Warning( "Lightmap size must be a power of 2, greater or equal to 2 pixels.\n" );
|
||||
lmCustomSize = game->lightmapSize;
|
||||
lmCustomSizeW = lmCustomSizeH = atoi( argv[ i + 1 ] );
|
||||
if( i + 2 < argc - 1 && argv[ i + 2 ][0] != '-' && 0 != atoi( argv[ i + 2 ] ) ){
|
||||
lmCustomSizeH = atoi( argv[ i + 2 ] );
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
Sys_Printf( "Default lightmap size set to %d x %d pixels\n", lmCustomSize, lmCustomSize );
|
||||
/* must be a power of 2 and greater than 2 */
|
||||
if ( ( ( lmCustomSizeW - 1 ) & lmCustomSizeW ) || lmCustomSizeW < 2 ||
|
||||
( ( lmCustomSizeH - 1 ) & lmCustomSizeH ) || lmCustomSizeH < 2 ) {
|
||||
Sys_Warning( "Lightmap size must be a power of 2, greater or equal to 2 pixels.\n" );
|
||||
lmCustomSizeW = lmCustomSizeH = game->lightmapSize;
|
||||
}
|
||||
Sys_Printf( "Default lightmap size set to %d x %d pixels\n", lmCustomSizeW, lmCustomSizeH );
|
||||
|
||||
/* enable external lightmaps */
|
||||
if ( lmCustomSize != game->lightmapSize ) {
|
||||
if ( lmCustomSizeW != game->lightmapSize || lmCustomSizeH != game->lightmapSize ) {
|
||||
/* -lightmapsize might just require -external for native external lms, but it has already been used in existing batches alone,
|
||||
so brand new switch here for external lms, referenced by shaders hack/behavior */
|
||||
externalLightmaps = !strEqual( argv[ i - 1 ], "-extlmhacksize" );
|
||||
externalLightmaps = !extlmhack;
|
||||
Sys_Printf( "Storing all lightmaps externally\n" );
|
||||
}
|
||||
}
|
||||
|
|
@ -2921,7 +2927,7 @@ int LightMain( int argc, char **argv ){
|
|||
|
||||
/* fix up lightmap search power */
|
||||
if ( lightmapMergeSize ) {
|
||||
lightmapSearchBlockSize = ( lightmapMergeSize / lmCustomSize ) * ( lightmapMergeSize / lmCustomSize );
|
||||
lightmapSearchBlockSize = ( lightmapMergeSize / lmCustomSizeW ) * ( lightmapMergeSize / lmCustomSizeW ); //? should use min or max( lmCustomSizeW, lmCustomSizeH )? :thinking:
|
||||
if ( lightmapSearchBlockSize < 1 ) {
|
||||
lightmapSearchBlockSize = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2300,7 +2300,8 @@ Q_EXTERN bool noCollapse Q_ASSIGN( false );
|
|||
Q_EXTERN int lightmapSearchBlockSize Q_ASSIGN( 0 );
|
||||
Q_EXTERN bool exportLightmaps Q_ASSIGN( false );
|
||||
Q_EXTERN bool externalLightmaps Q_ASSIGN( false );
|
||||
Q_EXTERN int lmCustomSize Q_ASSIGN( LIGHTMAP_WIDTH );
|
||||
Q_EXTERN int lmCustomSizeW Q_ASSIGN( LIGHTMAP_WIDTH );
|
||||
Q_EXTERN int lmCustomSizeH Q_ASSIGN( LIGHTMAP_WIDTH );
|
||||
Q_EXTERN char * lmCustomDir Q_ASSIGN( NULL );
|
||||
Q_EXTERN int lmLimitSize Q_ASSIGN( 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -653,8 +653,8 @@ static shaderInfo_t *AllocShaderInfo( void ){
|
|||
TCModIdentity( si->mod );
|
||||
|
||||
/* ydnar: lightmaps can now be > 128x128 in certain games or an externally generated tga */
|
||||
si->lmCustomWidth = lmCustomSize;
|
||||
si->lmCustomHeight = lmCustomSize;
|
||||
si->lmCustomWidth = lmCustomSizeW;
|
||||
si->lmCustomHeight = lmCustomSizeH;
|
||||
|
||||
/* return to sender */
|
||||
return si;
|
||||
|
|
@ -1571,8 +1571,8 @@ static void ParseShaderFile( const char *filename ){
|
|||
( ( si->lmCustomHeight - 1 ) & si->lmCustomHeight ) ) {
|
||||
Sys_Warning( "Non power-of-two lightmap size specified (%d, %d)\n",
|
||||
si->lmCustomWidth, si->lmCustomHeight );
|
||||
si->lmCustomWidth = lmCustomSize;
|
||||
si->lmCustomHeight = lmCustomSize;
|
||||
si->lmCustomWidth = lmCustomSizeW;
|
||||
si->lmCustomHeight = lmCustomSizeH;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user