BsTextureImportOptions.h 2.5 KB

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