The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
postprocess.h
Go to the documentation of this file.
1 /*
2  * Dune D3D library - Tobias Alexander Franke 2012
3  * For copyright and license see LICENSE
4  * http://www.tobias-franke.eu
5  */
6 
9 #ifndef DUNE_POSTPROCESS
10 #define DUNE_POSTPROCESS
11 
12 #include "render_target.h"
13 #include "simple_mesh.h"
14 
15 #include <list>
16 #include <string>
17 
18 namespace dune
19 {
29  {
30  protected:
31  INT buffers_start_slot_;
32  simple_mesh fs_triangle_;
33 
34  render_target frontbuffer_;
35 
36  bool enabled_;
37 
39  virtual void do_create(ID3D11Device* device)
40  {
41  }
42 
44  virtual void do_destroy()
45  {
46  }
47 
49  virtual void do_set_shader(ID3D11Device* device)
50  {
51  }
52 
54  virtual void do_resize(UINT width, UINT height)
55  {
56  }
57 
58  public:
59  postprocessor();
60  virtual ~postprocessor() {}
61 
62  void create(ID3D11Device* device, DXGI_SURFACE_DESC desc);
63 
65  virtual void render(ID3D11DeviceContext* context, ID3D11RenderTargetView* backbuffer);
66 
79  void set_shader(ID3D11Device* device, ID3DBlob* input_binary, ID3D11VertexShader* fs_triangle, UINT buffers_start_slot);
80 
81  void destroy();
82 
84  void resize(UINT width, UINT height);
85 
87  inline render_target& frontbuffer() { return frontbuffer_; }
88 
90  inline void enable() { enabled_ = true; };
91 
93  inline void disable() { enabled_ = false; };
94 
96  inline bool enabled() { return enabled_; }
97  };
98 }
99 
100 #endif
virtual void do_set_shader(ID3D11Device *device)
Overwrite this method to initializes further shader instances.
Definition: postprocess.h:49
A base interface for a postprocessor pipeline.
Definition: postprocess.h:28
bool enabled()
Check whether or not the postprocessing pipeline is enabled.
Definition: postprocess.h:96
virtual void do_destroy()
Overwrite this to destroy additional resources created.
Definition: postprocess.h:44
void enable()
Enable the postprocessing pipeline.
Definition: postprocess.h:90
render_target & frontbuffer()
Render into this render_target for the postprocessor.
Definition: postprocess.h:87
void disable()
Disable the postprocessing pipeline.
Definition: postprocess.h:93
void set_shader(ID3D11Device *device, ID3DBlob *input_binary, ID3D11VertexShader *fs_triangle, UINT buffers_start_slot)
Set shader parameters for the postprocessing pipeline.
Definition: postprocess.cpp:20
virtual void do_resize(UINT width, UINT height)
Overwrite this method to react to resizes.
Definition: postprocess.h:54
virtual void render(ID3D11DeviceContext *context, ID3D11RenderTargetView *backbuffer)
Render the entire postprocess (i.e. all steps of the pipeline) and write the result to backbuffer...
Definition: postprocess.cpp:44
A render target wrapper.
Definition: render_target.h:30
void resize(UINT width, UINT height)
Resizes the frontbuffer into which a deferred renderer writes its image to.
Definition: postprocess.cpp:57
virtual void do_create(ID3D11Device *device)
Overwrite this method to add your own creation code.
Definition: postprocess.h:39
A very simple mesh class with position-only vertex attributes.
Definition: simple_mesh.h:31