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]]
67 Effect* add(Args&&... args);
68
72 void bind();
73
77 void unbind();
78
82 void render_effects();
83
87 void render_output();
88
95 void resize(const int width, const int height);
96
97 private:
102
107
111 meta::vector<std::unique_ptr<graphics::PostEffect>> m_effects;
112
116 unsigned int m_screen_vbo;
117
121 unsigned int m_screen_vao;
122
126 unsigned int m_output_fb;
127 };
128
129 template<is_posteffect Effect, typename... Args>
130 inline Effect* PostProcess::add(Args&&... args)
131 {
132 m_effects.push_back(std::make_unique<Effect>(std::forward<Args>(args)...));
133 return dynamic_cast<Effect*>(m_effects.back().get());
134 }
135 } // namespace graphics
136} // namespace galaxy
137
138#endif
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.
OpenGL Shader Program.
Definition Shader.hpp:29
Constraint to ensure type is a Post Effect.
Animated.cpp galaxy.
Definition Animated.cpp:16