28.12.2009, 05:22
Код:
// signature
#define MMP_SIGNATURE ((DWORD)0x00504D4D)
// formats
#define MMP_FORMAT_5650 ((DWORD)0x5650)
#define MMP_FORMAT_5550 ((DWORD)0x5550)
#define MMP_FORMAT_5551 ((DWORD)0x5551)
#define MMP_FORMAT_4444 ((DWORD)0x4444)
#define MMP_FORMAT_8888 ((DWORD)0x8888)
#define MMP_FORMAT_DXT1 ((DWORD)0x31545844)
#define MMP_FORMAT_DXT2 ((DWORD)0x32545844)
#define MMP_FORMAT_DXT3 ((DWORD)0x33545844)
#define MMP_FORMAT_DXT4 ((DWORD)0x34545844)
#define MMP_FORMAT_DXT5 ((DWORD)0x35545844)
#define MMP_FORMAT_DXTN ((DWORD)0x00545844)
#define MMP_FORMAT_PAINT ((DWORD)0x00544E50)
#define MMP_FORMAT_PAINT32 ((DWORD)0x32544E50)
#define MMP_FORMAT_PNT3 ((DWORD)0x33544E50)
// bit depthes for appropriate formats
#define MMP_BIT_DEPTH_5650 ((DWORD)16)
#define MMP_BIT_DEPTH_5551 ((DWORD)16)
#define MMP_BIT_DEPTH_4444 ((DWORD)16)
#define MMP_BIT_DEPTH_8888 ((DWORD)32)
#define MMP_BIT_DEPTH_DXT1 ((DWORD)4)
#define MMP_BIT_DEPTH_DXT2 ((DWORD)8)
#define MMP_BIT_DEPTH_DXT3 ((DWORD)8)
#define MMP_BIT_DEPTH_DXT4 ((DWORD)8)
#define MMP_BIT_DEPTH_DXT5 ((DWORD)8)
#define MMP_BIT_DEPTH_PAINT ((DWORD)24)
#define MMP_BIT_DEPTH_PAINT32 ((DWORD)32)
#define MMP_BIT_DEPTH_PNT3 ((DWORD)32)
struct SMMPFileHeader
{
public :
// general header information
DWORD dwSignature; // see signature constant above
DWORD dwDimentionX; // x-dimention of the top-level mip object
DWORD dwDimentionY; // y-dimention of the top-level mip object
union
{
DWORD dwMipMapLevel; // number of mip-map levels
DWORD dwLinearSize; // linear size of compresed PNT3 format
};
// format info
// general format info
DWORD dwFormat; // format type (see format constants above)
DWORD dwBitDepth; // bit depth (see bit depth constants above)
// masks (for RGBA formats it can be applied to each pixel, for FOURCC formats if can be applied for color_0...color_1)
// alpha mask info
DWORD dwAMask; // mask
DWORD dwAShift; // shift
DWORD dwABits; // bits
// red mask info
DWORD dwRMask; // mask
DWORD dwRShift; // shift
DWORD dwRBits; // bits
// green mask info
DWORD dwGMask; // mask
DWORD dwGShift; // shift
DWORD dwGBits; // bits
// blue mask info
DWORD dwBMask; // mask
DWORD dwBShift; // shift
DWORD dwBBits; // bits
//
DWORD dwUserDataShift; // number of bytes to shift from the header to get to mmp data
};
Добавил: Robin [mergetime]1261963327[/mergetime]
Сто раз уже это обмусоливали.