-
Notifications
You must be signed in to change notification settings - Fork 2
mmp
aspadm edited this page Jul 11, 2018
·
2 revisions
Packed texture file with MIP-map support
File contain one header with this structure:
struct Header
{
uint magic; // 4D 4D 50 00
uint width;
uint height;
uint mip_count;
uint format;
uint bit_count;
struct Channel a_format, r_format, g_format, b_format;
uint offset
};
a_format, r_format, g_format, b_format
- specification of ARGB pixel structure:
struct Channel
{
uint mask;
uint shift;
uint count;
};
format
value can be one of this:
format | description |
---|---|
44 44 00 00 | ARGB4 |
44 58 54 31 | DXT1 |
44 58 54 33 | DXT3 |
50 4E 54 33 | PNT3 - RLE encoded ARGB8 |
50 56 00 00 | R5G5B5 |
51 55 00 00 | A1R5G5B5 |
88 88 00 00 | ARGB8 |
After header lay image data: zero mip level, second etc.
If format of image is PNT3, pixel structure equal to 0; bit_count = compressed image size in bytes. Uncompressed size is 4 * H * W.
PNT3 decoding:
if uint number is 0 or 1000000, skip this 4 bytes and increase count, else copy count bytes and reset counter.