1
0
forked from 0ad/0ad

Moves and cleanups includes and public/private section of PostprocManager.

Reviewed By: elexis
This was SVN commit r22738.
This commit is contained in:
Vladislav Belov 2019-08-20 21:15:15 +00:00
parent 3285f43394
commit 486691b49a
2 changed files with 53 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -17,21 +17,19 @@
#include "precompiled.h" #include "precompiled.h"
#include "lib/ogl.h" #include "renderer/PostprocManager.h"
#include "maths/MathUtil.h"
#include "gui/GUIutil.h"
#include "lib/bits.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/Game.h"
#include "ps/World.h"
#include "graphics/GameView.h" #include "graphics/GameView.h"
#include "graphics/LightEnv.h" #include "graphics/LightEnv.h"
#include "graphics/ShaderManager.h" #include "graphics/ShaderManager.h"
#include "gui/GUIutil.h"
#include "renderer/PostprocManager.h" #include "lib/bits.h"
#include "lib/ogl.h"
#include "maths/MathUtil.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/Game.h"
#include "ps/World.h"
#include "renderer/Renderer.h" #include "renderer/Renderer.h"
#if !CONFIG2_GLES #if !CONFIG2_GLES

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -18,11 +18,51 @@
#ifndef INCLUDED_POSTPROCMANAGER #ifndef INCLUDED_POSTPROCMANAGER
#define INCLUDED_POSTPROCMANAGER #define INCLUDED_POSTPROCMANAGER
#include "graphics/ShaderTechnique.h" #include "graphics/ShaderTechnique.h"
#include "ps/CStr.h"
#include <vector>
class CPostprocManager class CPostprocManager
{ {
public:
CPostprocManager();
~CPostprocManager();
// Create all buffers/textures in GPU memory and set default effect.
// @note Must be called before using in the renderer. May be called multiple times.
void Initialize();
// Update the size of the screen
void Resize();
// Returns a list of xml files found in shaders/effects/postproc.
static std::vector<CStrW> GetPostEffects();
// Returns the name of the current effect.
const CStrW& GetPostEffect() const
{
return m_PostProcEffect;
}
// Sets the current effect.
void SetPostEffect(const CStrW& name);
// 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
void CaptureRenderOutput();
// First renders blur textures, then calls ApplyEffect for each effect pass,
// ping-ponging the buffers at each step.
// @note CPostprocManager must be initialized first
void ApplyPostproc();
// Blits the final postprocessed texture to the system framebuffer. The system framebuffer
// is selected as the output buffer. Should be called before silhouette rendering.
// @note CPostprocManager must be initialized first
void ReleaseRenderOutput();
private: private:
// Two framebuffers, that we flip between at each shader pass. // Two framebuffers, that we flip between at each shader pass.
@ -75,45 +115,6 @@ private:
// Delete existing buffers/textures and create them again, using a new screen size if needed. // Delete existing buffers/textures and create them again, using a new screen size if needed.
// (the textures are also attached to the framebuffers) // (the textures are also attached to the framebuffers)
void RecreateBuffers(); void RecreateBuffers();
public:
CPostprocManager();
~CPostprocManager();
// Create all buffers/textures in GPU memory and set default effect.
// @note Must be called before using in the renderer. May be called multiple times.
void Initialize();
// Update the size of the screen
void Resize();
// Returns a list of xml files found in shaders/effects/postproc.
static std::vector<CStrW> GetPostEffects();
// Returns the name of the current effect.
inline const CStrW& GetPostEffect() const
{
return m_PostProcEffect;
}
// Sets the current effect.
void SetPostEffect(const CStrW& name);
// 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
void CaptureRenderOutput();
// First renders blur textures, then calls ApplyEffect for each effect pass,
// ping-ponging the buffers at each step.
// @note CPostprocManager must be initialized first
void ApplyPostproc();
// Blits the final postprocessed texture to the system framebuffer. The system framebuffer
// is selected as the output buffer. Should be called before silhouette rendering.
// @note CPostprocManager must be initialized first
void ReleaseRenderOutput();
}; };
#endif // INCLUDED_POSTPROCMANAGER
#endif //INCLUDED_POSTPROCMANAGER