For fun, I wrote an 010 Template to look at the .dds headers...
Technical File Info
//--------------------------------------
//--- 010 Editor v2.1.3 Binary Template
//
// File: DDS file
// Author: Glen Rickey
// Revision: 0.01
// Purpose: Parse DDS file headers only... possible eventual pixeldata conversion
// Comments mostly from Microsoft MSDN reference docs
//--------------------------------------
struct ddsFile {
struct DDSSURFACEDESC2
{
char MagicFourCC[4]; // "DDS "
DWORD dwSize; //size of header: always 124
/*
DDSD_CAPS =0x00000001
DDSD_HEIGHT = 0x00000002
DDSD_WIDTH = 0x00000004
DDSD_PITCH = 0x00000008
DDSD_PIXELFORMAT = 0x00001000
DDSD_MIPMAPCOUNT = 0x00020000
DDSD_LINEARSIZE = 0x00080000
DDSD_DEPTH = 0x00800000
*/
// 100010100001000000001111
struct DDSD
{
DWORD DDSD_CAPS :1;
DWORD DDSD_HEIGHT :1;
DWORD DDSD_WIDTH :1;
DWORD DDSD_PITCH :1;
DWORD :8;
DWORD DDSD_PIXELFORMAT:1;
DWORD :4;
DWORD DDSD_MIPMAPCOUNT:1;
DWORD :1;
DWORD DDSD_LINEARSIZE:1;
DWORD :3;
DWORD DDSD_DEPTH:1;
} dwFlags;
//DSDDCAPS dwFlags; //flags... use enum, some must always be set.
DWORD dwHeight; //height in pixels
DWORD dwWidth; //width in pixels
DWORD dwPitchOrLinearSize; //For uncompressed formats, this is the number of bytes per scan line (DWORD> aligned) for the main image. dwFlags should include DDSD_PITCH in this case. For compressed formats, this is the total number of bytes for the main image. dwFlags should be include DDSD_LINEARSIZE in this case.
DWORD dwDepth; //For volume textures, this is the depth of the volume. dwFlags should include DDSD_DEPTH in this case.
DWORD dwMipMapCount; //For items with mipmap levels, this is the total number of levels in the mipmap chain of the main image. dwFlags should include DDSD_MIPMAPCOUNT in this case.
DWORD dwReserved1[11]; // 11 Int32s
struct DDPIXELFORMAT
{
DWORD dwSize; //Size of structure. This member must be set to 32.
/*
DDPF_ALPHAPIXELS 0x00000001
DDPF_FOURCC 0x00000004
DDPF_RGB 0x00000040
*/
// 1000101
struct DDPF
{
DWORD DDPF_ALPHAPIXELS :1;
DWORD :1;
DWORD DDPF_FOURCC :1;
DWORD :3;
DWORD DDPF_RGB :1;
} dwFlags;
//DWORD dwFlags; //Flags to indicate valid fields. Uncompressed formats will usually use DDPF_RGB to indicate an RGB format, while compressed formats will use DDPF_FOURCC with a four-character code.
char dwFourCC[4]; //This is the four-character code for compressed formats. dwFlags should include DDPF_FOURCC in this case. For DXTn compression, this is set to "DXT1", "DXT2", "DXT3", "DXT4", or "DXT5".
DWORD dwRGBBitCount; //For RGB formats, this is the total number of bits in the format. dwFlags should include DDPF_RGB in this case. This value is usually 16, 24, or 32. For A8R8G8B8, this value would be 32.
DWORD dwRBitMask;
DWORD dwGBitMask;
DWORD dwBBitMask; //For RGB formats, these three fields contain the masks for the red, green, and blue channels. For A8R8G8B8, these values would be 0x00ff0000, 0x0000ff00, and 0x000000ff respectively.
DWORD dwRGBAlphaBitMask; //For RGB formats, this contains the mask for the alpha channel, if any. dwFlags should include DDPF_ALPHAPIXELS in this case. For A8R8G8B8, this value would be 0xff000000.
} ddPixelFormat;
struct DDCAPS2
{
/*
DDSCAPS_COMPLEX 0x00000008
DDSCAPS_TEXTURE 0x00001000
DDSCAPS_MIPMAP 0x00400000
*/
// 10000000001000000001000
//DWORD dwCaps1; //DDS files should always include DDSCAPS_TEXTURE. If the file contains mipmaps, DDSCAPS_MIPMAP should be set. For any DDS file with more than one main surface, such as a mipmaps, cubic environment map, or volume texture, DDSCAPS_COMPLEX should also be set.
struct DDSCAPS
{
DWORD :3;
DWORD DDSCAPS_COMPLEX :1;
DWORD :8;
DWORD DDSCAPS_TEXTURE :1;
DWORD :9;
DWORD DDSCAPS_MIPMAP :1;
} dwCaps1;
/*
DDSCAPS2_CUBEMAP 0x00000200
DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
DDSCAPS2_VOLUME 0x00200000
*/
// 1000001111111000000000
//DWORD dwCaps2; //For cubic environment maps, DDSCAPS2_CUBEMAP should be included as well as one or more faces of the map (DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, DDSCAPS2_CUBEMAP_NEGATIVEY, DDSCAPS2_CUBEMAP_POSITIVEZ, DDSCAPS2_CUBEMAP_NEGATIVEZ). For volume textures, DDSCAPS2_VOLUME should be included.
struct DDSCAPS2
{
DWORD :9;
DWORD DDSCAPS2_CUBEMAP :1;
DWORD DDSCAPS2_CUBEMAP_POSITIVEX :1;
DWORD DDSCAPS2_CUBEMAP_NEGATIVEX :1;
DWORD DDSCAPS2_CUBEMAP_POSITIVEY :1;
DWORD DDSCAPS2_CUBEMAP_NEGATIVEY :1;
DWORD DDSCAPS2_CUBEMAP_POSITIVEZ :1;
DWORD DDSCAPS2_CUBEMAP_NEGATIVEZ :1;
DWORD :5;
DWORD DDSCAPS2_VOLUME :1;
} dwCaps2;
DWORD Reserved[2];
}ddsCaps; //16-byte value that specifies the capabilities structure.
DWORD dwReserved2;
} head;
} DDSFile;
There is one comment on this page. [Display comment]