galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
PostProcess.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_GRAPHICS_POSTPROCESSOR_HPP_
9#define GALAXY_GRAPHICS_POSTPROCESSOR_HPP_
10
17#include "galaxy/meta/Memory.hpp"
18
19namespace galaxy
20{
21 namespace graphics
22 {
26 class PostProcess final
27 {
28 public:
33
38
45 void init(const int width, const int height);
46
50 void destroy();
51
65 template<is_posteffect Effect, typename... Args>
66 [[maybe_unused]] Effect* add(Args&&... args);
67
71 void bind();
72
76 void unbind();
77
81 void render_effects();
82
86 void render_output();
87
94 void resize(const int width, const int height);
95
96 private:
101
106
110 meta::vector<std::unique_ptr<graphics::PostEffect>> m_effects;
111
115 unsigned int m_screen_vbo;
116
120 unsigned int m_screen_vao;
121
125 unsigned int m_output_fb;
126 };
127
128 template<is_posteffect Effect, typename... Args>
129 inline Effect* PostProcess::add(Args&&... args)
130 {
131 m_effects.push_back(std::make_unique<Effect>(std::forward<Args>(args)...));
132 return dynamic_cast<Effect*>(m_effects.back().get());
133 }
134 } // namespace graphics
135} // namespace galaxy
136
137#endif
OpenGL Shader Program.
Definition Shader.hpp:28
Manages post processing effects to apply to combined scene.
void bind()
Bind to draw to post processor framebuffer.
RenderTexture m_fb
For geometry and lighting.
void destroy()
Cleanup used memory.
unsigned int m_screen_vao
Simple quad to draw when applying effects (array).
meta::vector< std::unique_ptr< graphics::PostEffect > > m_effects
List of effects to apply in order.
Effect * add(Args &&... args)
Add an effect to process.
void resize(const int width, const int height)
Resize framebuffers.
void render_effects()
Draw post effects to stored framebuffer.
Shader m_output
Simple output shader.
void render_output()
Draw finished post effects to default framebuffer (screen).
unsigned int m_output_fb
Output cache.
void unbind()
Unbind to draw to post processor framebuffer.
unsigned int m_screen_vbo
Simple quad to draw when applying effects (buffer).
void init(const int width, const int height)
Initialize post processor and GL buffers.
Draw to an opengl texture instead of the screen.
Constraint to ensure type is a Post Effect.
Animated.cpp galaxy.
Definition Animated.cpp:16