Add ddsinfo utility.
This commit is contained in:
@ -140,7 +140,7 @@ DDSHeader::DDSHeader()
|
||||
|
||||
// Store version information on the reserved header attributes.
|
||||
this->reserved[9] = MAKEFOURCC('N', 'V', 'T', 'T');
|
||||
this->reserved[10] = (0 << 16) | (1 << 8) | (0); // major.minor.revision
|
||||
this->reserved[10] = (0 << 16) | (9 << 8) | (3); // major.minor.revision
|
||||
|
||||
this->pf.size = 32;
|
||||
this->pf.flags = 0;
|
||||
@ -682,4 +682,72 @@ uint DirectDrawSurface::offset(const uint face, const uint mipmap)
|
||||
}
|
||||
|
||||
|
||||
void DirectDrawSurface::printInfo() const
|
||||
{
|
||||
printf("Flags: 0x%.8X\n", header.flags);
|
||||
if (header.flags & DDSD_CAPS) printf("\tDDSD_CAPS\n");
|
||||
if (header.flags & DDSD_PIXELFORMAT) printf("\tDDSD_PIXELFORMAT\n");
|
||||
if (header.flags & DDSD_WIDTH) printf("\tDDSD_WIDTH\n");
|
||||
if (header.flags & DDSD_HEIGHT) printf("\tDDSD_HEIGHT\n");
|
||||
if (header.flags & DDSD_DEPTH) printf("\tDDSD_DEPTH\n");
|
||||
if (header.flags & DDSD_PITCH) printf("\tDDSD_PITCH\n");
|
||||
if (header.flags & DDSD_LINEARSIZE) printf("\tDDSD_LINEARSIZE\n");
|
||||
if (header.flags & DDSD_MIPMAPCOUNT) printf("\tDDSD_MIPMAPCOUNT\n");
|
||||
|
||||
printf("Height: %d\n", header.height);
|
||||
printf("Width: %d\n", header.width);
|
||||
printf("Depth: %d\n", header.depth);
|
||||
if (header.flags & DDSD_PITCH) printf("Pitch: %d\n", header.pitch);
|
||||
else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %d\n", header.pitch);
|
||||
printf("Mipmap count: %d\n", header.mipmapcount);
|
||||
|
||||
printf("Pixel Format:\n");
|
||||
printf("\tFlags: 0x%.8X\n", header.pf.flags);
|
||||
if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n");
|
||||
if (header.pf.flags & DDPF_FOURCC) printf("\t\tDDPF_FOURCC\n");
|
||||
if (header.pf.flags & DDPF_ALPHAPIXELS) printf("\t\tDDPF_ALPHAPIXELS\n");
|
||||
if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
|
||||
|
||||
printf("\tFourCC: '%c%c%c%c'\n", ((header.pf.fourcc >> 0) & 0xFF), ((header.pf.fourcc >> 8) & 0xFF), ((header.pf.fourcc >> 16) & 0xFF), ((header.pf.fourcc >> 24) & 0xFF));
|
||||
printf("\tBit count: %d\n", header.pf.bitcount);
|
||||
printf("\tRed mask: 0x%.8X\n", header.pf.rmask);
|
||||
printf("\tGreen mask: 0x%.8X\n", header.pf.gmask);
|
||||
printf("\tBlue mask: 0x%.8X\n", header.pf.bmask);
|
||||
printf("\tAlpha mask: 0x%.8X\n", header.pf.amask);
|
||||
|
||||
printf("Caps:\n");
|
||||
printf("\tCaps 1: 0x%.8X\n", header.caps.caps1);
|
||||
if (header.caps.caps1 & DDSCAPS_COMPLEX) printf("\t\tDDSCAPS_COMPLEX\n");
|
||||
if (header.caps.caps1 & DDSCAPS_TEXTURE) printf("\t\tDDSCAPS_TEXTURE\n");
|
||||
if (header.caps.caps1 & DDSCAPS_MIPMAP) printf("\t\tDDSCAPS_MIPMAP\n");
|
||||
|
||||
printf("\tCaps 2: 0x%.8X\n", header.caps.caps2);
|
||||
if (header.caps.caps2 & DDSCAPS2_VOLUME) printf("\t\tDDSCAPS2_VOLUME\n");
|
||||
else if (header.caps.caps2 & DDSCAPS2_CUBEMAP)
|
||||
{
|
||||
printf("\t\tDDSCAPS2_CUBEMAP\n");
|
||||
if ((header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) == DDSCAPS2_CUBEMAP_ALL_FACES) printf("\t\tDDSCAPS2_CUBEMAP_ALL_FACES\n");
|
||||
else {
|
||||
if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEX) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEX\n");
|
||||
if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEX\n");
|
||||
if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEY) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEY\n");
|
||||
if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEY\n");
|
||||
if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEZ\n");
|
||||
if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEZ\n");
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tCaps 3: 0x%.8X\n", header.caps.caps3);
|
||||
printf("\tCaps 4: 0x%.8X\n", header.caps.caps4);
|
||||
|
||||
if (header.reserved[9] == MAKEFOURCC('N', 'V', 'T', 'T'))
|
||||
{
|
||||
int major = (header.reserved[10] >> 16) & 0xFF;
|
||||
int minor = (header.reserved[10] >> 8) & 0xFF;
|
||||
int revision= header.reserved[10] & 0xFF;
|
||||
|
||||
printf("Version:\n");
|
||||
printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user