Fix handling of ambient (was getting reset to 1,1,1,1 unintentionally).

Modify shaders to balance ambient across render modes again.
master
Graham Linden 2019-05-31 13:47:44 -07:00
parent 485c5978e7
commit 58f7b981bd
10 changed files with 17 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -801,7 +801,7 @@ void LLDrawPoolAvatar::beginImpostor()
gImpostorProgram.setMinimumAlpha(0.01f);
}
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
gPipeline.enableLightsFullbright();
sDiffuseChannel = 0;
}

View File

@ -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);

View File

@ -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);

View File

@ -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()

View File

@ -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);