DX11Texture.h 1.2 KB

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