mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 07:22:05 +00:00
Don't do ambient occlusion when rendering to texture
This commit is contained in:
parent
b6c64416be
commit
7c862b85b3
1 changed files with 19 additions and 13 deletions
|
@ -492,14 +492,29 @@ void FGLRenderer::DrawScene(int drawmode)
|
|||
}
|
||||
GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place.
|
||||
|
||||
RenderScene(recursion);
|
||||
|
||||
bool applySSAO = gl_ssao && FGLRenderBuffers::IsEnabled() && drawmode != DM_PORTAL;
|
||||
// If SSAO is active, switch to gbuffer shaders and use the gbuffer framebuffer
|
||||
bool applySSAO = gl_ssao && FGLRenderBuffers::IsEnabled() && drawmode == DM_MAINVIEW;
|
||||
if (applySSAO)
|
||||
{
|
||||
AmbientOccludeScene();
|
||||
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
|
||||
glDrawBuffers(2, buffers);
|
||||
gl_RenderState.SetPassType(GBUFFER_PASS);
|
||||
gl_RenderState.Apply();
|
||||
gl_RenderState.ApplyMatrices();
|
||||
}
|
||||
|
||||
RenderScene(recursion);
|
||||
|
||||
// Apply ambient occlusion and switch back to shaders without gbuffer output
|
||||
if (applySSAO)
|
||||
{
|
||||
GLenum buffers[] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDrawBuffers(1, buffers);
|
||||
AmbientOccludeScene();
|
||||
mBuffers->BindSceneFB(true);
|
||||
gl_RenderState.SetPassType(NORMAL_PASS);
|
||||
gl_RenderState.Apply();
|
||||
gl_RenderState.ApplyMatrices();
|
||||
}
|
||||
|
||||
// Handle all portals after rendering the opaque objects but before
|
||||
|
@ -508,15 +523,6 @@ void FGLRenderer::DrawScene(int drawmode)
|
|||
GLPortal::EndFrame();
|
||||
recursion--;
|
||||
RenderTranslucent();
|
||||
|
||||
if (applySSAO)
|
||||
{
|
||||
mBuffers->BindSceneFB(true);
|
||||
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
|
||||
glDrawBuffers(2, buffers);
|
||||
gl_RenderState.SetPassType(NORMAL_PASS);
|
||||
gl_RenderState.Apply();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue