BsTextureImportOptions.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsImportOptions.h"
  4. #include "BsPixelUtil.h"
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup Importer
  8. * @{
  9. */
  10. /** Contains import options you may use to control how is a texture imported. */
  11. class BS_CORE_EXPORT TextureImportOptions : public ImportOptions
  12. {
  13. public:
  14. TextureImportOptions();
  15. /** Sets the pixel format to import as. */
  16. void setFormat(PixelFormat format) { mFormat = format; }
  17. /** Enables or disables mipmap generation for the texture. */
  18. void setGenerateMipmaps(bool generate) { mGenerateMips = generate; }
  19. /**
  20. * Sets the maximum mip level to generate when generating mipmaps. If 0 then maximum amount of mip levels will be
  21. * generated.
  22. */
  23. void setMaxMip(UINT32 maxMip) { mMaxMip = maxMip; }
  24. /** Sets whether the texture data is also stored in main memory, available for fast CPU access. */
  25. void setCPUReadable(bool readable) { mCPUReadable = readable; }
  26. /**
  27. * Sets whether the texture data should be treated as if its in sRGB (gamma) space. Such texture will be converted
  28. * by hardware to linear space before use on the GPU.
  29. */
  30. void setSRGB(bool sRGB) { mSRGB = sRGB; }
  31. /** Gets the pixel format to import as. */
  32. PixelFormat getFormat() const { return mFormat; }
  33. /** Checks will be imported texture have automatically generated mipmaps. */
  34. bool getGenerateMipmaps() const { return mGenerateMips; }
  35. /**
  36. * Gets the maximum mip level to generate when generating mipmaps. If 0 then maximum amount of mip levels will be
  37. * generated.
  38. */
  39. UINT32 getMaxMip() const { return mMaxMip; }
  40. /** Retrieves whether the texture data is also stored in main memory, available for fast CPU access. */
  41. bool getCPUReadable() const { return mCPUReadable; }
  42. /**
  43. * Retrieves whether the texture data should be treated as if its in sRGB (gamma) space. Such texture will be
  44. * converted by hardware to linear space before use on the GPU.
  45. */
  46. bool getSRGB() const { return mSRGB; }
  47. /************************************************************************/
  48. /* SERIALIZATION */
  49. /************************************************************************/
  50. public:
  51. friend class TextureImportOptionsRTTI;
  52. static RTTITypeBase* getRTTIStatic();
  53. virtual RTTITypeBase* getRTTI() const override;
  54. private:
  55. PixelFormat mFormat;
  56. bool mGenerateMips;
  57. UINT32 mMaxMip;
  58. bool mCPUReadable;
  59. bool mSRGB;
  60. };
  61. /** @} */
  62. }