SL-16127: Replace slow getLightTransmittance with faster version
parent
851767b808
commit
a172c9d9cf
|
|
@ -1206,6 +1206,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 @@ public:
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -313,7 +313,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
|
||||
|
|
|
|||
Loading…
Reference in New Issue