aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvosky.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvosky.cpp')
-rw-r--r--linden/indra/newview/llvosky.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/linden/indra/newview/llvosky.cpp b/linden/indra/newview/llvosky.cpp
index 4ed5353..68fee1a 100644
--- a/linden/indra/newview/llvosky.cpp
+++ b/linden/indra/newview/llvosky.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -188,7 +189,7 @@ inline F32 color_intens ( const LLColor4 &col )
188 189
189inline F32 color_avg ( const LLColor3 &col ) 190inline F32 color_avg ( const LLColor3 &col )
190{ 191{
191 return color_intens(col) / 3; 192 return color_intens(col) / 3.f;
192} 193}
193 194
194inline void color_gamma_correct(LLColor3 &col) 195inline void color_gamma_correct(LLColor3 &col)
@@ -462,7 +463,7 @@ void LLSkyTex::create(const F32 brightness_scale, const LLColor3& multiscatt)
462 } 463 }
463 464
464 U32* pix = (U32*)(data + offset); 465 U32* pix = (U32*)(data + offset);
465 LLColor4 temp = LLColor4(col); 466 LLColor4 temp = LLColor4(col, 0);
466 LLColor4U temp1 = LLColor4U(temp); 467 LLColor4U temp1 = LLColor4U(temp);
467 *pix = temp1.mAll; 468 *pix = temp1.mAll;
468 } 469 }
@@ -636,7 +637,6 @@ void LLVOSky::restoreGL()
636 637
637 calcBrightnessScaleAndColors(); 638 calcBrightnessScaleAndColors();
638 639
639 // Water is currently broken on Mac.
640 if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap) 640 if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap)
641 { 641 {
642 LLCubeMap* cube_map = getCubeMap(); 642 LLCubeMap* cube_map = getCubeMap();
@@ -776,7 +776,7 @@ LLColor3 LLVOSky::calcSkyColorInDir(const LLVector3 &dir)
776{ 776{
777 LLColor3 col, transp; 777 LLColor3 col, transp;
778 778
779 if (dir.mV[VZ] < -0.02) 779 if (dir.mV[VZ] < -0.02f)
780 { 780 {
781 col = LLColor3(llmax(mFogColor[0],0.2f), llmax(mFogColor[1],0.2f), llmax(mFogColor[2],0.27f)); 781 col = LLColor3(llmax(mFogColor[0],0.2f), llmax(mFogColor[1],0.2f), llmax(mFogColor[2],0.27f));
782 float x = 1.0f-fabsf(-0.1f-dir.mV[VZ]); 782 float x = 1.0f-fabsf(-0.1f-dir.mV[VZ]);
@@ -826,15 +826,18 @@ void LLVOSky::calcSkyColorInDir(LLColor3& res, LLColor3& transp, const LLVector3
826 const F32 e_pow_k = (F32)LL_FAST_EXP(K); 826 const F32 e_pow_k = (F32)LL_FAST_EXP(K);
827 F32 step = FIRST_STEP * (1 - 1 / e_pow_k); 827 F32 step = FIRST_STEP * (1 - 1 / e_pow_k);
828 828
829 // Initialize outside the loop because we write into them every iteration. JC
830 LLColor3 air_sca_opt_depth;
831 LLColor3 haze_sca_opt_depth;
832 LLColor3 air_transp;
833
829 for (S32 s = 0; s < NO_STEPS; ++s) 834 for (S32 s = 0; s < NO_STEPS; ++s)
830 { 835 {
831 h = calcHeight(cur_pos); 836 h = calcHeight(cur_pos);
832 step *= e_pow_k; 837 step *= e_pow_k;
833 LLColor3 air_sca_opt_depth;
834 LLHaze::calcAirSca(h, air_sca_opt_depth); 838 LLHaze::calcAirSca(h, air_sca_opt_depth);
835 air_sca_opt_depth *= step; 839 air_sca_opt_depth *= step;
836 840
837 LLColor3 haze_sca_opt_depth;
838 mHaze.calcSigSca(h, haze_sca_opt_depth); 841 mHaze.calcSigSca(h, haze_sca_opt_depth);
839 haze_sca_opt_depth *= step; 842 haze_sca_opt_depth *= step;
840 843
@@ -844,7 +847,6 @@ void LLVOSky::calcSkyColorInDir(LLColor3& res, LLColor3& transp, const LLVector3
844 if (calcHitsEarth(cur_pos, tosun) < 0) // calculates amount of in-scattered light from the sun 847 if (calcHitsEarth(cur_pos, tosun) < 0) // calculates amount of in-scattered light from the sun
845 { 848 {
846 //visibility check is too expensive 849 //visibility check is too expensive
847 LLColor3 air_transp;
848 mTransp.calcTransp(calcUpVec(cur_pos) * tosun, h, air_transp); 850 mTransp.calcTransp(calcUpVec(cur_pos) * tosun, h, air_transp);
849 air_transp *= transp; 851 air_transp *= transp;
850 res += air_sca_opt_depth * air_transp; 852 res += air_sca_opt_depth * air_transp;
@@ -1251,18 +1253,14 @@ BOOL LLVOSky::updateSky()
1251 mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE)); 1253 mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE));
1252 } 1254 }
1253 next_frame = 0; 1255 next_frame = 0;
1254 //llSkyTex::stepCurrent();
1255 } 1256 }
1256 1257
1257 if (!gSavedSettings.getBOOL("RenderDynamicReflections")) 1258 std::vector<LLPointer<LLImageRaw> > images;
1259 for (S32 side = 0; side < 6; side++)
1258 { 1260 {
1259 std::vector<LLPointer<LLImageRaw> > images; 1261 images.push_back(mSkyTex[side].getImageRaw(FALSE));
1260 for (S32 side = 0; side < 6; side++)
1261 {
1262 images.push_back(mSkyTex[side].getImageRaw(FALSE));
1263 }
1264 mCubeMap->init(images);
1265 } 1262 }
1263 mCubeMap->init(images);
1266 } 1264 }
1267 } 1265 }
1268 1266