summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-05-31 13:47:44 -0700
committerGraham Linden <graham@lindenlab.com>2019-05-31 13:47:44 -0700
commit58f7b981bdb415311f23dfffc39e7a841b3017a0 (patch)
treec2ab03473650063efdc37deb0701a58035ff7ff9
parent485c5978e7559471f4dad66fb141408262d75363 (diff)
SL-11337
Fix handling of ambient (was getting reset to 1,1,1,1 unintentionally). Modify shaders to balance ambient across render modes again.
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/lldrawpoolalpha.cpp6
-rw-r--r--indra/newview/lldrawpoolavatar.cpp2
-rw-r--r--indra/newview/lldrawpoolsimple.cpp4
-rw-r--r--indra/newview/llfloatermodelpreview.cpp2
-rw-r--r--indra/newview/pipeline.cpp22
-rw-r--r--indra/newview/pipeline.h2
10 files changed, 17 insertions, 29 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 93359e0d4c..1ed25d1dba 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -240,7 +240,7 @@ void main()
vec3 sun_contrib = min(final_da, shadow) * sunlit;
#if !defined(AMBIENT_KILL)
- color.rgb = amblit;
+ color.rgb = amblit * 0.5;
color.rgb *= ambient;
#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 4701157909..8e0b903d04 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -332,7 +332,7 @@ void main()
vec3 sun_contrib = min(final_da, shadow) * sunlit;
#if !defined(AMBIENT_KILL)
- color.rgb = amblit;
+ color.rgb = amblit * 0.5;
color.rgb *= ambient;
#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index e07b31b3c1..5b03fbaa50 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -111,7 +111,7 @@ void main()
vec3 sun_contrib = final_da * sunlit;
#if !defined(AMBIENT_KILL)
- color.rgb = amblit;
+ color.rgb = amblit * 0.5;
color.rgb *= ambient;
#endif
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 35018360ac..9492141b49 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -119,7 +119,7 @@ void main()
vec3 sun_contrib = min(scol, final_da) * sunlit;
#if !defined(AMBIENT_KILL)
- color.rgb = amblit;
+ color.rgb = amblit * 0.5;
color.rgb *= ambient;
#endif
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 9d80853ba3..d671a5968f 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -300,7 +300,7 @@ void LLDrawPoolAlpha::render(S32 pass)
}
else
{
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gPipeline.enableLightsFullbright();
}
gGL.diffuseColor4f(1,0,0,1);
@@ -487,7 +487,7 @@ void LLDrawPoolAlpha::renderSimples(U32 mask, std::vector<LLDrawInfo*>& simples)
void LLDrawPoolAlpha::renderFullbrights(U32 mask, std::vector<LLDrawInfo*>& fullbrights)
{
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gPipeline.enableLightsFullbright();
fullbright_shader->bind();
fullbright_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.0f);
bool use_shaders = gPipeline.canUseVertexShaders();
@@ -698,7 +698,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
}
else
{
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gPipeline.enableLightsFullbright();
}
light_enabled = FALSE;
}
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 19b5b4af30..15a0595179 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -801,7 +801,7 @@ void LLDrawPoolAvatar::beginImpostor()
gImpostorProgram.setMinimumAlpha(0.01f);
}
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gPipeline.enableLightsFullbright();
sDiffuseChannel = 0;
}
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index f653920662..f211cf6e27 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -447,7 +447,7 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass)
else
{
LLGLEnable test(GL_ALPHA_TEST);
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gPipeline.enableLightsFullbright();
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE);
gPipeline.enableLightsDynamic();
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
@@ -750,7 +750,7 @@ void LLDrawPoolFullbright::render(S32 pass)
}
else
{
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ gPipeline.enableLightsFullbright();
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR;
renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask);
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 4f1ea4a89e..35df26c405 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -4016,7 +4016,7 @@ BOOL LLModelPreview::render()
glLineWidth(3.f);
glPointSize(8.f);
- gPipeline.enableLightsFullbright(LLColor4::white);
+ gPipeline.enableLightsFullbright();
//show degenerate triangles
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
LLGLDisable cull(GL_CULL_FACE);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 33b953beb7..50970293ef 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6191,22 +6191,15 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
-
- // Ambient
+
if (!LLGLSLShader::sNoFixedFunction)
{
- gGL.syncMatrices();
- LLColor4 ambient = psky->getTotalAmbient();
- gGL.setAmbientLightColor(ambient);
+ gGL.syncMatrices();
}
// Ambient
- if (!LLGLSLShader::sNoFixedFunction)
- {
- gGL.syncMatrices();
- LLColor4 ambient = psky->getTotalAmbient();
- gGL.setAmbientLightColor(ambient);
- }
+ LLColor4 ambient = psky->getTotalAmbient();
+ gGL.setAmbientLightColor(ambient);
bool sun_up = environment.getIsSunUp();
bool moon_up = environment.getIsMoonUp();
@@ -6502,9 +6495,6 @@ void LLPipeline::enableLights(U32 mask)
}
mLightMask = mask;
stop_glerror();
-
- LLColor4 ambient = LLEnvironment::instance().getCurrentSky()->getTotalAmbient();
- gGL.setAmbientLightColor(ambient);
}
}
@@ -6620,13 +6610,11 @@ void LLPipeline::enableLightsAvatarEdit(const LLColor4& color)
gGL.setAmbientLightColor(color);
}
-void LLPipeline::enableLightsFullbright(const LLColor4& color)
+void LLPipeline::enableLightsFullbright()
{
assertInitialized();
U32 mask = 0x1000; // Non-0 mask, set ambient
enableLights(mask);
-
- gGL.setAmbientLightColor(color);
}
void LLPipeline::disableLights()
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index b4a8ca004e..10412da6c7 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -315,7 +315,7 @@ public:
void enableLightsAvatar();
void enableLightsPreview();
void enableLightsAvatarEdit(const LLColor4& color);
- void enableLightsFullbright(const LLColor4& color);
+ void enableLightsFullbright();
void disableLights();
void shiftObjects(const LLVector3 &offset);