| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#ifndef DDSHEADER_H |
| 42 |
#define DDSHEADER_H |
| 43 |
|
| 44 |
#include <QtCore/QDataStream> |
| 45 |
|
| 46 |
#ifndef QT_NO_DATASTREAM |
| 47 |
|
| 48 |
QT_BEGIN_NAMESPACE |
| 49 |
|
| 50 |
enum Format { |
| 51 |
FormatUnknown = 0, |
| 52 |
|
| 53 |
FormatR8G8B8 = 20, |
| 54 |
FormatA8R8G8B8 = 21, |
| 55 |
FormatX8R8G8B8 = 22, |
| 56 |
FormatR5G6B5 = 23, |
| 57 |
FormatX1R5G5B5 = 24, |
| 58 |
FormatA1R5G5B5 = 25, |
| 59 |
FormatA4R4G4B4 = 26, |
| 60 |
FormatR3G3B2 = 27, |
| 61 |
FormatA8 = 28, |
| 62 |
FormatA8R3G3B2 = 29, |
| 63 |
FormatX4R4G4B4 = 30, |
| 64 |
FormatA2B10G10R10 = 31, |
| 65 |
FormatA8B8G8R8 = 32, |
| 66 |
FormatX8B8G8R8 = 33, |
| 67 |
FormatG16R16 = 34, |
| 68 |
FormatA2R10G10B10 = 35, |
| 69 |
FormatA16B16G16R16 = 36, |
| 70 |
|
| 71 |
FormatA8P8 = 40, |
| 72 |
FormatP8 = 41, |
| 73 |
|
| 74 |
FormatL8 = 50, |
| 75 |
FormatA8L8 = 51, |
| 76 |
FormatA4L4 = 52, |
| 77 |
|
| 78 |
FormatV8U8 = 60, |
| 79 |
FormatL6V5U5 = 61, |
| 80 |
FormatX8L8V8U8 = 62, |
| 81 |
FormatQ8W8V8U8 = 63, |
| 82 |
FormatV16U16 = 64, |
| 83 |
FormatA2W10V10U10 = 67, |
| 84 |
|
| 85 |
FormatUYVY = 0x59565955, |
| 86 |
FormatR8G8B8G8 = 0x47424752, |
| 87 |
FormatYUY2 = 0x32595559, |
| 88 |
FormatG8R8G8B8 = 0x42475247, |
| 89 |
FormatDXT1 = 0x31545844, |
| 90 |
FormatDXT2 = 0x32545844, |
| 91 |
FormatDXT3 = 0x33545844, |
| 92 |
FormatDXT4 = 0x34545844, |
| 93 |
FormatDXT5 = 0x35545844, |
| 94 |
FormatRXGB = 0x42475852, |
| 95 |
FormatATI2 = 0x32495441, |
| 96 |
|
| 97 |
FormatD16Lockable = 70, |
| 98 |
FormatD32 = 71, |
| 99 |
FormatD15S1 = 73, |
| 100 |
FormatD24S8 = 75, |
| 101 |
FormatD24X8 = 77, |
| 102 |
FormatD24X4S4 = 79, |
| 103 |
FormatD16 = 80, |
| 104 |
|
| 105 |
FormatD32FLockable = 82, |
| 106 |
FormatD24FS8 = 83, |
| 107 |
|
| 108 |
FormatD32Lockable = 84, |
| 109 |
FormatS8Lockable = 85, |
| 110 |
|
| 111 |
FormatL16 = 81, |
| 112 |
|
| 113 |
FormatVertexData =100, |
| 114 |
FormatIndex16 =101, |
| 115 |
FormatIndex32 =102, |
| 116 |
|
| 117 |
FormatQ16W16V16U16 = 110, |
| 118 |
|
| 119 |
FormatMulti2ARGB8 = 0x3154454d, |
| 120 |
|
| 121 |
FormatR16F = 111, |
| 122 |
FormatG16R16F = 112, |
| 123 |
FormatA16B16G16R16F = 113, |
| 124 |
|
| 125 |
FormatR32F = 114, |
| 126 |
FormatG32R32F = 115, |
| 127 |
FormatA32B32G32R32F = 116, |
| 128 |
|
| 129 |
FormatCxV8U8 = 117, |
| 130 |
|
| 131 |
FormatA1 = 118, |
| 132 |
FormatA2B10G10R10_XR_BIAS = 119, |
| 133 |
FormatBinaryBuffer = 199, |
| 134 |
|
| 135 |
FormatP4, |
| 136 |
FormatA4P4, |
| 137 |
|
| 138 |
FormatLast = 0x7fffffff |
| 139 |
}; |
| 140 |
|
| 141 |
struct DDSPixelFormat |
| 142 |
{ |
| 143 |
enum DDSPixelFormatFlags { |
| 144 |
FlagAlphaPixels = 0x00000001, |
| 145 |
FlagAlpha = 0x00000002, |
| 146 |
FlagFourCC = 0x00000004, |
| 147 |
FlagPaletteIndexed4 = 0x00000008, |
| 148 |
FlagPaletteIndexed8 = 0x00000020, |
| 149 |
FlagRGB = 0x00000040, |
| 150 |
FlagYUV = 0x00000200, |
| 151 |
FlagLuminance = 0x00020000, |
| 152 |
FlagNormal = 0x00080000, |
| 153 |
FlagRGBA = FlagAlphaPixels | FlagRGB, |
| 154 |
FlagLA = FlagAlphaPixels | FlagLuminance |
| 155 |
}; |
| 156 |
|
| 157 |
quint32 size; |
| 158 |
quint32 flags; |
| 159 |
quint32 fourCC; |
| 160 |
quint32 rgbBitCount; |
| 161 |
quint32 rBitMask; |
| 162 |
quint32 gBitMask; |
| 163 |
quint32 bBitMask; |
| 164 |
quint32 aBitMask; |
| 165 |
}; |
| 166 |
|
| 167 |
QDataStream &operator>>(QDataStream &s, DDSPixelFormat &pixelFormat); |
| 168 |
QDataStream &operator<<(QDataStream &s, const DDSPixelFormat &pixelFormat); |
| 169 |
|
| 170 |
struct DDSHeader |
| 171 |
{ |
| 172 |
enum DDSFlags { |
| 173 |
FlagCaps = 0x000001, |
| 174 |
FlagHeight = 0x000002, |
| 175 |
FlagWidth = 0x000004, |
| 176 |
FlagPitch = 0x000008, |
| 177 |
FlagPixelFormat = 0x001000, |
| 178 |
FlagMipmapCount = 0x020000, |
| 179 |
FlagLinearSize = 0x080000, |
| 180 |
FlagDepth = 0x800000 |
| 181 |
}; |
| 182 |
|
| 183 |
enum DDSCapsFlags { |
| 184 |
CapsComplex = 0x000008, |
| 185 |
CapsTexture = 0x001000, |
| 186 |
CapsMipmap = 0x400000 |
| 187 |
}; |
| 188 |
|
| 189 |
enum DDSCaps2Flags { |
| 190 |
Caps2CubeMap = 0x0200, |
| 191 |
Caps2CubeMapPositiveX = 0x0400, |
| 192 |
Caps2CubeMapNegativeX = 0x0800, |
| 193 |
Caps2CubeMapPositiveY = 0x1000, |
| 194 |
Caps2CubeMapNegativeY = 0x2000, |
| 195 |
Caps2CubeMapPositiveZ = 0x4000, |
| 196 |
Caps2CubeMapNegativeZ = 0x8000, |
| 197 |
Caps2Volume = 0x200000 |
| 198 |
}; |
| 199 |
|
| 200 |
enum { ReservedCount = 11 }; |
| 201 |
|
| 202 |
quint32 magic; |
| 203 |
quint32 size; |
| 204 |
quint32 flags; |
| 205 |
quint32 height; |
| 206 |
quint32 width; |
| 207 |
quint32 pitchOrLinearSize; |
| 208 |
quint32 depth; |
| 209 |
quint32 mipMapCount; |
| 210 |
quint32 reserved1[ReservedCount]; |
| 211 |
DDSPixelFormat pixelFormat; |
| 212 |
quint32 caps; |
| 213 |
quint32 caps2; |
| 214 |
quint32 caps3; |
| 215 |
quint32 caps4; |
| 216 |
quint32 reserved2; |
| 217 |
}; |
| 218 |
|
| 219 |
QDataStream &operator>>(QDataStream &s, DDSHeader &header); |
| 220 |
QDataStream &operator<<(QDataStream &s, const DDSHeader &header); |
| 221 |
|
| 222 |
struct DDSHeaderDX10 |
| 223 |
{ |
| 224 |
quint32 dxgiFormat; |
| 225 |
quint32 resourceDimension; |
| 226 |
quint32 miscFlag; |
| 227 |
quint32 arraySize; |
| 228 |
quint32 reserved; |
| 229 |
}; |
| 230 |
|
| 231 |
QDataStream &operator>>(QDataStream &s, DDSHeaderDX10 &header); |
| 232 |
QDataStream &operator<<(QDataStream &s, const DDSHeaderDX10 &header); |
| 233 |
|
| 234 |
QT_END_NAMESPACE |
| 235 |
|
| 236 |
#endif |
| 237 |
|
| 238 |
#endif |