The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
|
A GBuffer fed from a Kinect camera. More...
#include <kinect_gbuffer.h>
Public Member Functions | |
void | destroy () |
Destroy the shader_resource and free all memory. | |
void | start () |
Start an initialized Kinect camera. | |
void | stop () |
Stop a running Kinect camera. | |
void | update (ID3D11DeviceContext *context) |
Copy over all render_target CPU memory to the GPU. Call this method every before rendering. | |
render_target * | depth () |
Returns the depth render_target. | |
render_target * | color () |
Returns the color render_target. | |
float | depth_min () const |
Return the minimum and maximum depth range defined by the Kinect SDK. | |
float | depth_max () const |
Return the minimum and maximum depth range defined by the Kinect SDK. | |
Public Member Functions inherited from dune::gbuffer | |
targets_vec & | targets () |
Returns all render_target objects in this gbuffer. | |
void | resize (UINT width, UINT height) |
Resize all render_target objects in this gbuffer to a new width and height. | |
void | to_ps (ID3D11DeviceContext *context, UINT start_slot) |
Upload the shader resource to register slot of a pixel shader. | |
void | to_gs (ID3D11DeviceContext *context, UINT start_slot) |
Upload the shader resource to register slot of a geometry shader. | |
void | to_vs (ID3D11DeviceContext *context, UINT start_slot) |
Upload the shader resource to register slot of a vertex shader. | |
void | add_target (const tstring &name, render_target &target) |
Create a new render_target in the gbuffer. These functions basically forward parameters to the render_target's create function. | |
void | add_target (const tstring &name, const D3D11_TEXTURE2D_DESC &desc, bool cached=false) |
Create a new render_target in the gbuffer. These functions basically forward parameters to the render_target's create function. | |
void | add_target (const tstring &name, const DXGI_SURFACE_DESC &desc, UINT num_mipmaps=1) |
Create a new render_target in the gbuffer. These functions basically forward parameters to the render_target's create function. | |
void | add_depth (const tstring &name, DXGI_SURFACE_DESC desc) |
Create a new render_target in the gbuffer. These functions basically forward parameters to the render_target's create function. | |
render_target * | operator[] (const tstring &name) |
Fetch a render_target with its name. | |
const render_target * | operator[] (const tstring &name) const |
Fetch a render_target with its name. | |
Public Member Functions inherited from dune::shader_resource | |
virtual void | to_cs (ID3D11DeviceContext *context, UINT slot) |
Upload the shader resource to register slot of a compute shader. | |
Protected Member Functions | |
void | init () |
Initializes a Kinect camera. | |
void | shutdown () |
Stops the Kinect thread and shuts down the Kinect. | |
void | update_depth (ID3D11DeviceContext *context) |
Map and update the depth render_target GPU memory from the CPU copy. | |
void | update_color (ID3D11DeviceContext *context) |
Map and update the color render_target GPU memory from the CPU copy. | |
void | copy_buffer (DATA_TYPE type) |
Copies over NUI_IMAGE_FRAMEs to render_targets. More... | |
void | lock (DATA_TYPE type) |
Lock a buffer type. | |
void | unlock (DATA_TYPE type) |
Unlock a buffer type. | |
Protected Member Functions inherited from dune::gbuffer | |
void | srvs (srv_vec &srv_array) |
Fill up a vector of ID3D11ShaderResourceView with the SRVs of all render_target objects in this gbuffer. | |
render_target * | target (const tstring &name) |
Return a named target. | |
const render_target * | target (const tstring &name) const |
Return a named target. | |
Static Protected Member Functions | |
static DWORD WINAPI | thread (LPVOID) |
The thread which updates render_targets from the Kinect API. | |
A GBuffer fed from a Kinect camera.
The kinect_gbuffer is a regular Geometry Buffer which is fed from a Kinect camera. It has two targets for depth and colors. When passing this buffer to a deferred renderer, it will not notice the difference to a regular GBuffer and can therefore render for instance post-processing effects as usual.
kinect_gbuffer objects work with a two step update model with pull mechanics. A thread is spawned which copies images received from the Kinect into two internal render_target objects. Once the render_target objects are written to, flags are raised to indicate this to other threads. The application thread calls the update method to pull data over into the gbuffer objects. This is neccessary to be able to update buffers without managing two D3D context objects in a multithreading environment, because GBuffers under normal circumstances can only be accessed in the same thread as the renderer.
|
protected |
Copies over NUI_IMAGE_FRAMEs to render_targets.
Calling this method with a type will copy over a NUI_IMAGE_FRAME to a render_target's CPU bound buffer.
type | The type of the buffer to copy: color or depth. |
References color(), dune::render_target::data(), depth(), lock(), dune::gbuffer::target(), and unlock().
Referenced by thread().