diff options
author | Aleric Inglewood <Aleric.Inglewood@gmail.com> | 2010-12-30 14:53:30 +0100 |
---|---|---|
committer | Aleric Inglewood <Aleric.Inglewood@gmail.com> | 2010-12-30 14:53:30 +0100 |
commit | 953104660944345c0531b2b2f49bfaf09348d44c (patch) | |
tree | ef5b993902a60edff931353b631466a8c3d3fe25 /indra/newview/llvosky.cpp | |
parent | e82fb8c7b90c0f5038c38a1aaf4882718433bfd6 (diff) |
STORM-955: VWR-24312: Massively duplicated objects
Turns out that most of my SNOW-800 patch was included in Viewer 2 (albeit without crediting me).
However, not everything was used and some more cleaning up was possible.
After this patch, and when compiling with optimization, there are no duplicates left
anymore that shouldn't be there in the first place. Apart from the debug stream
iostream guard variable, there are several static variables with the same name (r, r1,
r2, etc) but that indeed actually different symbol objects. Then there are a few
constant POD arrays that are duplicated a hand full of times because they are
accessed with a variable index (so optimizing them away is not possible). I left them
like that (although defining those as extern as well would have been more consistent
and not slower; in fact it would be faster theoretically because those arrays could
share the same cache page then).
Diffstat (limited to 'indra/newview/llvosky.cpp')
-rw-r--r-- | indra/newview/llvosky.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 7ae8c2c07d..80f43e51d2 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -77,9 +77,6 @@ static const LLVector2 TEX11 = LLVector2(1.f, 1.f); LLUUID gSunTextureID = IMG_SUN; LLUUID gMoonTextureID = IMG_MOON; -//static -LLColor3 LLHaze::sAirScaSeaLevel; - class LLFastLn { public: @@ -182,6 +179,23 @@ inline void color_gamma_correct(LLColor3 &col) } } +static LLColor3 calc_air_sca_sea_level() +{ + static LLColor3 WAVE_LEN(675, 520, 445); + static LLColor3 refr_ind = refr_ind_calc(WAVE_LEN); + static LLColor3 n21 = refr_ind * refr_ind - LLColor3(1, 1, 1); + static LLColor3 n4 = n21 * n21; + static LLColor3 wl2 = WAVE_LEN * WAVE_LEN * 1e-6f; + static LLColor3 wl4 = wl2 * wl2; + static LLColor3 mult_const = fsigma * 2.0f/ 3.0f * 1e24f * (F_PI * F_PI) * n4; + static F32 dens_div_N = F32( ATM_SEA_LEVEL_NDENS / Ndens2); + return dens_div_N * color_div ( mult_const, wl4 ); +} + +// static constants. +LLColor3 const LLHaze::sAirScaSeaLevel = calc_air_sca_sea_level(); +F32 const LLHaze::sAirScaIntense = color_intens(LLHaze::sAirScaSeaLevel); +F32 const LLHaze::sAirScaAvg = LLHaze::sAirScaIntense / 3.f; /*************************************** @@ -394,12 +408,6 @@ LLVOSky::~LLVOSky() mCubeMap = NULL; } -void LLVOSky::initClass() -{ - LLHaze::initClass(); -} - - void LLVOSky::init() { const F32 haze_int = color_intens(mHaze.calcSigSca(0)); @@ -2147,17 +2155,8 @@ void LLVOSky::updateFog(const F32 distance) stop_glerror(); } -// static -void LLHaze::initClass() -{ - sAirScaSeaLevel = LLHaze::calcAirScaSeaLevel(); -} - - // Functions used a lot. - - F32 color_norm_pow(LLColor3& col, F32 e, BOOL postmultiply) { F32 mv = color_max(col); |