Texture.pkg 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. $#include "Texture.h"
  2. /// Base class for texture resources.
  3. class Texture : public Resource
  4. {
  5. public:
  6. /// Set number of requested mip levels. Needs to be called before setting size.
  7. void SetNumLevels(unsigned levels);
  8. /// Set filtering mode.
  9. void SetFilterMode(TextureFilterMode filter);
  10. /// Set addressing mode by texture coordinate.
  11. void SetAddressMode(TextureCoordinate coord, TextureAddressMode address);
  12. /// Set border color for border addressing mode.
  13. void SetBorderColor(const Color& color);
  14. /// Set sRGB sampling and writing mode.
  15. void SetSRGB(bool enable);
  16. /// Set backup texture to use when rendering to this texture.
  17. void SetBackupTexture(Texture* texture);
  18. /// Return texture format.
  19. unsigned GetFormat() const;
  20. /// Return whether the texture format is compressed.
  21. bool IsCompressed() const;
  22. /// Return number of mip levels.
  23. unsigned GetLevels() const;
  24. /// Return width.
  25. int GetWidth() const;
  26. /// Return height.
  27. int GetHeight() const;
  28. /// Return filtering mode.
  29. TextureFilterMode GetFilterMode() const;
  30. /// Return addressing mode by texture coordinate.
  31. TextureAddressMode GetAddressMode(TextureCoordinate coord) const;
  32. /// Return border color.
  33. const Color& GetBorderColor() const;
  34. /// Return whether is using sRGB sampling and writing.
  35. bool GetSRGB() const;
  36. /// Return backup texture.
  37. Texture* GetBackupTexture() const;
  38. /// Return mip level width, or 0 if level does not exist.
  39. int GetLevelWidth(unsigned level) const;
  40. /// Return mip level width, or 0 if level does not exist.
  41. int GetLevelHeight(unsigned level) const;
  42. /// Return texture usage type.
  43. TextureUsage GetUsage() const;
  44. /// Return data size in bytes for a rectangular region.
  45. unsigned GetDataSize(int width, int height) const;
  46. /// Return data size in bytes for a pixel or block row.
  47. unsigned GetRowDataSize(int width) const;
  48. };