diff --git a/World.cpp b/World.cpp index 7d988403..3caef0d6 100644 --- a/World.cpp +++ b/World.cpp @@ -2270,11 +2270,13 @@ world_environment::update() { m_moon.update(); // ...determine source of key light and adjust global state accordingly... auto const sunlightlevel = m_sun.getIntensity(); - 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.5f; // scaled down by arbitrary factor, it's pretty bright otherwise float keylightintensity; float twilightfactor; glm::vec3 keylightcolor; if( moonlightlevel > sunlightlevel ) { + WriteLog("using moon: " + std::to_string(moonlightlevel)); + // rare situations when the moon is brighter than the sun, typically at night Global::SunAngle = m_moon.getAngle(); Global::daylight.direction = -1.0f * m_moon.getDirection(); @@ -2284,6 +2286,8 @@ world_environment::update() { keylightcolor = glm::vec3( 255.0f / 255.0f, 242.0f / 255.0f, 202.0f / 255.0f ); } else { + WriteLog("using sun: " + std::to_string(sunlightlevel)); + // regular situation with sun as the key light Global::SunAngle = m_sun.getAngle(); Global::daylight.direction = -1.0f * m_sun.getDirection(); @@ -2313,9 +2317,11 @@ world_environment::update() { auto const diffuselevel = interpolate(keylightintensity, intensity * (1.0f - twilightfactor), 1.0f - Global::Overcast * 0.75f); // ...update light colours and intensity. keylightcolor = keylightcolor * diffuselevel; - Global::daylight.color.x = keylightcolor.x; - Global::daylight.color.y = keylightcolor.y; - Global::daylight.color.z = keylightcolor.z; + + if (sunlightlevel > moonlightlevel) + Global::daylight.color = keylightcolor * 0.8f; + else + Global::daylight.color = glm::vec3(0.0f); // tonal impact of skydome color is inversely proportional to how high the sun is above the horizon // (this is pure conjecture, aimed more to 'look right' than be accurate) diff --git a/renderer.cpp b/renderer.cpp index ce8aa487..45a38bca 100644 --- a/renderer.cpp +++ b/renderer.cpp @@ -329,7 +329,7 @@ opengl_renderer::Render( world_environment *Environment ) { ::glLoadIdentity(); // macierz jedynkowa ::glTranslatef( moonposition.x, moonposition.y, moonposition.z ); - float const size = 0.02f; // TODO: expose distance/scale factor from the moon object + float const size = 0.02f / 4.0f; // TODO: expose distance/scale factor from the moon object // choose the moon appearance variant, based on current moon phase // NOTE: implementation specific, 8 variants are laid out in 3x3 arrangement // from new moon onwards, top left to right bottom (last spot is left for future use, if any)