The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
|
The deferred renderer base class. More...
#include <deferred_renderer.h>
Public Member Functions | |
void | start_capture (ID3D11Device *device, size_t width, size_t height, size_t fps) |
Capture the backbuffer and write it to an MP4 video file. More... | |
void | stop_capture () |
Stop capturing and finalize an MP4 video file. | |
const buffer_collection & | buffers () |
Returns the map containing all buffers indexed by their registers. | |
void | add_buffer (gbuffer &buffer, UINT slot) |
Add a gbuffer to the deferred renderer buffer map. More... | |
void | add_buffer (texture &target, UINT slot) |
Add a render_target to the buffer map. | |
void | set_postprocessor (postprocessor *pp) |
Set a postprocessor to use. If this isn't called or set to nullptr, the deferred renderer output is displayed directly. | |
void | show_target (ID3D11DeviceContext *context, const tstring &name) |
Select a render_target by name to display in a small overlay when rendering. | |
virtual void | resize (UINT width, UINT height) |
Resize the deferred_renderer's output to a new width/height . | |
Protected Member Functions | |
void | overlay (ID3D11DeviceContext *context, ID3D11RenderTargetView *backbuffer) |
Render a selected target into a small preview window on top of the backbuffer. | |
void | deferred (ID3D11DeviceContext *context, ID3D11RenderTargetView *backbuffer) |
Render the deferred pass with an optional postprocessing pass. | |
Private Member Functions | |
void | reassign_everything (ID3D11DeviceContext *context) |
Reassigns all buffers in buffers_ to their respective registers. | |
void | clear_assigned (ID3D11DeviceContext *context) |
Clear all registers that have been assigned previously. | |
void | blit (ID3D11DeviceContext *context, ID3D11RenderTargetView *backbuffer) |
Render a fullscreen triangle pass. | |
ID3D11ShaderResourceView * | target (const tstring &name) const |
Returns a render_target of a given name. | |
The deferred renderer base class.
This class implements a deferred renderer manager. A deferred_renderer is initialized by "adding" render_target or gbuffer objects to it with given register numbers. These objects are collected into one big buffer map. When rendering, the deferred_renderer will call a deferred shader for a full screen triangle and upload all buffers in the buffer map to their respective registers, which can then be used by the deferred shader.
Next to managing a lot of texture buffers, the deferred renderer can also display a small preview window of a selected buffer (an overlay) and handle a reference to a postprocessor, which augments the output of the deferred shader.
Last but not least the class features a recording function, which will capture the final output of whoever comes last in the pipeline into an MP4.
void dune::deferred_renderer::add_buffer | ( | gbuffer & | buffer, |
UINT | slot | ||
) |
Add a gbuffer to the deferred renderer buffer map.
A gbuffer of e.g. three render targets starting at slot 4 will upload to register t4, t5 and t6.
buffer | The gbuffer object. |
slot | The texture register starting number. |
References dune::gbuffer::targets().
void dune::deferred_renderer::start_capture | ( | ID3D11Device * | device, |
size_t | width, | ||
size_t | height, | ||
size_t | fps | ||
) |
Capture the backbuffer and write it to an MP4 video file.
Enable capture is a toggle function to either start or stop recording a video of the rendered image using ffmpeg.
device | The Direct3D device. |
width | The width of the video (doesn't have to be the same as the backbuffers width, but should be power of 2). |
height | The height of the video (doesn't have to be the same as the backbuffers height, but should be power of 2). |
fps | The frames per second written to the video. |
Referenced by dc::on_keyboard().