//this code has been snipped out of the DX SDK to remove the DDS loader's //dependency on what is otherwise a 200+MB download that won't run on Linux. // //I've also put it all in a namespace since it defines more symbols than //I care to have kicking around my intellisense popup - PD #ifndef MAKEFOURCC #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ ((unsigned long)(char)(ch0) | ((unsigned long)(char)(ch1) << 8) | \ ((unsigned long)(char)(ch2) << 16) | ((unsigned long)(char)(ch3) << 24 )) #endif namespace dx { typedef struct { unsigned long dwColorSpaceLowValue; // low boundary of color space that is to // be treated as Color Key, inclusive unsigned long dwColorSpaceHighValue; // high boundary of color space that is // to be treated as Color Key, inclusive } DDCOLORKEY_t; typedef struct { unsigned long dwCaps; // capabilities of surface wanted unsigned long dwCaps2; unsigned long dwCaps3; union { unsigned long dwCaps4; unsigned long dwVolumeDepth; } u0; } DDSCAPS2_t; typedef struct { unsigned long dwSize; // size of structure unsigned long dwFlags; // pixel format flags unsigned long dwFourCC; // (FOURCC code) union { unsigned long dwRGBBitCount; // how many bits per pixel unsigned long dwYUVBitCount; // how many bits per pixel unsigned long dwZBufferBitDepth; // how many total bits/pixel in z buffer (including any stencil bits) unsigned long dwAlphaBitDepth; // how many bits for alpha channels unsigned long dwLuminanceBitCount; // how many bits per pixel unsigned long dwBumpBitCount; // how many bits per "buxel", total unsigned long dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture // format list and if DDPF_D3DFORMAT is set } u0; union { unsigned long dwRBitMask; // mask for red bit unsigned long dwYBitMask; // mask for Y bits unsigned long dwStencilBitDepth; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) unsigned long dwLuminanceBitMask; // mask for luminance bits unsigned long dwBumpDuBitMask; // mask for bump map U delta bits unsigned long dwOperations; // DDPF_D3DFORMAT Operations } u1; union { unsigned long dwGBitMask; // mask for green bits unsigned long dwUBitMask; // mask for U bits unsigned long dwZBitMask; // mask for Z bits unsigned long dwBumpDvBitMask; // mask for bump map V delta bits struct { unsigned short wFlipMSTypes; // Multisample methods supported via flip for this D3DFORMAT unsigned short wBltMSTypes; // Multisample methods supported via blt for this D3DFORMAT } MultiSampleCaps; } u2; union { unsigned long dwBBitMask; // mask for blue bits unsigned long dwVBitMask; // mask for V bits unsigned long dwStencilBitMask; // mask for stencil bits unsigned long dwBumpLuminanceBitMask; // mask for luminance in bump map } u3; union { unsigned long dwRGBAlphaBitMask; // mask for alpha channel unsigned long dwYUVAlphaBitMask; // mask for alpha channel unsigned long dwLuminanceAlphaBitMask;// mask for alpha channel unsigned long dwRGBZBitMask; // mask for Z channel unsigned long dwYUVZBitMask; // mask for Z channel } u4; } DDPIXELFORMAT_t; typedef struct { unsigned long dwSize; // size of the DDSURFACEDESC structure unsigned long dwFlags; // determines what fields are valid unsigned long dwHeight; // height of surface to be created unsigned long dwWidth; // width of input surface union { long lPitch; // distance to start of next line (return value only) unsigned long dwLinearSize; // Formless late-allocated optimized surface size } u0; union { unsigned long dwBackBufferCount; // number of back buffers requested unsigned long dwDepth; // the depth if this is a volume texture } u1; union { unsigned long dwMipMapCount; // number of mip-map levels requestde // dwZBufferBitDepth removed, use ddpfPixelFormat one instead unsigned long dwRefreshRate; // refresh rate (used when display mode is described) unsigned long dwSrcVBHandle; // The source used in VB::Optimize } u2; unsigned long dwAlphaBitDepth; // depth of alpha buffer requested unsigned long dwReserved; // reserved void* lpSurface; // pointer to the associated surface memory union { DDCOLORKEY_t ddckCKDestOverlay; // color key for destination overlay use unsigned long dwEmptyFaceColor; // Physical color for empty cubemap faces } u3; DDCOLORKEY_t ddckCKDestBlt; // color key for destination blt use DDCOLORKEY_t ddckCKSrcOverlay; // color key for source overlay use DDCOLORKEY_t ddckCKSrcBlt; // color key for source blt use union { DDPIXELFORMAT_t ddpfPixelFormat; // pixel format description of the surface unsigned long dwFVF; // vertex format description of vertex buffers } u4; DDSCAPS2_t ddsCaps; // direct draw surface capabilities unsigned long dwTextureStage; // stage in multitexture cascade } DDSURFACEDESC2_t; // // DDSURFACEDESC2 flags that mark the validity of the struct data // const unsigned long DDSD_CAPS = 0x00000001l; // default const unsigned long DDSD_HEIGHT = 0x00000002l; // default const unsigned long DDSD_WIDTH = 0x00000004l; // default const unsigned long DDSD_PIXELFORMAT = 0x00001000l; // default const unsigned long DDSD_PITCH = 0x00000008l; // For uncompressed formats const unsigned long DDSD_MIPMAPCOUNT = 0x00020000l; const unsigned long DDSD_LINEARSIZE = 0x00080000l; // For compressed formats const unsigned long DDSD_DEPTH = 0x00800000l; // Volume Textures // // DDPIXELFORMAT flags // const unsigned long DDPF_ALPHAPIXELS = 0x00000001l; const unsigned long DDPF_FOURCC = 0x00000004l; // Compressed formats const unsigned long DDPF_RGB = 0x00000040l; // Uncompressed formats const unsigned long DDPF_ALPHA = 0x00000002l; const unsigned long DDPF_COMPRESSED = 0x00000080l; const unsigned long DDPF_LUMINANCE = 0x00020000l; const unsigned long DDPF_PALETTEINDEXED4 = 0x00000008l; const unsigned long DDPF_PALETTEINDEXEDTO8 = 0x00000010l; const unsigned long DDPF_PALETTEINDEXED8 = 0x00000020l; // // DDSCAPS flags // const unsigned long DDSCAPS_COMPLEX = 0x00000008l; const unsigned long DDSCAPS_TEXTURE = 0x00001000l; // default const unsigned long DDSCAPS_MIPMAP = 0x00400000l; const unsigned long DDSCAPS2_VOLUME = 0x00200000l; const unsigned long DDSCAPS2_CUBEMAP = 0x00000200L; const unsigned long DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400L; const unsigned long DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800L; const unsigned long DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000L; const unsigned long DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000L; const unsigned long DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000L; const unsigned long DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000L; const unsigned long FOURCC_DDS = MAKEFOURCC( 'D', 'D', 'S', ' ' ); /* * FOURCC codes for DX compressed-texture pixel formats */ const unsigned long FOURCC_DXT1 = MAKEFOURCC( 'D', 'X', 'T', '1' ); const unsigned long FOURCC_DXT2 = MAKEFOURCC( 'D', 'X', 'T', '2' ); const unsigned long FOURCC_DXT3 = MAKEFOURCC( 'D', 'X', 'T', '3' ); const unsigned long FOURCC_DXT4 = MAKEFOURCC( 'D', 'X', 'T', '4' ); const unsigned long FOURCC_DXT5 = MAKEFOURCC( 'D', 'X', 'T', '5' ); };