Skip to content
Snippets Groups Projects
Commit 9cb8ed92 authored by Ptolemy's avatar Ptolemy
Browse files

SL-17701 PBR: Cleanup alpha setting EEP shader uniforms

parent 049fc419
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -613,6 +613,50 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
if (is_pbr && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND)
{
target_shader = &gDeferredPBRAlphaProgram[rigged];
if (current_shader != target_shader)
{
gPipeline.bindDeferredShader(*target_shader);
}
if (params.mTexture.notNull())
{
gGL.getTexUnit(0)->bindFast(params.mTexture); // diffuse
}
else
{
gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep);
}
if (params.mNormalMap)
{
target_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
}
else
{
target_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep);
}
if (params.mSpecularMap)
{
target_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // PBR linear packed Occlusion, Roughness, Metal.
}
else
{
target_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
}
if (params.mEmissiveMap)
{
target_shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, params.mEmissiveMap); // PBR sRGB Emissive
}
else
{
target_shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep);
}
target_shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, params.mGLTFMaterial->mRoughnessFactor);
target_shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, params.mGLTFMaterial->mMetallicFactor);
target_shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, params.mGLTFMaterial->mEmissiveColor.mV);
}
else
{
......@@ -684,56 +728,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
target_shader->bind();
}
if (is_pbr)
{
if (params.mTexture.notNull())
{
gGL.getTexUnit(0)->bindFast(params.mTexture); // diffuse
}
else
{
gGL.getTexUnit(0)->bindFast(LLViewerFetchedTexture::sWhiteImagep);
}
if (params.mNormalMap)
{
target_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
}
else
{
target_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep);
}
if (params.mSpecularMap)
{
target_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // PBR linear packed Occlusion, Roughness, Metal.
}
else
{
target_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
}
if (params.mEmissiveMap)
{
target_shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, params.mEmissiveMap); // PBR sRGB Emissive
}
else
{
target_shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, LLViewerFetchedTexture::sWhiteImagep);
}
target_shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, params.mGLTFMaterial->mRoughnessFactor);
target_shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, params.mGLTFMaterial->mMetallicFactor);
target_shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, params.mGLTFMaterial->mEmissiveColor.mV);
LLEnvironment& environment = LLEnvironment::instance();
target_shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
// TODO? prepare_alpha_shader( target_shader, false, true );
target_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, gPipeline.mTransformedSunDir.mV);
target_shader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, gPipeline.mTransformedMoonDir.mV);
}
LLVector4 spec_color(1, 1, 1, 1);
F32 env_intensity = 0.0f;
F32 brightness = 1.0f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment