Index: ps/trunk/source/renderer/PostprocManager.h =================================================================== --- ps/trunk/source/renderer/PostprocManager.h +++ ps/trunk/source/renderer/PostprocManager.h @@ -48,6 +48,8 @@ // 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 @@ // 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; Index: ps/trunk/source/renderer/PostprocManager.cpp =================================================================== --- ps/trunk/source/renderer/PostprocManager.cpp +++ ps/trunk/source/renderer/PostprocManager.cpp @@ -427,8 +427,8 @@ 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 @@ 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::SetDepthBufferClipPlanes(float UNUSED(nearPlane), float UNUSED(farPlane)) +{ +} + void CPostprocManager::CaptureRenderOutput() { } Index: ps/trunk/source/renderer/Renderer.cpp =================================================================== --- ps/trunk/source/renderer/Renderer.cpp +++ ps/trunk/source/renderer/Renderer.cpp @@ -1342,6 +1342,15 @@ 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)