Add ssao quality setting

This commit is contained in:
Magnus Norddahl 2016-09-24 19:26:25 +02:00
commit 3f11c0562c
7 changed files with 75 additions and 32 deletions

View file

@ -158,10 +158,11 @@ void FGLRenderer::Set3DViewport(bool mainview)
{
if (mainview && mBuffers->Setup(mScreenViewport.width, mScreenViewport.height, mSceneViewport.width, mSceneViewport.height))
{
mBuffers->BindSceneFB(gl_ssao);
bool useSSAO = (gl_ssao != 0);
mBuffers->BindSceneFB(useSSAO);
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
glDrawBuffers(gl_ssao ? 2 : 1, buffers);
gl_RenderState.SetPassType(gl_ssao ? GBUFFER_PASS : NORMAL_PASS);
glDrawBuffers(useSSAO ? 2 : 1, buffers);
gl_RenderState.SetPassType(useSSAO ? GBUFFER_PASS : NORMAL_PASS);
gl_RenderState.Apply();
}
@ -494,7 +495,7 @@ void FGLRenderer::DrawScene(int drawmode)
GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place.
// If SSAO is active, switch to gbuffer shaders and use the gbuffer framebuffer
bool applySSAO = gl_ssao && FGLRenderBuffers::IsEnabled() && drawmode == DM_MAINVIEW;
bool applySSAO = gl_ssao != 0 && FGLRenderBuffers::IsEnabled() && drawmode == DM_MAINVIEW;
if (applySSAO)
{
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };