mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
post-processing test
This commit is contained in:
parent
e7af5830cf
commit
8ed65ca51e
13 changed files with 268 additions and 113 deletions
37
src/graphics/PostProcessing.h
Normal file
37
src/graphics/PostProcessing.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef GRAPHICS_POST_PROCESSING_H_
|
||||
#define GRAPHICS_POST_PROCESSING_H_
|
||||
|
||||
#include "Viewport.h"
|
||||
#include "GfxContext.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class Mesh;
|
||||
class Shader;
|
||||
class Framebuffer;
|
||||
|
||||
/// @brief Framebuffer with blitting with shaders.
|
||||
/// @attention Current implementation does not support multiple render passes
|
||||
/// for multiple effects. Will be implemented in v0.21
|
||||
class PostProcessing {
|
||||
/// @brief Main framebuffer (lasy field)
|
||||
std::unique_ptr<Framebuffer> fbo;
|
||||
/// @brief Fullscreen quad mesh as the post-processing canvas
|
||||
std::unique_ptr<Mesh> quadMesh;
|
||||
public:
|
||||
PostProcessing();
|
||||
~PostProcessing();
|
||||
|
||||
/// @brief Prepare and bind framebuffer
|
||||
/// @param context graphics context will be modified
|
||||
void use(GfxContext& context);
|
||||
|
||||
/// @brief Render fullscreen quad using the passed shader
|
||||
/// with framebuffer texture bound
|
||||
/// @param context graphics context
|
||||
/// @param screenShader shader used for fullscreen quad
|
||||
/// @throws std::runtime_error if use(...) wasn't called before
|
||||
void render(GfxContext& context, Shader* screenShader);
|
||||
};
|
||||
|
||||
#endif // GRAPHICS_POST_PROCESSING_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue