Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
postprocessingpass.h
1 #pragma once
2 
3 #include <vector>
4 #include <memory>
5 #include <unordered_map>
6 
7 #include <glow/ref_ptr.h>
8 
9 #include "renderpass.h"
10 #include "etc/contextdependant.h"
11 
12 
13 namespace glow {
14  class Program;
15  class AbstractUniform;
16 }
17 
18 class FrameBuffer;
19 class ScreenQuad;
20 
26 public:
27  PostProcessingPass(const std::string& name, std::shared_ptr<ScreenQuad> quad);
28 
29  virtual void apply(FrameBuffer& frameBuffer, const RenderMetaData& metadata) override;
30 
31  void beforeDraw(FrameBuffer& frameBuffer);
32 
33  void setInputMapping(const std::unordered_map<std::string, int>& inputMapping);
34  void setOutput(const std::vector<int>& output);
35 
36  void setFragmentShader(const std::string& output);
37 
38  template<typename T>
39  void setUniform(const std::string& name, const T& value);
40 
41  bool isEnabled();
42  void setEnabled(bool enabled);
43 
44 protected:
45  std::unordered_map<std::string, glow::ref_ptr<glow::AbstractUniform>> m_uniforms;
46  glow::ref_ptr<glow::Program> m_program;
47  std::shared_ptr<ScreenQuad> m_quad;
48 
49  std::unordered_map<std::string, int> m_inputMapping;
50  std::vector<int> m_output;
51  std::string m_fragmentShader;
52  std::string m_vertexShader;
53  bool m_enabled;
54 
55  void initialize();
56  void restoreUniforms();
57  virtual void beforeContextDestroy() override;
58  virtual void afterContextRebuild() override;
59 };
60 
61 #include "postprocessingpass.inl"
62 
Definition: contextdependant.h:7
Definition: rendermetadata.h:9
Definition: renderpass.h:15
Definition: framebuffer.h:17
Definition: postprocessingpass.h:25
Definition: screenquad.h:15