diff --git a/src/EterLib/DecodedImageData.h b/src/EterLib/DecodedImageData.h new file mode 100644 index 0000000..a5dcee7 --- /dev/null +++ b/src/EterLib/DecodedImageData.h @@ -0,0 +1,59 @@ +#ifndef __INC_ETERLIB_DECODEDIMAGEDATA_H__ +#define __INC_ETERLIB_DECODEDIMAGEDATA_H__ + +#include +#include +#include + +// Decoded image data for GPU upload +struct TDecodedImageData +{ + enum EFormat + { + FORMAT_UNKNOWN = 0, + FORMAT_RGBA8, + FORMAT_RGB8, + FORMAT_DDS, + }; + + std::vector pixels; + int width; + int height; + EFormat format; + D3DFORMAT d3dFormat; + bool isDDS; + int mipLevels; + + TDecodedImageData() + : width(0) + , height(0) + , format(FORMAT_UNKNOWN) + , d3dFormat(D3DFMT_UNKNOWN) + , isDDS(false) + , mipLevels(1) + { + } + + void Clear() + { + pixels.clear(); + width = 0; + height = 0; + format = FORMAT_UNKNOWN; + d3dFormat = D3DFMT_UNKNOWN; + isDDS = false; + mipLevels = 1; + } + + bool IsValid() const + { + return width > 0 && height > 0 && !pixels.empty(); + } + + size_t GetDataSize() const + { + return pixels.size(); + } +}; + +#endif // __INC_ETERLIB_DECODEDIMAGEDATA_H__