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