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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
/*
* Copyright 2009, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This file contains the structure definintions necessary for loading a DDS
// image file (DirectDrawSurface). Using ths definition will prevent apps
// from having to including "ddraw.h" from the DirectX SDK.
#ifndef O3D_CORE_CROSS_GL_DDSURFACEDESC_H_
#define O3D_CORE_CROSS_GL_DDSURFACEDESC_H_
#include <build/build_config.h>
#ifndef OS_WIN
typedef uint16 WORD;
typedef uint32 DWORD;
typedef int8 BYTE;
typedef int32 LONG;
typedef void* LPVOID;
#endif
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
#define FOURCC_DXT1 (MAKEFOURCC('D', 'X', 'T', '1'))
#define FOURCC_DXT2 (MAKEFOURCC('D', 'X', 'T', '2'))
#define FOURCC_DXT3 (MAKEFOURCC('D', 'X', 'T', '3'))
#define FOURCC_DXT4 (MAKEFOURCC('D', 'X', 'T', '4'))
#define FOURCC_DXT5 (MAKEFOURCC('D', 'X', 'T', '5'))
/*
* The surface will accept pixel data in the format specified
* and compress it during the write.
*/
#define DDPF_ALPHAPIXELS 0x00000001l
#define DDPF_FOURCC 0x00000004L
#define DDPF_RGB 0x00000040L
#define DDPF_COMPRESSED 0x00000080L
#define DDSCAPS_COMPLEX 0x00000008L
#define DDSCAPS_MIPMAP 0x00400000L
#define DDSCAPS_TEXTURE 0x00001000L
#define DDSCAPS2_CUBEMAP 0x00000200L
/*
* These flags preform two functions:
* - At CreateSurface time, they define which of the six cube faces are
* required by the application.
* - After creation, each face in the cubemap will have exactly one of these
* bits set.
*/
#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400L
#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800L
#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000L
#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000L
#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000L
#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000L
/*
* This macro may be used to specify all faces of a cube map at
* CreateSurface time.
*/
#define DDSCAPS2_CUBEMAP_ALLFACES (DDSCAPS2_CUBEMAP_POSITIVEX | \
DDSCAPS2_CUBEMAP_NEGATIVEX | \
DDSCAPS2_CUBEMAP_POSITIVEY | \
DDSCAPS2_CUBEMAP_NEGATIVEY | \
DDSCAPS2_CUBEMAP_POSITIVEZ | \
DDSCAPS2_CUBEMAP_NEGATIVEZ)
namespace o3d {
enum DDSD_FLAGS {
DDSD_CAPS = 0x00000001l,
DDSD_HEIGHT = 0x00000002l,
DDSD_WIDTH = 0x00000004l,
DDSD_PITCH = 0x00000008l,
DDSD_BACKBUFFERCOUNT = 0x00000020l,
DDSD_ZBUFFERBITDEPTH = 0x00000040l,
DDSD_ALPHABITDEPTH = 0x00000080l,
DDSD_LPSURFACE = 0x00000800l,
DDSD_PIXELFORMAT = 0x00001000l,
DDSD_CKDESTOVERLAY = 0x00002000l,
DDSD_CKDESTBLT = 0x00004000l,
DDSD_CKSRCOVERLAY = 0x00008000l,
DDSD_CKSRCBLT = 0x00010000l,
DDSD_MIPMAPCOUNT = 0x00020000l,
DDSD_REFRESHRATE = 0x00040000l,
DDSD_LINEARSIZE = 0x00080000l,
DDSD_TEXTURESTAGE = 0x00100000l,
DDSD_FVF = 0x00200000l,
DDSD_SRCVBHANDLE = 0x00400000l,
DDSD_DEPTH = 0x00800000l,
};
struct DDCOLORKEY {
DWORD dwColorSpaceLowValue; // low boundary of Color Key, inclusive
DWORD dwColorSpaceHighValue; // high boundary of Color Key, inclusive
};
struct DDPIXELFORMAT {
DWORD dwSize; // size of structure
DWORD dwFlags; // pixel format flags
DWORD dwFourCC; // (FOURCC code)
union {
DWORD dwRGBBitCount; // how many bits per pixel
DWORD dwYUVBitCount; // how many bits per pixel
DWORD dwZBufferBitDepth; // how many total bits/pixel in z buffer
// (including any stencil bits)
DWORD dwAlphaBitDepth; // how many bits for alpha channels
DWORD dwLuminanceBitCount; // how many bits per pixel
DWORD dwBumpBitCount; // how many bits per "buxel", total
DWORD dwPrivateFormatBitCount; // Bits per pixel of private driver formats.
// Only valid in texture format list and if
// DDPF_D3DFORMAT is set.
};
union {
DWORD dwRBitMask; // mask for red bit
DWORD dwYBitMask; // mask for Y bits
DWORD dwStencilBitDepth; // how many stencil bits
// (note:dwZBufferBitDepth-dwStencilBitDepth is
// total Z-only bits)
DWORD dwLuminanceBitMask; // mask for luminance bits
DWORD dwBumpDuBitMask; // mask for bump map U delta bits
DWORD dwOperations; // DDPF_D3DFORMAT Operations
};
union {
DWORD dwGBitMask; // mask for green bits
DWORD dwUBitMask; // mask for U bits
DWORD dwZBitMask; // mask for Z bits
DWORD dwBumpDvBitMask; // mask for bump map V delta bits
struct {
WORD wFlipMSTypes; // Multisample methods supported via flip for
// this D3DFORMAT
WORD wBltMSTypes; // Multisample methods supported via blt for
// this D3DFORMAT
} MultiSampleCaps;
};
union {
DWORD dwBBitMask; // mask for blue bits
DWORD dwVBitMask; // mask for V bits
DWORD dwStencilBitMask; // mask for stencil bits
DWORD dwBumpLuminanceBitMask; // mask for luminance in bump map
};
union {
DWORD dwRGBAlphaBitMask; // mask for alpha channel
DWORD dwYUVAlphaBitMask; // mask for alpha channel
DWORD dwLuminanceAlphaBitMask; // mask for alpha channel
DWORD dwRGBZBitMask; // mask for Z channel
DWORD dwYUVZBitMask; // mask for Z channel
};
};
struct DDSCAPS2 {
DWORD dwCaps; // capabilities of surface wanted
DWORD dwCaps2;
DWORD dwCaps3;
union {
DWORD dwCaps4;
DWORD dwVolumeDepth;
};
};
struct DDSURFACEDESC2 {
DWORD dwSize; // size of the DDSURFACEDESC structure
DWORD dwFlags; // determines what fields are valid
DWORD dwHeight; // height of surface to be created
DWORD dwWidth; // width of input surface
union {
LONG lPitch; // distance to start of next line (return value only)
DWORD dwLinearSize; // Formless late-allocated optimized surface size
};
union {
DWORD dwBackBufferCount; // number of back buffers requested
DWORD dwDepth; // the depth if this is a volume texture
};
union {
DWORD dwMipMapCount; // number of mip-map levels requested
// dwZBufferBitDepth removed, use ddpfPixelFormat
// one instead
DWORD dwRefreshRate; // refresh rate (used when display mode is described)
DWORD dwSrcVBHandle; // The source used in VB::Optimize
};
DWORD dwAlphaBitDepth; // depth of alpha buffer requested
DWORD dwReserved; // reserved
LPVOID lpSurface; // pointer to the associated surface memory
union {
DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay
DWORD dwEmptyFaceColor; // color for empty cubemap faces
};
DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
union {
DDPIXELFORMAT ddpfPixelFormat; // format of the surface
DWORD dwFVF; // format of vertex buffers
};
DDSCAPS2 ddsCaps; // direct draw surface capabilities
DWORD dwTextureStage; // stage in multitexture cascade
};
} // namespace o3d
#endif // O3D_CORE_CROSS_GL_DDSURFACEDESC_H_
|