summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldrawpoolwater.cpp6
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp13
-rw-r--r--indra/newview/llenvironment.cpp3
-rw-r--r--indra/newview/llenvironment.h1
-rw-r--r--indra/newview/llsky.cpp8
-rw-r--r--indra/newview/llsky.h3
-rw-r--r--indra/newview/llviewershadermgr.cpp8
-rw-r--r--indra/newview/llvosky.cpp25
-rw-r--r--indra/newview/pipeline.cpp8
9 files changed, 36 insertions, 39 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index bdf04bd436..2804ad1f46 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -491,6 +491,8 @@ void LLDrawPoolWater::shade()
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
light_dir = voskyp->getLightDirection();
+ light_dir.normalize();
+
if (LLEnvironment::instance().getIsDayTime())
{
light_color = voskyp->getSunAmbientColor();
@@ -501,14 +503,14 @@ void LLDrawPoolWater::shade()
}
else
{
- light_color = voskyp->getMoonAmbientColor();
+ light_color = voskyp->getMoonDiffuseColor();
light_diffuse = voskyp->getMoonDiffuseColor();
light_diffuse.normalize();
light_diffuse *= 0.5f;
light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f);
}
-// if (gSky.getSunDirection().mV[2] > LLSky::NIGHTTIME_ELEVATION_COS)
+// if (gSky.getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS)
// {
// light_dir = gSky.getSunDirection();
// light_dir.normVec();
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 91bfc3858c..277f1f3d6c 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -329,15 +329,12 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
gGL.getTexUnit(0)->bind(face->getTexture());
LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor());
-#if 0
- F32 a = gSky.mVOSkyp->getMoon().getDirection().mV[2];
+ /*F32 a = gSky.mVOSkyp->getMoon().getDirection().mV[2];
if (a > 0.f)
{
a = a*a*4.f;
- }
-
- color.mV[3] = llclamp(a, 0.f, 1.f);
-#endif
+ }
+ color.mV[3] = llclamp(a, 0.f, 1.f);*/
if (gPipeline.canUseVertexShaders())
{
@@ -431,7 +428,9 @@ void LLDrawPoolWLSky::render(S32 pass)
renderSkyHaze(origin, camHeightLocal);
- if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders())
+ bool use_advanced = gPipeline.useAdvancedAtmospherics();
+
+ if (!use_advanced)
{
gGL.pushMatrix();
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index d878bd9abe..d37cbfc76d 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -190,7 +190,6 @@ const F32Seconds LLEnvironment::TRANSITION_DEFAULT(5.0f);
const F32Seconds LLEnvironment::TRANSITION_SLOW(10.0f);
const F32 LLEnvironment::SUN_DELTA_YAW(F_PI); // 180deg
-const F32 LLEnvironment::NIGHTTIME_ELEVATION_COS(LLSky::NIGHTTIME_ELEVATION_COS);
//-------------------------------------------------------------------------
LLEnvironment::LLEnvironment():
@@ -380,7 +379,7 @@ F32 LLEnvironment::getWaterHeight() const
bool LLEnvironment::getIsDayTime() const
{
- return mCurrentEnvironment->getSky()->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS;
+ return mCurrentEnvironment->getSky()->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_SIN;
}
//-------------------------------------------------------------------------
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 30286d54fd..e4f891deca 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -293,7 +293,6 @@ private:
};
static const F32 SUN_DELTA_YAW;
- static const F32 NIGHTTIME_ELEVATION_COS;
typedef std::map<LLUUID, LLSettingsBase::ptr_t> AssetSettingMap_t;
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 15aebda5ad..a81e74b6ed 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -51,18 +51,16 @@
#include "llvosky.h"
#include "llcubemap.h"
#include "llviewercontrol.h"
+#include "llenvironment.h"
#include "llvowlsky.h"
F32 azimuth_from_vector(const LLVector3 &v);
F32 elevation_from_vector(const LLVector3 &v);
-LLSky gSky;
-// ---------------- LLSky ----------------
-
-const F32 LLSky::NIGHTTIME_ELEVATION = -8.0f; // degrees
-const F32 LLSky::NIGHTTIME_ELEVATION_COS = (F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD);
+LLSky gSky;
+// ---------------- LLSky ----------------
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h
index 010cc30d55..27029b254b 100644
--- a/indra/newview/llsky.h
+++ b/indra/newview/llsky.h
@@ -97,9 +97,6 @@ public:
// Legacy stuff
LLVector3 mSunDefaultPosition;
- static const F32 NIGHTTIME_ELEVATION; // degrees
- static const F32 NIGHTTIME_ELEVATION_COS;
-
protected:
F32 mSunPhase;
LLColor4 mFogColor; // Color to use for fog and haze
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 95e4f27a39..40cf4c82e6 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -46,6 +46,8 @@
#include "llenvironment.h"
#include "llatmosphere.h"
+#pragma optimize("", off)
+
#ifdef LL_RELEASE_FOR_DOWNLOAD
#define UNIFORM_ERRS LL_WARNS_ONCE("Shader")
#else
@@ -509,8 +511,9 @@ void LLViewerShaderMgr::setShaders()
wl_class = llmin(wl_class, 2);
}
- if (!(LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")
- && gSavedSettings.getBOOL("WindLightUseAtmosShaders")))
+ bool hasWindLightShaders = LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders");
+ bool useWindLightShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
+ if (!hasWindLightShaders || !useWindLightShaders)
{
// user has disabled WindLight in their settings, downgrade
// windlight shaders to stub versions.
@@ -544,7 +547,6 @@ void LLViewerShaderMgr::setShaders()
// Load all shaders to set max levels
loaded = loadShadersEnvironment();
- llassert(loaded);
if (loaded)
{
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 5f55f6c310..1e99c77da9 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -700,6 +700,12 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
bool draw_sun = updateHeavenlyBodyGeometry(drawable, FACE_SUN, mSun, up, right);
bool draw_moon = updateHeavenlyBodyGeometry(drawable, FACE_MOON, mMoon, up, right);
+ bool daytime = LLEnvironment::getInstance()->getIsDayTime();
+
+ // makeshift check until we properly handle moon in daytime
+ draw_sun &= daytime;
+ draw_moon &= !daytime;
+
mSun.setDraw(draw_sun);
mMoon.setDraw(draw_moon);
@@ -763,16 +769,7 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, LLHe
S32 index_offset;
LLFace *facep;
- LLVector3 to_dir = hb.getDirection();
-
- /*F32 rad = hb.getDiskRadius();
- F32 d = to_dir * LLVector3::z_axis;
- if (d < -(rad * 0.5f))
- {
- hb.setVisible(FALSE);
- return FALSE;
- }*/
-
+ LLVector3 to_dir = hb.getDirection();
LLVector3 draw_pos = to_dir * HEAVENLY_BODY_DIST;
LLVector3 hb_right = to_dir % LLVector3::z_axis;
@@ -780,8 +777,12 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, LLHe
hb_right.normalize();
hb_up.normalize();
- const LLVector3 scaled_right = HEAVENLY_BODY_DIST * hb.getDiskRadius() * hb_right;
- const LLVector3 scaled_up = HEAVENLY_BODY_DIST * hb.getDiskRadius() * hb_up;
+ const F32 enlargm_factor = ( 1 - to_dir.mV[2] );
+ F32 horiz_enlargement = 1 + enlargm_factor * 0.3f;
+ F32 vert_enlargement = 1 + enlargm_factor * 0.2f;
+
+ const LLVector3 scaled_right = horiz_enlargement * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_right;
+ const LLVector3 scaled_up = vert_enlargement * HEAVENLY_BODY_DIST * HEAVENLY_BODY_FACTOR * hb.getDiskRadius() * hb_up;
LLVector3 v_clipped[4];
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 6ad47386c7..b2ec9a6a66 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -927,7 +927,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
for (U32 i = 0; i < 4; i++)
{
if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
- if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
+ if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
}
}
else
@@ -6034,7 +6034,7 @@ void LLPipeline::setupAvatarLights(bool for_edit)
}
}
F32 backlight_mag;
- if (gSky.getSunDirection().mV[2] >= LLSky::NIGHTTIME_ELEVATION_COS)
+ if (gSky.getSunDirection().mV[2] >= NIGHTTIME_ELEVATION_SIN)
{
backlight_mag = BACKLIGHT_DAY_MAGNITUDE_OBJECT;
}
@@ -6253,7 +6253,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
// Light 0 = Sun or Moon (All objects)
{
- if (gSky.getSunDirection().mV[2] >= LLSky::NIGHTTIME_ELEVATION_COS)
+ if (gSky.getSunDirection().mV[2] >= NIGHTTIME_ELEVATION_SIN)
{
mSunDir.setVec(gSky.getSunDirection());
mSunDiffuse.setVec(gSky.getSunDiffuseColor());
@@ -9124,7 +9124,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
}
}
-// pretty sure this doesn't work as expected since the shaders using 'shadow_ofset' all declare it as a single uniform float, no array or vec
+// pretty sure this doesn't work as expected since the shaders using 'shadow_offset' all declare it as a single uniform float, no array or vec
gDeferredSunProgram.uniform3fv(LLShaderMgr::DEFERRED_SHADOW_OFFSET, slice, offset);
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight());