summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-02-08 22:10:07 +0000
committerRider Linden <rider@lindenlab.com>2019-02-08 22:10:07 +0000
commita1c2d021261d38de7dabd0863dd264ac3bf50523 (patch)
tree3b09e4412ccac313dd93adff2d14d1c766b5686a /indra
parentc8d8414b3b2e83fbaffd6e48f55ca14a3cb27ca4 (diff)
parent0a7bc35335666cc310ef900d4e4144c658b92522 (diff)
Merged in graham_linden/viewer-eep-fixes (pull request #273)
SL-10478, SL-10486, SL-10501, SL-10415, SL-10487
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingssky.cpp15
-rw-r--r--indra/llinventory/llsettingssky.h3
-rw-r--r--indra/llrender/llrender.cpp20
-rw-r--r--indra/llrender/llrender.h2
-rw-r--r--indra/llrender/llshadermgr.cpp2
-rw-r--r--indra/llrender/llshadermgr.h2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl43
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/skyF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/cloudShadowF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl4
-rw-r--r--indra/newview/lldrawpool.cpp2
-rw-r--r--indra/newview/lldrawpoolavatar.cpp19
-rw-r--r--indra/newview/lldrawpoolterrain.cpp4
-rw-r--r--indra/newview/lldrawpooltree.cpp4
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp1
-rw-r--r--indra/newview/llpaneleditsky.cpp2
-rw-r--r--indra/newview/llweb.cpp11
-rw-r--r--indra/newview/pipeline.cpp65
30 files changed, 149 insertions, 115 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 612c97168c..72a3c7b01c 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -140,7 +140,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level");
const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c");
static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver
-static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver
+static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b");
const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze");
@@ -1238,12 +1238,6 @@ LLVector3 LLSettingsSky::getMoonDirection() const
return mMoonDirection;
}
-LLColor4U LLSettingsSky::getFadeColor() const
-{
- update();
- return mFadeColor;
-}
-
LLColor4 LLSettingsSky::getMoonAmbient() const
{
update();
@@ -1305,12 +1299,9 @@ void LLSettingsSky::calculateLightSettings() const
mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance));
mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5);
- mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance));
- mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f);
+ mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f);
+ mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.25f);
mTotalAmbient = mSunAmbient;
-
- mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f;
- mFadeColor.setAlpha(0);
}
LLUUID LLSettingsSky::GetDefaultAssetId()
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 65c0f2c581..cd173a6b18 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -280,7 +280,7 @@ public:
LLVector3 getSunDirection() const;
LLVector3 getMoonDirection() const;
- LLColor4U getFadeColor() const;
+
LLColor4 getMoonAmbient() const;
LLColor3 getMoonDiffuse() const;
LLColor4 getSunAmbient() const;
@@ -347,7 +347,6 @@ private:
static const F32 DOME_RADIUS;
static const F32 DOME_OFFSET;
- mutable LLColor4U mFadeColor;
mutable LLColor4 mMoonAmbient;
mutable LLColor3 mMoonDiffuse;
mutable LLColor4 mSunAmbient;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 173444f708..dc9affb596 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -895,6 +895,15 @@ void LLLightState::setDiffuse(const LLColor4& diffuse)
}
}
+void LLLightState::setDiffuseB(const LLColor4& diffuse)
+{
+ if (mDiffuseB != diffuse)
+ {
+ ++gGL.mLightHash;
+ mDiffuseB = diffuse;
+ }
+}
+
void LLLightState::setAmbient(const LLColor4& ambient)
{
if (mAmbient != ambient)
@@ -1153,6 +1162,7 @@ void LLRender::syncLightState()
LLVector3 direction[8];
LLVector4 attenuation[8];
LLVector3 diffuse[8];
+ LLVector3 diffuseB[8];
for (U32 i = 0; i < 8; i++)
{
@@ -1162,6 +1172,7 @@ void LLRender::syncLightState()
direction[i] = light->mSpotDirection;
attenuation[i].set(light->mLinearAtten, light->mQuadraticAtten, light->mSpecular.mV[2], light->mSpecular.mV[3]);
diffuse[i].set(light->mDiffuse.mV);
+ diffuseB[i].set(light->mDiffuseB.mV);
}
shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, 8, position[0].mV);
@@ -1169,8 +1180,8 @@ void LLRender::syncLightState()
shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV);
shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
- //HACK -- duplicate sunlight color for compatibility with drivers that can't deal with multiple shader objects referencing the same uniform
shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
+ shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuseB[0].mV);
}
}
@@ -1477,6 +1488,13 @@ void LLRender::matrixMode(U32 mode)
{
if (mode == MM_TEXTURE)
{
+ U32 tex_index = gGL.getCurrentTexUnitIndex();
+ // the shaders don't actually reference anything beyond texture_matrix0/1
+ if (tex_index > 3)
+ {
+ LL_WARNS_ONCE("render") << "Cannot use texture matrix with texture unit " << tex_index << " forcing texture matrix 3!" << LL_ENDL;
+ tex_index = 3;
+ }
mode = MM_TEXTURE0 + gGL.getCurrentTexUnitIndex();
}
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index a79db80ebe..012a8da4ce 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -229,6 +229,7 @@ public:
void enable();
void disable();
void setDiffuse(const LLColor4& diffuse);
+ void setDiffuseB(const LLColor4& diffuse);
void setAmbient(const LLColor4& ambient);
void setSpecular(const LLColor4& specular);
void setPosition(const LLVector4& position);
@@ -245,6 +246,7 @@ protected:
S32 mIndex;
bool mEnabled;
LLColor4 mDiffuse;
+ LLColor4 mDiffuseB;
LLColor4 mAmbient;
LLColor4 mSpecular;
LLVector4 mPosition;
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 3989c1e2e4..11e84d8785 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1352,6 +1352,8 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("sun_moon_glow_factor");
mReservedUniforms.push_back("water_edge");
+ mReservedUniforms.push_back("sun_up_factor");
+ mReservedUniforms.push_back("moonlight_color");
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index ef6f33f2e5..497c3eb231 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -250,6 +250,8 @@ public:
SUN_MOON_GLOW_FACTOR,
WATER_EDGE_FACTOR,
+ SUN_UP_FACTOR,
+ MOONLIGHT_COLOR,
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index 53391da9aa..4beb334f5a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -47,6 +47,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -94,7 +96,7 @@ void main()
vec4 temp2 = vec4(0.);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index c6c12f80f8..d964ce8eee 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -35,6 +35,7 @@ out vec4 frag_data[3];
uniform vec4 color;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
uniform vec3 lumWeights;
uniform float moon_brightness;
uniform float minLuminance;
@@ -57,6 +58,7 @@ void main()
vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
c.rgb = pow(c.rgb, exp);
+ //c.rgb *= moonlight_color.rgb;
frag_data[0] = vec4(c.rgb, c.a);
frag_data[1] = vec4(0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index 6c509b7616..e762871ba1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -39,19 +39,18 @@ uniform vec2 proj_shadow_res;
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform float shadow_bias;
-
+uniform float shadow_offset;
uniform float spot_shadow_bias;
uniform float spot_shadow_offset;
uniform mat4 inv_proj;
uniform vec2 screen_res;
+uniform int sun_up_factor;
-float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
+float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
{
stc.xyz /= stc.w;
- float offset = max(0.75, light_dir.z);
- stc.z += offset * shadow_bias * 3.33 * bias_mul;
-
- stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*3.14159))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
+ stc.z += shadow_bias * bias_mul* 2.0;
+ stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*pos_screen.x))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs * 4.0;
@@ -61,7 +60,7 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float bias_mul, vec2 pos_sc
shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
- return shadow*0.125;
+ return shadow * 0.125;
}
float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 pos_screen)
@@ -85,23 +84,18 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
{
+ float shadow = 0.0f;
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+
float dp_sun = max(0.0, dot(sun_dir.xyz, norm));
float dp_moon = max(0.0, dot(moon_dir.xyz, norm));
- float dp_directional_light = max(dp_sun,dp_moon);
+ float dp_directional_light = (sun_up_factor == 1) ? dp_sun : dp_moon;
dp_directional_light = clamp(dp_directional_light, 0.0, 1.0);
- vec3 light_dir = (dp_moon > dp_sun) ? moon_dir : sun_dir;
- vec3 offset = light_dir * (1.0-dp_directional_light);
- vec3 shadow_pos = pos.xyz + (offset * shadow_bias);
-
- float shadow = 0.0f;
- vec4 spos = vec4(shadow_pos,1.0);
-
- // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup
- if (dp_directional_light <= 0.0)
- {
- return 0.0;
- }
+ vec3 shadow_pos = pos.xyz;
+ vec3 offset = abs(light_dir.xyz) * (1.0 - dp_directional_light* 0.8);
+ shadow_pos += offset;
+ vec4 spos = vec4(shadow_pos.xyz, 1.0);
if (spos.z > -shadow_clip.w)
{
@@ -117,7 +111,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap3, lpos, 1.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap3, norm, lpos, 4.0, pos_screen, light_dir)*w;
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
@@ -129,7 +123,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap2, lpos, 1.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap2, norm, lpos, 2.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -140,7 +134,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
- shadow += pcfShadow(shadowMap1, lpos, 1.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap1, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -151,14 +145,13 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
- shadow += pcfShadow(shadowMap0, lpos, 1.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap0, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
shadow /= weight;
}
- shadow = min(dp_directional_light, shadow);
return shadow;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 7c02d31d43..83dd9da091 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -39,6 +39,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -82,7 +84,7 @@ void main()
vec4 temp2 = vec4(0.);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
index 67e7604e22..8a98d6a489 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
@@ -39,7 +39,6 @@ uniform sampler2D diffuseMap;
uniform sampler2D altDiffuseMap;
uniform float blend_factor;
uniform float custom_alpha;
-uniform vec4 sunlight_color;
uniform float time;
float twinkle(){
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
index b66b56e0fb..947c301110 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -35,6 +35,7 @@ out vec4 frag_color;
uniform vec4 color;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
uniform vec3 lumWeights;
uniform float moon_brightness;
uniform float minLuminance;
@@ -45,8 +46,8 @@ VARYING vec2 vary_texcoord0;
void main()
{
- vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy);
- vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
+ vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy);
+ vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
// mix factor which blends when sunlight is brighter
@@ -55,8 +56,9 @@ void main()
float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
- c.rgb = pow(c.rgb, exp);
+ c.rgb = pow(c.rgb, exp);
+ //c.rgb *= moonlight_color.rgb;
- frag_color = vec4(c.rgb, c.a);
+ frag_color = vec4(c.rgb, c.a);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
index 7e2d41cf7b..26f8095dc1 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
@@ -34,6 +34,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -112,7 +114,7 @@ void main()
vec4 temp2 = vec4(0.);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 2c1cc3026f..8bc9add5cf 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -57,6 +57,8 @@ uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
uniform vec3 moon_dir;
+uniform int sun_up_factor;
+
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
@@ -89,9 +91,9 @@ void main()
float envIntensity = norm.z;
norm.xyz = getNorm(tc); // unpack norm
- float da_sun = dot(norm.xyz, normalize(sun_dir.xyz));
- float da_moon = dot(norm.xyz, normalize(moon_dir.xyz));
- float da = (da_sun > 0.0) ? da_sun : da_moon;
+ float da_sun = dot(norm.xyz, sun_dir.xyz);
+ float da_moon = dot(norm.xyz, moon_dir.xyz);
+ float da = (sun_up_factor == 1) ? da_sun : da_moon;
da = clamp(da, 0.0, 1.0);
da = pow(da, global_gamma + 0.3);
@@ -106,7 +108,7 @@ void main()
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(global_gamma + 0.3));
- float scol = max(scol_ambocc.r, diffuse.a);
+ float scol = max(scol_ambocc.r, diffuse.a);
float ambocc = scol_ambocc.g;
vec3 sunlit;
@@ -116,7 +118,8 @@ void main()
calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten);
- float ambient = dot(norm.xyz, sun_dir.xyz);
+ float ambient = da;
+
ambient *= 0.5;
ambient *= ambient;
ambient = (1.0-ambient);
@@ -124,7 +127,7 @@ void main()
col.rgb = amblit;
col.rgb *= min(ambient, max(scol, 0.5));
- col += (sunlit * da) * scol;
+ col += sunlit * da * scol;
col *= diffuse.rgb;
@@ -162,6 +165,9 @@ void main()
col = fogged.rgb;
bloom = fogged.a;
#endif
+
+//col.rgb = vec3(scol);
+//col.rgb = vec3(da * scol);
}
frag_color.rgb = col;
frag_color.a = bloom;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 683ab794d3..efcf848ab1 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -29,6 +29,8 @@ vec3 getAtmosAttenuation();
uniform vec4 gamma;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -75,7 +77,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit,
vec3 temp2 = vec3(0);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
//sunlight attenuation effect (hue and brightness) due to atmosphere
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index 86cdae8768..a26752f741 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -44,6 +44,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -74,7 +76,7 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3 temp2 = vec3(0);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
//sunlight attenuation effect (hue and brightness) due to atmosphere
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 3e3bd929e1..fb978691da 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -46,6 +46,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -93,7 +95,7 @@ void main()
vec4 temp2 = vec4(0.);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index f9f1eb7355..a65cc09c73 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -39,6 +39,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -82,7 +84,7 @@ void main()
vec4 temp2 = vec4(0.);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
// Sunlight attenuation effect (hue and brightness) due to atmosphere
diff --git a/indra/newview/app_settings/shaders/class3/deferred/cloudShadowF.glsl b/indra/newview/app_settings/shaders/class3/deferred/cloudShadowF.glsl
index 95d5b52b45..c0ba804a30 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/cloudShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/cloudShadowF.glsl
@@ -44,7 +44,6 @@ uniform sampler2D cloud_noise_texture_next;
uniform float blend_factor;
uniform vec4 cloud_pos_density1;
uniform vec4 cloud_pos_density2;
-uniform vec4 sunlight_color;
uniform vec4 cloud_color;
uniform float cloud_shadow;
uniform float cloud_scale;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl
index c111456782..cc7a86f35c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl
@@ -47,7 +47,6 @@ uniform sampler2D cloud_noise_texture_next;
uniform float blend_factor;
uniform vec4 cloud_pos_density1;
uniform vec4 cloud_pos_density2;
-uniform vec4 sunlight_color;
uniform vec4 cloud_color;
uniform float cloud_shadow;
uniform float cloud_scale;
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
index a1b67fc31e..852c2478bc 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
@@ -29,6 +29,8 @@ vec3 getAtmosAttenuation();
uniform vec4 gamma;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -69,7 +71,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit,
vec3 temp2 = vec3(0);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
//sunlight attenuation effect (hue and brightness) due to atmosphere
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
index 3270c243a4..9bd75cf118 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsV.glsl
@@ -38,6 +38,8 @@ uniform vec3 camPosLocal;
uniform vec4 lightnorm;
uniform vec4 sunlight_color;
+uniform vec4 moonlight_color;
+uniform int sun_up_factor;
uniform vec4 ambient;
uniform vec4 blue_horizon;
uniform vec4 blue_density;
@@ -63,7 +65,7 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3 temp2 = vec3(0);
vec4 blue_weight;
vec4 haze_weight;
- vec4 sunlight = sunlight_color;
+ vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
//sunlight attenuation effect (hue and brightness) due to atmosphere
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 00493c83df..b7504b16bf 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -449,10 +449,10 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
if (params.mModelMatrix != gGLLastMatrix)
{
gGLLastMatrix = params.mModelMatrix;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.loadMatrix(gGLModelView);
if (params.mModelMatrix)
{
- llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
}
gPipeline.mMatrixOpCount++;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index eaf5b7dd68..3e1d78e6df 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1999,15 +1999,24 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
if (face->mTextureMatrix && vobj->mTexAnimMode)
{
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadMatrix((F32*) face->mTextureMatrix->mMatrix);
+ U32 tex_index = gGL.getCurrentTexUnitIndex();
+ if (tex_index <= 1)
+ {
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((F32*) face->mTextureMatrix->mMatrix);
+ }
+ else
+ {
+ LL_WARNS_ONCE("render") << "Cannot use tex anim of tex index " << tex_index << " ignoring!" << LL_ENDL;
+ }
buff->setBuffer(data_mask);
buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadIdentity();
-
+ if (tex_index <= 1)
+ {
+ gGL.loadIdentity();
+ }
}
else
{
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index e716214d72..ba2b00ee4e 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -48,6 +48,7 @@
#include "pipeline.h"
#include "llviewershadermgr.h"
#include "llrender.h"
+#include "llenvironment.h"
const F32 DETAIL_SCALE = 1.f/16.f;
int DebugDetailMap = 0;
@@ -259,6 +260,9 @@ void LLDrawPoolTerrain::beginShadowPass(S32 pass)
LLFacePool::beginRenderPass(pass);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gDeferredShadowProgram.bind();
+
+ LLEnvironment& environment = LLEnvironment::instance();
+ gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
}
void LLDrawPoolTerrain::endShadowPass(S32 pass)
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 81b0c8b1bb..aa8812ab9d 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -38,6 +38,7 @@
#include "llrender.h"
#include "llviewercontrol.h"
#include "llviewerregion.h"
+#include "llenvironment.h"
S32 LLDrawPoolTree::sDiffTex = 0;
static LLGLSLShader* shader = NULL;
@@ -178,7 +179,10 @@ void LLDrawPoolTree::beginShadowPass(S32 pass)
glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
+ LLEnvironment& environment = LLEnvironment::instance();
+
gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
gDeferredTreeShadowProgram.setMinimumAlpha(0.5f);
}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index acf2a6ea6e..313e74d5cd 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -701,6 +701,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
F32 moon_brightness = (float)psky->getMoonBrightness();
moon_shader->uniform1f(LLShaderMgr::MOON_BRIGHTNESS, moon_brightness);
+ moon_shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, gSky.mVOSkyp->getMoon().getColor().mV);
moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp
index b011522728..bbd1beb246 100644
--- a/indra/newview/llpaneleditsky.cpp
+++ b/indra/newview/llpaneleditsky.cpp
@@ -451,7 +451,7 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild()
getChild<LLUICtrl>(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); });
getChild<LLUICtrl>(FIELD_SKY_MOON_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonImageChanged(); });
getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setDefaultImageAssetID(LLSettingsSky::GetDefaultMoonTextureId());
- getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setBlankImageAssetID(LLUUID::null);
+ getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetDefaultMoonTextureId());
getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE);
getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); });
getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonBrightnessChanged(); });
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 768db047a4..2760ebd1df 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -268,12 +268,9 @@ bool LLWeb::useExternalBrowser(const std::string &url)
boost::match_results<std::string::const_iterator> matches;
return !(boost::regex_search(uri_string, matches, pattern));
}
- else
- {
- boost::regex pattern = boost::regex("^mailto:", boost::regex::perl | boost::regex::icase);
- boost::match_results<std::string::const_iterator> matches;
- return boost::regex_search(url, matches, pattern);
- }
- return false;
+
+ boost::regex pattern = boost::regex("^mailto:", boost::regex::perl | boost::regex::icase);
+ boost::match_results<std::string::const_iterator> matches;
+ return boost::regex_search(url, matches, pattern);
#endif
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 82c59282d5..0898b0d53d 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6075,9 +6075,7 @@ void LLPipeline::setupAvatarLights(bool for_edit)
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
- bool sun_up = environment.getIsSunUp();
- bool moon_up = environment.getIsMoonUp();
- bool sun_is_primary = sun_up || !moon_up;
+ bool sun_up = environment.getIsSunUp();
if (for_edit)
{
@@ -6113,13 +6111,13 @@ void LLPipeline::setupAvatarLights(bool for_edit)
}
else if (gAvatarBacklight) // Always true (unless overridden in a devs .ini)
{
- LLVector3 light_dir = sun_is_primary ? LLVector3(mSunDir) : LLVector3(mMoonDir);
+ LLVector3 light_dir = sun_up ? LLVector3(mSunDir) : LLVector3(mMoonDir);
LLVector3 opposite_pos = -light_dir;
LLVector3 orthog_light_pos = light_dir % LLVector3::z_axis;
LLVector4 backlight_pos = LLVector4(lerp(opposite_pos, orthog_light_pos, 0.3f), 0.0f);
backlight_pos.normalize();
- LLColor4 light_diffuse = sun_is_primary ? mSunDiffuse : mMoonDiffuse;
+ LLColor4 light_diffuse = sun_up ? mSunDiffuse : mMoonDiffuse;
LLColor4 backlight_diffuse(1.f - light_diffuse.mV[VRED], 1.f - light_diffuse.mV[VGREEN], 1.f - light_diffuse.mV[VBLUE], 1.f);
F32 max_component = 0.001f;
@@ -6351,9 +6349,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
gGL.setAmbientLightColor(ambient);
}
- bool sun_up = environment.getIsSunUp();
- bool moon_up = environment.getIsMoonUp();
- bool sun_is_primary = sun_up || !moon_up;
+ bool sun_up = environment.getIsSunUp();
// Light 0 = Sun or Moon (All objects)
{
@@ -6379,15 +6375,15 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
}
mMoonDiffuse.clamp();
- LLColor4 light_diffuse = sun_is_primary ? mSunDiffuse : mMoonDiffuse;
- LLVector4 light_dir = sun_is_primary ? mSunDir : mMoonDir;
+ LLVector4 light_dir = sun_up ? mSunDir : mMoonDir;
- mHWLightColors[0] = light_diffuse;
+ mHWLightColors[0] = mSunDiffuse;
LLLightState* light = gGL.getLight(0);
light->setPosition(light_dir);
- light->setDiffuse(light_diffuse);
+ light->setDiffuse(mSunDiffuse);
+ light->setDiffuseB(mMoonDiffuse);
light->setAmbient(LLColor4::black);
light->setSpecular(LLColor4::black);
light->setConstantAttenuation(1.f);
@@ -8596,32 +8592,14 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
- const LLEnvironment& environment = LLEnvironment::instance();
+ setupHWLights(NULL); //to set mSun/MoonDir;
- bool sun_up = environment.getIsSunUp();
- bool moon_up = environment.getIsMoonUp();
-
- {
- setupHWLights(NULL); //to set mSun/MoonDir;
- glh::vec4f tc(mSunDir.mV);
- mat.mult_matrix_vec(tc);
+ glh::vec4f tc(mSunDir.mV);
+ mat.mult_matrix_vec(tc);
+ mTransformedSunDir.set(tc.v);
- glh::vec4f tc_moon(mMoonDir.mV);
- mTransformedMoonDir.set(tc_moon.v);
- mTransformedMoonDir.normalize();
-
- bool sun_is_primary = sun_up || !moon_up;
- if (sun_is_primary)
- {
- mTransformedSunDir.set(tc.v);
- mTransformedSunDir.normalize();
- }
- else
- {
- mTransformedSunDir.set(tc_moon.v);
- mTransformedSunDir.normalize();
- }
- }
+ glh::vec4f tc_moon(mMoonDir.mV);
+ mTransformedMoonDir.set(tc_moon.v);
gGL.pushMatrix();
gGL.loadIdentity();
@@ -8757,6 +8735,10 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
LL_RECORD_BLOCK_TIME(FTM_ATMOSPHERICS);
bindDeferredShader(soften_shader);
+
+ LLEnvironment& environment = LLEnvironment::instance();
+ soften_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
+
{
LLGLDepthTest depth(GL_FALSE);
LLGLDisable blend(GL_BLEND);
@@ -9870,6 +9852,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
stop_glerror();
+ LLEnvironment& environment = LLEnvironment::instance();
+
LLVertexBuffer::unbind();
{
@@ -9880,6 +9864,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
else
{
gDeferredShadowProgram.bind();
+ gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
}
gGL.diffuseColor4f(1,1,1,1);
@@ -9911,6 +9896,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gDeferredShadowProgram.unbind();
renderGeomShadow(shadow_cam);
gDeferredShadowProgram.bind();
+ gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
}
else
{
@@ -9921,6 +9907,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA);
gDeferredShadowAlphaMaskProgram.bind();
gDeferredShadowAlphaMaskProgram.uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
+ gDeferredShadowAlphaMaskProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
U32 mask = LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0 |
@@ -9935,6 +9922,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
mask = mask & ~LLVertexBuffer::MAP_TEXTURE_INDEX;
gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
renderMaskedObjects(LLRenderPass::PASS_NORMSPEC_MASK, mask);
renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, mask);
renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, mask);
@@ -10625,9 +10613,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
bool sun_up = environment.getIsSunUp();
bool moon_up = environment.getIsMoonUp();
- bool sun_is_primary = sun_up || !moon_up;
- bool ignore_shadows = (sun_is_primary && (mSunDiffuse == LLColor4::black))
- || (moon_up && (mMoonDiffuse == LLColor4::black))
+ bool ignore_shadows = (sun_up && (mSunDiffuse == LLColor4::black))
+ || (moon_up && (mMoonDiffuse == LLColor4::black))
|| !(sun_up || moon_up);
if (ignore_shadows)