forked from metin-server/m2dev-client-src
- Stores decoded pixel data ready for GPU upload - Supports RGBA8, RGB8, and DDS formats - Separates CPU decoding from GPU upload phases
60 lines
912 B
C++
60 lines
912 B
C++
#ifndef __INC_ETERLIB_DECODEDIMAGEDATA_H__
|
|
#define __INC_ETERLIB_DECODEDIMAGEDATA_H__
|
|
|
|
#include <vector>
|
|
#include <cstdint>
|
|
#include <d3d9.h>
|
|
|
|
// Decoded image data for GPU upload
|
|
struct TDecodedImageData
|
|
{
|
|
enum EFormat
|
|
{
|
|
FORMAT_UNKNOWN = 0,
|
|
FORMAT_RGBA8,
|
|
FORMAT_RGB8,
|
|
FORMAT_DDS,
|
|
};
|
|
|
|
std::vector<uint8_t> 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__
|