diff options
author | Graham Linden <graham@lindenlab.com> | 2018-10-30 00:22:00 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-10-30 00:22:00 +0100 |
commit | 38a6f3b0dfd56ceb09bc5a689a678038f8022603 (patch) | |
tree | 8d70020376698e4604342356bbf7c5eaed03583a /indra/newview/lldrawpoolwlsky.cpp | |
parent | 536799d07e4298ff8157ef51ed00040e10a5ba65 (diff) |
SL-9966 fix cloud noise map bindings when current and next are identical.
Diffstat (limited to 'indra/newview/lldrawpoolwlsky.cpp')
-rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index d4674cec67..d8042a4125 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -399,13 +399,41 @@ void LLDrawPoolWLSky::renderSkyCloudsAdvanced(const LLVector3& camPosLocal, F32 { LLGLSPipelineBlendSkyBox pipeline(true, true); + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + cloudshader->bind(); - S32 cloud_channel = cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, gSky.mVOSkyp->getCloudNoiseTex()); + LLPointer<LLViewerTexture> cloud_noise = gSky.mVOSkyp->getCloudNoiseTex(); + LLPointer<LLViewerTexture> cloud_noise_next = gSky.mVOSkyp->getCloudNoiseTexNext(); + + S32 cloud_channel = cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise); S32 cloud_next_channel = cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP_NEXT, gSky.mVOSkyp->getCloudNoiseTexNext()); (void)cloud_channel, (void)cloud_next_channel; - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + + F32 blend_factor = 0.; + // if we even have sun disc textures to work with... + if (cloud_noise || cloud_noise_next) + { + if (cloud_noise && (!cloud_noise_next || (cloud_noise == cloud_noise_next))) + { + // Bind current and next sun textures + cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (cloud_noise_next && !cloud_noise) + { + cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise_next, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (cloud_noise_next != cloud_noise) + { + cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise, LLTexUnit::TT_TEXTURE); + cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP_NEXT, cloud_noise_next, LLTexUnit::TT_TEXTURE); + } + } cloudshader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); cloudshader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); |