BsTextureImportOptions.h 2.7 KB

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