mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
Add gl_ssao_portals for controlling how many portals gets SSAO
This commit is contained in:
parent
3f11c0562c
commit
979e70ca8f
5 changed files with 20 additions and 2 deletions
|
@ -105,6 +105,12 @@ CUSTOM_CVAR(Int, gl_ssao, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
self = 0;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, gl_ssao_portals, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 0)
|
||||
self = 0;
|
||||
}
|
||||
|
||||
CVAR(Float, gl_ssao_strength, 0.7, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, gl_ssao_debug, false, 0)
|
||||
CVAR(Float, gl_ssao_bias, 0.5f, 0)
|
||||
|
|
|
@ -477,6 +477,7 @@ void FGLRenderer::RenderTranslucent()
|
|||
void FGLRenderer::DrawScene(int drawmode)
|
||||
{
|
||||
static int recursion=0;
|
||||
static int ssao_portals_available = 0;
|
||||
|
||||
if (camera != nullptr)
|
||||
{
|
||||
|
@ -494,8 +495,16 @@ 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 != 0 && FGLRenderBuffers::IsEnabled() && drawmode == DM_MAINVIEW;
|
||||
// Decide if we need to do ssao for this scene
|
||||
bool applySSAO = gl_ssao != 0 && FGLRenderBuffers::IsEnabled();
|
||||
switch (drawmode)
|
||||
{
|
||||
case DM_MAINVIEW: ssao_portals_available = gl_ssao_portals; break;
|
||||
case DM_OFFSCREEN: ssao_portals_available = 0; applySSAO = false; break;
|
||||
case DM_PORTAL: applySSAO = applySSAO && (ssao_portals_available > 0); ssao_portals_available--; break;
|
||||
}
|
||||
|
||||
// If SSAO is active, switch to gbuffer shaders and use the framebuffer with gbuffers
|
||||
if (applySSAO)
|
||||
{
|
||||
GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
|
||||
|
|
|
@ -51,6 +51,7 @@ EXTERN_CVAR(Float, gl_lens_k)
|
|||
EXTERN_CVAR(Float, gl_lens_kcube)
|
||||
EXTERN_CVAR(Float, gl_lens_chromatic)
|
||||
EXTERN_CVAR(Int, gl_ssao)
|
||||
EXTERN_CVAR(Int, gl_ssao_portals)
|
||||
EXTERN_CVAR(Float, gl_ssao_strength)
|
||||
EXTERN_CVAR(Bool, gl_ssao_debug)
|
||||
EXTERN_CVAR(Float, gl_ssao_bias)
|
||||
|
|
|
@ -2637,6 +2637,7 @@ GLPREFMNU_TONEMAP = "Tonemap Mode";
|
|||
GLPREFMNU_BLOOM = "Bloom effect";
|
||||
GLPREFMNU_LENS = "Lens distortion effect";
|
||||
GLPREFMNU_SSAO = "Ambient occlusion quality";
|
||||
GLPREFMNU_SSAO_PORTALS = "Portals with AO";
|
||||
|
||||
// Option Values
|
||||
OPTVAL_SMART = "Smart";
|
||||
|
|
|
@ -235,4 +235,5 @@ OptionMenu "GLPrefOptions"
|
|||
Option "$GLPREFMNU_BLOOM", gl_bloom, "OnOff"
|
||||
Option "$GLPREFMNU_LENS", gl_lens, "OnOff"
|
||||
Option "$GLPREFMNU_SSAO", gl_ssao, "SSAOModes"
|
||||
Slider "$GLPREFMNU_SSAO_PORTALS", gl_ssao_portals, 0.0, 4.0, 1.0, 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue