mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 09:19:18 +02:00
disable diffuse and specular moon lighting
This commit is contained in:
14
World.cpp
14
World.cpp
@@ -2270,11 +2270,13 @@ world_environment::update() {
|
|||||||
m_moon.update();
|
m_moon.update();
|
||||||
// ...determine source of key light and adjust global state accordingly...
|
// ...determine source of key light and adjust global state accordingly...
|
||||||
auto const sunlightlevel = m_sun.getIntensity();
|
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 keylightintensity;
|
||||||
float twilightfactor;
|
float twilightfactor;
|
||||||
glm::vec3 keylightcolor;
|
glm::vec3 keylightcolor;
|
||||||
if( moonlightlevel > sunlightlevel ) {
|
if( moonlightlevel > sunlightlevel ) {
|
||||||
|
WriteLog("using moon: " + std::to_string(moonlightlevel));
|
||||||
|
|
||||||
// rare situations when the moon is brighter than the sun, typically at night
|
// rare situations when the moon is brighter than the sun, typically at night
|
||||||
Global::SunAngle = m_moon.getAngle();
|
Global::SunAngle = m_moon.getAngle();
|
||||||
Global::daylight.direction = -1.0f * m_moon.getDirection();
|
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 );
|
keylightcolor = glm::vec3( 255.0f / 255.0f, 242.0f / 255.0f, 202.0f / 255.0f );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
WriteLog("using sun: " + std::to_string(sunlightlevel));
|
||||||
|
|
||||||
// regular situation with sun as the key light
|
// regular situation with sun as the key light
|
||||||
Global::SunAngle = m_sun.getAngle();
|
Global::SunAngle = m_sun.getAngle();
|
||||||
Global::daylight.direction = -1.0f * m_sun.getDirection();
|
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);
|
auto const diffuselevel = interpolate(keylightintensity, intensity * (1.0f - twilightfactor), 1.0f - Global::Overcast * 0.75f);
|
||||||
// ...update light colours and intensity.
|
// ...update light colours and intensity.
|
||||||
keylightcolor = keylightcolor * diffuselevel;
|
keylightcolor = keylightcolor * diffuselevel;
|
||||||
Global::daylight.color.x = keylightcolor.x;
|
|
||||||
Global::daylight.color.y = keylightcolor.y;
|
if (sunlightlevel > moonlightlevel)
|
||||||
Global::daylight.color.z = keylightcolor.z;
|
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
|
// 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)
|
// (this is pure conjecture, aimed more to 'look right' than be accurate)
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ opengl_renderer::Render( world_environment *Environment ) {
|
|||||||
::glLoadIdentity(); // macierz jedynkowa
|
::glLoadIdentity(); // macierz jedynkowa
|
||||||
::glTranslatef( moonposition.x, moonposition.y, moonposition.z );
|
::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
|
// choose the moon appearance variant, based on current moon phase
|
||||||
// NOTE: implementation specific, 8 variants are laid out in 3x3 arrangement
|
// 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)
|
// from new moon onwards, top left to right bottom (last spot is left for future use, if any)
|
||||||
|
|||||||
Reference in New Issue
Block a user