* fix custom shaders generation for lightstyles and external lightmaps hacks for :q3map suffixed shaders

note ignoring only classic stageless :q3map shaders; ones with stages are assumed as templates for custom shaders, hidden by suffix
closes #165
This commit is contained in:
Garux 2024-02-04 09:33:43 +06:00
parent 4b26129c47
commit e77d713bad

View File

@ -841,7 +841,8 @@ static void ParseShaderFile( const char *filename ){
shaderInfo_t *si = AllocShaderInfo(); shaderInfo_t *si = AllocShaderInfo();
/* ignore ":q3map" suffix */ /* ignore ":q3map" suffix */
if( striEqualSuffix( token, ":q3map" ) ) const bool isQ3mapOnlyShader = striEqualSuffix( token, ":q3map" );
if( isQ3mapOnlyShader )
si->shader << StringRange( token, strlen( token ) - strlen( ":q3map" ) ); si->shader << StringRange( token, strlen( token ) - strlen( ":q3map" ) );
else else
si->shader << token; si->shader << token;
@ -1773,10 +1774,13 @@ static void ParseShaderFile( const char *filename ){
} }
/* copy shader text to the shaderinfo */ /* copy shader text to the shaderinfo */
text.text << '\n'; /* unless it's :q3map stageless shader: shaderText of those is not usable for custom shaders composition */
si->shaderText = copystring( text.text ); if( !( isQ3mapOnlyShader && !si->hasPasses ) ){
//% if( vector3_length( si->vecs[ 0 ] ) ) text.text << '\n';
//% Sys_Printf( "%s\n", si->shaderText ); si->shaderText = copystring( text.text );
//% if( vector3_length( si->vecs[ 0 ] ) )
//% Sys_Printf( "%s\n", si->shaderText );
}
/* ydnar: clear shader text buffer */ /* ydnar: clear shader text buffer */
text.clear(); text.clear();