diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-05 08:11:33 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-05 08:11:33 -0500 |
commit | 30bcc7d6d5fa4ceedfec28cc0973c253364c555e (patch) | |
tree | 55be9de647378b14acfb2681f050bf8b4fbc7ae2 /indra/newview/lldrawpoolwater.cpp | |
parent | 1e72e3d82c438c2ca17bd8efb80709eaca6c14ca (diff) |
SL-18190 WIP - Add refraction to water without splitting scene between above and below water
Diffstat (limited to 'indra/newview/lldrawpoolwater.cpp')
-rw-r--r-- | indra/newview/lldrawpoolwater.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 23de00e3a4..0b9bca06db 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -122,6 +122,19 @@ S32 LLDrawPoolWater::getNumPostDeferredPasses() return 1; } +void LLDrawPoolWater::beginPostDeferredPass(S32 pass) +{ + // copy framebuffer contents so far to a texture to be used for + // reflections and refractions + LLRenderTarget& src = gPipeline.mRT->screen; + LLRenderTarget& dst = gPipeline.mWaterDis; + dst.copyContents(src, + 0, 0, src.getWidth(), src.getHeight(), + 0, 0, dst.getWidth(), dst.getHeight(), + GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, + GL_NEAREST); +} + void LLDrawPoolWater::renderPostDeferred(S32 pass) { renderWater(); @@ -587,6 +600,8 @@ void LLDrawPoolWater::renderWater() // bind reflection texture from RenderTarget S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); + S32 screenDepth = shader->enableTexture(LLShaderMgr::WATER_SCREENDEPTH); + F32 screenRes[] = {1.f / gGLViewport[2], 1.f / gGLViewport[3]}; S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); @@ -613,6 +628,11 @@ void LLDrawPoolWater::renderWater() gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); } + if (screenDepth > -1) + { + gGL.getTexUnit(screenDepth)->bind(&gPipeline.mWaterDis, true); + } + if (mShaderLevel == 1) { fog_color.mV[VW] = log(fog_density) / log(2); |