feat: post-processing effects

This commit is contained in:
MihailRis
2025-04-05 00:41:25 +03:00
parent 22e97b1766
commit ba170035ef
19 changed files with 216 additions and 84 deletions
+6 -3
View File
@@ -1,12 +1,14 @@
#pragma once
#include <vector>
#include <memory>
class Mesh;
class Shader;
class Assets;
class Framebuffer;
class DrawContext;
class ImageData;
class PostEffect;
/// @brief Framebuffer with blitting with shaders.
/// @attention Current implementation does not support multiple render passes
@@ -14,8 +16,10 @@ class ImageData;
class PostProcessing {
/// @brief Main framebuffer (lasy field)
std::unique_ptr<Framebuffer> fbo;
std::unique_ptr<Framebuffer> fboSecond;
/// @brief Fullscreen quad mesh as the post-processing canvas
std::unique_ptr<Mesh> quadMesh;
std::vector<std::shared_ptr<PostEffect>> effectSlots;
public:
PostProcessing();
~PostProcessing();
@@ -27,9 +31,8 @@ public:
/// @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(const DrawContext& context, Shader* screenShader);
void render(const DrawContext& context, const Assets& assets, float timer);
/// @brief Make an image from the last rendered frame
std::unique_ptr<ImageData> toImage();