diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llvosky.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/llvosky.cpp')
-rw-r--r-- | linden/indra/newview/llvosky.cpp | 186 |
1 files changed, 106 insertions, 80 deletions
diff --git a/linden/indra/newview/llvosky.cpp b/linden/indra/newview/llvosky.cpp index 559e846..4ed5353 100644 --- a/linden/indra/newview/llvosky.cpp +++ b/linden/indra/newview/llvosky.cpp | |||
@@ -440,7 +440,7 @@ void LLSkyTex::initEmpty(const S32 tex) | |||
440 | } | 440 | } |
441 | } | 441 | } |
442 | 442 | ||
443 | createTexture(tex); | 443 | createGLImage(tex); |
444 | } | 444 | } |
445 | 445 | ||
446 | 446 | ||
@@ -467,10 +467,10 @@ void LLSkyTex::create(const F32 brightness_scale, const LLColor3& multiscatt) | |||
467 | *pix = temp1.mAll; | 467 | *pix = temp1.mAll; |
468 | } | 468 | } |
469 | } | 469 | } |
470 | createTexture(sCurrent); | 470 | createGLImage(sCurrent); |
471 | } | 471 | } |
472 | 472 | ||
473 | void LLSkyTex::createTexture(S32 which) | 473 | void LLSkyTex::createGLImage(S32 which) |
474 | { | 474 | { |
475 | mImageGL[which]->createGLTexture(0, mImageRaw[which]); | 475 | mImageGL[which]->createGLTexture(0, mImageRaw[which]); |
476 | mImageGL[which]->setClamp(TRUE, TRUE); | 476 | mImageGL[which]->setClamp(TRUE, TRUE); |
@@ -494,7 +494,7 @@ S32 LLVOSky::sTileResX = sResolution/NUM_TILES_X; | |||
494 | S32 LLVOSky::sTileResY = sResolution/NUM_TILES_Y; | 494 | S32 LLVOSky::sTileResY = sResolution/NUM_TILES_Y; |
495 | 495 | ||
496 | LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) | 496 | LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) |
497 | : LLViewerObject(id, pcode, regionp), | 497 | : LLStaticViewerObject(id, pcode, regionp), |
498 | mSun(SUN_DISK_RADIUS), mMoon(MOON_DISK_RADIUS), | 498 | mSun(SUN_DISK_RADIUS), mMoon(MOON_DISK_RADIUS), |
499 | mBrightnessScale(1.f), | 499 | mBrightnessScale(1.f), |
500 | mBrightnessScaleNew(0.f), | 500 | mBrightnessScaleNew(0.f), |
@@ -1054,11 +1054,9 @@ void LLVOSky::calcBrightnessScaleAndColors() | |||
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | calculateColors(); // MSMSM Moved this down here per Milo Lindens suggestion, to fix orange flashing bug at sunset. | 1056 | calculateColors(); // MSMSM Moved this down here per Milo Lindens suggestion, to fix orange flashing bug at sunset. |
1057 | generateScatterMap(); | ||
1058 | } | 1057 | } |
1059 | 1058 | ||
1060 | 1059 | ||
1061 | |||
1062 | void LLVOSky::calculateColors() | 1060 | void LLVOSky::calculateColors() |
1063 | { | 1061 | { |
1064 | const F32 h = -0.1f; | 1062 | const F32 h = -0.1f; |
@@ -1068,14 +1066,13 @@ void LLVOSky::calculateColors() | |||
1068 | F32 sun_factor = 1; | 1066 | F32 sun_factor = 1; |
1069 | 1067 | ||
1070 | // Sun Diffuse | 1068 | // Sun Diffuse |
1071 | if (calcHitsEarth(mCameraPosAgent, tosun) < 0) | 1069 | F32 sun_height = tosun.mV[2]; |
1072 | { | 1070 | |
1073 | mSunDiffuse = mBrightnessScaleGuess * mSun.getIntensity() * mTransp.calcTransp(tosun.mV[2], h); | 1071 | if (sun_height <= 0.0) |
1074 | } | 1072 | sun_height = 0.0; |
1075 | else | 1073 | |
1076 | { | 1074 | mSunDiffuse = mBrightnessScaleGuess * mSun.getIntensity() * mTransp.calcTransp(sun_height, h); |
1077 | mSunDiffuse = mBrightnessScaleGuess * mSun.getIntensity() * mTransp.calcTransp(0, h); | 1075 | |
1078 | } | ||
1079 | mSunDiffuse = 1.0f * color_norm(mSunDiffuse); | 1076 | mSunDiffuse = 1.0f * color_norm(mSunDiffuse); |
1080 | 1077 | ||
1081 | // Sun Ambient | 1078 | // Sun Ambient |
@@ -1188,8 +1185,6 @@ BOOL LLVOSky::updateSky() | |||
1188 | return TRUE; | 1185 | return TRUE; |
1189 | } | 1186 | } |
1190 | 1187 | ||
1191 | setPositionAgent(gAgent.getCameraPositionAgent()); | ||
1192 | |||
1193 | static S32 next_frame = 0; | 1188 | static S32 next_frame = 0; |
1194 | const S32 total_no_tiles = 6 * NUM_TILES; | 1189 | const S32 total_no_tiles = 6 * NUM_TILES; |
1195 | const S32 cycle_frame_no = total_no_tiles + 1; | 1190 | const S32 cycle_frame_no = total_no_tiles + 1; |
@@ -1253,21 +1248,27 @@ BOOL LLVOSky::updateSky() | |||
1253 | LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE); | 1248 | LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE); |
1254 | LLImageRaw* raw2 = mSkyTex[side].getImageRaw(FALSE); | 1249 | LLImageRaw* raw2 = mSkyTex[side].getImageRaw(FALSE); |
1255 | raw2->copy(raw1); | 1250 | raw2->copy(raw1); |
1256 | mSkyTex[side].createTexture(mSkyTex[side].getWhich(FALSE)); | 1251 | mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE)); |
1257 | } | 1252 | } |
1258 | next_frame = 0; | 1253 | next_frame = 0; |
1259 | //llSkyTex::stepCurrent(); | 1254 | //llSkyTex::stepCurrent(); |
1260 | } | 1255 | } |
1261 | 1256 | ||
1262 | std::vector<LLPointer<LLImageRaw> > images; | 1257 | if (!gSavedSettings.getBOOL("RenderDynamicReflections")) |
1263 | for (S32 side = 0; side < 6; side++) | ||
1264 | { | 1258 | { |
1265 | images.push_back(mSkyTex[side].getImageRaw(FALSE)); | 1259 | std::vector<LLPointer<LLImageRaw> > images; |
1260 | for (S32 side = 0; side < 6; side++) | ||
1261 | { | ||
1262 | images.push_back(mSkyTex[side].getImageRaw(FALSE)); | ||
1263 | } | ||
1264 | mCubeMap->init(images); | ||
1266 | } | 1265 | } |
1267 | mCubeMap->init(images); | ||
1268 | } | 1266 | } |
1269 | } | 1267 | } |
1270 | 1268 | ||
1269 | gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); | ||
1270 | gPipeline.markRebuild(gSky.mVOStarsp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); | ||
1271 | |||
1271 | mForceUpdate = FALSE; | 1272 | mForceUpdate = FALSE; |
1272 | } | 1273 | } |
1273 | else | 1274 | else |
@@ -1306,7 +1307,8 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline) | |||
1306 | poolp->setSkyTex(mSkyTex); | 1307 | poolp->setSkyTex(mSkyTex); |
1307 | poolp->setSun(&mSun); | 1308 | poolp->setSun(&mSun); |
1308 | poolp->setMoon(&mMoon); | 1309 | poolp->setMoon(&mMoon); |
1309 | 1310 | mDrawable->setRenderType(LLPipeline::RENDER_TYPE_SKY); | |
1311 | |||
1310 | for (S32 i = 0; i < 6; ++i) | 1312 | for (S32 i = 0; i < 6; ++i) |
1311 | { | 1313 | { |
1312 | mFace[FACE_SIDE0 + i] = mDrawable->addFace(poolp, NULL); | 1314 | mFace[FACE_SIDE0 + i] = mDrawable->addFace(poolp, NULL); |
@@ -1316,9 +1318,6 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline) | |||
1316 | mFace[FACE_MOON] = mDrawable->addFace(poolp, mMoonTexturep); | 1318 | mFace[FACE_MOON] = mDrawable->addFace(poolp, mMoonTexturep); |
1317 | mFace[FACE_BLOOM] = mDrawable->addFace(poolp, mBloomTexturep); | 1319 | mFace[FACE_BLOOM] = mDrawable->addFace(poolp, mBloomTexturep); |
1318 | 1320 | ||
1319 | //mDrawable->addFace(poolp, LLViewerImage::sDefaultImagep); | ||
1320 | gPipeline.markMaterialed(mDrawable); | ||
1321 | |||
1322 | return mDrawable; | 1321 | return mDrawable; |
1323 | } | 1322 | } |
1324 | 1323 | ||
@@ -1326,70 +1325,74 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) | |||
1326 | { | 1325 | { |
1327 | if (mFace[FACE_REFLECTION] == NULL) | 1326 | if (mFace[FACE_REFLECTION] == NULL) |
1328 | { | 1327 | { |
1329 | mFace[FACE_REFLECTION] = drawable->addFace(gPipeline.getPool(LLDrawPool::POOL_WATER), NULL); | 1328 | LLDrawPoolWater *poolp = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER); |
1329 | mFace[FACE_REFLECTION] = drawable->addFace(poolp, NULL); | ||
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | mCameraPosAgent = drawable->getPositionAgent(); | 1332 | mCameraPosAgent = drawable->getPositionAgent(); |
1333 | mEarthCenter.mV[0] = mCameraPosAgent.mV[0]; | 1333 | mEarthCenter.mV[0] = mCameraPosAgent.mV[0]; |
1334 | mEarthCenter.mV[1] = mCameraPosAgent.mV[1]; | 1334 | mEarthCenter.mV[1] = mCameraPosAgent.mV[1]; |
1335 | 1335 | ||
1336 | |||
1337 | LLVector3 v_agent[8]; | 1336 | LLVector3 v_agent[8]; |
1338 | for (S32 i = 0; i < 8; ++i) | 1337 | for (S32 i = 0; i < 8; ++i) |
1339 | { | 1338 | { |
1340 | F32 x_sgn = (i&1) ? 1.f : -1.f; | 1339 | F32 x_sgn = (i&1) ? 1.f : -1.f; |
1341 | F32 y_sgn = (i&2) ? 1.f : -1.f; | 1340 | F32 y_sgn = (i&2) ? 1.f : -1.f; |
1342 | F32 z_sgn = (i&4) ? 1.f : -1.f; | 1341 | F32 z_sgn = (i&4) ? 1.f : -1.f; |
1343 | v_agent[i] = mCameraPosAgent + HORIZON_DIST * LLVector3(x_sgn, y_sgn, z_sgn); | 1342 | v_agent[i] = HORIZON_DIST*0.25f * LLVector3(x_sgn, y_sgn, z_sgn); |
1344 | } | 1343 | } |
1345 | 1344 | ||
1346 | LLStrider<LLVector3> verticesp; | 1345 | LLStrider<LLVector3> verticesp; |
1347 | LLStrider<LLVector3> normalsp; | 1346 | LLStrider<LLVector3> normalsp; |
1348 | LLStrider<LLVector2> texCoordsp; | 1347 | LLStrider<LLVector2> texCoordsp; |
1349 | U32 *indicesp; | 1348 | LLStrider<U32> indicesp; |
1350 | S32 index_offset; | 1349 | S32 index_offset; |
1351 | LLFace *face; | 1350 | LLFace *face; |
1352 | 1351 | ||
1353 | for (S32 side = 0; side < 6; ++side) | 1352 | for (S32 side = 0; side < 6; ++side) |
1354 | { | 1353 | { |
1355 | face = mFace[FACE_SIDE0 + side]; | 1354 | face = mFace[FACE_SIDE0 + side]; |
1356 | face->setPrimType(LLTriangles); | 1355 | |
1357 | face->setSize(4, 6); | 1356 | if (face->mVertexBuffer.isNull()) |
1358 | index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); | ||
1359 | if (-1 == index_offset) | ||
1360 | { | 1357 | { |
1361 | return TRUE; | 1358 | face->setSize(4, 6); |
1359 | face->setGeomIndex(0); | ||
1360 | face->setIndicesIndex(0); | ||
1361 | face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); | ||
1362 | face->mVertexBuffer->allocateBuffer(4, 6, TRUE); | ||
1363 | |||
1364 | index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); | ||
1365 | |||
1366 | S32 vtx = 0; | ||
1367 | S32 curr_bit = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X | ||
1368 | S32 side_dir = side & 1; // even - 0, odd - 1 | ||
1369 | S32 i_bit = (curr_bit + 2) % 3; | ||
1370 | S32 j_bit = (i_bit + 2) % 3; | ||
1371 | |||
1372 | LLVector3 axis; | ||
1373 | axis.mV[curr_bit] = 1; | ||
1374 | face->mCenterAgent = (F32)((side_dir << 1) - 1) * axis * HORIZON_DIST; | ||
1375 | |||
1376 | vtx = side_dir << curr_bit; | ||
1377 | *(verticesp++) = v_agent[vtx]; | ||
1378 | *(verticesp++) = v_agent[vtx | 1 << j_bit]; | ||
1379 | *(verticesp++) = v_agent[vtx | 1 << i_bit]; | ||
1380 | *(verticesp++) = v_agent[vtx | 1 << i_bit | 1 << j_bit]; | ||
1381 | |||
1382 | *(texCoordsp++) = TEX00; | ||
1383 | *(texCoordsp++) = TEX01; | ||
1384 | *(texCoordsp++) = TEX10; | ||
1385 | *(texCoordsp++) = TEX11; | ||
1386 | |||
1387 | // Triangles for each side | ||
1388 | *indicesp++ = index_offset + 0; | ||
1389 | *indicesp++ = index_offset + 1; | ||
1390 | *indicesp++ = index_offset + 3; | ||
1391 | |||
1392 | *indicesp++ = index_offset + 0; | ||
1393 | *indicesp++ = index_offset + 3; | ||
1394 | *indicesp++ = index_offset + 2; | ||
1362 | } | 1395 | } |
1363 | |||
1364 | S32 vtx = 0; | ||
1365 | S32 curr_bit = side >> 1; // 0/1 = Z axis, 2/3 = Y, 4/5 = X | ||
1366 | S32 side_dir = side & 1; // even - 0, odd - 1 | ||
1367 | S32 i_bit = (curr_bit + 2) % 3; | ||
1368 | S32 j_bit = (i_bit + 2) % 3; | ||
1369 | |||
1370 | LLVector3 axis; | ||
1371 | axis.mV[curr_bit] = 1; | ||
1372 | face->mCenterAgent = mCameraPosAgent + (F32)((side_dir << 1) - 1) * axis * HORIZON_DIST; | ||
1373 | |||
1374 | vtx = side_dir << curr_bit; | ||
1375 | *(verticesp++) = v_agent[vtx]; | ||
1376 | *(verticesp++) = v_agent[vtx | 1 << j_bit]; | ||
1377 | *(verticesp++) = v_agent[vtx | 1 << i_bit]; | ||
1378 | *(verticesp++) = v_agent[vtx | 1 << i_bit | 1 << j_bit]; | ||
1379 | |||
1380 | *(texCoordsp++) = TEX00; | ||
1381 | *(texCoordsp++) = TEX01; | ||
1382 | *(texCoordsp++) = TEX10; | ||
1383 | *(texCoordsp++) = TEX11; | ||
1384 | |||
1385 | // Triangles for each side | ||
1386 | *indicesp++ = index_offset + 0; | ||
1387 | *indicesp++ = index_offset + 1; | ||
1388 | *indicesp++ = index_offset + 3; | ||
1389 | |||
1390 | *indicesp++ = index_offset + 0; | ||
1391 | *indicesp++ = index_offset + 3; | ||
1392 | *indicesp++ = index_offset + 2; | ||
1393 | } | 1396 | } |
1394 | 1397 | ||
1395 | const LLVector3 &look_at = gCamera->getAtAxis(); | 1398 | const LLVector3 &look_at = gCamera->getAtAxis(); |
@@ -1464,7 +1467,7 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons | |||
1464 | LLStrider<LLVector3> verticesp; | 1467 | LLStrider<LLVector3> verticesp; |
1465 | LLStrider<LLVector3> normalsp; | 1468 | LLStrider<LLVector3> normalsp; |
1466 | LLStrider<LLVector2> texCoordsp; | 1469 | LLStrider<LLVector2> texCoordsp; |
1467 | U32 *indicesp; | 1470 | LLStrider<U32> indicesp; |
1468 | S32 index_offset; | 1471 | S32 index_offset; |
1469 | LLFace *facep; | 1472 | LLFace *facep; |
1470 | 1473 | ||
@@ -1512,8 +1515,16 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons | |||
1512 | hb.setVisible(TRUE); | 1515 | hb.setVisible(TRUE); |
1513 | 1516 | ||
1514 | facep = mFace[f]; | 1517 | facep = mFace[f]; |
1515 | facep->setPrimType(LLTriangles); | 1518 | |
1516 | facep->setSize(4, 6); | 1519 | if (facep->mVertexBuffer.isNull()) |
1520 | { | ||
1521 | facep->setSize(4, 6); | ||
1522 | facep->mVertexBuffer = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); | ||
1523 | facep->mVertexBuffer->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount(), TRUE); | ||
1524 | facep->setGeomIndex(0); | ||
1525 | facep->setIndicesIndex(0); | ||
1526 | } | ||
1527 | |||
1517 | index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp); | 1528 | index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp); |
1518 | if (-1 == index_offset) | 1529 | if (-1 == index_offset) |
1519 | { | 1530 | { |
@@ -1642,7 +1653,7 @@ void LLVOSky::updateSunHaloGeometry(LLDrawable *drawable ) | |||
1642 | LLStrider<LLVector3> verticesp; | 1653 | LLStrider<LLVector3> verticesp; |
1643 | LLStrider<LLVector3> normalsp; | 1654 | LLStrider<LLVector3> normalsp; |
1644 | LLStrider<LLVector2> texCoordsp; | 1655 | LLStrider<LLVector2> texCoordsp; |
1645 | U32 *indicesp; | 1656 | LLStrider<U32> indicesp; |
1646 | S32 index_offset; | 1657 | S32 index_offset; |
1647 | LLFace *face; | 1658 | LLFace *face; |
1648 | 1659 | ||
@@ -1661,8 +1672,16 @@ void LLVOSky::updateSunHaloGeometry(LLDrawable *drawable ) | |||
1661 | v_glow_corner[3] = draw_pos + right - up; | 1672 | v_glow_corner[3] = draw_pos + right - up; |
1662 | 1673 | ||
1663 | face = mFace[FACE_BLOOM]; | 1674 | face = mFace[FACE_BLOOM]; |
1664 | face->setPrimType(LLTriangles); | 1675 | |
1665 | face->setSize(4, 6); | 1676 | if (face->mVertexBuffer.isNull()) |
1677 | { | ||
1678 | face->setSize(4, 6); | ||
1679 | face->setGeomIndex(0); | ||
1680 | face->setIndicesIndex(0); | ||
1681 | face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); | ||
1682 | face->mVertexBuffer->allocateBuffer(4, 6, TRUE); | ||
1683 | } | ||
1684 | |||
1666 | index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); | 1685 | index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); |
1667 | if (-1 == index_offset) | 1686 | if (-1 == index_offset) |
1668 | { | 1687 | { |
@@ -1896,15 +1915,23 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, | |||
1896 | dt_clip = -0.1f; | 1915 | dt_clip = -0.1f; |
1897 | } | 1916 | } |
1898 | 1917 | ||
1918 | LLFace *face = mFace[FACE_REFLECTION]; | ||
1919 | |||
1920 | if (face->mVertexBuffer.isNull() || quads*4 != face->getGeomCount()) | ||
1921 | { | ||
1922 | face->setSize(quads * 4, quads * 6); | ||
1923 | face->mVertexBuffer = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB); | ||
1924 | face->mVertexBuffer->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE); | ||
1925 | face->setIndicesIndex(0); | ||
1926 | face->setGeomIndex(0); | ||
1927 | } | ||
1928 | |||
1899 | LLStrider<LLVector3> verticesp; | 1929 | LLStrider<LLVector3> verticesp; |
1900 | LLStrider<LLVector3> normalsp; | 1930 | LLStrider<LLVector3> normalsp; |
1901 | LLStrider<LLVector2> texCoordsp; | 1931 | LLStrider<LLVector2> texCoordsp; |
1902 | U32 *indicesp; | 1932 | LLStrider<U32> indicesp; |
1903 | S32 index_offset; | 1933 | S32 index_offset; |
1904 | LLFace *face = mFace[FACE_REFLECTION]; | 1934 | |
1905 | |||
1906 | face->setPrimType(LLTriangles); | ||
1907 | face->setSize(quads * 4, quads * 6); | ||
1908 | index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); | 1935 | index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp); |
1909 | if (-1 == index_offset) | 1936 | if (-1 == index_offset) |
1910 | { | 1937 | { |
@@ -2132,16 +2159,14 @@ void LLVOSky::updateFog(const F32 distance) | |||
2132 | 2159 | ||
2133 | color_gamma_correct(sky_fog_color); | 2160 | color_gamma_correct(sky_fog_color); |
2134 | 2161 | ||
2135 | if (!(gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT) > LLDrawPool::SHADER_LEVEL_SCATTERING)) | 2162 | render_fog_color = sky_fog_color; |
2136 | { | 2163 | |
2137 | render_fog_color = sky_fog_color; | ||
2138 | } | ||
2139 | |||
2140 | if (camera_height > water_height) | 2164 | if (camera_height > water_height) |
2141 | { | 2165 | { |
2142 | fog_distance = mFogRatio * distance; | 2166 | fog_distance = mFogRatio * distance; |
2143 | LLColor4 fog(render_fog_color); | 2167 | LLColor4 fog(render_fog_color); |
2144 | glFogfv(GL_FOG_COLOR, fog.mV); | 2168 | glFogfv(GL_FOG_COLOR, fog.mV); |
2169 | mGLFogCol = fog; | ||
2145 | } | 2170 | } |
2146 | else | 2171 | else |
2147 | { | 2172 | { |
@@ -2161,6 +2186,7 @@ void LLVOSky::updateFog(const F32 distance) | |||
2161 | LLColor4 fogCol = brightness * (color_frac * render_fog_color + (1.f - color_frac) * LLColor4(0.f, 0.2f, 0.3f, 1.f)); | 2186 | LLColor4 fogCol = brightness * (color_frac * render_fog_color + (1.f - color_frac) * LLColor4(0.f, 0.2f, 0.3f, 1.f)); |
2162 | fogCol.setAlpha(1); | 2187 | fogCol.setAlpha(1); |
2163 | glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV); | 2188 | glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV); |
2189 | mGLFogCol = fogCol; | ||
2164 | } | 2190 | } |
2165 | 2191 | ||
2166 | mFogColor = sky_fog_color; | 2192 | mFogColor = sky_fog_color; |