Texture.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include "anki/gr/GrObject.h"
  7. namespace anki {
  8. /// @addtogroup graphics
  9. /// @{
  10. /// Sampler initializer.
  11. class SamplerInitializer
  12. {
  13. public:
  14. SamplingFilter m_minMagFilter = SamplingFilter::NEAREST;
  15. SamplingFilter m_mipmapFilter = SamplingFilter::BASE;
  16. CompareOperation m_compareOperation = CompareOperation::ALWAYS;
  17. F32 m_minLod = -1000.0;
  18. F32 m_maxLod = 1000.0;
  19. I8 m_anisotropyLevel = 0;
  20. Bool8 m_repeat = true;
  21. };
  22. /// Texture initializer.
  23. class TextureInitializer
  24. {
  25. public:
  26. TextureType m_type = TextureType::_2D;
  27. U32 m_width = 0;
  28. U32 m_height = 0;
  29. U32 m_depth = 0; ///< Relevant only for 3D, 2DArray and CubeArray textures
  30. PixelFormat m_format;
  31. U8 m_mipmapsCount = 0;
  32. U8 m_samples = 1;
  33. SamplerInitializer m_sampling;
  34. };
  35. /// GPU texture
  36. class Texture: public GrObject
  37. {
  38. public:
  39. /// Construct.
  40. Texture(GrManager* manager);
  41. /// Destroy.
  42. ~Texture();
  43. /// Access the implementation.
  44. TextureImpl& getImplementation()
  45. {
  46. return *m_impl;
  47. }
  48. /// Create it.
  49. void create(const TextureInitializer& init);
  50. private:
  51. UniquePtr<TextureImpl> m_impl;
  52. };
  53. /// @}
  54. } // end namespace anki