summaryrefslogtreecommitdiff
path: root/indra/newview/llvosky.cpp
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-16 23:45:56 +0100
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-16 23:45:56 +0100
commit4d4a7dfb9f28007c2ceb53668d065bbe0fa332af (patch)
tree9c9929e754fa8f6d0ad6c8fdc15c0fa494dbd0b6 /indra/newview/llvosky.cpp
parent3116416fcb8dfd54ef2807e9e75959429c946d79 (diff)
parent67a16cad8ab5c928f34b4299eae5499b59c3aa83 (diff)
Merge and disable new sky render.
Diffstat (limited to 'indra/newview/llvosky.cpp')
-rw-r--r--indra/newview/llvosky.cpp160
1 files changed, 81 insertions, 79 deletions
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 125dbce24c..a64df57d0b 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -53,6 +53,8 @@
#include "llsettingssky.h"
#include "llenvironment.h"
+#pragma optimize("", off)
+
#undef min
#undef max
@@ -96,17 +98,17 @@ F32 clip_side_to_horizon(const LLVector3& V0, const LLVector3& V1, const F32 cos
if (z1 * cos_max_angle < 0)
{
return t2;
- }
+ }
else if (z2 * cos_max_angle < 0)
- {
+ {
return t1;
- }
+ }
else if ((t1 < 0) || (t1 > 1))
- {
+ {
return t2;
- }
- else
- {
+ }
+ else
+ {
return t1;
}
}
@@ -129,9 +131,9 @@ BOOL clip_quad_to_horizon(F32& t_left, F32& t_right, LLVector3 v_clipped[4],
//if (!left_clip && !right_clip)
{
for (S32 vtx = 0; vtx < 4; ++vtx)
- {
+ {
v_clipped[vtx] = v_corner[vtx];
- }
+ }
}
/* else
{
@@ -322,7 +324,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mHeavenlyBodyUpdated = FALSE ;
mDrawRefl = 0;
- mInterpVal = 0.f;
+ mInterpVal = 0.f;
}
@@ -555,85 +557,85 @@ BOOL LLVOSky::updateSky()
if (mForceUpdate || total_no_tiles == frame)
{
- LLSkyTex::stepCurrent();
+ LLSkyTex::stepCurrent();
- const static F32 LIGHT_DIRECTION_THRESHOLD = (F32) cos(DEG_TO_RAD * 1.f);
- const static F32 COLOR_CHANGE_THRESHOLD = 0.01f;
-
- LLVector3 direction = mSun.getDirection();
- direction.normalize();
- const F32 dot_lighting = direction * mLastLightingDirection;
-
- LLColor3 delta_color;
- delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0],
- mLastTotalAmbient.mV[1] - total_ambient.mV[1],
- mLastTotalAmbient.mV[2] - total_ambient.mV[2]);
-
- if ( mForceUpdate
- || (((dot_lighting < LIGHT_DIRECTION_THRESHOLD)
- || (delta_color.length() > COLOR_CHANGE_THRESHOLD)
- || !mInitialized)
- && !direction.isExactlyZero()))
- {
- mLastLightingDirection = direction;
+ const static F32 LIGHT_DIRECTION_THRESHOLD = (F32) cos(DEG_TO_RAD * 1.f);
+ const static F32 COLOR_CHANGE_THRESHOLD = 0.01f;
+
+ LLVector3 direction = mSun.getDirection();
+ direction.normalize();
+ const F32 dot_lighting = direction * mLastLightingDirection;
+
+ LLColor3 delta_color;
+ delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0],
+ mLastTotalAmbient.mV[1] - total_ambient.mV[1],
+ mLastTotalAmbient.mV[2] - total_ambient.mV[2]);
+
+ if ( mForceUpdate
+ || (((dot_lighting < LIGHT_DIRECTION_THRESHOLD)
+ || (delta_color.length() > COLOR_CHANGE_THRESHOLD)
+ || !mInitialized)
+ && !direction.isExactlyZero()))
+ {
+ mLastLightingDirection = direction;
mLastTotalAmbient = total_ambient;
- mInitialized = TRUE;
+ mInitialized = TRUE;
- if (mCubeMap)
- {
+ if (mCubeMap)
+ {
if (mForceUpdate)
- {
- updateFog(LLViewerCamera::getInstance()->getFar());
-
- for (int side = 0; side < 6; side++)
- {
- for (int tile = 0; tile < NUM_TILES; tile++)
- {
- createSkyTexture(side, tile);
- }
- }
-
- for (int side = 0; side < 6; side++)
- {
- LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE);
- LLImageRaw* raw2 = mSkyTex[side].getImageRaw(FALSE);
- raw2->copy(raw1);
- mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE));
-
- raw1 = mShinyTex[side].getImageRaw(TRUE);
- raw2 = mShinyTex[side].getImageRaw(FALSE);
- raw2->copy(raw1);
- mShinyTex[side].createGLImage(mShinyTex[side].getWhich(FALSE));
- }
- next_frame = 0;
-
- // update the sky texture
- for (S32 i = 0; i < 6; ++i)
- {
- mSkyTex[i].create(1.0f);
- mShinyTex[i].create(1.0f);
- }
-
- // update the environment map
- if (mCubeMap)
- {
- std::vector<LLPointer<LLImageRaw> > images;
- images.reserve(6);
- for (S32 side = 0; side < 6; side++)
- {
- images.push_back(mShinyTex[side].getImageRaw(TRUE));
- }
- mCubeMap->init(images);
+ {
+ updateFog(LLViewerCamera::getInstance()->getFar());
+
+ for (int side = 0; side < 6; side++)
+ {
+ for (int tile = 0; tile < NUM_TILES; tile++)
+ {
+ createSkyTexture(side, tile);
+ }
+ }
+
+ for (int side = 0; side < 6; side++)
+ {
+ LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE);
+ LLImageRaw* raw2 = mSkyTex[side].getImageRaw(FALSE);
+ raw2->copy(raw1);
+ mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE));
+
+ raw1 = mShinyTex[side].getImageRaw(TRUE);
+ raw2 = mShinyTex[side].getImageRaw(FALSE);
+ raw2->copy(raw1);
+ mShinyTex[side].createGLImage(mShinyTex[side].getWhich(FALSE));
+ }
+ next_frame = 0;
+
+ // update the sky texture
+ for (S32 i = 0; i < 6; ++i)
+ {
+ mSkyTex[i].create(1.0f);
+ mShinyTex[i].create(1.0f);
+ }
+
+ // update the environment map
+ if (mCubeMap)
+ {
+ std::vector<LLPointer<LLImageRaw> > images;
+ images.reserve(6);
+ for (S32 side = 0; side < 6; side++)
+ {
+ images.push_back(mShinyTex[side].getImageRaw(TRUE));
+ }
+ mCubeMap->init(images);
gGL.getTexUnit(0)->disable();
}
}
}
}
- gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
- mForceUpdate = FALSE;
- }
- }
+ gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
+ mForceUpdate = FALSE;
+ }
+ }
if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer())
{