1 module directx.d3d7; 2 3 import directx.win32; 4 import directx.com; 5 import directx.d3dcommon; 6 7 enum DD_ROP_SPACE = 256 / 32; 8 9 struct DDSCAPS { 10 DWORD dwCaps; // capabilities of surface wanted 11 } 12 alias LPDDSCAPS = DDSCAPS*; 13 14 enum { 15 DDSD_CAPS = 0x00000001, 16 DDSD_HEIGHT = 0x00000002, 17 DDSD_WIDTH = 0x00000004, 18 DDSD_PITCH = 0x00000008, 19 DDSD_BACKBUFFERCOUNT = 0x00000020, 20 DDSD_ZBUFFERBITDEPTH = 0x00000040, 21 DDSD_ALPHABITDEPTH = 0x00000080, 22 DDSD_LPSURFACE = 0x00000800, 23 DDSD_PIXELFORMAT = 0x00001000, 24 DDSD_CKDESTOVERLAY = 0x00002000, 25 DDSD_CKDESTBLT = 0x00004000, 26 DDSD_CKSRCOVERLAY = 0x00008000, 27 DDSD_CKSRCBLT = 0x00010000, 28 DDSD_MIPMAPCOUNT = 0x00020000, 29 DDSD_REFRESHRATE = 0x00040000, 30 DDSD_LINEARSIZE = 0x00080000, 31 DDSD_TEXTURESTAGE = 0x00100000, 32 DDSD_FVF = 0x00200000, 33 DDSD_SRCVBHANDLE = 0x00400000, 34 DDSD_DEPTH = 0x00800000, 35 DDSD_ALL = 0x00fff9ee 36 } 37 38 enum { 39 DDSCAPS_RESERVED1 = 0x00000001, 40 DDSCAPS_ALPHA = 0x00000002, 41 DDSCAPS_BACKBUFFER = 0x00000004, 42 DDSCAPS_COMPLEX = 0x00000008, 43 DDSCAPS_FLIP = 0x00000010, 44 DDSCAPS_FRONTBUFFER = 0x00000020, 45 DDSCAPS_OFFSCREENPLAIN = 0x00000040, 46 DDSCAPS_OVERLAY = 0x00000080, 47 DDSCAPS_PALETTE = 0x00000100, 48 DDSCAPS_PRIMARYSURFACE = 0x00000200, 49 DDSCAPS_RESERVED3 = 0x00000400, 50 DDSCAPS_PRIMARYSURFACELEFT = 0x00000000, 51 DDSCAPS_SYSTEMMEMORY = 0x00000800, 52 DDSCAPS_TEXTURE = 0x00001000, 53 DDSCAPS_3DDEVICE = 0x00002000, 54 DDSCAPS_VIDEOMEMORY = 0x00004000, 55 DDSCAPS_VISIBLE = 0x00008000, 56 DDSCAPS_WRITEONLY = 0x00010000, 57 DDSCAPS_ZBUFFER = 0x00020000, 58 DDSCAPS_OWNDC = 0x00040000, 59 DDSCAPS_LIVEVIDEO = 0x00080000, 60 DDSCAPS_HWCODEC = 0x00100000, 61 DDSCAPS_MODEX = 0x00200000, 62 DDSCAPS_MIPMAP = 0x00400000, 63 DDSCAPS_RESERVED2 = 0x00800000, 64 DDSCAPS_ALLOCONLOAD = 0x04000000, 65 DDSCAPS_VIDEOPORT = 0x08000000, 66 DDSCAPS_LOCALVIDMEM = 0x10000000, 67 DDSCAPS_NONLOCALVIDMEM = 0x20000000, 68 DDSCAPS_STANDARDVGAMODE = 0x40000000, 69 DDSCAPS_OPTIMIZED = 0x80000000, 70 DDSCAPS2_RESERVED4 = 0x00000002, 71 DDSCAPS2_HARDWAREDEINTERLACE = 0x00000000, 72 DDSCAPS2_HINTDYNAMIC = 0x00000004, 73 DDSCAPS2_HINTSTATIC = 0x00000008, 74 DDSCAPS2_TEXTUREMANAGE = 0x00000010, 75 DDSCAPS2_RESERVED1 = 0x00000020, 76 DDSCAPS2_RESERVED2 = 0x00000040, 77 DDSCAPS2_OPAQUE = 0x00000080, 78 DDSCAPS2_HINTANTIALIASING = 0x00000100, 79 DDSCAPS2_CUBEMAP = 0x00000200, 80 DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400, 81 DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800, 82 DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000, 83 DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000, 84 DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000, 85 DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000, 86 DDSCAPS2_CUBEMAP_ALLFACES = DDSCAPS2_CUBEMAP_POSITIVEX | 87 DDSCAPS2_CUBEMAP_NEGATIVEX | 88 DDSCAPS2_CUBEMAP_POSITIVEY | 89 DDSCAPS2_CUBEMAP_NEGATIVEY | 90 DDSCAPS2_CUBEMAP_POSITIVEZ | 91 DDSCAPS2_CUBEMAP_NEGATIVEZ, 92 DDSCAPS2_MIPMAPSUBLEVEL = 0x00010000, 93 DDSCAPS2_D3DTEXTUREMANAGE = 0x00020000, 94 DDSCAPS2_DONOTPERSIST = 0x00040000, 95 DDSCAPS2_STEREOSURFACELEFT = 0x00080000, 96 DDSCAPS2_VOLUME = 0x00200000, 97 DDSCAPS2_NOTUSERLOCKABLE = 0x00400000, 98 DDSCAPS2_POINTS = 0x00800000, 99 DDSCAPS2_RTPATCHES = 0x01000000, 100 DDSCAPS2_NPATCHES = 0x02000000, 101 DDSCAPS2_RESERVED3 = 0x04000000, 102 DDSCAPS2_DISCARDBACKBUFFER = 0x10000000, 103 DDSCAPS2_ENABLEALPHACHANNEL = 0x20000000, 104 DDSCAPS2_EXTENDEDFORMATPRIMARY = 0x40000000, 105 DDSCAPS2_ADDITIONALPRIMARY = 0x80000000, 106 DDSCAPS3_MULTISAMPLE_MASK = 0x0000001F, 107 DDSCAPS3_MULTISAMPLE_QUALITY_MASK = 0x000000E0, 108 DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT = 5, 109 DDSCAPS3_RESERVED1 = 0x00000100, 110 DDSCAPS3_RESERVED2 = 0x00000200, 111 DDSCAPS3_LIGHTWEIGHTMIPMAP = 0x00000400, 112 DDSCAPS3_AUTOGENMIPMAP = 0x00000800, 113 DDSCAPS3_DMAP = 0x00001000, 114 115 /* D3D9Ex only -- */ 116 DDSCAPS3_CREATESHAREDRESOURCE = 0x00002000, 117 DDSCAPS3_READONLYRESOURCE = 0x00004000, 118 DDSCAPS3_OPENSHAREDRESOURCE = 0x00008000 119 } 120 121 struct DDCAPS_DX7 { 122 /* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure 123 /* 4*/ DWORD dwCaps; // driver specific capabilities 124 /* 8*/ DWORD dwCaps2; // more driver specific capabilites 125 /* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface 126 /* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites 127 /* 14*/ DWORD dwFXAlphaCaps; // alpha driver specific capabilities 128 /* 18*/ DWORD dwPalCaps; // palette capabilities 129 /* 1c*/ DWORD dwSVCaps; // stereo vision capabilities 130 /* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 131 /* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 132 /* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 133 /* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 134 /* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 135 /* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 136 /* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 137 /* 3c*/ DWORD dwVidMemTotal; // total amount of video memory 138 /* 40*/ DWORD dwVidMemFree; // amount of free video memory 139 /* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays 140 /* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays 141 /* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes 142 /* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment 143 /* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size 144 /* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment 145 /* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size 146 /* 60*/ DWORD dwAlignStrideAlign; // stride alignment 147 /* 64*/ DWORD[DD_ROP_SPACE] dwRops; // ROPS supported 148 /* 84*/ DDSCAPS ddsOldCaps; // Was DDSCAPS ddsCaps. ddsCaps is of type DDSCAPS2 for DX6 149 /* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 150 /* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 151 /* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 152 /* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 153 /* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 154 /* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 155 /* a0*/ DWORD dwReserved1; // reserved 156 /* a4*/ DWORD dwReserved2; // reserved 157 /* a8*/ DWORD dwReserved3; // reserved 158 /* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts 159 /* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts 160 /* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts 161 /* b8*/ DWORD[DD_ROP_SPACE] dwSVBRops;// ROPS supported for System->Vmem blts 162 /* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts 163 /* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts 164 /* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts 165 /* e4*/ DWORD[DD_ROP_SPACE] dwVSBRops;// ROPS supported for Vmem->System blts 166 /*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts 167 /*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts 168 /*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts 169 /*110*/ DWORD[DD_ROP_SPACE] dwSSBRops;// ROPS supported for System->System blts 170 /*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports 171 /*134*/ DWORD dwCurrVideoPorts; // current number of video ports used 172 /*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts 173 /*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts 174 /*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts 175 /*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts 176 /*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts 177 /*14c*/ DWORD[DD_ROP_SPACE] dwNLVBRops; // ROPS supported for non-local->local blts 178 // Members added for DX6 release 179 /*16c*/ DDSCAPS2 ddsCaps; // Surface Caps 180 } 181 alias LPDDCAPS_DX7 = DDCAPS_DX7*; 182 183 alias DDCAPS = DDCAPS_DX7; 184 alias LPDDCAPS = LPDDCAPS_DX7; 185 186 struct DDCOLORKEY { 187 DWORD dwColorSpaceLowValue; // low boundary of color space that is to 188 // be treated as Color Key, inclusive 189 DWORD dwColorSpaceHighValue; // high boundary of color space that is 190 // to be treated as Color Key, inclusive 191 } 192 alias LPDDCOLORKEY = DDCOLORKEY*; 193 194 enum MAX_DDDEVICEID_STRING = 512; 195 196 struct DDDEVICEIDENTIFIER2 { 197 /* 198 * These elements are for presentation to the user only. They should not be used to identify particular 199 * drivers, since this is unreliable and many different strings may be associated with the same 200 * device, and the same driver from different vendors. 201 */ 202 char[MAX_DDDEVICEID_STRING] szDriver; 203 char[MAX_DDDEVICEID_STRING] szDescription; 204 205 /* 206 * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons 207 * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic 208 * drivers. It is recommended that guidDeviceIdentifier is used for this purpose. 209 * 210 * This version has the form: 211 * wProduct = HIWORD(liDriverVersion.HighPart) 212 * wVersion = LOWORD(liDriverVersion.HighPart) 213 * wSubVersion = HIWORD(liDriverVersion.LowPart) 214 * wBuild = LOWORD(liDriverVersion.LowPart) 215 */ 216 // #ifdef _WIN32 217 LARGE_INTEGER liDriverVersion; /* Defined for applications and other 32 bit components */ 218 // #else 219 // DWORD dwDriverVersionLowPart; /* Defined for 16 bit driver components */ 220 // DWORD dwDriverVersionHighPart; 221 // #endif 222 223 224 /* 225 * These elements can be used to identify particular chipsets. Use with extreme caution. 226 * dwVendorId Identifies the manufacturer. May be zero if unknown. 227 * dwDeviceId Identifies the type of chipset. May be zero if unknown. 228 * dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. 229 * dwRevision Identifies the revision level of the chipset. May be zero if unknown. 230 */ 231 DWORD dwVendorId; 232 DWORD dwDeviceId; 233 DWORD dwSubSysId; 234 DWORD dwRevision; 235 236 /* 237 * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the 238 * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to 239 * reprofile the graphics subsystem. 240 * This element can also be used to identify particular problematic drivers. 241 */ 242 GUID guidDeviceIdentifier; 243 244 /* 245 * This element is used to determine the Windows Hardware Quality Lab (WHQL) 246 * certification level for this driver/device pair. 247 */ 248 DWORD dwWHQLLevel; 249 } 250 alias LPDDDEVICEIDENTIFIER2 = DDDEVICEIDENTIFIER2*; 251 252 struct DDPIXELFORMAT { 253 DWORD dwSize; // size of structure 254 DWORD dwFlags; // pixel format flags 255 DWORD dwFourCC; // (FOURCC code) 256 union { 257 DWORD dwRGBBitCount; // how many bits per pixel 258 DWORD dwYUVBitCount; // how many bits per pixel 259 DWORD dwZBufferBitDepth; // how many total bits/pixel in z buffer (including any stencil bits) 260 DWORD dwAlphaBitDepth; // how many bits for alpha channels 261 DWORD dwLuminanceBitCount; // how many bits per pixel 262 DWORD dwBumpBitCount; // how many bits per "buxel", total 263 DWORD dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture 264 // format list and if DDPF_D3DFORMAT is set 265 } 266 union { 267 DWORD dwRBitMask; // mask for red bit 268 DWORD dwYBitMask; // mask for Y bits 269 DWORD dwStencilBitDepth; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) 270 DWORD dwLuminanceBitMask; // mask for luminance bits 271 DWORD dwBumpDuBitMask; // mask for bump map U delta bits 272 DWORD dwOperations; // DDPF_D3DFORMAT Operations 273 } 274 union { 275 DWORD dwGBitMask; // mask for green bits 276 DWORD dwUBitMask; // mask for U bits 277 DWORD dwZBitMask; // mask for Z bits 278 DWORD dwBumpDvBitMask; // mask for bump map V delta bits 279 struct { 280 WORD wFlipMSTypes; // Multisample methods supported via flip for this D3DFORMAT 281 WORD wBltMSTypes; // Multisample methods supported via blt for this D3DFORMAT 282 } 283 284 } 285 union { 286 DWORD dwBBitMask; // mask for blue bits 287 DWORD dwVBitMask; // mask for V bits 288 DWORD dwStencilBitMask; // mask for stencil bits 289 DWORD dwBumpLuminanceBitMask; // mask for luminance in bump map 290 } 291 union { 292 DWORD dwRGBAlphaBitMask; // mask for alpha channel 293 DWORD dwYUVAlphaBitMask; // mask for alpha channel 294 DWORD dwLuminanceAlphaBitMask;// mask for alpha channel 295 DWORD dwRGBZBitMask; // mask for Z channel 296 DWORD dwYUVZBitMask; // mask for Z channel 297 } 298 } 299 alias LPDDPIXELFORMAT = DDPIXELFORMAT*; 300 301 struct DDSCAPS2 { 302 DWORD dwCaps; // capabilities of surface wanted 303 DWORD dwCaps2; 304 DWORD dwCaps3; 305 union { 306 DWORD dwCaps4; 307 DWORD dwVolumeDepth; 308 } 309 } 310 alias LPDDSCAPS2 = DDSCAPS2*; 311 312 struct DDSURFACEDESC2 { 313 DWORD dwSize; // size of the DDSURFACEDESC structure 314 DWORD dwFlags; // determines what fields are valid 315 DWORD dwHeight; // height of surface to be created 316 DWORD dwWidth; // width of input surface 317 union { 318 LONG lPitch; // distance to start of next line (return value only) 319 DWORD dwLinearSize; // Formless late-allocated optimized surface size 320 } 321 union { 322 DWORD dwBackBufferCount; // number of back buffers requested 323 DWORD dwDepth; // the depth if this is a volume texture 324 } 325 union { 326 DWORD dwMipMapCount; // number of mip-map levels requestde 327 // dwZBufferBitDepth removed, use ddpfPixelFormat one instead 328 DWORD dwRefreshRate; // refresh rate (used when display mode is described) 329 DWORD dwSrcVBHandle; // The source used in VB::Optimize 330 } 331 DWORD dwAlphaBitDepth; // depth of alpha buffer requested 332 DWORD dwReserved; // reserved 333 LPVOID lpSurface; // pointer to the associated surface memory 334 union { 335 DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use 336 DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces 337 } 338 DDCOLORKEY ddckCKDestBlt; // color key for destination blt use 339 DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use 340 DDCOLORKEY ddckCKSrcBlt; // color key for source blt use 341 union { 342 DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface 343 DWORD dwFVF; // vertex format description of vertex buffers 344 } 345 DDSCAPS2 ddsCaps; // direct draw surface capabilities 346 DWORD dwTextureStage; // stage in multitexture cascade 347 } 348 alias LPDDSURFACEDESC2 = DDSURFACEDESC2*; 349 350 mixin(uuid!(IDirectDraw7, "15e65ec0-3b9c-11d2-b92f-00609797ea5b")); 351 extern (C++) interface IDirectDraw7 : IUnknown { 352 HRESULT Compact(); 353 HRESULT CreateClipper(DWORD, LPDIRECTDRAWCLIPPER*, IUnknown); 354 HRESULT CreatePalette(DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE*, IUnknown); 355 HRESULT CreateSurface(LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7*, IUnknown); 356 HRESULT DuplicateSurface(LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7*); 357 HRESULT EnumDisplayModes(DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2); 358 HRESULT EnumSurfaces(DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMSURFACESCALLBACK7); 359 HRESULT FlipToGDISurface(); 360 HRESULT GetCaps(LPDDCAPS, LPDDCAPS); 361 HRESULT GetDisplayMode(LPDDSURFACEDESC2); 362 HRESULT GetFourCCCodes(LPDWORD, LPDWORD ); 363 HRESULT GetGDISurface(LPDIRECTDRAWSURFACE7*); 364 HRESULT GetMonitorFrequency(LPDWORD); 365 HRESULT GetScanLine(LPDWORD); 366 HRESULT GetVerticalBlankStatus(LPBOOL); 367 HRESULT Initialize(GUID*); 368 HRESULT RestoreDisplayMode(); 369 HRESULT SetCooperativeLevel(HWND, DWORD); 370 HRESULT SetDisplayMode(DWORD, DWORD, DWORD, DWORD, DWORD); 371 HRESULT WaitForVerticalBlank(DWORD, HANDLE); 372 /*** Added in the v2 interface ***/ 373 HRESULT GetAvailableVidMem(LPDDSCAPS2, LPDWORD, LPDWORD); 374 /*** Added in the V4 Interface ***/ 375 HRESULT GetSurfaceFromDC(HDC, LPDIRECTDRAWSURFACE7*); 376 HRESULT RestoreAllSurfaces(); 377 HRESULT TestCooperativeLevel(); 378 HRESULT GetDeviceIdentifier(LPDDDEVICEIDENTIFIER2, DWORD); 379 HRESULT StartModeTest(LPSIZE, DWORD, DWORD); 380 HRESULT EvaluateMode(DWORD, DWORD*); 381 } 382 383 extern (C++) interface IDirectDrawClipper : IUnknown { 384 385 } 386 alias LPDIRECTDRAWCLIPPER = IDirectDrawClipper; 387 388 extern (C++) interface IDirectDrawPalette : IUnknown { 389 390 } 391 alias LPDIRECTDRAWPALETTE = IDirectDrawPalette; 392 393 extern (C++) interface IDirectDrawSurface7 : IUnknown { 394 395 } 396 alias LPDIRECTDRAWSURFACE7 = IDirectDrawSurface7; 397 398 extern (Windows) { 399 alias LPD3DVALIDATECALLBACK = HRESULT function(LPVOID lpUserArg, DWORD dwOffset); 400 //alias LPD3DENUMTEXTUREFORMATSCALLBACK = HRESULT function(LPDDSURFACEDESC lpDdsd, LPVOID lpContext); 401 alias LPD3DENUMPIXELFORMATSCALLBACK = HRESULT function(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext); 402 403 alias LPD3DENUMDEVICESCALLBACK7 = HRESULT function 404 (LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID); 405 } 406 407 struct D3DVERTEXBUFFERDESC { 408 DWORD dwSize; 409 DWORD dwCaps; 410 DWORD dwFVF; 411 DWORD dwNumVertices; 412 } 413 alias LPD3DVERTEXBUFFERDESC = D3DVERTEXBUFFERDESC*; 414 415 alias D3DVALUE = float; 416 alias LPD3DVALUE = D3DVALUE*; 417 418 struct D3DPRIMCAPS { 419 DWORD dwSize; 420 DWORD dwMiscCaps; /* Capability flags */ 421 DWORD dwRasterCaps; 422 DWORD dwZCmpCaps; 423 DWORD dwSrcBlendCaps; 424 DWORD dwDestBlendCaps; 425 DWORD dwAlphaCmpCaps; 426 DWORD dwShadeCaps; 427 DWORD dwTextureCaps; 428 DWORD dwTextureFilterCaps; 429 DWORD dwTextureBlendCaps; 430 DWORD dwTextureAddressCaps; 431 DWORD dwStippleWidth; /* maximum width and height of */ 432 DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */ 433 } 434 alias LPD3DPRIMCAPS = D3DPRIMCAPS*; 435 436 struct D3DDEVICEDESC7 { 437 DWORD dwDevCaps; /* Capabilities of device */ 438 D3DPRIMCAPS dpcLineCaps; 439 D3DPRIMCAPS dpcTriCaps; 440 DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ 441 DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ 442 443 DWORD dwMinTextureWidth, dwMinTextureHeight; 444 DWORD dwMaxTextureWidth, dwMaxTextureHeight; 445 446 DWORD dwMaxTextureRepeat; 447 DWORD dwMaxTextureAspectRatio; 448 DWORD dwMaxAnisotropy; 449 450 D3DVALUE dvGuardBandLeft; 451 D3DVALUE dvGuardBandTop; 452 D3DVALUE dvGuardBandRight; 453 D3DVALUE dvGuardBandBottom; 454 455 D3DVALUE dvExtentsAdjust; 456 DWORD dwStencilCaps; 457 458 DWORD dwFVFCaps; 459 DWORD dwTextureOpCaps; 460 WORD wMaxTextureBlendStages; 461 WORD wMaxSimultaneousTextures; 462 463 DWORD dwMaxActiveLights; 464 D3DVALUE dvMaxVertexW; 465 GUID deviceGUID; 466 467 WORD wMaxUserClipPlanes; 468 WORD wMaxVertexBlendMatrices; 469 470 DWORD dwVertexProcessingCaps; 471 472 DWORD dwReserved1; 473 DWORD dwReserved2; 474 DWORD dwReserved3; 475 DWORD dwReserved4; 476 } 477 alias LPD3DDEVICEDESC7 = D3DDEVICEDESC7*; 478 479 mixin(uuid!(IDirect3D7, "f5049e77-4861-11d2-a407-00a0c90629a8")); 480 extern (C++) interface IDirect3D7 : IUnknown { 481 HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK7,LPVOID); 482 HRESULT CreateDevice(REFCLSID,LPDIRECTDRAWSURFACE7,LPDIRECT3DDEVICE7*); 483 HRESULT CreateVertexBuffer(LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER7*,DWORD); 484 HRESULT EnumZBufferFormats(REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID); 485 HRESULT EvictManagedTextures(); 486 } 487 alias LPDIRECT3D7 = IDirect3D7; 488 489 struct D3DCLIPSTATUS { 490 DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */ 491 DWORD dwStatus; /* Clip status */ 492 float minx, maxx; /* X extents */ 493 float miny, maxy; /* Y extents */ 494 float minz, maxz; /* Z extents */ 495 } 496 alias LPD3DCLIPSTATUS = D3DCLIPSTATUS*; 497 498 enum { 499 D3DCLIPSTATUS_STATUS = 0x00000001, 500 D3DCLIPSTATUS_EXTENTS2 = 0x00000002, 501 D3DCLIPSTATUS_EXTENTS3 = 0x00000004 502 } 503 504 struct D3DVIEWPORT7 { 505 DWORD dwX; 506 DWORD dwY; /* Viewport Top left */ 507 DWORD dwWidth; 508 DWORD dwHeight; /* Viewport Dimensions */ 509 D3DVALUE dvMinZ; /* Min/max of clip Volume */ 510 D3DVALUE dvMaxZ; 511 } 512 alias LPD3DVIEWPORT7 = D3DVIEWPORT7*; 513 514 struct D3DMATERIAL7 { 515 union { 516 D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ 517 D3DCOLORVALUE dcvDiffuse; 518 } 519 union { 520 D3DCOLORVALUE ambient; /* Ambient color RGB */ 521 D3DCOLORVALUE dcvAmbient; 522 } 523 union { 524 D3DCOLORVALUE specular; /* Specular 'shininess' */ 525 D3DCOLORVALUE dcvSpecular; 526 } 527 union { 528 D3DCOLORVALUE emissive; /* Emissive color RGB */ 529 D3DCOLORVALUE dcvEmissive; 530 } 531 union { 532 D3DVALUE power; /* Sharpness if specular highlight */ 533 D3DVALUE dvPower; 534 } 535 } 536 alias LPD3DMATERIAL7 = D3DMATERIAL7*; 537 538 struct D3DLIGHT7 { 539 D3DLIGHTTYPE dltType; /* Type of light source */ 540 D3DCOLORVALUE dcvDiffuse; /* Diffuse color of light */ 541 D3DCOLORVALUE dcvSpecular; /* Specular color of light */ 542 D3DCOLORVALUE dcvAmbient; /* Ambient color of light */ 543 D3DVECTOR dvPosition; /* Position in world space */ 544 D3DVECTOR dvDirection; /* Direction in world space */ 545 D3DVALUE dvRange; /* Cutoff range */ 546 D3DVALUE dvFalloff; /* Falloff */ 547 D3DVALUE dvAttenuation0; /* Constant attenuation */ 548 D3DVALUE dvAttenuation1; /* Linear attenuation */ 549 D3DVALUE dvAttenuation2; /* Quadratic attenuation */ 550 D3DVALUE dvTheta; /* Inner angle of spotlight cone */ 551 D3DVALUE dvPhi; /* Outer angle of spotlight cone */ 552 } 553 alias LPD3DLIGHT7 = D3DLIGHT7*; 554 555 struct D3DDP_PTRSTRIDE { 556 LPVOID lpvData; 557 DWORD dwStride; 558 } 559 560 enum D3DDP_MAXTEXCOORD = 8; 561 562 struct D3DDRAWPRIMITIVESTRIDEDDATA { 563 D3DDP_PTRSTRIDE position; 564 D3DDP_PTRSTRIDE normal; 565 D3DDP_PTRSTRIDE diffuse; 566 D3DDP_PTRSTRIDE specular; 567 D3DDP_PTRSTRIDE[D3DDP_MAXTEXCOORD] textureCoords; 568 } 569 alias LPD3DDRAWPRIMITIVESTRIDEDDATA = D3DDRAWPRIMITIVESTRIDEDDATA*; 570 571 mixin(uuid!(IDirect3DDevice7, "f5049e79-4861-11d2-a407-00a0c90629a8")); 572 extern (C++) interface IDirect3DDevice7 : IUnknown { 573 HRESULT GetCaps(LPD3DDEVICEDESC7); 574 HRESULT EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK,LPVOID); 575 HRESULT BeginScene(); 576 HRESULT EndScene(); 577 HRESULT GetDirect3D(LPDIRECT3D7*); 578 HRESULT SetRenderTarget(LPDIRECTDRAWSURFACE7,DWORD); 579 HRESULT GetRenderTarget(LPDIRECTDRAWSURFACE7 *); 580 HRESULT Clear(DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD); 581 HRESULT SetTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX); 582 HRESULT GetTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX); 583 HRESULT SetViewport(LPD3DVIEWPORT7); 584 HRESULT MultiplyTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX); 585 HRESULT GetViewport(LPD3DVIEWPORT7); 586 HRESULT SetMaterial(LPD3DMATERIAL7); 587 HRESULT GetMaterial(LPD3DMATERIAL7); 588 HRESULT SetLight(DWORD,LPD3DLIGHT7); 589 HRESULT GetLight(DWORD,LPD3DLIGHT7); 590 HRESULT SetRenderState(D3DRENDERSTATETYPE,DWORD); 591 HRESULT GetRenderState(D3DRENDERSTATETYPE,LPDWORD); 592 HRESULT BeginStateBlock(); 593 HRESULT EndStateBlock(LPDWORD); 594 HRESULT PreLoad(LPDIRECTDRAWSURFACE7); 595 HRESULT DrawPrimitive(D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD); 596 HRESULT DrawIndexedPrimitive(D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD); 597 HRESULT SetClipStatus(LPD3DCLIPSTATUS); 598 HRESULT GetClipStatus(LPD3DCLIPSTATUS); 599 HRESULT DrawPrimitiveStrided(D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD); 600 HRESULT DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD); 601 HRESULT DrawPrimitiveVB(D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,DWORD); 602 HRESULT DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,LPWORD,DWORD,DWORD); 603 HRESULT ComputeSphereVisibility(LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD); 604 HRESULT GetTexture(DWORD,LPDIRECTDRAWSURFACE7 *); 605 HRESULT SetTexture(DWORD,LPDIRECTDRAWSURFACE7); 606 HRESULT GetTextureStageState(DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD); 607 HRESULT SetTextureStageState(DWORD,D3DTEXTURESTAGESTATETYPE,DWORD); 608 HRESULT ValidateDevice(LPDWORD); 609 HRESULT ApplyStateBlock(DWORD); 610 HRESULT CaptureStateBlock(DWORD); 611 HRESULT DeleteStateBlock(DWORD); 612 HRESULT CreateStateBlock(D3DSTATEBLOCKTYPE,LPDWORD); 613 HRESULT Load(LPDIRECTDRAWSURFACE7,LPPOINT,LPDIRECTDRAWSURFACE7,LPRECT,DWORD); 614 HRESULT LightEnable(DWORD,BOOL); 615 HRESULT GetLightEnable(DWORD,BOOL*); 616 HRESULT SetClipPlane(DWORD,D3DVALUE*); 617 HRESULT GetClipPlane(DWORD,D3DVALUE*); 618 HRESULT GetInfo(DWORD,LPVOID,DWORD); 619 } 620 alias LPDIRECT3DDEVICE7 = IDirect3DDevice7; 621 622 extern (C++) interface IDirect3DVertexBuffer7 : IUnknown { 623 HRESULT Lock(DWORD,LPVOID*,LPDWORD); 624 HRESULT Unlock(); 625 HRESULT ProcessVertices(DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER7,DWORD,LPDIRECT3DDEVICE7,DWORD); 626 HRESULT GetVertexBufferDesc(LPD3DVERTEXBUFFERDESC); 627 HRESULT Optimize(LPDIRECT3DDEVICE7,DWORD); 628 HRESULT ProcessVerticesStrided(DWORD,DWORD,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPDIRECT3DDEVICE7,DWORD); 629 }; 630 alias LPDIRECT3DVERTEXBUFFER7 = IDirect3DVertexBuffer7; 631 632 __gshared LPDIRECTDRAWCREATEEX DirectDrawCreateEx; 633 __gshared LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExA; 634 635 extern (Windows) { 636 //alias LPDDENUMMODESCALLBACK = HRESULT function(LPDDSURFACEDESC, LPVOID); 637 alias LPDDENUMMODESCALLBACK2 = HRESULT function(LPDDSURFACEDESC2, LPVOID); 638 //alias LPDDENUMSURFACESCALLBACK = HRESULT function(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); 639 //alias LPDDENUMSURFACESCALLBACK2 = HRESULT function(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); 640 alias LPDDENUMSURFACESCALLBACK7 = HRESULT function(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); 641 642 alias LPCLIPPERCALLBACK = DWORD function(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, 643 LPVOID lpContext); 644 645 enum { 646 DDCREATE_HARDWAREONLY = 0x00000001, 647 DDCREATE_EMULATIONONLY = 0x00000002 648 } 649 650 alias LPDIRECTDRAWCREATEEX = HRESULT function(GUID* lpGUID, 651 LPVOID* lplpDD, 652 REFIID iid, 653 IUnknown* pUnkOuter); 654 655 enum { 656 DDENUM_ATTACHEDSECONDARYDEVICES = 0x00000001 657 } 658 659 alias LPDDENUMCALLBACKEXA = BOOL function(GUID*, LPSTR, LPSTR, 660 LPVOID, HMONITOR); 661 662 alias LPDIRECTDRAWENUMERATEEXA = 663 HRESULT function(LPDDENUMCALLBACKEXA lpCallback, 664 LPVOID lpContext, 665 DWORD dwFlags); 666 }