Sync with trunk (r48545)
[reactos.git] / include / psdk / d3dtypes.h
1 /*
2 * Copyright (C) 2000 Peter Hunnisett
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 /* FIXME: Need to add C++ code for certain structs for headers - this is going to be a problem
20 if WINE continues to only use C code - I suppose that we could always inline in
21 the header file to get around that little problem... */
22 /* FIXME: We need to implement versioning on everything directx 5 and up if these headers
23 are going to be generically useful for directx stuff */
24
25 #ifndef __WINE_D3DTYPES_H
26 #define __WINE_D3DTYPES_H
27
28 /* #include <windows.h> FIXME: Need to include for compatibility. Inclusion caused compile fail */
29
30 #include <float.h>
31 #include <ddraw.h>
32
33 #define D3DVALP(val, prec) ((float)(val))
34 #define D3DVAL(val) ((float)(val))
35 #define D3DDivide(a, b) (float)((double) (a) / (double) (b))
36 #define D3DMultiply(a, b) ((a) * (b))
37
38 typedef LONG D3DFIXED;
39
40
41 #ifndef RGB_MAKE
42 #define CI_GETALPHA(ci) ((ci) >> 24)
43 #define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff)
44 #define CI_GETFRACTION(ci) ((ci) & 0xff)
45 #define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80)
46 #define CI_MASKALPHA(ci) ((ci) & 0xffffff)
47 #define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f))
48
49 #define RGBA_GETALPHA(rgb) ((rgb) >> 24)
50 #define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff)
51 #define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
52 #define RGBA_GETBLUE(rgb) ((rgb) & 0xff)
53 #define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
54
55 #define D3DRGB(r, g, b) \
56 (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
57 #define D3DRGBA(r, g, b, a) \
58 ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
59 | (((long)((g) * 255)) << 8) | (long)((b) * 255) \
60 )
61
62 #define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff)
63 #define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
64 #define RGB_GETBLUE(rgb) ((rgb) & 0xff)
65 #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
66 #define RGB_MAKE(r, g, b) ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b)))
67 #define RGBA_TORGB(rgba) ((D3DCOLOR) ((rgba) & 0xffffff))
68 #define RGB_TORGBA(rgb) ((D3DCOLOR) ((rgb) | 0xff000000))
69
70 #endif
71
72 #define D3DENUMRET_CANCEL DDENUMRET_CANCEL
73 #define D3DENUMRET_OK DDENUMRET_OK
74
75 typedef HRESULT (CALLBACK *LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset);
76 typedef HRESULT (CALLBACK *LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext);
77 typedef HRESULT (CALLBACK *LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext);
78
79 #ifndef DX_SHARED_DEFINES
80
81 typedef float D3DVALUE,*LPD3DVALUE;
82
83 #ifndef D3DCOLOR_DEFINED
84 typedef DWORD D3DCOLOR, *LPD3DCOLOR;
85 #define D3DCOLOR_DEFINED
86 #endif
87
88 #ifndef D3DVECTOR_DEFINED
89 typedef struct _D3DVECTOR {
90 union {
91 D3DVALUE x;
92 D3DVALUE dvX;
93 } DUMMYUNIONNAME1;
94 union {
95 D3DVALUE y;
96 D3DVALUE dvY;
97 } DUMMYUNIONNAME2;
98 union {
99 D3DVALUE z;
100 D3DVALUE dvZ;
101 } DUMMYUNIONNAME3;
102 #if defined(__cplusplus) && defined(D3D_OVERLOADS)
103 /* the definitions for these methods are in d3dvec.inl */
104 public:
105 /*** constructors ***/
106 _D3DVECTOR() {}
107 _D3DVECTOR(D3DVALUE f);
108 _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z);
109 _D3DVECTOR(const D3DVALUE f[3]);
110
111 /*** assignment operators ***/
112 _D3DVECTOR& operator += (const _D3DVECTOR& v);
113 _D3DVECTOR& operator -= (const _D3DVECTOR& v);
114 _D3DVECTOR& operator *= (const _D3DVECTOR& v);
115 _D3DVECTOR& operator /= (const _D3DVECTOR& v);
116 _D3DVECTOR& operator *= (D3DVALUE s);
117 _D3DVECTOR& operator /= (D3DVALUE s);
118
119 /*** unary operators ***/
120 friend _D3DVECTOR operator + (const _D3DVECTOR& v);
121 friend _D3DVECTOR operator - (const _D3DVECTOR& v);
122
123 /*** binary operators ***/
124 friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
125 friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
126
127 friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s);
128 friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v);
129 friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s);
130
131 friend D3DVALUE SquareMagnitude(const _D3DVECTOR& v);
132 friend D3DVALUE Magnitude(const _D3DVECTOR& v);
133
134 friend _D3DVECTOR Normalize(const _D3DVECTOR& v);
135
136 friend D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2);
137 friend _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2);
138 #endif
139 } D3DVECTOR,*LPD3DVECTOR;
140 #define D3DVECTOR_DEFINED
141 #endif
142
143 #define DX_SHARED_DEFINES
144 #endif /* DX_SHARED_DEFINES */
145
146 typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE;
147 typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE;
148 typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE;
149
150 #ifndef D3DCOLORVALUE_DEFINED
151 typedef struct _D3DCOLORVALUE {
152 union {
153 D3DVALUE r;
154 D3DVALUE dvR;
155 } DUMMYUNIONNAME1;
156 union {
157 D3DVALUE g;
158 D3DVALUE dvG;
159 } DUMMYUNIONNAME2;
160 union {
161 D3DVALUE b;
162 D3DVALUE dvB;
163 } DUMMYUNIONNAME3;
164 union {
165 D3DVALUE a;
166 D3DVALUE dvA;
167 } DUMMYUNIONNAME4;
168 } D3DCOLORVALUE,*LPD3DCOLORVALUE;
169 #endif
170
171 #ifndef D3DRECT_DEFINED
172 typedef struct _D3DRECT {
173 union {
174 LONG x1;
175 LONG lX1;
176 } DUMMYUNIONNAME1;
177 union {
178 LONG y1;
179 LONG lY1;
180 } DUMMYUNIONNAME2;
181 union {
182 LONG x2;
183 LONG lX2;
184 } DUMMYUNIONNAME3;
185 union {
186 LONG y2;
187 LONG lY2;
188 } DUMMYUNIONNAME4;
189 } D3DRECT;
190 #endif
191 typedef struct _D3DRECT *LPD3DRECT;
192
193 typedef struct _D3DHVERTEX {
194 DWORD dwFlags;
195 union {
196 D3DVALUE hx;
197 D3DVALUE dvHX;
198 } DUMMYUNIONNAME1;
199 union {
200 D3DVALUE hy;
201 D3DVALUE dvHY;
202 } DUMMYUNIONNAME2;
203 union {
204 D3DVALUE hz;
205 D3DVALUE dvHZ;
206 } DUMMYUNIONNAME3;
207 } D3DHVERTEX, *LPD3DHVERTEX;
208
209 /*
210 * Transformed/lit vertices
211 */
212 typedef struct _D3DTLVERTEX {
213 union {
214 D3DVALUE sx;
215 D3DVALUE dvSX;
216 } DUMMYUNIONNAME1;
217 union {
218 D3DVALUE sy;
219 D3DVALUE dvSY;
220 } DUMMYUNIONNAME2;
221 union {
222 D3DVALUE sz;
223 D3DVALUE dvSZ;
224 } DUMMYUNIONNAME3;
225 union {
226 D3DVALUE rhw;
227 D3DVALUE dvRHW;
228 } DUMMYUNIONNAME4;
229 union {
230 D3DCOLOR color;
231 D3DCOLOR dcColor;
232 } DUMMYUNIONNAME5;
233 union {
234 D3DCOLOR specular;
235 D3DCOLOR dcSpecular;
236 } DUMMYUNIONNAME6;
237 union {
238 D3DVALUE tu;
239 D3DVALUE dvTU;
240 } DUMMYUNIONNAME7;
241 union {
242 D3DVALUE tv;
243 D3DVALUE dvTV;
244 } DUMMYUNIONNAME8;
245 #if defined(__cplusplus) && defined(D3D_OVERLOADS)
246 public:
247 _D3DTLVERTEX() {}
248 _D3DTLVERTEX(const D3DVECTOR& v, float _rhw, D3DCOLOR _color, D3DCOLOR _specular, float _tu, float _tv) {
249 sx = v.x; sy = v.y; sz = v.z; rhw = _rhw;
250 color = _color; specular = _specular;
251 tu = _tu; tv = _tv;
252 }
253 #endif
254 } D3DTLVERTEX, *LPD3DTLVERTEX;
255
256 typedef struct _D3DLVERTEX {
257 union {
258 D3DVALUE x;
259 D3DVALUE dvX;
260 } DUMMYUNIONNAME1;
261 union {
262 D3DVALUE y;
263 D3DVALUE dvY;
264 } DUMMYUNIONNAME2;
265 union {
266 D3DVALUE z;
267 D3DVALUE dvZ;
268 } DUMMYUNIONNAME3;
269 DWORD dwReserved;
270 union {
271 D3DCOLOR color;
272 D3DCOLOR dcColor;
273 } DUMMYUNIONNAME4;
274 union {
275 D3DCOLOR specular;
276 D3DCOLOR dcSpecular;
277 } DUMMYUNIONNAME5;
278 union {
279 D3DVALUE tu;
280 D3DVALUE dvTU;
281 } DUMMYUNIONNAME6;
282 union {
283 D3DVALUE tv;
284 D3DVALUE dvTV;
285 } DUMMYUNIONNAME7;
286 } D3DLVERTEX, *LPD3DLVERTEX;
287
288 typedef struct _D3DVERTEX {
289 union {
290 D3DVALUE x;
291 D3DVALUE dvX;
292 } DUMMYUNIONNAME1;
293 union {
294 D3DVALUE y;
295 D3DVALUE dvY;
296 } DUMMYUNIONNAME2;
297 union {
298 D3DVALUE z;
299 D3DVALUE dvZ;
300 } DUMMYUNIONNAME3;
301 union {
302 D3DVALUE nx;
303 D3DVALUE dvNX;
304 } DUMMYUNIONNAME4;
305 union {
306 D3DVALUE ny;
307 D3DVALUE dvNY;
308 } DUMMYUNIONNAME5;
309 union {
310 D3DVALUE nz;
311 D3DVALUE dvNZ;
312 } DUMMYUNIONNAME6;
313 union {
314 D3DVALUE tu;
315 D3DVALUE dvTU;
316 } DUMMYUNIONNAME7;
317 union {
318 D3DVALUE tv;
319 D3DVALUE dvTV;
320 } DUMMYUNIONNAME8;
321 #if defined(__cplusplus) && defined(D3D_OVERLOADS)
322 public:
323 _D3DVERTEX() {}
324 _D3DVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, float _tu, float _tv) {
325 x = v.x; y = v.y; z = v.z;
326 nx = n.x; ny = n.y; nz = n.z;
327 tu = _tu; tv = _tv;
328 }
329 #endif
330 } D3DVERTEX, *LPD3DVERTEX;
331
332 #ifndef D3DMATRIX_DEFINED
333 typedef struct _D3DMATRIX {
334 D3DVALUE _11, _12, _13, _14;
335 D3DVALUE _21, _22, _23, _24;
336 D3DVALUE _31, _32, _33, _34;
337 D3DVALUE _41, _42, _43, _44;
338 #if defined(__cplusplus) && defined(D3D_OVERLOADS)
339 _D3DMATRIX() { }
340
341 /* This is different from MS, but avoids anonymous structs. */
342 D3DVALUE &operator () (int r, int c)
343 { return ((D3DVALUE [4][4])&_11)[r][c]; }
344 const D3DVALUE &operator() (int r, int c) const
345 { return ((const D3DVALUE [4][4])&_11)[r][c]; }
346 #endif
347 } D3DMATRIX, *LPD3DMATRIX;
348 #endif
349
350 #if defined(__cplusplus) && defined(D3D_OVERLOADS)
351 #include <d3dvec.inl>
352 #endif
353
354 typedef struct _D3DVIEWPORT {
355 DWORD dwSize;
356 DWORD dwX;
357 DWORD dwY;
358 DWORD dwWidth;
359 DWORD dwHeight;
360 D3DVALUE dvScaleX;
361 D3DVALUE dvScaleY;
362 D3DVALUE dvMaxX;
363 D3DVALUE dvMaxY;
364 D3DVALUE dvMinZ;
365 D3DVALUE dvMaxZ;
366 } D3DVIEWPORT, *LPD3DVIEWPORT;
367
368 typedef struct _D3DVIEWPORT2 {
369 DWORD dwSize;
370 DWORD dwX;
371 DWORD dwY;
372 DWORD dwWidth;
373 DWORD dwHeight;
374 D3DVALUE dvClipX;
375 D3DVALUE dvClipY;
376 D3DVALUE dvClipWidth;
377 D3DVALUE dvClipHeight;
378 D3DVALUE dvMinZ;
379 D3DVALUE dvMaxZ;
380 } D3DVIEWPORT2, *LPD3DVIEWPORT2;
381
382 typedef struct _D3DVIEWPORT7 {
383 DWORD dwX;
384 DWORD dwY;
385 DWORD dwWidth;
386 DWORD dwHeight;
387 D3DVALUE dvMinZ;
388 D3DVALUE dvMaxZ;
389 } D3DVIEWPORT7, *LPD3DVIEWPORT7;
390
391 #define D3DMAXUSERCLIPPLANES 32
392
393 #define D3DCLIPPLANE0 (1 << 0)
394 #define D3DCLIPPLANE1 (1 << 1)
395 #define D3DCLIPPLANE2 (1 << 2)
396 #define D3DCLIPPLANE3 (1 << 3)
397 #define D3DCLIPPLANE4 (1 << 4)
398 #define D3DCLIPPLANE5 (1 << 5)
399
400 #define D3DCLIP_LEFT 0x00000001
401 #define D3DCLIP_RIGHT 0x00000002
402 #define D3DCLIP_TOP 0x00000004
403 #define D3DCLIP_BOTTOM 0x00000008
404 #define D3DCLIP_FRONT 0x00000010
405 #define D3DCLIP_BACK 0x00000020
406 #define D3DCLIP_GEN0 0x00000040
407 #define D3DCLIP_GEN1 0x00000080
408 #define D3DCLIP_GEN2 0x00000100
409 #define D3DCLIP_GEN3 0x00000200
410 #define D3DCLIP_GEN4 0x00000400
411 #define D3DCLIP_GEN5 0x00000800
412
413 #define D3DSTATUS_CLIPUNIONLEFT D3DCLIP_LEFT
414 #define D3DSTATUS_CLIPUNIONRIGHT D3DCLIP_RIGHT
415 #define D3DSTATUS_CLIPUNIONTOP D3DCLIP_TOP
416 #define D3DSTATUS_CLIPUNIONBOTTOM D3DCLIP_BOTTOM
417 #define D3DSTATUS_CLIPUNIONFRONT D3DCLIP_FRONT
418 #define D3DSTATUS_CLIPUNIONBACK D3DCLIP_BACK
419 #define D3DSTATUS_CLIPUNIONGEN0 D3DCLIP_GEN0
420 #define D3DSTATUS_CLIPUNIONGEN1 D3DCLIP_GEN1
421 #define D3DSTATUS_CLIPUNIONGEN2 D3DCLIP_GEN2
422 #define D3DSTATUS_CLIPUNIONGEN3 D3DCLIP_GEN3
423 #define D3DSTATUS_CLIPUNIONGEN4 D3DCLIP_GEN4
424 #define D3DSTATUS_CLIPUNIONGEN5 D3DCLIP_GEN5
425
426 #define D3DSTATUS_CLIPINTERSECTIONLEFT 0x00001000
427 #define D3DSTATUS_CLIPINTERSECTIONRIGHT 0x00002000
428 #define D3DSTATUS_CLIPINTERSECTIONTOP 0x00004000
429 #define D3DSTATUS_CLIPINTERSECTIONBOTTOM 0x00008000
430 #define D3DSTATUS_CLIPINTERSECTIONFRONT 0x00010000
431 #define D3DSTATUS_CLIPINTERSECTIONBACK 0x00020000
432 #define D3DSTATUS_CLIPINTERSECTIONGEN0 0x00040000
433 #define D3DSTATUS_CLIPINTERSECTIONGEN1 0x00080000
434 #define D3DSTATUS_CLIPINTERSECTIONGEN2 0x00100000
435 #define D3DSTATUS_CLIPINTERSECTIONGEN3 0x00200000
436 #define D3DSTATUS_CLIPINTERSECTIONGEN4 0x00400000
437 #define D3DSTATUS_CLIPINTERSECTIONGEN5 0x00800000
438 #define D3DSTATUS_ZNOTVISIBLE 0x01000000
439
440 #define D3DSTATUS_CLIPUNIONALL ( \
441 D3DSTATUS_CLIPUNIONLEFT | \
442 D3DSTATUS_CLIPUNIONRIGHT | \
443 D3DSTATUS_CLIPUNIONTOP | \
444 D3DSTATUS_CLIPUNIONBOTTOM | \
445 D3DSTATUS_CLIPUNIONFRONT | \
446 D3DSTATUS_CLIPUNIONBACK | \
447 D3DSTATUS_CLIPUNIONGEN0 | \
448 D3DSTATUS_CLIPUNIONGEN1 | \
449 D3DSTATUS_CLIPUNIONGEN2 | \
450 D3DSTATUS_CLIPUNIONGEN3 | \
451 D3DSTATUS_CLIPUNIONGEN4 | \
452 D3DSTATUS_CLIPUNIONGEN5 \
453 )
454
455 #define D3DSTATUS_CLIPINTERSECTIONALL ( \
456 D3DSTATUS_CLIPINTERSECTIONLEFT | \
457 D3DSTATUS_CLIPINTERSECTIONRIGHT | \
458 D3DSTATUS_CLIPINTERSECTIONTOP | \
459 D3DSTATUS_CLIPINTERSECTIONBOTTOM | \
460 D3DSTATUS_CLIPINTERSECTIONFRONT | \
461 D3DSTATUS_CLIPINTERSECTIONBACK | \
462 D3DSTATUS_CLIPINTERSECTIONGEN0 | \
463 D3DSTATUS_CLIPINTERSECTIONGEN1 | \
464 D3DSTATUS_CLIPINTERSECTIONGEN2 | \
465 D3DSTATUS_CLIPINTERSECTIONGEN3 | \
466 D3DSTATUS_CLIPINTERSECTIONGEN4 | \
467 D3DSTATUS_CLIPINTERSECTIONGEN5 \
468 )
469
470 #define D3DSTATUS_DEFAULT ( \
471 D3DSTATUS_CLIPINTERSECTIONALL | \
472 D3DSTATUS_ZNOTVISIBLE)
473
474 #define D3DTRANSFORM_CLIPPED 0x00000001
475 #define D3DTRANSFORM_UNCLIPPED 0x00000002
476
477 typedef struct _D3DTRANSFORMDATA {
478 DWORD dwSize;
479 LPVOID lpIn;
480 DWORD dwInSize;
481 LPVOID lpOut;
482 DWORD dwOutSize;
483 LPD3DHVERTEX lpHOut;
484 DWORD dwClip;
485 DWORD dwClipIntersection;
486 DWORD dwClipUnion;
487 D3DRECT drExtent;
488 } D3DTRANSFORMDATA, *LPD3DTRANSFORMDATA;
489
490 typedef struct _D3DLIGHTINGELEMENT {
491 D3DVECTOR dvPosition;
492 D3DVECTOR dvNormal;
493 } D3DLIGHTINGELEMENT, *LPD3DLIGHTINGELEMENT;
494
495 typedef struct _D3DMATERIAL {
496 DWORD dwSize;
497 union {
498 D3DCOLORVALUE diffuse;
499 D3DCOLORVALUE dcvDiffuse;
500 } DUMMYUNIONNAME;
501 union {
502 D3DCOLORVALUE ambient;
503 D3DCOLORVALUE dcvAmbient;
504 } DUMMYUNIONNAME1;
505 union {
506 D3DCOLORVALUE specular;
507 D3DCOLORVALUE dcvSpecular;
508 } DUMMYUNIONNAME2;
509 union {
510 D3DCOLORVALUE emissive;
511 D3DCOLORVALUE dcvEmissive;
512 } DUMMYUNIONNAME3;
513 union {
514 D3DVALUE power;
515 D3DVALUE dvPower;
516 } DUMMYUNIONNAME4;
517 D3DTEXTUREHANDLE hTexture;
518 DWORD dwRampSize;
519 } D3DMATERIAL, *LPD3DMATERIAL;
520
521 typedef struct _D3DMATERIAL7 {
522 union {
523 D3DCOLORVALUE diffuse;
524 D3DCOLORVALUE dcvDiffuse;
525 } DUMMYUNIONNAME;
526 union {
527 D3DCOLORVALUE ambient;
528 D3DCOLORVALUE dcvAmbient;
529 } DUMMYUNIONNAME1;
530 union {
531 D3DCOLORVALUE specular;
532 D3DCOLORVALUE dcvSpecular;
533 } DUMMYUNIONNAME2;
534 union {
535 D3DCOLORVALUE emissive;
536 D3DCOLORVALUE dcvEmissive;
537 } DUMMYUNIONNAME3;
538 union {
539 D3DVALUE power;
540 D3DVALUE dvPower;
541 } DUMMYUNIONNAME4;
542 } D3DMATERIAL7, *LPD3DMATERIAL7;
543
544 #if (DIRECT3D_VERSION < 0x0800)
545
546 typedef enum {
547 D3DLIGHT_POINT = 1,
548 D3DLIGHT_SPOT = 2,
549 D3DLIGHT_DIRECTIONAL = 3,
550 D3DLIGHT_PARALLELPOINT = 4,
551 D3DLIGHT_GLSPOT = 5,
552 D3DLIGHT_FORCE_DWORD = 0x7fffffff
553 } D3DLIGHTTYPE;
554
555 #endif
556
557 typedef struct _D3DLIGHT {
558 DWORD dwSize;
559 D3DLIGHTTYPE dltType;
560 D3DCOLORVALUE dcvColor;
561 D3DVECTOR dvPosition;
562 D3DVECTOR dvDirection;
563 D3DVALUE dvRange;
564 D3DVALUE dvFalloff;
565 D3DVALUE dvAttenuation0;
566 D3DVALUE dvAttenuation1;
567 D3DVALUE dvAttenuation2;
568 D3DVALUE dvTheta;
569 D3DVALUE dvPhi;
570 } D3DLIGHT,*LPD3DLIGHT;
571
572 typedef struct _D3DLIGHT7 {
573 D3DLIGHTTYPE dltType;
574 D3DCOLORVALUE dcvDiffuse;
575 D3DCOLORVALUE dcvSpecular;
576 D3DCOLORVALUE dcvAmbient;
577 D3DVECTOR dvPosition;
578 D3DVECTOR dvDirection;
579 D3DVALUE dvRange;
580 D3DVALUE dvFalloff;
581 D3DVALUE dvAttenuation0;
582 D3DVALUE dvAttenuation1;
583 D3DVALUE dvAttenuation2;
584 D3DVALUE dvTheta;
585 D3DVALUE dvPhi;
586 } D3DLIGHT7, *LPD3DLIGHT7;
587
588 #define D3DLIGHT_ACTIVE 0x00000001
589 #define D3DLIGHT_NO_SPECULAR 0x00000002
590 #define D3DLIGHT_ALL (D3DLIGHT_ACTIVE | D3DLIGHT_NO_SPECULAR) /* 0x3 */
591
592 #define D3DLIGHT_RANGE_MAX ((float)sqrt(FLT_MAX))
593
594 typedef struct _D3DLIGHT2 {
595 DWORD dwSize;
596 D3DLIGHTTYPE dltType;
597 D3DCOLORVALUE dcvColor;
598 D3DVECTOR dvPosition;
599 D3DVECTOR dvDirection;
600 D3DVALUE dvRange;
601 D3DVALUE dvFalloff;
602 D3DVALUE dvAttenuation0;
603 D3DVALUE dvAttenuation1;
604 D3DVALUE dvAttenuation2;
605 D3DVALUE dvTheta;
606 D3DVALUE dvPhi;
607 DWORD dwFlags;
608 } D3DLIGHT2, *LPD3DLIGHT2;
609
610 typedef struct _D3DLIGHTDATA {
611 DWORD dwSize;
612 LPD3DLIGHTINGELEMENT lpIn;
613 DWORD dwInSize;
614 LPD3DTLVERTEX lpOut;
615 DWORD dwOutSize;
616 } D3DLIGHTDATA, *LPD3DLIGHTDATA;
617
618 #define D3DCOLOR_MONO 1
619 #define D3DCOLOR_RGB 2
620
621 typedef DWORD D3DCOLORMODEL;
622
623 #ifndef D3DCLEAR_TARGET
624 #define D3DCLEAR_TARGET 0x00000001
625 #endif
626
627 #ifndef D3DCLEAR_ZBUFFER
628 #define D3DCLEAR_ZBUFFER 0x00000002
629 #endif
630
631 #ifndef D3DCLEAR_STENCIL
632 #define D3DCLEAR_STENCIL 0x00000004
633 #endif
634
635 typedef enum _D3DOPCODE {
636 D3DOP_POINT = 1,
637 D3DOP_LINE = 2,
638 D3DOP_TRIANGLE = 3,
639 D3DOP_MATRIXLOAD = 4,
640 D3DOP_MATRIXMULTIPLY = 5,
641 D3DOP_STATETRANSFORM = 6,
642 D3DOP_STATELIGHT = 7,
643 D3DOP_STATERENDER = 8,
644 D3DOP_PROCESSVERTICES = 9,
645 D3DOP_TEXTURELOAD = 10,
646 D3DOP_EXIT = 11,
647 D3DOP_BRANCHFORWARD = 12,
648 D3DOP_SPAN = 13,
649 D3DOP_SETSTATUS = 14,
650
651 D3DOP_FORCE_DWORD = 0x7fffffff
652 } D3DOPCODE;
653
654 typedef struct _D3DINSTRUCTION {
655 BYTE bOpcode;
656 BYTE bSize;
657 WORD wCount;
658 } D3DINSTRUCTION, *LPD3DINSTRUCTION;
659
660 typedef struct _D3DTEXTURELOAD {
661 D3DTEXTUREHANDLE hDestTexture;
662 D3DTEXTUREHANDLE hSrcTexture;
663 } D3DTEXTURELOAD, *LPD3DTEXTURELOAD;
664
665 typedef struct _D3DPICKRECORD {
666 BYTE bOpcode;
667 BYTE bPad;
668 DWORD dwOffset;
669 D3DVALUE dvZ;
670 } D3DPICKRECORD, *LPD3DPICKRECORD;
671
672 #if (DIRECT3D_VERSION < 0x0800)
673
674 typedef enum {
675 D3DSHADE_FLAT = 1,
676 D3DSHADE_GOURAUD = 2,
677 D3DSHADE_PHONG = 3,
678 D3DSHADE_FORCE_DWORD = 0x7fffffff
679 } D3DSHADEMODE;
680
681 typedef enum {
682 D3DFILL_POINT = 1,
683 D3DFILL_WIREFRAME = 2,
684 D3DFILL_SOLID = 3,
685 D3DFILL_FORCE_DWORD = 0x7fffffff
686 } D3DFILLMODE;
687
688 typedef struct _D3DLINEPATTERN {
689 WORD wRepeatFactor;
690 WORD wLinePattern;
691 } D3DLINEPATTERN;
692
693 #endif /* (DIRECT3D_VERSION < 0x0800) */
694
695 typedef enum {
696 D3DFILTER_NEAREST = 1,
697 D3DFILTER_LINEAR = 2,
698 D3DFILTER_MIPNEAREST = 3,
699 D3DFILTER_MIPLINEAR = 4,
700 D3DFILTER_LINEARMIPNEAREST = 5,
701 D3DFILTER_LINEARMIPLINEAR = 6,
702 D3DFILTER_FORCE_DWORD = 0x7fffffff
703 } D3DTEXTUREFILTER;
704
705 #if (DIRECT3D_VERSION < 0x0800)
706
707 typedef enum {
708 D3DBLEND_ZERO = 1,
709 D3DBLEND_ONE = 2,
710 D3DBLEND_SRCCOLOR = 3,
711 D3DBLEND_INVSRCCOLOR = 4,
712 D3DBLEND_SRCALPHA = 5,
713 D3DBLEND_INVSRCALPHA = 6,
714 D3DBLEND_DESTALPHA = 7,
715 D3DBLEND_INVDESTALPHA = 8,
716 D3DBLEND_DESTCOLOR = 9,
717 D3DBLEND_INVDESTCOLOR = 10,
718 D3DBLEND_SRCALPHASAT = 11,
719 D3DBLEND_BOTHSRCALPHA = 12,
720 D3DBLEND_BOTHINVSRCALPHA = 13,
721 D3DBLEND_FORCE_DWORD = 0x7fffffff
722 } D3DBLEND;
723
724 #endif /* (DIRECT3D_VERSION < 0x0800) */
725
726
727 typedef enum {
728 D3DTBLEND_DECAL = 1,
729 D3DTBLEND_MODULATE = 2,
730 D3DTBLEND_DECALALPHA = 3,
731 D3DTBLEND_MODULATEALPHA = 4,
732 D3DTBLEND_DECALMASK = 5,
733 D3DTBLEND_MODULATEMASK = 6,
734 D3DTBLEND_COPY = 7,
735 D3DTBLEND_ADD = 8,
736 D3DTBLEND_FORCE_DWORD = 0x7fffffff
737 } D3DTEXTUREBLEND;
738
739
740 #if (DIRECT3D_VERSION < 0x0800)
741
742 typedef enum _D3DTEXTUREADDRESS {
743 D3DTADDRESS_WRAP = 1,
744 D3DTADDRESS_MIRROR = 2,
745 D3DTADDRESS_CLAMP = 3,
746 D3DTADDRESS_BORDER = 4,
747 D3DTADDRESS_FORCE_DWORD = 0x7fffffff
748 } D3DTEXTUREADDRESS;
749
750 typedef enum {
751 D3DCULL_NONE = 1,
752 D3DCULL_CW = 2,
753 D3DCULL_CCW = 3,
754 D3DCULL_FORCE_DWORD = 0x7fffffff
755 } D3DCULL;
756
757 typedef enum {
758 D3DCMP_NEVER = 1,
759 D3DCMP_LESS = 2,
760 D3DCMP_EQUAL = 3,
761 D3DCMP_LESSEQUAL = 4,
762 D3DCMP_GREATER = 5,
763 D3DCMP_NOTEQUAL = 6,
764 D3DCMP_GREATEREQUAL = 7,
765 D3DCMP_ALWAYS = 8,
766 D3DCMP_FORCE_DWORD = 0x7fffffff
767 } D3DCMPFUNC;
768
769 typedef enum _D3DSTENCILOP {
770 D3DSTENCILOP_KEEP = 1,
771 D3DSTENCILOP_ZERO = 2,
772 D3DSTENCILOP_REPLACE = 3,
773 D3DSTENCILOP_INCRSAT = 4,
774 D3DSTENCILOP_DECRSAT = 5,
775 D3DSTENCILOP_INVERT = 6,
776 D3DSTENCILOP_INCR = 7,
777 D3DSTENCILOP_DECR = 8,
778 D3DSTENCILOP_FORCE_DWORD = 0x7fffffff
779 } D3DSTENCILOP;
780
781 typedef enum _D3DFOGMODE {
782 D3DFOG_NONE = 0,
783 D3DFOG_EXP = 1,
784 D3DFOG_EXP2 = 2,
785 D3DFOG_LINEAR = 3,
786 D3DFOG_FORCE_DWORD = 0x7fffffff
787 } D3DFOGMODE;
788
789 typedef enum _D3DZBUFFERTYPE {
790 D3DZB_FALSE = 0,
791 D3DZB_TRUE = 1,
792 D3DZB_USEW = 2,
793 D3DZB_FORCE_DWORD = 0x7fffffff
794 } D3DZBUFFERTYPE;
795
796 #endif /* (DIRECT3D_VERSION < 0x0800) */
797
798 typedef enum _D3DANTIALIASMODE {
799 D3DANTIALIAS_NONE = 0,
800 D3DANTIALIAS_SORTDEPENDENT = 1,
801 D3DANTIALIAS_SORTINDEPENDENT = 2,
802 D3DANTIALIAS_FORCE_DWORD = 0x7fffffff
803 } D3DANTIALIASMODE;
804
805 typedef enum {
806 D3DVT_VERTEX = 1,
807 D3DVT_LVERTEX = 2,
808 D3DVT_TLVERTEX = 3,
809 D3DVT_FORCE_DWORD = 0x7fffffff
810 } D3DVERTEXTYPE;
811
812 #if (DIRECT3D_VERSION < 0x0800)
813
814 typedef enum {
815 D3DPT_POINTLIST = 1,
816 D3DPT_LINELIST = 2,
817 D3DPT_LINESTRIP = 3,
818 D3DPT_TRIANGLELIST = 4,
819 D3DPT_TRIANGLESTRIP = 5,
820 D3DPT_TRIANGLEFAN = 6,
821 D3DPT_FORCE_DWORD = 0x7fffffff
822 } D3DPRIMITIVETYPE;
823
824 #endif /* (DIRECT3D_VERSION < 0x0800) */
825
826 #define D3DSTATE_OVERRIDE_BIAS 256
827
828 #define D3DSTATE_OVERRIDE(type) (D3DRENDERSTATETYPE)(((DWORD) (type) + D3DSTATE_OVERRIDE_BIAS))
829
830 #if (DIRECT3D_VERSION < 0x0800)
831
832 typedef enum _D3DTRANSFORMSTATETYPE {
833 D3DTRANSFORMSTATE_WORLD = 1,
834 D3DTRANSFORMSTATE_VIEW = 2,
835 D3DTRANSFORMSTATE_PROJECTION = 3,
836 D3DTRANSFORMSTATE_WORLD1 = 4,
837 D3DTRANSFORMSTATE_WORLD2 = 5,
838 D3DTRANSFORMSTATE_WORLD3 = 6,
839 D3DTRANSFORMSTATE_TEXTURE0 = 16,
840 D3DTRANSFORMSTATE_TEXTURE1 = 17,
841 D3DTRANSFORMSTATE_TEXTURE2 = 18,
842 D3DTRANSFORMSTATE_TEXTURE3 = 19,
843 D3DTRANSFORMSTATE_TEXTURE4 = 20,
844 D3DTRANSFORMSTATE_TEXTURE5 = 21,
845 D3DTRANSFORMSTATE_TEXTURE6 = 22,
846 D3DTRANSFORMSTATE_TEXTURE7 = 23,
847 D3DTRANSFORMSTATE_FORCE_DWORD = 0x7fffffff
848 } D3DTRANSFORMSTATETYPE;
849
850 #endif /* (DIRECT3D_VERSION < 0x0800) */
851
852 typedef enum {
853 D3DLIGHTSTATE_MATERIAL = 1,
854 D3DLIGHTSTATE_AMBIENT = 2,
855 D3DLIGHTSTATE_COLORMODEL = 3,
856 D3DLIGHTSTATE_FOGMODE = 4,
857 D3DLIGHTSTATE_FOGSTART = 5,
858 D3DLIGHTSTATE_FOGEND = 6,
859 D3DLIGHTSTATE_FOGDENSITY = 7,
860 D3DLIGHTSTATE_COLORVERTEX = 8,
861 D3DLIGHTSTATE_FORCE_DWORD = 0x7fffffff
862 } D3DLIGHTSTATETYPE;
863
864 #if (DIRECT3D_VERSION < 0x0800)
865
866 typedef enum {
867 D3DRENDERSTATE_TEXTUREHANDLE = 1,
868 D3DRENDERSTATE_ANTIALIAS = 2,
869 D3DRENDERSTATE_TEXTUREADDRESS = 3,
870 D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4,
871 D3DRENDERSTATE_WRAPU = 5,
872 D3DRENDERSTATE_WRAPV = 6,
873 D3DRENDERSTATE_ZENABLE = 7,
874 D3DRENDERSTATE_FILLMODE = 8,
875 D3DRENDERSTATE_SHADEMODE = 9,
876 D3DRENDERSTATE_LINEPATTERN = 10,
877 D3DRENDERSTATE_MONOENABLE = 11,
878 D3DRENDERSTATE_ROP2 = 12,
879 D3DRENDERSTATE_PLANEMASK = 13,
880 D3DRENDERSTATE_ZWRITEENABLE = 14,
881 D3DRENDERSTATE_ALPHATESTENABLE = 15,
882 D3DRENDERSTATE_LASTPIXEL = 16,
883 D3DRENDERSTATE_TEXTUREMAG = 17,
884 D3DRENDERSTATE_TEXTUREMIN = 18,
885 D3DRENDERSTATE_SRCBLEND = 19,
886 D3DRENDERSTATE_DESTBLEND = 20,
887 D3DRENDERSTATE_TEXTUREMAPBLEND = 21,
888 D3DRENDERSTATE_CULLMODE = 22,
889 D3DRENDERSTATE_ZFUNC = 23,
890 D3DRENDERSTATE_ALPHAREF = 24,
891 D3DRENDERSTATE_ALPHAFUNC = 25,
892 D3DRENDERSTATE_DITHERENABLE = 26,
893 D3DRENDERSTATE_ALPHABLENDENABLE = 27,
894 D3DRENDERSTATE_FOGENABLE = 28,
895 D3DRENDERSTATE_SPECULARENABLE = 29,
896 D3DRENDERSTATE_ZVISIBLE = 30,
897 D3DRENDERSTATE_SUBPIXEL = 31,
898 D3DRENDERSTATE_SUBPIXELX = 32,
899 D3DRENDERSTATE_STIPPLEDALPHA = 33,
900 D3DRENDERSTATE_FOGCOLOR = 34,
901 D3DRENDERSTATE_FOGTABLEMODE = 35,
902 D3DRENDERSTATE_FOGTABLESTART = 36,
903 D3DRENDERSTATE_FOGTABLEEND = 37,
904 D3DRENDERSTATE_FOGTABLEDENSITY = 38,
905 D3DRENDERSTATE_FOGSTART = 36,
906 D3DRENDERSTATE_FOGEND = 37,
907 D3DRENDERSTATE_FOGDENSITY = 38,
908 D3DRENDERSTATE_STIPPLEENABLE = 39,
909 D3DRENDERSTATE_EDGEANTIALIAS = 40,
910 D3DRENDERSTATE_COLORKEYENABLE = 41,
911 D3DRENDERSTATE_BORDERCOLOR = 43,
912 D3DRENDERSTATE_TEXTUREADDRESSU = 44,
913 D3DRENDERSTATE_TEXTUREADDRESSV = 45,
914 D3DRENDERSTATE_MIPMAPLODBIAS = 46,
915 D3DRENDERSTATE_ZBIAS = 47,
916 D3DRENDERSTATE_RANGEFOGENABLE = 48,
917 D3DRENDERSTATE_ANISOTROPY = 49,
918 D3DRENDERSTATE_FLUSHBATCH = 50,
919 D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT = 51,
920
921 D3DRENDERSTATE_STENCILENABLE = 52,
922 D3DRENDERSTATE_STENCILFAIL = 53,
923 D3DRENDERSTATE_STENCILZFAIL = 54,
924 D3DRENDERSTATE_STENCILPASS = 55,
925 D3DRENDERSTATE_STENCILFUNC = 56,
926 D3DRENDERSTATE_STENCILREF = 57,
927 D3DRENDERSTATE_STENCILMASK = 58,
928 D3DRENDERSTATE_STENCILWRITEMASK = 59,
929 D3DRENDERSTATE_TEXTUREFACTOR = 60,
930
931 D3DRENDERSTATE_STIPPLEPATTERN00 = 64,
932 D3DRENDERSTATE_STIPPLEPATTERN01 = 65,
933 D3DRENDERSTATE_STIPPLEPATTERN02 = 66,
934 D3DRENDERSTATE_STIPPLEPATTERN03 = 67,
935 D3DRENDERSTATE_STIPPLEPATTERN04 = 68,
936 D3DRENDERSTATE_STIPPLEPATTERN05 = 69,
937 D3DRENDERSTATE_STIPPLEPATTERN06 = 70,
938 D3DRENDERSTATE_STIPPLEPATTERN07 = 71,
939 D3DRENDERSTATE_STIPPLEPATTERN08 = 72,
940 D3DRENDERSTATE_STIPPLEPATTERN09 = 73,
941 D3DRENDERSTATE_STIPPLEPATTERN10 = 74,
942 D3DRENDERSTATE_STIPPLEPATTERN11 = 75,
943 D3DRENDERSTATE_STIPPLEPATTERN12 = 76,
944 D3DRENDERSTATE_STIPPLEPATTERN13 = 77,
945 D3DRENDERSTATE_STIPPLEPATTERN14 = 78,
946 D3DRENDERSTATE_STIPPLEPATTERN15 = 79,
947 D3DRENDERSTATE_STIPPLEPATTERN16 = 80,
948 D3DRENDERSTATE_STIPPLEPATTERN17 = 81,
949 D3DRENDERSTATE_STIPPLEPATTERN18 = 82,
950 D3DRENDERSTATE_STIPPLEPATTERN19 = 83,
951 D3DRENDERSTATE_STIPPLEPATTERN20 = 84,
952 D3DRENDERSTATE_STIPPLEPATTERN21 = 85,
953 D3DRENDERSTATE_STIPPLEPATTERN22 = 86,
954 D3DRENDERSTATE_STIPPLEPATTERN23 = 87,
955 D3DRENDERSTATE_STIPPLEPATTERN24 = 88,
956 D3DRENDERSTATE_STIPPLEPATTERN25 = 89,
957 D3DRENDERSTATE_STIPPLEPATTERN26 = 90,
958 D3DRENDERSTATE_STIPPLEPATTERN27 = 91,
959 D3DRENDERSTATE_STIPPLEPATTERN28 = 92,
960 D3DRENDERSTATE_STIPPLEPATTERN29 = 93,
961 D3DRENDERSTATE_STIPPLEPATTERN30 = 94,
962 D3DRENDERSTATE_STIPPLEPATTERN31 = 95,
963
964 D3DRENDERSTATE_WRAP0 = 128,
965 D3DRENDERSTATE_WRAP1 = 129,
966 D3DRENDERSTATE_WRAP2 = 130,
967 D3DRENDERSTATE_WRAP3 = 131,
968 D3DRENDERSTATE_WRAP4 = 132,
969 D3DRENDERSTATE_WRAP5 = 133,
970 D3DRENDERSTATE_WRAP6 = 134,
971 D3DRENDERSTATE_WRAP7 = 135,
972 D3DRENDERSTATE_CLIPPING = 136,
973 D3DRENDERSTATE_LIGHTING = 137,
974 D3DRENDERSTATE_EXTENTS = 138,
975 D3DRENDERSTATE_AMBIENT = 139,
976 D3DRENDERSTATE_FOGVERTEXMODE = 140,
977 D3DRENDERSTATE_COLORVERTEX = 141,
978 D3DRENDERSTATE_LOCALVIEWER = 142,
979 D3DRENDERSTATE_NORMALIZENORMALS = 143,
980 D3DRENDERSTATE_COLORKEYBLENDENABLE = 144,
981 D3DRENDERSTATE_DIFFUSEMATERIALSOURCE = 145,
982 D3DRENDERSTATE_SPECULARMATERIALSOURCE = 146,
983 D3DRENDERSTATE_AMBIENTMATERIALSOURCE = 147,
984 D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = 148,
985 D3DRENDERSTATE_VERTEXBLEND = 151,
986 D3DRENDERSTATE_CLIPPLANEENABLE = 152,
987
988 D3DRENDERSTATE_FORCE_DWORD = 0x7fffffff
989
990 /* FIXME: We have some retired values that are being reused for DirectX 7 */
991 } D3DRENDERSTATETYPE;
992
993 typedef enum _D3DMATERIALCOLORSOURCE
994 {
995 D3DMCS_MATERIAL = 0,
996 D3DMCS_COLOR1 = 1,
997 D3DMCS_COLOR2 = 2,
998 D3DMCS_FORCE_DWORD = 0x7fffffff
999 } D3DMATERIALCOLORSOURCE;
1000
1001 #define D3DRENDERSTATE_BLENDENABLE D3DRENDERSTATE_ALPHABLENDENABLE
1002 #define D3DRENDERSTATE_WRAPBIAS 128UL
1003 #define D3DWRAP_U 0x00000001L
1004 #define D3DWRAP_V 0x00000002L
1005
1006 #define D3DWRAPCOORD_0 0x00000001L
1007 #define D3DWRAPCOORD_1 0x00000002L
1008 #define D3DWRAPCOORD_2 0x00000004L
1009 #define D3DWRAPCOORD_3 0x00000008L
1010
1011 #endif /* (DIRECT3D_VERSION < 0x0800) */
1012
1013 #define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y))
1014
1015 typedef struct _D3DSTATE {
1016 union {
1017 D3DTRANSFORMSTATETYPE dtstTransformStateType;
1018 D3DLIGHTSTATETYPE dlstLightStateType;
1019 D3DRENDERSTATETYPE drstRenderStateType;
1020 } DUMMYUNIONNAME1;
1021 union {
1022 DWORD dwArg[1];
1023 D3DVALUE dvArg[1];
1024 } DUMMYUNIONNAME2;
1025 } D3DSTATE, *LPD3DSTATE;
1026
1027 typedef struct _D3DMATRIXLOAD {
1028 D3DMATRIXHANDLE hDestMatrix;
1029 D3DMATRIXHANDLE hSrcMatrix;
1030 } D3DMATRIXLOAD, *LPD3DMATRIXLOAD;
1031
1032 typedef struct _D3DMATRIXMULTIPLY {
1033 D3DMATRIXHANDLE hDestMatrix;
1034 D3DMATRIXHANDLE hSrcMatrix1;
1035 D3DMATRIXHANDLE hSrcMatrix2;
1036 } D3DMATRIXMULTIPLY, *LPD3DMATRIXMULTIPLY;
1037
1038 typedef struct _D3DPROCESSVERTICES {
1039 DWORD dwFlags;
1040 WORD wStart;
1041 WORD wDest;
1042 DWORD dwCount;
1043 DWORD dwReserved;
1044 } D3DPROCESSVERTICES, *LPD3DPROCESSVERTICES;
1045
1046 #define D3DPROCESSVERTICES_TRANSFORMLIGHT 0x00000000L
1047 #define D3DPROCESSVERTICES_TRANSFORM 0x00000001L
1048 #define D3DPROCESSVERTICES_COPY 0x00000002L
1049 #define D3DPROCESSVERTICES_OPMASK 0x00000007L
1050
1051 #define D3DPROCESSVERTICES_UPDATEEXTENTS 0x00000008L
1052 #define D3DPROCESSVERTICES_NOCOLOR 0x00000010L
1053
1054 #if (DIRECT3D_VERSION < 0x0800)
1055
1056 typedef enum _D3DTEXTURESTAGESTATETYPE
1057 {
1058 D3DTSS_COLOROP = 1,
1059 D3DTSS_COLORARG1 = 2,
1060 D3DTSS_COLORARG2 = 3,
1061 D3DTSS_ALPHAOP = 4,
1062 D3DTSS_ALPHAARG1 = 5,
1063 D3DTSS_ALPHAARG2 = 6,
1064 D3DTSS_BUMPENVMAT00 = 7,
1065 D3DTSS_BUMPENVMAT01 = 8,
1066 D3DTSS_BUMPENVMAT10 = 9,
1067 D3DTSS_BUMPENVMAT11 = 10,
1068 D3DTSS_TEXCOORDINDEX = 11,
1069 D3DTSS_ADDRESS = 12,
1070 D3DTSS_ADDRESSU = 13,
1071 D3DTSS_ADDRESSV = 14,
1072 D3DTSS_BORDERCOLOR = 15,
1073 D3DTSS_MAGFILTER = 16,
1074 D3DTSS_MINFILTER = 17,
1075 D3DTSS_MIPFILTER = 18,
1076 D3DTSS_MIPMAPLODBIAS = 19,
1077 D3DTSS_MAXMIPLEVEL = 20,
1078 D3DTSS_MAXANISOTROPY = 21,
1079 D3DTSS_BUMPENVLSCALE = 22,
1080 D3DTSS_BUMPENVLOFFSET = 23,
1081 D3DTSS_TEXTURETRANSFORMFLAGS = 24,
1082 D3DTSS_FORCE_DWORD = 0x7fffffff
1083 } D3DTEXTURESTAGESTATETYPE;
1084
1085 #define D3DTSS_TCI_PASSTHRU 0x00000000
1086 #define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000
1087 #define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000
1088 #define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000
1089
1090 typedef enum _D3DTEXTUREOP
1091 {
1092 D3DTOP_DISABLE = 1,
1093 D3DTOP_SELECTARG1 = 2,
1094 D3DTOP_SELECTARG2 = 3,
1095
1096 D3DTOP_MODULATE = 4,
1097 D3DTOP_MODULATE2X = 5,
1098 D3DTOP_MODULATE4X = 6,
1099
1100 D3DTOP_ADD = 7,
1101 D3DTOP_ADDSIGNED = 8,
1102 D3DTOP_ADDSIGNED2X = 9,
1103 D3DTOP_SUBTRACT = 10,
1104 D3DTOP_ADDSMOOTH = 11,
1105
1106 D3DTOP_BLENDDIFFUSEALPHA = 12,
1107 D3DTOP_BLENDTEXTUREALPHA = 13,
1108 D3DTOP_BLENDFACTORALPHA = 14,
1109 D3DTOP_BLENDTEXTUREALPHAPM = 15,
1110 D3DTOP_BLENDCURRENTALPHA = 16,
1111
1112 D3DTOP_PREMODULATE = 17,
1113 D3DTOP_MODULATEALPHA_ADDCOLOR = 18,
1114 D3DTOP_MODULATECOLOR_ADDALPHA = 19,
1115 D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,
1116 D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,
1117
1118 D3DTOP_BUMPENVMAP = 22,
1119 D3DTOP_BUMPENVMAPLUMINANCE = 23,
1120 D3DTOP_DOTPRODUCT3 = 24,
1121
1122 D3DTOP_FORCE_DWORD = 0x7fffffff
1123 } D3DTEXTUREOP;
1124
1125 #define D3DTA_SELECTMASK 0x0000000f
1126 #define D3DTA_DIFFUSE 0x00000000
1127 #define D3DTA_CURRENT 0x00000001
1128 #define D3DTA_TEXTURE 0x00000002
1129 #define D3DTA_TFACTOR 0x00000003
1130 #define D3DTA_SPECULAR 0x00000004
1131 #define D3DTA_COMPLEMENT 0x00000010
1132 #define D3DTA_ALPHAREPLICATE 0x00000020
1133
1134 #endif /* (DIRECT3D_VERSION < 0x0800) */
1135
1136 typedef enum _D3DTEXTUREMAGFILTER
1137 {
1138 D3DTFG_POINT = 1,
1139 D3DTFG_LINEAR = 2,
1140 D3DTFG_FLATCUBIC = 3,
1141 D3DTFG_GAUSSIANCUBIC = 4,
1142 D3DTFG_ANISOTROPIC = 5,
1143 D3DTFG_FORCE_DWORD = 0x7fffffff
1144 } D3DTEXTUREMAGFILTER;
1145
1146 typedef enum _D3DTEXTUREMINFILTER
1147 {
1148 D3DTFN_POINT = 1,
1149 D3DTFN_LINEAR = 2,
1150 D3DTFN_ANISOTROPIC = 3,
1151 D3DTFN_FORCE_DWORD = 0x7fffffff
1152 } D3DTEXTUREMINFILTER;
1153
1154 typedef enum _D3DTEXTUREMIPFILTER
1155 {
1156 D3DTFP_NONE = 1,
1157 D3DTFP_POINT = 2,
1158 D3DTFP_LINEAR = 3,
1159 D3DTFP_FORCE_DWORD = 0x7fffffff
1160 } D3DTEXTUREMIPFILTER;
1161
1162 #define D3DTRIFLAG_START 0x00000000L
1163 #define D3DTRIFLAG_STARTFLAT(len) (len)
1164 #define D3DTRIFLAG_ODD 0x0000001eL
1165 #define D3DTRIFLAG_EVEN 0x0000001fL
1166
1167 #define D3DTRIFLAG_EDGEENABLE1 0x00000100L
1168 #define D3DTRIFLAG_EDGEENABLE2 0x00000200L
1169 #define D3DTRIFLAG_EDGEENABLE3 0x00000400L
1170 #define D3DTRIFLAG_EDGEENABLETRIANGLE \
1171 (D3DTRIFLAG_EDGEENABLE1 | D3DTRIFLAG_EDGEENABLE2 | D3DTRIFLAG_EDGEENABLE3)
1172
1173 typedef struct _D3DTRIANGLE {
1174 union {
1175 WORD v1;
1176 WORD wV1;
1177 } DUMMYUNIONNAME1;
1178 union {
1179 WORD v2;
1180 WORD wV2;
1181 } DUMMYUNIONNAME2;
1182 union {
1183 WORD v3;
1184 WORD wV3;
1185 } DUMMYUNIONNAME3;
1186 WORD wFlags;
1187 } D3DTRIANGLE, *LPD3DTRIANGLE;
1188
1189 typedef struct _D3DLINE {
1190 union {
1191 WORD v1;
1192 WORD wV1;
1193 } DUMMYUNIONNAME1;
1194 union {
1195 WORD v2;
1196 WORD wV2;
1197 } DUMMYUNIONNAME2;
1198 } D3DLINE, *LPD3DLINE;
1199
1200 typedef struct _D3DSPAN {
1201 WORD wCount;
1202 WORD wFirst;
1203 } D3DSPAN, *LPD3DSPAN;
1204
1205 typedef struct _D3DPOINT {
1206 WORD wCount;
1207 WORD wFirst;
1208 } D3DPOINT, *LPD3DPOINT;
1209
1210 typedef struct _D3DBRANCH {
1211 DWORD dwMask;
1212 DWORD dwValue;
1213 BOOL bNegate;
1214 DWORD dwOffset;
1215 } D3DBRANCH, *LPD3DBRANCH;
1216
1217 typedef struct _D3DSTATUS {
1218 DWORD dwFlags;
1219 DWORD dwStatus;
1220 D3DRECT drExtent;
1221 } D3DSTATUS, *LPD3DSTATUS;
1222
1223 #define D3DSETSTATUS_STATUS 0x00000001L
1224 #define D3DSETSTATUS_EXTENTS 0x00000002L
1225 #define D3DSETSTATUS_ALL (D3DSETSTATUS_STATUS | D3DSETSTATUS_EXTENTS)
1226
1227 typedef struct _D3DCLIPSTATUS {
1228 DWORD dwFlags;
1229 DWORD dwStatus;
1230 float minx, maxx;
1231 float miny, maxy;
1232 float minz, maxz;
1233 } D3DCLIPSTATUS, *LPD3DCLIPSTATUS;
1234
1235 #define D3DCLIPSTATUS_STATUS 0x00000001L
1236 #define D3DCLIPSTATUS_EXTENTS2 0x00000002L
1237 #define D3DCLIPSTATUS_EXTENTS3 0x00000004L
1238
1239 typedef struct {
1240 DWORD dwSize;
1241 DWORD dwTrianglesDrawn;
1242 DWORD dwLinesDrawn;
1243 DWORD dwPointsDrawn;
1244 DWORD dwSpansDrawn;
1245 DWORD dwVerticesProcessed;
1246 } D3DSTATS, *LPD3DSTATS;
1247
1248 #define D3DEXECUTE_CLIPPED 0x00000001l
1249 #define D3DEXECUTE_UNCLIPPED 0x00000002l
1250
1251 typedef struct _D3DEXECUTEDATA {
1252 DWORD dwSize;
1253 DWORD dwVertexOffset;
1254 DWORD dwVertexCount;
1255 DWORD dwInstructionOffset;
1256 DWORD dwInstructionLength;
1257 DWORD dwHVertexOffset;
1258 D3DSTATUS dsStatus;
1259 } D3DEXECUTEDATA, *LPD3DEXECUTEDATA;
1260
1261 #define D3DPAL_FREE 0x00
1262 #define D3DPAL_READONLY 0x40
1263 #define D3DPAL_RESERVED 0x80
1264
1265 typedef struct _D3DVERTEXBUFFERDESC {
1266 DWORD dwSize;
1267 DWORD dwCaps;
1268 DWORD dwFVF;
1269 DWORD dwNumVertices;
1270 } D3DVERTEXBUFFERDESC, *LPD3DVERTEXBUFFERDESC;
1271
1272 #define D3DVBCAPS_SYSTEMMEMORY 0x00000800l
1273 #define D3DVBCAPS_WRITEONLY 0x00010000l
1274 #define D3DVBCAPS_OPTIMIZED 0x80000000l
1275 #define D3DVBCAPS_DONOTCLIP 0x00000001l
1276
1277 #define D3DVOP_LIGHT (1 << 10)
1278 #define D3DVOP_TRANSFORM (1 << 0)
1279 #define D3DVOP_CLIP (1 << 2)
1280 #define D3DVOP_EXTENTS (1 << 3)
1281
1282 #if (DIRECT3D_VERSION < 0x0800)
1283
1284 #define D3DMAXNUMVERTICES ((1<<16) - 1)
1285
1286 #define D3DMAXNUMPRIMITIVES ((1<<16) - 1)
1287
1288 #define D3DPV_DONOTCOPYDATA (1 << 0)
1289
1290 #define D3DFVF_RESERVED0 0x001
1291 #define D3DFVF_POSITION_MASK 0x00E
1292 #define D3DFVF_XYZ 0x002
1293 #define D3DFVF_XYZRHW 0x004
1294 #define D3DFVF_XYZB1 0x006
1295 #define D3DFVF_XYZB2 0x008
1296 #define D3DFVF_XYZB3 0x00a
1297 #define D3DFVF_XYZB4 0x00c
1298 #define D3DFVF_XYZB5 0x00e
1299
1300 #define D3DFVF_NORMAL 0x010
1301 #define D3DFVF_RESERVED1 0x020
1302 #define D3DFVF_DIFFUSE 0x040
1303 #define D3DFVF_SPECULAR 0x080
1304 #define D3DFVF_TEXCOUNT_MASK 0xf00
1305 #define D3DFVF_TEXCOUNT_SHIFT 8
1306 #define D3DFVF_TEX0 0x000
1307 #define D3DFVF_TEX1 0x100
1308 #define D3DFVF_TEX2 0x200
1309 #define D3DFVF_TEX3 0x300
1310 #define D3DFVF_TEX4 0x400
1311 #define D3DFVF_TEX5 0x500
1312 #define D3DFVF_TEX6 0x600
1313 #define D3DFVF_TEX7 0x700
1314 #define D3DFVF_TEX8 0x800
1315
1316 #define D3DFVF_RESERVED2 0xf000
1317
1318 #endif /* (DIRECT3D_VERSION < 0x0800) */
1319
1320 #define D3DFVF_VERTEX ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
1321 #define D3DFVF_LVERTEX ( D3DFVF_XYZ | D3DFVF_RESERVED1 | D3DFVF_DIFFUSE | \
1322 D3DFVF_SPECULAR | D3DFVF_TEX1 )
1323 #define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \
1324 D3DFVF_TEX1 )
1325
1326 typedef struct _D3DDP_PTRSTRIDE {
1327 LPVOID lpvData;
1328 DWORD dwStride;
1329 } D3DDP_PTRSTRIDE;
1330
1331 #define D3DDP_MAXTEXCOORD 8
1332
1333 typedef struct _D3DDRAWPRIMITIVESTRIDEDDATA {
1334 D3DDP_PTRSTRIDE position;
1335 D3DDP_PTRSTRIDE normal;
1336 D3DDP_PTRSTRIDE diffuse;
1337 D3DDP_PTRSTRIDE specular;
1338 D3DDP_PTRSTRIDE textureCoords[D3DDP_MAXTEXCOORD];
1339 } D3DDRAWPRIMITIVESTRIDEDDATA ,*LPD3DDRAWPRIMITIVESTRIDEDDATA;
1340
1341 #define D3DVIS_INSIDE_FRUSTUM 0
1342 #define D3DVIS_INTERSECT_FRUSTUM 1
1343 #define D3DVIS_OUTSIDE_FRUSTUM 2
1344 #define D3DVIS_INSIDE_LEFT 0
1345 #define D3DVIS_INTERSECT_LEFT (1 << 2)
1346 #define D3DVIS_OUTSIDE_LEFT (2 << 2)
1347 #define D3DVIS_INSIDE_RIGHT 0
1348 #define D3DVIS_INTERSECT_RIGHT (1 << 4)
1349 #define D3DVIS_OUTSIDE_RIGHT (2 << 4)
1350 #define D3DVIS_INSIDE_TOP 0
1351 #define D3DVIS_INTERSECT_TOP (1 << 6)
1352 #define D3DVIS_OUTSIDE_TOP (2 << 6)
1353 #define D3DVIS_INSIDE_BOTTOM 0
1354 #define D3DVIS_INTERSECT_BOTTOM (1 << 8)
1355 #define D3DVIS_OUTSIDE_BOTTOM (2 << 8)
1356 #define D3DVIS_INSIDE_NEAR 0
1357 #define D3DVIS_INTERSECT_NEAR (1 << 10)
1358 #define D3DVIS_OUTSIDE_NEAR (2 << 10)
1359 #define D3DVIS_INSIDE_FAR 0
1360 #define D3DVIS_INTERSECT_FAR (1 << 12)
1361 #define D3DVIS_OUTSIDE_FAR (2 << 12)
1362
1363 #define D3DVIS_MASK_FRUSTUM (3 << 0)
1364 #define D3DVIS_MASK_LEFT (3 << 2)
1365 #define D3DVIS_MASK_RIGHT (3 << 4)
1366 #define D3DVIS_MASK_TOP (3 << 6)
1367 #define D3DVIS_MASK_BOTTOM (3 << 8)
1368 #define D3DVIS_MASK_NEAR (3 << 10)
1369 #define D3DVIS_MASK_FAR (3 << 12)
1370
1371
1372 #if (DIRECT3D_VERSION < 0x0800)
1373
1374 #define D3DDEVINFOID_TEXTUREMANAGER 1
1375 #define D3DDEVINFOID_D3DTEXTUREMANAGER 2
1376 #define D3DDEVINFOID_TEXTURING 3
1377
1378 typedef enum _D3DSTATEBLOCKTYPE
1379 {
1380 D3DSBT_ALL = 1,
1381 D3DSBT_PIXELSTATE = 2,
1382 D3DSBT_VERTEXSTATE = 3,
1383 D3DSBT_FORCE_DWORD = 0xffffffff
1384 } D3DSTATEBLOCKTYPE;
1385
1386 typedef enum _D3DVERTEXBLENDFLAGS
1387 {
1388 D3DVBLEND_DISABLE = 0,
1389 D3DVBLEND_1WEIGHT = 1,
1390 D3DVBLEND_2WEIGHTS = 2,
1391 D3DVBLEND_3WEIGHTS = 3,
1392 } D3DVERTEXBLENDFLAGS;
1393
1394 typedef enum _D3DTEXTURETRANSFORMFLAGS {
1395 D3DTTFF_DISABLE = 0,
1396 D3DTTFF_COUNT1 = 1,
1397 D3DTTFF_COUNT2 = 2,
1398 D3DTTFF_COUNT3 = 3,
1399 D3DTTFF_COUNT4 = 4,
1400 D3DTTFF_PROJECTED = 256,
1401 D3DTTFF_FORCE_DWORD = 0x7fffffff
1402 } D3DTEXTURETRANSFORMFLAGS;
1403
1404 #define D3DFVF_TEXTUREFORMAT2 0
1405 #define D3DFVF_TEXTUREFORMAT1 3
1406 #define D3DFVF_TEXTUREFORMAT3 1
1407 #define D3DFVF_TEXTUREFORMAT4 2
1408
1409 #define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
1410 #define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
1411 #define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
1412 #define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
1413
1414 #endif /* (DIRECT3D_VERSION < 0x0800) */
1415
1416 #endif