- Add new "scene" target for custom postprocess shaders

- Add "gl_custompost" cvar to turn off custom postprocess shaders completely
- Made "scene" affect the screen before 2D drawing, made "screen" affect the entire screen after 2D drawing
This commit is contained in:
Rachael Alexanderson 2017-07-02 21:04:22 -04:00
parent edb45cd70d
commit 5c87cdd786

View file

@ -148,6 +148,8 @@ CUSTOM_CVAR(Bool, gl_paltonemap_reverselookup, true, CVAR_ARCHIVE | CVAR_NOINITC
CVAR(Float, gl_menu_blur, -1.0f, CVAR_ARCHIVE) CVAR(Float, gl_menu_blur, -1.0f, CVAR_ARCHIVE)
CVAR(Bool, gl_custompost, true, 0)
EXTERN_CVAR(Float, vid_brightness) EXTERN_CVAR(Float, vid_brightness)
EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_contrast)
EXTERN_CVAR(Float, vid_saturation) EXTERN_CVAR(Float, vid_saturation)
@ -178,11 +180,14 @@ void FGLRenderer::PostProcessScene(int fixedcm)
ColormapScene(fixedcm); ColormapScene(fixedcm);
LensDistortScene(); LensDistortScene();
ApplyFXAA(); ApplyFXAA();
RunCustomPostProcessShaders("screen"); RunCustomPostProcessShaders("scene");
} }
void FGLRenderer::RunCustomPostProcessShaders(FString target) void FGLRenderer::RunCustomPostProcessShaders(FString target)
{ {
if (!gl_custompost)
return;
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++) for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
{ {
PostProcessShader &shader = PostProcessShaders[i]; PostProcessShader &shader = PostProcessShaders[i];
@ -895,6 +900,8 @@ void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma)
m2DDrawer->Draw(); // draw all pending 2D stuff before copying the buffer m2DDrawer->Draw(); // draw all pending 2D stuff before copying the buffer
m2DDrawer->Clear(); m2DDrawer->Clear();
RunCustomPostProcessShaders("screen");
FGLDebug::PushGroup("CopyToBackbuffer"); FGLDebug::PushGroup("CopyToBackbuffer");
if (FGLRenderBuffers::IsEnabled()) if (FGLRenderBuffers::IsEnabled())
{ {