1
0
forked from 0ad/0ad

Fixes values of clip planes in PostProcManager.

Reviewed By: wraitii
Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D2196
This was SVN commit r22940.
This commit is contained in:
Vladislav Belov 2019-09-20 07:54:44 +00:00
parent c17e7ee92f
commit 8f7729bfdb
3 changed files with 24 additions and 2 deletions

View File

@ -427,8 +427,8 @@ void CPostprocManager::ApplyEffect(CShaderTechniquePtr &shaderTech1, int pass)
shader->Uniform(str_width, m_Width);
shader->Uniform(str_height, m_Height);
shader->Uniform(str_zNear, g_Game->GetView()->GetNear());
shader->Uniform(str_zFar, g_Game->GetView()->GetFar());
shader->Uniform(str_zNear, m_NearPlane);
shader->Uniform(str_zFar, m_FarPlane);
shader->Uniform(str_brightness, g_LightEnv.m_Brightness);
shader->Uniform(str_hdr, g_LightEnv.m_Contrast);
@ -544,6 +544,12 @@ void CPostprocManager::SetPostEffect(const CStrW& name)
m_PostProcEffect = name;
}
void CPostprocManager::SetDepthBufferClipPlanes(float nearPlane, float farPlane)
{
m_NearPlane = nearPlane;
m_FarPlane = farPlane;
}
#else
#warning TODO: implement PostprocManager for GLES
@ -593,6 +599,10 @@ void CPostprocManager::SetPostEffect(const CStrW& UNUSED(name))
{
}
void CPostprocManager::SetDepthBufferClipPlanes(float UNUSED(nearPlane), float UNUSED(farPlane))
{
}
void CPostprocManager::CaptureRenderOutput()
{
}

View File

@ -48,6 +48,8 @@ public:
// Sets the current effect.
void SetPostEffect(const CStrW& name);
void SetDepthBufferClipPlanes(float nearPlane, float farPlane);
// Clears the two color buffers and depth buffer, and redirects all rendering
// to our textures instead of directly to the system framebuffer.
// @note CPostprocManager must be initialized first
@ -73,6 +75,7 @@ private:
// The framebuffers share a depth/stencil texture.
GLuint m_DepthTex;
float m_NearPlane, m_FarPlane;
// A framebuffer and textures x2 for each blur level we render.
GLuint m_BloomFbo, m_BlurTex2a, m_BlurTex2b, m_BlurTex4a, m_BlurTex4b, m_BlurTex8a, m_BlurTex8b;

View File

@ -1342,6 +1342,15 @@ void CRenderer::RenderSubmissions(const CBoundingBoxAligned& waterScissor)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
if (g_RenderingOptions.GetPostProc())
{
// We have to update the post process manager with real near/far planes
// that we use for the scene rendering.
m->postprocManager.SetDepthBufferClipPlanes(
m_ViewCamera.GetNearPlane(), m_ViewCamera.GetFarPlane()
);
}
ogl_WarnIfError();
if (m_WaterManager->m_RenderWater)