diff options
author | Dave Parks <davep@lindenlab.com> | 2022-05-19 22:24:41 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-05-19 22:24:41 -0500 |
commit | 3564b24e2a90e0772c37185cc5dcedca29d62ab8 (patch) | |
tree | 9c0e7fa9d747d7bca7b25352bf8e28c875163e77 /indra/newview/pipeline.cpp | |
parent | 02fb1bd6103cad5538fc170e015f4329f3545542 (diff) |
SL-17286 Reflection probe alpha/fullbright support.
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4cf8157623..b4b70a3e11 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8208,30 +8208,16 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); - bool setup_env_mat = false; channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); if (channel > -1) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if (cube_map) { - setup_env_mat = true; cube_map->enable(channel); cube_map->bind(); } - } - channel = shader.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); - if (channel > -1 && mReflectionMapManager.mTexture.notNull()) - { - // see comments in class2/deferred/softenLightF.glsl for what these uniforms mean - mReflectionMapManager.mTexture->bind(channel); - mReflectionMapManager.setUniforms(); - setup_env_mat = true; - } - - if (setup_env_mat) - { F32* m = gGLModelView; F32 mat[] = { m[0], m[1], m[2], @@ -8239,8 +8225,10 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ m[8], m[9], m[10] }; shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); - } + } + bindReflectionProbes(shader); + if (gAtmosphere) { // bind precomputed textures necessary for calculating sun and sky luminance @@ -9163,7 +9151,35 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) } } - channel = shader.disableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP); + unbindReflectionProbes(shader); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->activate(); + shader.unbind(); +} + +void LLPipeline::bindReflectionProbes(LLGLSLShader& shader) +{ + S32 channel = shader.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); + if (channel > -1 && mReflectionMapManager.mTexture.notNull()) + { + // see comments in class2/deferred/softenLightF.glsl for what these uniforms mean + mReflectionMapManager.mTexture->bind(channel); + mReflectionMapManager.setUniforms(); + + F32* m = gGLModelView; + + F32 mat[] = { m[0], m[1], m[2], + m[4], m[5], m[6], + m[8], m[9], m[10] }; + + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); + } +} + +void LLPipeline::unbindReflectionProbes(LLGLSLShader& shader) +{ + S32 channel = shader.disableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP); if (channel > -1 && mReflectionMapManager.mTexture.notNull()) { mReflectionMapManager.mTexture->unbind(); @@ -9172,12 +9188,9 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) gGL.getTexUnit(channel)->enable(LLTexUnit::TT_TEXTURE); } } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->activate(); - shader.unbind(); } + inline float sgn(float a) { if (a > 0.0F) return (1.0F); |