Fixed moon being lit by atmosphere irradiance

This commit is contained in:
Michaël Lemaire 2016-01-17 18:27:18 +01:00
parent df28a84671
commit 1e22d778e1
3 changed files with 7 additions and 3 deletions

View file

@ -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:

View file

@ -1159,7 +1159,7 @@ bool AtmosphereModelBruneton::getLightsAt(vector<LightComponent> &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;

View file

@ -1,5 +1,6 @@
#include "NightSky.h"
#include <algorithm>
#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<LightComponent> &result, const Vector3 &) const {
bool NightSky::getLightsAt(vector<LightComponent> &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;