make q3map_skyLight work w/o surfaceparm sky or q3map_sun

This commit is contained in:
Garux
2025-11-01 08:38:33 +05:00
parent c4d4700885
commit 198a915665
3 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ bool LoadScriptFile( const char *filename, int index /* = 0 */, bool verbose /*
ParseFromMemory
==============
*/
void ParseFromMemory( char *buffer, size_t size ){
void ParseFromMemory( const char *buffer, size_t size ){
scriptstack.clear();
tokenready = false;
MemBuffer bu( size );
+1 -1
View File
@@ -32,7 +32,7 @@ extern int scriptline;
/// \param[in] index >= 0: \p filename is relative path in VSF, Nth occurrence of file
/// \return true on success
bool LoadScriptFile( const char *filename, int index = 0, bool verbose = true );
void ParseFromMemory( char *buffer, size_t size );
void ParseFromMemory( const char *buffer, size_t size );
/// \param[in] crossline true: write next token to \c token or return false on EOF
/// \param[in] crossline false: find next token on the current line or emit \c Error
+5 -6
View File
@@ -1094,7 +1094,7 @@ static void ParseShaderFile( const char *filename ){
sun.numSamples = atoi( token );
}
/* apply sky surfaceparm */
/* apply sky surfaceparm, this is required by ELightType::Sun to work */
ApplySurfaceParm( "sky", &si.contentFlags, &si.surfaceFlags, &si.compileFlags );
/* don't process any more tokens on this line */
@@ -1179,13 +1179,12 @@ static void ParseShaderFile( const char *filename ){
else if ( striEqual( token, "q3map_skyLight" ) ) {
skylight_t& skylight = si.skylights.emplace_back();
text.GetToken( false );
skylight.value = atof( token );
skylight.value = std::max( atof( token ), 0.0 );
text.GetToken( false );
skylight.iterations = atoi( token );
skylight.iterations = std::max( atoi( token ), 2 );
/* clamp */
value_maximize( skylight.value, 0.0f );
value_maximize( skylight.iterations, 2 );
/* apply sky surfaceparm, this is required by ELightType::Sun to work */
ApplySurfaceParm( "sky", &si.contentFlags, &si.surfaceFlags, &si.compileFlags );
/* read optional extension: horizon_min horizon_max sample_color*/
if( TokenAvailable() ){