DX11Texture.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "Critical.h"
  3. #include "Texture.h"
  4. struct ID3D11Texture2D;
  5. struct ID3D11ShaderResourceView;
  6. struct ID3D11Device;
  7. struct ID3D11DeviceContext;
  8. namespace Framework
  9. {
  10. class DX11Texture : public Texture
  11. {
  12. private:
  13. ID3D11Texture2D* txt;
  14. ID3D11ShaderResourceView* view;
  15. ID3D11Device* device;
  16. ID3D11DeviceContext* context;
  17. bool useMips;
  18. Critical& deviceLock;
  19. ID3D11Texture2D* readAccessTexture;
  20. public:
  21. DLLEXPORT DX11Texture(ID3D11Device* device,
  22. ID3D11DeviceContext* context,
  23. Critical& deviceLock,
  24. TextureDirection dir);
  25. DLLEXPORT ~DX11Texture();
  26. //! Updates the texture. The pixels of the current image are copied
  27. //! to graphics memory
  28. DLLEXPORT bool updateTextur() override;
  29. //! Returns true if updateTextur needs to be called
  30. DLLEXPORT bool needsUpdate() const override;
  31. //! Returns the used shader resource view
  32. DLLEXPORT operator ID3D11ShaderResourceView*() const;
  33. //! Returns the used texture
  34. DLLEXPORT operator ID3D11Texture2D*() const;
  35. //! specifies if a mip map should be generated
  36. DLLEXPORT void setUseMips(bool useMips);
  37. };
  38. } // namespace Framework