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