Ocular Engine
D3D11RenderState.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_GRAPHICS_D3D11_RENDER_STATE__H__
19 #define __H__OCULAR_GRAPHICS_D3D11_RENDER_STATE__H__
20 
21 #include "Graphics/RenderState/RenderState.hpp"
22 #include <d3d11.h>
23 
24 //------------------------------------------------------------------------------------------
25 
30 namespace Ocular
31 {
36  namespace Graphics
37  {
42  {
43  public:
44 
45  D3D11RenderState(ID3D11Device* device, ID3D11DeviceContext* context);
46  virtual ~D3D11RenderState();
47 
48  virtual void bind() override;
49  virtual void setDepthStencilState(DepthStencilState const& state) override;
50 
51  ID3D11RasterizerState* getD3DRasterizerState();
52  ID3D11DepthStencilState* getD3DDepthStencilState();
53  ID3D11BlendState* getD3DBlendState();
54 
55  D3D11_PRIMITIVE_TOPOLOGY getD3DPrimitiveTopology();
56 
57  protected:
58 
59  bool createD3DRasterizerState();
60  bool createD3DDepthStencilState();
61  bool createD3DBlendState();
62 
63  D3D11_RASTERIZER_DESC createRenderStateDescr();
64  D3D11_DEPTH_STENCIL_DESC createDepthStencilStateDescr();
65  D3D11_BLEND_DESC createBlendStateDescr();
66 
67  D3D11_BLEND convertBlendType(BlendType type) const;
68  D3D11_BLEND_OP convertBlendEquation(BlendEquation equation) const;
69  D3D11_STENCIL_OP convertStencilOperation(StencilOperation operation) const;
70  D3D11_COMPARISON_FUNC convertDepthStencilComparison(DepthStencilComparison comparison) const;
71 
72  //------------------------------------------------------------
73 
74  ID3D11Device* m_D3DDevice;
75  ID3D11DeviceContext* m_D3DDeviceContext;
76  ID3D11RasterizerState* m_D3DRasterizerState;
77  ID3D11DepthStencilState* m_D3DDepthStencilState;
78  ID3D11BlendState* m_D3DBlendState;
79  D3D11_PRIMITIVE_TOPOLOGY m_D3DPrimitiveTopology;
80 
81  private:
82  };
83  }
87 }
92 //------------------------------------------------------------------------------------------
93 
94 #endif
virtual void setDepthStencilState(DepthStencilState const &state) override
Definition: D3D11RenderState.cpp:108
Definition: D3D11RenderState.hpp:41
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: RenderState.hpp:42
Definition: DepthStencilState.hpp:113
virtual void bind() override
Definition: D3D11RenderState.cpp:68