mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 02:09:18 +02:00
Let eu07.ini scale how much the moon lights the scenery at night (gfx.moonlight)
This commit is contained in:
@@ -257,6 +257,7 @@ are no longer loaded.
|
||||
| `gfx.stars.brightness` | `1.0` | 0..16: their brightness |
|
||||
| `gfx.sun.disc` | `1.0` | 0..4: brightness of the sun disc against the radiance its sunlight gives it; 1 is physical (held within the range of the image), the glare around it comes from the bloom |
|
||||
| `gfx.moon.disc` | `1.0` | 0..16: brightness of the moon disc |
|
||||
| `gfx.moonlight` | `1.0` | 0..10: how much the moon lights the scenery at night (its direct light, the night light that comes with it and the moonlit sky); 0: no moonlight |
|
||||
|
||||
### Models drawn from the GPU
|
||||
|
||||
|
||||
@@ -888,6 +888,7 @@ void opengl46_renderer::draw_debug_ui()
|
||||
m_sky.draw_debug_ui();
|
||||
ImGui::SliderFloat("sun disc, 1 = physical (gfx.sun.disc)", &Global.gfx_sun_disc, 0.f, 2.f);
|
||||
ImGui::SliderFloat("moon disc (gfx.moon.disc)", &Global.gfx_moon_disc, 0.f, 8.f);
|
||||
ImGui::SliderFloat("moonlight on the scenery (gfx.moonlight)", &Global.gfx_moonlight, 0.f, 10.f);
|
||||
{
|
||||
// where the sun and the moon are: azimuth from the north to the east (the sky has x to the west, z to the north)
|
||||
auto const azimuth = [](glm::vec3 const &Direction) { return glm::degrees(std::atan2(-Direction.x, Direction.z)) + (Direction.x > 0.f ? 360.f : 0.f); };
|
||||
@@ -2390,7 +2391,7 @@ bool opengl46_renderer::Render(world_environment *Environment)
|
||||
{
|
||||
// turn on moon shadows after astronomical twilight, if the moon is actually up. they come in with the moonlight
|
||||
// (simulation/simulationenvironment.cpp) and are as deep as it is strong: full from the gibbous moon, faint from a crescent
|
||||
auto const moonshadow{std::clamp(4.f * Environment->m_moon.getBrightness(), 0.f, 1.f) * std::clamp((-18.f - Environment->m_sun.getAngle()) / 2.f, 0.f, 1.f) *
|
||||
auto const moonshadow{std::clamp(4.f * Environment->m_moon.getBrightness() * Global.gfx_moonlight, 0.f, 1.f) * std::clamp((-18.f - Environment->m_sun.getAngle()) / 2.f, 0.f, 1.f) *
|
||||
std::clamp(Environment->m_moon.getAngle() / 5.f, 0.f, 1.f)};
|
||||
m_shadowcolor = glm::mix(glm::vec4{colors::white}, glm::vec4{colors::shadow}, moonshadow);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ world_environment::update() {
|
||||
float twilightfactor = std::clamp( -m_sun.getAngle(), 0.0f, 18.0f ) / 18.0f;
|
||||
// NOTE: sun light receives extra padding to prevent moon from kicking in too soon
|
||||
auto const sunlightlevel = m_sun.getIntensity() + 0.05f * ( 1.f - twilightfactor );
|
||||
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
|
||||
auto const moonlightlevel = m_moon.getIntensity() * 0.65f * Global.gfx_moonlight; // scaled down by arbitrary factor, it's pretty bright otherwise
|
||||
|
||||
// ...update skydome to match the current sun position as well...
|
||||
// twilight factor can be reset later down, so we do it here while it's still reflecting state of the sun
|
||||
@@ -157,7 +157,7 @@ world_environment::update() {
|
||||
m_lightintensity = moonlightlevel;
|
||||
// if the moon is up, it overrides the twilight
|
||||
twilightfactor = 0.0f;
|
||||
lightfloor *= moonlightshare;
|
||||
lightfloor *= moonlightshare * Global.gfx_moonlight;
|
||||
keylightcolor = moonlightcolor * moonfadein;
|
||||
moonkeylight = true;
|
||||
}
|
||||
|
||||
@@ -1710,6 +1710,7 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
|
||||
else if( Token == "gfx.stars.brightness" ) { readvalue( gfx_stars_brightness, 0.f, 16.f ); }
|
||||
else if( Token == "gfx.sun.disc" ) { readvalue( gfx_sun_disc, 0.f, 4.f ); }
|
||||
else if( Token == "gfx.moon.disc" ) { readvalue( gfx_moon_disc, 0.f, 16.f ); }
|
||||
else if( Token == "gfx.moonlight" ) { readvalue( gfx_moonlight, 0.f, 10.f ); }
|
||||
else { return false; }
|
||||
|
||||
return true;
|
||||
@@ -2017,6 +2018,7 @@ global_settings::export_as_text( std::ostream &Output ) const {
|
||||
export_as_text( Output, "gfx.stars.brightness", gfx_stars_brightness );
|
||||
export_as_text( Output, "gfx.sun.disc", gfx_sun_disc );
|
||||
export_as_text( Output, "gfx.moon.disc", gfx_moon_disc );
|
||||
export_as_text( Output, "gfx.moonlight", gfx_moonlight );
|
||||
export_as_text( Output, "python.enabled", python_enabled );
|
||||
export_as_text( Output, "python.threadedupload", python_threadedupload );
|
||||
export_as_text( Output, "python.uploadmain", python_uploadmain );
|
||||
|
||||
@@ -404,6 +404,8 @@ struct global_settings {
|
||||
// and of the moon disc
|
||||
float gfx_sun_disc { 1.f };
|
||||
float gfx_moon_disc { 1.f };
|
||||
// how much the moon lights the scenery at night (its direct light, the night light that comes with it and the moonlit sky)
|
||||
float gfx_moonlight { 1.f };
|
||||
|
||||
float ui_fontsize = 13.0f;
|
||||
float ui_scale = 1.0f;
|
||||
|
||||
Reference in New Issue
Block a user