The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
camera.h
Go to the documentation of this file.
1 /*
2  * Dune D3D library - Tobias Alexander Franke 2014
3  * For copyright and license see LICENSE
4  * http://www.tobias-franke.eu
5  */
6 
9 #ifndef DUNE_CAMERA
10 #define DUNE_CAMERA
11 
12 #undef NOMINMAX
13 #include <DXUT.h>
14 #include <DXUTcamera.h>
15 
16 #include "cbuffer.h"
17 
18 namespace dune
19 {
26  class camera : public CFirstPersonCamera
27  {
28  public:
29  struct param
30  {
31  DirectX::XMFLOAT4X4 vp;
32  DirectX::XMFLOAT4X4 vp_inv;
33  DirectX::XMFLOAT3 camera_pos;
34  FLOAT z_far;
35  };
36 
37  protected:
38  typedef cbuffer<param> cb_param;
39  cb_param cb_param_;
40 
41  public:
42  void create(ID3D11Device* device);
43  void destroy();
44 
46 
47  cb_param& parameters() { return cb_param_; }
48  const cb_param& parameters() const { return cb_param_; }
50 
52  void update(float z_far);
53  };
54 }
55 
56 #endif
cb_param & parameters()
Return local cbuffer parameters.
Definition: camera.h:47
void update(float z_far)
Update the constant buffer from the current values of the camera and a supplied Z-far.
Definition: camera.cpp:21
const cb_param & parameters() const
Return local cbuffer parameters.
Definition: camera.h:48
A simple perspective camera.
Definition: camera.h:26