17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 16:05:35 +01:00

Draw volumetric clouds, their shadows, a volumetric fog and catalogue stars from a new weather system in the GL 4.6 renderer

This commit is contained in:
2026-10-16 21:44:47 +02:00
parent d509775269
commit 2be85410ce
47 changed files with 5092 additions and 74 deletions

View File

@@ -1644,6 +1644,41 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
Parser >> gfx_lights_shadows_headlights;
gfx_lights_shadows_headlights = std::clamp( gfx_lights_shadows_headlights, 0, 4 ); }
else if( Token == "gfx.lights.shadows.headlights.range" ) { readvalue( gfx_lights_shadows_headlights_range, 10.f, 1000.f ); }
else if( Token == "gfx.fog" ) {
// volumetric (yes) or analytic (no, old): the same weather either way
Parser.getTokens( 1 );
std::string mode;
Parser >> mode;
gfx_fog = ( mode == "analytic" || mode == "old" || mode == "no" || mode == "false" || mode == "0" ) ? 0 : 1; }
else if( Token == "gfx.fog.quality" ) {
Parser.getTokens( 1 );
std::string level;
Parser >> level;
gfx_fog_quality = ( level == "low" || level == "1" ) ? 1 : ( level == "high" || level == "3" ) ? 3 : ( level == "ultra" || level == "4" ) ? 4 : 2; }
else if( Token == "gfx.fog.range" ) { readvalue( gfx_fog_range, 100.f, 10000.f ); }
else if( Token == "gfx.fog.lights" ) { readvalue( gfx_fog_lights, 0.f, 10.f ); }
else if( Token == "gfx.fog.shadows" ) { readswitch( gfx_fog_shadows ); }
else if( Token == "gfx.fog.temporal" ) { readswitch( gfx_fog_temporal ); }
else if( Token == "gfx.clouds" ) {
// no, or the quality: low, medium (yes), high, ultra
Parser.getTokens( 1 );
std::string level;
Parser >> level;
gfx_clouds =
( level == "low" || level == "1" ) ? 1 :
( level == "medium" || level == "yes" || level == "true" || level == "2" ) ? 2 :
( level == "high" || level == "3" ) ? 3 :
( level == "ultra" || level == "4" ) ? 4 :
0; }
else if( Token == "gfx.clouds.distance" ) { readvalue( gfx_clouds_distance, 5000.f, 200000.f ); }
else if( Token == "gfx.clouds.shadows" ) { readswitch( gfx_clouds_shadows ); }
else if( Token == "gfx.clouds.shadows.size" ) {
Parser.getTokens( 1 );
Parser >> gfx_clouds_shadows_size;
gfx_clouds_shadows_size = std::clamp( gfx_clouds_shadows_size, 64, 2048 ); }
else if( Token == "gfx.clouds.shadows.range" ) { readvalue( gfx_clouds_shadows_range, 1000.f, 100000.f ); }
else if( Token == "gfx.stars" ) { readswitch( gfx_stars ); }
else if( Token == "gfx.stars.brightness" ) { readvalue( gfx_stars_brightness, 0.f, 16.f ); }
else { return false; }
return true;
@@ -1928,6 +1963,19 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "gfx.lights.shadows.vehicles.range", gfx_lights_shadows_vehicles_range );
export_as_text( Output, "gfx.lights.shadows.headlights", gfx_lights_shadows_headlights );
export_as_text( Output, "gfx.lights.shadows.headlights.range", gfx_lights_shadows_headlights_range );
export_as_text( Output, "gfx.fog", std::string{ gfx_fog == 1 ? "volumetric" : "analytic" } );
export_as_text( Output, "gfx.fog.quality", std::string{ gfx_fog_quality == 1 ? "low" : gfx_fog_quality == 3 ? "high" : gfx_fog_quality == 4 ? "ultra" : "medium" } );
export_as_text( Output, "gfx.fog.range", gfx_fog_range );
export_as_text( Output, "gfx.fog.lights", gfx_fog_lights );
export_as_text( Output, "gfx.fog.shadows", gfx_fog_shadows );
export_as_text( Output, "gfx.fog.temporal", gfx_fog_temporal );
export_as_text( Output, "gfx.clouds", std::string{ gfx_clouds == 1 ? "low" : gfx_clouds == 2 ? "medium" : gfx_clouds == 3 ? "high" : gfx_clouds == 4 ? "ultra" : "no" } );
export_as_text( Output, "gfx.clouds.distance", gfx_clouds_distance );
export_as_text( Output, "gfx.clouds.shadows", gfx_clouds_shadows );
export_as_text( Output, "gfx.clouds.shadows.size", gfx_clouds_shadows_size );
export_as_text( Output, "gfx.clouds.shadows.range", gfx_clouds_shadows_range );
export_as_text( Output, "gfx.stars", gfx_stars );
export_as_text( Output, "gfx.stars.brightness", gfx_stars_brightness );
export_as_text( Output, "python.enabled", python_enabled );
export_as_text( Output, "python.threadedupload", python_threadedupload );
export_as_text( Output, "python.uploadmain", python_uploadmain );

View File

@@ -362,6 +362,27 @@ struct global_settings {
// cast them, metres
int gfx_lights_shadows_headlights { 2 };
float gfx_lights_shadows_headlights_range { 250.f };
// weather of the opengl 4.6 renderer (debug window "Weather"); the weather itself comes from the scenery, see
// environment/weather.h. fog: 1 volumetric (a volume over the view with the shafts of the sun, the shadows of the clouds and
// the light of lamps and headlights, worked out along the ray past it), 0 analytic (the same fog along the ray only, the way
// the old one was drawn); the quality of the volume 1-4 (low, medium, high, ultra), its depth (metres), the brightness of the
// lamps in it (0: none), whether the sun and the headlights cast their shadows into it, blending over frames
int gfx_fog { 1 };
int gfx_fog_quality { 2 };
float gfx_fog_range { 1500.f };
float gfx_fog_lights { 1.f };
bool gfx_fog_shadows { true };
bool gfx_fog_temporal { true };
// volumetric clouds, 0 none, 1-4 the quality (low, medium, high, ultra); the farthest they are drawn (metres); the shadows
// they cast (a map around the camera: its size in texels and in metres)
int gfx_clouds { 2 };
float gfx_clouds_distance { 40000.f };
bool gfx_clouds_shadows { true };
int gfx_clouds_shadows_size { 512 };
float gfx_clouds_shadows_range { 16000.f };
// stars from the catalogue, and their brightness
bool gfx_stars { true };
float gfx_stars_brightness { 1.f };
float ui_fontsize = 13.0f;
float ui_scale = 1.0f;