Ocular Engine
D3D11Texture.hpp
1 
17 #pragma once
18 #ifndef __OCULAR_D3D11_TEXTURE__H__
19 #define __OCULAR_D3D11_TEXTURE__H__
20 
21 #include <d3d11.h>
22 
23 //------------------------------------------------------------------------------------------
24 
29 namespace Ocular
30 {
35  namespace Graphics
36  {
43  {
44  public:
45 
46  D3D11Texture(ID3D11Device* device);
47  virtual ~D3D11Texture();
48 
49  ID3D11Texture2D* getD3DTexture2D();
50  ID3D11ShaderResourceView* getD3DShaderResource();
51 
52  protected:
53 
54  virtual bool createD3DTexture2D(TextureDescriptor const& descriptor);
55  virtual bool createD3DShaderResource(TextureDescriptor const& descriptor);
56 
61  void refresh(std::vector<Core::Color>& pixels, Graphics::TextureDescriptor const& descriptor);
62 
63 
64  //------------------------------------------------------------
65 
66  ID3D11Device* m_D3DDevice;
67  ID3D11Texture2D* m_D3DTexture;
68  ID3D11ShaderResourceView* m_D3DShaderResourceView;
69  DXGI_FORMAT m_D3DFormat;
70 
71  private:
72 
76  ID3D11Texture2D* createStagingTexture();
77 
81  void copyData(void const* source, void* dest, uint32_t const sourceWidth, uint32_t const destWidth, uint32_t const height);
82 
86  void copyToPixels4(uint8_t const* source, std::vector<Core::Color>& dest, Graphics::TextureDescriptor const& descriptor);
87 
91  void copyToPixels8(uint8_t const* source, std::vector<Core::Color>& dest, Graphics::TextureDescriptor const& descriptor);
92 
96  void copyToPixels16(uint8_t const* source, std::vector<Core::Color>& dest, Graphics::TextureDescriptor const& descriptor);
97  };
98  }
102 }
107 //------------------------------------------------------------------------------------------
108 
109 #endif
void refresh(std::vector< Core::Color > &pixels, Graphics::TextureDescriptor const &descriptor)
Definition: D3D11Texture.cpp:142
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: TextureDescriptor.hpp:45
Definition: D3D11Texture.hpp:42