diff options
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 30 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 3 |
2 files changed, 26 insertions, 7 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e02ecc8a33..fecca12905 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1246,6 +1246,17 @@ LLColor4 LLSettingsSky::getTotalAmbient() const return mTotalAmbient; } +LLColor3 LLSettingsSky::getMoonlightColor() const +{ + F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; + + LLColor3 moonlight_a(0.45, 0.45, 0.66); + LLColor3 moonlight_b(0.33, 0.33, 1.0); + + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + return moonlight; +} + void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables @@ -1278,19 +1289,24 @@ void LLSettingsSky::calculateLightSettings() const //brightness of surface both sunlight and ambient // reduce range to 0 - 1 before gamma correct to prevent clipping // then restore to full 0 - 3 range before storage - mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f; - mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f; + //mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + //mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); + + mSunDiffuse = componentMult(sunlight, light_transmittance); + mSunAmbient = componentMult(tmpAmbient, light_transmittance); F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.45, 0.45, 0.66); - LLColor3 moonlight_b(0.33, 0.33, 1.0); + LLColor3 moonlight = getMoonlightColor(); + LLColor3 moonlight_b(0.33, 0.33, 1.0); // scotopic ambient value - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + //mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); + //mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; + mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mTotalAmbient = mSunAmbient; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index ef2a6740f0..92b8a8bd5a 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -282,6 +282,9 @@ public: LLVector3 getSunDirection() const; LLVector3 getMoonDirection() const; + // color based on brightness + LLColor3 getMoonlightColor() const; + LLColor4 getMoonAmbient() const; LLColor3 getMoonDiffuse() const; LLColor4 getSunAmbient() const; |