Ocular Engine
D3D11Material.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_D3D11_MATERIAL__H__
19 #define __H__OCULAR_D3D11_MATERIAL__H__
20 
21 #include "Graphics/Material/Material.hpp"
22 #include <d3d11.h>
23 #include <vector>
24 
25 //------------------------------------------------------------------------------------------
26 
31 namespace Ocular
32 {
37  namespace Graphics
38  {
42  class D3D11Material : public Material
43  {
44  public:
45 
46  D3D11Material(ID3D11DeviceContext* context);
47  virtual ~D3D11Material();
48 
49  virtual void bind() override;
50  virtual void unbind() override;
51 
52  virtual bool setTexture(uint32_t index, std::string const& name, Texture* texture) override;
53  virtual void removeTexture(uint32_t index) override;
54 
55  protected:
56 
57  void createSampler();
58 
59  void bindTextures();
60  void unbindTextures();
61 
62  //------------------------------------------------------------
63 
64  ID3D11DeviceContext* m_D3DDeviceContext;
65  ID3D11SamplerState* m_D3DSampler;
66 
67  std::vector<ID3D11ShaderResourceView*> m_ShaderResourceViews; // Array of ShaderResourceView objects to pass to the shaders.
68  std::vector<ID3D11ShaderResourceView*> m_NullShaderResourceViews; // Used when unbinding textures
69 
70  private:
71  };
72  }
76 }
81 //------------------------------------------------------------------------------------------
82 
83 #endif
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: D3D11Material.hpp:42
virtual void removeTexture(uint32_t index) override
Definition: D3D11Material.cpp:110
virtual bool setTexture(uint32_t index, std::string const &name, Texture *texture) override
Definition: D3D11Material.cpp:75
Definition: Material.hpp:62
Base class for all texture objects.
Definition: Texture.hpp:45