/[cvs]/api/include/d3dtypes.h
ViewVC logotype

Annotation of /api/include/d3dtypes.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sun Jul 1 20:47:59 2001 UTC (22 years, 10 months ago) by bearsoft
Branch point for: lazy, MAIN
File MIME type: text/plain
Initial revision

1 bearsoft 1.1 /*==========================================================================;
2     *
3     * Copyright (C) 1995-1998 Microsoft Corporation. All Rights Reserved.
4     *
5     * File: d3dtypes.h
6     * Content: Direct3D types include file
7     *
8     ***************************************************************************/
9    
10     #ifndef _D3DTYPES_H_
11     #define _D3DTYPES_H_
12    
13     #ifndef DIRECT3D_VERSION
14     #define DIRECT3D_VERSION 0x0700
15     #endif
16    
17     #if (DIRECT3D_VERSION >= 0x0800)
18     #pragma message("should not include d3dtypes.h when compiling for DX8 or newer interfaces")
19     #endif
20    
21     #include <windows.h>
22    
23     #include <float.h>
24     #include "ddraw.h"
25    
26     #pragma warning(disable:4201) // anonymous unions warning
27     #pragma pack(4)
28    
29    
30     /* D3DVALUE is the fundamental Direct3D fractional data type */
31    
32     #define D3DVALP(val, prec) ((float)(val))
33     #define D3DVAL(val) ((float)(val))
34    
35     #ifndef DX_SHARED_DEFINES
36    
37     /*
38     * This definition is shared with other DirectX components whose header files
39     * might already have defined it. Therefore, we don't define this type if
40     * someone else already has (as indicated by the definition of
41     * DX_SHARED_DEFINES). We don't set DX_SHARED_DEFINES here as there are
42     * other types in this header that are also shared. The last of these
43     * shared defines in this file will set DX_SHARED_DEFINES.
44     */
45     typedef float D3DVALUE, *LPD3DVALUE;
46    
47     #endif /* DX_SHARED_DEFINES */
48    
49     #define D3DDivide(a, b) (float)((double) (a) / (double) (b))
50     #define D3DMultiply(a, b) ((a) * (b))
51    
52     typedef LONG D3DFIXED;
53    
54     #ifndef RGB_MAKE
55     /*
56     * Format of CI colors is
57     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58     * | alpha | color index | fraction |
59     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60     */
61     #define CI_GETALPHA(ci) ((ci) >> 24)
62     #define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff)
63     #define CI_GETFRACTION(ci) ((ci) & 0xff)
64     #define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80)
65     #define CI_MASKALPHA(ci) ((ci) & 0xffffff)
66     #define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f))
67    
68     /*
69     * Format of RGBA colors is
70     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71     * | alpha | red | green | blue |
72     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73     */
74     #define RGBA_GETALPHA(rgb) ((rgb) >> 24)
75     #define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff)
76     #define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
77     #define RGBA_GETBLUE(rgb) ((rgb) & 0xff)
78     #define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
79    
80     /* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
81     * The float values must be in the range 0..1
82     */
83     #define D3DRGB(r, g, b) \
84     (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
85     #define D3DRGBA(r, g, b, a) \
86     ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
87     | (((long)((g) * 255)) << 8) | (long)((b) * 255) \
88     )
89    
90     /*
91     * Format of RGB colors is
92     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
93     * | ignored | red | green | blue |
94     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
95     */
96     #define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff)
97     #define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
98     #define RGB_GETBLUE(rgb) ((rgb) & 0xff)
99     #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
100     #define RGB_MAKE(r, g, b) ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b)))
101     #define RGBA_TORGB(rgba) ((D3DCOLOR) ((rgba) & 0xffffff))
102     #define RGB_TORGBA(rgb) ((D3DCOLOR) ((rgb) | 0xff000000))
103    
104     #endif
105    
106     /*
107     * Flags for Enumerate functions
108     */
109    
110     /*
111     * Stop the enumeration
112     */
113     #define D3DENUMRET_CANCEL DDENUMRET_CANCEL
114    
115     /*
116     * Continue the enumeration
117     */
118     #define D3DENUMRET_OK DDENUMRET_OK
119    
120     typedef HRESULT (CALLBACK* LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset);
121     typedef HRESULT (CALLBACK* LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext);
122     typedef HRESULT (CALLBACK* LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext);
123    
124     #ifndef DX_SHARED_DEFINES
125    
126     /*
127     * This definition is shared with other DirectX components whose header files
128     * might already have defined it. Therefore, we don't define this type if
129     * someone else already has (as indicated by the definition of
130     * DX_SHARED_DEFINES). We don't set DX_SHARED_DEFINES here as there are
131     * other types in this header that are also shared. The last of these
132     * shared defines in this file will set DX_SHARED_DEFINES.
133     */
134     #ifndef D3DCOLOR_DEFINED
135     typedef DWORD D3DCOLOR;
136     #define D3DCOLOR_DEFINED
137     #endif
138     typedef DWORD *LPD3DCOLOR;
139    
140     #endif /* DX_SHARED_DEFINES */
141    
142     typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE;
143     typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE;
144     typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE;
145    
146     #ifndef D3DCOLORVALUE_DEFINED
147     typedef struct _D3DCOLORVALUE {
148     union {
149     D3DVALUE r;
150     D3DVALUE dvR;
151     };
152     union {
153     D3DVALUE g;
154     D3DVALUE dvG;
155     };
156     union {
157     D3DVALUE b;
158     D3DVALUE dvB;
159     };
160     union {
161     D3DVALUE a;
162     D3DVALUE dvA;
163     };
164     } D3DCOLORVALUE;
165     #define D3DCOLORVALUE_DEFINED
166     #endif
167     typedef struct _D3DCOLORVALUE *LPD3DCOLORVALUE;
168    
169     #ifndef D3DRECT_DEFINED
170     typedef struct _D3DRECT {
171     union {
172     LONG x1;
173     LONG lX1;
174     };
175     union {
176     LONG y1;
177     LONG lY1;
178     };
179     union {
180     LONG x2;
181     LONG lX2;
182     };
183     union {
184     LONG y2;
185     LONG lY2;
186     };
187     } D3DRECT;
188     #define D3DRECT_DEFINED
189     #endif
190     typedef struct _D3DRECT *LPD3DRECT;
191    
192     #ifndef DX_SHARED_DEFINES
193    
194     /*
195     * This definition is shared with other DirectX components whose header files
196     * might already have defined it. Therefore, we don't define this type if
197     * someone else already has (as indicated by the definition of
198     * DX_SHARED_DEFINES).
199     */
200    
201     #ifndef D3DVECTOR_DEFINED
202     typedef struct _D3DVECTOR {
203     union {
204     D3DVALUE x;
205     D3DVALUE dvX;
206     };
207     union {
208     D3DVALUE y;
209     D3DVALUE dvY;
210     };
211     union {
212     D3DVALUE z;
213     D3DVALUE dvZ;
214     };
215     #if(DIRECT3D_VERSION >= 0x0500)
216     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
217    
218     public:
219    
220     // =====================================
221     // Constructors
222     // =====================================
223    
224     _D3DVECTOR() { }
225     _D3DVECTOR(D3DVALUE f);
226     _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z);
227     _D3DVECTOR(const D3DVALUE f[3]);
228    
229     // =====================================
230     // Access grants
231     // =====================================
232    
233     const D3DVALUE&operator[](int i) const;
234     D3DVALUE&operator[](int i);
235    
236     // =====================================
237     // Assignment operators
238     // =====================================
239    
240     _D3DVECTOR& operator += (const _D3DVECTOR& v);
241     _D3DVECTOR& operator -= (const _D3DVECTOR& v);
242     _D3DVECTOR& operator *= (const _D3DVECTOR& v);
243     _D3DVECTOR& operator /= (const _D3DVECTOR& v);
244     _D3DVECTOR& operator *= (D3DVALUE s);
245     _D3DVECTOR& operator /= (D3DVALUE s);
246    
247     // =====================================
248     // Unary operators
249     // =====================================
250    
251     friend _D3DVECTOR operator + (const _D3DVECTOR& v);
252     friend _D3DVECTOR operator - (const _D3DVECTOR& v);
253    
254    
255     // =====================================
256     // Binary operators
257     // =====================================
258    
259     // Addition and subtraction
260     friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
261     friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
262     // Scalar multiplication and division
263     friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s);
264     friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v);
265     friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s);
266     // Memberwise multiplication and division
267     friend _D3DVECTOR operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
268     friend _D3DVECTOR operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
269    
270     // Vector dominance
271     friend int operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
272     friend int operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
273    
274     // Bitwise equality
275     friend int operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
276    
277     // Length-related functions
278     friend D3DVALUE SquareMagnitude (const _D3DVECTOR& v);
279     friend D3DVALUE Magnitude (const _D3DVECTOR& v);
280    
281     // Returns vector with same direction and unit length
282     friend _D3DVECTOR Normalize (const _D3DVECTOR& v);
283    
284     // Return min/max component of the input vector
285     friend D3DVALUE Min (const _D3DVECTOR& v);
286     friend D3DVALUE Max (const _D3DVECTOR& v);
287    
288     // Return memberwise min/max of input vectors
289     friend _D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
290     friend _D3DVECTOR Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
291    
292     // Dot and cross product
293     friend D3DVALUE DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
294     friend _D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
295    
296     #endif
297     #endif /* DIRECT3D_VERSION >= 0x0500 */
298     } D3DVECTOR;
299     #define D3DVECTOR_DEFINED
300     #endif
301     typedef struct _D3DVECTOR *LPD3DVECTOR;
302    
303     /*
304     * As this is the last of the shared defines to be defined we now set
305     * D3D_SHARED_DEFINES to flag that fact that this header has defined these
306     * types.
307     */
308     #define DX_SHARED_DEFINES
309    
310     #endif /* DX_SHARED_DEFINES */
311    
312     /*
313     * Vertex data types supported in an ExecuteBuffer.
314     */
315    
316     /*
317     * Homogeneous vertices
318     */
319    
320     typedef struct _D3DHVERTEX {
321     DWORD dwFlags; /* Homogeneous clipping flags */
322     union {
323     D3DVALUE hx;
324     D3DVALUE dvHX;
325     };
326     union {
327     D3DVALUE hy;
328     D3DVALUE dvHY;
329     };
330     union {
331     D3DVALUE hz;
332     D3DVALUE dvHZ;
333     };
334     } D3DHVERTEX, *LPD3DHVERTEX;
335    
336     /*
337     * Transformed/lit vertices
338     */
339     typedef struct _D3DTLVERTEX {
340     union {
341     D3DVALUE sx; /* Screen coordinates */
342     D3DVALUE dvSX;
343     };
344     union {
345     D3DVALUE sy;
346     D3DVALUE dvSY;
347     };
348     union {
349     D3DVALUE sz;
350     D3DVALUE dvSZ;
351     };
352     union {
353     D3DVALUE rhw; /* Reciprocal of homogeneous w */
354     D3DVALUE dvRHW;
355     };
356     union {
357     D3DCOLOR color; /* Vertex color */
358     D3DCOLOR dcColor;
359     };
360     union {
361     D3DCOLOR specular; /* Specular component of vertex */
362     D3DCOLOR dcSpecular;
363     };
364     union {
365     D3DVALUE tu; /* Texture coordinates */
366     D3DVALUE dvTU;
367     };
368     union {
369     D3DVALUE tv;
370     D3DVALUE dvTV;
371     };
372     #if(DIRECT3D_VERSION >= 0x0500)
373     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
374     _D3DTLVERTEX() { }
375     _D3DTLVERTEX(const D3DVECTOR& v, float _rhw,
376     D3DCOLOR _color, D3DCOLOR _specular,
377     float _tu, float _tv)
378     { sx = v.x; sy = v.y; sz = v.z; rhw = _rhw;
379     color = _color; specular = _specular;
380     tu = _tu; tv = _tv;
381     }
382     #endif
383     #endif /* DIRECT3D_VERSION >= 0x0500 */
384     } D3DTLVERTEX, *LPD3DTLVERTEX;
385    
386     /*
387     * Untransformed/lit vertices
388     */
389     typedef struct _D3DLVERTEX {
390     union {
391     D3DVALUE x; /* Homogeneous coordinates */
392     D3DVALUE dvX;
393     };
394     union {
395     D3DVALUE y;
396     D3DVALUE dvY;
397     };
398     union {
399     D3DVALUE z;
400     D3DVALUE dvZ;
401     };
402     DWORD dwReserved;
403     union {
404     D3DCOLOR color; /* Vertex color */
405     D3DCOLOR dcColor;
406     };
407     union {
408     D3DCOLOR specular; /* Specular component of vertex */
409     D3DCOLOR dcSpecular;
410     };
411     union {
412     D3DVALUE tu; /* Texture coordinates */
413     D3DVALUE dvTU;
414     };
415     union {
416     D3DVALUE tv;
417     D3DVALUE dvTV;
418     };
419     #if(DIRECT3D_VERSION >= 0x0500)
420     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
421     _D3DLVERTEX() { }
422     _D3DLVERTEX(const D3DVECTOR& v,
423     D3DCOLOR _color, D3DCOLOR _specular,
424     float _tu, float _tv)
425     { x = v.x; y = v.y; z = v.z; dwReserved = 0;
426     color = _color; specular = _specular;
427     tu = _tu; tv = _tv;
428     }
429     #endif
430     #endif /* DIRECT3D_VERSION >= 0x0500 */
431     } D3DLVERTEX, *LPD3DLVERTEX;
432    
433     /*
434     * Untransformed/unlit vertices
435     */
436    
437     typedef struct _D3DVERTEX {
438     union {
439     D3DVALUE x; /* Homogeneous coordinates */
440     D3DVALUE dvX;
441     };
442     union {
443     D3DVALUE y;
444     D3DVALUE dvY;
445     };
446     union {
447     D3DVALUE z;
448     D3DVALUE dvZ;
449     };
450     union {
451     D3DVALUE nx; /* Normal */
452     D3DVALUE dvNX;
453     };
454     union {
455     D3DVALUE ny;
456     D3DVALUE dvNY;
457     };
458     union {
459     D3DVALUE nz;
460     D3DVALUE dvNZ;
461     };
462     union {
463     D3DVALUE tu; /* Texture coordinates */
464     D3DVALUE dvTU;
465     };
466     union {
467     D3DVALUE tv;
468     D3DVALUE dvTV;
469     };
470     #if(DIRECT3D_VERSION >= 0x0500)
471     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
472     _D3DVERTEX() { }
473     _D3DVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, float _tu, float _tv)
474     { x = v.x; y = v.y; z = v.z;
475     nx = n.x; ny = n.y; nz = n.z;
476     tu = _tu; tv = _tv;
477     }
478     #endif
479     #endif /* DIRECT3D_VERSION >= 0x0500 */
480     } D3DVERTEX, *LPD3DVERTEX;
481    
482    
483     /*
484     * Matrix, viewport, and tranformation structures and definitions.
485     */
486    
487     #ifndef D3DMATRIX_DEFINED
488     typedef struct _D3DMATRIX {
489     #if(DIRECT3D_VERSION >= 0x0500)
490     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
491     union {
492     struct {
493     #endif
494    
495     #endif /* DIRECT3D_VERSION >= 0x0500 */
496     D3DVALUE _11, _12, _13, _14;
497     D3DVALUE _21, _22, _23, _24;
498     D3DVALUE _31, _32, _33, _34;
499     D3DVALUE _41, _42, _43, _44;
500    
501     #if(DIRECT3D_VERSION >= 0x0500)
502     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
503     };
504     D3DVALUE m[4][4];
505     };
506     _D3DMATRIX() { }
507     _D3DMATRIX( D3DVALUE _m00, D3DVALUE _m01, D3DVALUE _m02, D3DVALUE _m03,
508     D3DVALUE _m10, D3DVALUE _m11, D3DVALUE _m12, D3DVALUE _m13,
509     D3DVALUE _m20, D3DVALUE _m21, D3DVALUE _m22, D3DVALUE _m23,
510     D3DVALUE _m30, D3DVALUE _m31, D3DVALUE _m32, D3DVALUE _m33
511     )
512     {
513     m[0][0] = _m00; m[0][1] = _m01; m[0][2] = _m02; m[0][3] = _m03;
514     m[1][0] = _m10; m[1][1] = _m11; m[1][2] = _m12; m[1][3] = _m13;
515     m[2][0] = _m20; m[2][1] = _m21; m[2][2] = _m22; m[2][3] = _m23;
516     m[3][0] = _m30; m[3][1] = _m31; m[3][2] = _m32; m[3][3] = _m33;
517     }
518    
519     D3DVALUE& operator()(int iRow, int iColumn) { return m[iRow][iColumn]; }
520     const D3DVALUE& operator()(int iRow, int iColumn) const { return m[iRow][iColumn]; }
521     #if(DIRECT3D_VERSION >= 0x0600)
522     friend _D3DMATRIX operator* (const _D3DMATRIX&, const _D3DMATRIX&);
523     #endif /* DIRECT3D_VERSION >= 0x0600 */
524     #endif
525     #endif /* DIRECT3D_VERSION >= 0x0500 */
526     } D3DMATRIX;
527     #define D3DMATRIX_DEFINED
528     #endif
529     typedef struct _D3DMATRIX *LPD3DMATRIX;
530    
531     #if (defined __cplusplus) && (defined D3D_OVERLOADS)
532     #include "d3dvec.inl"
533     #endif
534    
535     typedef struct _D3DVIEWPORT {
536     DWORD dwSize;
537     DWORD dwX;
538     DWORD dwY; /* Top left */
539     DWORD dwWidth;
540     DWORD dwHeight; /* Dimensions */
541     D3DVALUE dvScaleX; /* Scale homogeneous to screen */
542     D3DVALUE dvScaleY; /* Scale homogeneous to screen */
543     D3DVALUE dvMaxX; /* Min/max homogeneous x coord */
544     D3DVALUE dvMaxY; /* Min/max homogeneous y coord */
545     D3DVALUE dvMinZ;
546     D3DVALUE dvMaxZ; /* Min/max homogeneous z coord */
547     } D3DVIEWPORT, *LPD3DVIEWPORT;
548    
549     #if(DIRECT3D_VERSION >= 0x0500)
550     typedef struct _D3DVIEWPORT2 {
551     DWORD dwSize;
552     DWORD dwX;
553     DWORD dwY; /* Viewport Top left */
554     DWORD dwWidth;
555     DWORD dwHeight; /* Viewport Dimensions */
556     D3DVALUE dvClipX; /* Top left of clip volume */
557     D3DVALUE dvClipY;
558     D3DVALUE dvClipWidth; /* Clip Volume Dimensions */
559     D3DVALUE dvClipHeight;
560     D3DVALUE dvMinZ; /* Min/max of clip Volume */
561     D3DVALUE dvMaxZ;
562     } D3DVIEWPORT2, *LPD3DVIEWPORT2;
563     #endif /* DIRECT3D_VERSION >= 0x0500 */
564    
565     #if(DIRECT3D_VERSION >= 0x0700)
566     typedef struct _D3DVIEWPORT7 {
567     DWORD dwX;
568     DWORD dwY; /* Viewport Top left */
569     DWORD dwWidth;
570     DWORD dwHeight; /* Viewport Dimensions */
571     D3DVALUE dvMinZ; /* Min/max of clip Volume */
572     D3DVALUE dvMaxZ;
573     } D3DVIEWPORT7, *LPD3DVIEWPORT7;
574     #endif /* DIRECT3D_VERSION >= 0x0700 */
575    
576     /*
577     * Values for clip fields.
578     */
579    
580     #if(DIRECT3D_VERSION >= 0x0700)
581    
582     // Max number of user clipping planes, supported in D3D.
583     #define D3DMAXUSERCLIPPLANES 32
584    
585     // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
586     //
587     #define D3DCLIPPLANE0 (1 << 0)
588     #define D3DCLIPPLANE1 (1 << 1)
589     #define D3DCLIPPLANE2 (1 << 2)
590     #define D3DCLIPPLANE3 (1 << 3)
591     #define D3DCLIPPLANE4 (1 << 4)
592     #define D3DCLIPPLANE5 (1 << 5)
593    
594     #endif /* DIRECT3D_VERSION >= 0x0700 */
595    
596     #define D3DCLIP_LEFT 0x00000001L
597     #define D3DCLIP_RIGHT 0x00000002L
598     #define D3DCLIP_TOP 0x00000004L
599     #define D3DCLIP_BOTTOM 0x00000008L
600     #define D3DCLIP_FRONT 0x00000010L
601     #define D3DCLIP_BACK 0x00000020L
602     #define D3DCLIP_GEN0 0x00000040L
603     #define D3DCLIP_GEN1 0x00000080L
604     #define D3DCLIP_GEN2 0x00000100L
605     #define D3DCLIP_GEN3 0x00000200L
606     #define D3DCLIP_GEN4 0x00000400L
607     #define D3DCLIP_GEN5 0x00000800L
608    
609     /*
610     * Values for d3d status.
611     */
612     #define D3DSTATUS_CLIPUNIONLEFT D3DCLIP_LEFT
613     #define D3DSTATUS_CLIPUNIONRIGHT D3DCLIP_RIGHT
614     #define D3DSTATUS_CLIPUNIONTOP D3DCLIP_TOP
615     #define D3DSTATUS_CLIPUNIONBOTTOM D3DCLIP_BOTTOM
616     #define D3DSTATUS_CLIPUNIONFRONT D3DCLIP_FRONT
617     #define D3DSTATUS_CLIPUNIONBACK D3DCLIP_BACK
618     #define D3DSTATUS_CLIPUNIONGEN0 D3DCLIP_GEN0
619     #define D3DSTATUS_CLIPUNIONGEN1 D3DCLIP_GEN1
620     #define D3DSTATUS_CLIPUNIONGEN2 D3DCLIP_GEN2
621     #define D3DSTATUS_CLIPUNIONGEN3 D3DCLIP_GEN3
622     #define D3DSTATUS_CLIPUNIONGEN4 D3DCLIP_GEN4
623     #define D3DSTATUS_CLIPUNIONGEN5 D3DCLIP_GEN5
624    
625     #define D3DSTATUS_CLIPINTERSECTIONLEFT 0x00001000L
626     #define D3DSTATUS_CLIPINTERSECTIONRIGHT 0x00002000L
627     #define D3DSTATUS_CLIPINTERSECTIONTOP 0x00004000L
628     #define D3DSTATUS_CLIPINTERSECTIONBOTTOM 0x00008000L
629     #define D3DSTATUS_CLIPINTERSECTIONFRONT 0x00010000L
630     #define D3DSTATUS_CLIPINTERSECTIONBACK 0x00020000L
631     #define D3DSTATUS_CLIPINTERSECTIONGEN0 0x00040000L
632     #define D3DSTATUS_CLIPINTERSECTIONGEN1 0x00080000L
633     #define D3DSTATUS_CLIPINTERSECTIONGEN2 0x00100000L
634     #define D3DSTATUS_CLIPINTERSECTIONGEN3 0x00200000L
635     #define D3DSTATUS_CLIPINTERSECTIONGEN4 0x00400000L
636     #define D3DSTATUS_CLIPINTERSECTIONGEN5 0x00800000L
637     #define D3DSTATUS_ZNOTVISIBLE 0x01000000L
638     /* Do not use 0x80000000 for any status flags in future as it is reserved */
639    
640     #define D3DSTATUS_CLIPUNIONALL ( \
641     D3DSTATUS_CLIPUNIONLEFT | \
642     D3DSTATUS_CLIPUNIONRIGHT | \
643     D3DSTATUS_CLIPUNIONTOP | \
644     D3DSTATUS_CLIPUNIONBOTTOM | \
645     D3DSTATUS_CLIPUNIONFRONT | \
646     D3DSTATUS_CLIPUNIONBACK | \
647     D3DSTATUS_CLIPUNIONGEN0 | \
648     D3DSTATUS_CLIPUNIONGEN1 | \
649     D3DSTATUS_CLIPUNIONGEN2 | \
650     D3DSTATUS_CLIPUNIONGEN3 | \
651     D3DSTATUS_CLIPUNIONGEN4 | \
652     D3DSTATUS_CLIPUNIONGEN5 \
653     )
654    
655     #define D3DSTATUS_CLIPINTERSECTIONALL ( \
656     D3DSTATUS_CLIPINTERSECTIONLEFT | \
657     D3DSTATUS_CLIPINTERSECTIONRIGHT | \
658     D3DSTATUS_CLIPINTERSECTIONTOP | \
659     D3DSTATUS_CLIPINTERSECTIONBOTTOM | \
660     D3DSTATUS_CLIPINTERSECTIONFRONT | \
661     D3DSTATUS_CLIPINTERSECTIONBACK | \
662     D3DSTATUS_CLIPINTERSECTIONGEN0 | \
663     D3DSTATUS_CLIPINTERSECTIONGEN1 | \
664     D3DSTATUS_CLIPINTERSECTIONGEN2 | \
665     D3DSTATUS_CLIPINTERSECTIONGEN3 | \
666     D3DSTATUS_CLIPINTERSECTIONGEN4 | \
667     D3DSTATUS_CLIPINTERSECTIONGEN5 \
668     )
669    
670     #define D3DSTATUS_DEFAULT ( \
671     D3DSTATUS_CLIPINTERSECTIONALL | \
672     D3DSTATUS_ZNOTVISIBLE)
673    
674    
675     /*
676     * Options for direct transform calls
677     */
678     #define D3DTRANSFORM_CLIPPED 0x00000001l
679     #define D3DTRANSFORM_UNCLIPPED 0x00000002l
680    
681     typedef struct _D3DTRANSFORMDATA {
682     DWORD dwSize;
683     LPVOID lpIn; /* Input vertices */
684     DWORD dwInSize; /* Stride of input vertices */
685     LPVOID lpOut; /* Output vertices */
686     DWORD dwOutSize; /* Stride of output vertices */
687     LPD3DHVERTEX lpHOut; /* Output homogeneous vertices */
688     DWORD dwClip; /* Clipping hint */
689     DWORD dwClipIntersection;
690     DWORD dwClipUnion; /* Union of all clip flags */
691     D3DRECT drExtent; /* Extent of transformed vertices */
692     } D3DTRANSFORMDATA, *LPD3DTRANSFORMDATA;
693    
694     /*
695     * Structure defining position and direction properties for lighting.
696     */
697     typedef struct _D3DLIGHTINGELEMENT {
698     D3DVECTOR dvPosition; /* Lightable point in model space */
699     D3DVECTOR dvNormal; /* Normalised unit vector */
700     } D3DLIGHTINGELEMENT, *LPD3DLIGHTINGELEMENT;
701    
702     /*
703     * Structure defining material properties for lighting.
704     */
705     typedef struct _D3DMATERIAL {
706     DWORD dwSize;
707     union {
708     D3DCOLORVALUE diffuse; /* Diffuse color RGBA */
709     D3DCOLORVALUE dcvDiffuse;
710     };
711     union {
712     D3DCOLORVALUE ambient; /* Ambient color RGB */
713     D3DCOLORVALUE dcvAmbient;
714     };
715     union {
716     D3DCOLORVALUE specular; /* Specular 'shininess' */
717     D3DCOLORVALUE dcvSpecular;
718     };
719     union {
720     D3DCOLORVALUE emissive; /* Emissive color RGB */
721     D3DCOLORVALUE dcvEmissive;
722     };
723     union {
724     D3DVALUE power; /* Sharpness if specular highlight */
725     D3DVALUE dvPower;
726     };
727     D3DTEXTUREHANDLE hTexture; /* Handle to texture map */
728     DWORD dwRampSize;
729     } D3DMATERIAL, *LPD3DMATERIAL;
730    
731     #if(DIRECT3D_VERSION >= 0x0700)
732    
733     typedef struct _D3DMATERIAL7 {
734     union {
735     D3DCOLORVALUE diffuse; /* Diffuse color RGBA */
736     D3DCOLORVALUE dcvDiffuse;
737     };
738     union {
739     D3DCOLORVALUE ambient; /* Ambient color RGB */
740     D3DCOLORVALUE dcvAmbient;
741     };
742     union {
743     D3DCOLORVALUE specular; /* Specular 'shininess' */
744     D3DCOLORVALUE dcvSpecular;
745     };
746     union {
747     D3DCOLORVALUE emissive; /* Emissive color RGB */
748     D3DCOLORVALUE dcvEmissive;
749     };
750     union {
751     D3DVALUE power; /* Sharpness if specular highlight */
752     D3DVALUE dvPower;
753     };
754     } D3DMATERIAL7, *LPD3DMATERIAL7;
755    
756     #endif /* DIRECT3D_VERSION >= 0x0700 */
757    
758     #if(DIRECT3D_VERSION < 0x0800)
759    
760     typedef enum _D3DLIGHTTYPE {
761     D3DLIGHT_POINT = 1,
762     D3DLIGHT_SPOT = 2,
763     D3DLIGHT_DIRECTIONAL = 3,
764     // Note: The following light type (D3DLIGHT_PARALLELPOINT)
765     // is no longer supported from D3D for DX7 onwards.
766     D3DLIGHT_PARALLELPOINT = 4,
767     #if(DIRECT3D_VERSION < 0x0500) // For backward compatible headers
768     D3DLIGHT_GLSPOT = 5,
769     #endif
770     D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
771     } D3DLIGHTTYPE;
772    
773     #else
774     typedef enum _D3DLIGHTTYPE D3DLIGHTTYPE;
775     #define D3DLIGHT_PARALLELPOINT (D3DLIGHTTYPE)4
776     #define D3DLIGHT_GLSPOT (D3DLIGHTTYPE)5
777    
778     #endif //(DIRECT3D_VERSION < 0x0800)
779    
780     /*
781     * Structure defining a light source and its properties.
782     */
783     typedef struct _D3DLIGHT {
784     DWORD dwSize;
785     D3DLIGHTTYPE dltType; /* Type of light source */
786     D3DCOLORVALUE dcvColor; /* Color of light */
787     D3DVECTOR dvPosition; /* Position in world space */
788     D3DVECTOR dvDirection; /* Direction in world space */
789     D3DVALUE dvRange; /* Cutoff range */
790     D3DVALUE dvFalloff; /* Falloff */
791     D3DVALUE dvAttenuation0; /* Constant attenuation */
792     D3DVALUE dvAttenuation1; /* Linear attenuation */
793     D3DVALUE dvAttenuation2; /* Quadratic attenuation */
794     D3DVALUE dvTheta; /* Inner angle of spotlight cone */
795     D3DVALUE dvPhi; /* Outer angle of spotlight cone */
796     } D3DLIGHT, *LPD3DLIGHT;
797    
798     #if(DIRECT3D_VERSION >= 0x0700)
799    
800     typedef struct _D3DLIGHT7 {
801     D3DLIGHTTYPE dltType; /* Type of light source */
802     D3DCOLORVALUE dcvDiffuse; /* Diffuse color of light */
803     D3DCOLORVALUE dcvSpecular; /* Specular color of light */
804     D3DCOLORVALUE dcvAmbient; /* Ambient color of light */
805     D3DVECTOR dvPosition; /* Position in world space */
806     D3DVECTOR dvDirection; /* Direction in world space */
807     D3DVALUE dvRange; /* Cutoff range */
808     D3DVALUE dvFalloff; /* Falloff */
809     D3DVALUE dvAttenuation0; /* Constant attenuation */
810     D3DVALUE dvAttenuation1; /* Linear attenuation */
811     D3DVALUE dvAttenuation2; /* Quadratic attenuation */
812     D3DVALUE dvTheta; /* Inner angle of spotlight cone */
813     D3DVALUE dvPhi; /* Outer angle of spotlight cone */
814     } D3DLIGHT7, *LPD3DLIGHT7;
815    
816     #endif /* DIRECT3D_VERSION >= 0x0700 */
817    
818     #if(DIRECT3D_VERSION >= 0x0500)
819     /*
820     * Structure defining a light source and its properties.
821     */
822    
823     /* flags bits */
824     #define D3DLIGHT_ACTIVE 0x00000001
825     #define D3DLIGHT_NO_SPECULAR 0x00000002
826     #define D3DLIGHT_ALL (D3DLIGHT_ACTIVE | D3DLIGHT_NO_SPECULAR)
827    
828     /* maximum valid light range */
829     #define D3DLIGHT_RANGE_MAX ((float)sqrt(FLT_MAX))
830    
831     typedef struct _D3DLIGHT2 {
832     DWORD dwSize;
833     D3DLIGHTTYPE dltType; /* Type of light source */
834     D3DCOLORVALUE dcvColor; /* Color of light */
835     D3DVECTOR dvPosition; /* Position in world space */
836     D3DVECTOR dvDirection; /* Direction in world space */
837     D3DVALUE dvRange; /* Cutoff range */
838     D3DVALUE dvFalloff; /* Falloff */
839     D3DVALUE dvAttenuation0; /* Constant attenuation */
840     D3DVALUE dvAttenuation1; /* Linear attenuation */
841     D3DVALUE dvAttenuation2; /* Quadratic attenuation */
842     D3DVALUE dvTheta; /* Inner angle of spotlight cone */
843     D3DVALUE dvPhi; /* Outer angle of spotlight cone */
844     DWORD dwFlags;
845     } D3DLIGHT2, *LPD3DLIGHT2;
846    
847     #endif /* DIRECT3D_VERSION >= 0x0500 */
848     typedef struct _D3DLIGHTDATA {
849     DWORD dwSize;
850     LPD3DLIGHTINGELEMENT lpIn; /* Input positions and normals */
851     DWORD dwInSize; /* Stride of input elements */
852     LPD3DTLVERTEX lpOut; /* Output colors */
853     DWORD dwOutSize; /* Stride of output colors */
854     } D3DLIGHTDATA, *LPD3DLIGHTDATA;
855    
856     #if(DIRECT3D_VERSION >= 0x0500)
857     /*
858     * Before DX5, these values were in an enum called
859     * D3DCOLORMODEL. This was not correct, since they are
860     * bit flags. A driver can surface either or both flags
861     * in the dcmColorModel member of D3DDEVICEDESC.
862     */
863     #define D3DCOLOR_MONO 1
864     #define D3DCOLOR_RGB 2
865    
866     typedef DWORD D3DCOLORMODEL;
867     #endif /* DIRECT3D_VERSION >= 0x0500 */
868    
869     /*
870     * Options for clearing
871     */
872     #define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */
873     #define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */
874     #if(DIRECT3D_VERSION >= 0x0600)
875     #define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */
876     #endif /* DIRECT3D_VERSION >= 0x0600 */
877    
878     /*
879     * Execute buffers are allocated via Direct3D. These buffers may then
880     * be filled by the application with instructions to execute along with
881     * vertex data.
882     */
883    
884     /*
885     * Supported op codes for execute instructions.
886     */
887     typedef enum _D3DOPCODE {
888     D3DOP_POINT = 1,
889     D3DOP_LINE = 2,
890     D3DOP_TRIANGLE = 3,
891     D3DOP_MATRIXLOAD = 4,
892     D3DOP_MATRIXMULTIPLY = 5,
893     D3DOP_STATETRANSFORM = 6,
894     D3DOP_STATELIGHT = 7,
895     D3DOP_STATERENDER = 8,
896     D3DOP_PROCESSVERTICES = 9,
897     D3DOP_TEXTURELOAD = 10,
898     D3DOP_EXIT = 11,
899     D3DOP_BRANCHFORWARD = 12,
900     D3DOP_SPAN = 13,
901     D3DOP_SETSTATUS = 14,
902     #if(DIRECT3D_VERSION >= 0x0500)
903     D3DOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
904     #endif /* DIRECT3D_VERSION >= 0x0500 */
905     } D3DOPCODE;
906    
907     typedef struct _D3DINSTRUCTION {
908     BYTE bOpcode; /* Instruction opcode */
909     BYTE bSize; /* Size of each instruction data unit */
910     WORD wCount; /* Count of instruction data units to follow */
911     } D3DINSTRUCTION, *LPD3DINSTRUCTION;
912    
913     /*
914     * Structure for texture loads
915     */
916     typedef struct _D3DTEXTURELOAD {
917     D3DTEXTUREHANDLE hDestTexture;
918     D3DTEXTUREHANDLE hSrcTexture;
919     } D3DTEXTURELOAD, *LPD3DTEXTURELOAD;
920    
921     /*
922     * Structure for picking
923     */
924     typedef struct _D3DPICKRECORD {
925     BYTE bOpcode;
926     BYTE bPad;
927     DWORD dwOffset;
928     D3DVALUE dvZ;
929     } D3DPICKRECORD, *LPD3DPICKRECORD;
930    
931     /*
932     * The following defines the rendering states which can be set in the
933     * execute buffer.
934     */
935    
936     #if(DIRECT3D_VERSION < 0x0800)
937    
938     typedef enum _D3DSHADEMODE {
939     D3DSHADE_FLAT = 1,
940     D3DSHADE_GOURAUD = 2,
941     D3DSHADE_PHONG = 3,
942     #if(DIRECT3D_VERSION >= 0x0500)
943     D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
944     #endif /* DIRECT3D_VERSION >= 0x0500 */
945     } D3DSHADEMODE;
946    
947     typedef enum _D3DFILLMODE {
948     D3DFILL_POINT = 1,
949     D3DFILL_WIREFRAME = 2,
950     D3DFILL_SOLID = 3,
951     #if(DIRECT3D_VERSION >= 0x0500)
952     D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
953     #endif /* DIRECT3D_VERSION >= 0x0500 */
954     } D3DFILLMODE;
955    
956     typedef struct _D3DLINEPATTERN {
957     WORD wRepeatFactor;
958     WORD wLinePattern;
959     } D3DLINEPATTERN;
960    
961     #endif //(DIRECT3D_VERSION < 0x0800)
962    
963     typedef enum _D3DTEXTUREFILTER {
964     D3DFILTER_NEAREST = 1,
965     D3DFILTER_LINEAR = 2,
966     D3DFILTER_MIPNEAREST = 3,
967     D3DFILTER_MIPLINEAR = 4,
968     D3DFILTER_LINEARMIPNEAREST = 5,
969     D3DFILTER_LINEARMIPLINEAR = 6,
970     #if(DIRECT3D_VERSION >= 0x0500)
971     D3DFILTER_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
972     #endif /* DIRECT3D_VERSION >= 0x0500 */
973     } D3DTEXTUREFILTER;
974    
975     #if(DIRECT3D_VERSION < 0x0800)
976    
977     typedef enum _D3DBLEND {
978     D3DBLEND_ZERO = 1,
979     D3DBLEND_ONE = 2,
980     D3DBLEND_SRCCOLOR = 3,
981     D3DBLEND_INVSRCCOLOR = 4,
982     D3DBLEND_SRCALPHA = 5,
983     D3DBLEND_INVSRCALPHA = 6,
984     D3DBLEND_DESTALPHA = 7,
985     D3DBLEND_INVDESTALPHA = 8,
986     D3DBLEND_DESTCOLOR = 9,
987     D3DBLEND_INVDESTCOLOR = 10,
988     D3DBLEND_SRCALPHASAT = 11,
989     D3DBLEND_BOTHSRCALPHA = 12,
990     D3DBLEND_BOTHINVSRCALPHA = 13,
991     #if(DIRECT3D_VERSION >= 0x0500)
992     D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
993     #endif /* DIRECT3D_VERSION >= 0x0500 */
994     } D3DBLEND;
995    
996     #endif //(DIRECT3D_VERSION < 0x0800)
997    
998     typedef enum _D3DTEXTUREBLEND {
999     D3DTBLEND_DECAL = 1,
1000     D3DTBLEND_MODULATE = 2,
1001     D3DTBLEND_DECALALPHA = 3,
1002     D3DTBLEND_MODULATEALPHA = 4,
1003     D3DTBLEND_DECALMASK = 5,
1004     D3DTBLEND_MODULATEMASK = 6,
1005     D3DTBLEND_COPY = 7,
1006     #if(DIRECT3D_VERSION >= 0x0500)
1007     D3DTBLEND_ADD = 8,
1008     D3DTBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1009     #endif /* DIRECT3D_VERSION >= 0x0500 */
1010     } D3DTEXTUREBLEND;
1011    
1012     #if(DIRECT3D_VERSION < 0x0800)
1013    
1014     typedef enum _D3DTEXTUREADDRESS {
1015     D3DTADDRESS_WRAP = 1,
1016     D3DTADDRESS_MIRROR = 2,
1017     D3DTADDRESS_CLAMP = 3,
1018     #if(DIRECT3D_VERSION >= 0x0500)
1019     D3DTADDRESS_BORDER = 4,
1020     D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1021     #endif /* DIRECT3D_VERSION >= 0x0500 */
1022     } D3DTEXTUREADDRESS;
1023    
1024     typedef enum _D3DCULL {
1025     D3DCULL_NONE = 1,
1026     D3DCULL_CW = 2,
1027     D3DCULL_CCW = 3,
1028     #if(DIRECT3D_VERSION >= 0x0500)
1029     D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1030     #endif /* DIRECT3D_VERSION >= 0x0500 */
1031     } D3DCULL;
1032    
1033     typedef enum _D3DCMPFUNC {
1034     D3DCMP_NEVER = 1,
1035     D3DCMP_LESS = 2,
1036     D3DCMP_EQUAL = 3,
1037     D3DCMP_LESSEQUAL = 4,
1038     D3DCMP_GREATER = 5,
1039     D3DCMP_NOTEQUAL = 6,
1040     D3DCMP_GREATEREQUAL = 7,
1041     D3DCMP_ALWAYS = 8,
1042     #if(DIRECT3D_VERSION >= 0x0500)
1043     D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1044     #endif /* DIRECT3D_VERSION >= 0x0500 */
1045     } D3DCMPFUNC;
1046    
1047     #if(DIRECT3D_VERSION >= 0x0600)
1048     typedef enum _D3DSTENCILOP {
1049     D3DSTENCILOP_KEEP = 1,
1050     D3DSTENCILOP_ZERO = 2,
1051     D3DSTENCILOP_REPLACE = 3,
1052     D3DSTENCILOP_INCRSAT = 4,
1053     D3DSTENCILOP_DECRSAT = 5,
1054     D3DSTENCILOP_INVERT = 6,
1055     D3DSTENCILOP_INCR = 7,
1056     D3DSTENCILOP_DECR = 8,
1057     D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1058     } D3DSTENCILOP;
1059     #endif /* DIRECT3D_VERSION >= 0x0600 */
1060    
1061     typedef enum _D3DFOGMODE {
1062     D3DFOG_NONE = 0,
1063     D3DFOG_EXP = 1,
1064     D3DFOG_EXP2 = 2,
1065     #if(DIRECT3D_VERSION >= 0x0500)
1066     D3DFOG_LINEAR = 3,
1067     D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1068     #endif /* DIRECT3D_VERSION >= 0x0500 */
1069     } D3DFOGMODE;
1070    
1071     #if(DIRECT3D_VERSION >= 0x0600)
1072     typedef enum _D3DZBUFFERTYPE {
1073     D3DZB_FALSE = 0,
1074     D3DZB_TRUE = 1, // Z buffering
1075     D3DZB_USEW = 2, // W buffering
1076     D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1077     } D3DZBUFFERTYPE;
1078     #endif /* DIRECT3D_VERSION >= 0x0600 */
1079    
1080     #endif //(DIRECT3D_VERSION < 0x0800)
1081    
1082     #if(DIRECT3D_VERSION >= 0x0500)
1083     typedef enum _D3DANTIALIASMODE {
1084     D3DANTIALIAS_NONE = 0,
1085     D3DANTIALIAS_SORTDEPENDENT = 1,
1086     D3DANTIALIAS_SORTINDEPENDENT = 2,
1087     D3DANTIALIAS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1088     } D3DANTIALIASMODE;
1089    
1090     // Vertex types supported by Direct3D
1091     typedef enum _D3DVERTEXTYPE {
1092     D3DVT_VERTEX = 1,
1093     D3DVT_LVERTEX = 2,
1094     D3DVT_TLVERTEX = 3,
1095     D3DVT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1096     } D3DVERTEXTYPE;
1097    
1098     #if(DIRECT3D_VERSION < 0x0800)
1099    
1100     // Primitives supported by draw-primitive API
1101     typedef enum _D3DPRIMITIVETYPE {
1102     D3DPT_POINTLIST = 1,
1103     D3DPT_LINELIST = 2,
1104     D3DPT_LINESTRIP = 3,
1105     D3DPT_TRIANGLELIST = 4,
1106     D3DPT_TRIANGLESTRIP = 5,
1107     D3DPT_TRIANGLEFAN = 6,
1108     D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1109     } D3DPRIMITIVETYPE;
1110    
1111     #endif //(DIRECT3D_VERSION < 0x0800)
1112    
1113     #endif /* DIRECT3D_VERSION >= 0x0500 */
1114     /*
1115     * Amount to add to a state to generate the override for that state.
1116     */
1117     #define D3DSTATE_OVERRIDE_BIAS 256
1118    
1119     /*
1120     * A state which sets the override flag for the specified state type.
1121     */
1122     #define D3DSTATE_OVERRIDE(type) (D3DRENDERSTATETYPE)(((DWORD) (type) + D3DSTATE_OVERRIDE_BIAS))
1123    
1124     #if(DIRECT3D_VERSION < 0x0800)
1125    
1126     typedef enum _D3DTRANSFORMSTATETYPE {
1127     D3DTRANSFORMSTATE_WORLD = 1,
1128     D3DTRANSFORMSTATE_VIEW = 2,
1129     D3DTRANSFORMSTATE_PROJECTION = 3,
1130     #if(DIRECT3D_VERSION >= 0x0700)
1131     D3DTRANSFORMSTATE_WORLD1 = 4, // 2nd matrix to blend
1132     D3DTRANSFORMSTATE_WORLD2 = 5, // 3rd matrix to blend
1133     D3DTRANSFORMSTATE_WORLD3 = 6, // 4th matrix to blend
1134     D3DTRANSFORMSTATE_TEXTURE0 = 16,
1135     D3DTRANSFORMSTATE_TEXTURE1 = 17,
1136     D3DTRANSFORMSTATE_TEXTURE2 = 18,
1137     D3DTRANSFORMSTATE_TEXTURE3 = 19,
1138     D3DTRANSFORMSTATE_TEXTURE4 = 20,
1139     D3DTRANSFORMSTATE_TEXTURE5 = 21,
1140     D3DTRANSFORMSTATE_TEXTURE6 = 22,
1141     D3DTRANSFORMSTATE_TEXTURE7 = 23,
1142     #endif /* DIRECT3D_VERSION >= 0x0700 */
1143     #if(DIRECT3D_VERSION >= 0x0500)
1144     D3DTRANSFORMSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1145     #endif /* DIRECT3D_VERSION >= 0x0500 */
1146     } D3DTRANSFORMSTATETYPE;
1147    
1148     #else
1149    
1150     //
1151     // legacy transform state names
1152     //
1153     typedef enum _D3DTRANSFORMSTATETYPE D3DTRANSFORMSTATETYPE;
1154     #define D3DTRANSFORMSTATE_WORLD (D3DTRANSFORMSTATETYPE)1
1155     #define D3DTRANSFORMSTATE_VIEW (D3DTRANSFORMSTATETYPE)2
1156     #define D3DTRANSFORMSTATE_PROJECTION (D3DTRANSFORMSTATETYPE)3
1157     #define D3DTRANSFORMSTATE_WORLD1 (D3DTRANSFORMSTATETYPE)4
1158     #define D3DTRANSFORMSTATE_WORLD2 (D3DTRANSFORMSTATETYPE)5
1159     #define D3DTRANSFORMSTATE_WORLD3 (D3DTRANSFORMSTATETYPE)6
1160     #define D3DTRANSFORMSTATE_TEXTURE0 (D3DTRANSFORMSTATETYPE)16
1161     #define D3DTRANSFORMSTATE_TEXTURE1 (D3DTRANSFORMSTATETYPE)17
1162     #define D3DTRANSFORMSTATE_TEXTURE2 (D3DTRANSFORMSTATETYPE)18
1163     #define D3DTRANSFORMSTATE_TEXTURE3 (D3DTRANSFORMSTATETYPE)19
1164     #define D3DTRANSFORMSTATE_TEXTURE4 (D3DTRANSFORMSTATETYPE)20
1165     #define D3DTRANSFORMSTATE_TEXTURE5 (D3DTRANSFORMSTATETYPE)21
1166     #define D3DTRANSFORMSTATE_TEXTURE6 (D3DTRANSFORMSTATETYPE)22
1167     #define D3DTRANSFORMSTATE_TEXTURE7 (D3DTRANSFORMSTATETYPE)23
1168    
1169     #endif //(DIRECT3D_VERSION < 0x0800)
1170    
1171     typedef enum _D3DLIGHTSTATETYPE {
1172     D3DLIGHTSTATE_MATERIAL = 1,
1173     D3DLIGHTSTATE_AMBIENT = 2,
1174     D3DLIGHTSTATE_COLORMODEL = 3,
1175     D3DLIGHTSTATE_FOGMODE = 4,
1176     D3DLIGHTSTATE_FOGSTART = 5,
1177     D3DLIGHTSTATE_FOGEND = 6,
1178     D3DLIGHTSTATE_FOGDENSITY = 7,
1179     #if(DIRECT3D_VERSION >= 0x0600)
1180     D3DLIGHTSTATE_COLORVERTEX = 8,
1181     #endif /* DIRECT3D_VERSION >= 0x0600 */
1182     #if(DIRECT3D_VERSION >= 0x0500)
1183     D3DLIGHTSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1184     #endif /* DIRECT3D_VERSION >= 0x0500 */
1185     } D3DLIGHTSTATETYPE;
1186    
1187     #if(DIRECT3D_VERSION < 0x0800)
1188    
1189     typedef enum _D3DRENDERSTATETYPE {
1190     D3DRENDERSTATE_ANTIALIAS = 2, /* D3DANTIALIASMODE */
1191     D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4, /* TRUE for perspective correction */
1192     D3DRENDERSTATE_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */
1193     D3DRENDERSTATE_FILLMODE = 8, /* D3DFILL_MODE */
1194     D3DRENDERSTATE_SHADEMODE = 9, /* D3DSHADEMODE */
1195     D3DRENDERSTATE_LINEPATTERN = 10, /* D3DLINEPATTERN */
1196     D3DRENDERSTATE_ZWRITEENABLE = 14, /* TRUE to enable z writes */
1197     D3DRENDERSTATE_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */
1198     D3DRENDERSTATE_LASTPIXEL = 16, /* TRUE for last-pixel on lines */
1199     D3DRENDERSTATE_SRCBLEND = 19, /* D3DBLEND */
1200     D3DRENDERSTATE_DESTBLEND = 20, /* D3DBLEND */
1201     D3DRENDERSTATE_CULLMODE = 22, /* D3DCULL */
1202     D3DRENDERSTATE_ZFUNC = 23, /* D3DCMPFUNC */
1203     D3DRENDERSTATE_ALPHAREF = 24, /* D3DFIXED */
1204     D3DRENDERSTATE_ALPHAFUNC = 25, /* D3DCMPFUNC */
1205     D3DRENDERSTATE_DITHERENABLE = 26, /* TRUE to enable dithering */
1206     #if(DIRECT3D_VERSION >= 0x0500)
1207     D3DRENDERSTATE_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */
1208     #endif /* DIRECT3D_VERSION >= 0x0500 */
1209     D3DRENDERSTATE_FOGENABLE = 28, /* TRUE to enable fog blending */
1210     D3DRENDERSTATE_SPECULARENABLE = 29, /* TRUE to enable specular */
1211     D3DRENDERSTATE_ZVISIBLE = 30, /* TRUE to enable z checking */
1212     D3DRENDERSTATE_STIPPLEDALPHA = 33, /* TRUE to enable stippled alpha (RGB device only) */
1213     D3DRENDERSTATE_FOGCOLOR = 34, /* D3DCOLOR */
1214     D3DRENDERSTATE_FOGTABLEMODE = 35, /* D3DFOGMODE */
1215     #if(DIRECT3D_VERSION >= 0x0700)
1216     D3DRENDERSTATE_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */
1217     D3DRENDERSTATE_FOGEND = 37, /* Fog end */
1218     D3DRENDERSTATE_FOGDENSITY = 38, /* Fog density */
1219     #endif /* DIRECT3D_VERSION >= 0x0700 */
1220     #if(DIRECT3D_VERSION >= 0x0500)
1221     D3DRENDERSTATE_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */
1222     D3DRENDERSTATE_COLORKEYENABLE = 41, /* TRUE to enable source colorkeyed textures */
1223     D3DRENDERSTATE_ZBIAS = 47, /* LONG Z bias */
1224     D3DRENDERSTATE_RANGEFOGENABLE = 48, /* Enables range-based fog */
1225     #endif /* DIRECT3D_VERSION >= 0x0500 */
1226    
1227     #if(DIRECT3D_VERSION >= 0x0600)
1228     D3DRENDERSTATE_STENCILENABLE = 52, /* BOOL enable/disable stenciling */
1229     D3DRENDERSTATE_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */
1230     D3DRENDERSTATE_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */
1231     D3DRENDERSTATE_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */
1232     D3DRENDERSTATE_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */
1233     D3DRENDERSTATE_STENCILREF = 57, /* Reference value used in stencil test */
1234     D3DRENDERSTATE_STENCILMASK = 58, /* Mask value used in stencil test */
1235     D3DRENDERSTATE_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */
1236     D3DRENDERSTATE_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */
1237     #endif /* DIRECT3D_VERSION >= 0x0600 */
1238    
1239     #if(DIRECT3D_VERSION >= 0x0600)
1240    
1241     /*
1242     * 128 values [128, 255] are reserved for texture coordinate wrap flags.
1243     * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
1244     * a flags word preserves forward compatibility with texture coordinates
1245     * that are >2D.
1246     */
1247     D3DRENDERSTATE_WRAP0 = 128, /* wrap for 1st texture coord. set */
1248     D3DRENDERSTATE_WRAP1 = 129, /* wrap for 2nd texture coord. set */
1249     D3DRENDERSTATE_WRAP2 = 130, /* wrap for 3rd texture coord. set */
1250     D3DRENDERSTATE_WRAP3 = 131, /* wrap for 4th texture coord. set */
1251     D3DRENDERSTATE_WRAP4 = 132, /* wrap for 5th texture coord. set */
1252     D3DRENDERSTATE_WRAP5 = 133, /* wrap for 6th texture coord. set */
1253     D3DRENDERSTATE_WRAP6 = 134, /* wrap for 7th texture coord. set */
1254     D3DRENDERSTATE_WRAP7 = 135, /* wrap for 8th texture coord. set */
1255     #endif /* DIRECT3D_VERSION >= 0x0600 */
1256     #if(DIRECT3D_VERSION >= 0x0700)
1257     D3DRENDERSTATE_CLIPPING = 136,
1258     D3DRENDERSTATE_LIGHTING = 137,
1259     D3DRENDERSTATE_EXTENTS = 138,
1260     D3DRENDERSTATE_AMBIENT = 139,
1261     D3DRENDERSTATE_FOGVERTEXMODE = 140,
1262     D3DRENDERSTATE_COLORVERTEX = 141,
1263     D3DRENDERSTATE_LOCALVIEWER = 142,
1264     D3DRENDERSTATE_NORMALIZENORMALS = 143,
1265     D3DRENDERSTATE_COLORKEYBLENDENABLE = 144,
1266     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE = 145,
1267     D3DRENDERSTATE_SPECULARMATERIALSOURCE = 146,
1268     D3DRENDERSTATE_AMBIENTMATERIALSOURCE = 147,
1269     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = 148,
1270     D3DRENDERSTATE_VERTEXBLEND = 151,
1271     D3DRENDERSTATE_CLIPPLANEENABLE = 152,
1272    
1273     #endif /* DIRECT3D_VERSION >= 0x0700 */
1274    
1275     //
1276     // retired renderstates - not supported for DX7 interfaces
1277     //
1278     D3DRENDERSTATE_TEXTUREHANDLE = 1, /* Texture handle for legacy interfaces (Texture,Texture2) */
1279     D3DRENDERSTATE_TEXTUREADDRESS = 3, /* D3DTEXTUREADDRESS */
1280     D3DRENDERSTATE_WRAPU = 5, /* TRUE for wrapping in u */
1281     D3DRENDERSTATE_WRAPV = 6, /* TRUE for wrapping in v */
1282     D3DRENDERSTATE_MONOENABLE = 11, /* TRUE to enable mono rasterization */
1283     D3DRENDERSTATE_ROP2 = 12, /* ROP2 */
1284     D3DRENDERSTATE_PLANEMASK = 13, /* DWORD physical plane mask */
1285     D3DRENDERSTATE_TEXTUREMAG = 17, /* D3DTEXTUREFILTER */
1286     D3DRENDERSTATE_TEXTUREMIN = 18, /* D3DTEXTUREFILTER */
1287     D3DRENDERSTATE_TEXTUREMAPBLEND = 21, /* D3DTEXTUREBLEND */
1288     D3DRENDERSTATE_SUBPIXEL = 31, /* TRUE to enable subpixel correction */
1289     D3DRENDERSTATE_SUBPIXELX = 32, /* TRUE to enable correction in X only */
1290     D3DRENDERSTATE_STIPPLEENABLE = 39, /* TRUE to enable stippling */
1291     #if(DIRECT3D_VERSION >= 0x0500)
1292     D3DRENDERSTATE_BORDERCOLOR = 43, /* Border color for texturing w/border */
1293     D3DRENDERSTATE_TEXTUREADDRESSU = 44, /* Texture addressing mode for U coordinate */
1294     D3DRENDERSTATE_TEXTUREADDRESSV = 45, /* Texture addressing mode for V coordinate */
1295     D3DRENDERSTATE_MIPMAPLODBIAS = 46, /* D3DVALUE Mipmap LOD bias */
1296     D3DRENDERSTATE_ANISOTROPY = 49, /* Max. anisotropy. 1 = no anisotropy */
1297     #endif /* DIRECT3D_VERSION >= 0x0500 */
1298     D3DRENDERSTATE_FLUSHBATCH = 50, /* Explicit flush for DP batching (DX5 Only) */
1299     #if(DIRECT3D_VERSION >= 0x0600)
1300     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51, /* BOOL enable sort-independent transparency */
1301     #endif /* DIRECT3D_VERSION >= 0x0600 */
1302     D3DRENDERSTATE_STIPPLEPATTERN00 = 64, /* Stipple pattern 01... */
1303     D3DRENDERSTATE_STIPPLEPATTERN01 = 65,
1304     D3DRENDERSTATE_STIPPLEPATTERN02 = 66,
1305     D3DRENDERSTATE_STIPPLEPATTERN03 = 67,
1306     D3DRENDERSTATE_STIPPLEPATTERN04 = 68,
1307     D3DRENDERSTATE_STIPPLEPATTERN05 = 69,
1308     D3DRENDERSTATE_STIPPLEPATTERN06 = 70,
1309     D3DRENDERSTATE_STIPPLEPATTERN07 = 71,
1310     D3DRENDERSTATE_STIPPLEPATTERN08 = 72,
1311     D3DRENDERSTATE_STIPPLEPATTERN09 = 73,
1312     D3DRENDERSTATE_STIPPLEPATTERN10 = 74,
1313     D3DRENDERSTATE_STIPPLEPATTERN11 = 75,
1314     D3DRENDERSTATE_STIPPLEPATTERN12 = 76,
1315     D3DRENDERSTATE_STIPPLEPATTERN13 = 77,
1316     D3DRENDERSTATE_STIPPLEPATTERN14 = 78,
1317     D3DRENDERSTATE_STIPPLEPATTERN15 = 79,
1318     D3DRENDERSTATE_STIPPLEPATTERN16 = 80,
1319     D3DRENDERSTATE_STIPPLEPATTERN17 = 81,
1320     D3DRENDERSTATE_STIPPLEPATTERN18 = 82,
1321     D3DRENDERSTATE_STIPPLEPATTERN19 = 83,
1322     D3DRENDERSTATE_STIPPLEPATTERN20 = 84,
1323     D3DRENDERSTATE_STIPPLEPATTERN21 = 85,
1324     D3DRENDERSTATE_STIPPLEPATTERN22 = 86,
1325     D3DRENDERSTATE_STIPPLEPATTERN23 = 87,
1326     D3DRENDERSTATE_STIPPLEPATTERN24 = 88,
1327     D3DRENDERSTATE_STIPPLEPATTERN25 = 89,
1328     D3DRENDERSTATE_STIPPLEPATTERN26 = 90,
1329     D3DRENDERSTATE_STIPPLEPATTERN27 = 91,
1330     D3DRENDERSTATE_STIPPLEPATTERN28 = 92,
1331     D3DRENDERSTATE_STIPPLEPATTERN29 = 93,
1332     D3DRENDERSTATE_STIPPLEPATTERN30 = 94,
1333     D3DRENDERSTATE_STIPPLEPATTERN31 = 95,
1334    
1335     //
1336     // retired renderstate names - the values are still used under new naming conventions
1337     //
1338     D3DRENDERSTATE_FOGTABLESTART = 36, /* Fog table start */
1339     D3DRENDERSTATE_FOGTABLEEND = 37, /* Fog table end */
1340     D3DRENDERSTATE_FOGTABLEDENSITY = 38, /* Fog table density */
1341    
1342     #if(DIRECT3D_VERSION >= 0x0500)
1343     D3DRENDERSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1344     #endif /* DIRECT3D_VERSION >= 0x0500 */
1345     } D3DRENDERSTATETYPE;
1346    
1347     #else
1348    
1349     typedef enum _D3DRENDERSTATETYPE D3DRENDERSTATETYPE;
1350    
1351     //
1352     // legacy renderstate names
1353     //
1354     #define D3DRENDERSTATE_TEXTUREPERSPECTIVE (D3DRENDERSTATETYPE)4
1355     #define D3DRENDERSTATE_ZENABLE (D3DRENDERSTATETYPE)7
1356     #define D3DRENDERSTATE_FILLMODE (D3DRENDERSTATETYPE)8
1357     #define D3DRENDERSTATE_SHADEMODE (D3DRENDERSTATETYPE)9
1358     #define D3DRENDERSTATE_LINEPATTERN (D3DRENDERSTATETYPE)10
1359     #define D3DRENDERSTATE_ZWRITEENABLE (D3DRENDERSTATETYPE)14
1360     #define D3DRENDERSTATE_ALPHATESTENABLE (D3DRENDERSTATETYPE)15
1361     #define D3DRENDERSTATE_LASTPIXEL (D3DRENDERSTATETYPE)16
1362     #define D3DRENDERSTATE_SRCBLEND (D3DRENDERSTATETYPE)19
1363     #define D3DRENDERSTATE_DESTBLEND (D3DRENDERSTATETYPE)20
1364     #define D3DRENDERSTATE_CULLMODE (D3DRENDERSTATETYPE)22
1365     #define D3DRENDERSTATE_ZFUNC (D3DRENDERSTATETYPE)23
1366     #define D3DRENDERSTATE_ALPHAREF (D3DRENDERSTATETYPE)24
1367     #define D3DRENDERSTATE_ALPHAFUNC (D3DRENDERSTATETYPE)25
1368     #define D3DRENDERSTATE_DITHERENABLE (D3DRENDERSTATETYPE)26
1369     #define D3DRENDERSTATE_ALPHABLENDENABLE (D3DRENDERSTATETYPE)27
1370     #define D3DRENDERSTATE_FOGENABLE (D3DRENDERSTATETYPE)28
1371     #define D3DRENDERSTATE_SPECULARENABLE (D3DRENDERSTATETYPE)29
1372     #define D3DRENDERSTATE_ZVISIBLE (D3DRENDERSTATETYPE)30
1373     #define D3DRENDERSTATE_STIPPLEDALPHA (D3DRENDERSTATETYPE)33
1374     #define D3DRENDERSTATE_FOGCOLOR (D3DRENDERSTATETYPE)34
1375     #define D3DRENDERSTATE_FOGTABLEMODE (D3DRENDERSTATETYPE)35
1376     #define D3DRENDERSTATE_FOGSTART (D3DRENDERSTATETYPE)36
1377     #define D3DRENDERSTATE_FOGEND (D3DRENDERSTATETYPE)37
1378     #define D3DRENDERSTATE_FOGDENSITY (D3DRENDERSTATETYPE)38
1379     #define D3DRENDERSTATE_EDGEANTIALIAS (D3DRENDERSTATETYPE)40
1380     #define D3DRENDERSTATE_ZBIAS (D3DRENDERSTATETYPE)47
1381     #define D3DRENDERSTATE_RANGEFOGENABLE (D3DRENDERSTATETYPE)48
1382     #define D3DRENDERSTATE_STENCILENABLE (D3DRENDERSTATETYPE)52
1383     #define D3DRENDERSTATE_STENCILFAIL (D3DRENDERSTATETYPE)53
1384     #define D3DRENDERSTATE_STENCILZFAIL (D3DRENDERSTATETYPE)54
1385     #define D3DRENDERSTATE_STENCILPASS (D3DRENDERSTATETYPE)55
1386     #define D3DRENDERSTATE_STENCILFUNC (D3DRENDERSTATETYPE)56
1387     #define D3DRENDERSTATE_STENCILREF (D3DRENDERSTATETYPE)57
1388     #define D3DRENDERSTATE_STENCILMASK (D3DRENDERSTATETYPE)58
1389     #define D3DRENDERSTATE_STENCILWRITEMASK (D3DRENDERSTATETYPE)59
1390     #define D3DRENDERSTATE_TEXTUREFACTOR (D3DRENDERSTATETYPE)60
1391     #define D3DRENDERSTATE_WRAP0 (D3DRENDERSTATETYPE)128
1392     #define D3DRENDERSTATE_WRAP1 (D3DRENDERSTATETYPE)129
1393     #define D3DRENDERSTATE_WRAP2 (D3DRENDERSTATETYPE)130
1394     #define D3DRENDERSTATE_WRAP3 (D3DRENDERSTATETYPE)131
1395     #define D3DRENDERSTATE_WRAP4 (D3DRENDERSTATETYPE)132
1396     #define D3DRENDERSTATE_WRAP5 (D3DRENDERSTATETYPE)133
1397     #define D3DRENDERSTATE_WRAP6 (D3DRENDERSTATETYPE)134
1398     #define D3DRENDERSTATE_WRAP7 (D3DRENDERSTATETYPE)135
1399    
1400     #define D3DRENDERSTATE_CLIPPING (D3DRENDERSTATETYPE)136
1401     #define D3DRENDERSTATE_LIGHTING (D3DRENDERSTATETYPE)137
1402     #define D3DRENDERSTATE_EXTENTS (D3DRENDERSTATETYPE)138
1403     #define D3DRENDERSTATE_AMBIENT (D3DRENDERSTATETYPE)139
1404     #define D3DRENDERSTATE_FOGVERTEXMODE (D3DRENDERSTATETYPE)140
1405     #define D3DRENDERSTATE_COLORVERTEX (D3DRENDERSTATETYPE)141
1406     #define D3DRENDERSTATE_LOCALVIEWER (D3DRENDERSTATETYPE)142
1407     #define D3DRENDERSTATE_NORMALIZENORMALS (D3DRENDERSTATETYPE)143
1408     #define D3DRENDERSTATE_COLORKEYBLENDENABLE (D3DRENDERSTATETYPE)144
1409     #define D3DRENDERSTATE_DIFFUSEMATERIALSOURCE (D3DRENDERSTATETYPE)145
1410     #define D3DRENDERSTATE_SPECULARMATERIALSOURCE (D3DRENDERSTATETYPE)146
1411     #define D3DRENDERSTATE_AMBIENTMATERIALSOURCE (D3DRENDERSTATETYPE)147
1412     #define D3DRENDERSTATE_EMISSIVEMATERIALSOURCE (D3DRENDERSTATETYPE)148
1413     #define D3DRENDERSTATE_VERTEXBLEND (D3DRENDERSTATETYPE)151
1414     #define D3DRENDERSTATE_CLIPPLANEENABLE (D3DRENDERSTATETYPE)152
1415    
1416     //
1417     // retired renderstates - not supported for DX7 interfaces
1418     //
1419     #define D3DRENDERSTATE_TEXTUREHANDLE (D3DRENDERSTATETYPE)1
1420     #define D3DRENDERSTATE_ANTIALIAS (D3DRENDERSTATETYPE)2
1421     #define D3DRENDERSTATE_TEXTUREADDRESS (D3DRENDERSTATETYPE)3
1422     #define D3DRENDERSTATE_WRAPU (D3DRENDERSTATETYPE)5
1423     #define D3DRENDERSTATE_WRAPV (D3DRENDERSTATETYPE)6
1424     #define D3DRENDERSTATE_MONOENABLE (D3DRENDERSTATETYPE)11
1425     #define D3DRENDERSTATE_ROP2 (D3DRENDERSTATETYPE)12
1426     #define D3DRENDERSTATE_PLANEMASK (D3DRENDERSTATETYPE)13
1427     #define D3DRENDERSTATE_TEXTUREMAG (D3DRENDERSTATETYPE)17
1428     #define D3DRENDERSTATE_TEXTUREMIN (D3DRENDERSTATETYPE)18
1429     #define D3DRENDERSTATE_TEXTUREMAPBLEND (D3DRENDERSTATETYPE)21
1430     #define D3DRENDERSTATE_SUBPIXEL (D3DRENDERSTATETYPE)31
1431     #define D3DRENDERSTATE_SUBPIXELX (D3DRENDERSTATETYPE)32
1432     #define D3DRENDERSTATE_STIPPLEENABLE (D3DRENDERSTATETYPE)39
1433     #define D3DRENDERSTATE_OLDALPHABLENDENABLE (D3DRENDERSTATETYPE)42
1434     #define D3DRENDERSTATE_BORDERCOLOR (D3DRENDERSTATETYPE)43
1435     #define D3DRENDERSTATE_TEXTUREADDRESSU (D3DRENDERSTATETYPE)44
1436     #define D3DRENDERSTATE_TEXTUREADDRESSV (D3DRENDERSTATETYPE)45
1437     #define D3DRENDERSTATE_MIPMAPLODBIAS (D3DRENDERSTATETYPE)46
1438     #define D3DRENDERSTATE_ANISOTROPY (D3DRENDERSTATETYPE)49
1439     #define D3DRENDERSTATE_FLUSHBATCH (D3DRENDERSTATETYPE)50
1440     #define D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT (D3DRENDERSTATETYPE)51
1441     #define D3DRENDERSTATE_STIPPLEPATTERN00 (D3DRENDERSTATETYPE)64
1442     #define D3DRENDERSTATE_STIPPLEPATTERN01 (D3DRENDERSTATETYPE)65
1443     #define D3DRENDERSTATE_STIPPLEPATTERN02 (D3DRENDERSTATETYPE)66
1444     #define D3DRENDERSTATE_STIPPLEPATTERN03 (D3DRENDERSTATETYPE)67
1445     #define D3DRENDERSTATE_STIPPLEPATTERN04 (D3DRENDERSTATETYPE)68
1446     #define D3DRENDERSTATE_STIPPLEPATTERN05 (D3DRENDERSTATETYPE)69
1447     #define D3DRENDERSTATE_STIPPLEPATTERN06 (D3DRENDERSTATETYPE)70
1448     #define D3DRENDERSTATE_STIPPLEPATTERN07 (D3DRENDERSTATETYPE)71
1449     #define D3DRENDERSTATE_STIPPLEPATTERN08 (D3DRENDERSTATETYPE)72
1450     #define D3DRENDERSTATE_STIPPLEPATTERN09 (D3DRENDERSTATETYPE)73
1451     #define D3DRENDERSTATE_STIPPLEPATTERN10 (D3DRENDERSTATETYPE)74
1452     #define D3DRENDERSTATE_STIPPLEPATTERN11 (D3DRENDERSTATETYPE)75
1453     #define D3DRENDERSTATE_STIPPLEPATTERN12 (D3DRENDERSTATETYPE)76
1454     #define D3DRENDERSTATE_STIPPLEPATTERN13 (D3DRENDERSTATETYPE)77
1455     #define D3DRENDERSTATE_STIPPLEPATTERN14 (D3DRENDERSTATETYPE)78
1456     #define D3DRENDERSTATE_STIPPLEPATTERN15 (D3DRENDERSTATETYPE)79
1457     #define D3DRENDERSTATE_STIPPLEPATTERN16 (D3DRENDERSTATETYPE)80
1458     #define D3DRENDERSTATE_STIPPLEPATTERN17 (D3DRENDERSTATETYPE)81
1459     #define D3DRENDERSTATE_STIPPLEPATTERN18 (D3DRENDERSTATETYPE)82
1460     #define D3DRENDERSTATE_STIPPLEPATTERN19 (D3DRENDERSTATETYPE)83
1461     #define D3DRENDERSTATE_STIPPLEPATTERN20 (D3DRENDERSTATETYPE)84
1462     #define D3DRENDERSTATE_STIPPLEPATTERN21 (D3DRENDERSTATETYPE)85
1463     #define D3DRENDERSTATE_STIPPLEPATTERN22 (D3DRENDERSTATETYPE)86
1464     #define D3DRENDERSTATE_STIPPLEPATTERN23 (D3DRENDERSTATETYPE)87
1465     #define D3DRENDERSTATE_STIPPLEPATTERN24 (D3DRENDERSTATETYPE)88
1466     #define D3DRENDERSTATE_STIPPLEPATTERN25 (D3DRENDERSTATETYPE)89
1467     #define D3DRENDERSTATE_STIPPLEPATTERN26 (D3DRENDERSTATETYPE)90
1468     #define D3DRENDERSTATE_STIPPLEPATTERN27 (D3DRENDERSTATETYPE)91
1469     #define D3DRENDERSTATE_STIPPLEPATTERN28 (D3DRENDERSTATETYPE)92
1470     #define D3DRENDERSTATE_STIPPLEPATTERN29 (D3DRENDERSTATETYPE)93
1471     #define D3DRENDERSTATE_STIPPLEPATTERN30 (D3DRENDERSTATETYPE)94
1472     #define D3DRENDERSTATE_STIPPLEPATTERN31 (D3DRENDERSTATETYPE)95
1473    
1474     //
1475     // retired renderstates - not supported for DX8 interfaces
1476     //
1477     #define D3DRENDERSTATE_COLORKEYENABLE (D3DRENDERSTATETYPE)41
1478     #define D3DRENDERSTATE_COLORKEYBLENDENABLE (D3DRENDERSTATETYPE)144
1479    
1480     //
1481     // retired renderstate names - the values are still used under new naming conventions
1482     //
1483     #define D3DRENDERSTATE_BLENDENABLE (D3DRENDERSTATETYPE)27
1484     #define D3DRENDERSTATE_FOGTABLESTART (D3DRENDERSTATETYPE)36
1485     #define D3DRENDERSTATE_FOGTABLEEND (D3DRENDERSTATETYPE)37
1486     #define D3DRENDERSTATE_FOGTABLEDENSITY (D3DRENDERSTATETYPE)38
1487    
1488     #endif //(DIRECT3D_VERSION < 0x0800)
1489    
1490    
1491     #if(DIRECT3D_VERSION < 0x0800)
1492    
1493     // Values for material source
1494     typedef enum _D3DMATERIALCOLORSOURCE
1495     {
1496     D3DMCS_MATERIAL = 0, // Color from material is used
1497     D3DMCS_COLOR1 = 1, // Diffuse vertex color is used
1498     D3DMCS_COLOR2 = 2, // Specular vertex color is used
1499     D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
1500     } D3DMATERIALCOLORSOURCE;
1501    
1502    
1503     #if(DIRECT3D_VERSION >= 0x0500)
1504     // For back-compatibility with legacy compilations
1505     #define D3DRENDERSTATE_BLENDENABLE D3DRENDERSTATE_ALPHABLENDENABLE
1506     #endif /* DIRECT3D_VERSION >= 0x0500 */
1507    
1508     #if(DIRECT3D_VERSION >= 0x0600)
1509    
1510     // Bias to apply to the texture coordinate set to apply a wrap to.
1511     #define D3DRENDERSTATE_WRAPBIAS 128UL
1512    
1513     /* Flags to construct the WRAP render states */
1514     #define D3DWRAP_U 0x00000001L
1515     #define D3DWRAP_V 0x00000002L
1516    
1517     #endif /* DIRECT3D_VERSION >= 0x0600 */
1518    
1519     #if(DIRECT3D_VERSION >= 0x0700)
1520    
1521     /* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */
1522     #define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U
1523     #define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V
1524     #define D3DWRAPCOORD_2 0x00000004L
1525     #define D3DWRAPCOORD_3 0x00000008L
1526    
1527     #endif /* DIRECT3D_VERSION >= 0x0700 */
1528    
1529     #endif //(DIRECT3D_VERSION < 0x0800)
1530    
1531     #define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y))
1532    
1533     typedef struct _D3DSTATE {
1534     union {
1535     #if(DIRECT3D_VERSION < 0x0800)
1536     D3DTRANSFORMSTATETYPE dtstTransformStateType;
1537     #endif //(DIRECT3D_VERSION < 0x0800)
1538     D3DLIGHTSTATETYPE dlstLightStateType;
1539     D3DRENDERSTATETYPE drstRenderStateType;
1540     };
1541     union {
1542     DWORD dwArg[1];
1543     D3DVALUE dvArg[1];
1544     };
1545     } D3DSTATE, *LPD3DSTATE;
1546    
1547    
1548     /*
1549     * Operation used to load matrices
1550     * hDstMat = hSrcMat
1551     */
1552     typedef struct _D3DMATRIXLOAD {
1553     D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */
1554     D3DMATRIXHANDLE hSrcMatrix; /* Source matrix */
1555     } D3DMATRIXLOAD, *LPD3DMATRIXLOAD;
1556    
1557     /*
1558     * Operation used to multiply matrices
1559     * hDstMat = hSrcMat1 * hSrcMat2
1560     */
1561     typedef struct _D3DMATRIXMULTIPLY {
1562     D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */
1563     D3DMATRIXHANDLE hSrcMatrix1; /* First source matrix */
1564     D3DMATRIXHANDLE hSrcMatrix2; /* Second source matrix */
1565     } D3DMATRIXMULTIPLY, *LPD3DMATRIXMULTIPLY;
1566    
1567     /*
1568     * Operation used to transform and light vertices.
1569     */
1570     typedef struct _D3DPROCESSVERTICES {
1571     DWORD dwFlags; /* Do we transform or light or just copy? */
1572     WORD wStart; /* Index to first vertex in source */
1573     WORD wDest; /* Index to first vertex in local buffer */
1574     DWORD dwCount; /* Number of vertices to be processed */
1575     DWORD dwReserved; /* Must be zero */
1576     } D3DPROCESSVERTICES, *LPD3DPROCESSVERTICES;
1577    
1578     #define D3DPROCESSVERTICES_TRANSFORMLIGHT 0x00000000L
1579     #define D3DPROCESSVERTICES_TRANSFORM 0x00000001L
1580     #define D3DPROCESSVERTICES_COPY 0x00000002L
1581     #define D3DPROCESSVERTICES_OPMASK 0x00000007L
1582    
1583     #define D3DPROCESSVERTICES_UPDATEEXTENTS 0x00000008L
1584     #define D3DPROCESSVERTICES_NOCOLOR 0x00000010L
1585    
1586    
1587     #if(DIRECT3D_VERSION >= 0x0600)
1588    
1589    
1590     #if(DIRECT3D_VERSION < 0x0800)
1591    
1592     /*
1593     * State enumerants for per-stage texture processing.
1594     */
1595     typedef enum _D3DTEXTURESTAGESTATETYPE
1596     {
1597     D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */
1598     D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */
1599     D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */
1600     D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */
1601     D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */
1602     D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */
1603     D3DTSS_BUMPENVMAT00 = 7, /* D3DVALUE (bump mapping matrix) */
1604     D3DTSS_BUMPENVMAT01 = 8, /* D3DVALUE (bump mapping matrix) */
1605     D3DTSS_BUMPENVMAT10 = 9, /* D3DVALUE (bump mapping matrix) */
1606     D3DTSS_BUMPENVMAT11 = 10, /* D3DVALUE (bump mapping matrix) */
1607     D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */
1608     D3DTSS_ADDRESS = 12, /* D3DTEXTUREADDRESS for both coordinates */
1609     D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */
1610     D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */
1611     D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */
1612     D3DTSS_MAGFILTER = 16, /* D3DTEXTUREMAGFILTER filter to use for magnification */
1613     D3DTSS_MINFILTER = 17, /* D3DTEXTUREMINFILTER filter to use for minification */
1614     D3DTSS_MIPFILTER = 18, /* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification */
1615     D3DTSS_MIPMAPLODBIAS = 19, /* D3DVALUE Mipmap LOD bias */
1616     D3DTSS_MAXMIPLEVEL = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */
1617     D3DTSS_MAXANISOTROPY = 21, /* DWORD maximum anisotropy */
1618     D3DTSS_BUMPENVLSCALE = 22, /* D3DVALUE scale for bump map luminance */
1619     D3DTSS_BUMPENVLOFFSET = 23, /* D3DVALUE offset for bump map luminance */
1620     #if(DIRECT3D_VERSION >= 0x0700)
1621     D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */
1622     #endif /* DIRECT3D_VERSION >= 0x0700 */
1623     D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
1624     } D3DTEXTURESTAGESTATETYPE;
1625    
1626     #if(DIRECT3D_VERSION >= 0x0700)
1627     // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
1628     // and normal in the camera space) should be taken as texture coordinates
1629     // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
1630     //
1631     #define D3DTSS_TCI_PASSTHRU 0x00000000
1632     #define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000
1633     #define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000
1634     #define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000
1635     #endif /* DIRECT3D_VERSION >= 0x0700 */
1636    
1637     /*
1638     * Enumerations for COLOROP and ALPHAOP texture blending operations set in
1639     * texture processing stage controls in D3DRENDERSTATE.
1640     */
1641     typedef enum _D3DTEXTUREOP
1642     {
1643     // Control
1644     D3DTOP_DISABLE = 1, // disables stage
1645     D3DTOP_SELECTARG1 = 2, // the default
1646     D3DTOP_SELECTARG2 = 3,
1647    
1648     // Modulate
1649     D3DTOP_MODULATE = 4, // multiply args together
1650     D3DTOP_MODULATE2X = 5, // multiply and 1 bit
1651     D3DTOP_MODULATE4X = 6, // multiply and 2 bits
1652    
1653     // Add
1654     D3DTOP_ADD = 7, // add arguments together
1655     D3DTOP_ADDSIGNED = 8, // add with -0.5 bias
1656     D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit
1657     D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation
1658     D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product
1659     // Arg1 + Arg2 - Arg1*Arg2
1660     // = Arg1 + (1-Arg1)*Arg2
1661    
1662     // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
1663     D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha
1664     D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha
1665     D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRENDERSTATE_TEXTUREFACTOR
1666     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
1667     D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha
1668     D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color
1669    
1670     // Specular mapping
1671     D3DTOP_PREMODULATE = 17, // modulate with next texture before use
1672     D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB
1673     // COLOROP only
1674     D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A
1675     // COLOROP only
1676     D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
1677     // COLOROP only
1678     D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
1679     // COLOROP only
1680    
1681     // Bump mapping
1682     D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation
1683     D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel
1684     // This can do either diffuse or specular bump mapping with correct input.
1685     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
1686     // where each component has been scaled and offset to make it signed.
1687     // The result is replicated into all four (including alpha) channels.
1688     // This is a valid COLOROP only.
1689     D3DTOP_DOTPRODUCT3 = 24,
1690    
1691     D3DTOP_FORCE_DWORD = 0x7fffffff,
1692     } D3DTEXTUREOP;
1693    
1694     /*
1695     * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
1696     * set in texture processing stage controls in D3DRENDERSTATE.
1697     */
1698     #define D3DTA_SELECTMASK 0x0000000f // mask for arg selector
1699     #define D3DTA_DIFFUSE 0x00000000 // select diffuse color
1700     #define D3DTA_CURRENT 0x00000001 // select result of previous stage
1701     #define D3DTA_TEXTURE 0x00000002 // select texture color
1702     #define D3DTA_TFACTOR 0x00000003 // select RENDERSTATE_TEXTUREFACTOR
1703     #if(DIRECT3D_VERSION >= 0x0700)
1704     #define D3DTA_SPECULAR 0x00000004 // select specular color
1705     #endif /* DIRECT3D_VERSION >= 0x0700 */
1706     #define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x
1707     #define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components
1708    
1709     #endif //(DIRECT3D_VERSION < 0x0800)
1710    
1711     /*
1712     * IDirect3DTexture2 State Filter Types
1713     */
1714     typedef enum _D3DTEXTUREMAGFILTER
1715     {
1716     D3DTFG_POINT = 1, // nearest
1717     D3DTFG_LINEAR = 2, // linear interpolation
1718     D3DTFG_FLATCUBIC = 3, // cubic
1719     D3DTFG_GAUSSIANCUBIC = 4, // different cubic kernel
1720     D3DTFG_ANISOTROPIC = 5, //
1721     #if(DIRECT3D_VERSION >= 0x0700)
1722     #endif /* DIRECT3D_VERSION >= 0x0700 */
1723     D3DTFG_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
1724     } D3DTEXTUREMAGFILTER;
1725    
1726     typedef enum _D3DTEXTUREMINFILTER
1727     {
1728     D3DTFN_POINT = 1, // nearest
1729     D3DTFN_LINEAR = 2, // linear interpolation
1730     D3DTFN_ANISOTROPIC = 3, //
1731     D3DTFN_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
1732     } D3DTEXTUREMINFILTER;
1733    
1734     typedef enum _D3DTEXTUREMIPFILTER
1735     {
1736     D3DTFP_NONE = 1, // mipmapping disabled (use MAG filter)
1737     D3DTFP_POINT = 2, // nearest
1738     D3DTFP_LINEAR = 3, // linear interpolation
1739     D3DTFP_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
1740     } D3DTEXTUREMIPFILTER;
1741    
1742     #endif /* DIRECT3D_VERSION >= 0x0600 */
1743    
1744     /*
1745     * Triangle flags
1746     */
1747    
1748     /*
1749     * Tri strip and fan flags.
1750     * START loads all three vertices
1751     * EVEN and ODD load just v3 with even or odd culling
1752     * START_FLAT contains a count from 0 to 29 that allows the
1753     * whole strip or fan to be culled in one hit.
1754     * e.g. for a quad len = 1
1755     */
1756     #define D3DTRIFLAG_START 0x00000000L
1757     #define D3DTRIFLAG_STARTFLAT(len) (len) /* 0 < len < 30 */
1758     #define D3DTRIFLAG_ODD 0x0000001eL
1759     #define D3DTRIFLAG_EVEN 0x0000001fL
1760    
1761     /*
1762     * Triangle edge flags
1763     * enable edges for wireframe or antialiasing
1764     */
1765     #define D3DTRIFLAG_EDGEENABLE1 0x00000100L /* v0-v1 edge */
1766     #define D3DTRIFLAG_EDGEENABLE2 0x00000200L /* v1-v2 edge */
1767     #define D3DTRIFLAG_EDGEENABLE3 0x00000400L /* v2-v0 edge */
1768     #define D3DTRIFLAG_EDGEENABLETRIANGLE \
1769     (D3DTRIFLAG_EDGEENABLE1 | D3DTRIFLAG_EDGEENABLE2 | D3DTRIFLAG_EDGEENABLE3)
1770    
1771     /*
1772     * Primitive structures and related defines. Vertex offsets are to types
1773     * D3DVERTEX, D3DLVERTEX, or D3DTLVERTEX.
1774     */
1775    
1776     /*
1777     * Triangle list primitive structure
1778     */
1779     typedef struct _D3DTRIANGLE {
1780     union {
1781     WORD v1; /* Vertex indices */
1782     WORD wV1;
1783     };
1784     union {
1785     WORD v2;
1786     WORD wV2;
1787     };
1788     union {
1789     WORD v3;
1790     WORD wV3;
1791     };
1792     WORD wFlags; /* Edge (and other) flags */
1793     } D3DTRIANGLE, *LPD3DTRIANGLE;
1794    
1795     /*
1796     * Line list structure.
1797     * The instruction count defines the number of line segments.
1798     */
1799     typedef struct _D3DLINE {
1800     union {
1801     WORD v1; /* Vertex indices */
1802     WORD wV1;
1803     };
1804     union {
1805     WORD v2;
1806     WORD wV2;
1807     };
1808     } D3DLINE, *LPD3DLINE;
1809    
1810     /*
1811     * Span structure
1812     * Spans join a list of points with the same y value.
1813     * If the y value changes, a new span is started.
1814     */
1815     typedef struct _D3DSPAN {
1816     WORD wCount; /* Number of spans */
1817     WORD wFirst; /* Index to first vertex */
1818     } D3DSPAN, *LPD3DSPAN;
1819    
1820     /*
1821     * Point structure
1822     */
1823     typedef struct _D3DPOINT {
1824     WORD wCount; /* number of points */
1825     WORD wFirst; /* index to first vertex */
1826     } D3DPOINT, *LPD3DPOINT;
1827    
1828    
1829     /*
1830     * Forward branch structure.
1831     * Mask is logically anded with the driver status mask
1832     * if the result equals 'value', the branch is taken.
1833     */
1834     typedef struct _D3DBRANCH {
1835     DWORD dwMask; /* Bitmask against D3D status */
1836     DWORD dwValue;
1837     BOOL bNegate; /* TRUE to negate comparison */
1838     DWORD dwOffset; /* How far to branch forward (0 for exit)*/
1839     } D3DBRANCH, *LPD3DBRANCH;
1840    
1841     /*
1842     * Status used for set status instruction.
1843     * The D3D status is initialised on device creation
1844     * and is modified by all execute calls.
1845     */
1846     typedef struct _D3DSTATUS {
1847     DWORD dwFlags; /* Do we set extents or status */
1848     DWORD dwStatus; /* D3D status */
1849     D3DRECT drExtent;
1850     } D3DSTATUS, *LPD3DSTATUS;
1851    
1852     #define D3DSETSTATUS_STATUS 0x00000001L
1853     #define D3DSETSTATUS_EXTENTS 0x00000002L
1854     #define D3DSETSTATUS_ALL (D3DSETSTATUS_STATUS | D3DSETSTATUS_EXTENTS)
1855    
1856     #if(DIRECT3D_VERSION >= 0x0500)
1857     typedef struct _D3DCLIPSTATUS {
1858     DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */
1859     DWORD dwStatus; /* Clip status */
1860     float minx, maxx; /* X extents */
1861     float miny, maxy; /* Y extents */
1862     float minz, maxz; /* Z extents */
1863     } D3DCLIPSTATUS, *LPD3DCLIPSTATUS;
1864    
1865     #define D3DCLIPSTATUS_STATUS 0x00000001L
1866     #define D3DCLIPSTATUS_EXTENTS2 0x00000002L
1867     #define D3DCLIPSTATUS_EXTENTS3 0x00000004L
1868    
1869     #endif /* DIRECT3D_VERSION >= 0x0500 */
1870     /*
1871     * Statistics structure
1872     */
1873     typedef struct _D3DSTATS {
1874     DWORD dwSize;
1875     DWORD dwTrianglesDrawn;
1876     DWORD dwLinesDrawn;
1877     DWORD dwPointsDrawn;
1878     DWORD dwSpansDrawn;
1879     DWORD dwVerticesProcessed;
1880     } D3DSTATS, *LPD3DSTATS;
1881    
1882     /*
1883     * Execute options.
1884     * When calling using D3DEXECUTE_UNCLIPPED all the primitives
1885     * inside the buffer must be contained within the viewport.
1886     */
1887     #define D3DEXECUTE_CLIPPED 0x00000001l
1888     #define D3DEXECUTE_UNCLIPPED 0x00000002l
1889    
1890     typedef struct _D3DEXECUTEDATA {
1891     DWORD dwSize;
1892     DWORD dwVertexOffset;
1893     DWORD dwVertexCount;
1894     DWORD dwInstructionOffset;
1895     DWORD dwInstructionLength;
1896     DWORD dwHVertexOffset;
1897     D3DSTATUS dsStatus; /* Status after execute */
1898     } D3DEXECUTEDATA, *LPD3DEXECUTEDATA;
1899    
1900     /*
1901     * Palette flags.
1902     * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
1903     */
1904     #define D3DPAL_FREE 0x00 /* Renderer may use this entry freely */
1905     #define D3DPAL_READONLY 0x40 /* Renderer may not set this entry */
1906     #define D3DPAL_RESERVED 0x80 /* Renderer may not use this entry */
1907    
1908    
1909     #if(DIRECT3D_VERSION >= 0x0600)
1910    
1911     typedef struct _D3DVERTEXBUFFERDESC {
1912     DWORD dwSize;
1913     DWORD dwCaps;
1914     DWORD dwFVF;
1915     DWORD dwNumVertices;
1916     } D3DVERTEXBUFFERDESC, *LPD3DVERTEXBUFFERDESC;
1917    
1918     #define D3DVBCAPS_SYSTEMMEMORY 0x00000800l
1919     #define D3DVBCAPS_WRITEONLY 0x00010000l
1920     #define D3DVBCAPS_OPTIMIZED 0x80000000l
1921     #define D3DVBCAPS_DONOTCLIP 0x00000001l
1922    
1923     /* Vertex Operations for ProcessVertices */
1924     #define D3DVOP_LIGHT (1 << 10)
1925     #define D3DVOP_TRANSFORM (1 << 0)
1926     #define D3DVOP_CLIP (1 << 2)
1927     #define D3DVOP_EXTENTS (1 << 3)
1928    
1929    
1930     #if(DIRECT3D_VERSION < 0x0800)
1931    
1932     /* The maximum number of vertices user can pass to any d3d
1933     drawing function or to create vertex buffer with
1934     */
1935     #define D3DMAXNUMVERTICES ((1<<16) - 1)
1936     /* The maximum number of primitives user can pass to any d3d
1937     drawing function.
1938     */
1939     #define D3DMAXNUMPRIMITIVES ((1<<16) - 1)
1940    
1941     #if(DIRECT3D_VERSION >= 0x0700)
1942    
1943     /* Bits for dwFlags in ProcessVertices call */
1944     #define D3DPV_DONOTCOPYDATA (1 << 0)
1945    
1946     #endif /* DIRECT3D_VERSION >= 0x0700 */
1947    
1948     #endif //(DIRECT3D_VERSION < 0x0800)
1949    
1950     //-------------------------------------------------------------------
1951    
1952     #if(DIRECT3D_VERSION < 0x0800)
1953    
1954     // Flexible vertex format bits
1955     //
1956     #define D3DFVF_RESERVED0 0x001
1957     #define D3DFVF_POSITION_MASK 0x00E
1958     #define D3DFVF_XYZ 0x002
1959     #define D3DFVF_XYZRHW 0x004
1960     #if(DIRECT3D_VERSION >= 0x0700)
1961     #define D3DFVF_XYZB1 0x006
1962     #define D3DFVF_XYZB2 0x008
1963     #define D3DFVF_XYZB3 0x00a
1964     #define D3DFVF_XYZB4 0x00c
1965     #define D3DFVF_XYZB5 0x00e
1966    
1967     #endif /* DIRECT3D_VERSION >= 0x0700 */
1968     #define D3DFVF_NORMAL 0x010
1969     #define D3DFVF_RESERVED1 0x020
1970     #define D3DFVF_DIFFUSE 0x040
1971     #define D3DFVF_SPECULAR 0x080
1972    
1973     #define D3DFVF_TEXCOUNT_MASK 0xf00
1974     #define D3DFVF_TEXCOUNT_SHIFT 8
1975     #define D3DFVF_TEX0 0x000
1976     #define D3DFVF_TEX1 0x100
1977     #define D3DFVF_TEX2 0x200
1978     #define D3DFVF_TEX3 0x300
1979     #define D3DFVF_TEX4 0x400
1980     #define D3DFVF_TEX5 0x500
1981     #define D3DFVF_TEX6 0x600
1982     #define D3DFVF_TEX7 0x700
1983     #define D3DFVF_TEX8 0x800
1984    
1985     #define D3DFVF_RESERVED2 0xf000 // 4 reserved bits
1986    
1987     #else
1988     #define D3DFVF_RESERVED1 0x020
1989     #endif //(DIRECT3D_VERSION < 0x0800)
1990    
1991     #define D3DFVF_VERTEX ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
1992     #define D3DFVF_LVERTEX ( D3DFVF_XYZ | D3DFVF_RESERVED1 | D3DFVF_DIFFUSE | \
1993     D3DFVF_SPECULAR | D3DFVF_TEX1 )
1994     #define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \
1995     D3DFVF_TEX1 )
1996    
1997    
1998     typedef struct _D3DDP_PTRSTRIDE
1999     {
2000     LPVOID lpvData;
2001     DWORD dwStride;
2002     } D3DDP_PTRSTRIDE;
2003    
2004     #define D3DDP_MAXTEXCOORD 8
2005    
2006     typedef struct _D3DDRAWPRIMITIVESTRIDEDDATA
2007     {
2008     D3DDP_PTRSTRIDE position;
2009     D3DDP_PTRSTRIDE normal;
2010     D3DDP_PTRSTRIDE diffuse;
2011     D3DDP_PTRSTRIDE specular;
2012     D3DDP_PTRSTRIDE textureCoords[D3DDP_MAXTEXCOORD];
2013     } D3DDRAWPRIMITIVESTRIDEDDATA, *LPD3DDRAWPRIMITIVESTRIDEDDATA;
2014     //---------------------------------------------------------------------
2015     // ComputeSphereVisibility return values
2016     //
2017     #define D3DVIS_INSIDE_FRUSTUM 0
2018     #define D3DVIS_INTERSECT_FRUSTUM 1
2019     #define D3DVIS_OUTSIDE_FRUSTUM 2
2020     #define D3DVIS_INSIDE_LEFT 0
2021     #define D3DVIS_INTERSECT_LEFT (1 << 2)
2022     #define D3DVIS_OUTSIDE_LEFT (2 << 2)
2023     #define D3DVIS_INSIDE_RIGHT 0
2024     #define D3DVIS_INTERSECT_RIGHT (1 << 4)
2025     #define D3DVIS_OUTSIDE_RIGHT (2 << 4)
2026     #define D3DVIS_INSIDE_TOP 0
2027     #define D3DVIS_INTERSECT_TOP (1 << 6)
2028     #define D3DVIS_OUTSIDE_TOP (2 << 6)
2029     #define D3DVIS_INSIDE_BOTTOM 0
2030     #define D3DVIS_INTERSECT_BOTTOM (1 << 8)
2031     #define D3DVIS_OUTSIDE_BOTTOM (2 << 8)
2032     #define D3DVIS_INSIDE_NEAR 0
2033     #define D3DVIS_INTERSECT_NEAR (1 << 10)
2034     #define D3DVIS_OUTSIDE_NEAR (2 << 10)
2035     #define D3DVIS_INSIDE_FAR 0
2036     #define D3DVIS_INTERSECT_FAR (1 << 12)
2037     #define D3DVIS_OUTSIDE_FAR (2 << 12)
2038    
2039     #define D3DVIS_MASK_FRUSTUM (3 << 0)
2040     #define D3DVIS_MASK_LEFT (3 << 2)
2041     #define D3DVIS_MASK_RIGHT (3 << 4)
2042     #define D3DVIS_MASK_TOP (3 << 6)
2043     #define D3DVIS_MASK_BOTTOM (3 << 8)
2044     #define D3DVIS_MASK_NEAR (3 << 10)
2045     #define D3DVIS_MASK_FAR (3 << 12)
2046    
2047     #endif /* DIRECT3D_VERSION >= 0x0600 */
2048    
2049     #if(DIRECT3D_VERSION < 0x0800)
2050    
2051     #if(DIRECT3D_VERSION >= 0x0700)
2052    
2053     // To be used with GetInfo()
2054     #define D3DDEVINFOID_TEXTUREMANAGER 1
2055     #define D3DDEVINFOID_D3DTEXTUREMANAGER 2
2056     #define D3DDEVINFOID_TEXTURING 3
2057    
2058     typedef enum _D3DSTATEBLOCKTYPE
2059     {
2060     D3DSBT_ALL = 1, // capture all state
2061     D3DSBT_PIXELSTATE = 2, // capture pixel state
2062     D3DSBT_VERTEXSTATE = 3, // capture vertex state
2063     D3DSBT_FORCE_DWORD = 0xffffffff
2064     } D3DSTATEBLOCKTYPE;
2065    
2066     // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
2067     //
2068     typedef enum _D3DVERTEXBLENDFLAGS
2069     {
2070     D3DVBLEND_DISABLE = 0, // Disable vertex blending
2071     D3DVBLEND_1WEIGHT = 1, // blend between 2 matrices
2072     D3DVBLEND_2WEIGHTS = 2, // blend between 3 matrices
2073     D3DVBLEND_3WEIGHTS = 3, // blend between 4 matrices
2074     } D3DVERTEXBLENDFLAGS;
2075    
2076     typedef enum _D3DTEXTURETRANSFORMFLAGS {
2077     D3DTTFF_DISABLE = 0, // texture coordinates are passed directly
2078     D3DTTFF_COUNT1 = 1, // rasterizer should expect 1-D texture coords
2079     D3DTTFF_COUNT2 = 2, // rasterizer should expect 2-D texture coords
2080     D3DTTFF_COUNT3 = 3, // rasterizer should expect 3-D texture coords
2081     D3DTTFF_COUNT4 = 4, // rasterizer should expect 4-D texture coords
2082     D3DTTFF_PROJECTED = 256, // texcoords to be divided by COUNTth element
2083     D3DTTFF_FORCE_DWORD = 0x7fffffff,
2084     } D3DTEXTURETRANSFORMFLAGS;
2085    
2086     // Macros to set texture coordinate format bits in the FVF id
2087    
2088     #define D3DFVF_TEXTUREFORMAT2 0 // Two floating point values
2089     #define D3DFVF_TEXTUREFORMAT1 3 // One floating point value
2090     #define D3DFVF_TEXTUREFORMAT3 1 // Three floating point values
2091     #define D3DFVF_TEXTUREFORMAT4 2 // Four floating point values
2092    
2093     #define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
2094     #define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
2095     #define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
2096     #define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
2097    
2098    
2099     #endif /* DIRECT3D_VERSION >= 0x0700 */
2100    
2101     #else
2102     //
2103     // legacy vertex blend names
2104     //
2105     typedef enum _D3DVERTEXBLENDFLAGS D3DVERTEXBLENDFLAGS;
2106     #define D3DVBLEND_DISABLE (D3DVERTEXBLENDFLAGS)0
2107     #define D3DVBLEND_1WEIGHT (D3DVERTEXBLENDFLAGS)1
2108     #define D3DVBLEND_2WEIGHTS (D3DVERTEXBLENDFLAGS)2
2109     #define D3DVBLEND_3WEIGHTS (D3DVERTEXBLENDFLAGS)3
2110    
2111     #endif //(DIRECT3D_VERSION < 0x0800)
2112    
2113     #pragma pack()
2114     #pragma warning(default:4201)
2115    
2116     #endif /* _D3DTYPES_H_ */
2117    

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26