BlockData.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef __BLOCKDATA_HPP__
  2. #define __BLOCKDATA_HPP__
  3. #include <condition_variable>
  4. #include <future>
  5. #include <memory>
  6. #include <mutex>
  7. #include <stdint.h>
  8. #include <stdio.h>
  9. #include <vector>
  10. #include "Bitmap.hpp"
  11. #include "ForceInline.hpp"
  12. #include "Vector.hpp"
  13. class BlockData
  14. {
  15. public:
  16. enum Type
  17. {
  18. Etc1,
  19. Etc2_RGB,
  20. Etc2_RGBA,
  21. Dxt1,
  22. Dxt5
  23. };
  24. BlockData( const char* fn );
  25. BlockData( const char* fn, const v2i& size, bool mipmap, Type type );
  26. BlockData( const v2i& size, bool mipmap, Type type );
  27. ~BlockData();
  28. BitmapPtr Decode();
  29. void Process( const uint32_t* src, uint32_t blocks, size_t offset, size_t width, Channels type, bool dither );
  30. void ProcessRGBA( const uint32_t* src, uint32_t blocks, size_t offset, size_t width );
  31. const v2i& Size() const { return m_size; }
  32. private:
  33. etcpak_no_inline BitmapPtr DecodeRGB();
  34. etcpak_no_inline BitmapPtr DecodeRGBA();
  35. etcpak_no_inline BitmapPtr DecodeDxt1();
  36. etcpak_no_inline BitmapPtr DecodeDxt5();
  37. uint8_t* m_data;
  38. v2i m_size;
  39. size_t m_dataOffset;
  40. FILE* m_file;
  41. size_t m_maplen;
  42. Type m_type;
  43. };
  44. typedef std::shared_ptr<BlockData> BlockDataPtr;
  45. #endif