diff --git a/src/definition/Scenery.h b/src/definition/Scenery.h index d132961..9fde57a 100644 --- a/src/definition/Scenery.h +++ b/src/definition/Scenery.h @@ -41,6 +41,9 @@ class DEFINITIONSHARED_EXPORT Scenery : public DefinitionNode { static constexpr double SUN_RADIUS = 6.955e5; static constexpr double SUN_RADIUS_SCALED = SUN_RADIUS * KM_TO_UNIT; + static constexpr double ATMOSPHERE_WIDTH = 61.0; + static constexpr double ATMOSPHERE_WIDTH_SCALED = ATMOSPHERE_WIDTH * KM_TO_UNIT; + static constexpr double FAR_LIMIT_SCALED = 20000.0; public: diff --git a/src/render/software/AtmosphereModelBruneton.cpp b/src/render/software/AtmosphereModelBruneton.cpp index d670010..65b0055 100644 --- a/src/render/software/AtmosphereModelBruneton.cpp +++ b/src/render/software/AtmosphereModelBruneton.cpp @@ -1159,7 +1159,7 @@ bool AtmosphereModelBruneton::getLightsAt(vector &result, const result.push_back(sun); - irradiance.color = _irradiance(_irradianceTexture, r0, muS); + irradiance.color = _irradiance(_irradianceTexture, r0, muS).scaled(1.0 - min(location.y / Scenery::ATMOSPHERE_WIDTH_SCALED, 1.0)); irradiance.direction = VECTOR_DOWN; irradiance.reflection = 0.0; irradiance.altered = 0; diff --git a/src/render/software/NightSky.cpp b/src/render/software/NightSky.cpp index adb9916..92ebefc 100644 --- a/src/render/software/NightSky.cpp +++ b/src/render/software/NightSky.cpp @@ -1,5 +1,6 @@ #include "NightSky.h" +#include #include "Color.h" #include "Vector3.h" #include "Geometry.h" @@ -54,10 +55,10 @@ const Color NightSky::getColor(double altitude, const Vector3 &direction) { return result; } -bool NightSky::getLightsAt(vector &result, const Vector3 &) const { +bool NightSky::getLightsAt(vector &result, const Vector3 &location) const { LightComponent sky; - sky.color = Color(0.01, 0.012, 0.03); + sky.color = Color(0.01, 0.012, 0.03).scaled(1.0 - min(location.y / Scenery::ATMOSPHERE_WIDTH_SCALED, 1.0)); sky.direction = VECTOR_DOWN; sky.reflection = 0.0; sky.altered = 0;