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