The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
common_gui.h
Go to the documentation of this file.
1 /*
2  * The Dirtchamber - Tobias Alexander Franke 2013
3  * For copyright and license see LICENSE
4  * http://www.tobias-franke.eu
5  */
6 
9 #ifndef COMMON_GUI_H
10 #define COMMON_GUI_H
11 
12 #undef NOMINMAX
13 #include <DXUT.h>
14 #include <DXUTgui.h>
15 
16 #include "idc.h"
17 
18 #include "pppipe.h"
19 
21 #include <dune/light.h>
23 #include <dune/composite_mesh.h>
24 
25 #include <dune/deferred_renderer.h>
26 #include <dune/serializer.h>
27 
28 typedef void(*save_func)(dune::serializer& s);
29 typedef void(*load_func)(dune::serializer& t);
30 
31 namespace dc
32 {
33  namespace gui
34  {
35  extern CDXUTDialog hud;
36  extern CDXUTDialog hud_light;
37  extern CDXUTDialog hud_gi;
38  extern CDXUTDialog hud_postp1;
39  extern CDXUTDialog hud_postp2;
40  extern CDXUTDialogResourceManager dlg_manager;
41  extern CDXUTComboBox* combo_render_targets;
42  extern CDXUTComboBox* combo_settings;
43 
45  int init(PCALLBACKDXUTGUIEVENT f, int spacing = 18, UINT ewidth = 160, UINT eheight = 22);
46 
48  void update(dune::deferred_renderer* renderer);
49 
51  void select_hud();
52 
54 
55  LRESULT CALLBACK on_msg(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool *pbNoFurtherProcessing, void *pUserContext);
56  void CALLBACK on_resize(ID3D11Device* pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext);
57  void CALLBACK on_event(UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext);
58  void CALLBACK on_render(ID3D11Device* device, ID3D11DeviceContext* context, double fTime, float fElapsedTime, void* pUserContext);
60 
62  void toggle();
63 
65 
66  bool checkbox_value(int idc);
67  float slider_value(int idc, int mi, int ma);
68  float slider_value(int idc, bool normalize = false);
70 
72 
73  void set_text(int idc, LPCWSTR text);
74  void set_checkbox_value(int idc, bool v);
75  void set_checkbox_value(int idc, BOOL v);
76  void set_slider_value(int idc, int mi, int ma, float v);
77  void set_slider_value(int idc, float v, bool normalized = false);
79 
81 
102  bool save_settings(save_func f = nullptr);
103  bool load_settings(load_func f = nullptr);
105 
107 
108  void get_parameters(pppipe& ppp);
109  void set_parameters(const pppipe& ppp);
111 
113 
114  void get_parameters(dune::directional_light& main_light, dune::d3d_mesh& scene, float z_near, float z_far);
115  void set_parameters(const dune::directional_light& main_light, dune::d3d_mesh& scene, float z_near, float z_far);
117 
119 
120  void get_parameters(dune::light_propagation_volume& lpv);
121  void set_parameters(const dune::light_propagation_volume& lpv);
123 
125 
126  void get_parameters(dune::sparse_voxel_octree& svo);
127  void set_parameters(const dune::sparse_voxel_octree& svo);
129  }
130 }
131 
132 #endif
Seralizer to read/write Dune objects from/into JSON/XML.
Definition: serializer.h:41
The deferred renderer base class.
Definition: deferred_renderer.h:40
A Light Propagation Volume.
Definition: light_propagation_volume.h:32
HRESULT CALLBACK on_resize(ID3D11Device *pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC *pBackBufferSurfaceDesc, void *pUserContext)
Default implementation of DXUT callbacks common to all render samples.
Definition: common_dxut.cpp:37
A simple directional light source with an RSM.
Definition: light.h:28
LRESULT CALLBACK on_msg(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool *pbNoFurtherProcessing, void *pUserContext)
Default implementation of DXUT callbacks common to all render samples.
Definition: common_dxut.cpp:55
void CALLBACK on_render(ID3D11Device *device, ID3D11DeviceContext *context, double fTime, float fElapsedTime, void *pUserContext)
Default implementation of DXUT callbacks common to all render samples.
Definition: common_dxut.cpp:26
A default implementation of the postprocessor.
Definition: pppipe.h:27
Main D3D mesh interface class.
Definition: mesh.h:129
A sparse voxel octree (SVO).
Definition: sparse_voxel_octree.h:42