Skip to content
Snippets Groups Projects
Commit aa7ca0ae authored by Michael Pohoreski's avatar Michael Pohoreski
Browse files

Merged in SL-16127 (pull request #741)

SL-16127

Approved-by: Euclid Linden
Approved-by: Dave Parks
parents c907d067 26e8d2d8
No related branches found
No related tags found
No related merge requests found
......@@ -1209,6 +1209,14 @@ LLColor3 LLSettingsSky::getLightTransmittance(F32 distance) const
return transmittance;
}
// SL-16127: getTotalDensity() and getDensityMultiplier() call LLSettingsSky::getColor() and LLSettingsSky::getFloat() respectively which are S-L-O-W
LLColor3 LLSettingsSky::getLightTransmittanceFast( const LLColor3& total_density, const F32 density_multiplier, const F32 distance ) const
{
// Transparency (-> density) from Beer's law
LLColor3 transmittance = componentExp(total_density * -(density_multiplier * distance));
return transmittance;
}
// performs soft scale clip and gamma correction ala the shader implementation
// scales colors down to 0 - 1 range preserving relative ratios
LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const
......
......@@ -252,6 +252,7 @@ class LLSettingsSky: public LLSettingsBase
LLColor3 getLightAttenuation(F32 distance) const;
LLColor3 getLightTransmittance(F32 distance) const;
LLColor3 getLightTransmittanceFast(const LLColor3& total_density, const F32 density_multiplier, const F32 distance) const;
LLColor3 getTotalDensity() const;
LLColor3 gammaCorrect(const LLColor3& in) const;
......
......@@ -211,8 +211,8 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVecto
// This cubemap is used as "environmentMap" in indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny)
{
F32 sky_saturation = 0.25f;
F32 land_saturation = 0.1f;
const F32 sky_saturation = 0.25f;
const F32 land_saturation = 0.1f;
if (isShiny && dir.mV[VZ] < -0.02f)
{
......@@ -270,11 +270,12 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm
// indra\newview\lllegacyatmospherics.cpp
void LLAtmospherics::calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVector3 & Pn, AtmosphericsVars& vars)
{
LLColor3 blue_density = vars.blue_density;
LLColor3 blue_horizon = vars.blue_horizon;
F32 haze_horizon = vars.haze_horizon;
F32 haze_density = vars.haze_density;
F32 density_multiplier = vars.density_multiplier;
const LLColor3 blue_density = vars.blue_density;
const LLColor3 blue_horizon = vars.blue_horizon;
const F32 haze_horizon = vars.haze_horizon;
const F32 haze_density = vars.haze_density;
const F32 density_multiplier = vars.density_multiplier;
F32 max_y = vars.max_y;
LLVector4 sun_norm = vars.sun_norm;
......@@ -313,7 +314,7 @@ void LLAtmospherics::calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVect
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
LLColor3 light_atten = vars.light_atten;
LLColor3 light_transmittance = psky->getLightTransmittance(Plen);
LLColor3 light_transmittance = psky->getLightTransmittanceFast(vars.total_density, vars.density_multiplier, Plen);
(void)light_transmittance; // silence Clang warn-error
// Calculate relative weights
......
This diff is collapsed.
......@@ -214,12 +214,12 @@ class LLVOSky : public LLStaticViewerObject
// Initialize/delete data that's only inited once per class.
void init();
void initCubeMap();
void initEmpty();
void cleanupGL();
void restoreGL();
void calc();
void cacheEnvironment(LLSettingsSky::ptr_t psky, AtmosphericsVars& atmosphericsVars);
/*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
bool updateSky();
......@@ -253,8 +253,6 @@ class LLVOSky : public LLStaticViewerObject
LLColor4 getSkyFogColor() const { return m_legacyAtmospherics.getFogColor(); }
LLColor4 getGLFogColor() const { return m_legacyAtmospherics.getGLFogColor(); }
LLColor4U getFadeColor() const;
void setCloudDensity(F32 cloud_density) { mCloudDensity = cloud_density; }
void setWind ( const LLVector3& wind ) { mWind = wind.length(); }
......@@ -299,10 +297,10 @@ class LLVOSky : public LLStaticViewerObject
protected:
~LLVOSky();
void updateDirections(void);
void updateDirections(LLSettingsSky::ptr_t psky);
void initSkyTextureDirs(const S32 side, const S32 tile);
void createSkyTexture(AtmosphericsVars& vars, const S32 side, const S32 tile);
void createSkyTexture(LLSettingsSky::ptr_t psky, AtmosphericsVars& vars, const S32 side, const S32 tile);
LLPointer<LLViewerFetchedTexture> mSunTexturep[2];
LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment