Subversion Repositories spacemission

Rev

Rev 16 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. (*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1994-1999 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  DirectX header version 98.11.20
  6.  *
  7.  *  Present by Hiroyuki Hori.
  8.  *
  9.  *  E-Mail: hori@ingjapan.ne.jp
  10.  *  Homepage: http://www.ingjapan.ne.jp/hori/index.html
  11.  *  Homepage: http://www.ingjapan.ne.jp/hori/index-e.html
  12.  *
  13.  *  Present unit:
  14.  *    DirectX.pas    DirectX 7 (DirectX 7 SDK)
  15.  *    DShow.pas      DirectShow (DirectX Media SDK 5.1)
  16.  *    DAnim.pas      DirectAnimation (DirectX Media SDK 5.1)
  17.  *
  18.  *--------------------------------------------------------------------------
  19.  *
  20.  *    DirectMusic header version 1.0
  21.  *
  22.  *    Present by Kazuya Yamane
  23.  *
  24.  *    e-mail : kazuya-y@infosakyu.ne.jp
  25.  *    URL    : http://www.infosakyu.ne.jp/~kazuya-y/index.html
  26.  *
  27.  ***************************************************************************)
  28. {
  29. (c)2004 Jaro Benes Recompilation with Erik Unger's headers
  30.  
  31. Join in order:
  32.   1) DirectDraw
  33.   2) Direct3D
  34.   3) Direct3DRM
  35.   4) DirectInput
  36.   5) DirectPlay
  37.   6) DirectSetup
  38.   7) DirectSound
  39.   8) DirectMusic
  40. }
  41. Unit DirectX;
  42.  
  43. Interface
  44.  
  45. {Delphi version marks}
  46.  
  47. {$I DelphiXcfg.inc}
  48.  
  49. {$MINENUMSIZE 4}
  50. {$ALIGN ON}
  51.  
  52. uses
  53.   Windows, MMSystem;
  54.  
  55. type
  56. {$IFDEF UNICODE}
  57.   PCharAW = PWideChar;
  58. {$ELSE}
  59.   PCharAW = PAnsiChar;
  60. {$ENDIF}
  61.  
  62. //DirectDraw file
  63. (*==========================================================================;
  64.  *
  65.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  66.  *
  67.  *  Files:      ddraw.h dvp.h
  68.  *  Content:    DirectDraw and DirectDrawVideoPort include files
  69.  *
  70.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  71.  *
  72.  *  Modified: 10-Sep-2000
  73.  *
  74.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  75.  *  E-Mail: DelphiDirectX@next-reality.com
  76.  *
  77.  *
  78.  ***************************************************************************)
  79.  
  80. var
  81.   DDrawDLL : HMODULE = 0;
  82.  
  83. function DDErrorString(Value: HResult) : string;
  84.  
  85. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  86.  
  87. (*
  88.  * FOURCC codes for DX compressed-texture pixel formats
  89.  *)
  90. const
  91.   FOURCC_DXT1 = 'DXT1';
  92.   FOURCC_DXT2 = 'DXT2';
  93.   FOURCC_DXT3 = 'DXT3';
  94.   FOURCC_DXT4 = 'DXT4';
  95.   FOURCC_DXT5 = 'DXT5';
  96.  
  97. (*
  98.  * GUIDS used by DirectDraw objects
  99.  *)
  100. const
  101.   CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
  102.   CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
  103.   CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
  104.  
  105. const
  106.   DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
  107.  
  108.   MAX_DDDEVICEID_STRING = 512;
  109.  
  110. (*
  111.  * Flags for the IDirectDraw4::GetDeviceIdentifier method
  112.  *)
  113.  
  114. (*
  115.  * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
  116.  * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
  117.  * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
  118.  * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
  119.  * of the DirectDraw object involved.
  120.  *)
  121.   DDGDI_GETHOSTIDENTIFIER         = $00000001;
  122.  
  123. (*============================================================================
  124.  *
  125.  * DirectDraw Structures
  126.  *
  127.  * Various structures used to invoke DirectDraw.
  128.  *
  129.  *==========================================================================*)
  130.  
  131. var
  132.   NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
  133.  
  134. type
  135.   TRefGUID = packed record
  136.     case integer of
  137.     1: (guid : PGUID);
  138.     2: (dwFlags : DWORD);
  139.   end;
  140.  
  141.   IDirectDraw = interface;
  142.   IDirectDraw2 = interface;
  143.   IDirectDraw4 = interface;
  144.   IDirectDraw7 = interface;
  145.   IDirectDrawSurface = interface;
  146.   IDirectDrawSurface2 = interface;
  147.   IDirectDrawSurface3 = interface;
  148.   IDirectDrawSurface4 = interface;
  149.   IDirectDrawSurface7 = interface;
  150.  
  151.   IDirectDrawPalette = interface;
  152.   IDirectDrawClipper = interface;
  153.   IDirectDrawColorControl = interface;
  154.   IDirectDrawGammaControl = interface;
  155.  
  156. (*
  157.  * Generic pixel format with 8-bit RGB and alpha components
  158.  *)
  159.   PDDARGB = ^TDDARGB;
  160.   TDDARGB = packed record
  161.     blue:     BYTE;
  162.     green:    BYTE;
  163.     red:      BYTE;
  164.     alpha:    BYTE;
  165.   end;
  166.  
  167. (*
  168.  * This version of the structure remains for backwards source compatibility.
  169.  * The DDARGB structure is the one that should be used for all DirectDraw APIs.
  170.  *)
  171.   PDDRGBA = ^TDDRGBA;
  172.   TDDRGBA = packed record
  173.     red   : BYTE;
  174.     green : BYTE;
  175.     blue  : BYTE;
  176.     alpha : BYTE;
  177.   end;
  178.  
  179. (*
  180.  * TDDColorKey
  181.  *)
  182.   PDDColorKey = ^TDDColorKey;
  183.   TDDColorKey = packed record
  184.     dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
  185.                                    // be treated as Color Key, inclusive
  186.     dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
  187.                                    // to be treated as Color Key, inclusive
  188.   end;
  189.  
  190. // Delphi 5 can't handle interface in variant records
  191. // so we have to use pointers instead (which can be type-casted into interfaces):
  192.  
  193. {$IFDEF VER5UP}
  194.   PDirectDrawSurface = Pointer;              
  195. {$ELSE}
  196.   PDirectDrawSurface = IDirectDrawSurface;
  197. {$ENDIF}
  198.  
  199. (*
  200.  * TDDBltFX
  201.  * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
  202.  *)
  203.   PDDBltFX = ^TDDBltFX;
  204.   TDDBltFX = packed record
  205.     dwSize                        : DWORD;     // size of structure
  206.     dwDDFX                        : DWORD;     // FX operations
  207.     dwROP                         : DWORD;     // Win32 raster operations
  208.     dwDDROP                       : DWORD;     // Raster operations new for DirectDraw
  209.     dwRotationAngle               : DWORD;     // Rotation angle for blt
  210.     dwZBufferOpCode               : DWORD;     // ZBuffer compares
  211.     dwZBufferLow                  : DWORD;     // Low limit of Z buffer
  212.     dwZBufferHigh                 : DWORD;     // High limit of Z buffer
  213.     dwZBufferBaseDest             : DWORD;     // Destination base value
  214.     dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination
  215.     case integer of
  216.     0: (
  217.       dwZDestConst                : DWORD      // Constant to use as Z buffer for dest
  218.      );
  219.     1: (
  220.       lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest
  221.       dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source
  222.       case integer of
  223.       0: (
  224.         dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src
  225.        );
  226.       1: (
  227.         lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src
  228.         dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend
  229.         dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending
  230.         dwReserved                : DWORD;
  231.         dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination
  232.         case integer of
  233.         0: (
  234.           dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel
  235.          );
  236.         1: (
  237.           lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel
  238.           dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source
  239.           case integer of
  240.           0: (
  241.             dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel
  242.           );
  243.           1: (
  244.             lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel
  245.             case integer of
  246.             0: (
  247.               dwFillColor         : DWORD;     // color in RGB or Palettized
  248.             );
  249.             1: (
  250.               dwFillDepth         : DWORD;     // depth value for z-buffer
  251.             );
  252.             2: (
  253.               dwFillPixel         : DWORD;     // pixel value
  254.             );
  255.             3: (
  256.               lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern
  257.               ddckDestColorkey    : TDDColorKey; // DestColorkey override
  258.               ddckSrcColorkey     : TDDColorKey; // SrcColorkey override
  259.             )
  260.         )
  261.       )
  262.     )
  263.   )
  264.   end;
  265.  
  266. (*
  267.  * TDDSCaps
  268.  *)
  269.   PDDSCaps = ^TDDSCaps;
  270.   TDDSCaps = packed record
  271.     dwCaps: DWORD;         // capabilities of surface wanted
  272.   end;
  273.  
  274. (*
  275.  * TDDOSCaps
  276.  *)
  277.   PDDOSCaps = ^TDDOSCaps;
  278.   TDDOSCaps = packed record
  279.     dwCaps: DWORD;         // capabilities of surface wanted
  280.   end;
  281.  
  282. (*
  283.  * This structure is used internally by DirectDraw.
  284.  *)
  285.   PDDSCapsEx = ^TDDSCapsEx;
  286.   TDDSCapsEx = packed record
  287.     dwCaps2 : DWORD;
  288.     dwCaps3 : DWORD;
  289.     dwCaps4 : DWORD;
  290.   end;
  291.  
  292. (*
  293.  * TDDSCaps2
  294.  *)
  295.   PDDSCaps2 = ^TDDSCaps2;
  296.   TDDSCaps2 = packed record
  297.     dwCaps: DWORD;         // capabilities of surface wanted
  298.     dwCaps2 : DWORD;
  299.     dwCaps3 : DWORD;
  300.     dwCaps4 : DWORD;
  301.   end;
  302.  
  303. (*
  304.  * TDDCaps
  305.  *)
  306. (*
  307.  * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
  308.  * It is present for back compatability.
  309.  *)
  310.   PDDCaps_DX3 = ^TDDCaps_DX3;
  311.   TDDCaps_DX3 = packed record
  312.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  313.     dwCaps: DWORD;                 // driver specific capabilities
  314.     dwCaps2: DWORD;                // more driver specific capabilites
  315.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  316.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  317.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  318.     dwPalCaps: DWORD;              // palette capabilities
  319.     dwSVCaps: DWORD;               // stereo vision capabilities
  320.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  321.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  322.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  323.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  324.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  325.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  326.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  327.     dwVidMemTotal: DWORD;          // total amount of video memory
  328.     dwVidMemFree: DWORD;           // amount of free video memory
  329.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  330.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  331.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  332.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  333.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  334.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  335.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  336.     dwAlignStrideAlign: DWORD;     // stride alignment
  337.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  338.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  339.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  340.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  341.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  342.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  343.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  344.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  345.     dwReserved1: DWORD;            // reserved
  346.     dwReserved2: DWORD;            // reserved
  347.     dwReserved3: DWORD;            // reserved
  348.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  349.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  350.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  351.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  352.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  353.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  354.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  355.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  356.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  357.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  358.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  359.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  360.     dwReserved4 : DWORD;
  361.     dwReserved5 : DWORD;
  362.     dwReserved6 : DWORD;
  363.   end;
  364.  
  365. (*
  366.  * This structure is the TDDCaps structure as it was in version 5 of Direct X.
  367.  * It is present for back compatability.
  368.  *)
  369.   PDDCaps_DX5 = ^TDDCaps_DX5;
  370.   TDDCaps_DX5 = packed record
  371.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  372.     dwCaps: DWORD;                 // driver specific capabilities
  373.     dwCaps2: DWORD;                // more driver specific capabilites
  374.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  375.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  376.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  377.     dwPalCaps: DWORD;              // palette capabilities
  378.     dwSVCaps: DWORD;               // stereo vision capabilities
  379.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  380.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  381.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  382.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  383.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  384.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  385.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  386.     dwVidMemTotal: DWORD;          // total amount of video memory
  387.     dwVidMemFree: DWORD;           // amount of free video memory
  388.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  389.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  390.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  391.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  392.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  393.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  394.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  395.     dwAlignStrideAlign: DWORD;     // stride alignment
  396.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  397.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  398.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  399.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  400.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  401.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  402.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  403.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  404.     dwReserved1: DWORD;            // reserved
  405.     dwReserved2: DWORD;            // reserved
  406.     dwReserved3: DWORD;            // reserved
  407.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  408.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  409.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  410.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  411.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  412.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  413.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  414.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  415.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  416.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  417.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  418.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  419.     // Members added for DX5:
  420.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  421.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  422.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  423.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  424.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  425.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  426.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  427.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  428.   end;
  429.  
  430.   PDDCaps_DX6 = ^TDDCaps_DX6;
  431.   TDDCaps_DX6 = packed record
  432.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  433.     dwCaps: DWORD;                 // driver specific capabilities
  434.     dwCaps2: DWORD;                // more driver specific capabilites
  435.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  436.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  437.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  438.     dwPalCaps: DWORD;              // palette capabilities
  439.     dwSVCaps: DWORD;               // stereo vision capabilities
  440.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  441.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  442.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  443.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  444.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  445.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  446.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  447.     dwVidMemTotal: DWORD;          // total amount of video memory
  448.     dwVidMemFree: DWORD;           // amount of free video memory
  449.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  450.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  451.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  452.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  453.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  454.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  455.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  456.     dwAlignStrideAlign: DWORD;     // stride alignment
  457.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  458.     ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6
  459.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  460.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  461.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  462.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  463.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  464.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  465.     dwReserved1: DWORD;            // reserved
  466.     dwReserved2: DWORD;            // reserved
  467.     dwReserved3: DWORD;            // reserved
  468.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  469.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  470.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  471.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  472.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  473.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  474.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  475.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  476.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  477.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  478.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  479.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  480.     // Members added for DX5:
  481.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  482.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  483.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  484.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  485.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  486.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  487.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  488.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  489.     // Members added for DX6 release
  490.     ddsCaps : TDDSCaps2 ;          // Surface Caps
  491.   end;
  492.  
  493.   TDDCaps_DX7 = TDDCaps_DX6;
  494.  
  495.   PDDCaps = ^TDDCaps;
  496.  
  497. {$IFDEF DIRECTX3}
  498.   TDDCaps = TDDCaps_DX3;
  499. {$ELSE}
  500.   {$IFDEF DIRECTX5}
  501.     TDDCaps = TDDCaps_DX5;
  502.   {$ELSE}
  503.     {$IFDEF DIRECTX6}
  504.       TDDCaps = TDDCaps_DX6;
  505.     {$ELSE}
  506.       TDDCaps = TDDCaps_DX7;
  507.     {$ENDIF}
  508.   {$ENDIF}
  509. {$ENDIF}
  510.  
  511.  
  512.  
  513.  
  514. (*
  515.  * TDDPixelFormat
  516.  *)
  517.   PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;
  518.   TDDPixelFormat_DX5 = packed record
  519.     dwSize: DWORD;                 // size of structure
  520.     dwFlags: DWORD;                // pixel format flags
  521.     dwFourCC: DWORD;               // (FOURCC code)
  522.     case Integer of
  523.     0: (
  524.       dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  525.      );
  526.     1: (
  527.       dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  528.      );
  529.     2: (
  530.       dwRGBBitCount: DWORD;          // how many bits per pixel
  531.       dwRBitMask: DWORD;             // mask for red bit
  532.       dwGBitMask: DWORD;             // mask for green bits
  533.       dwBBitMask: DWORD;             // mask for blue bits
  534.       dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  535.      );
  536.     3: (
  537.       dwYUVBitCount: DWORD;          // how many bits per pixel
  538.       dwYBitMask: DWORD;             // mask for Y bits
  539.       dwUBitMask: DWORD;             // mask for U bits
  540.       dwVBitMask: DWORD;             // mask for V bits
  541.       case Integer of
  542.       0: (
  543.         dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  544.        );
  545.       1: (
  546.         dwRGBZBitMask: DWORD;
  547.        );
  548.       2: (
  549.         dwYUVZBitMask: DWORD;
  550.        );
  551.      );
  552.   end;
  553.  
  554.   PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;
  555.   TDDPixelFormat_DX6 = packed record
  556.     dwSize: DWORD;                 // size of structure
  557.     dwFlags: DWORD;                // pixel format flags
  558.     dwFourCC: DWORD;               // (FOURCC code)
  559.     case Integer of
  560.       1: (
  561.           dwRGBBitCount : DWORD;  // how many bits per pixel
  562.           dwRBitMask : DWORD;  // mask for red bit
  563.           dwGBitMask : DWORD;  // mask for green bits
  564.           dwBBitMask : DWORD;  // mask for blue bits
  565.           dwRGBAlphaBitMask : DWORD; // mask for alpha channel
  566.           );
  567.       2: (
  568.           dwYUVBitCount : DWORD;  // how many bits per pixel
  569.           dwYBitMask : DWORD;  // mask for Y bits
  570.           dwUBitMask : DWORD;  // mask for U bits
  571.           dwVBitMask : DWORD;  // mask for V bits
  572.           dwYUVAlphaBitMask : DWORD; // mask for alpha channel
  573.           );
  574.       3: (
  575.           dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)
  576.           dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
  577.           dwZBitMask : DWORD;  // mask for Z bits
  578.           dwStencilBitMask : DWORD; // mask for stencil bits
  579.           dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel
  580.           );
  581.       4: (
  582.           dwAlphaBitDepth : DWORD; // how many bits for alpha channels
  583.           dwLuminanceBitMask : DWORD; // mask for luminance bits
  584.           dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits
  585.           dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map
  586.           dwRGBZBitMask : DWORD;  // mask for Z channel
  587.           );
  588.       5: (
  589.            dwLuminanceBitCount : DWORD; // how many bits per pixel
  590.            dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits
  591.            Fill1, Fill2    : DWORD;
  592.            dwYUVZBitMask   : DWORD;  // mask for Z channel
  593.          );
  594.       6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total
  595.          );
  596.   end;
  597.  
  598.   TDDPixelFormat_DX3 = TDDPixelFormat_DX5;
  599.   TDDPixelFormat_DX7 = TDDPixelFormat_DX6;
  600.  
  601.   PDDPixelFormat = ^TDDPixelFormat;
  602. {$IFDEF DIRECTX3}
  603.   TDDPixelFormat = TDDPixelFormat_DX3;
  604. {$ELSE}
  605.   {$IFDEF DIRECTX5}
  606.     TDDPixelFormat = TDDPixelFormat_DX5;
  607.   {$ELSE}
  608.     {$IFDEF DIRECTX6}
  609.       TDDPixelFormat = TDDPixelFormat_DX6;
  610.     {$ELSE}
  611.       TDDPixelFormat = TDDPixelFormat_DX7;
  612.     {$ENDIF}
  613.   {$ENDIF}
  614. {$ENDIF}
  615.  
  616. (*
  617.  * TDDOverlayFX
  618.  *)
  619.   PDDOverlayFX = ^TDDOverlayFX;
  620.   TDDOverlayFX = packed record
  621.     dwSize: DWORD;                         // size of structure
  622.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  623.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  624.     dwReserved: DWORD;
  625.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  626.     case Integer of
  627.     0: (
  628.       dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
  629.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  630.       dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
  631.       dckDestColorkey: TDDColorKey;                // DestColorkey override
  632.       dckSrcColorkey: TDDColorKey;                 // DestColorkey override
  633.       dwDDFX: DWORD;                         // Overlay FX
  634.       dwFlags: DWORD;                        // flags
  635.      );
  636.     1: (
  637.       lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest
  638.       filler: DWORD;
  639.       lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src
  640.      );
  641.   end;
  642.  
  643. (*
  644.  * TDDBltBatch: BltBatch entry structure
  645.  *)
  646.   PDDBltBatch = ^TDDBltBatch;
  647.   TDDBltBatch = packed record
  648.     lprDest: PRect;
  649.     lpDDSSrc: IDirectDrawSurface;
  650.     lprSrc: PRect;
  651.     dwFlags: DWORD;
  652.     lpDDBltFx: TDDBltFX;
  653.   end;
  654.  
  655. (*
  656.  * TDDGammaRamp
  657.  *)
  658.   PDDGammaRamp = ^TDDGammaRamp;
  659.   TDDGammaRamp = packed record
  660.     red   : array[0..255] of WORD;
  661.     green : array[0..255] of WORD;
  662.     blue  : array[0..255] of WORD;
  663.   end;
  664.  
  665. (*
  666.  *  This is the structure within which DirectDraw returns data about the current graphics driver and chipset
  667.  *)
  668.  
  669.   PDDDeviceIdentifier = ^TDDDeviceIdentifier;
  670.   TDDDeviceIdentifier = packed record
  671.     //
  672.     // These elements are for presentation to the user only. They should not be used to identify particular
  673.     // drivers, since this is unreliable and many different strings may be associated with the same
  674.     // device, and the same driver from different vendors.
  675.     //
  676.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  677.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  678.  
  679.     //
  680.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  681.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  682.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  683.     //
  684.     // This version has the form:
  685.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  686.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  687.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  688.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  689.     //
  690.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  691.  
  692.     //
  693.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  694.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  695.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  696.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  697.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  698.     //
  699.     dwVendorId: DWORD;
  700.     dwDeviceId: DWORD;
  701.     dwSubSysId: DWORD;
  702.     dwRevision: DWORD;
  703.  
  704.     //
  705.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  706.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  707.     // reprofile the graphics subsystem.
  708.     // This element can also be used to identify particular problematic drivers.
  709.     //
  710.     guidDeviceIdentifier: TGUID;
  711.   end;
  712.  
  713.   PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
  714.   TDDDeviceIdentifier2 = packed record
  715.     //
  716.     // These elements are for presentation to the user only. They should not be used to identify particular
  717.     // drivers, since this is unreliable and many different strings may be associated with the same
  718.     // device, and the same driver from different vendors.
  719.     //
  720.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  721.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  722.  
  723.     //
  724.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  725.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  726.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  727.     //
  728.     // This version has the form:
  729.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  730.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  731.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  732.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  733.     //
  734.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  735.  
  736.     //
  737.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  738.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  739.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  740.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  741.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  742.     //
  743.     dwVendorId: DWORD;
  744.     dwDeviceId: DWORD;
  745.     dwSubSysId: DWORD;
  746.     dwRevision: DWORD;
  747.  
  748.     //
  749.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  750.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  751.     // reprofile the graphics subsystem.
  752.     // This element can also be used to identify particular problematic drivers.
  753.     //
  754.     guidDeviceIdentifier: TGUID;
  755.  
  756.     (*
  757.      * This element is used to determine the Windows Hardware Quality Lab (WHQL)
  758.      * certification level for this driver/device pair.
  759.      *)
  760.     dwWHQLLevel: DWORD;
  761.   end;
  762.  
  763. (*
  764.  * callbacks
  765.  *)
  766.   TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
  767.       Code: DWORD; lpContext: Pointer): HResult; stdcall;
  768.   TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
  769.  
  770. (*
  771.  * TDDSurfaceDesc
  772.  *)
  773.   PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
  774.   TDDSurfaceDesc_DX5 = packed record
  775.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  776.     dwFlags: DWORD;                // determines what fields are valid
  777.     dwHeight: DWORD;               // height of surface to be created
  778.     dwWidth: DWORD;                // width of input surface
  779.     case Integer of
  780.     0: (
  781.       dwLinearSize : DWORD;       // unused at the moment
  782.      );
  783.     1: (
  784.       lPitch: LongInt;                 // distance to start of next line (return value only)
  785.       dwBackBufferCount: DWORD;      // number of back buffers requested
  786.       case Integer of
  787.       0: (
  788.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  789.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  790.         dwReserved: DWORD;             // reserved
  791.         lpSurface: Pointer;              // pointer to the associated surface memory
  792.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  793.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  794.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  795.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  796.         ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface
  797.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  798.        );
  799.       1: (
  800.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  801.        );
  802.       2: (
  803.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  804.        );
  805.      );
  806.   end;
  807.  
  808.   PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
  809.   TDDSurfaceDesc_DX6 = packed record
  810.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  811.     dwFlags: DWORD;                // determines what fields are valid
  812.     dwHeight: DWORD;               // height of surface to be created
  813.     dwWidth: DWORD;                // width of input surface
  814.     case Integer of
  815.     0: (
  816.       dwLinearSize : DWORD;       // unused at the moment
  817.      );
  818.     1: (
  819.       lPitch: LongInt;                 // distance to start of next line (return value only)
  820.       dwBackBufferCount: DWORD;      // number of back buffers requested
  821.       case Integer of
  822.       0: (
  823.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  824.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  825.         dwReserved: DWORD;             // reserved
  826.         lpSurface: Pointer;              // pointer to the associated surface memory
  827.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  828.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  829.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  830.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  831.         ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface
  832.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  833.        );
  834.       1: (
  835.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  836.        );
  837.       2: (
  838.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  839.        );
  840.      );
  841.   end;
  842.  
  843.   PDDSurfaceDesc = ^TDDSurfaceDesc;
  844. {$IFDEF DIRECTX5}
  845.   TDDSurfaceDesc = TDDSurfaceDesc_DX5;
  846. {$ELSE}
  847.   TDDSurfaceDesc = TDDSurfaceDesc_DX6;
  848. {$ENDIF}
  849.  
  850.  
  851. (*
  852.  * TDDSurfaceDesc2
  853.  *)
  854.   PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  855.   TDDSurfaceDesc2 = packed record
  856.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  857.     dwFlags: DWORD;                // determines what fields are valid
  858.     dwHeight: DWORD;               // height of surface to be created
  859.     dwWidth: DWORD;                // width of input surface
  860.     case Integer of
  861.     0: (
  862.       lPitch : LongInt;                  // distance to start of next line (return value only)
  863.      );
  864.     1: (
  865.       dwLinearSize : DWORD;              // Formless late-allocated optimized surface size
  866.       dwBackBufferCount: DWORD;          // number of back buffers requested
  867.       case Integer of
  868.       0: (
  869.         dwMipMapCount: DWORD;            // number of mip-map levels requested
  870.         dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested
  871.         dwReserved: DWORD;               // reserved
  872.         lpSurface: Pointer;              // pointer to the associated surface memory
  873.         ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use
  874.         ddckCKDestBlt: TDDColorKey;      // color key for destination blt use
  875.         ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use
  876.         ddckCKSrcBlt: TDDColorKey;       // color key for source blt use
  877.         ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface
  878.         ddsCaps: TDDSCaps2;              // direct draw surface capabilities
  879.         dwTextureStage: DWORD;           // stage in multitexture cascade
  880.        );
  881.       1: (
  882.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  883.        );
  884.      );
  885.   end;
  886.  
  887. (*
  888.  * TDDOptSurfaceDesc
  889.  *)
  890.  
  891.   PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  892.   TDDOptSurfaceDesc = packed record
  893.     dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure
  894.     dwFlags : DWORD;            // determines what fields are valid
  895.     ddSCaps : TDDSCaps2;        // Common caps like: Memory type
  896.     ddOSCaps : TDDOSCaps;       // Common caps like: Memory type
  897.     guid : TGUID;               // Compression technique GUID
  898.     dwCompressionRatio : DWORD; // Compression ratio
  899.   end;
  900.  
  901. (*
  902.  * DDCOLORCONTROL
  903.  *)
  904.   PDDColorControl = ^TDDColorControl;
  905.   TDDColorControl = packed record
  906.     dwSize: DWORD;
  907.     dwFlags: DWORD;
  908.     lBrightness: LongInt;
  909.     lContrast: LongInt;
  910.     lHue: LongInt;
  911.     lSaturation: LongInt;
  912.     lSharpness: LongInt;
  913.     lGamma: LongInt;
  914.     lColorEnable: LongInt;
  915.     dwReserved1: DWORD;
  916.   end;
  917.  
  918. (*
  919.  * callbacks
  920.  *)
  921.  
  922. {$IFNDEF WINNT}
  923.   TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;
  924.       lpContext: Pointer) : HResult; stdcall;
  925.   TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  926.       lpContext: Pointer) : HResult; stdcall;
  927.   TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;
  928.       const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;
  929.   TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;
  930.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  931.   TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;
  932.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  933. {$ENDIF}
  934.  
  935. (*
  936.  * INTERACES FOLLOW:
  937.  *      IDirectDraw
  938.  *      IDirectDrawClipper
  939.  *      IDirectDrawPalette
  940.  *      IDirectDrawSurface
  941.  *)
  942.  
  943. (*
  944.  * IDirectDraw
  945.  *)
  946.  
  947.   IDirectDraw = interface (IUnknown)
  948.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  949.     (*** IDirectDraw methods ***)
  950.     function Compact: HResult; stdcall;
  951.     function CreateClipper (dwFlags: DWORD;
  952.         out lplpDDClipper: IDirectDrawClipper;
  953.         pUnkOuter: IUnknown) : HResult; stdcall;
  954.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  955.         out lplpDDPalette: IDirectDrawPalette;
  956.         pUnkOuter: IUnknown) : HResult; stdcall;
  957.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  958.         out lplpDDSurface: IDirectDrawSurface;
  959.         pUnkOuter: IUnknown) : HResult; stdcall;
  960.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  961.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  962.     function EnumDisplayModes (dwFlags: DWORD;
  963.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  964.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  965.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  966.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  967.         HResult; stdcall;
  968.     function FlipToGDISurface: HResult; stdcall;
  969.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  970.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  971.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  972.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :
  973.         HResult; stdcall;
  974.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  975.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  976.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  977.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  978.     function RestoreDisplayMode: HResult; stdcall;
  979.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  980.     (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  981.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;
  982.         dwBpp: DWORD) : HResult; stdcall;
  983.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  984.         HResult; stdcall;
  985.   end;
  986.  
  987.   IDirectDraw2 = interface (IUnknown)
  988.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  989.     (*** IDirectDraw methods ***)
  990.     function Compact: HResult; stdcall;
  991.     function CreateClipper (dwFlags: DWORD;
  992.         out lplpDDClipper: IDirectDrawClipper;
  993.         pUnkOuter: IUnknown) : HResult; stdcall;
  994.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  995.         out lplpDDPalette: IDirectDrawPalette;
  996.         pUnkOuter: IUnknown) : HResult; stdcall;
  997.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  998.         out lplpDDSurface: IDirectDrawSurface;
  999.         pUnkOuter: IUnknown) : HResult; stdcall;
  1000.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  1001.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  1002.     function EnumDisplayModes (dwFlags: DWORD;
  1003.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  1004.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  1005.     function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;
  1006.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  1007.         HResult; stdcall;
  1008.     function FlipToGDISurface: HResult; stdcall;
  1009.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1010.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1011.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1012.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;
  1013.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1014.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1015.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1016.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1017.     function RestoreDisplayMode: HResult; stdcall;
  1018.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1019. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1020.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1021.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1022.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1023.         HResult; stdcall;
  1024.     (*** Added in the v2 interface ***)
  1025.     function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;
  1026.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1027.   end;
  1028.  
  1029.   IDirectDraw4 = interface (IUnknown)
  1030.     ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']
  1031.     (*** IDirectDraw methods ***)
  1032.     function Compact: HResult; stdcall;
  1033.     function CreateClipper (dwFlags: DWORD;
  1034.         out lplpDDClipper: IDirectDrawClipper;
  1035.         pUnkOuter: IUnknown) : HResult; stdcall;
  1036.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1037.         out lplpDDPalette: IDirectDrawPalette;
  1038.         pUnkOuter: IUnknown) : HResult; stdcall;
  1039.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1040.         out lplpDDSurface: IDirectDrawSurface4;
  1041.         pUnkOuter: IUnknown) : HResult; stdcall;
  1042.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;
  1043.         out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  1044.     function EnumDisplayModes (dwFlags: DWORD;
  1045.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1046.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1047.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1048.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :
  1049.         HResult; stdcall;
  1050.     function FlipToGDISurface: HResult; stdcall;
  1051.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1052.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1053.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1054.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :
  1055.         HResult; stdcall;
  1056.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1057.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1058.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1059.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1060.     function RestoreDisplayMode: HResult; stdcall;
  1061.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1062. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1063.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1064.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1065.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1066.         HResult; stdcall;
  1067.     (*** Added in the v2 interface ***)
  1068.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1069.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1070.     (*** Added in the V4 Interface ***)
  1071.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1072.         out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;
  1073.     function RestoreAllSurfaces : HResult; stdcall;
  1074.     function TestCooperativeLevel : HResult; stdcall;
  1075.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;
  1076.         dwFlags: DWORD) : HResult; stdcall;
  1077.   end;
  1078.  
  1079.   IDirectDraw7 = interface (IUnknown)
  1080.     ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']
  1081.     (*** IDirectDraw methods ***)
  1082.     function Compact: HResult; stdcall;
  1083.     function CreateClipper (dwFlags: DWORD;
  1084.         out lplpDDClipper: IDirectDrawClipper;
  1085.         pUnkOuter: IUnknown) : HResult; stdcall;
  1086.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1087.         out lplpDDPalette: IDirectDrawPalette;
  1088.         pUnkOuter: IUnknown) : HResult; stdcall;
  1089.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1090.         out lplpDDSurface: IDirectDrawSurface7;
  1091.         pUnkOuter: IUnknown) : HResult; stdcall;
  1092.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;
  1093.         out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;
  1094.     function EnumDisplayModes (dwFlags: DWORD;
  1095.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1096.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1097.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1098.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :
  1099.         HResult; stdcall;
  1100.     function FlipToGDISurface: HResult; stdcall;
  1101.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1102.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1103.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1104.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :
  1105.         HResult; stdcall;
  1106.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1107.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1108.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1109.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1110.     function RestoreDisplayMode: HResult; stdcall;
  1111.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1112.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1113.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1114.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1115.         HResult; stdcall;
  1116.     (*** Added in the v2 interface ***)
  1117.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1118.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1119.     (*** Added in the V4 Interface ***)
  1120.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1121.         out lpDDS: IDirectDrawSurface7) : HResult; stdcall;
  1122.     function RestoreAllSurfaces : HResult; stdcall;
  1123.     function TestCooperativeLevel : HResult; stdcall;
  1124.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;
  1125.         dwFlags: DWORD) : HResult; stdcall;
  1126.     function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;
  1127.     function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;
  1128.   end;
  1129.  
  1130.  
  1131.  
  1132. (*
  1133.  * IDirectDrawPalette
  1134.  *)
  1135.  
  1136.   IDirectDrawPalette = interface (IUnknown)
  1137.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  1138.     (*** IDirectDrawPalette methods ***)
  1139.     function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;
  1140.     function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
  1141.         lpEntries: pointer) : HResult; stdcall;
  1142.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;
  1143.         lpDDColorTable: pointer) : HResult; stdcall;
  1144.     function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;
  1145.         dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;
  1146.   end;
  1147.  
  1148. (*
  1149.  * IDirectDrawClipper
  1150.  *)
  1151.  
  1152.   IDirectDrawClipper = interface (IUnknown)
  1153.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  1154.     (*** IDirectDrawClipper methods ***)
  1155.     function GetClipList (lpRect: PRect; lpClipList: PRgnData;
  1156.         var lpdwSize: DWORD) : HResult; stdcall;
  1157.     function GetHWnd (out lphWnd: HWND) : HResult; stdcall;
  1158.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;
  1159.     function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;
  1160.     function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;
  1161.     function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;
  1162.   end;
  1163.  
  1164. (*
  1165.  * IDirectDrawSurface and related interfaces
  1166.  *)
  1167.  
  1168.   IDirectDrawSurface = interface (IUnknown)
  1169.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  1170.     (*** IDirectDrawSurface methods ***)
  1171.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :
  1172.         HResult; stdcall;
  1173.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1174.     function Blt (lpDestRect: PRect;
  1175.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1176.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1177.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1178.         dwFlags: DWORD) : HResult; stdcall;
  1179.     function BltFast (dwX: DWORD; dwY: DWORD;
  1180.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1181.         dwTrans: DWORD) : HResult; stdcall;
  1182.     function DeleteAttachedSurface (dwFlags: DWORD;
  1183.         lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1184.     function EnumAttachedSurfaces (lpContext: Pointer;
  1185.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1186.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1187.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1188.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;
  1189.         dwFlags: DWORD) : HResult; stdcall;
  1190.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1191.         (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1192.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1193.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1194.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1195.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1196.         HResult; stdcall;
  1197.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1198.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1199.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1200.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1201.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1202.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1203.     function Initialize (lpDD: IDirectDraw;
  1204.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1205.     function IsLost: HResult; stdcall;
  1206.     function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:
  1207.         TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;
  1208.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1209.     function _Restore: HResult; stdcall;
  1210.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1211.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1212.         HResult; stdcall;
  1213.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1214.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1215.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1216.     function UpdateOverlay (lpSrcRect: PRect;
  1217.         lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;
  1218.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1219.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1220.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1221.         lpDDSReference: IDirectDrawSurface) : HResult; stdcall;
  1222.   end;
  1223.  
  1224. (*
  1225.  * IDirectDrawSurface2 and related interfaces
  1226.  *)
  1227.  
  1228.   IDirectDrawSurface2 = interface (IUnknown)
  1229.     ['{57805885-6eec-11cf-9441-a82303c10e27}']
  1230.     (*** IDirectDrawSurface methods ***)
  1231.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :
  1232.         HResult; stdcall;
  1233.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1234.     function Blt (lpDestRect: PRect;
  1235.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1236.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1237.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1238.         dwFlags: DWORD) : HResult; stdcall;
  1239.     function BltFast (dwX: DWORD; dwY: DWORD;
  1240.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1241.         dwTrans: DWORD) : HResult; stdcall;
  1242.     function DeleteAttachedSurface (dwFlags: DWORD;
  1243.         lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1244.     function EnumAttachedSurfaces (lpContext: Pointer;
  1245.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1246.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1247.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1248.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;
  1249.         dwFlags: DWORD) : HResult; stdcall;
  1250.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1251.         out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1252.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1253.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1254.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1255.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1256.         HResult; stdcall;
  1257.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1258.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1259.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1260.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1261.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1262.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1263.     function Initialize (lpDD: IDirectDraw;
  1264.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1265.     function IsLost: HResult; stdcall;
  1266.     function Lock (lpDestRect: PRect;
  1267.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1268.         hEvent: THandle) : HResult; stdcall;
  1269.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1270.     function _Restore: HResult; stdcall;
  1271.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1272.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1273.         HResult; stdcall;
  1274.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1275.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1276.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1277.     function UpdateOverlay (lpSrcRect: PRect;
  1278.         lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;
  1279.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1280.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1281.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1282.         lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;
  1283.     (*** Added in the v2 interface ***)
  1284.     function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;
  1285.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1286.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1287.   end;
  1288.  
  1289.   IDirectDrawSurface3 = interface (IUnknown)
  1290.     ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
  1291.     (*** IDirectDrawSurface methods ***)
  1292.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :
  1293.         HResult; stdcall;
  1294.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1295.     function Blt (lpDestRect: PRect;
  1296.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1297.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1298.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1299.         dwFlags: DWORD) : HResult; stdcall;
  1300.     function BltFast (dwX: DWORD; dwY: DWORD;
  1301.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1302.         dwTrans: DWORD) : HResult; stdcall;
  1303.     function DeleteAttachedSurface (dwFlags: DWORD;
  1304.         lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1305.     function EnumAttachedSurfaces (lpContext: Pointer;
  1306.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1307.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1308.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1309.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;
  1310.         dwFlags: DWORD) : HResult; stdcall;
  1311.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1312.         out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1313.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1314.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1315.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1316.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1317.         HResult; stdcall;
  1318.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1319.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1320.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1321.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1322.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1323.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1324.     function Initialize (lpDD: IDirectDraw;
  1325.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1326.     function IsLost: HResult; stdcall;
  1327.     function Lock (lpDestRect: PRect;
  1328.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1329.         hEvent: THandle) : HResult; stdcall;
  1330.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1331.     function _Restore: HResult; stdcall;
  1332.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1333.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1334.         HResult; stdcall;
  1335.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1336.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1337.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1338.     function UpdateOverlay (lpSrcRect: PRect;
  1339.         lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;
  1340.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1341.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1342.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1343.         lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;
  1344.     (*** Added in the v2 interface ***)
  1345.     function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;
  1346.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1347.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1348.     (*** Added in the V3 interface ***)
  1349.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;
  1350.   end;
  1351.  
  1352. (*
  1353.  * IDirectDrawSurface4 and related interfaces
  1354.  *)
  1355.   IDirectDrawSurface4 = interface (IUnknown)
  1356.     ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
  1357.     (*** IDirectDrawSurface methods ***)
  1358.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :
  1359.         HResult; stdcall;
  1360.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1361.     function Blt (lpDestRect: PRect;
  1362.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1363.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1364.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1365.         dwFlags: DWORD) : HResult; stdcall;
  1366.     function BltFast (dwX: DWORD; dwY: DWORD;
  1367.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1368.         dwTrans: DWORD) : HResult; stdcall;
  1369.     function DeleteAttachedSurface (dwFlags: DWORD;
  1370.         lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1371.     function EnumAttachedSurfaces (lpContext: Pointer;
  1372.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1373.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1374.         lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1375.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;
  1376.         dwFlags: DWORD) : HResult; stdcall;
  1377.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1378.         out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1379.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1380.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1381.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1382.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1383.         HResult; stdcall;
  1384.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1385.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1386.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1387.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1388.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1389.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1390.     function Initialize (lpDD: IDirectDraw;
  1391.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1392.     function IsLost: HResult; stdcall;
  1393.     function Lock (lpDestRect: PRect;
  1394.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1395.         hEvent: THandle) : HResult; stdcall;
  1396.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1397.     function _Restore: HResult; stdcall;
  1398.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1399.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1400.         HResult; stdcall;
  1401.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1402.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1403.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1404.     function UpdateOverlay (lpSrcRect: PRect;
  1405.         lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;
  1406.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1407.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1408.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1409.         lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;
  1410.     (*** Added in the v2 interface ***)
  1411.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1412.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1413.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1414.     (*** Added in the V3 interface ***)
  1415.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1416.     (*** Added in the v4 interface ***)
  1417.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1418.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1419.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1420.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1421.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1422.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1423.     function ChangeUniquenessValue : HResult; stdcall;
  1424.   end;
  1425.  
  1426.   IDirectDrawSurface7 = interface (IUnknown)
  1427.     ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']
  1428.     (*** IDirectDrawSurface methods ***)
  1429.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :
  1430.         HResult; stdcall;
  1431.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1432.     function Blt (lpDestRect: PRect;
  1433.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1434.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1435.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1436.         dwFlags: DWORD) : HResult; stdcall;
  1437.     function BltFast (dwX: DWORD; dwY: DWORD;
  1438.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1439.         dwTrans: DWORD) : HResult; stdcall;
  1440.     function DeleteAttachedSurface (dwFlags: DWORD;
  1441.         lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1442.     function EnumAttachedSurfaces (lpContext: Pointer;
  1443.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1444.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1445.         lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1446.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;
  1447.         dwFlags: DWORD) : HResult; stdcall;
  1448.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1449.         out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1450.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1451.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1452.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1453.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1454.         HResult; stdcall;
  1455.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1456.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1457.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1458.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1459.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1460.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1461.     function Initialize (lpDD: IDirectDraw;
  1462.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1463.     function IsLost: HResult; stdcall;
  1464.     function Lock (lpDestRect: PRect;
  1465.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1466.         hEvent: THandle) : HResult; stdcall;
  1467.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1468.     function _Restore: HResult; stdcall;
  1469.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1470.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1471.         HResult; stdcall;
  1472.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1473.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1474.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1475.     function UpdateOverlay (lpSrcRect: PRect;
  1476.         lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;
  1477.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1478.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1479.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1480.         lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;
  1481.     (*** Added in the v2 interface ***)
  1482.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1483.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1484.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1485.     (*** Added in the V3 interface ***)
  1486.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1487.     (*** Added in the v4 interface ***)
  1488.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1489.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1490.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1491.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1492.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1493.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1494.     function ChangeUniquenessValue : HResult; stdcall;
  1495.     (*** Moved Texture7 methods here ***)
  1496.     function SetPriority(dwPriority: DWORD) : HResult; stdcall;
  1497.     function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;
  1498.     function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;
  1499.     function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;
  1500.   end;
  1501.  
  1502.   IDirectDrawColorControl = interface (IUnknown)
  1503.     ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
  1504.     function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;
  1505.     function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;
  1506.   end;
  1507.  
  1508. (*
  1509.  * IDirectDrawGammaControl
  1510.  *)
  1511.   IDirectDrawGammaControl = interface (IUnknown)
  1512.     ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
  1513.     function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)
  1514.         : HResult; stdcall;
  1515.     function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)
  1516.         : HResult; stdcall;
  1517.   end;
  1518.  
  1519. type
  1520.   IID_IDirectDraw = IDirectDraw;
  1521.   IID_IDirectDraw2 = IDirectDraw2;
  1522.   IID_IDirectDraw4 = IDirectDraw4;
  1523.   IID_IDirectDraw7 = IDirectDraw7;
  1524.   IID_IDirectDrawSurface = IDirectDrawSurface;
  1525.   IID_IDirectDrawSurface2 = IDirectDrawSurface2;
  1526.   IID_IDirectDrawSurface3 = IDirectDrawSurface3;
  1527.   IID_IDirectDrawSurface4 = IDirectDrawSurface4;
  1528.   IID_IDirectDrawSurface7 = IDirectDrawSurface7;
  1529.  
  1530.   IID_IDirectDrawPalette = IDirectDrawPalette;
  1531.   IID_IDirectDrawClipper = IDirectDrawClipper;
  1532.   IID_IDirectDrawColorControl = IDirectDrawColorControl;
  1533.   IID_IDirectDrawGammaControl = IDirectDrawGammaControl;
  1534.  
  1535. const  
  1536. (*
  1537.  * ddsCaps field is valid.
  1538.  *)
  1539.   DDSD_CAPS               = $00000001;     // default
  1540.  
  1541. (*
  1542.  * dwHeight field is valid.
  1543.  *)
  1544.   DDSD_HEIGHT             = $00000002;
  1545.  
  1546. (*
  1547.  * dwWidth field is valid.
  1548.  *)
  1549.   DDSD_WIDTH              = $00000004;
  1550.  
  1551. (*
  1552.  * lPitch is valid.
  1553.  *)
  1554.   DDSD_PITCH              = $00000008;
  1555.  
  1556. (*
  1557.  * dwBackBufferCount is valid.
  1558.  *)
  1559.   DDSD_BACKBUFFERCOUNT    = $00000020;
  1560.  
  1561. (*
  1562.  * dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
  1563.  *)
  1564.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  1565.  
  1566. (*
  1567.  * dwAlphaBitDepth is valid.
  1568.  *)
  1569.    DDSD_ALPHABITDEPTH      = $00000080;
  1570.  
  1571. (*
  1572.  * lpSurface is valid.
  1573.  *)
  1574.   DDSD_LPSURFACE           = $00000800;
  1575.  
  1576. (*
  1577.  * ddpfPixelFormat is valid.
  1578.  *)
  1579.   DDSD_PIXELFORMAT        = $00001000;
  1580.  
  1581. (*
  1582.  * ddckCKDestOverlay is valid.
  1583.  *)
  1584.   DDSD_CKDESTOVERLAY      = $00002000;
  1585.  
  1586. (*
  1587.  * ddckCKDestBlt is valid.
  1588.  *)
  1589.   DDSD_CKDESTBLT          = $00004000;
  1590.  
  1591. (*
  1592.  * ddckCKSrcOverlay is valid.
  1593.  *)
  1594.   DDSD_CKSRCOVERLAY       = $00008000;
  1595.  
  1596. (*
  1597.  * ddckCKSrcBlt is valid.
  1598.  *)
  1599.   DDSD_CKSRCBLT           = $00010000;
  1600.  
  1601. (*
  1602.  * dwMipMapCount is valid.
  1603.  *)
  1604.   DDSD_MIPMAPCOUNT        = $00020000;
  1605.  
  1606.  (*
  1607.   * dwRefreshRate is valid
  1608.   *)
  1609.   DDSD_REFRESHRATE        = $00040000;
  1610.  
  1611. (*
  1612.  * dwLinearSize is valid
  1613.  *)
  1614.   DDSD_LINEARSIZE         = $00080000;
  1615.  
  1616. (*
  1617.  * dwTextureStage is valid
  1618.  *)
  1619.   DDSD_TEXTURESTAGE       = $00100000;
  1620.  
  1621. (*
  1622.  * All input fields are valid.
  1623.  *)
  1624.   DDSD_ALL                = $001ff9ee;
  1625.  
  1626.  
  1627. (*
  1628.  * guid field is valid.
  1629.  *)
  1630.   DDOSD_GUID                  = $00000001;
  1631.  
  1632. (*
  1633.  * dwCompressionRatio field is valid.
  1634.  *)
  1635.   DDOSD_COMPRESSION_RATIO     = $00000002;
  1636.  
  1637. (*
  1638.  * ddSCaps field is valid.
  1639.  *)
  1640.   DDOSD_SCAPS                 = $00000004;
  1641.  
  1642. (*
  1643.  * ddOSCaps field is valid.
  1644.  *)
  1645.   DDOSD_OSCAPS                = $00000008;
  1646.  
  1647. (*
  1648.  * All input fields are valid.
  1649.  *)
  1650.   DDOSD_ALL                   = $0000000f;
  1651.  
  1652. (*
  1653.  * The surface's optimized pixelformat is compressed
  1654.  *)
  1655.   DDOSDCAPS_OPTCOMPRESSED                       = $00000001;
  1656.  
  1657. (*
  1658.  * The surface's optimized pixelformat is reordered
  1659.  *)
  1660.   DDOSDCAPS_OPTREORDERED                        = $00000002;
  1661.  
  1662. (*
  1663.  * The opt surface is a monolithic mipmap
  1664.  *)
  1665.   DDOSDCAPS_MONOLITHICMIPMAP            = $00000004;
  1666.  
  1667. (*
  1668.  * The valid Surf caps:
  1669.  *   DDSCAPS_SYSTEMMEMORY       = $00000800;
  1670.  *   DDSCAPS_VIDEOMEMORY        = $00004000;
  1671.  *   DDSCAPS_LOCALVIDMEM        = $10000000;
  1672.  *   DDSCAPS_NONLOCALVIDMEM     = $20000000;
  1673.  *)
  1674.   DDOSDCAPS_VALIDSCAPS          = $30004800;
  1675.  
  1676. (*
  1677.  * The valid OptSurf caps
  1678.  *)
  1679.   DDOSDCAPS_VALIDOSCAPS                 = $00000007;
  1680.  
  1681.  
  1682. (*
  1683.  * DDCOLORCONTROL
  1684.  *)
  1685.  
  1686. (*
  1687.  * lBrightness field is valid.
  1688.  *)
  1689.   DDCOLOR_BRIGHTNESS            = $00000001;
  1690.  
  1691. (*
  1692.  * lContrast field is valid.
  1693.  *)
  1694.   DDCOLOR_CONTRAST              = $00000002;
  1695.  
  1696. (*
  1697.  * lHue field is valid.
  1698.  *)
  1699.   DDCOLOR_HUE                   = $00000004;
  1700.  
  1701. (*
  1702.  * lSaturation field is valid.
  1703.  *)
  1704.   DDCOLOR_SATURATION            = $00000008;
  1705.  
  1706. (*
  1707.  * lSharpness field is valid.
  1708.  *)
  1709.   DDCOLOR_SHARPNESS             = $00000010;
  1710.  
  1711. (*
  1712.  * lGamma field is valid.
  1713.  *)
  1714.   DDCOLOR_GAMMA                 = $00000020;
  1715.  
  1716. (*
  1717.  * lColorEnable field is valid.
  1718.  *)
  1719.   DDCOLOR_COLORENABLE           = $00000040;
  1720.  
  1721.  
  1722.  
  1723. (*============================================================================
  1724.  *
  1725.  * Direct Draw Capability Flags
  1726.  *
  1727.  * These flags are used to describe the capabilities of a given Surface.
  1728.  * All flags are bit flags.
  1729.  *
  1730.  *==========================================================================*)
  1731.  
  1732. (****************************************************************************
  1733.  *
  1734.  * DIRECTDRAWSURFACE CAPABILITY FLAGS
  1735.  *
  1736.  ****************************************************************************)
  1737. (*
  1738.  * This bit currently has no meaning.
  1739.  *)
  1740.   DDSCAPS_RESERVED1                       = $00000001;
  1741.  
  1742. (*
  1743.  * Indicates that this surface contains alpha-only information.
  1744.  * (To determine if a surface is RGBA/YUVA, the pixel format must be
  1745.  * interrogated.)
  1746.  *)
  1747.   DDSCAPS_ALPHA                           = $00000002;
  1748.  
  1749. (*
  1750.  * Indicates that this surface is a backbuffer.  It is generally
  1751.  * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
  1752.  * It indicates that this surface is THE back buffer of a surface
  1753.  * flipping structure.  DirectDraw supports N surfaces in a
  1754.  * surface flipping structure.  Only the surface that immediately
  1755.  * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
  1756.  * The other surfaces are identified as back buffers by the presence
  1757.  * of the DDSCAPS_FLIP capability, their attachment order, and the
  1758.  * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
  1759.  * capabilities.  The bit is sent to CreateSurface when a standalone
  1760.  * back buffer is being created.  This surface could be attached to
  1761.  * a front buffer and/or back buffers to form a flipping surface
  1762.  * structure after the CreateSurface call.  See AddAttachments for
  1763.  * a detailed description of the behaviors in this case.
  1764.  *)
  1765.   DDSCAPS_BACKBUFFER                      = $00000004;
  1766.  
  1767. (*
  1768.  * Indicates a complex surface structure is being described.  A
  1769.  * complex surface structure results in the creation of more than
  1770.  * one surface.  The additional surfaces are attached to the root
  1771.  * surface.  The complex structure can only be destroyed by
  1772.  * destroying the root.
  1773.  *)
  1774.   DDSCAPS_COMPLEX                         = $00000008;
  1775.  
  1776. (*
  1777.  * Indicates that this surface is a part of a surface flipping structure.
  1778.  * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
  1779.  * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
  1780.  * on the resulting creations.  The dwBackBufferCount field in the
  1781.  * TDDSurfaceDesc structure must be set to at least 1 in order for
  1782.  * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
  1783.  * must always be set with creating multiple surfaces through CreateSurface.
  1784.  *)
  1785.   DDSCAPS_FLIP                            = $00000010;
  1786.  
  1787. (*
  1788.  * Indicates that this surface is THE front buffer of a surface flipping
  1789.  * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
  1790.  * capability bit is set.
  1791.  * If this capability is sent to CreateSurface then a standalonw front buffer
  1792.  * is created.  This surface will not have the DDSCAPS_FLIP capability.
  1793.  * It can be attached to other back buffers to form a flipping structure.
  1794.  * See AddAttachments for a detailed description of the behaviors in this
  1795.  * case.
  1796.  *)
  1797.   DDSCAPS_FRONTBUFFER                     = $00000020;
  1798.  
  1799. (*
  1800.  * Indicates that this surface is any offscreen surface that is not an overlay,
  1801.  * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
  1802.  * to identify plain vanilla surfaces.
  1803.  *)
  1804.   DDSCAPS_OFFSCREENPLAIN                  = $00000040;
  1805.  
  1806. (*
  1807.  * Indicates that this surface is an overlay.  It may or may not be directly visible
  1808.  * depending on whether or not it is currently being overlayed onto the primary
  1809.  * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
  1810.  * overlayed at the moment.
  1811.  *)
  1812.   DDSCAPS_OVERLAY                         = $00000080;
  1813.  
  1814. (*
  1815.  * Indicates that unique DirectDrawPalette objects can be created and
  1816.  * attached to this surface.
  1817.  *)
  1818.   DDSCAPS_PALETTE                         = $00000100;
  1819.  
  1820. (*
  1821.  * Indicates that this surface is the primary surface.  The primary
  1822.  * surface represents what the user is seeing at the moment.
  1823.  *)
  1824.   DDSCAPS_PRIMARYSURFACE                  = $00000200;
  1825.  
  1826. (*
  1827.  * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now
  1828.  * obsolete.
  1829.  *)
  1830.   DDSCAPS_RESERVED3              = $00000400;
  1831. (*
  1832.  * Indicates that this surface is the primary surface for the left eye.
  1833.  * The primary surface for the left eye represents what the user is seeing
  1834.  * at the moment with the users left eye.  When this surface is created the
  1835.  * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
  1836.  * right eye.
  1837.  *)
  1838.   DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;
  1839.  
  1840. (*
  1841.  * Indicates that this surface memory was allocated in system memory
  1842.  *)
  1843.   DDSCAPS_SYSTEMMEMORY                    = $00000800;
  1844.  
  1845. (*
  1846.  * Indicates that this surface can be used as a 3D texture.  It does not
  1847.  * indicate whether or not the surface is being used for that purpose.
  1848.  *)
  1849.   DDSCAPS_TEXTURE                         = $00001000;
  1850.  
  1851. (*
  1852.  * Indicates that a surface may be a destination for 3D rendering.  This
  1853.  * bit must be set in order to query for a Direct3D Device Interface
  1854.  * from this surface.
  1855.  *)
  1856.   DDSCAPS_3DDEVICE                        = $00002000;
  1857.  
  1858. (*
  1859.  * Indicates that this surface exists in video memory.
  1860.  *)
  1861.   DDSCAPS_VIDEOMEMORY                     = $00004000;
  1862.  
  1863. (*
  1864.  * Indicates that changes made to this surface are immediately visible.
  1865.  * It is always set for the primary surface and is set for overlays while
  1866.  * they are being overlayed and texture maps while they are being textured.
  1867.  *)
  1868.   DDSCAPS_VISIBLE                         = $00008000;
  1869.  
  1870. (*
  1871.  * Indicates that only writes are permitted to the surface.  Read accesses
  1872.  * from the surface may or may not generate a protection fault, but the
  1873.  * results of a read from this surface will not be meaningful.  READ ONLY.
  1874.  *)
  1875.   DDSCAPS_WRITEONLY                       = $00010000;
  1876.  
  1877. (*
  1878.  * Indicates that this surface is a z buffer. A z buffer does not contain
  1879.  * displayable information.  Instead it contains bit depth information that is
  1880.  * used to determine which pixels are visible and which are obscured.
  1881.  *)
  1882.   DDSCAPS_ZBUFFER                         = $00020000;
  1883.  
  1884. (*
  1885.  * Indicates surface will have a DC associated long term
  1886.  *)
  1887.   DDSCAPS_OWNDC                           = $00040000;
  1888.  
  1889. (*
  1890.  * Indicates surface should be able to receive live video
  1891.  *)
  1892.   DDSCAPS_LIVEVIDEO                       = $00080000;
  1893.  
  1894. (*
  1895.  * Indicates surface should be able to have a stream decompressed
  1896.  * to it by the hardware.
  1897.  *)
  1898.   DDSCAPS_HWCODEC                         = $00100000;
  1899.  
  1900. (*
  1901.  * Surface is a ModeX surface.
  1902.  *
  1903.  *)
  1904.   DDSCAPS_MODEX                           = $00200000;
  1905.  
  1906. (*
  1907.  * Indicates surface is one level of a mip-map. This surface will
  1908.  * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
  1909.  * This can be done explicitly, by creating a number of surfaces and
  1910.  * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
  1911.  * If this bit is set then DDSCAPS_TEXTURE must also be set.
  1912.  *)
  1913.   DDSCAPS_MIPMAP                          = $00400000;
  1914.  
  1915. (*
  1916.  * This bit is reserved. It should not be specified.
  1917.  *)
  1918.   DDSCAPS_RESERVED2                       = $00800000;
  1919.  
  1920. (*
  1921.  * Indicates that memory for the surface is not allocated until the surface
  1922.  * is loaded (via the Direct3D texture Load() function).
  1923.  *)
  1924.   DDSCAPS_ALLOCONLOAD                     = $04000000;
  1925.  
  1926. (*
  1927.  * Indicates that the surface will recieve data from a video port.
  1928.  *)
  1929.   DDSCAPS_VIDEOPORT                       = $08000000;
  1930.  
  1931. (*
  1932.  * Indicates that a video memory surface is resident in true, local video
  1933.  * memory rather than non-local video memory. If this flag is specified then
  1934.  * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1935.  * DDSCAPS_NONLOCALVIDMEM.
  1936.  *)
  1937.   DDSCAPS_LOCALVIDMEM                     = $10000000;
  1938.  
  1939. (*
  1940.  * Indicates that a video memory surface is resident in non-local video
  1941.  * memory rather than true, local video memory. If this flag is specified
  1942.  * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1943.  * DDSCAPS_LOCALVIDMEM.
  1944.  *)
  1945.   DDSCAPS_NONLOCALVIDMEM                  = $20000000;
  1946.  
  1947. (*
  1948.  * Indicates that this surface is a standard VGA mode surface, and not a
  1949.  * ModeX surface. (This flag will never be set in combination with the
  1950.  * DDSCAPS_MODEX flag).
  1951.  *)
  1952.   DDSCAPS_STANDARDVGAMODE                 = $40000000;
  1953.  
  1954. (*
  1955.  * Indicates that this surface will be an optimized surface. This flag is
  1956.  * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface
  1957.  * will be created without any underlying video memory until loaded.
  1958.  *)
  1959.   DDSCAPS_OPTIMIZED                       = $80000000;
  1960.  
  1961.  
  1962.  
  1963. (*
  1964.  * Indicates that this surface will receive data from a video port using
  1965.  * the de-interlacing hardware.  This allows the driver to allocate memory
  1966.  * for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and
  1967.  * DDSCAPS_OVERLAY flags must also be set.
  1968.  *)
  1969.   DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;
  1970.  
  1971. (*
  1972.  * Indicates to the driver that this surface will be locked very frequently
  1973.  * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap
  1974.  * set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  1975.  * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.
  1976.  *)
  1977.   DDSCAPS2_HINTDYNAMIC                  = $00000004;
  1978.  
  1979. (*
  1980.  * Indicates to the driver that this surface can be re-ordered/retiled on
  1981.  * load. This operation will not change the size of the texture. It is
  1982.  * relatively fast and symmetrical, since the application may lock these
  1983.  * bits (although it will take a performance hit when doing so). Surfaces
  1984.  * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be
  1985.  * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.
  1986.  *)
  1987.   DDSCAPS2_HINTSTATIC                   = $00000008;
  1988.  
  1989. (*
  1990.  * Indicates that the client would like this texture surface to be managed by the
  1991.  * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have
  1992.  * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.
  1993.  *)
  1994.   DDSCAPS2_TEXTUREMANAGE                  = $00000010;
  1995.  
  1996. (*
  1997.  * These bits are reserved for internal use *)
  1998.   DDSCAPS2_RESERVED1                      = $00000020;
  1999.   DDSCAPS2_RESERVED2                      = $00000040;
  2000.  
  2001. (*
  2002.  * Indicates to the driver that this surface will never be locked again.
  2003.  * The driver is free to optimize this surface via retiling and actual compression.
  2004.  * All calls to Lock() or Blts from this surface will fail. Surfaces with this
  2005.  * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  2006.  * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.
  2007.  *)
  2008.   DDSCAPS2_OPAQUE                         = $00000080;
  2009.  
  2010. (*
  2011.  * Applications should set this bit at CreateSurface time to indicate that they
  2012.  * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.
  2013.  *)
  2014.   DDSCAPS2_HINTANTIALIASING               = $00000100;
  2015.  
  2016. (*
  2017.  * This flag is used at CreateSurface time to indicate that this set of
  2018.  * surfaces is a cubic environment map
  2019.  *)
  2020.   DDSCAPS2_CUBEMAP                        = $00000200;
  2021.  
  2022. (*
  2023.  * These flags preform two functions:
  2024.  * - At CreateSurface time, they define which of the six cube faces are
  2025.  *   required by the application.
  2026.  * - After creation, each face in the cubemap will have exactly one of these
  2027.  *   bits set.
  2028.  *)
  2029.   DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;
  2030.   DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;
  2031.   DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;
  2032.   DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;
  2033.   DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;
  2034.   DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;
  2035.  
  2036. (*
  2037.  * This macro may be used to specify all faces of a cube map at CreateSurface time
  2038.  *)
  2039.   DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or
  2040.                                 DDSCAPS2_CUBEMAP_NEGATIVEX or
  2041.                                 DDSCAPS2_CUBEMAP_POSITIVEY or
  2042.                                 DDSCAPS2_CUBEMAP_NEGATIVEY or
  2043.                                 DDSCAPS2_CUBEMAP_POSITIVEZ or
  2044.                                 DDSCAPS2_CUBEMAP_NEGATIVEZ );
  2045.  
  2046.  
  2047. (*
  2048.  * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards
  2049.  * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface
  2050.  * constructs such as Cube Maps, wherein there are more than one mipmap surface attached
  2051.  * to the root surface.
  2052.  * This caps bit is ignored by CreateSurface
  2053.  *)
  2054.   DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;
  2055.  
  2056. (* This flag indicates that the texture should be managed by D3D only *)
  2057.   DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;
  2058.  
  2059. (* This flag indicates that the managed surface can be safely lost *)
  2060.   DDSCAPS2_DONOTPERSIST                   = $00040000;
  2061.  
  2062. (* indicates that this surface is part of a stereo flipping chain *)
  2063.   DDSCAPS2_STEREOSURFACELEFT              = $00080000;
  2064.  
  2065.  
  2066.  
  2067.  (****************************************************************************
  2068.  *
  2069.  * DIRECTDRAW DRIVER CAPABILITY FLAGS
  2070.  *
  2071.  ****************************************************************************)
  2072.  
  2073. (*
  2074.  * Display hardware has 3D acceleration.
  2075.  *)
  2076.   DDCAPS_3D                       = $00000001;
  2077.  
  2078. (*
  2079.  * Indicates that DirectDraw will support only dest rectangles that are aligned
  2080.  * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
  2081.  * READ ONLY.
  2082.  *)
  2083.   DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
  2084.  
  2085. (*
  2086.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2087.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
  2088.  *)
  2089.   DDCAPS_ALIGNSIZEDEST            = $00000004;
  2090. (*
  2091.  * Indicates that DirectDraw will support only source rectangles that are aligned
  2092.  * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
  2093.  * READ ONLY.
  2094.  *)
  2095.   DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
  2096.  
  2097. (*
  2098.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2099.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
  2100.  *)
  2101.   DDCAPS_ALIGNSIZESRC             = $00000010;
  2102.  
  2103. (*
  2104.  * Indicates that DirectDraw will create video memory surfaces that have a stride
  2105.  * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
  2106.  *)
  2107.   DDCAPS_ALIGNSTRIDE              = $00000020;
  2108.  
  2109. (*
  2110.  * Display hardware is capable of blt operations.
  2111.  *)
  2112.   DDCAPS_BLT                      = $00000040;
  2113.  
  2114. (*
  2115.  * Display hardware is capable of asynchronous blt operations.
  2116.  *)
  2117.   DDCAPS_BLTQUEUE                 = $00000080;
  2118.  
  2119. (*
  2120.  * Display hardware is capable of color space conversions during the blt operation.
  2121.  *)
  2122.   DDCAPS_BLTFOURCC                = $00000100;
  2123.  
  2124. (*
  2125.  * Display hardware is capable of stretching during blt operations.
  2126.  *)
  2127.   DDCAPS_BLTSTRETCH               = $00000200;
  2128.  
  2129. (*
  2130.  * Display hardware is shared with GDI.
  2131.  *)
  2132.   DDCAPS_GDI                      = $00000400;
  2133.  
  2134. (*
  2135.  * Display hardware can overlay.
  2136.  *)
  2137.   DDCAPS_OVERLAY                  = $00000800;
  2138.  
  2139. (*
  2140.  * Set if display hardware supports overlays but can not clip them.
  2141.  *)
  2142.   DDCAPS_OVERLAYCANTCLIP          = $00001000;
  2143.  
  2144. (*
  2145.  * Indicates that overlay hardware is capable of color space conversions during
  2146.  * the overlay operation.
  2147.  *)
  2148.   DDCAPS_OVERLAYFOURCC            = $00002000;
  2149.  
  2150. (*
  2151.  * Indicates that stretching can be done by the overlay hardware.
  2152.  *)
  2153.   DDCAPS_OVERLAYSTRETCH           = $00004000;
  2154.  
  2155. (*
  2156.  * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
  2157.  * other than the primary surface.
  2158.  *)
  2159.   DDCAPS_PALETTE                  = $00008000;
  2160.  
  2161. (*
  2162.  * Indicates that palette changes can be syncd with the veritcal refresh.
  2163.  *)
  2164.   DDCAPS_PALETTEVSYNC             = $00010000;
  2165.  
  2166. (*
  2167.  * Display hardware can return the current scan line.
  2168.  *)
  2169.   DDCAPS_READSCANLINE             = $00020000;
  2170.  
  2171. (*
  2172.  * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT
  2173.  * can be created.
  2174.  *)
  2175.   DDCAPS_STEREOVIEW               = $00040000;
  2176.  
  2177. (*
  2178.  * Display hardware is capable of generating a vertical blank interrupt.
  2179.  *)
  2180.   DDCAPS_VBI                      = $00080000;
  2181.  
  2182. (*
  2183.  * Supports the use of z buffers with blt operations.
  2184.  *)
  2185.   DDCAPS_ZBLTS                    = $00100000;
  2186.  
  2187. (*
  2188.  * Supports Z Ordering of overlays.
  2189.  *)
  2190.   DDCAPS_ZOVERLAYS                = $00200000;
  2191.  
  2192. (*
  2193.  * Supports color key
  2194.  *)
  2195.   DDCAPS_COLORKEY                 = $00400000;
  2196.  
  2197. (*
  2198.  * Supports alpha surfaces
  2199.  *)
  2200.   DDCAPS_ALPHA                    = $00800000;
  2201.  
  2202. (*
  2203.  * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
  2204.  *)
  2205.   DDCAPS_COLORKEYHWASSIST         = $01000000;
  2206.  
  2207. (*
  2208.  * no hardware support at all
  2209.  *)
  2210.   DDCAPS_NOHARDWARE               = $02000000;
  2211.  
  2212. (*
  2213.  * Display hardware is capable of color fill with bltter
  2214.  *)
  2215.   DDCAPS_BLTCOLORFILL             = $04000000;
  2216.  
  2217. (*
  2218.  * Display hardware is bank switched, and potentially very slow at
  2219.  * random access to VRAM.
  2220.  *)
  2221.   DDCAPS_BANKSWITCHED             = $08000000;
  2222.  
  2223. (*
  2224.  * Display hardware is capable of depth filling Z-buffers with bltter
  2225.  *)
  2226.   DDCAPS_BLTDEPTHFILL             = $10000000;
  2227.  
  2228. (*
  2229.  * Display hardware is capable of clipping while bltting.
  2230.  *)
  2231.   DDCAPS_CANCLIP                  = $20000000;
  2232.  
  2233. (*
  2234.  * Display hardware is capable of clipping while stretch bltting.
  2235.  *)
  2236.   DDCAPS_CANCLIPSTRETCHED         = $40000000;
  2237.  
  2238. (*
  2239.  * Display hardware is capable of bltting to or from system memory
  2240.  *)
  2241.   DDCAPS_CANBLTSYSMEM             = $80000000;
  2242.  
  2243.  
  2244.  (****************************************************************************
  2245.  *
  2246.  * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
  2247.  *
  2248.  ****************************************************************************)
  2249.  
  2250. (*
  2251.  * Display hardware is certified
  2252.  *)
  2253.   DDCAPS2_CERTIFIED               = $00000001;
  2254.  
  2255. (*
  2256.  * Driver cannot interleave 2D operations (lock and blt) to surfaces with
  2257.  * Direct3D rendering operations between calls to BeginScene() and EndScene()
  2258.  *)
  2259.   DDCAPS2_NO2DDURING3DSCENE       = $00000002;
  2260.  
  2261. (*
  2262.  * Display hardware contains a video port
  2263.  *)
  2264.   DDCAPS2_VIDEOPORT               = $00000004;
  2265.  
  2266. (*
  2267.  * The overlay can be automatically flipped according to the video port
  2268.  * VSYNCs, providing automatic doubled buffered display of video port
  2269.  * data using an overlay
  2270.  *)
  2271.   DDCAPS2_AUTOFLIPOVERLAY         = $00000008;
  2272.  
  2273. (*
  2274.  * Overlay can display each field of interlaced data individually while
  2275.  * it is interleaved in memory without causing jittery artifacts.
  2276.  *)
  2277.   DDCAPS2_CANBOBINTERLEAVED     = $00000010;
  2278.  
  2279. (*
  2280.  * Overlay can display each field of interlaced data individually while
  2281.  * it is not interleaved in memory without causing jittery artifacts.
  2282.  *)
  2283.   DDCAPS2_CANBOBNONINTERLEAVED  = $00000020;
  2284.  
  2285. (*
  2286.  * The overlay surface contains color controls (brightness, sharpness, etc.)
  2287.  *)
  2288.   DDCAPS2_COLORCONTROLOVERLAY   = $00000040;
  2289.  
  2290. (*
  2291.  * The primary surface contains color controls (gamma, etc.)
  2292.  *)
  2293.   DDCAPS2_COLORCONTROLPRIMARY   = $00000080;
  2294.  
  2295. (*
  2296.  * RGBZ -> RGB supported for 16:16 RGB:Z
  2297.  *)
  2298.   DDCAPS2_CANDROPZ16BIT         = $00000100;
  2299.  
  2300. (*
  2301.  * Driver supports non-local video memory.
  2302.  *)
  2303.   DDCAPS2_NONLOCALVIDMEM          = $00000200;
  2304.  
  2305. (*
  2306.  * Dirver supports non-local video memory but has different capabilities for
  2307.  * non-local video memory surfaces. If this bit is set then so must
  2308.  * DDCAPS2_NONLOCALVIDMEM.
  2309.  *)
  2310.   DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;
  2311.  
  2312. (*
  2313.  * Driver neither requires nor prefers surfaces to be pagelocked when performing
  2314.  * blts involving system memory surfaces
  2315.  *)
  2316.   DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;
  2317.  
  2318. (*
  2319.  * Driver can create surfaces which are wider than the primary surface
  2320.  *)
  2321.   DDCAPS2_WIDESURFACES            = $00001000;
  2322.  
  2323. (*
  2324.  * Driver supports bob without using a video port by handling the
  2325.  * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.
  2326.  *)
  2327.   DDCAPS2_CANFLIPODDEVEN          = $00002000;
  2328.  
  2329. (*
  2330.  * Driver supports bob using hardware
  2331.  *)
  2332.   DDCAPS2_CANBOBHARDWARE          = $00004000;
  2333.  
  2334. (*
  2335.  * Driver supports bltting any FOURCC surface to another surface of the same FOURCC
  2336.  *)
  2337.   DDCAPS2_COPYFOURCC              = $00008000;
  2338.  
  2339.  
  2340. (*
  2341.  * Driver supports loadable gamma ramps for the primary surface
  2342.  *)
  2343.   DDCAPS2_PRIMARYGAMMA            = $00020000;
  2344.  
  2345. (*
  2346.  * Driver can render in windowed mode.
  2347.  *)
  2348.   DDCAPS2_CANRENDERWINDOWED       = $00080000;
  2349.  
  2350. (*
  2351.  * A calibrator is available to adjust the gamma ramp according to the
  2352.  * physical display properties so that the result will be identical on
  2353.  * all calibrated systems.
  2354.  *)
  2355.   DDCAPS2_CANCALIBRATEGAMMA       = $00100000;
  2356.  
  2357. (*
  2358.  * Indicates that the driver will respond to DDFLIP_INTERVALn flags
  2359.  *)
  2360.   DDCAPS2_FLIPINTERVAL            = $00200000;
  2361.  
  2362. (*
  2363.  * Indicates that the driver will respond to DDFLIP_NOVSYNC
  2364.  *)
  2365.    DDCAPS2_FLIPNOVSYNC             = $00400000;
  2366.  
  2367. (*
  2368.  * Driver supports management of video memory, if this flag is ON,
  2369.  * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on
  2370.  * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on
  2371.  *)
  2372.   DDCAPS2_CANMANAGETEXTURE        = $00800000;
  2373.  
  2374. (*
  2375.  * The Direct3D texture manager uses this cap to decide whether to put managed
  2376.  * surfaces in non-local video memory. If the cap is set, the texture manager will
  2377.  * put managed surfaces in non-local vidmem. Drivers that cannot texture from
  2378.  * local vidmem SHOULD NOT set this cap.
  2379.  *)
  2380.   DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;
  2381.  
  2382. (*
  2383.  * Indicates that the driver supports DX7 type of stereo in at least one mode (which may
  2384.  * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)
  2385.  * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of
  2386.  * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application
  2387.  * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.
  2388.  *)
  2389.   DDCAPS2_STEREO                  = $02000000;
  2390.  
  2391. (*
  2392.  * This caps bit is intended for internal DirectDraw use.
  2393.  * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.
  2394.  * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and
  2395.  *  all the assoicated system memory blt caps must be correct).
  2396.  * -It implies that the system->video blt caps in DDCAPS also apply to system to
  2397.  *  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops
  2398.  *  members of DDCAPS (DDCORECAPS) are filled in correctly.
  2399.  * -Any blt from system to nonlocal memory that matches these caps bits will
  2400.  *  be passed to the driver.
  2401.  *
  2402.  * NOTE: This is intended to enable the driver itself to do efficient reordering
  2403.  * of textures. This is NOT meant to imply that hardware can write into AGP memory.
  2404.  * This operation is not currently supported.
  2405.  *)
  2406.   DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;
  2407.  
  2408. (****************************************************************************
  2409.  *
  2410.  * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
  2411.  *
  2412.  ****************************************************************************)
  2413.  
  2414. (*
  2415.  * Supports alpha blending around the edge of a source color keyed surface.
  2416.  * For Blt.
  2417.  *)
  2418.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  2419.  
  2420. (*
  2421.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2422.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2423.  * more opaque as the alpha value increases.  (0 is transparent.)
  2424.  * For Blt.
  2425.  *)
  2426.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  2427.  
  2428. (*
  2429.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2430.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2431.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2432.  * This flag can only be set if DDCAPS_ALPHA is set.
  2433.  * For Blt.
  2434.  *)
  2435.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  2436.  
  2437. (*
  2438.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2439.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2440.  * (0 is transparent.)
  2441.  * For Blt.
  2442.  *)
  2443.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  2444.  
  2445. (*
  2446.  * The depth of the alpha channel data can range can be 1,2,4, or 8.
  2447.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2448.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2449.  * DDCAPS_ALPHA is set.
  2450.  * For Blt.
  2451.  *)
  2452.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  2453.  
  2454. (*
  2455.  * Supports alpha blending around the edge of a source color keyed surface.
  2456.  * For Overlays.
  2457.  *)
  2458.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  2459.  
  2460. (*
  2461.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2462.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2463.  * more opaque as the alpha value increases.  (0 is transparent.)
  2464.  * For Overlays.
  2465.  *)
  2466.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  2467.  
  2468. (*
  2469.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2470.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2471.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2472.  * This flag can only be set if DDCAPS_ALPHA is set.
  2473.  * For Overlays.
  2474.  *)
  2475.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  2476.  
  2477. (*
  2478.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2479.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2480.  * (0 is transparent.)
  2481.  * For Overlays.
  2482.  *)
  2483.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  2484.  
  2485. (*
  2486.  * The depth of the alpha channel data can range can be 1,2,4, or 8.  
  2487.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2488.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2489.  * DDCAPS_ALPHA is set.
  2490.  * For Overlays.
  2491.  *)
  2492.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  2493.  
  2494. (****************************************************************************
  2495.  *
  2496.  * DIRECTDRAW FX CAPABILITY FLAGS
  2497.  *
  2498.  ****************************************************************************)
  2499.  
  2500. (*
  2501.  * Uses arithmetic operations to stretch and shrink surfaces during blt
  2502.  * rather than pixel doubling techniques.  Along the Y axis.
  2503.  *)
  2504.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  2505.  
  2506. (*
  2507.  * Uses arithmetic operations to stretch during blt
  2508.  * rather than pixel doubling techniques.  Along the Y axis. Only
  2509.  * works for x1, x2, etc.
  2510.  *)
  2511.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  2512.  
  2513. (*
  2514.  * Supports mirroring left to right in blt.
  2515.  *)
  2516.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  2517.  
  2518. (*
  2519.  * Supports mirroring top to bottom in blt.
  2520.  *)
  2521.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  2522.  
  2523. (*
  2524.  * Supports arbitrary rotation for blts.
  2525.  *)
  2526.   DDFXCAPS_BLTROTATION            = $00000100;
  2527.  
  2528. (*
  2529.  * Supports 90 degree rotations for blts.
  2530.  *)
  2531.    DDFXCAPS_BLTROTATION90          = $00000200;
  2532.  
  2533. (*
  2534.  * DirectDraw supports arbitrary shrinking of a surface along the
  2535.  * x axis (horizontal direction) for blts.
  2536.  *)
  2537.   DDFXCAPS_BLTSHRINKX             = $00000400;
  2538.  
  2539. (*
  2540.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2541.  * along the x axis (horizontal direction) for blts.
  2542.  *)
  2543.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  2544.  
  2545. (*
  2546.  * DirectDraw supports arbitrary shrinking of a surface along the
  2547.  * y axis (horizontal direction) for blts.  
  2548.  *)
  2549.   DDFXCAPS_BLTSHRINKY             = $00001000;
  2550.  
  2551. (*
  2552.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2553.  * along the y axis (vertical direction) for blts.
  2554.  *)
  2555.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  2556.  
  2557. (*
  2558.  * DirectDraw supports arbitrary stretching of a surface along the
  2559.  * x axis (horizontal direction) for blts.
  2560.  *)
  2561.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  2562.  
  2563. (*
  2564.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2565.  * along the x axis (horizontal direction) for blts.
  2566.  *)
  2567.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  2568.  
  2569. (*
  2570.  * DirectDraw supports arbitrary stretching of a surface along the
  2571.  * y axis (horizontal direction) for blts.  
  2572.  *)
  2573.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  2574.  
  2575. (*
  2576.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2577.  * along the y axis (vertical direction) for blts.  
  2578.  *)
  2579.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  2580.  
  2581. (*
  2582.  * Uses arithmetic operations to stretch and shrink surfaces during
  2583.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2584.  * for overlays.
  2585.  *)
  2586.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  2587.  
  2588. (*
  2589.  * Uses arithmetic operations to stretch surfaces during
  2590.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2591.  * for overlays. Only works for x1, x2, etc.
  2592.  *)
  2593.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  2594.  
  2595. (*
  2596.  * DirectDraw supports arbitrary shrinking of a surface along the
  2597.  * x axis (horizontal direction) for overlays.
  2598.  *)
  2599.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  2600.  
  2601. (*
  2602.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2603.  * along the x axis (horizontal direction) for overlays.
  2604.  *)
  2605.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  2606.  
  2607. (*
  2608.  * DirectDraw supports arbitrary shrinking of a surface along the
  2609.  * y axis (horizontal direction) for overlays.
  2610.  *)
  2611.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  2612.  
  2613. (*
  2614.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2615.  * along the y axis (vertical direction) for overlays.  
  2616.  *)
  2617.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  2618.  
  2619. (*
  2620.  * DirectDraw supports arbitrary stretching of a surface along the
  2621.  * x axis (horizontal direction) for overlays.
  2622.  *)
  2623.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  2624.  
  2625. (*
  2626.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2627.  * along the x axis (horizontal direction) for overlays.
  2628.  *)
  2629.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  2630.  
  2631. (*
  2632.  * DirectDraw supports arbitrary stretching of a surface along the
  2633.  * y axis (horizontal direction) for overlays.  
  2634.  *)
  2635.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  2636.  
  2637. (*
  2638.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2639.  * along the y axis (vertical direction) for overlays.  
  2640.  *)
  2641.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  2642.  
  2643. (*
  2644.  * DirectDraw supports mirroring of overlays across the vertical axis
  2645.  *)
  2646.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  2647.  
  2648. (*
  2649.  * DirectDraw supports mirroring of overlays across the horizontal axis
  2650.  *)
  2651.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  2652.  
  2653. (*
  2654.  * Driver can do alpha blending for blits.
  2655.  *)
  2656.   DDFXCAPS_BLTALPHA             = $00000001;
  2657.  
  2658. (*
  2659.  * Driver can do geometric transformations (or warps) for blits.
  2660.  *)
  2661.   DDFXCAPS_BLTTRANSFORM         = $00000002;
  2662.  
  2663. (*
  2664.  * Driver can do surface-reconstruction filtering for warped blits.
  2665.  *)
  2666.   DDFXCAPS_BLTFILTER           = DDFXCAPS_BLTARITHSTRETCHY;
  2667.  
  2668. (*
  2669.  * Driver can do alpha blending for overlays.
  2670.  *)
  2671.   DDFXCAPS_OVERLAYALPHA                 = $00000004;
  2672.  
  2673. (*
  2674.  * Driver can do geometric transformations (or warps) for overlays.
  2675.  *)
  2676.   DDFXCAPS_OVERLAYTRANSFORM     = $20000000;
  2677.  
  2678. (*
  2679.  * Driver can do surface-reconstruction filtering for warped overlays.
  2680.  *)
  2681.   DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;
  2682.  
  2683. (****************************************************************************
  2684.  *
  2685.  * DIRECTDRAW STEREO VIEW CAPABILITIES
  2686.  *
  2687.  ****************************************************************************)
  2688.  
  2689. (*
  2690.  * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete
  2691.  * The stereo view is accomplished via enigma encoding.
  2692.  *)
  2693.   DDSVCAPS_RESERVED1                 = $00000001;
  2694.   DDSVCAPS_ENIGMA                 = DDSVCAPS_RESERVED1;
  2695.  
  2696. (*
  2697.  * This flag used to be DDSVCAPS_FLICKER, which is now obsolete
  2698.  * The stereo view is accomplished via high frequency flickering.
  2699.  *)
  2700.   DDSVCAPS_RESERVED2                = $00000002;
  2701.   DDSVCAPS_FLICKER                = DDSVCAPS_RESERVED2;
  2702.  
  2703. (*
  2704.  * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete
  2705.  * The stereo view is accomplished via red and blue filters applied
  2706.  * to the left and right eyes.  All images must adapt their colorspaces
  2707.  * for this process.
  2708.  *)
  2709.   DDSVCAPS_RESERVED3                = $00000004;
  2710.   DDSVCAPS_REDBLUE                = DDSVCAPS_RESERVED3;
  2711.  
  2712. (*
  2713.  * This flag used to be DDSVCAPS_SPLIT, which is now obsolete
  2714.  * The stereo view is accomplished with split screen technology.
  2715.  *)
  2716.   DDSVCAPS_RESERVED4                  = $00000008;
  2717.   DDSVCAPS_SPLIT                  = DDSVCAPS_RESERVED4;
  2718.  
  2719. (*
  2720.  * The stereo view is accomplished with switching technology
  2721.  *)
  2722.   DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
  2723.  
  2724. (****************************************************************************
  2725.  *
  2726.  * DIRECTDRAWPALETTE CAPABILITIES
  2727.  *
  2728.  ****************************************************************************)
  2729.  
  2730. (*
  2731.  * Index is 4 bits.  There are sixteen color entries in the palette table.
  2732.  *)
  2733.   DDPCAPS_4BIT                    = $00000001;
  2734.  
  2735. (*
  2736.  * Index is onto a 8 bit color index.  This field is only valid with the
  2737.  * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
  2738.  * surface is in 8bpp. Each color entry is one byte long and is an index
  2739.  * into destination surface's 8bpp palette.
  2740.  *)
  2741.   DDPCAPS_8BITENTRIES             = $00000002;
  2742.  
  2743. (*
  2744.  * Index is 8 bits.  There are 256 color entries in the palette table.
  2745.  *)
  2746.   DDPCAPS_8BIT                    = $00000004;
  2747.  
  2748. (*
  2749.  * Indicates that this DIRECTDRAWPALETTE should use the palette color array
  2750.  * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
  2751.  * object.
  2752.  * This flag is obsolete. DirectDraw always initializes the color array from
  2753.  * the lpDDColorArray parameter. The definition remains for source-level
  2754.  * compatibility.
  2755.  *)
  2756.   DDPCAPS_INITIALIZE              = $00000008;
  2757.  
  2758. (*
  2759.  * This palette is the one attached to the primary surface.  Changing this
  2760.  * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
  2761.  * and supported.
  2762.  *)
  2763.   DDPCAPS_PRIMARYSURFACE          = $00000010;
  2764.  
  2765. (*
  2766.  * This palette is the one attached to the primary surface left.  Changing
  2767.  * this table has immediate effect on the display for the left eye unless
  2768.  * DDPSETPAL_VSYNC is specified and supported.
  2769.  *)
  2770.   DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
  2771.  
  2772. (*
  2773.  * This palette can have all 256 entries defined
  2774.  *)
  2775.   DDPCAPS_ALLOW256                = $00000040;
  2776.  
  2777. (*
  2778.  * This palette can have modifications to it synced with the monitors
  2779.  * refresh rate.
  2780.  *)
  2781.   DDPCAPS_VSYNC                   = $00000080;
  2782.  
  2783. (*
  2784.  * Index is 1 bit.  There are two color entries in the palette table.
  2785.  *)
  2786.   DDPCAPS_1BIT                    = $00000100;
  2787.  
  2788. (*
  2789.  * Index is 2 bit.  There are four color entries in the palette table.
  2790.  *)
  2791.   DDPCAPS_2BIT                    = $00000200;
  2792.  
  2793. (*
  2794.  * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value
  2795.  *)
  2796.   DDPCAPS_ALPHA                 = $00000400;
  2797.  
  2798. (****************************************************************************
  2799.  *
  2800.  * DIRECTDRAWPALETTE SETENTRY CONSTANTS
  2801.  *
  2802.  ****************************************************************************)
  2803.  
  2804.  
  2805. (****************************************************************************
  2806.  *
  2807.  * DIRECTDRAWPALETTE GETENTRY CONSTANTS
  2808.  *
  2809.  ****************************************************************************)
  2810.  
  2811. (* 0 is the only legal value *)
  2812.  
  2813. (****************************************************************************
  2814.  *
  2815.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2816.  *
  2817.  ****************************************************************************)
  2818.  
  2819. (*
  2820.  * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData
  2821.  * must be set to sizeof(IUnknown^). DirectDraw will call AddRef through this
  2822.  * pointer and Release when the private data is destroyed. This includes when
  2823.  * the surface or palette is destroyed before such priovate data is destroyed.
  2824.  *)
  2825.   DDSPD_IUNKNOWNPOINTER           = $00000001;
  2826.  
  2827. (*
  2828.  * Private data is only valid for the current state of the object,
  2829.  * as determined by the uniqueness value.
  2830.  *)
  2831.   DDSPD_VOLATILE                  = $00000002;
  2832.  
  2833. (****************************************************************************
  2834.  *
  2835.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2836.  *
  2837.  ****************************************************************************)
  2838.  
  2839.  
  2840. (****************************************************************************
  2841.  *
  2842.  * DIRECTDRAW BITDEPTH CONSTANTS
  2843.  *
  2844.  * NOTE:  These are only used to indicate supported bit depths.   These
  2845.  * are flags only, they are not to be used as an actual bit depth.   The
  2846.  * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
  2847.  * bit depths in a surface or for changing the display mode.
  2848.  *
  2849.  ****************************************************************************)
  2850.  
  2851. (*
  2852.  * 1 bit per pixel.
  2853.  *)
  2854.   DDBD_1                  = $00004000;
  2855.  
  2856. (*
  2857.  * 2 bits per pixel.
  2858.  *)
  2859.   DDBD_2                  = $00002000;
  2860.  
  2861. (*
  2862.  * 4 bits per pixel.
  2863.  *)
  2864.   DDBD_4                  = $00001000;
  2865.  
  2866. (*
  2867.  * 8 bits per pixel.
  2868.  *)
  2869.   DDBD_8                  = $00000800;
  2870.  
  2871. (*
  2872.  * 16 bits per pixel.
  2873.  *)
  2874.   DDBD_16                 = $00000400;
  2875.  
  2876. (*
  2877.  * 24 bits per pixel.
  2878.  *)
  2879.   DDBD_24                 = $00000200;
  2880.  
  2881. (*
  2882.  * 32 bits per pixel.
  2883.  *)
  2884.   DDBD_32                 = $00000100;
  2885.  
  2886. (****************************************************************************
  2887.  *
  2888.  * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
  2889.  *
  2890.  ****************************************************************************)
  2891.  
  2892. (*
  2893.  * Set if the structure contains a color space.  Not set if the structure
  2894.  * contains a single color key.
  2895.  *)
  2896.   DDCKEY_COLORSPACE       = $00000001;
  2897.  
  2898. (*
  2899.  * Set if the structure specifies a color key or color space which is to be
  2900.  * used as a destination color key for blt operations.
  2901.  *)
  2902.   DDCKEY_DESTBLT          = $00000002;
  2903.  
  2904. (*
  2905.  * Set if the structure specifies a color key or color space which is to be
  2906.  * used as a destination color key for overlay operations.
  2907.  *)
  2908.   DDCKEY_DESTOVERLAY      = $00000004;
  2909.  
  2910. (*
  2911.  * Set if the structure specifies a color key or color space which is to be
  2912.  * used as a source color key for blt operations.
  2913.  *)
  2914.   DDCKEY_SRCBLT           = $00000008;
  2915.  
  2916. (*
  2917.  * Set if the structure specifies a color key or color space which is to be
  2918.  * used as a source color key for overlay operations.
  2919.  *)
  2920.   DDCKEY_SRCOVERLAY       = $00000010;
  2921.  
  2922.  
  2923. (****************************************************************************
  2924.  *
  2925.  * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
  2926.  *
  2927.  ****************************************************************************)
  2928.  
  2929. (*
  2930.  * Supports transparent blting using a color key to identify the replaceable
  2931.  * bits of the destination surface for RGB colors.
  2932.  *)
  2933.   DDCKEYCAPS_DESTBLT                      = $00000001;
  2934.  
  2935. (*
  2936.  * Supports transparent blting using a color space to identify the replaceable
  2937.  * bits of the destination surface for RGB colors.
  2938.  *)
  2939.   DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
  2940.  
  2941. (*
  2942.  * Supports transparent blting using a color space to identify the replaceable
  2943.  * bits of the destination surface for YUV colors.
  2944.  *)
  2945.   DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
  2946.  
  2947. (*
  2948.  * Supports transparent blting using a color key to identify the replaceable
  2949.  * bits of the destination surface for YUV colors.
  2950.  *)
  2951.   DDCKEYCAPS_DESTBLTYUV                   = $00000008;
  2952.  
  2953. (*
  2954.  * Supports overlaying using colorkeying of the replaceable bits of the surface
  2955.  * being overlayed for RGB colors.
  2956.  *)
  2957.   DDCKEYCAPS_DESTOVERLAY                  = $00000010;
  2958.  
  2959. (*
  2960.  * Supports a color space as the color key for the destination for RGB colors.
  2961.  *)
  2962.   DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
  2963.  
  2964. (*
  2965.  * Supports a color space as the color key for the destination for YUV colors.
  2966.  *)
  2967.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
  2968.  
  2969. (*
  2970.  * Supports only one active destination color key value for visible overlay
  2971.  * surfaces.
  2972.  *)
  2973.   DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
  2974.  
  2975. (*
  2976.  * Supports overlaying using colorkeying of the replaceable bits of the
  2977.  * surface being overlayed for YUV colors.
  2978.  *)
  2979.   DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
  2980.  
  2981. (*
  2982.  * Supports transparent blting using the color key for the source with
  2983.  * this surface for RGB colors.
  2984.  *)
  2985.   DDCKEYCAPS_SRCBLT                       = $00000200;
  2986.  
  2987. (*
  2988.  * Supports transparent blting using a color space for the source with
  2989.  * this surface for RGB colors.
  2990.  *)
  2991.   DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
  2992.  
  2993. (*
  2994.  * Supports transparent blting using a color space for the source with
  2995.  * this surface for YUV colors.
  2996.  *)
  2997.   DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
  2998.  
  2999. (*
  3000.  * Supports transparent blting using the color key for the source with
  3001.  * this surface for YUV colors.
  3002.  *)
  3003.   DDCKEYCAPS_SRCBLTYUV                    = $00001000;
  3004.  
  3005. (*
  3006.  * Supports overlays using the color key for the source with this
  3007.  * overlay surface for RGB colors.
  3008.  *)
  3009.   DDCKEYCAPS_SRCOVERLAY                   = $00002000;
  3010.  
  3011. (*
  3012.  * Supports overlays using a color space as the source color key for
  3013.  * the overlay surface for RGB colors.
  3014.  *)
  3015.   DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
  3016.  
  3017. (*
  3018.  * Supports overlays using a color space as the source color key for
  3019.  * the overlay surface for YUV colors.
  3020.  *)
  3021.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
  3022.  
  3023. (*
  3024.  * Supports only one active source color key value for visible
  3025.  * overlay surfaces.
  3026.  *)
  3027.   DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
  3028.  
  3029. (*
  3030.  * Supports overlays using the color key for the source with this
  3031.  * overlay surface for YUV colors.
  3032.  *)
  3033.   DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
  3034.  
  3035. (*
  3036.  * there are no bandwidth trade-offs for using colorkey with an overlay
  3037.  *)
  3038.   DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
  3039.  
  3040.  
  3041. (****************************************************************************
  3042.  *
  3043.  * DIRECTDRAW PIXELFORMAT FLAGS
  3044.  *
  3045.  ****************************************************************************)
  3046.  
  3047. (*
  3048.  * The surface has alpha channel information in the pixel format.
  3049.  *)
  3050.   DDPF_ALPHAPIXELS                        = $00000001;
  3051.  
  3052. (*
  3053.  * The pixel format contains alpha only information
  3054.  *)
  3055.   DDPF_ALPHA                              = $00000002;
  3056.  
  3057. (*
  3058.  * The FourCC code is valid.
  3059.  *)
  3060.   DDPF_FOURCC                             = $00000004;
  3061.  
  3062. (*
  3063.  * The surface is 4-bit color indexed.
  3064.  *)
  3065.   DDPF_PALETTEINDEXED4                    = $00000008;
  3066.  
  3067. (*
  3068.  * The surface is indexed into a palette which stores indices
  3069.  * into the destination surface's 8-bit palette.
  3070.  *)
  3071.   DDPF_PALETTEINDEXEDTO8                  = $00000010;
  3072.  
  3073. (*
  3074.  * The surface is 8-bit color indexed.
  3075.  *)
  3076.   DDPF_PALETTEINDEXED8                    = $00000020;
  3077.  
  3078. (*
  3079.  * The RGB data in the pixel format structure is valid.
  3080.  *)
  3081.   DDPF_RGB                                = $00000040;
  3082.  
  3083. (*
  3084.  * The surface will accept pixel data in the format specified
  3085.  * and compress it during the write.
  3086.  *)
  3087.   DDPF_COMPRESSED                         = $00000080;
  3088.  
  3089. (*
  3090.  * The surface will accept RGB data and translate it during
  3091.  * the write to YUV data.  The format of the data to be written
  3092.  * will be contained in the pixel format structure.  The DDPF_RGB
  3093.  * flag will be set.
  3094.  *)
  3095.   DDPF_RGBTOYUV                           = $00000100;
  3096.  
  3097. (*
  3098.  * pixel format is YUV - YUV data in pixel format struct is valid
  3099.  *)
  3100.   DDPF_YUV                                = $00000200;
  3101.  
  3102. (*
  3103.  * pixel format is a z buffer only surface
  3104.  *)
  3105.   DDPF_ZBUFFER                            = $00000400;
  3106.  
  3107. (*
  3108.  * The surface is 1-bit color indexed.
  3109.  *)
  3110.   DDPF_PALETTEINDEXED1                    = $00000800;
  3111.  
  3112. (*
  3113.  * The surface is 2-bit color indexed.
  3114.  *)
  3115.   DDPF_PALETTEINDEXED2                    = $00001000;
  3116.  
  3117. (*
  3118.  * The surface contains Z information in the pixels
  3119.  *)
  3120.   DDPF_ZPIXELS                          = $00002000;
  3121.  
  3122. (*
  3123.  * The surface contains stencil information along with Z
  3124.  *)
  3125.   DDPF_STENCILBUFFER                    = $00004000;
  3126.  
  3127. (*
  3128.  * Premultiplied alpha format -- the color components have been
  3129.  * premultiplied by the alpha component.
  3130.  *)
  3131.   DDPF_ALPHAPREMULT                     = $00008000;
  3132.  
  3133.  
  3134. (*
  3135.  * Luminance data in the pixel format is valid.
  3136.  * Use this flag for luminance-only or luminance+alpha surfaces,
  3137.  * the bit depth is then ddpf.dwLuminanceBitCount.
  3138.  *)
  3139.   DDPF_LUMINANCE                          = $00020000;
  3140.  
  3141. (*
  3142.  * Luminance data in the pixel format is valid.
  3143.  * Use this flag when hanging luminance off bumpmap surfaces,
  3144.  * the bit mask for the luminance portion of the pixel is then
  3145.  * ddpf.dwBumpLuminanceBitMask
  3146.  *)
  3147.   DDPF_BUMPLUMINANCE                      = $00040000;
  3148.  
  3149. (*
  3150.  * Bump map dUdV data in the pixel format is valid.
  3151.  *)
  3152.   DDPF_BUMPDUDV                           = $00080000;
  3153.  
  3154. (*===========================================================================
  3155.  *
  3156.  *
  3157.  * DIRECTDRAW CALLBACK FLAGS
  3158.  *
  3159.  *
  3160.  *==========================================================================*)
  3161.  
  3162. (****************************************************************************
  3163.  *
  3164.  * DIRECTDRAW ENUMSURFACES FLAGS
  3165.  *
  3166.  ****************************************************************************)
  3167.  
  3168. (*
  3169.  * Enumerate all of the surfaces that meet the search criterion.
  3170.  *)
  3171.   DDENUMSURFACES_ALL                      = $00000001;
  3172.  
  3173. (*
  3174.  * A search hit is a surface that matches the surface description.
  3175.  *)
  3176.   DDENUMSURFACES_MATCH                    = $00000002;
  3177.  
  3178. (*
  3179.  * A search hit is a surface that does not match the surface description.
  3180.  *)
  3181.   DDENUMSURFACES_NOMATCH                  = $00000004;
  3182.  
  3183. (*
  3184.  * Enumerate the first surface that can be created which meets the search criterion.
  3185.  *)
  3186.   DDENUMSURFACES_CANBECREATED             = $00000008;
  3187.  
  3188. (*
  3189.  * Enumerate the surfaces that already exist that meet the search criterion.
  3190.  *)
  3191.   DDENUMSURFACES_DOESEXIST                = $00000010;
  3192.  
  3193. (****************************************************************************
  3194.  *
  3195.  * DIRECTDRAW SETDISPLAYMODE FLAGS
  3196.  *
  3197.  ****************************************************************************)
  3198.  
  3199. (*
  3200.  * The desired mode is a standard VGA mode
  3201.  *)
  3202.   DDSDM_STANDARDVGAMODE                   = $00000001;
  3203.  
  3204. (****************************************************************************
  3205.  *
  3206.  * DIRECTDRAW ENUMDISPLAYMODES FLAGS
  3207.  *
  3208.  ****************************************************************************)
  3209.  
  3210. (*
  3211.  * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
  3212.  * that a particular mode will be enumerated only once.  This flag specifies whether
  3213.  * the refresh rate is taken into account when determining if a mode is unique.
  3214.  *)
  3215.   DDEDM_REFRESHRATES                      = $00000001;
  3216.  
  3217. (*
  3218.  * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA
  3219.  * modes such as mode 0x13 in addition to the usual ModeX modes (which are always
  3220.  * enumerated if the application has previously called SetCooperativeLevel with the
  3221.  * DDSCL_ALLOWMODEX flag set).
  3222.  *)
  3223.   DDEDM_STANDARDVGAMODES                  = $00000002;
  3224.  
  3225.  
  3226. (****************************************************************************
  3227.  *
  3228.  * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
  3229.  *
  3230.  ****************************************************************************)
  3231.  
  3232. (*
  3233.  * Exclusive mode owner will be responsible for the entire primary surface.
  3234.  * GDI can be ignored. used with DD
  3235.  *)
  3236.   DDSCL_FULLSCREEN                        = $00000001;
  3237.  
  3238. (*
  3239.  * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode
  3240.  *)
  3241.   DDSCL_ALLOWREBOOT                       = $00000002;
  3242.  
  3243. (*
  3244.  * prevents DDRAW from modifying the application window.
  3245.  * prevents DDRAW from minimize/restore the application window on activation.
  3246.  *)
  3247.   DDSCL_NOWINDOWCHANGES                   = $00000004;
  3248.  
  3249. (*
  3250.  * app wants to work as a regular Windows application
  3251.  *)
  3252.   DDSCL_NORMAL                            = $00000008;
  3253.  
  3254. (*
  3255.  * app wants exclusive access
  3256.  *)
  3257.   DDSCL_EXCLUSIVE                         = $00000010;
  3258.  
  3259.  
  3260. (*
  3261.  * app can deal with non-windows display modes
  3262.  *)
  3263.   DDSCL_ALLOWMODEX                        = $00000040;
  3264.  
  3265. (*
  3266.  * this window will receive the focus messages
  3267.  *)
  3268.   DDSCL_SETFOCUSWINDOW                    = $00000080;
  3269.  
  3270. (*
  3271.  * this window is associated with the DDRAW object and will
  3272.  * cover the screen in fullscreen mode
  3273.  *)
  3274.   DDSCL_SETDEVICEWINDOW                   = $00000100;
  3275.  
  3276. (*
  3277.  * app wants DDRAW to create a window to be associated with the
  3278.  * DDRAW object
  3279.  *)
  3280.   DDSCL_CREATEDEVICEWINDOW                = $00000200;
  3281.  
  3282. (*
  3283.  * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D
  3284.  * take the global crtisec more frequently.
  3285.  *)
  3286.   DDSCL_MULTITHREADED                     = $00000400;
  3287.  
  3288. (*
  3289.  * App hints that it would like to keep the FPU set up for optimal Direct3D
  3290.  * performance (single precision and exceptions disabled) so Direct3D
  3291.  * does not need to explicitly set the FPU each time
  3292.  *)
  3293.   DDSCL_FPUSETUP                          = $00000800;
  3294.  
  3295. (*
  3296.  * App specifies that it needs either double precision FPU or FPU exceptions
  3297.  * enabled. This makes Direct3D explicitly set the FPU state eah time it is
  3298.  * called. Setting the flag will reduce Direct3D performance. The flag is
  3299.  * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP
  3300.  *)
  3301.   DDSCL_FPUPRESERVE                          = $00001000;
  3302.  
  3303. (****************************************************************************
  3304.  *
  3305.  * DIRECTDRAW BLT FLAGS
  3306.  *
  3307.  ****************************************************************************)
  3308.  
  3309. (*
  3310.  * Use the alpha information in the pixel format or the alpha channel surface
  3311.  * attached to the destination surface as the alpha channel for this blt.
  3312.  *)
  3313.   DDBLT_ALPHADEST                         = $00000001;
  3314.  
  3315. (*
  3316.  * Use the dwConstAlphaDest field in the TDDBltFX structure as the alpha channel
  3317.  * for the destination surface for this blt.
  3318.  *)
  3319.   DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
  3320.  
  3321. (*
  3322.  * The NEG suffix indicates that the destination surface becomes more
  3323.  * transparent as the alpha value increases. (0 is opaque)
  3324.  *)
  3325.   DDBLT_ALPHADESTNEG                      = $00000004;
  3326.  
  3327. (*
  3328.  * Use the lpDDSAlphaDest field in the TDDBltFX structure as the alpha
  3329.  * channel for the destination for this blt.
  3330.  *)
  3331.   DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
  3332.  
  3333. (*
  3334.  * Use the dwAlphaEdgeBlend field in the TDDBltFX structure as the alpha channel
  3335.  * for the edges of the image that border the color key colors.
  3336.  *)
  3337.   DDBLT_ALPHAEDGEBLEND                    = $00000010;
  3338.  
  3339. (*
  3340.  * Use the alpha information in the pixel format or the alpha channel surface
  3341.  * attached to the source surface as the alpha channel for this blt.
  3342.  *)
  3343.   DDBLT_ALPHASRC                          = $00000020;
  3344.  
  3345. (*
  3346.  * Use the dwConstAlphaSrc field in the TDDBltFX structure as the alpha channel
  3347.  * for the source for this blt.
  3348.  *)
  3349.   DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
  3350.  
  3351. (*
  3352.  * The NEG suffix indicates that the source surface becomes more transparent
  3353.  * as the alpha value increases. (0 is opaque)
  3354.  *)
  3355.   DDBLT_ALPHASRCNEG                       = $00000080;
  3356.  
  3357. (*
  3358.  * Use the lpDDSAlphaSrc field in the TDDBltFX structure as the alpha channel
  3359.  * for the source for this blt.
  3360.  *)
  3361.   DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
  3362.  
  3363. (*
  3364.  * Do this blt asynchronously through the FIFO in the order received.  If
  3365.  * there is no room in the hardware FIFO fail the call.
  3366.  *)
  3367.   DDBLT_ASYNC                             = $00000200;
  3368.  
  3369. (*
  3370.  * Uses the dwFillColor field in the TDDBltFX structure as the RGB color
  3371.  * to fill the destination rectangle on the destination surface with.
  3372.  *)
  3373.   DDBLT_COLORFILL                         = $00000400;
  3374.  
  3375. (*
  3376.  * Uses the dwDDFX field in the TDDBltFX structure to specify the effects
  3377.  * to use for the blt.
  3378.  *)
  3379.   DDBLT_DDFX                              = $00000800;
  3380.  
  3381. (*
  3382.  * Uses the dwDDROPS field in the TDDBltFX structure to specify the ROPS
  3383.  * that are not part of the Win32 API.
  3384.  *)
  3385.   DDBLT_DDROPS                            = $00001000;
  3386.  
  3387. (*
  3388.  * Use the color key associated with the destination surface.
  3389.  *)
  3390.   DDBLT_KEYDEST                           = $00002000;
  3391.  
  3392. (*
  3393.  * Use the dckDestColorkey field in the TDDBltFX structure as the color key
  3394.  * for the destination surface.
  3395.  *)
  3396.   DDBLT_KEYDESTOVERRIDE                   = $00004000;
  3397.  
  3398. (*
  3399.  * Use the color key associated with the source surface.
  3400.  *)
  3401.   DDBLT_KEYSRC                            = $00008000;
  3402.  
  3403. (*
  3404.  * Use the dckSrcColorkey field in the TDDBltFX structure as the color key
  3405.  * for the source surface.
  3406.  *)
  3407.   DDBLT_KEYSRCOVERRIDE                    = $00010000;
  3408.  
  3409. (*
  3410.  * Use the dwROP field in the TDDBltFX structure for the raster operation
  3411.  * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
  3412.  *)
  3413.   DDBLT_ROP                               = $00020000;
  3414.  
  3415. (*
  3416.  * Use the dwRotationAngle field in the TDDBltFX structure as the angle
  3417.  * (specified in 1/100th of a degree) to rotate the surface.
  3418.  *)
  3419.   DDBLT_ROTATIONANGLE                     = $00040000;
  3420.  
  3421. (*
  3422.  * Z-buffered blt using the z-buffers attached to the source and destination
  3423.  * surfaces and the dwZBufferOpCode field in the TDDBltFX structure as the
  3424.  * z-buffer opcode.
  3425.  *)
  3426.   DDBLT_ZBUFFER                           = $00080000;
  3427.  
  3428. (*
  3429.  * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
  3430.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3431.  * for the destination.
  3432.  *)
  3433.   DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
  3434.  
  3435. (*
  3436.  * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
  3437.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3438.  * respectively for the destination.
  3439.  *)
  3440.   DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
  3441.  
  3442. (*
  3443.  * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
  3444.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3445.  * for the source.
  3446.  *)
  3447.   DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
  3448.  
  3449. (*
  3450.  * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
  3451.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3452.  * respectively for the source.
  3453.  *)
  3454.    DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
  3455.  
  3456. (*
  3457.  * wait until the device is ready to handle the blt
  3458.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3459.  *)
  3460.   DDBLT_WAIT                              = $01000000;
  3461.  
  3462. (*
  3463.  * Uses the dwFillDepth field in the TDDBltFX structure as the depth value
  3464.  * to fill the destination rectangle on the destination Z-buffer surface
  3465.  * with.
  3466.  *)
  3467.   DDBLT_DEPTHFILL                         = $02000000;
  3468.  
  3469. (*
  3470.  * wait until the device is ready to handle the blt
  3471.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3472.  *)
  3473.   DDBLT_DONOTWAIT                         = $08000000;
  3474.  
  3475. (****************************************************************************
  3476.  *
  3477.  * BLTFAST FLAGS
  3478.  *
  3479.  ****************************************************************************)
  3480.  
  3481.   DDBLTFAST_NOCOLORKEY                    = $00000000;
  3482.   DDBLTFAST_SRCCOLORKEY                   = $00000001;
  3483.   DDBLTFAST_DESTCOLORKEY                  = $00000002;
  3484.   DDBLTFAST_WAIT                          = $00000010;
  3485.   DDBLTFAST_DONOTWAIT                     = $00000020;
  3486.  
  3487. (****************************************************************************
  3488.  *
  3489.  * FLIP FLAGS
  3490.  *
  3491.  ****************************************************************************)
  3492.  
  3493.  
  3494.   DDFLIP_WAIT                          = $00000001;
  3495.  
  3496. (*
  3497.  * Indicates that the target surface contains the even field of video data.
  3498.  * This flag is only valid with an overlay surface.
  3499.  *)
  3500.   DDFLIP_EVEN                          = $00000002;
  3501.  
  3502. (*
  3503.  * Indicates that the target surface contains the odd field of video data.
  3504.  * This flag is only valid with an overlay surface.
  3505.  *)
  3506.   DDFLIP_ODD                           = $00000004;
  3507.  
  3508. (*
  3509.  * Causes DirectDraw to perform the physical flip immediately and return
  3510.  * to the application. Typically, what was the front buffer but is now the back
  3511.  * buffer will still be visible (depending on timing) until the next vertical
  3512.  * retrace. Subsequent operations involving the two flipped surfaces will
  3513.  * not check to see if the physical flip has finished (i.e. will not return
  3514.  * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)).
  3515.  * This allows an application to perform Flips at a higher frequency than the
  3516.  * monitor refresh rate, but may introduce visible artifacts.
  3517.  * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set,
  3518.  * DDFLIP_NOVSYNC has no effect.
  3519.  *)
  3520.   DDFLIP_NOVSYNC                       = $00000008;
  3521.  
  3522.  
  3523. (*
  3524.  * Flip Interval Flags. These flags indicate how many vertical retraces to wait between
  3525.  * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each
  3526.  * surface involved in the flip until the specified number of vertical retraces has
  3527.  * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set,
  3528.  * DDFLIP_INTERVALn has no effect.
  3529.  *)
  3530.  
  3531. (*
  3532.  * DirectDraw will flip on every other vertical sync
  3533.  *)
  3534.   DDFLIP_INTERVAL2                     = $02000000;
  3535.  
  3536.  
  3537. (*
  3538.  * DirectDraw will flip on every third vertical sync
  3539.  *)
  3540.   DDFLIP_INTERVAL3                     = $03000000;
  3541.  
  3542.  
  3543. (*
  3544.  * DirectDraw will flip on every fourth vertical sync
  3545.  *)
  3546.   DDFLIP_INTERVAL4                     = $04000000;
  3547.  
  3548. (*
  3549.  * DirectDraw will flip and display a main stereo surface
  3550.  *)
  3551.   DDFLIP_STEREO                        = $00000010;
  3552.  
  3553. (*
  3554.  * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish
  3555.  * to override the default and use time when the accelerator is busy (as denoted by
  3556.  * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT.
  3557.  *)
  3558.   DDFLIP_DONOTWAIT                     = $00000020;
  3559.  
  3560. (****************************************************************************
  3561.  *
  3562.  * DIRECTDRAW SURFACE OVERLAY FLAGS
  3563.  *
  3564.  ****************************************************************************)
  3565.  
  3566. (*
  3567.  * Use the alpha information in the pixel format or the alpha channel surface
  3568.  * attached to the destination surface as the alpha channel for the
  3569.  * destination overlay.
  3570.  *)
  3571.   DDOVER_ALPHADEST                        = $00000001;
  3572.  
  3573. (*
  3574.  * Use the dwConstAlphaDest field in the TDDOverlayFX structure as the
  3575.  * destination alpha channel for this overlay.
  3576.  *)
  3577.   DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
  3578.  
  3579. (*
  3580.  * The NEG suffix indicates that the destination surface becomes more
  3581.  * transparent as the alpha value increases.
  3582.  *)
  3583.   DDOVER_ALPHADESTNEG                     = $00000004;
  3584.  
  3585. (*
  3586.  * Use the lpDDSAlphaDest field in the TDDOverlayFX structure as the alpha
  3587.  * channel destination for this overlay.
  3588.  *)
  3589.   DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
  3590.  
  3591. (*
  3592.  * Use the dwAlphaEdgeBlend field in the TDDOverlayFX structure as the alpha
  3593.  * channel for the edges of the image that border the color key colors.
  3594.  *)
  3595.   DDOVER_ALPHAEDGEBLEND                   = $00000010;
  3596.  
  3597. (*
  3598.  * Use the alpha information in the pixel format or the alpha channel surface
  3599.  * attached to the source surface as the source alpha channel for this overlay.
  3600.  *)
  3601.   DDOVER_ALPHASRC                         = $00000020;
  3602.  
  3603. (*
  3604.  * Use the dwConstAlphaSrc field in the TDDOverlayFX structure as the source
  3605.  * alpha channel for this overlay.
  3606.  *)
  3607.   DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
  3608.  
  3609. (*
  3610.  * The NEG suffix indicates that the source surface becomes more transparent
  3611.  * as the alpha value increases.
  3612.  *)
  3613.   DDOVER_ALPHASRCNEG                      = $00000080;
  3614.  
  3615. (*
  3616.  * Use the lpDDSAlphaSrc field in the TDDOverlayFX structure as the alpha channel
  3617.  * source for this overlay.
  3618.  *)
  3619.   DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
  3620.  
  3621. (*
  3622.  * Turn this overlay off.
  3623.  *)
  3624.   DDOVER_HIDE                             = $00000200;
  3625.  
  3626. (*
  3627.  * Use the color key associated with the destination surface.
  3628.  *)
  3629.   DDOVER_KEYDEST                          = $00000400;
  3630.  
  3631. (*
  3632.  * Use the dckDestColorkey field in the TDDOverlayFX structure as the color key
  3633.  * for the destination surface
  3634.  *)
  3635.   DDOVER_KEYDESTOVERRIDE                  = $00000800;
  3636.  
  3637. (*
  3638.  * Use the color key associated with the source surface.
  3639.  *)
  3640.   DDOVER_KEYSRC                           = $00001000;
  3641.  
  3642. (*
  3643.  * Use the dckSrcColorkey field in the TDDOverlayFX structure as the color key
  3644.  * for the source surface.
  3645.  *)
  3646.   DDOVER_KEYSRCOVERRIDE                   = $00002000;
  3647.  
  3648. (*
  3649.  * Turn this overlay on.
  3650.  *)
  3651.   DDOVER_SHOW                             = $00004000;
  3652.  
  3653. (*
  3654.  * Add a dirty rect to an emulated overlayed surface.
  3655.  *)
  3656.   DDOVER_ADDDIRTYRECT                     = $00008000;
  3657.  
  3658. (*
  3659.  * Redraw all dirty rects on an emulated overlayed surface.
  3660.  *)
  3661.   DDOVER_REFRESHDIRTYRECTS                = $00010000;
  3662.  
  3663. (*
  3664.  * Redraw the entire surface on an emulated overlayed surface.
  3665.  *)
  3666.   DDOVER_REFRESHALL                      = $00020000;
  3667.  
  3668. (*
  3669.  * Use the overlay FX flags to define special overlay FX
  3670.  *)
  3671.   DDOVER_DDFX                             = $00080000;
  3672.  
  3673. (*
  3674.  * Autoflip the overlay when ever the video port autoflips
  3675.  *)
  3676.   DDOVER_AUTOFLIP                         = $00100000;
  3677.  
  3678. (*
  3679.  * Display each field of video port data individually without
  3680.  * causing any jittery artifacts
  3681.  *)
  3682.   DDOVER_BOB                              = $00200000;
  3683.  
  3684. (*
  3685.  * Indicates that bob/weave decisions should not be overridden by other
  3686.  * interfaces.
  3687.  *)
  3688.   DDOVER_OVERRIDEBOBWEAVE                 = $00400000;
  3689.  
  3690. (*
  3691.  * Indicates that the surface memory is composed of interleaved fields.
  3692.  *)
  3693.   DDOVER_INTERLEAVED                      = $00800000;
  3694.  
  3695. (*
  3696.  * Indicates that bob will be performed using hardware rather than
  3697.  * software or emulated.
  3698.  *)
  3699.   DDOVER_BOBHARDWARE                    = $01000000;
  3700.  
  3701. (*
  3702.  * Indicates that overlay FX structure contains valid ARGB scaling factors.
  3703.  *)
  3704.   DDOVER_ARGBSCALEFACTORS                 = $02000000;
  3705.  
  3706. (*
  3707.  * Indicates that ARGB scaling factors can be degraded to fit driver capabilities.
  3708.  *)
  3709.   DDOVER_DEGRADEARGBSCALING               = $04000000;
  3710.  
  3711. (****************************************************************************
  3712.  *
  3713.  * DIRECTDRAWSURFACE LOCK FLAGS
  3714.  *
  3715.  ****************************************************************************)
  3716.  
  3717. (*
  3718.  * The default.  Set to indicate that Lock should return a valid memory pointer
  3719.  * to the top of the specified rectangle.  If no rectangle is specified then a
  3720.  * pointer to the top of the surface is returned.
  3721.  *)
  3722.   DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
  3723.  
  3724. (*
  3725.  * Set to indicate that Lock should wait until it can obtain a valid memory
  3726.  * pointer before returning.  If this bit is set, Lock will never return
  3727.  * DDERR_WASSTILLDRAWING.
  3728.  *)
  3729.   DDLOCK_WAIT                             = $00000001;
  3730.  
  3731. (*
  3732.  * Set if an event handle is being passed to Lock.  Lock will trigger the event
  3733.  * when it can return the surface memory pointer requested.
  3734.  *)
  3735.   DDLOCK_EVENT                            = $00000002;
  3736.  
  3737. (*
  3738.  * Indicates that the surface being locked will only be read from.
  3739.  *)
  3740.   DDLOCK_READONLY                         = $00000010;
  3741.  
  3742. (*
  3743.  * Indicates that the surface being locked will only be written to
  3744.  *)
  3745.   DDLOCK_WRITEONLY                        = $00000020;
  3746.  
  3747. (*
  3748.  * Indicates that a system wide lock should not be taken when this surface
  3749.  * is locked. This has several advantages (cursor responsiveness, ability
  3750.  * to call more Windows functions, easier debugging) when locking video
  3751.  * memory surfaces. However, an application specifying this flag must
  3752.  * comply with a number of conditions documented in the help file.
  3753.  * Furthermore, this flag cannot be specified when locking the primary.
  3754.  *)
  3755.   DDLOCK_NOSYSLOCK                        = $00000800;
  3756.  
  3757. (*
  3758.  * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices
  3759.  * that were referred to in Draw*PrimtiveVB calls since the start of the
  3760.  * frame (or the last lock without this flag) will be modified during the
  3761.  * lock. This can be useful when one is only appending data to the vertex
  3762.  * buffer
  3763.  *)
  3764.   DDLOCK_NOOVERWRITE                      = $00001000;
  3765.  
  3766. (*
  3767.  * Indicates that no assumptions will be made about the contents of the
  3768.  * surface or vertex buffer during this lock.
  3769.  * This enables two things:
  3770.  * -    Direct3D or the driver may provide an alternative memory
  3771.  *      area as the vertex buffer. This is useful when one plans to clear the
  3772.  *      contents of the vertex buffer and fill in new data.
  3773.  * -    Drivers sometimes store surface data in a re-ordered format.
  3774.  *      When the application locks the surface, the driver is forced to un-re-order
  3775.  *      the surface data before allowing the application to see the surface contents.
  3776.  *      This flag is a hint to the driver that it can skip the un-re-ordering process
  3777.  *      since the application plans to overwrite every single pixel in the surface
  3778.  *      or locked rectangle (and so erase any un-re-ordered pixels anyway).
  3779.  *      Applications should always set this flag when they intend to overwrite the entire
  3780.  *      surface or locked rectangle.
  3781.  *)
  3782.   DDLOCK_DISCARDCONTENTS                  = $00002000;
  3783.  (*
  3784.   * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS
  3785.   *)
  3786.   DDLOCK_OKTOSWAP                         = $00002000;
  3787.  
  3788. (*
  3789.  * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish
  3790.  * to override the default and use time when the accelerator is busy (as denoted by
  3791.  * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT.
  3792.  *)
  3793.   DDLOCK_DONOTWAIT                        = $00004000;
  3794.  
  3795.  
  3796. (****************************************************************************
  3797.  *
  3798.  * DIRECTDRAWSURFACE PAGELOCK FLAGS
  3799.  *
  3800.  ****************************************************************************)
  3801.  
  3802. (*
  3803.  * No flags defined at present
  3804.  *)
  3805.  
  3806.  
  3807. (****************************************************************************
  3808.  *
  3809.  * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
  3810.  *
  3811.  ****************************************************************************)
  3812.  
  3813. (*
  3814.  * No flags defined at present
  3815.  *)
  3816.  
  3817.  
  3818. (****************************************************************************
  3819.  *
  3820.  * DIRECTDRAWSURFACE BLT FX FLAGS
  3821.  *
  3822.  ****************************************************************************)
  3823.  
  3824. (*
  3825.  * If stretching, use arithmetic stretching along the Y axis for this blt.
  3826.  *)
  3827.   DDBLTFX_ARITHSTRETCHY                   = $00000001;
  3828.  
  3829. (*
  3830.  * Do this blt mirroring the surface left to right.  Spin the
  3831.  * surface around its y-axis.
  3832.  *)
  3833.   DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
  3834.  
  3835. (*
  3836.  * Do this blt mirroring the surface up and down.  Spin the surface
  3837.  * around its x-axis.
  3838.  *)
  3839.   DDBLTFX_MIRRORUPDOWN                    = $00000004;
  3840.  
  3841. (*
  3842.  * Schedule this blt to avoid tearing.
  3843.  *)
  3844.   DDBLTFX_NOTEARING                       = $00000008;
  3845.  
  3846. (*
  3847.  * Do this blt rotating the surface one hundred and eighty degrees.
  3848.  *)
  3849.   DDBLTFX_ROTATE180                       = $00000010;
  3850.  
  3851. (*
  3852.  * Do this blt rotating the surface two hundred and seventy degrees.
  3853.  *)
  3854.   DDBLTFX_ROTATE270                       = $00000020;
  3855.  
  3856. (*
  3857.  * Do this blt rotating the surface ninety degrees.
  3858.  *)
  3859.   DDBLTFX_ROTATE90                        = $00000040;
  3860.  
  3861. (*
  3862.  * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
  3863.  * specified to limit the bits copied from the source surface.
  3864.  *)
  3865.   DDBLTFX_ZBUFFERRANGE                    = $00000080;
  3866.  
  3867. (*
  3868.  * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
  3869.  * before comparing it with the desting z values.
  3870.  *)
  3871.   DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
  3872.  
  3873. (****************************************************************************
  3874.  *
  3875.  * DIRECTDRAWSURFACE OVERLAY FX FLAGS
  3876.  *
  3877.  ****************************************************************************)
  3878.  
  3879. (*
  3880.  * If stretching, use arithmetic stretching along the Y axis for this overlay.
  3881.  *)
  3882.   DDOVERFX_ARITHSTRETCHY                  = $00000001;
  3883.  
  3884. (*
  3885.  * Mirror the overlay across the vertical axis
  3886.  *)
  3887.   DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
  3888.  
  3889. (*
  3890.  * Mirror the overlay across the horizontal axis
  3891.  *)
  3892.   DDOVERFX_MIRRORUPDOWN                   = $00000004;
  3893.  
  3894. (****************************************************************************
  3895.  *
  3896.  * Flags for dwDDFX member of DDSPRITEFX structure
  3897.  *
  3898.  ****************************************************************************)
  3899. (*
  3900.  * Use affine transformation matrix in fTransform member.
  3901.  *)
  3902.   DDSPRITEFX_AFFINETRANSFORM            = $00000001;
  3903.  
  3904. (*
  3905.  * Use RGBA scaling factors in ddrgbaScaleFactors member.
  3906.  *)
  3907.   DDSPRITEFX_RGBASCALING                        = $00000002;
  3908.  
  3909. (*
  3910.  * Degrade RGBA scaling factors to accommodate driver's capabilities.
  3911.  *)
  3912.   DDSPRITEFX_DEGRADERGBASCALING         = $00000004;
  3913.  
  3914. (*
  3915.  * Do bilinear filtering of stretched or warped sprite.
  3916.  *)
  3917.   DDSPRITEFX_BILINEARFILTER                     = $00000008;
  3918.  
  3919. (*
  3920.  * Do "blur" filtering of stretched or warped sprite.
  3921.  *)
  3922.   DDSPRITEFX_BLURFILTER                         = $00000010;
  3923.  
  3924. (*
  3925.  * Do "flat" filtering of stretched or warped sprite.
  3926.  *)
  3927.   DDSPRITEFX_FLATFILTER                         = $00000020;
  3928.  
  3929. (*
  3930.  * Degrade filtering operation to accommodate driver's capabilities.
  3931.  *)
  3932.   DDSPRITEFX_DEGRADEFILTER              = $00000040;
  3933.  
  3934. (****************************************************************************
  3935.  *
  3936.  * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
  3937.  *
  3938.  ****************************************************************************)
  3939.  
  3940. (*
  3941.  * return when the vertical blank interval begins
  3942.  *)
  3943.   DDWAITVB_BLOCKBEGIN                     = $00000001;
  3944.  
  3945. (*
  3946.  * set up an event to trigger when the vertical blank begins
  3947.  *)
  3948.   DDWAITVB_BLOCKBEGINEVENT                = $00000002;
  3949.  
  3950. (*
  3951.  * return when the vertical blank interval ends and display begins
  3952.  *)
  3953.   DDWAITVB_BLOCKEND                       = $00000004;
  3954.  
  3955. (****************************************************************************
  3956.  *
  3957.  * DIRECTDRAW GETFLIPSTATUS FLAGS
  3958.  *
  3959.  ****************************************************************************)
  3960.  
  3961. (*
  3962.  * is it OK to flip now?
  3963.  *)
  3964.   DDGFS_CANFLIP                   = $00000001;
  3965.  
  3966. (*
  3967.  * is the last flip finished?
  3968.  *)
  3969.   DDGFS_ISFLIPDONE                = $00000002;
  3970.  
  3971. (****************************************************************************
  3972.  *
  3973.  * DIRECTDRAW GETBLTSTATUS FLAGS
  3974.  *
  3975.  ****************************************************************************)
  3976.  
  3977. (*
  3978.  * is it OK to blt now?
  3979.  *)
  3980.   DDGBS_CANBLT                    = $00000001;
  3981.  
  3982. (*
  3983.  * is the blt to the surface finished?
  3984.  *)
  3985.   DDGBS_ISBLTDONE                 = $00000002;
  3986.  
  3987.  
  3988. (****************************************************************************
  3989.  *
  3990.  * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
  3991.  *
  3992.  ****************************************************************************)
  3993.  
  3994. (*
  3995.  * Enumerate overlays back to front.
  3996.  *)
  3997.   DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
  3998.  
  3999. (*
  4000.  * Enumerate overlays front to back
  4001.  *)
  4002.   DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
  4003.  
  4004. (****************************************************************************
  4005.  *
  4006.  * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
  4007.  *
  4008.  ****************************************************************************)
  4009.  
  4010. (*
  4011.  * Send overlay to front
  4012.  *)
  4013.   DDOVERZ_SENDTOFRONT             = $00000000;
  4014.  
  4015. (*
  4016.  * Send overlay to back
  4017.  *)
  4018.   DDOVERZ_SENDTOBACK              = $00000001;
  4019.  
  4020. (*
  4021.  * Move Overlay forward
  4022.  *)
  4023.   DDOVERZ_MOVEFORWARD             = $00000002;
  4024.  
  4025. (*
  4026.  * Move Overlay backward
  4027.  *)
  4028.   DDOVERZ_MOVEBACKWARD            = $00000003;
  4029.  
  4030. (*
  4031.  * Move Overlay in front of relative surface
  4032.  *)
  4033.   DDOVERZ_INSERTINFRONTOF         = $00000004;
  4034.  
  4035. (*
  4036.  * Move Overlay in back of relative surface
  4037.  *)
  4038.   DDOVERZ_INSERTINBACKOF          = $00000005;
  4039.  
  4040. (****************************************************************************
  4041.  *
  4042.  * DIRECTDRAW SETGAMMARAMP FLAGS
  4043.  *
  4044.  ****************************************************************************)
  4045.  
  4046. (*
  4047.  * Request calibrator to adjust the gamma ramp according to the physical
  4048.  * properties of the display so that the result should appear identical
  4049.  * on all systems.
  4050.  *)
  4051.   DDSGR_CALIBRATE                        = $00000001;
  4052.  
  4053. (****************************************************************************
  4054.  *
  4055.  * DIRECTDRAW STARTMODETEST FLAGS
  4056.  *
  4057.  ****************************************************************************)
  4058.  
  4059. (*
  4060.  * Indicates that the mode being tested has passed
  4061.  *)
  4062.  DDSMT_ISTESTREQUIRED                   = $00000001;
  4063.  
  4064.  
  4065. (****************************************************************************
  4066.  *
  4067.  * DIRECTDRAW EVALUATEMODE FLAGS
  4068.  *
  4069.  ****************************************************************************)
  4070.  
  4071. (*
  4072.  * Indicates that the mode being tested has passed
  4073.  *)
  4074.  DDEM_MODEPASSED                        = $00000001;
  4075.  
  4076. (*
  4077.  * Indicates that the mode being tested has failed
  4078.  *)
  4079.  DDEM_MODEFAILED                        = $00000002;
  4080.  
  4081. (*===========================================================================
  4082.  *
  4083.  *
  4084.  * DIRECTDRAW RETURN CODES
  4085.  *
  4086.  * The return values from DirectDraw Commands and Surface that return an HResult
  4087.  * are codes from DirectDraw concerning the results of the action
  4088.  * requested by DirectDraw.
  4089.  *
  4090.  *==========================================================================*)
  4091.  
  4092. (*
  4093.  * Status is OK
  4094.  *
  4095.  * Issued by: DirectDraw Commands and all callbacks
  4096.  *)
  4097.   DD_OK                                   = 0;
  4098.   DD_FALSE                                = S_FALSE;
  4099.  
  4100. (****************************************************************************
  4101.  *
  4102.  * DIRECTDRAW ENUMCALLBACK RETURN VALUES
  4103.  *
  4104.  * EnumCallback returns are used to control the flow of the DIRECTDRAW and
  4105.  * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
  4106.  * enumeration callback routines.
  4107.  *
  4108.  ****************************************************************************)
  4109.  
  4110. (*
  4111.  * stop the enumeration
  4112.  *)
  4113.   DDENUMRET_CANCEL                        = 0;
  4114.  
  4115. (*
  4116.  * continue the enumeration
  4117.  *)
  4118.   DDENUMRET_OK                            = 1;
  4119.  
  4120. (****************************************************************************
  4121.  *
  4122.  * DIRECTDRAW ERRORS
  4123.  *
  4124.  * Errors are represented by negative values and cannot be combined.
  4125.  *
  4126.  ****************************************************************************)
  4127.  
  4128.   _FACDD = $876;
  4129.   MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16);
  4130.  
  4131.  
  4132. (*
  4133.  * This object is already initialized
  4134.  *)
  4135.   DDERR_ALREADYINITIALIZED                = MAKE_DDHRESULT + 5;
  4136.  
  4137. (*
  4138.  * This surface can not be attached to the requested surface.
  4139.  *)
  4140.   DDERR_CANNOTATTACHSURFACE               = MAKE_DDHRESULT + 10;
  4141.  
  4142. (*
  4143.  * This surface can not be detached from the requested surface.
  4144.  *)
  4145.   DDERR_CANNOTDETACHSURFACE               = MAKE_DDHRESULT + 20;
  4146.  
  4147. (*
  4148.  * Support is currently not available.
  4149.  *)
  4150.   DDERR_CURRENTLYNOTAVAIL                 = MAKE_DDHRESULT + 40;
  4151.  
  4152. (*
  4153.  * An exception was encountered while performing the requested operation
  4154.  *)
  4155.   DDERR_EXCEPTION                         = MAKE_DDHRESULT + 55;
  4156.  
  4157. (*
  4158.  * Generic failure.
  4159.  *)
  4160.   DDERR_GENERIC                           = E_FAIL;
  4161.  
  4162. (*
  4163.  * Height of rectangle provided is not a multiple of reqd alignment
  4164.  *)
  4165.   DDERR_HEIGHTALIGN                       = MAKE_DDHRESULT + 90;
  4166.  
  4167. (*
  4168.  * Unable to match primary surface creation request with existing
  4169.  * primary surface.
  4170.  *)
  4171.   DDERR_INCOMPATIBLEPRIMARY               = MAKE_DDHRESULT + 95;
  4172.  
  4173. (*
  4174.  * One or more of the caps bits passed to the callback are incorrect.
  4175.  *)
  4176.   DDERR_INVALIDCAPS                       = MAKE_DDHRESULT + 100;
  4177.  
  4178. (*
  4179.  * DirectDraw does not support provided Cliplist.
  4180.  *)
  4181.   DDERR_INVALIDCLIPLIST                   = MAKE_DDHRESULT + 110;
  4182.  
  4183. (*
  4184.  * DirectDraw does not support the requested mode
  4185.  *)
  4186.   DDERR_INVALIDMODE                       = MAKE_DDHRESULT + 120;
  4187.  
  4188. (*
  4189.  * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
  4190.  *)
  4191.   DDERR_INVALIDOBJECT                     = MAKE_DDHRESULT + 130;
  4192.  
  4193. (*
  4194.  * One or more of the parameters passed to the callback function are
  4195.  * incorrect.
  4196.  *)
  4197.   DDERR_INVALIDPARAMS                     = E_INVALIDARG;
  4198.  
  4199. (*
  4200.  * pixel format was invalid as specified
  4201.  *)
  4202.   DDERR_INVALIDPIXELFORMAT                = MAKE_DDHRESULT + 145;
  4203.  
  4204. (*
  4205.  * Rectangle provided was invalid.
  4206.  *)
  4207.   DDERR_INVALIDRECT                       = MAKE_DDHRESULT + 150;
  4208.  
  4209. (*
  4210.  * Operation could not be carried out because one or more surfaces are locked
  4211.  *)
  4212.   DDERR_LOCKEDSURFACES                    = MAKE_DDHRESULT + 160;
  4213.  
  4214. (*
  4215.  * There is no 3D present.
  4216.  *)
  4217.   DDERR_NO3D                              = MAKE_DDHRESULT + 170;
  4218.  
  4219. (*
  4220.  * Operation could not be carried out because there is no alpha accleration
  4221.  * hardware present or available.
  4222.  *)
  4223.   DDERR_NOALPHAHW                         = MAKE_DDHRESULT + 180;
  4224.  
  4225. (*
  4226.  * Operation could not be carried out because there is no stereo
  4227.  * hardware present or available.
  4228.  *)
  4229.   DDERR_NOSTEREOHARDWARE          = MAKE_DDHRESULT + 181;
  4230.  
  4231. (*
  4232.  * Operation could not be carried out because there is no hardware
  4233.  * present which supports stereo surfaces
  4234.  *)
  4235.   DDERR_NOSURFACELEFT             = MAKE_DDHRESULT + 182;
  4236.  
  4237. (*
  4238.  * no clip list available
  4239.  *)
  4240.   DDERR_NOCLIPLIST                        = MAKE_DDHRESULT + 205;
  4241.  
  4242. (*
  4243.  * Operation could not be carried out because there is no color conversion
  4244.  * hardware present or available.
  4245.  *)
  4246.   DDERR_NOCOLORCONVHW                     = MAKE_DDHRESULT + 210;
  4247.  
  4248. (*
  4249.  * Create function called without DirectDraw object method SetCooperativeLevel
  4250.  * being called.
  4251.  *)
  4252.   DDERR_NOCOOPERATIVELEVELSET             = MAKE_DDHRESULT + 212;
  4253.  
  4254. (*
  4255.  * Surface doesn't currently have a color key
  4256.  *)
  4257.   DDERR_NOCOLORKEY                        = MAKE_DDHRESULT + 215;
  4258.  
  4259. (*
  4260.  * Operation could not be carried out because there is no hardware support
  4261.  * of the dest color key.
  4262.  *)
  4263.   DDERR_NOCOLORKEYHW                      = MAKE_DDHRESULT + 220;
  4264.  
  4265. (*
  4266.  * No DirectDraw support possible with current display driver
  4267.  *)
  4268.   DDERR_NODIRECTDRAWSUPPORT               = MAKE_DDHRESULT + 222;
  4269.  
  4270. (*
  4271.  * Operation requires the application to have exclusive mode but the
  4272.  * application does not have exclusive mode.
  4273.  *)
  4274.   DDERR_NOEXCLUSIVEMODE                   = MAKE_DDHRESULT + 225;
  4275.  
  4276. (*
  4277.  * Flipping visible surfaces is not supported.
  4278.  *)
  4279.   DDERR_NOFLIPHW                          = MAKE_DDHRESULT + 230;
  4280.  
  4281. (*
  4282.  * There is no GDI present.
  4283.  *)
  4284.   DDERR_NOGDI                             = MAKE_DDHRESULT + 240;
  4285.  
  4286. (*
  4287.  * Operation could not be carried out because there is no hardware present
  4288.  * or available.
  4289.  *)
  4290.   DDERR_NOMIRRORHW                        = MAKE_DDHRESULT + 250;
  4291.  
  4292. (*
  4293.  * Requested item was not found
  4294.  *)
  4295.   DDERR_NOTFOUND                          = MAKE_DDHRESULT + 255;
  4296.  
  4297. (*
  4298.  * Operation could not be carried out because there is no overlay hardware
  4299.  * present or available.
  4300.  *)
  4301.   DDERR_NOOVERLAYHW                       = MAKE_DDHRESULT + 260;
  4302.  
  4303. (*
  4304.  * Operation could not be carried out because the source and destination
  4305.  * rectangles are on the same surface and overlap each other.
  4306.  *)
  4307.   DDERR_OVERLAPPINGRECTS                = MAKE_DDHRESULT + 270;
  4308.  
  4309. (*
  4310.  * Operation could not be carried out because there is no appropriate raster
  4311.  * op hardware present or available.
  4312.  *)
  4313.   DDERR_NORASTEROPHW                      = MAKE_DDHRESULT + 280;
  4314.  
  4315. (*
  4316.  * Operation could not be carried out because there is no rotation hardware
  4317.  * present or available.
  4318.  *)
  4319.   DDERR_NOROTATIONHW                      = MAKE_DDHRESULT + 290;
  4320.  
  4321. (*
  4322.  * Operation could not be carried out because there is no hardware support
  4323.  * for stretching
  4324.  *)
  4325.   DDERR_NOSTRETCHHW                       = MAKE_DDHRESULT + 310;
  4326.  
  4327. (*
  4328.  * DirectDrawSurface is not in 4 bit color palette and the requested operation
  4329.  * requires 4 bit color palette.
  4330.  *)
  4331.   DDERR_NOT4BITCOLOR                      = MAKE_DDHRESULT + 316;
  4332.  
  4333. (*
  4334.  * DirectDrawSurface is not in 4 bit color index palette and the requested
  4335.  * operation requires 4 bit color index palette.
  4336.  *)
  4337.   DDERR_NOT4BITCOLORINDEX                 = MAKE_DDHRESULT + 317;
  4338.  
  4339. (*
  4340.  * DirectDraw Surface is not in 8 bit color mode and the requested operation
  4341.  * requires 8 bit color.
  4342.  *)
  4343.   DDERR_NOT8BITCOLOR                      = MAKE_DDHRESULT + 320;
  4344.  
  4345. (*
  4346.  * Operation could not be carried out because there is no texture mapping
  4347.  * hardware present or available.
  4348.  *)
  4349.   DDERR_NOTEXTUREHW                       = MAKE_DDHRESULT + 330;
  4350.  
  4351. (*
  4352.  * Operation could not be carried out because there is no hardware support
  4353.  * for vertical blank synchronized operations.
  4354.  *)
  4355.   DDERR_NOVSYNCHW                         = MAKE_DDHRESULT + 335;
  4356.  
  4357. (*
  4358.  * Operation could not be carried out because there is no hardware support
  4359.  * for zbuffer blting.
  4360.  *)
  4361.   DDERR_NOZBUFFERHW                       = MAKE_DDHRESULT + 340;
  4362.  
  4363. (*
  4364.  * Overlay surfaces could not be z layered based on their BltOrder because
  4365.  * the hardware does not support z layering of overlays.
  4366.  *)
  4367.   DDERR_NOZOVERLAYHW                      = MAKE_DDHRESULT + 350;
  4368.  
  4369. (*
  4370.  * The hardware needed for the requested operation has already been
  4371.  * allocated.
  4372.  *)
  4373.   DDERR_OUTOFCAPS                         = MAKE_DDHRESULT + 360;
  4374.  
  4375. (*
  4376.  * DirectDraw does not have enough memory to perform the operation.
  4377.  *)
  4378.   DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
  4379.  
  4380. (*
  4381.  * DirectDraw does not have enough memory to perform the operation.
  4382.  *)
  4383.   DDERR_OUTOFVIDEOMEMORY                  = MAKE_DDHRESULT + 380;
  4384.  
  4385. (*
  4386.  * hardware does not support clipped overlays
  4387.  *)
  4388.   DDERR_OVERLAYCANTCLIP                   = MAKE_DDHRESULT + 382;
  4389.  
  4390. (*
  4391.  * Can only have ony color key active at one time for overlays
  4392.  *)
  4393.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = MAKE_DDHRESULT + 384;
  4394.  
  4395. (*
  4396.  * Access to this palette is being refused because the palette is already
  4397.  * locked by another thread.
  4398.  *)
  4399.   DDERR_PALETTEBUSY                       = MAKE_DDHRESULT + 387;
  4400.  
  4401. (*
  4402.  * No src color key specified for this operation.
  4403.  *)
  4404.   DDERR_COLORKEYNOTSET                    = MAKE_DDHRESULT + 400;
  4405.  
  4406. (*
  4407.  * This surface is already attached to the surface it is being attached to.
  4408.  *)
  4409.   DDERR_SURFACEALREADYATTACHED            = MAKE_DDHRESULT + 410;
  4410.  
  4411. (*
  4412.  * This surface is already a dependency of the surface it is being made a
  4413.  * dependency of.
  4414.  *)
  4415.   DDERR_SURFACEALREADYDEPENDENT           = MAKE_DDHRESULT + 420;
  4416.  
  4417. (*
  4418.  * Access to this surface is being refused because the surface is already
  4419.  * locked by another thread.
  4420.  *)
  4421.   DDERR_SURFACEBUSY                       = MAKE_DDHRESULT + 430;
  4422.  
  4423. (*
  4424.  * Access to this surface is being refused because no driver exists
  4425.  * which can supply a pointer to the surface.
  4426.  * This is most likely to happen when attempting to lock the primary
  4427.  * surface when no DCI provider is present.
  4428.  * Will also happen on attempts to lock an optimized surface.
  4429.  *)
  4430.   DDERR_CANTLOCKSURFACE                   = MAKE_DDHRESULT + 435;
  4431.  
  4432. (*
  4433.  * Access to Surface refused because Surface is obscured.
  4434.  *)
  4435.   DDERR_SURFACEISOBSCURED                 = MAKE_DDHRESULT + 440;
  4436.  
  4437. (*
  4438.  * Access to this surface is being refused because the surface is gone.
  4439.  * The DIRECTDRAWSURFACE object representing this surface should
  4440.  * have Restore called on it.
  4441.  *)
  4442.   DDERR_SURFACELOST                       = MAKE_DDHRESULT + 450;
  4443.  
  4444. (*
  4445.  * The requested surface is not attached.
  4446.  *)
  4447.   DDERR_SURFACENOTATTACHED                = MAKE_DDHRESULT + 460;
  4448.  
  4449. (*
  4450.  * Height requested by DirectDraw is too large.
  4451.  *)
  4452.   DDERR_TOOBIGHEIGHT                      = MAKE_DDHRESULT + 470;
  4453.  
  4454. (*
  4455.  * Size requested by DirectDraw is too large --  The individual height and
  4456.  * width are OK.
  4457.  *)
  4458.   DDERR_TOOBIGSIZE                        = MAKE_DDHRESULT + 480;
  4459.  
  4460. (*
  4461.  * Width requested by DirectDraw is too large.
  4462.  *)
  4463.   DDERR_TOOBIGWIDTH                       = MAKE_DDHRESULT + 490;
  4464.  
  4465. (*
  4466.  * Action not supported.
  4467.  *)
  4468.   DDERR_UNSUPPORTED                       = E_NOTIMPL;
  4469.  
  4470. (*
  4471.  * FOURCC format requested is unsupported by DirectDraw
  4472.  *)
  4473.   DDERR_UNSUPPORTEDFORMAT                 = MAKE_DDHRESULT + 510;
  4474.  
  4475. (*
  4476.  * Bitmask in the pixel format requested is unsupported by DirectDraw
  4477.  *)
  4478.   DDERR_UNSUPPORTEDMASK                   = MAKE_DDHRESULT + 520;
  4479.  
  4480. (*
  4481.  * The specified stream contains invalid data
  4482.  *)
  4483.   DDERR_INVALIDSTREAM                     = MAKE_DDHRESULT + 521;
  4484.  
  4485. (*
  4486.  * vertical blank is in progress
  4487.  *)
  4488.   DDERR_VERTICALBLANKINPROGRESS           = MAKE_DDHRESULT + 537;
  4489.  
  4490. (*
  4491.  * Informs DirectDraw that the previous Blt which is transfering information
  4492.  * to or from this Surface is incomplete.
  4493.  *)
  4494.   DDERR_WASSTILLDRAWING                   = MAKE_DDHRESULT + 540;
  4495.  
  4496. (*
  4497.  * The specified surface type requires specification of the COMPLEX flag
  4498.  *)
  4499.   DDERR_DDSCAPSCOMPLEXREQUIRED            = MAKE_DDHRESULT + 542;
  4500.  
  4501. (*
  4502.  * Rectangle provided was not horizontally aligned on reqd. boundary
  4503.  *)
  4504.   DDERR_XALIGN                            = MAKE_DDHRESULT + 560;
  4505.  
  4506. (*
  4507.  * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
  4508.  * identifier.
  4509.  *)
  4510.   DDERR_INVALIDDIRECTDRAWGUID             = MAKE_DDHRESULT + 561;
  4511.  
  4512. (*
  4513.  * A DirectDraw object representing this driver has already been created
  4514.  * for this process.
  4515.  *)
  4516.   DDERR_DIRECTDRAWALREADYCREATED          = MAKE_DDHRESULT + 562;
  4517.  
  4518. (*
  4519.  * A hardware only DirectDraw object creation was attempted but the driver
  4520.  * did not support any hardware.
  4521.  *)
  4522.   DDERR_NODIRECTDRAWHW                    = MAKE_DDHRESULT + 563;
  4523.  
  4524. (*
  4525.  * this process already has created a primary surface
  4526.  *)
  4527.   DDERR_PRIMARYSURFACEALREADYEXISTS       = MAKE_DDHRESULT + 564;
  4528.  
  4529. (*
  4530.  * software emulation not available.
  4531.  *)
  4532.   DDERR_NOEMULATION                       = MAKE_DDHRESULT + 565;
  4533.  
  4534. (*
  4535.  * region passed to Clipper::GetClipList is too small.
  4536.  *)
  4537.   DDERR_REGIONTOOSMALL                    = MAKE_DDHRESULT + 566;
  4538.  
  4539. (*
  4540.  * an attempt was made to set a clip list for a clipper objec that
  4541.  * is already monitoring an hwnd.
  4542.  *)
  4543.   DDERR_CLIPPERISUSINGHWND                = MAKE_DDHRESULT + 567;
  4544.  
  4545. (*
  4546.  * No clipper object attached to surface object
  4547.  *)
  4548.   DDERR_NOCLIPPERATTACHED                 = MAKE_DDHRESULT + 568;
  4549.  
  4550. (*
  4551.  * Clipper notification requires an HWND or
  4552.  * no HWND has previously been set as the CooperativeLevel HWND.
  4553.  *)
  4554.   DDERR_NOHWND                            = MAKE_DDHRESULT + 569;
  4555.  
  4556. (*
  4557.  * HWND used by DirectDraw CooperativeLevel has been subclassed,
  4558.  * this prevents DirectDraw from restoring state.
  4559.  *)
  4560.   DDERR_HWNDSUBCLASSED                    = MAKE_DDHRESULT + 570;
  4561.  
  4562. (*
  4563.  * The CooperativeLevel HWND has already been set.
  4564.  * It can not be reset while the process has surfaces or palettes created.
  4565.  *)
  4566.   DDERR_HWNDALREADYSET                    = MAKE_DDHRESULT + 571;
  4567.  
  4568. (*
  4569.  * No palette object attached to this surface.
  4570.  *)
  4571.   DDERR_NOPALETTEATTACHED                 = MAKE_DDHRESULT + 572;
  4572.  
  4573. (*
  4574.  * No hardware support for 16 or 256 color palettes.
  4575.  *)
  4576.   DDERR_NOPALETTEHW                       = MAKE_DDHRESULT + 573;
  4577.  
  4578. (*
  4579.  * If a clipper object is attached to the source surface passed into a
  4580.  * BltFast call.
  4581.  *)
  4582.   DDERR_BLTFASTCANTCLIP                   = MAKE_DDHRESULT + 574;
  4583.  
  4584. (*
  4585.  * No blter.
  4586.  *)
  4587.   DDERR_NOBLTHW                           = MAKE_DDHRESULT + 575;
  4588.  
  4589. (*
  4590.  * No DirectDraw ROP hardware.
  4591.  *)
  4592.   DDERR_NODDROPSHW                        = MAKE_DDHRESULT + 576;
  4593.  
  4594. (*
  4595.  * returned when GetOverlayPosition is called on a hidden overlay
  4596.  *)
  4597.   DDERR_OVERLAYNOTVISIBLE                 = MAKE_DDHRESULT + 577;
  4598.  
  4599. (*
  4600.  * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
  4601.  * has never been called on to establish a destionation.
  4602.  *)
  4603.   DDERR_NOOVERLAYDEST                     = MAKE_DDHRESULT + 578;
  4604.  
  4605. (*
  4606.  * returned when the position of the overlay on the destionation is no longer
  4607.  * legal for that destionation.
  4608.  *)
  4609.   DDERR_INVALIDPOSITION                   = MAKE_DDHRESULT + 579;
  4610.  
  4611. (*
  4612.  * returned when an overlay member is called for a non-overlay surface
  4613.  *)
  4614.   DDERR_NOTAOVERLAYSURFACE                = MAKE_DDHRESULT + 580;
  4615.  
  4616. (*
  4617.  * An attempt was made to set the cooperative level when it was already
  4618.  * set to exclusive.
  4619.  *)
  4620.   DDERR_EXCLUSIVEMODEALREADYSET           = MAKE_DDHRESULT + 581;
  4621.  
  4622. (*
  4623.  * An attempt has been made to flip a surface that is not flippable.
  4624.  *)
  4625.   DDERR_NOTFLIPPABLE                      = MAKE_DDHRESULT + 582;
  4626.  
  4627. (*
  4628.  * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
  4629.  * created.
  4630.  *)
  4631.   DDERR_CANTDUPLICATE                     = MAKE_DDHRESULT + 583;
  4632.  
  4633. (*
  4634.  * Surface was not locked.  An attempt to unlock a surface that was not
  4635.  * locked at all, or by this process, has been attempted.
  4636.  *)
  4637.   DDERR_NOTLOCKED                         = MAKE_DDHRESULT + 584;
  4638.  
  4639. (*
  4640.  * Windows can not create any more DCs, or a DC was requested for a paltte-indexed
  4641.  * surface when the surface had no palette AND the display mode was not palette-indexed
  4642.  * (in this case DirectDraw cannot select a proper palette into the DC)
  4643.  *)
  4644.   DDERR_CANTCREATEDC                      = MAKE_DDHRESULT + 585;
  4645.  
  4646. (*
  4647.  * No DC was ever created for this surface.
  4648.  *)
  4649.   DDERR_NODC                              = MAKE_DDHRESULT + 586;
  4650.  
  4651. (*
  4652.  * This surface can not be restored because it was created in a different
  4653.  * mode.
  4654.  *)
  4655.   DDERR_WRONGMODE                         = MAKE_DDHRESULT + 587;
  4656.  
  4657. (*
  4658.  * This surface can not be restored because it is an implicitly created
  4659.  * surface.
  4660.  *)
  4661.   DDERR_IMPLICITLYCREATED                 = MAKE_DDHRESULT + 588;
  4662.  
  4663. (*
  4664.  * The surface being used is not a palette-based surface
  4665.  *)
  4666.   DDERR_NOTPALETTIZED                     = MAKE_DDHRESULT + 589;
  4667.  
  4668. (*
  4669.  * The display is currently in an unsupported mode
  4670.  *)
  4671.   DDERR_UNSUPPORTEDMODE                   = MAKE_DDHRESULT + 590;
  4672.  
  4673. (*
  4674.  * Operation could not be carried out because there is no mip-map
  4675.  * texture mapping hardware present or available.
  4676.  *)
  4677.   DDERR_NOMIPMAPHW                        = MAKE_DDHRESULT + 591;
  4678.  
  4679. (*
  4680.  * The requested action could not be performed because the surface was of
  4681.  * the wrong type.
  4682.  *)
  4683.   DDERR_INVALIDSURFACETYPE                = MAKE_DDHRESULT + 592;
  4684.  
  4685. (*
  4686.  * Device does not support optimized surfaces, therefore no video memory optimized surfaces
  4687.  *)
  4688.   DDERR_NOOPTIMIZEHW                      = MAKE_DDHRESULT + 600;
  4689.  
  4690. (*
  4691.  * Surface is an optimized surface, but has not yet been allocated any memory
  4692.  *)
  4693.   DDERR_NOTLOADED                         = MAKE_DDHRESULT + 601;
  4694.  
  4695. (*
  4696.  * Attempt was made to create or set a device window without first setting
  4697.  * the focus window
  4698.  *)
  4699.   DDERR_NOFOCUSWINDOW                     = MAKE_DDHRESULT + 602;
  4700.  
  4701. (*
  4702.  * Attempt was made to set a palette on a mipmap sublevel
  4703.  *)
  4704.   DDERR_NOTONMIPMAPSUBLEVEL               = MAKE_DDHRESULT + 603;
  4705.  
  4706. (*
  4707.  * A DC has already been returned for this surface. Only one DC can be
  4708.  * retrieved per surface.
  4709.  *)
  4710.   DDERR_DCALREADYCREATED                  = MAKE_DDHRESULT + 620;
  4711.  
  4712. (*
  4713.  * An attempt was made to allocate non-local video memory from a device
  4714.  * that does not support non-local video memory.
  4715.  *)
  4716.   DDERR_NONONLOCALVIDMEM                  = MAKE_DDHRESULT + 630;
  4717.  
  4718. (*
  4719.  * The attempt to page lock a surface failed.
  4720.  *)
  4721.   DDERR_CANTPAGELOCK                      = MAKE_DDHRESULT + 640;
  4722.  
  4723. (*
  4724.  * The attempt to page unlock a surface failed.
  4725.  *)
  4726.   DDERR_CANTPAGEUNLOCK                    = MAKE_DDHRESULT + 660;
  4727.  
  4728. (*
  4729.  * An attempt was made to page unlock a surface with no outstanding page locks.
  4730.  *)
  4731.   DDERR_NOTPAGELOCKED                     = MAKE_DDHRESULT + 680;
  4732.  
  4733. (*
  4734.  * There is more data available than the specified buffer size could hold
  4735.  *)
  4736.   DDERR_MOREDATA                                = MAKE_DDHRESULT + 690;
  4737.  
  4738. (*
  4739.  * The data has expired and is therefore no longer valid.
  4740.  *)
  4741.   DDERR_EXPIRED                           = MAKE_DDHRESULT + 691;
  4742.  
  4743. (*
  4744.  * The mode test has finished executing.
  4745.  *)
  4746.  DDERR_TESTFINISHED                      = MAKE_DDHRESULT + 692;
  4747.  
  4748. (*
  4749.  * The mode test has switched to a new mode.
  4750.  *)
  4751.  DDERR_NEWMODE                           = MAKE_DDHRESULT + 693;
  4752.  
  4753. (*
  4754.  * D3D has not yet been initialized.
  4755.  *)
  4756.  DDERR_D3DNOTINITIALIZED                 = MAKE_DDHRESULT + 694;
  4757.  
  4758. (*
  4759.  * The video port is not active
  4760.  *)
  4761.   DDERR_VIDEONOTACTIVE                          = MAKE_DDHRESULT + 695;
  4762.  
  4763. (*
  4764.  * The monitor does not have EDID data.
  4765.  *)
  4766.  DDERR_NOMONITORINFORMATION             = MAKE_DDHRESULT + 696;
  4767.  
  4768. (*
  4769.  * The driver does not enumerate display mode refresh rates.
  4770.  *)
  4771.  DDERR_NODRIVERSUPPORT                  = MAKE_DDHRESULT + 697;
  4772.  
  4773. (*
  4774.  * Surfaces created by one direct draw device cannot be used directly by
  4775.  * another direct draw device.
  4776.  *)
  4777.   DDERR_DEVICEDOESNTOWNSURFACE                  = MAKE_DDHRESULT + 699;
  4778.  
  4779. (*
  4780.  * An attempt was made to invoke an interface member of a DirectDraw object
  4781.  * created by CoCreateInstance() before it was initialized.
  4782.  *)
  4783.   DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
  4784.  
  4785. (* Alpha bit depth constants *)
  4786.  
  4787. (*
  4788.  * API's
  4789.  *)
  4790.  
  4791. type
  4792.   HMonitor = THandle;
  4793.  
  4794.   TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4795.       lpDriverName: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
  4796.   TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4797.       lpDriverName: PWideChar; lpContext: Pointer) : BOOL; stdcall;
  4798. {$IFDEF UNICODE}
  4799.   TDDEnumCallback = TDDEnumCallbackW;
  4800. {$ELSE}
  4801.   TDDEnumCallback = TDDEnumCallbackA;
  4802. {$ENDIF}
  4803.  
  4804.   TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4805.       lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4806.       stdcall;
  4807.   TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4808.       lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4809.       stdcall;
  4810.      
  4811. {$IFDEF UNICODE}
  4812.   TDDEnumCallbackEx = TDDEnumCallbackExW;
  4813. {$ELSE}
  4814.   TDDEnumCallbackEx = TDDEnumCallbackExA;
  4815. {$ENDIF}
  4816.  
  4817. var
  4818.   DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA;
  4819.        lpContext: Pointer) : HResult; stdcall;
  4820.   DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW;
  4821.        lpContext: Pointer) : HResult; stdcall;
  4822.   DirectDrawEnumerate : function (lpCallback: TDDEnumCallback;
  4823.        lpContext: Pointer) : HResult; stdcall;
  4824.  
  4825.   DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA;
  4826.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4827.   DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW;
  4828.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4829.   DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx;
  4830.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4831.  
  4832.   DirectDrawCreate : function (lpGUID: PGUID;
  4833.        out lplpDD: IDirectDraw;
  4834.        pUnkOuter: IUnknown) : HResult; stdcall;
  4835.   DirectDrawCreateEx : function  (lpGUID: PGUID;
  4836.        out lplpDD: IDirectDraw7; const iid: TGUID;
  4837.        pUnkOuter: IUnknown) : HResult; stdcall;
  4838.   DirectDrawCreateClipper : function (dwFlags: DWORD;
  4839.        out lplpDDClipper: IDirectDrawClipper;
  4840.        pUnkOuter: IUnknown) : HResult; stdcall;
  4841.  
  4842. const
  4843. (*
  4844.  * Flags for DirectDrawEnumerateEx
  4845.  * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to
  4846.  * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx.
  4847.  * By default, only the primary display device is enumerated.
  4848.  * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES)
  4849.  *)
  4850.  
  4851. (*
  4852.  * This flag causes enumeration of any GDI display devices which are part of
  4853.  * the Windows Desktop
  4854.  *)
  4855.   DDENUM_ATTACHEDSECONDARYDEVICES     = $00000001;
  4856.  
  4857. (*
  4858.  * This flag causes enumeration of any GDI display devices which are not
  4859.  * part of the Windows Desktop
  4860.  *)
  4861.   DDENUM_DETACHEDSECONDARYDEVICES     = $00000002;
  4862.  
  4863. (*
  4864.  * This flag causes enumeration of non-display devices
  4865.  *)
  4866.   DDENUM_NONDISPLAYDEVICES            = $00000004;
  4867.  
  4868.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  4869.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  4870.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  4871.  
  4872.   DDCREATE_HARDWAREONLY       = $00000001;
  4873.   DDCREATE_EMULATIONONLY      = $00000002;
  4874.  
  4875. (*
  4876.  * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel
  4877.  *)
  4878. function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
  4879. function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
  4880. function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
  4881.  
  4882.  
  4883. (*==========================================================================;
  4884.  *
  4885.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  4886.  *
  4887.  *  File:       dvp.h
  4888.  *  Content:    DirectDrawVideoPort include file
  4889.  *
  4890.  ***************************************************************************)
  4891.  
  4892. const
  4893. (*
  4894.  * GUIDS used by DirectDrawVideoPort objects
  4895.  *)
  4896.   DDVPTYPE_E_HREFH_VREFH: TGUID =
  4897.       (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4898.   DDVPTYPE_E_HREFH_VREFL: TGUID =
  4899.       (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4900.   DDVPTYPE_E_HREFL_VREFH: TGUID =
  4901.       (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4902.   DDVPTYPE_E_HREFL_VREFL: TGUID =
  4903.       (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4904.   DDVPTYPE_CCIR656: TGUID =
  4905.       (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4906.   DDVPTYPE_BROOKTREE: TGUID =
  4907.       (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4908.   DDVPTYPE_PHILIPS: TGUID =
  4909.       (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4910.  
  4911. (*
  4912.  * GUIDS used to describe connections
  4913.  *)
  4914.  
  4915. (*============================================================================
  4916.  *
  4917.  * DirectDraw Structures
  4918.  *
  4919.  * Various structures used to invoke DirectDraw.
  4920.  *
  4921.  *==========================================================================*)
  4922.  
  4923. type
  4924.  
  4925. (*
  4926.  * TDDVideoPortConnect
  4927.  *)
  4928.   PDDVideoPortConnect = ^TDDVideoPortConnect;
  4929.   TDDVideoPortConnect = packed record
  4930.     dwSize: DWORD;        // size of the TDDVideoPortConnect structure
  4931.     dwPortWidth: DWORD;   // Width of the video port
  4932.     guidTypeID: TGUID;    // Description of video port connection
  4933.     dwFlags: DWORD;       // Connection flags
  4934.     dwReserved1: DWORD;   // Reserved, set to zero.
  4935.   end;
  4936.  
  4937. (*
  4938.  * TDDVideoPortCaps
  4939.  *)
  4940.   PDDVideoPortCaps = ^TDDVideoPortCaps;
  4941.   TDDVideoPortCaps = packed record
  4942.     dwSize: DWORD;                          // size of the TDDVideoPortCaps structure
  4943.     dwFlags: DWORD;                         // indicates which fields contain data
  4944.     dwMaxWidth: DWORD;                      // max width of the video port field
  4945.     dwMaxVBIWidth: DWORD;                   // max width of the VBI data
  4946.     dwMaxHeight: DWORD;                     // max height of the video port field
  4947.     dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
  4948.     dwCaps: DWORD;                          // Video port capabilities
  4949.     dwFX: DWORD;                            // More video port capabilities
  4950.     dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
  4951.     dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
  4952.     dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
  4953.     dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
  4954.     dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
  4955.     dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
  4956.     dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
  4957.     dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
  4958.     dwNumPreferredAutoflip: DWORD;      // Optimal number of autoflippable surfaces for hardware
  4959.     wNumFilterTapsX: WORD;              // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
  4960.     wNumFilterTapsY: WORD;              // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
  4961.   end;
  4962.  
  4963. const
  4964. (*
  4965.  * The dwMaxWidth and dwMaxVBIWidth members are valid
  4966.  *)
  4967.   DDVPD_WIDTH = $00000001;
  4968.  
  4969. (*
  4970.  * The dwMaxHeight member is valid
  4971.  *)
  4972.   DDVPD_HEIGHT = $00000002;
  4973.  
  4974. (*
  4975.  * The dwVideoPortID member is valid
  4976.  *)
  4977.   DDVPD_ID = $00000004;
  4978.  
  4979. (*
  4980.  * The dwCaps member is valid
  4981.  *)
  4982.   DDVPD_CAPS = $00000008;
  4983.  
  4984. (*
  4985.  * The dwFX member is valid
  4986.  *)
  4987.   DDVPD_FX = $00000010;
  4988.  
  4989. (*
  4990.  * The dwNumAutoFlipSurfaces member is valid
  4991.  *)
  4992.   DDVPD_AUTOFLIP = $00000020;
  4993.  
  4994. (*
  4995.  * All of the alignment members are valid
  4996.  *)
  4997.   DDVPD_ALIGN = $00000040;
  4998.  
  4999. (*
  5000.  * The dwNumPreferredAutoflip member is valid
  5001.  *)
  5002.   DDVPD_PREFERREDAUTOFLIP = $00000080;
  5003.  
  5004. (*
  5005.  * The wNumFilterTapsX and wNumFilterTapsY fields are valid
  5006.  *)
  5007.   DDVPD_FILTERQUALITY     = $00000100;
  5008.  
  5009. type
  5010. (*
  5011.  * TDDVideoPortDesc
  5012.  *)
  5013.   PDDVideoPortDesc = ^TDDVideoPortDesc;
  5014.   TDDVideoPortDesc = packed record
  5015.     dwSize: DWORD;                       // size of the TDDVideoPortDesc structure
  5016.     dwFieldWidth: DWORD;                 // width of the video port field
  5017.     dwVBIWidth: DWORD;                   // width of the VBI data
  5018.     dwFieldHeight: DWORD;                // height of the video port field
  5019.     dwMicrosecondsPerField: DWORD;       // Microseconds per video field
  5020.     dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
  5021.     dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
  5022.     dwReserved1: DWORD;                  // Reserved for future use - set to zero
  5023.     VideoPortType: TDDVideoPortConnect;  // Description of video port connection
  5024.     dwReserved2: DWORD;                  // Reserved for future use - set to zero
  5025.     dwReserved3: DWORD;                  // Reserved for future use - set to zero
  5026.   end;
  5027.  
  5028. (*
  5029.  * TDDVideoPortInfo
  5030.  *)
  5031.   PDDVideoPortInfo = ^TDDVideoPortInfo;
  5032.   TDDVideoPortInfo = packed record
  5033.     dwSize: DWORD;                            // Size of the structure
  5034.     dwOriginX: DWORD;                         // Placement of the video data within the surface.
  5035.     dwOriginY: DWORD;                         // Placement of the video data within the surface.
  5036.     dwVPFlags: DWORD;                         // Video port options
  5037.     rCrop: TRect;                             // Cropping rectangle (optional).
  5038.     dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
  5039.     dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
  5040.     lpddpfInputFormat: PDDPixelFormat;       // Video format written to the video port
  5041.     lpddpfVBIInputFormat: PDDPixelFormat;    // Input format of the VBI data
  5042.     lpddpfVBIOutputFormat: PDDPixelFormat;   // Output format of the data
  5043.     dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
  5044.     dwReserved1: DWORD;                       // Reserved for future use - set to zero
  5045.     dwReserved2: DWORD;                       // Reserved for future use - set to zero
  5046.   end;
  5047.  
  5048. (*
  5049.  * TDDVideoPortBandWidth
  5050.  *)
  5051.   PDDVideoPortBandWidth = ^TDDVideoPortBandWidth;
  5052.   TDDVideoPortBandWidth = packed record
  5053.     dwSize: DWORD;                 // Size of the structure
  5054.     dwCaps: DWORD;
  5055.     dwOverlay: DWORD;              // Zoom factor at which overlay is supported
  5056.     dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
  5057.     dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
  5058.     dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
  5059.     dwReserved1: DWORD;            // Reserved for future use - set to zero
  5060.     dwReserved2: DWORD;            // Reserved for future use - set to zero
  5061.   end;
  5062.  
  5063. (*
  5064.  * TDDVideoPortStatus
  5065.  *)
  5066.   PDDVideoPortStatus = ^TDDVideoPortStatus;
  5067.   TDDVideoPortStatus = record
  5068.     dwSize: DWORD;                       // Size of the structure
  5069.     bInUse: BOOL;                        // TRUE if video port is currently being used
  5070.     dwFlags: DWORD;                      // Currently not used
  5071.     dwReserved1: DWORD;                  // Reserved for future use
  5072.     VideoPortType: TDDVideoPortConnect;  // Information about the connection
  5073.     dwReserved2: DWORD;                  // Reserved for future use
  5074.     dwReserved3: DWORD;                  // Reserved for future use
  5075.   end;
  5076.  
  5077. const
  5078. (*============================================================================
  5079.  *
  5080.  * Video Port Flags
  5081.  *
  5082.  * All flags are bit flags.
  5083.  *
  5084.  *==========================================================================*)
  5085.  
  5086. (****************************************************************************
  5087.  *
  5088.  * VIDEOPORT TDDVideoPortConnect FLAGS
  5089.  *
  5090.  ****************************************************************************)
  5091.  
  5092. (*
  5093.  * When this is set by the driver and passed to the client, this
  5094.  * indicates that the video port is capable of double clocking the data.
  5095.  * When this is set by the client, this indicates that the video port
  5096.  * should enable double clocking.  This flag is only valid with external
  5097.  * syncs.
  5098.  *)
  5099.   DDVPCONNECT_DOUBLECLOCK = $00000001;
  5100.  
  5101. (*
  5102.  * When this is set by the driver and passed to the client, this
  5103.  * indicates that the video port is capable of using an external VACT
  5104.  * signal. When this is set by the client, this indicates that the
  5105.  * video port should use the external VACT signal.
  5106.  *)
  5107.   DDVPCONNECT_VACT = $00000002;
  5108.  
  5109. (*
  5110.  * When this is set by the driver and passed to the client, this
  5111.  * indicates that the video port is capable of treating even fields
  5112.  * like odd fields and visa versa.  When this is set by the client,
  5113.  * this indicates that the video port should treat even fields like odd
  5114.  * fields.
  5115.  *)
  5116.   DDVPCONNECT_INVERTPOLARITY = $00000004;
  5117.  
  5118. (*
  5119.  * Indicates that any data written to the video port during the VREF
  5120.  * period will not be written into the frame buffer. This flag is read only.
  5121.  *)
  5122.   DDVPCONNECT_DISCARDSVREFDATA = $00000008;
  5123.  
  5124. (*
  5125.  * When this is set be the driver and passed to the client, this
  5126.  * indicates that the device will write half lines into the frame buffer
  5127.  * if half lines are provided by the decoder.  If this is set by the client,
  5128.  * this indicates that the decoder will be supplying half lines.
  5129.  *)
  5130.   DDVPCONNECT_HALFLINE = $00000010;
  5131.  
  5132. (*
  5133.  * Indicates that the signal is interlaced. This flag is only
  5134.  * set by the client.
  5135.  *)
  5136.   DDVPCONNECT_INTERLACED = $00000020;
  5137.  
  5138. (*
  5139.  * Indicates that video port is shareable and that this video port
  5140.  * will use the even fields.  This flag is only set by the client.
  5141.  *)
  5142.   DDVPCONNECT_SHAREEVEN = $00000040;
  5143.  
  5144. (*
  5145.  * Indicates that video port is shareable and that this video port
  5146.  * will use the odd fields.  This flag is only set by the client.
  5147.  *)
  5148.   DDVPCONNECT_SHAREODD = $00000080;
  5149.  
  5150. (****************************************************************************
  5151.  *
  5152.  * VIDEOPORT TDDVideoPortDesc CAPS
  5153.  *
  5154.  ****************************************************************************)
  5155.  
  5156. (*
  5157.  * Flip can be performed automatically to avoid tearing.
  5158.  *)
  5159.   DDVPCAPS_AUTOFLIP = $00000001;
  5160.  
  5161. (*
  5162.  * Supports interlaced video
  5163.  *)
  5164.   DDVPCAPS_INTERLACED = $00000002;
  5165.  
  5166. (*
  5167.  * Supports non-interlaced video
  5168.  *)
  5169.   DDVPCAPS_NONINTERLACED = $00000004;
  5170.  
  5171. (*
  5172.  * Indicates that the device can return whether the current field
  5173.  * of an interlaced signal is even or odd.
  5174.  *)
  5175.   DDVPCAPS_READBACKFIELD = $00000008;
  5176.  
  5177. (*
  5178.  * Indicates that the device can return the current line of video
  5179.  * being written into the frame buffer.
  5180.  *)
  5181.   DDVPCAPS_READBACKLINE = $00000010;
  5182.  
  5183. (*
  5184.  * Allows two gen-locked video streams to share a single video port,
  5185.  * where one stream uses the even fields and the other uses the odd
  5186.  * fields. Separate parameters (including address, scaling,
  5187.  * cropping, etc.) are maintained for both fields.)
  5188.  *)
  5189.   DDVPCAPS_SHAREABLE = $00000020;
  5190.  
  5191. (*
  5192.  * Even fields of video can be automatically discarded.
  5193.  *)
  5194.   DDVPCAPS_SKIPEVENFIELDS = $00000040;
  5195.  
  5196. (*
  5197.  * Odd fields of video can be automatically discarded.
  5198.  *)
  5199.   DDVPCAPS_SKIPODDFIELDS = $00000080;
  5200.  
  5201. (*
  5202.  * Indicates that the device is capable of driving the graphics
  5203.  * VSYNC with the video port VSYNC.
  5204.  *)
  5205.   DDVPCAPS_SYNCMASTER = $00000100;
  5206.  
  5207. (*
  5208.  * Indicates that data within the vertical blanking interval can
  5209.  * be written to a different surface.
  5210.  *)
  5211.   DDVPCAPS_VBISURFACE = $00000200;
  5212.  
  5213. (*
  5214.  * Indicates that the video port can perform color operations
  5215.  * on the incoming data before it is written to the frame buffer.
  5216.  *)
  5217.   DDVPCAPS_COLORCONTROL = $00000400;
  5218.  
  5219. (*
  5220.  * Indicates that the video port can accept VBI data in a different
  5221.  * width or format than the regular video data.
  5222.  *)
  5223.   DDVPCAPS_OVERSAMPLEDVBI = $00000800;
  5224.  
  5225. (*
  5226.  * Indicates that the video port can write data directly to system memory
  5227.  *)
  5228.   DDVPCAPS_SYSTEMMEMORY = $00001000;
  5229.  
  5230. (*
  5231.  * Indicates that the VBI and video portions of the video stream can
  5232.  * be controlled by an independent processes.
  5233.  *)
  5234.   DDVPCAPS_VBIANDVIDEOINDEPENDENT       = $00002000;
  5235.  
  5236. (*
  5237.  * Indicates that the video port contains high quality hardware
  5238.  * de-interlacing hardware that should be used instead of the
  5239.  * bob/weave algorithms.
  5240.  *)
  5241.   DDVPCAPS_HARDWAREDEINTERLACE          = $00004000;
  5242.  
  5243. (****************************************************************************
  5244.  *
  5245.  * VIDEOPORT TDDVideoPortDesc FX
  5246.  *
  5247.  ****************************************************************************)
  5248.  
  5249. (*
  5250.  * Limited cropping is available to crop out the vertical interval data.
  5251.  *)
  5252.   DDVPFX_CROPTOPDATA = $00000001;
  5253.  
  5254. (*
  5255.  * Incoming data can be cropped in the X direction before it is written
  5256.  * to the surface.
  5257.  *)
  5258.   DDVPFX_CROPX = $00000002;
  5259.  
  5260. (*
  5261.  * Incoming data can be cropped in the Y direction before it is written
  5262.  * to the surface.
  5263.  *)
  5264.   DDVPFX_CROPY = $00000004;
  5265.  
  5266. (*
  5267.  * Supports interleaving interlaced fields in memory.
  5268.  *)
  5269.   DDVPFX_INTERLEAVE = $00000008;
  5270.  
  5271. (*
  5272.  * Supports mirroring left to right as the video data is written
  5273.  * into the frame buffer.
  5274.  *)
  5275.   DDVPFX_MIRRORLEFTRIGHT = $00000010;
  5276.  
  5277. (*
  5278.  * Supports mirroring top to bottom as the video data is written
  5279.  * into the frame buffer.
  5280.  *)
  5281.   DDVPFX_MIRRORUPDOWN = $00000020;
  5282.  
  5283. (*
  5284.  * Data can be arbitrarily shrunk in the X direction before it
  5285.  * is written to the surface.
  5286.  *)
  5287.   DDVPFX_PRESHRINKX = $00000040;
  5288.  
  5289. (*
  5290.  * Data can be arbitrarily shrunk in the Y direction before it
  5291.  * is written to the surface.
  5292.  *)
  5293.   DDVPFX_PRESHRINKY = $00000080;
  5294.  
  5295. (*
  5296.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
  5297.  * direction before it is written to the surface.
  5298.  *)
  5299.   DDVPFX_PRESHRINKXB = $00000100;
  5300.  
  5301. (*
  5302.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
  5303.  * direction before it is written to the surface.
  5304.  *)
  5305.   DDVPFX_PRESHRINKYB = $00000200;
  5306.  
  5307. (*
  5308.  * Data can be shrunk in increments of 1/x in the X direction
  5309.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep)
  5310.  * before it is written to the surface.
  5311.  *)
  5312.   DDVPFX_PRESHRINKXS = $00000400;
  5313.  
  5314. (*
  5315.  * Data can be shrunk in increments of 1/x in the Y direction
  5316.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep)
  5317.  * before it is written to the surface.
  5318.  *)
  5319.   DDVPFX_PRESHRINKYS = $00000800;
  5320.  
  5321. (*
  5322.  * Data can be arbitrarily stretched in the X direction before
  5323.  * it is written to the surface.
  5324.  *)
  5325.   DDVPFX_PRESTRETCHX = $00001000;
  5326.  
  5327. (*
  5328.  * Data can be arbitrarily stretched in the Y direction before
  5329.  * it is written to the surface.
  5330.  *)
  5331.   DDVPFX_PRESTRETCHY = $00002000;
  5332.  
  5333. (*
  5334.  * Data can be integer stretched in the X direction before it is
  5335.  * written to the surface.
  5336.  *)
  5337.   DDVPFX_PRESTRETCHXN = $00004000;
  5338.  
  5339. (*
  5340.  * Data can be integer stretched in the Y direction before it is
  5341.  * written to the surface.
  5342.  *)
  5343.   DDVPFX_PRESTRETCHYN = $00008000;
  5344.  
  5345. (*
  5346.  * Indicates that data within the vertical blanking interval can
  5347.  * be converted independently of the remaining video data.
  5348.  *)
  5349.   DDVPFX_VBICONVERT = $00010000;
  5350.  
  5351. (*
  5352.  * Indicates that scaling can be disabled for data within the
  5353.  * vertical blanking interval.
  5354.  *)
  5355.   DDVPFX_VBINOSCALE = $00020000;
  5356.  
  5357. (*
  5358.  * Indicates that the video data can ignore the left and right
  5359.  * cropping coordinates when cropping oversampled VBI data.
  5360.  *)
  5361.   DDVPFX_IGNOREVBIXCROP = $00040000;
  5362.  
  5363. (*
  5364.  * Indicates that interleaving can be disabled for data within the
  5365.  * vertical blanking interval.
  5366.  *)
  5367.   DDVPFX_VBINOINTERLEAVE     = $00080000;
  5368.  
  5369. (****************************************************************************
  5370.  *
  5371.  * VIDEOPORT TDDVideoPortInfo FLAGS
  5372.  *
  5373.  ****************************************************************************)
  5374.  
  5375. (*
  5376.  * Perform automatic flipping.   Auto-flipping is performed between
  5377.  * the overlay surface that was attached to the video port using
  5378.  * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
  5379.  * are attached to the surface via the IDirectDrawSurface::AttachSurface
  5380.  * method.  The flip order is the order in which the overlay surfaces
  5381.  * were. attached.
  5382.  *)
  5383.   DDVP_AUTOFLIP = $00000001;
  5384.  
  5385. (*
  5386.  * Perform conversion using the ddpfOutputFormat information.
  5387.  *)
  5388.   DDVP_CONVERT = $00000002;
  5389.  
  5390. (*
  5391.  * Perform cropping using the specified rectangle.
  5392.  *)
  5393.   DDVP_CROP = $00000004;
  5394.  
  5395. (*
  5396.  * Indicates that interlaced fields should be interleaved in memory.
  5397.  *)
  5398.   DDVP_INTERLEAVE = $00000008;
  5399.  
  5400. (*
  5401.  * Indicates that the data should be mirrored left to right as it's
  5402.  * written into the frame buffer.
  5403.  *)
  5404.   DDVP_MIRRORLEFTRIGHT = $00000010;
  5405.  
  5406. (*
  5407.  * Indicates that the data should be mirrored top to bottom as it's
  5408.  * written into the frame buffer.
  5409.  *)
  5410.   DDVP_MIRRORUPDOWN = $00000020;
  5411.  
  5412. (*
  5413.  * Perform pre-scaling/zooming based on the pre-scale parameters.
  5414.  *)
  5415.   DDVP_PRESCALE = $00000040;
  5416.  
  5417. (*
  5418.  * Ignore input of even fields.
  5419.  *)
  5420.   DDVP_SKIPEVENFIELDS = $00000080;
  5421.  
  5422. (*
  5423.  * Ignore input of odd fields.
  5424.  *)
  5425.   DDVP_SKIPODDFIELDS = $00000100;
  5426.  
  5427. (*
  5428.  * Drive the graphics VSYNCs using the video port VYSNCs.
  5429.  *)
  5430.   DDVP_SYNCMASTER = $00000200;
  5431.  
  5432. (*
  5433.  * The ddpfVBIOutputFormatFormat member contains data that should be used
  5434.  * to convert the data within the vertical blanking interval.
  5435.  *)
  5436.   DDVP_VBICONVERT = $00000400;
  5437.  
  5438. (*
  5439.  * Indicates that data within the vertical blanking interval
  5440.  * should not be scaled.
  5441.  *)
  5442.   DDVP_VBINOSCALE = $00000800;
  5443.  
  5444. (*
  5445.  * Indicates that these bob/weave decisions should not be
  5446.  * overriden by other interfaces.
  5447.  *)
  5448.   DDVP_OVERRIDEBOBWEAVE = $00001000;
  5449.  
  5450. (*
  5451.  * Indicates that the video data should ignore the left and right
  5452.  * cropping coordinates when cropping the VBI data.
  5453.  *)
  5454.   DDVP_IGNOREVBIXCROP = $00002000;
  5455.  
  5456. (*
  5457.  * Indicates that interleaving can be disabled for data within the
  5458.  * vertical blanking interval.
  5459.  *)
  5460.   DDVP_VBINOINTERLEAVE                  = $00004000;
  5461.  
  5462. (*
  5463.  * Indicates that the video port should use the hardware
  5464.  * de-interlacing hardware.
  5465.  *)
  5466.   DDVP_HARDWAREDEINTERLACE              = $00008000;
  5467.  
  5468. (****************************************************************************
  5469.  *
  5470.  * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
  5471.  *
  5472.  ****************************************************************************)
  5473.  
  5474. (*
  5475.  * Return formats for the video data
  5476.  *)
  5477.   DDVPFORMAT_VIDEO = $00000001;
  5478.  
  5479. (*
  5480.  * Return formats for the VBI data
  5481.  *)
  5482.   DDVPFORMAT_VBI = $00000002;
  5483.  
  5484. (****************************************************************************
  5485.  *
  5486.  * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
  5487.  *
  5488.  ****************************************************************************)
  5489.  
  5490. (*
  5491.  * Surface should receive video data (and VBI data if a surface
  5492.  * is not explicitly attached for that purpose)
  5493.  *)
  5494.   DDVPTARGET_VIDEO = $00000001;
  5495.  
  5496. (*
  5497.  * Surface should receive VBI data
  5498.  *)
  5499.   DDVPTARGET_VBI = $00000002;
  5500.  
  5501. (****************************************************************************
  5502.  *
  5503.  * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
  5504.  *
  5505.  ****************************************************************************)
  5506.  
  5507. (*
  5508.  * Waits until the beginning of the next VSYNC
  5509.  *)
  5510.   DDVPWAIT_BEGIN = $00000001;
  5511.  
  5512. (*
  5513.  * Waits until the end of the next/current VSYNC
  5514.  *)
  5515.   DDVPWAIT_END = $00000002;
  5516.  
  5517. (*
  5518.  * Waits until the beginning of the specified line
  5519.  *)
  5520.   DDVPWAIT_LINE = $00000003;
  5521.  
  5522. (****************************************************************************
  5523.  *
  5524.  * DIRECTDRAWVIDEOPORT FLIP FLAGS
  5525.  *
  5526.  ****************************************************************************)
  5527.  
  5528. (*
  5529.  * Flips the normal video surface
  5530.  *)
  5531.   DDVPFLIP_VIDEO = $00000001;
  5532.  
  5533. (*
  5534.  * Flips the VBI surface
  5535.  *)
  5536.   DDVPFLIP_VBI = $00000002;
  5537.  
  5538. (****************************************************************************
  5539.  *
  5540.  * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
  5541.  *
  5542.  ****************************************************************************)
  5543.  
  5544. (*
  5545.  * No video signal is present at the video port
  5546.  *)
  5547.   DDVPSQ_NOSIGNAL = $00000001;
  5548.  
  5549. (*
  5550.  * A valid video signal is present at the video port
  5551.  *)
  5552.   DDVPSQ_SIGNALOK = $00000002;
  5553.  
  5554. (****************************************************************************
  5555.  *
  5556.  * VIDEOPORTBANDWIDTH Flags
  5557.  *
  5558.  ****************************************************************************)
  5559.  
  5560. (*
  5561.  * The specified height/width refer to the size of the video port data
  5562.  * written into memory, after prescaling has occured.
  5563.  *)
  5564.   DDVPB_VIDEOPORT = $00000001;
  5565.  
  5566. (*
  5567.  * The specified height/width refer to the source size of the overlay.
  5568.  *)
  5569.   DDVPB_OVERLAY = $00000002;
  5570.  
  5571. (*
  5572.  * This is a query for the device to return which caps this device requires.
  5573.  *)
  5574.   DDVPB_TYPE = $00000004;
  5575.  
  5576. (****************************************************************************
  5577.  *
  5578.  * VIDEOPORTBANDWIDTH Caps
  5579.  *
  5580.  ****************************************************************************)
  5581.  
  5582. (*
  5583.  * The bandwidth for this device is dependant on the overlay source size.
  5584.  *)
  5585.   DDVPBCAPS_SOURCE = $00000001;
  5586.  
  5587. (*
  5588.  * The bandwidth for this device is dependant on the overlay destination
  5589.  * size.
  5590.  *)
  5591.   DDVPBCAPS_DESTINATION = $00000002;
  5592.  
  5593. (****************************************************************************
  5594.  *
  5595.  * DDVIDEOPORTCONTAINER CreateVideoPort flags
  5596.  *
  5597.  ****************************************************************************)
  5598.  
  5599. (*
  5600.  * The process only wants to control the VBI portion of the video stream.
  5601.  *)
  5602.   DDVPCREATE_VBIONLY                    = $00000001;
  5603.  
  5604. (*
  5605.  * The process only wants to control the non-VBI (video) portion of
  5606.  * the video stream.
  5607.  *)
  5608.   DDVPCREATE_VIDEOONLY                  = $00000002;
  5609.  
  5610. (****************************************************************************
  5611.  *
  5612.  * DDVIDEOPORTSTATUS flags
  5613.  *
  5614.  ****************************************************************************)
  5615.  
  5616. (*
  5617.  * The video port interface is only controlling the VBI portion of the
  5618.  * video stream
  5619.  *)
  5620.   DDVPSTATUS_VBIONLY                    = $00000001;
  5621.  
  5622. (*
  5623.  * The video port interface is only controlling the video portion of the
  5624.  * video stream
  5625.  *)
  5626.   DDVPSTATUS_VIDEOONLY                  = $00000002;
  5627.  
  5628.  
  5629. type
  5630. (*
  5631.  * API's
  5632.  *)
  5633.  
  5634.   TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps;
  5635.       lpContext: Pointer) : HResult; stdcall;
  5636.  
  5637. (*
  5638.  * INTERACES FOLLOW:
  5639.  *      IDirectDrawVideoPort
  5640.  *      IVideoPort
  5641.  *)
  5642.  
  5643.  
  5644. (*
  5645.  * IDirectDrawVideoPort
  5646.  *)
  5647.   IDirectDrawVideoPort = interface (IUnknown)
  5648.     ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
  5649.     (*** IDirectDrawVideoPort methods ***)
  5650.     function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) : HResult; stdcall;
  5651.     function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat;
  5652.         dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD;
  5653.         var lpBandwidth: TDDVideoPortBandWidth) : HResult; stdcall;
  5654.     function GetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5655.     function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
  5656.         TDDPixelFormat; dwFlags: DWORD) : HResult; stdcall;
  5657.     function GetOutputFormats(var lpInputFormat: TDDPixelFormat;
  5658.         var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD)
  5659.         : HResult; stdcall;
  5660.     function GetFieldPolarity(var lpbVideoField: BOOL) : HResult; stdcall;
  5661.     function GetVideoLine(var lpdwLine: DWORD) : HResult; stdcall;
  5662.     function GetVideoSignalStatus(varlpdwStatus: DWORD) : HResult; stdcall;
  5663.     function SetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5664.     function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) :
  5665.         HResult; stdcall;
  5666.     function StartVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5667.     function StopVideo: HResult; stdcall;
  5668.     function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5669.     function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD) :
  5670.         HResult; stdcall;
  5671.   end;
  5672.  
  5673. (*
  5674.  * IDirectDrawVideoPortContainer
  5675.  *)
  5676.   IDDVideoPortContainer = interface (IUnknown)
  5677.     ['{6C142760-A733-11CE-A521-0020AF0BE560}']
  5678.     (*** IDDVideoPortContainer methods ***)
  5679.     function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc:
  5680.         TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort;
  5681.         pUnkOuter: IUnknown) : HResult; stdcall;
  5682.     function EnumVideoPorts(dwFlags: DWORD;
  5683.         lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer;
  5684.         lpEnumVideoCallback: TDDEnumVideoCallback) : HResult; stdcall;
  5685.     function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
  5686.         lpConnectInfo: PDDVideoPortConnect) : HResult; stdcall;
  5687.     function QueryVideoPortStatus(dwPortId: DWORD;
  5688.         var lpVPStatus: TDDVideoPortStatus) : HResult; stdcall;
  5689.   end;
  5690.  
  5691.   IID_IDDVideoPortContainer = IDDVideoPortContainer;
  5692.   IID_IDirectDrawVideoPort = IDirectDrawVideoPort;
  5693.  
  5694.  
  5695. //Direct3D file
  5696. (*==========================================================================;
  5697.  *
  5698.  *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
  5699.  *
  5700.  *  Files:   d3dtypes.h d3dcaps.h d3d.h
  5701.  *
  5702.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  5703.  *
  5704.  *  Modyfied: 26-Jun-2000
  5705.  *
  5706.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  5707.  *  E-Mail: DelphiDirectX@next-reality.com
  5708.  *
  5709.  ***************************************************************************)
  5710.  
  5711. (* TD3DValue is the fundamental Direct3D fractional data type *)
  5712.  
  5713. type
  5714.   TRefClsID = TGUID;
  5715.  
  5716. type
  5717.   TD3DValue = Single;
  5718.   TD3DFixed = LongInt;
  5719.   float = TD3DValue;
  5720.   PD3DColor = ^TD3DColor;
  5721.   TD3DColor = DWORD;
  5722.  
  5723. function D3DVal(val: variant) : float;
  5724. function D3DDivide(a,b: double) : float;
  5725. function D3DMultiply(a,b: double) : float;
  5726.  
  5727. (*
  5728.  * Format of CI colors is
  5729.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5730.  *  |    alpha      |         color index           |   fraction    |
  5731.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5732.  *)
  5733.  
  5734. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  5735. function CI_GETALPHA(ci: DWORD) : DWORD;
  5736.  
  5737. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  5738. function CI_GETINDEX(ci: DWORD) : DWORD;
  5739.  
  5740. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  5741. function CI_GETFRACTION(ci: DWORD) : DWORD;
  5742.  
  5743. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  5744. function CI_ROUNDINDEX(ci: DWORD) : DWORD;
  5745.  
  5746. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  5747. function CI_MASKALPHA(ci: DWORD) : DWORD;
  5748.  
  5749. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  5750. function CI_MAKE(a,i,f: DWORD) : DWORD;
  5751.  
  5752. (*
  5753.  * Format of RGBA colors is
  5754.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5755.  *  |    alpha      |      red      |     green     |     blue      |
  5756.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5757.  *)
  5758.  
  5759. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  5760. function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
  5761.  
  5762. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  5763. function RGBA_GETRED(rgb: TD3DColor) : DWORD;
  5764.  
  5765. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  5766. function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
  5767.  
  5768. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  5769. function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
  5770.  
  5771. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  5772. function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
  5773.  
  5774. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  5775.  * The float values must be in the range 0..1
  5776.  *)
  5777.  
  5778. // #define D3DRGB(r, g, b) \
  5779. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  5780. function D3DRGB(r, g, b: float) : TD3DColor;
  5781.  
  5782. // #define D3DRGBA(r, g, b, a) \
  5783. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  5784. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  5785. //    )
  5786. function D3DRGBA(r, g, b, a: float) : TD3DColor;
  5787.  
  5788. (*
  5789.  * Format of RGB colors is
  5790.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5791.  *  |    ignored    |      red      |     green     |     blue      |
  5792.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5793.  *)
  5794.  
  5795. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  5796. function RGB_GETRED(rgb: TD3DColor) : DWORD;
  5797.  
  5798. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  5799. function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
  5800.  
  5801. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  5802. function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
  5803.  
  5804. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  5805. function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
  5806.  
  5807. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  5808. function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
  5809.  
  5810. // #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
  5811. function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
  5812.  
  5813. // #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
  5814. function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
  5815.  
  5816. (*
  5817.  * Flags for Enumerate functions
  5818.  *)
  5819. const
  5820.  
  5821. (*
  5822.  * Stop the enumeration
  5823.  *)
  5824.  
  5825.   D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
  5826.  
  5827. (*
  5828.  * Continue the enumeration
  5829.  *)
  5830.  
  5831.   D3DENUMRET_OK                            = DDENUMRET_OK;
  5832.  
  5833. type
  5834.   TD3DValidateCallback = function (lpUserArg: Pointer;
  5835.       dwOffset: DWORD): HResult; stdcall;
  5836.   TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
  5837.       lpContext: Pointer): HResult; stdcall;
  5838.   TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
  5839.       lpContext: Pointer): HResult; stdcall;
  5840.  
  5841.  
  5842.   PD3DMaterialHandle = ^TD3DMaterialHandle;
  5843.   TD3DMaterialHandle = DWORD;
  5844.  
  5845.   PD3DTextureHandle = ^TD3DTextureHandle;
  5846.   TD3DTextureHandle = DWORD;
  5847.  
  5848.   PD3DMatrixHandle = ^TD3DMatrixHandle;
  5849.   TD3DMatrixHandle = DWORD;
  5850.  
  5851.   PD3DColorValue = ^TD3DColorValue;
  5852.   TD3DColorValue = packed record
  5853.     case Integer of
  5854.     0: (
  5855.       r: TD3DValue;
  5856.       g: TD3DValue;
  5857.       b: TD3DValue;
  5858.       a: TD3DValue;
  5859.      );
  5860.     1: (
  5861.       dvR: TD3DValue;
  5862.       dvG: TD3DValue;
  5863.       dvB: TD3DValue;
  5864.       dvA: TD3DValue;
  5865.      );
  5866.   end;
  5867.  
  5868.   PD3DRect = ^TD3DRect;
  5869.   TD3DRect = packed record
  5870.     case Integer of
  5871.     0: (
  5872.       x1: LongInt;
  5873.       y1: LongInt;
  5874.       x2: LongInt;
  5875.       y2: LongInt;
  5876.      );
  5877.     1: (
  5878.       lX1: LongInt;
  5879.       lY1: LongInt;
  5880.       lX2: LongInt;
  5881.       lY2: LongInt;
  5882.      );
  5883.      2: (
  5884.        a: array[0..3] of LongInt;
  5885.      );
  5886.   end;
  5887.  
  5888.   PD3DVector = ^TD3DVector;
  5889.   TD3DVector = packed record
  5890.     case Integer of
  5891.     0: (
  5892.       x: TD3DValue;
  5893.       y: TD3DValue;
  5894.       z: TD3DValue;
  5895.      );
  5896.     1: (
  5897.       dvX: TD3DValue;
  5898.       dvY: TD3DValue;
  5899.       dvZ: TD3DValue;
  5900.      );
  5901.   end;
  5902.  
  5903. (******************************************************************
  5904.  *                                                                *
  5905.  *   D3DVec.inl                                                   *
  5906.  *                                                                *
  5907.  *   Float-valued 3D vector class for Direct3D.                   *
  5908.  *                                                                *
  5909.  *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
  5910.  *                                                                *
  5911.  ******************************************************************)
  5912.  
  5913.     // Addition and subtraction
  5914.   function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
  5915.   function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
  5916.     // Scalar multiplication and division
  5917.   function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5918.   function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5919.     // Memberwise multiplication and division
  5920.   function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
  5921.   function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
  5922.     // Vector dominance
  5923.   function VectorSmaller(v1, v2: TD3DVector) : boolean;
  5924.   function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  5925.     // Bitwise equality
  5926.   function VectorEquel(v1, v2: TD3DVector) : boolean;
  5927.     // Length-related functions
  5928.   function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  5929.   function VectorMagnitude(v: TD3DVector) : TD3DValue;
  5930.     // Returns vector with same direction and unit length
  5931.   function VectorNormalize(const v: TD3DVector) : TD3DVector;
  5932.     // Return min/max component of the input vector
  5933.   function VectorMin(v: TD3DVector) : TD3DValue;
  5934.   function VectorMax(v: TD3DVector) : TD3DValue;
  5935.     // Return memberwise min/max of input vectors
  5936.   function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
  5937.   function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
  5938.     // Dot and cross product
  5939.   function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  5940.   function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
  5941.  
  5942. type
  5943. (*
  5944.  * Vertex data types supported in an ExecuteBuffer.
  5945.  *)
  5946.  
  5947. (*
  5948.  * Homogeneous vertices
  5949.  *)
  5950.  
  5951.   PD3DHVertex = ^TD3DHVertex;
  5952.   TD3DHVertex = packed record
  5953.     dwFlags: DWORD;        (* Homogeneous clipping flags *)
  5954.     case Integer of
  5955.     0: (
  5956.       hx: TD3DValue;
  5957.       hy: TD3DValue;
  5958.       hz: TD3DValue;
  5959.      );
  5960.     1: (
  5961.       dvHX: TD3DValue;
  5962.       dvHY: TD3DValue;
  5963.       dvHZ: TD3DValue;
  5964.      );
  5965.   end;
  5966.  
  5967. (*
  5968.  * Transformed/lit vertices
  5969.  *)
  5970.  
  5971.   PD3DTLVertex = ^TD3DTLVertex;
  5972.   TD3DTLVertex = packed record
  5973.     case Integer of
  5974.     0: (
  5975.       sx: TD3DValue;             (* Screen coordinates *)
  5976.       sy: TD3DValue;
  5977.       sz: TD3DValue;
  5978.       rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
  5979.       color: TD3DColor;          (* Vertex color *)
  5980.       specular: TD3DColor;       (* Specular component of vertex *)
  5981.       tu: TD3DValue;             (* Texture coordinates *)
  5982.       tv: TD3DValue;
  5983.      );
  5984.     1: (
  5985.       dvSX: TD3DValue;
  5986.       dvSY: TD3DValue;
  5987.       dvSZ: TD3DValue;
  5988.       dvRHW: TD3DValue;
  5989.       dcColor: TD3DColor;
  5990.       dcSpecular: TD3DColor;
  5991.       dvTU: TD3DValue;
  5992.       dvTV: TD3DValue;
  5993.      );
  5994.   end;
  5995.  
  5996. (*
  5997.  * Untransformed/lit vertices
  5998.  *)
  5999.  
  6000.   PD3DLVertex = ^TD3DLVertex;
  6001.   TD3DLVertex = packed record
  6002.     case Integer of
  6003.     0: (
  6004.       x: TD3DValue;             (* Homogeneous coordinates *)
  6005.       y: TD3DValue;
  6006.       z: TD3DValue;
  6007.       dwReserved: DWORD;
  6008.       color: TD3DColor;         (* Vertex color *)
  6009.       specular: TD3DColor;      (* Specular component of vertex *)
  6010.       tu: TD3DValue;            (* Texture coordinates *)
  6011.       tv: TD3DValue;
  6012.      );
  6013.     1: (
  6014.       dvX: TD3DValue;
  6015.       dvY: TD3DValue;
  6016.       dvZ: TD3DValue;
  6017.       UNIONFILLER1d: DWORD;
  6018.       dcColor: TD3DColor;
  6019.       dcSpecular: TD3DColor;
  6020.       dvTU: TD3DValue;
  6021.       dvTV: TD3DValue;
  6022.      );
  6023.   end;
  6024.  
  6025. (*
  6026.  * Untransformed/unlit vertices
  6027.  *)
  6028.  
  6029.   PD3DVertex = ^TD3DVertex;
  6030.   TD3DVertex = packed record
  6031.     case Integer of
  6032.     0: (
  6033.       x: TD3DValue;             (* Homogeneous coordinates *)
  6034.       y: TD3DValue;
  6035.       z: TD3DValue;
  6036.       nx: TD3DValue;            (* Normal *)
  6037.       ny: TD3DValue;
  6038.       nz: TD3DValue;
  6039.       tu: TD3DValue;            (* Texture coordinates *)
  6040.       tv: TD3DValue;
  6041.      );
  6042.     1: (
  6043.       dvX: TD3DValue;
  6044.       dvY: TD3DValue;
  6045.       dvZ: TD3DValue;
  6046.       dvNX: TD3DValue;
  6047.       dvNY: TD3DValue;
  6048.       dvNZ: TD3DValue;
  6049.       dvTU: TD3DValue;
  6050.       dvTV: TD3DValue;
  6051.      );
  6052.   end;
  6053.  
  6054. (*
  6055.  * Matrix, viewport, and tranformation structures and definitions.
  6056.  *)
  6057.  
  6058.   PD3DMatrix = ^TD3DMatrix;
  6059.   TD3DMatrix = packed record
  6060.     case integer of
  6061.       0 : (_11, _12, _13, _14: TD3DValue;
  6062.            _21, _22, _23, _24: TD3DValue;
  6063.            _31, _32, _33, _34: TD3DValue;
  6064.            _41, _42, _43, _44: TD3DValue);
  6065.       1 : (m : array [0..3, 0..3] of TD3DValue);
  6066.   end;
  6067.  
  6068.   PD3DViewport = ^TD3DViewport;
  6069.   TD3DViewport = packed record
  6070.     dwSize: DWORD;
  6071.     dwX: DWORD;
  6072.     dwY: DWORD;                (* Top left *)
  6073.     dwWidth: DWORD;
  6074.     dwHeight: DWORD;           (* Dimensions *)
  6075.     dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
  6076.     dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
  6077.     dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
  6078.     dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
  6079.     dvMinZ: TD3DValue;
  6080.     dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
  6081.   end;
  6082.  
  6083.   PD3DViewport2 = ^TD3DViewport2;
  6084.   TD3DViewport2 = packed record
  6085.     dwSize: DWORD;
  6086.     dwX: DWORD;
  6087.     dwY: DWORD;                (* Viewport Top left *)
  6088.     dwWidth: DWORD;
  6089.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6090.     dvClipX: TD3DValue;        (* Top left of clip volume *)
  6091.     dvClipY: TD3DValue;
  6092.     dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
  6093.     dvClipHeight: TD3DValue;
  6094.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6095.     dvMaxZ: TD3DValue;
  6096.   end;
  6097.  
  6098.   PD3DViewport7 = ^TD3DViewport7;
  6099.   TD3DViewport7 = packed record
  6100.     dwX: DWORD;
  6101.     dwY: DWORD;                (* Viewport Top left *)
  6102.     dwWidth: DWORD;
  6103.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6104.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6105.     dvMaxZ: TD3DValue;
  6106.   end;
  6107.  
  6108. (*
  6109.  * Values for clip fields.
  6110.  *)
  6111.  
  6112. const
  6113. // Max number of user clipping planes, supported in D3D.
  6114.   D3DMAXUSERCLIPPLANES  = 32;
  6115.  
  6116. // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
  6117. //
  6118.   D3DCLIPPLANE0 = (1 shl 0);
  6119.   D3DCLIPPLANE1 = (1 shl 1);
  6120.   D3DCLIPPLANE2 = (1 shl 2);
  6121.   D3DCLIPPLANE3 = (1 shl 3);
  6122.   D3DCLIPPLANE4 = (1 shl 4);
  6123.   D3DCLIPPLANE5 = (1 shl 5);
  6124.  
  6125. const
  6126.   D3DCLIP_LEFT                            = $00000001;
  6127.   D3DCLIP_RIGHT                           = $00000002;
  6128.   D3DCLIP_TOP                             = $00000004;
  6129.   D3DCLIP_BOTTOM                          = $00000008;
  6130.   D3DCLIP_FRONT                           = $00000010;
  6131.   D3DCLIP_BACK                            = $00000020;
  6132.   D3DCLIP_GEN0                            = $00000040;
  6133.   D3DCLIP_GEN1                            = $00000080;
  6134.   D3DCLIP_GEN2                            = $00000100;
  6135.   D3DCLIP_GEN3                            = $00000200;
  6136.   D3DCLIP_GEN4                            = $00000400;
  6137.   D3DCLIP_GEN5                            = $00000800;
  6138.  
  6139. (*
  6140.  * Values for d3d status.
  6141.  *)
  6142.  
  6143.   D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
  6144.   D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
  6145.   D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
  6146.   D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
  6147.   D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
  6148.   D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
  6149.   D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
  6150.   D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
  6151.   D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
  6152.   D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
  6153.   D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
  6154.   D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
  6155.  
  6156.   D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
  6157.   D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
  6158.   D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
  6159.   D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
  6160.   D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
  6161.   D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
  6162.   D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
  6163.   D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
  6164.   D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
  6165.   D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
  6166.   D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
  6167.   D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
  6168.   D3DSTATUS_ZNOTVISIBLE                   = $01000000;
  6169. (* Do not use 0x80000000 for any status flags in future as it is reserved *)
  6170.  
  6171.   D3DSTATUS_CLIPUNIONALL = (
  6172.             D3DSTATUS_CLIPUNIONLEFT or
  6173.             D3DSTATUS_CLIPUNIONRIGHT or
  6174.             D3DSTATUS_CLIPUNIONTOP or
  6175.             D3DSTATUS_CLIPUNIONBOTTOM or
  6176.             D3DSTATUS_CLIPUNIONFRONT or
  6177.             D3DSTATUS_CLIPUNIONBACK or
  6178.             D3DSTATUS_CLIPUNIONGEN0 or
  6179.             D3DSTATUS_CLIPUNIONGEN1 or
  6180.             D3DSTATUS_CLIPUNIONGEN2 or
  6181.             D3DSTATUS_CLIPUNIONGEN3 or
  6182.             D3DSTATUS_CLIPUNIONGEN4 or
  6183.             D3DSTATUS_CLIPUNIONGEN5);
  6184.  
  6185.   D3DSTATUS_CLIPINTERSECTIONALL = (
  6186.             D3DSTATUS_CLIPINTERSECTIONLEFT or
  6187.             D3DSTATUS_CLIPINTERSECTIONRIGHT or
  6188.             D3DSTATUS_CLIPINTERSECTIONTOP or
  6189.             D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  6190.             D3DSTATUS_CLIPINTERSECTIONFRONT or
  6191.             D3DSTATUS_CLIPINTERSECTIONBACK or
  6192.             D3DSTATUS_CLIPINTERSECTIONGEN0 or
  6193.             D3DSTATUS_CLIPINTERSECTIONGEN1 or
  6194.             D3DSTATUS_CLIPINTERSECTIONGEN2 or
  6195.             D3DSTATUS_CLIPINTERSECTIONGEN3 or
  6196.             D3DSTATUS_CLIPINTERSECTIONGEN4 or
  6197.             D3DSTATUS_CLIPINTERSECTIONGEN5);
  6198.  
  6199.   D3DSTATUS_DEFAULT = (
  6200.             D3DSTATUS_CLIPINTERSECTIONALL or
  6201.             D3DSTATUS_ZNOTVISIBLE);
  6202.  
  6203. (*
  6204.  * Options for direct transform calls
  6205.  *)
  6206.  
  6207.   D3DTRANSFORM_CLIPPED       = $00000001;
  6208.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  6209.  
  6210. type
  6211.   PD3DTransformData = ^TD3DTransformData;
  6212.   TD3DTransformData = packed record
  6213.     dwSize: DWORD;
  6214.     lpIn: Pointer;             (* Input vertices *)
  6215.     dwInSize: DWORD;           (* Stride of input vertices *)
  6216.     lpOut: Pointer;            (* Output vertices *)
  6217.     dwOutSize: DWORD;          (* Stride of output vertices *)
  6218.     lpHOut: ^TD3DHVertex;       (* Output homogeneous vertices *)
  6219.     dwClip: DWORD;             (* Clipping hint *)
  6220.     dwClipIntersection: DWORD;
  6221.     dwClipUnion: DWORD;        (* Union of all clip flags *)
  6222.     drExtent: TD3DRect;         (* Extent of transformed vertices *)
  6223.   end;
  6224.  
  6225. (*
  6226.  * Structure defining position and direction properties for lighting.
  6227.  *)
  6228.  
  6229.   PD3DLightingElement = ^TD3DLightingElement;
  6230.   TD3DLightingElement = packed record
  6231.     dvPosition: TD3DVector;           (* Lightable point in model space *)
  6232.     dvNormal: TD3DVector;             (* Normalised unit vector *)
  6233.   end;
  6234.  
  6235. (*
  6236.  * Structure defining material properties for lighting.
  6237.  *)
  6238.  
  6239.   PD3DMaterial = ^TD3DMaterial;
  6240.   TD3DMaterial = packed record
  6241.     dwSize: DWORD;
  6242.     case Integer of
  6243.     0: (
  6244.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6245.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6246.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6247.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6248.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6249.       hTexture: TD3DTextureHandle;    (* Handle to texture map *)
  6250.       dwRampSize: DWORD;
  6251.      );
  6252.     1: (
  6253.       dcvDiffuse: TD3DColorValue;
  6254.       dcvAmbient: TD3DColorValue;
  6255.       dcvSpecular: TD3DColorValue;
  6256.       dcvEmissive: TD3DColorValue;
  6257.       dvPower: TD3DValue;
  6258.      );
  6259.   end;
  6260.  
  6261.   PD3DMaterial7 = ^TD3DMaterial7;
  6262.   TD3DMaterial7 = packed record
  6263.     case Integer of
  6264.     0: (
  6265.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6266.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6267.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6268.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6269.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6270.      );
  6271.     1: (
  6272.       dcvDiffuse: TD3DColorValue;
  6273.       dcvAmbient: TD3DColorValue;
  6274.       dcvSpecular: TD3DColorValue;
  6275.       dcvEmissive: TD3DColorValue;
  6276.       dvPower: TD3DValue;
  6277.      );
  6278.   end;
  6279.  
  6280.   PD3DLightType = ^TD3DLightType;
  6281.   TD3DLightType = (
  6282.     D3DLIGHT_INVALID_0,
  6283.     D3DLIGHT_POINT,
  6284.     D3DLIGHT_SPOT,
  6285.     D3DLIGHT_DIRECTIONAL,
  6286. // Note: The following light type (D3DLIGHT_PARALLELPOINT)
  6287. // is no longer supported from D3D for DX7 onwards.
  6288.     D3DLIGHT_PARALLELPOINT,
  6289.     D3DLIGHT_GLSPOT);
  6290.  
  6291. (*
  6292.  * Structure defining a light source and its properties.
  6293.  *)
  6294.  
  6295.   PD3DLight = ^TD3DLight;
  6296.   TD3DLight = packed record
  6297.     dwSize: DWORD;
  6298.     dltType: TD3DLightType;     (* Type of light source *)
  6299.     dcvColor: TD3DColorValue;   (* Color of light *)
  6300.     dvPosition: TD3DVector;     (* Position in world space *)
  6301.     dvDirection: TD3DVector;    (* Direction in world space *)
  6302.     dvRange: TD3DValue;         (* Cutoff range *)
  6303.     dvFalloff: TD3DValue;       (* Falloff *)
  6304.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6305.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6306.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6307.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6308.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6309.   end;
  6310.  
  6311.   PD3DLight7 = ^TD3DLight7;
  6312.   TD3DLight7 = packed record
  6313.     dltType: TD3DLightType;     (* Type of light source *)
  6314.     dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
  6315.     dcvSpecular: TD3DColorValue;(* Specular color of light *)
  6316.     dcvAmbient: TD3DColorValue; (* Ambient color of light *)
  6317.     dvPosition: TD3DVector;     (* Position in world space *)
  6318.     dvDirection: TD3DVector;    (* Direction in world space *)
  6319.     dvRange: TD3DValue;         (* Cutoff range *)
  6320.     dvFalloff: TD3DValue;       (* Falloff *)
  6321.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6322.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6323.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6324.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6325.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6326.   end;
  6327.  
  6328. (*
  6329.  * Structure defining a light source and its properties.
  6330.  *)
  6331.  
  6332. (* flags bits *)
  6333. const
  6334.   D3DLIGHT_ACTIVE                       = $00000001;
  6335.   D3DLIGHT_NO_SPECULAR  = $00000002;
  6336.   D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
  6337.  
  6338. (* maximum valid light range *)
  6339.   D3DLIGHT_RANGE_MAX            = 1.8439088915e+18; //sqrt(FLT_MAX);
  6340.  
  6341. type
  6342.   PD3DLight2 = ^TD3DLight2;
  6343.   TD3DLight2 = packed record
  6344.     dwSize: DWORD;
  6345.     dltType: TD3DLightType;     (* Type of light source *)
  6346.     dcvColor: TD3DColorValue;   (* Color of light *)
  6347.     dvPosition: TD3DVector;     (* Position in world space *)
  6348.     dvDirection: TD3DVector;    (* Direction in world space *)
  6349.     dvRange: TD3DValue;         (* Cutoff range *)
  6350.     dvFalloff: TD3DValue;       (* Falloff *)
  6351.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6352.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6353.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6354.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6355.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6356.     dwFlags: DWORD;
  6357.   end;
  6358.  
  6359.   PD3DLightData = ^TD3DLightData;
  6360.   TD3DLightData = packed record
  6361.     dwSize: DWORD;
  6362.     lpIn: ^TD3DLightingElement;   (* Input positions and normals *)
  6363.     dwInSize: DWORD;             (* Stride of input elements *)
  6364.     lpOut: ^TD3DTLVertex;         (* Output colors *)
  6365.     dwOutSize: DWORD;            (* Stride of output colors *)
  6366.   end;
  6367.  
  6368. (*
  6369.  * Before DX5, these values were in an enum called
  6370.  * TD3DColorModel. This was not correct, since they are
  6371.  * bit flags. A driver can surface either or both flags
  6372.  * in the dcmColorModel member of D3DDEVICEDESC.
  6373.  *)
  6374.  
  6375. type
  6376.   TD3DColorModel = DWORD;
  6377.  
  6378. const
  6379.   D3DCOLOR_MONO = 1;
  6380.   D3DCOLOR_RGB  = 2;
  6381.  
  6382. (*
  6383.  * Options for clearing
  6384.  *)
  6385.  
  6386. const
  6387.   D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
  6388.   D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
  6389.   D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
  6390.  
  6391. (*
  6392.  * Execute buffers are allocated via Direct3D.  These buffers may then
  6393.  * be filled by the application with instructions to execute along with
  6394.  * vertex data.
  6395.  *)
  6396.  
  6397. (*
  6398.  * Supported op codes for execute instructions.
  6399.  *)
  6400.  
  6401. type
  6402.   PD3DOpcode = ^TD3DOpcode;
  6403.   TD3DOpcode = (
  6404.     D3DOP_INVALID_0,
  6405.     D3DOP_POINT,
  6406.     D3DOP_LINE,
  6407.     D3DOP_TRIANGLE,
  6408.     D3DOP_MATRIXLOAD,
  6409.     D3DOP_MATRIXMULTIPLY,
  6410.     D3DOP_STATETRANSFORM,
  6411.     D3DOP_STATELIGHT,
  6412.     D3DOP_STATERENDER,
  6413.     D3DOP_PROCESSVERTICES,
  6414.     D3DOP_TEXTURELOAD,
  6415.     D3DOP_EXIT,
  6416.     D3DOP_BRANCHFORWARD,
  6417.     D3DOP_SPAN,
  6418.     D3DOP_SETSTATUS);
  6419.  
  6420.   PD3DInstruction = ^TD3DInstruction;
  6421.   TD3DInstruction = packed record
  6422.     bOpcode: BYTE;   (* Instruction opcode *)
  6423.     bSize: BYTE;     (* Size of each instruction data unit *)
  6424.     wCount: WORD;    (* Count of instruction data units to follow *)
  6425.   end;
  6426.  
  6427. (*
  6428.  * Structure for texture loads
  6429.  *)
  6430.  
  6431.   PD3DTextureLoad = ^TD3DTextureLoad;
  6432.   TD3DTextureLoad = packed record
  6433.     hDestTexture: TD3DTextureHandle;
  6434.     hSrcTexture: TD3DTextureHandle;
  6435.   end;
  6436.  
  6437. (*
  6438.  * Structure for picking
  6439.  *)
  6440.  
  6441.   PD3DPickRecord = ^TD3DPickRecord;
  6442.   TD3DPickRecord = packed record
  6443.     bOpcode: BYTE;
  6444.     bPad: BYTE;
  6445.     dwOffset: DWORD;
  6446.     dvZ: TD3DValue;
  6447.   end;
  6448.  
  6449. (*
  6450.  * The following defines the rendering states which can be set in the
  6451.  * execute buffer.
  6452.  *)
  6453.  
  6454.   PD3DShadeMode = ^TD3DShadeMode;
  6455.   TD3DShadeMode = (
  6456.     D3DSHADE_INVALID_0,
  6457.     D3DSHADE_FLAT,
  6458.     D3DSHADE_GOURAUD,
  6459.     D3DSHADE_PHONG);
  6460.  
  6461.   PD3DFillMode = ^TD3DFillMode;
  6462.   TD3DFillMode = (
  6463.     D3DFILL_INVALID_0,
  6464.     D3DFILL_POINT,
  6465.     D3DFILL_WIREFRAME,
  6466.     D3DFILL_SOLID);
  6467.  
  6468.   PD3DLinePattern = ^TD3DLinePattern;
  6469.   TD3DLinePattern = packed record
  6470.     wRepeatFactor: WORD;
  6471.     wLinePattern: WORD;
  6472.   end;
  6473.  
  6474.   PD3DTextureFilter = ^TD3DTextureFilter;
  6475.   TD3DTextureFilter = (
  6476.     D3DFILTER_INVALID_0,
  6477.     D3DFILTER_NEAREST,
  6478.     D3DFILTER_LINEAR,
  6479.     D3DFILTER_MIPNEAREST,
  6480.     D3DFILTER_MIPLINEAR,
  6481.     D3DFILTER_LINEARMIPNEAREST,
  6482.     D3DFILTER_LINEARMIPLINEAR);
  6483.  
  6484.   PD3DBlend = ^TD3DBlend;
  6485.   TD3DBlend = (
  6486.     D3DBLEND_INVALID_0,
  6487.     D3DBLEND_ZERO,
  6488.     D3DBLEND_ONE,
  6489.     D3DBLEND_SRCCOLOR,
  6490.     D3DBLEND_INVSRCCOLOR,
  6491.     D3DBLEND_SRCALPHA,
  6492.     D3DBLEND_INVSRCALPHA,
  6493.     D3DBLEND_DESTALPHA,
  6494.     D3DBLEND_INVDESTALPHA,
  6495.     D3DBLEND_DESTCOLOR,
  6496.     D3DBLEND_INVDESTCOLOR,
  6497.     D3DBLEND_SRCALPHASAT,
  6498.     D3DBLEND_BOTHSRCALPHA,
  6499.     D3DBLEND_BOTHINVSRCALPHA);
  6500.  
  6501.   PD3DTextureBlend = ^TD3DTextureBlend;
  6502.   TD3DTextureBlend = (
  6503.     D3DTBLEND_INVALID_0,
  6504.     D3DTBLEND_DECAL,
  6505.     D3DTBLEND_MODULATE,
  6506.     D3DTBLEND_DECALALPHA,
  6507.     D3DTBLEND_MODULATEALPHA,
  6508.     D3DTBLEND_DECALMASK,
  6509.     D3DTBLEND_MODULATEMASK,
  6510.     D3DTBLEND_COPY,
  6511.     D3DTBLEND_ADD);
  6512.  
  6513.   PD3DTextureAddress = ^TD3DTextureAddress;
  6514.   TD3DTextureAddress = (
  6515.     D3DTADDRESS_INVALID_0,
  6516.     D3DTADDRESS_WRAP,
  6517.     D3DTADDRESS_MIRROR,
  6518.     D3DTADDRESS_CLAMP,
  6519.     D3DTADDRESS_BORDER);
  6520.  
  6521.   PD3DCull = ^TD3DCull;
  6522.   TD3DCull = (
  6523.     D3DCULL_INVALID_0,
  6524.     D3DCULL_NONE,
  6525.     D3DCULL_CW,
  6526.     D3DCULL_CCW);
  6527.  
  6528.   PD3DCmpFunc = ^TD3DCmpFunc;
  6529.   TD3DCmpFunc = (
  6530.     D3DCMP_INVALID_0,
  6531.     D3DCMP_NEVER,
  6532.     D3DCMP_LESS,
  6533.     D3DCMP_EQUAL,
  6534.     D3DCMP_LESSEQUAL,
  6535.     D3DCMP_GREATER,
  6536.     D3DCMP_NOTEQUAL,
  6537.     D3DCMP_GREATEREQUAL,
  6538.     D3DCMP_ALWAYS);
  6539.  
  6540.   PD3DStencilOp = ^TD3DStencilOp;
  6541.   TD3DStencilOp = (
  6542.     D3DSTENCILOP_INVALID_0,
  6543.     D3DSTENCILOP_KEEP,
  6544.     D3DSTENCILOP_ZERO,
  6545.     D3DSTENCILOP_REPLACE,
  6546.     D3DSTENCILOP_INCRSAT,
  6547.     D3DSTENCILOP_DECRSAT,
  6548.     D3DSTENCILOP_INVERT,
  6549.     D3DSTENCILOP_INCR,
  6550.     D3DSTENCILOP_DECR);
  6551.    
  6552.   PD3DFogMode = ^TD3DFogMode;
  6553.   TD3DFogMode = (
  6554.     D3DFOG_NONE,
  6555.     D3DFOG_EXP,
  6556.     D3DFOG_EXP2,
  6557.     D3DFOG_LINEAR);
  6558.  
  6559.   PD3DZBufferType = ^TD3DZBufferType;
  6560.   TD3DZBufferType = (
  6561.     D3DZB_FALSE,
  6562.     D3DZB_TRUE,   // Z buffering
  6563.     D3DZB_USEW);  // W buffering
  6564.  
  6565.   PD3DAntialiasMode = ^TD3DAntialiasMode;
  6566.   TD3DAntialiasMode = (
  6567.     D3DANTIALIAS_NONE,
  6568.     D3DANTIALIAS_SORTDEPENDENT,
  6569.     D3DANTIALIAS_SORTINDEPENDENT);
  6570.  
  6571. // Vertex types supported by Direct3D
  6572.   PD3DVertexType = ^TD3DVertexType;
  6573.   TD3DVertexType = (
  6574.     D3DVT_INVALID_0,
  6575.     D3DVT_VERTEX,
  6576.     D3DVT_LVERTEX,
  6577.     D3DVT_TLVERTEX);
  6578.  
  6579. // Primitives supported by draw-primitive API
  6580.   PD3DPrimitiveType = ^TD3DPrimitiveType;
  6581.   TD3DPrimitiveType = (
  6582.     D3DPT_INVALID_0,
  6583.     D3DPT_POINTLIST,
  6584.     D3DPT_LINELIST,
  6585.     D3DPT_LINESTRIP,
  6586.     D3DPT_TRIANGLELIST,
  6587.     D3DPT_TRIANGLESTRIP,
  6588.     D3DPT_TRIANGLEFAN);
  6589.  
  6590. (*
  6591.  * Amount to add to a state to generate the override for that state.
  6592.  *)
  6593.  
  6594. const
  6595.   D3DSTATE_OVERRIDE_BIAS          = 256;
  6596.  
  6597. (*
  6598.  * A state which sets the override flag for the specified state type.
  6599.  *)
  6600.  
  6601. function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
  6602.  
  6603. type
  6604.   PD3DTransformStateType = ^TD3DTransformStateType;
  6605.   TD3DTransformStateType = DWORD;
  6606. const
  6607.   D3DTRANSFORMSTATE_WORLD         = 1;
  6608.   D3DTRANSFORMSTATE_VIEW          = 2;
  6609.   D3DTRANSFORMSTATE_PROJECTION    = 3;
  6610.   D3DTRANSFORMSTATE_WORLD1        = 4;  // 2nd matrix to blend
  6611.   D3DTRANSFORMSTATE_WORLD2        = 5;  // 3rd matrix to blend
  6612.   D3DTRANSFORMSTATE_WORLD3        = 6;  // 4th matrix to blend
  6613.   D3DTRANSFORMSTATE_TEXTURE0      = 16;
  6614.   D3DTRANSFORMSTATE_TEXTURE1      = 17;
  6615.   D3DTRANSFORMSTATE_TEXTURE2      = 18;
  6616.   D3DTRANSFORMSTATE_TEXTURE3      = 19;
  6617.   D3DTRANSFORMSTATE_TEXTURE4      = 20;
  6618.   D3DTRANSFORMSTATE_TEXTURE5      = 21;
  6619.   D3DTRANSFORMSTATE_TEXTURE6      = 22;
  6620.   D3DTRANSFORMSTATE_TEXTURE7      = 23;
  6621.  
  6622. type
  6623.   PD3DLightStateType = ^TD3DLightStateType;
  6624.   TD3DLightStateType = (
  6625.     D3DLIGHTSTATE_INVALID_0,
  6626.     D3DLIGHTSTATE_MATERIAL,
  6627.     D3DLIGHTSTATE_AMBIENT,
  6628.     D3DLIGHTSTATE_COLORMODEL,
  6629.     D3DLIGHTSTATE_FOGMODE,
  6630.     D3DLIGHTSTATE_FOGSTART,
  6631.     D3DLIGHTSTATE_FOGEND,
  6632.     D3DLIGHTSTATE_FOGDENSITY,
  6633.     D3DLIGHTSTATE_COLORVERTEX);
  6634.  
  6635.   PD3DRenderStateType = ^TD3DRenderStateType;
  6636.   TD3DRenderStateType = DWORD;
  6637. const
  6638.     D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
  6639.     D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
  6640.     D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
  6641.     D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
  6642.     D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
  6643.     D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
  6644.     D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
  6645.     D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
  6646.     D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
  6647.     D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
  6648.     D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
  6649.     D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
  6650.     D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
  6651.     D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
  6652.     D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
  6653.     D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
  6654.     D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
  6655.     D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
  6656.     D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
  6657.     D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
  6658.     D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
  6659.     D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
  6660.     D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
  6661.     D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
  6662.     D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
  6663.     D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
  6664.     D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
  6665.     D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
  6666.     D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
  6667.     D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
  6668.  
  6669.     D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
  6670.     D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
  6671.     D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
  6672.     D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
  6673.     D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
  6674.     D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
  6675.     D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
  6676.     D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
  6677.     D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
  6678.  
  6679.     (*
  6680.      * 128 values [128; 255] are reserved for texture coordinate wrap flags.
  6681.      * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  6682.      * a flags word preserves forward compatibility with texture coordinates
  6683.      * that are >2D.
  6684.      *)
  6685.     D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
  6686.     D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
  6687.     D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
  6688.     D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
  6689.     D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
  6690.     D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
  6691.     D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
  6692.     D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
  6693.     D3DRENDERSTATE_CLIPPING            = 136;
  6694.     D3DRENDERSTATE_LIGHTING            = 137;
  6695.     D3DRENDERSTATE_EXTENTS             = 138;
  6696.     D3DRENDERSTATE_AMBIENT             = 139;
  6697.     D3DRENDERSTATE_FOGVERTEXMODE       = 140;
  6698.     D3DRENDERSTATE_COLORVERTEX         = 141;
  6699.     D3DRENDERSTATE_LOCALVIEWER         = 142;
  6700.     D3DRENDERSTATE_NORMALIZENORMALS    = 143;
  6701.     D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
  6702.     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
  6703.     D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
  6704.     D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
  6705.     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
  6706.     D3DRENDERSTATE_VERTEXBLEND              = 151;
  6707.     D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
  6708.  
  6709. //
  6710. // retired renderstates - not supported for DX7 interfaces
  6711. //
  6712.     D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
  6713.     D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
  6714.     D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
  6715.     D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
  6716.     D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
  6717.     D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
  6718.     D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
  6719.     D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
  6720.     D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
  6721.     D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
  6722.     D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
  6723.     D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
  6724.     D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
  6725.     D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
  6726.     D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
  6727.     D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
  6728.     D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
  6729.     D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
  6730.     D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
  6731.     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
  6732.     D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
  6733.     D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
  6734.     D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
  6735.     D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
  6736.     D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
  6737.     D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
  6738.     D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
  6739.     D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
  6740.     D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
  6741.     D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
  6742.     D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
  6743.     D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
  6744.     D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
  6745.     D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
  6746.     D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
  6747.     D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
  6748.     D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
  6749.     D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
  6750.     D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
  6751.     D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
  6752.     D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
  6753.     D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
  6754.     D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
  6755.     D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
  6756.     D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
  6757.     D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
  6758.     D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
  6759.     D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
  6760.     D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
  6761.     D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
  6762.     D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
  6763.     D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
  6764.  
  6765. //
  6766. // retired renderstate names - the values are still used under new naming conventions
  6767. //
  6768.     D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
  6769.     D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
  6770.     D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
  6771.  
  6772. type
  6773. // Values for material source
  6774.   PD3DMateralColorSource = ^TD3DMateralColorSource;
  6775.   TD3DMateralColorSource = (
  6776.     D3DMCS_MATERIAL,              // Color from material is used
  6777.     D3DMCS_COLOR1,                // Diffuse vertex color is used
  6778.     D3DMCS_COLOR2                 // Specular vertex color is used
  6779.   );
  6780.  
  6781. const
  6782.   // For back-compatibility with legacy compilations
  6783.   D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
  6784.  
  6785.  
  6786. // Bias to apply to the texture coordinate set to apply a wrap to.
  6787.    D3DRENDERSTATE_WRAPBIAS                = 128;
  6788.  
  6789. (* Flags to construct the WRAP render states *)
  6790.   D3DWRAP_U   = $00000001;
  6791.   D3DWRAP_V   = $00000002;
  6792.  
  6793. (* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
  6794.   D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
  6795.   D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
  6796.   D3DWRAPCOORD_2   = $00000004;
  6797.   D3DWRAPCOORD_3   = $00000008;
  6798.  
  6799. function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
  6800.  
  6801. type
  6802.   PD3DState = ^TD3DState;
  6803.   TD3DState = packed record
  6804.     case Integer of
  6805.     0: (
  6806.       dtstTransformStateType: TD3DTransformStateType;
  6807.       dwArg: Array [ 0..0 ] of DWORD;
  6808.      );
  6809.     1: (
  6810.       dlstLightStateType: TD3DLightStateType;
  6811.       dvArg: Array [ 0..0 ] of TD3DValue;
  6812.      );
  6813.     2: (
  6814.       drstRenderStateType: TD3DRenderStateType;
  6815.      );
  6816.   end;
  6817.  
  6818. (*
  6819.  * Operation used to load matrices
  6820.  * hDstMat = hSrcMat
  6821.  *)
  6822.   PD3DMatrixLoad = ^TD3DMatrixLoad;
  6823.   TD3DMatrixLoad = packed record
  6824.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6825.     hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
  6826.   end;
  6827.  
  6828. (*
  6829.  * Operation used to multiply matrices
  6830.  * hDstMat = hSrcMat1 * hSrcMat2
  6831.  *)
  6832.   PD3DMatrixMultiply = ^TD3DMatrixMultiply;
  6833.   TD3DMatrixMultiply = packed record
  6834.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6835.     hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
  6836.     hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
  6837.   end;
  6838.  
  6839. (*
  6840.  * Operation used to transform and light vertices.
  6841.  *)
  6842.   PD3DProcessVertices = ^TD3DProcessVertices;
  6843.   TD3DProcessVertices = packed record
  6844.     dwFlags: DWORD;           (* Do we transform or light or just copy? *)
  6845.     wStart: WORD;             (* Index to first vertex in source *)
  6846.     wDest: WORD;              (* Index to first vertex in local buffer *)
  6847.     dwCount: DWORD;           (* Number of vertices to be processed *)
  6848.     dwReserved: DWORD;        (* Must be zero *)
  6849.   end;
  6850.  
  6851. const
  6852.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  6853.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  6854.   D3DPROCESSVERTICES_COPY                 = $00000002;
  6855.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  6856.  
  6857.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  6858.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  6859.  
  6860.  
  6861. (*
  6862.  * State enumerants for per-stage texture processing.
  6863.  *)
  6864. type
  6865.   PD3DTextureStageStateType = ^TD3DTextureStageStateType;
  6866.   TD3DTextureStageStateType = DWORD;
  6867. const
  6868.   D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
  6869.   D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
  6870.   D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
  6871.   D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
  6872.   D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
  6873.   D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
  6874.   D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
  6875.   D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
  6876.   D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
  6877.   D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
  6878.   D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
  6879.   D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
  6880.   D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
  6881.   D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
  6882.   D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
  6883.   D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
  6884.   D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
  6885.   D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
  6886.   D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
  6887.   D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
  6888.   D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
  6889.   D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
  6890.   D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
  6891.   D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
  6892.  
  6893. // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
  6894. // and normal in the camera space) should be taken as texture coordinates
  6895. // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
  6896. //
  6897.   D3DTSS_TCI_PASSTHRU                             = $00000000;
  6898.   D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
  6899.   D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
  6900.   D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
  6901.  
  6902. type
  6903. (*
  6904.  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
  6905.  * texture processing stage controls in D3DRENDERSTATE.
  6906.  *)
  6907.   PD3DTextureOp = ^TD3DTextureOp;
  6908.   TD3DTextureOp = (
  6909.     D3DTOP_INVALID_0,
  6910. // Control
  6911.     D3DTOP_DISABLE   ,      // disables stage
  6912.     D3DTOP_SELECTARG1,      // the default
  6913.     D3DTOP_SELECTARG2,
  6914.  
  6915. // Modulate
  6916.     D3DTOP_MODULATE  ,      // multiply args together
  6917.     D3DTOP_MODULATE2X,      // multiply and  1 bit
  6918.     D3DTOP_MODULATE4X,      // multiply and  2 bits
  6919.  
  6920. // Add
  6921.     D3DTOP_ADD        ,   // add arguments together
  6922.     D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
  6923.     D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
  6924.     D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
  6925.     D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
  6926.                           // Arg1 + Arg2 - Arg1*Arg2
  6927.                           // = Arg1 + (1-Arg1)*Arg2
  6928.  
  6929. // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  6930.     D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
  6931.     D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
  6932.     D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  6933.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  6934.     D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
  6935.     D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
  6936.  
  6937. // Specular mapping
  6938.     D3DTOP_PREMODULATE           ,     // modulate with next texture before use
  6939.     D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
  6940.                                        // COLOROP only
  6941.     D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
  6942.                                             // COLOROP only
  6943.     D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  6944.                                        // COLOROP only
  6945.     D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  6946.                                             // COLOROP only
  6947.  
  6948. // Bump mapping
  6949.     D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
  6950.     D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
  6951.     // This can do either diffuse or specular bump mapping with correct input.
  6952.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  6953.     // where each component has been scaled and offset to make it signed.
  6954.     // The result is replicated into all four (including alpha) channels.
  6955.     // This is a valid COLOROP only.
  6956.     D3DTOP_DOTPRODUCT3
  6957.   );
  6958.  
  6959. (*
  6960.  * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  6961.  * set in texture processing stage controls in D3DRENDERSTATE.
  6962.  *)
  6963. const
  6964.   D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
  6965.   D3DTA_DIFFUSE           = $00000000;  // select diffuse color
  6966.   D3DTA_CURRENT           = $00000001;  // select result of previous stage
  6967.   D3DTA_TEXTURE           = $00000002;  // select texture color
  6968.   D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
  6969.   D3DTA_SPECULAR          = $00000004;  // select specular color
  6970.   D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
  6971.   D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
  6972.  
  6973. (*
  6974.  *  IDirect3DTexture2 State Filter Types
  6975.  *)
  6976. type
  6977.   PD3DTextureMagFilter = ^TD3DTextureMagFilter;
  6978.   TD3DTextureMagFilter = (
  6979.     D3DTFG_INVALID_0,
  6980.     D3DTFG_POINT        ,    // nearest
  6981.     D3DTFG_LINEAR       ,    // linear interpolation
  6982.     D3DTFG_FLATCUBIC    ,    // cubic
  6983.     D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
  6984.     D3DTFG_ANISOTROPIC
  6985.   );
  6986.  
  6987.   PD3DTextureMinFilter = ^TD3DTextureMinFilter;
  6988.   TD3DTextureMinFilter = (
  6989.     D3DTFN_INVALID_0,
  6990.     D3DTFN_POINT      ,    // nearest
  6991.     D3DTFN_LINEAR     ,    // linear interpolation
  6992.     D3DTFN_ANISOTROPIC
  6993.   );
  6994.  
  6995.   PD3DTextureMipFilter = ^TD3DTextureMipFilter;
  6996.   TD3DTextureMipFilter = (
  6997.     D3DTFP_INVALID_0,
  6998.     D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
  6999.     D3DTFP_POINT  ,    // nearest
  7000.     D3DTFP_LINEAR      // linear interpolation
  7001.   );
  7002.  
  7003.  
  7004. (*
  7005.  * Triangle flags
  7006.  *)
  7007.  
  7008. (*
  7009.  * Tri strip and fan flags.
  7010.  * START loads all three vertices
  7011.  * EVEN and ODD load just v3 with even or odd culling
  7012.  * START_FLAT contains a count from 0 to 29 that allows the
  7013.  * whole strip or fan to be culled in one hit.
  7014.  * e.g. for a quad len = 1
  7015.  *)
  7016. const
  7017.   D3DTRIFLAG_START                        = $00000000;
  7018. // #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
  7019. function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
  7020.  
  7021. const
  7022.   D3DTRIFLAG_ODD                          = $0000001e;
  7023.   D3DTRIFLAG_EVEN                         = $0000001f;
  7024.  
  7025. (*
  7026.  * Triangle edge flags
  7027.  * enable edges for wireframe or antialiasing
  7028.  *)
  7029.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
  7030.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
  7031.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
  7032.   D3DTRIFLAG_EDGEENABLETRIANGLE = (
  7033.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
  7034.  
  7035. (*
  7036.  * Primitive structures and related defines.  Vertex offsets are to types
  7037.  * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
  7038.  *)
  7039.  
  7040. (*
  7041.  * Triangle list primitive structure
  7042.  *)
  7043. type
  7044.   PD3DTriangle = ^TD3DTriangle;
  7045.   TD3DTriangle = packed record
  7046.     case Integer of
  7047.     0: (
  7048.       v1: WORD;            (* Vertex indices *)
  7049.       v2: WORD;
  7050.       v3: WORD;
  7051.       wFlags: WORD;        (* Edge (and other) flags *)
  7052.      );
  7053.     1: (
  7054.       wV1: WORD;
  7055.       wV2: WORD;
  7056.       wV3: WORD;
  7057.      );
  7058.   end;
  7059.  
  7060. (*
  7061.  * Line strip structure.
  7062.  * The instruction count - 1 defines the number of line segments.
  7063.  *)
  7064.   PD3DLine = ^TD3DLine;
  7065.   TD3DLine = packed record
  7066.     case Integer of
  7067.     0: (
  7068.       v1: WORD;            (* Vertex indices *)
  7069.       v2: WORD;
  7070.      );
  7071.     1: (
  7072.       wV1: WORD;
  7073.       wV2: WORD;
  7074.      );
  7075.   end;
  7076.  
  7077. (*
  7078.  * Span structure
  7079.  * Spans join a list of points with the same y value.
  7080.  * If the y value changes, a new span is started.
  7081.  *)
  7082.   PD3DSpan = ^TD3DSpan;
  7083.   TD3DSpan = packed record
  7084.     wCount: WORD;        (* Number of spans *)
  7085.     wFirst: WORD;        (* Index to first vertex *)
  7086.   end;
  7087.  
  7088. (*
  7089.  * Point structure
  7090.  *)
  7091.   PD3DPoint = ^TD3DPoint;
  7092.   TD3DPoint = packed record
  7093.     wCount: WORD;        (* number of points         *)
  7094.     wFirst: WORD;        (* index to first vertex    *)
  7095.   end;
  7096.  
  7097. (*
  7098.  * Forward branch structure.
  7099.  * Mask is logically anded with the driver status mask
  7100.  * if the result equals 'value', the branch is taken.
  7101.  *)
  7102.   PD3DBranch = ^TD3DBranch;
  7103.   TD3DBranch = packed record
  7104.     dwMask: DWORD;         (* Bitmask against D3D status *)
  7105.     dwValue: DWORD;
  7106.     bNegate: BOOL;         (* TRUE to negate comparison *)
  7107.     dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
  7108.   end;
  7109.  
  7110. (*
  7111.  * Status used for set status instruction.
  7112.  * The D3D status is initialised on device creation
  7113.  * and is modified by all execute calls.
  7114.  *)
  7115.   PD3DStatus = ^TD3DStatus;
  7116.   TD3DStatus = packed record
  7117.     dwFlags: DWORD;        (* Do we set extents or status *)
  7118.     dwStatus: DWORD;       (* D3D status *)
  7119.     drExtent: TD3DRect;
  7120.   end;
  7121.  
  7122. const
  7123.   D3DSETSTATUS_STATUS    = $00000001;
  7124.   D3DSETSTATUS_EXTENTS   = $00000002;
  7125.   D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
  7126.  
  7127. type
  7128.   PD3DClipStatus = ^TD3DClipStatus;
  7129.   TD3DClipStatus = packed record
  7130.     dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
  7131.     dwStatus : DWORD; (* Clip status *)
  7132.     minx, maxx : float; (* X extents *)
  7133.     miny, maxy : float; (* Y extents *)
  7134.     minz, maxz : float; (* Z extents *)
  7135.   end;
  7136.  
  7137. const
  7138.   D3DCLIPSTATUS_STATUS        = $00000001;
  7139.   D3DCLIPSTATUS_EXTENTS2      = $00000002;
  7140.   D3DCLIPSTATUS_EXTENTS3      = $00000004;
  7141.  
  7142. (*
  7143.  * Statistics structure
  7144.  *)
  7145. type
  7146.   PD3DStats = ^TD3DStats;
  7147.   TD3DStats = packed record
  7148.     dwSize: DWORD;
  7149.     dwTrianglesDrawn: DWORD;
  7150.     dwLinesDrawn: DWORD;
  7151.     dwPointsDrawn: DWORD;
  7152.     dwSpansDrawn: DWORD;
  7153.     dwVerticesProcessed: DWORD;
  7154.   end;
  7155.  
  7156. (*
  7157.  * Execute options.
  7158.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  7159.  * inside the buffer must be contained within the viewport.
  7160.  *)
  7161. const
  7162.   D3DEXECUTE_CLIPPED       = $00000001;
  7163.   D3DEXECUTE_UNCLIPPED     = $00000002;
  7164.  
  7165. type
  7166.   PD3DExecuteData = ^TD3DExecuteData;
  7167.   TD3DExecuteData = packed record
  7168.     dwSize: DWORD;
  7169.     dwVertexOffset: DWORD;
  7170.     dwVertexCount: DWORD;
  7171.     dwInstructionOffset: DWORD;
  7172.     dwInstructionLength: DWORD;
  7173.     dwHVertexOffset: DWORD;
  7174.     dsStatus: TD3DStatus;       (* Status after execute *)
  7175.   end;
  7176.  
  7177. (*
  7178.  * Palette flags.
  7179.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  7180.  *)
  7181.  
  7182. const
  7183.   D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
  7184.   D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
  7185.   D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
  7186.  
  7187.  
  7188. type
  7189.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  7190.   TD3DVertexBufferDesc = packed record
  7191.     dwSize : DWORD;
  7192.     dwCaps : DWORD;
  7193.     dwFVF : DWORD;
  7194.     dwNumVertices : DWORD;
  7195.   end;
  7196.  
  7197. const
  7198. (* These correspond to DDSCAPS_* flags *)
  7199.   D3DVBCAPS_SYSTEMMEMORY      = $00000800;
  7200.   D3DVBCAPS_WRITEONLY         = $00010000;
  7201.   D3DVBCAPS_OPTIMIZED         = $80000000;
  7202.   D3DVBCAPS_DONOTCLIP         = $00000001;
  7203.  
  7204. (* Vertex Operations for ProcessVertices *)
  7205.   D3DVOP_LIGHT      = (1 shl 10);
  7206.   D3DVOP_TRANSFORM  = (1 shl 0);
  7207.   D3DVOP_CLIP       = (1 shl 2);
  7208.   D3DVOP_EXTENTS    = (1 shl 3);
  7209.  
  7210. (* The maximum number of vertices user can pass to any d3d
  7211.    drawing function or to create vertex buffer with
  7212. *)
  7213.   D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
  7214. (* The maximum number of primitives user can pass to any d3d
  7215.    drawing function.
  7216. *)
  7217.   D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
  7218.  
  7219. (* Bits for dwFlags in ProcessVertices call *)
  7220.   D3DPV_DONOTCOPYDATA = (1 shl 0);
  7221.  
  7222. //-------------------------------------------------------------------
  7223.  
  7224. // Flexible vertex format bits
  7225. //
  7226.   D3DFVF_RESERVED0        = $001;
  7227.   D3DFVF_POSITION_MASK    = $00E;
  7228.   D3DFVF_XYZ              = $002;
  7229.   D3DFVF_XYZRHW           = $004;
  7230.   D3DFVF_XYZB1            = $006;
  7231.   D3DFVF_XYZB2            = $008;
  7232.   D3DFVF_XYZB3            = $00a;
  7233.   D3DFVF_XYZB4            = $00c;
  7234.   D3DFVF_XYZB5            = $00e;
  7235.  
  7236.   D3DFVF_NORMAL           = $010;
  7237.   D3DFVF_RESERVED1        = $020;
  7238.   D3DFVF_DIFFUSE          = $040;
  7239.   D3DFVF_SPECULAR         = $080;
  7240.  
  7241.   D3DFVF_TEXCOUNT_MASK    = $f00;
  7242.   D3DFVF_TEXCOUNT_SHIFT   = 8;
  7243.   D3DFVF_TEX0             = $000;
  7244.   D3DFVF_TEX1             = $100;
  7245.   D3DFVF_TEX2             = $200;
  7246.   D3DFVF_TEX3             = $300;
  7247.   D3DFVF_TEX4             = $400;
  7248.   D3DFVF_TEX5             = $500;
  7249.   D3DFVF_TEX6             = $600;
  7250.   D3DFVF_TEX7             = $700;
  7251.   D3DFVF_TEX8             = $800;
  7252.  
  7253.   D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
  7254.  
  7255.   D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
  7256.   D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
  7257.                          D3DFVF_SPECULAR or D3DFVF_TEX1 );
  7258.   D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
  7259.                           D3DFVF_TEX1 );
  7260.  
  7261. type
  7262.   PD3DDP_PtrStride = ^TD3DDP_PtrStride;
  7263.   TD3DDP_PtrStride = packed record
  7264.     lpvData : pointer;
  7265.     dwStride : DWORD;
  7266.   end;
  7267.  
  7268. const
  7269.   D3DDP_MAXTEXCOORD = 8;
  7270.  
  7271. type
  7272.   PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
  7273.   TD3DDrawPrimitiveStridedData = packed record
  7274.     position : TD3DDP_PtrStride;
  7275.     normal : TD3DDP_PtrStride;
  7276.     diffuse : TD3DDP_PtrStride;
  7277.     specular : TD3DDP_PtrStride;
  7278.     textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
  7279.   end;
  7280.  
  7281. //---------------------------------------------------------------------
  7282. // ComputeSphereVisibility return values
  7283. //
  7284. const
  7285.   D3DVIS_INSIDE_FRUSTUM      = 0;
  7286.   D3DVIS_INTERSECT_FRUSTUM   = 1;
  7287.   D3DVIS_OUTSIDE_FRUSTUM     = 2;
  7288.   D3DVIS_INSIDE_LEFT         = 0;
  7289.   D3DVIS_INTERSECT_LEFT      = (1 shl 2);
  7290.   D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
  7291.   D3DVIS_INSIDE_RIGHT        = 0;
  7292.   D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
  7293.   D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
  7294.   D3DVIS_INSIDE_TOP          = 0;
  7295.   D3DVIS_INTERSECT_TOP       = (1 shl 6);
  7296.   D3DVIS_OUTSIDE_TOP         = (2 shl 6);
  7297.   D3DVIS_INSIDE_BOTTOM       = 0;
  7298.   D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
  7299.   D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
  7300.   D3DVIS_INSIDE_NEAR         = 0;
  7301.   D3DVIS_INTERSECT_NEAR      = (1 shl 10);
  7302.   D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
  7303.   D3DVIS_INSIDE_FAR          = 0;
  7304.   D3DVIS_INTERSECT_FAR       = (1 shl 12);
  7305.   D3DVIS_OUTSIDE_FAR         = (2 shl 12);
  7306.  
  7307.   D3DVIS_MASK_FRUSTUM        = (3 shl 0);
  7308.   D3DVIS_MASK_LEFT           = (3 shl 2);
  7309.   D3DVIS_MASK_RIGHT          = (3 shl 4);
  7310.   D3DVIS_MASK_TOP            = (3 shl 6);
  7311.   D3DVIS_MASK_BOTTOM         = (3 shl 8);
  7312.   D3DVIS_MASK_NEAR           = (3 shl 10);
  7313.   D3DVIS_MASK_FAR            = (3 shl 12);
  7314.  
  7315. // To be used with GetInfo()
  7316.   D3DDEVINFOID_TEXTUREMANAGER    = 1;
  7317.   D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
  7318.   D3DDEVINFOID_TEXTURING         = 3;
  7319.  
  7320. type
  7321.   PD3DStateBlockType = ^TD3DStateBlockType;
  7322.   TD3DStateBlockType = (
  7323.     D3DSBT_INVALID_0   ,
  7324.     D3DSBT_ALL         , // capture all state
  7325.     D3DSBT_PIXELSTATE  , // capture pixel state
  7326.     D3DSBT_VERTEXSTATE   // capture vertex state
  7327.   );
  7328.  
  7329. // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
  7330. //
  7331.   PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
  7332.   TD3DVertexBlendFlags = (
  7333.     D3DVBLEND_DISABLE , // Disable vertex blending
  7334.     D3DVBLEND_1WEIGHT , // blend between 2 matrices
  7335.     D3DVBLEND_2WEIGHTS, // blend between 3 matrices
  7336.     D3DVBLEND_3WEIGHTS  // blend between 4 matrices
  7337.   );
  7338.  
  7339.   PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
  7340.   TD3DTextureTransformFlags = (
  7341.     D3DTTFF_DISABLE ,    // texture coordinates are passed directly
  7342.     D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
  7343.     D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
  7344.     D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
  7345.     D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
  7346.   );
  7347.  
  7348. const
  7349.   D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
  7350.  
  7351. // Macros to set texture coordinate format bits in the FVF id
  7352.  
  7353. D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
  7354. D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
  7355. D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
  7356. D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
  7357.  
  7358. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
  7359. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
  7360. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
  7361. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
  7362.  
  7363. (*==========================================================================;
  7364.  *
  7365.  *
  7366.  *  File:       d3dcaps.h
  7367.  *  Content:    Direct3D capabilities include file
  7368.  *
  7369.  ***************************************************************************)
  7370.  
  7371. (* Description of capabilities of transform *)
  7372.  
  7373. type
  7374.   PD3DTransformCaps = ^TD3DTransformCaps;
  7375.   TD3DTransformCaps = packed record
  7376.     dwSize: DWORD;
  7377.     dwCaps: DWORD;
  7378.   end;
  7379.  
  7380. const
  7381.   D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
  7382.  
  7383. (* Description of capabilities of lighting *)
  7384.  
  7385. type
  7386.   PD3DLightingCaps = ^TD3DLightingCaps;
  7387.   TD3DLightingCaps = packed record
  7388.     dwSize: DWORD;
  7389.     dwCaps: DWORD;                   (* Lighting caps *)
  7390.     dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
  7391.     dwNumLights: DWORD;              (* Number of lights that can be handled *)
  7392.   end;
  7393.  
  7394. const
  7395.   D3DLIGHTINGMODEL_RGB            = $00000001;
  7396.   D3DLIGHTINGMODEL_MONO           = $00000002;
  7397.  
  7398.   D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
  7399.   D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
  7400.   D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
  7401.   D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
  7402.   D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
  7403.  
  7404. (* Description of capabilities for each primitive type *)
  7405.  
  7406. type
  7407.   PD3DPrimCaps = ^TD3DPrimCaps;
  7408.   TD3DPrimCaps = packed record
  7409.     dwSize: DWORD;
  7410.     dwMiscCaps: DWORD;                 (* Capability flags *)
  7411.     dwRasterCaps: DWORD;
  7412.     dwZCmpCaps: DWORD;
  7413.     dwSrcBlendCaps: DWORD;
  7414.     dwDestBlendCaps: DWORD;
  7415.     dwAlphaCmpCaps: DWORD;
  7416.     dwShadeCaps: DWORD;
  7417.     dwTextureCaps: DWORD;
  7418.     dwTextureFilterCaps: DWORD;
  7419.     dwTextureBlendCaps: DWORD;
  7420.     dwTextureAddressCaps: DWORD;
  7421.     dwStippleWidth: DWORD;             (* maximum width and height of *)
  7422.     dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
  7423.   end;
  7424.  
  7425. const
  7426. (* TD3DPrimCaps dwMiscCaps *)
  7427.  
  7428.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  7429.   D3DPMISCCAPS_MASKZ              = $00000002;
  7430.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  7431.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  7432.   D3DPMISCCAPS_CULLNONE           = $00000010;
  7433.   D3DPMISCCAPS_CULLCW             = $00000020;
  7434.   D3DPMISCCAPS_CULLCCW            = $00000040;
  7435.  
  7436. (* TD3DPrimCaps dwRasterCaps *)
  7437.  
  7438.   D3DPRASTERCAPS_DITHER           = $00000001;
  7439.   D3DPRASTERCAPS_ROP2             = $00000002;
  7440.   D3DPRASTERCAPS_XOR              = $00000004;
  7441.   D3DPRASTERCAPS_PAT              = $00000008;
  7442.   D3DPRASTERCAPS_ZTEST            = $00000010;
  7443.   D3DPRASTERCAPS_SUBPIXEL         = $00000020;
  7444.   D3DPRASTERCAPS_SUBPIXELX        = $00000040;
  7445.   D3DPRASTERCAPS_FOGVERTEX        = $00000080;
  7446.   D3DPRASTERCAPS_FOGTABLE         = $00000100;
  7447.   D3DPRASTERCAPS_STIPPLE          = $00000200;
  7448.   D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
  7449.   D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
  7450.   D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
  7451.   D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
  7452.   D3DPRASTERCAPS_ZBIAS                    = $00004000;
  7453.   D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
  7454.   D3DPRASTERCAPS_FOGRANGE                 = $00010000;
  7455.   D3DPRASTERCAPS_ANISOTROPY               = $00020000;
  7456.   D3DPRASTERCAPS_WBUFFER                      = $00040000;
  7457.   D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
  7458.   D3DPRASTERCAPS_WFOG                         = $00100000;
  7459.   D3DPRASTERCAPS_ZFOG                         = $00200000;
  7460.  
  7461. (* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
  7462.  
  7463. const
  7464.   D3DPCMPCAPS_NEVER               = $00000001;
  7465.   D3DPCMPCAPS_LESS                = $00000002;
  7466.   D3DPCMPCAPS_EQUAL               = $00000004;
  7467.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  7468.   D3DPCMPCAPS_GREATER             = $00000010;
  7469.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  7470.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  7471.   D3DPCMPCAPS_ALWAYS              = $00000080;
  7472.  
  7473. (* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *)
  7474.  
  7475.   D3DPBLENDCAPS_ZERO              = $00000001;
  7476.   D3DPBLENDCAPS_ONE               = $00000002;
  7477.   D3DPBLENDCAPS_SRCCOLOR          = $00000004;
  7478.   D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
  7479.   D3DPBLENDCAPS_SRCALPHA          = $00000010;
  7480.   D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
  7481.   D3DPBLENDCAPS_DESTALPHA         = $00000040;
  7482.   D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
  7483.   D3DPBLENDCAPS_DESTCOLOR         = $00000100;
  7484.   D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
  7485.   D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
  7486.   D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
  7487.   D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
  7488.  
  7489. (* TD3DPrimCaps dwShadeCaps *)
  7490.  
  7491.   D3DPSHADECAPS_COLORFLATMONO             = $00000001;
  7492.   D3DPSHADECAPS_COLORFLATRGB              = $00000002;
  7493.   D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
  7494.   D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
  7495.   D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
  7496.   D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
  7497.  
  7498.   D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
  7499.   D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
  7500.   D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
  7501.   D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
  7502.   D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
  7503.   D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
  7504.  
  7505.   D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
  7506.   D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
  7507.   D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
  7508.   D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
  7509.   D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
  7510.   D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
  7511.  
  7512.   D3DPSHADECAPS_FOGFLAT                   = $00040000;
  7513.   D3DPSHADECAPS_FOGGOURAUD                = $00080000;
  7514.   D3DPSHADECAPS_FOGPHONG                  = $00100000;
  7515.  
  7516. (* TD3DPrimCaps dwTextureCaps *)
  7517.  
  7518. (*
  7519.  * Perspective-correct texturing is supported
  7520.  *)
  7521.   D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
  7522.  
  7523. (*
  7524.  * Power-of-2 texture dimensions are required
  7525.  *)
  7526.   D3DPTEXTURECAPS_POW2            = $00000002;
  7527.  
  7528. (*
  7529.  * Alpha in texture pixels is supported
  7530.  *)
  7531.   D3DPTEXTURECAPS_ALPHA           = $00000004;
  7532.  
  7533. (*
  7534.  * Color-keyed textures are supported
  7535.  *)
  7536.   D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
  7537.  
  7538. (*
  7539.  * obsolete, see D3DPTADDRESSCAPS_BORDER
  7540.  *)
  7541.   D3DPTEXTURECAPS_BORDER          = $00000010;
  7542.  
  7543. (*
  7544.  * Only square textures are supported
  7545.  *)
  7546.   D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
  7547.  
  7548. (*
  7549.  * Texture indices are not scaled by the texture size prior
  7550.  * to interpolation.
  7551.  *)
  7552.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
  7553.  
  7554. (*
  7555.  * Device can draw alpha from texture palettes
  7556.  *)
  7557.   D3DPTEXTURECAPS_ALPHAPALETTE    = $00000080;
  7558.  
  7559. (*
  7560.  * Device can use non-POW2 textures if:
  7561.  *  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
  7562.  *  2) D3DRS_WRAP(N) is zero for this texture's coordinates
  7563.  *  3) mip mapping is not enabled (use magnification filter only)
  7564.  *)
  7565.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL  = $00000100;
  7566.  
  7567. // 0x00000200L unused
  7568.  
  7569. (*
  7570.  * Device can divide transformed texture coordinates by the
  7571.  * COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
  7572.  *)
  7573.   D3DPTEXTURECAPS_PROJECTED  = $00000400;
  7574.  
  7575. (*
  7576.  * Device can do cubemap textures
  7577.  *)
  7578.   D3DPTEXTURECAPS_CUBEMAP           = $00000800;
  7579.  
  7580.   D3DPTEXTURECAPS_COLORKEYBLEND     = $00001000;
  7581.  
  7582.  
  7583. (* TD3DPrimCaps dwTextureFilterCaps *)
  7584.  
  7585.   D3DPTFILTERCAPS_NEAREST         = $00000001;
  7586.   D3DPTFILTERCAPS_LINEAR          = $00000002;
  7587.   D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
  7588.   D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
  7589.   D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
  7590.   D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
  7591.  
  7592. (* Device3 Min Filter *)
  7593.   D3DPTFILTERCAPS_MINFPOINT       = $00000100;
  7594.   D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
  7595.   D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
  7596.  
  7597. (* Device3 Mip Filter *)
  7598.   D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
  7599.   D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
  7600.  
  7601. (* Device3 Mag Filter *)
  7602.   D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
  7603.   D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
  7604.   D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
  7605.   D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
  7606.   D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
  7607.  
  7608. (* TD3DPrimCaps dwTextureBlendCaps *)
  7609.  
  7610.   D3DPTBLENDCAPS_DECAL            = $00000001;
  7611.   D3DPTBLENDCAPS_MODULATE         = $00000002;
  7612.   D3DPTBLENDCAPS_DECALALPHA       = $00000004;
  7613.   D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
  7614.   D3DPTBLENDCAPS_DECALMASK        = $00000010;
  7615.   D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
  7616.   D3DPTBLENDCAPS_COPY             = $00000040;
  7617.   D3DPTBLENDCAPS_ADD                      = $00000080;
  7618.  
  7619. (* TD3DPrimCaps dwTextureAddressCaps *)
  7620.   D3DPTADDRESSCAPS_WRAP           = $00000001;
  7621.   D3DPTADDRESSCAPS_MIRROR         = $00000002;
  7622.   D3DPTADDRESSCAPS_CLAMP          = $00000004;
  7623.   D3DPTADDRESSCAPS_BORDER         = $00000008;
  7624.   D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
  7625.  
  7626. (* D3DDEVICEDESC dwStencilCaps *)
  7627.  
  7628.   D3DSTENCILCAPS_KEEP     = $00000001;
  7629.   D3DSTENCILCAPS_ZERO     = $00000002;
  7630.   D3DSTENCILCAPS_REPLACE  = $00000004;
  7631.   D3DSTENCILCAPS_INCRSAT  = $00000008;
  7632.   D3DSTENCILCAPS_DECRSAT  = $00000010;
  7633.   D3DSTENCILCAPS_INVERT   = $00000020;
  7634.   D3DSTENCILCAPS_INCR     = $00000040;
  7635.   D3DSTENCILCAPS_DECR     = $00000080;
  7636.  
  7637. (* D3DDEVICEDESC dwTextureOpCaps *)
  7638.  
  7639.   D3DTEXOPCAPS_DISABLE                    = $00000001;
  7640.   D3DTEXOPCAPS_SELECTARG1                 = $00000002;
  7641.   D3DTEXOPCAPS_SELECTARG2                 = $00000004;
  7642.   D3DTEXOPCAPS_MODULATE                   = $00000008;
  7643.   D3DTEXOPCAPS_MODULATE2X                 = $00000010;
  7644.   D3DTEXOPCAPS_MODULATE4X                 = $00000020;
  7645.   D3DTEXOPCAPS_ADD                        = $00000040;
  7646.   D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
  7647.   D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
  7648.   D3DTEXOPCAPS_SUBTRACT                   = $00000200;
  7649.   D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
  7650.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
  7651.   D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
  7652.   D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
  7653.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
  7654.   D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
  7655.   D3DTEXOPCAPS_PREMODULATE                = $00010000;
  7656.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
  7657.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
  7658.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
  7659.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
  7660.   D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
  7661.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
  7662.   D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
  7663.  
  7664. (* D3DDEVICEDESC dwFVFCaps flags *)
  7665.  
  7666.   D3DFVFCAPS_TEXCOORDCOUNTMASK    = $0000ffff; (* mask for texture coordinate count field *)
  7667.   D3DFVFCAPS_DONOTSTRIPELEMENTS   = $00080000; (* Device prefers that vertex elements not be stripped *)
  7668.  
  7669. (*
  7670.  * Description for a device.
  7671.  * This is used to describe a device that is to be created or to query
  7672.  * the current device.
  7673.  *)
  7674.  
  7675. type
  7676.   PD3DDeviceDesc = ^TD3DDeviceDesc;
  7677.   TD3DDeviceDesc = packed record
  7678.     dwSize: DWORD;                       (* Size of TD3DDeviceDesc structure *)
  7679.     dwFlags: DWORD;                      (* Indicates which fields have valid data *)
  7680.     dcmColorModel: TD3DColorModel;        (* Color model of device *)
  7681.     dwDevCaps: DWORD;                    (* Capabilities of device *)
  7682.     dtcTransformCaps: TD3DTransformCaps;  (* Capabilities of transform *)
  7683.     bClipping: BOOL;                     (* Device can do 3D clipping *)
  7684.     dlcLightingCaps: TD3DLightingCaps;    (* Capabilities of lighting *)
  7685.     dpcLineCaps: TD3DPrimCaps;
  7686.     dpcTriCaps: TD3DPrimCaps;
  7687.     dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
  7688.     dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
  7689.     dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
  7690.     dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
  7691.     // *** New fields for DX5 *** //
  7692.  
  7693.     // Width and height caps are 0 for legacy HALs.
  7694.     dwMinTextureWidth, dwMinTextureHeight  : DWORD;
  7695.     dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
  7696.     dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
  7697.     dwMinStippleHeight, dwMaxStippleHeight : DWORD;
  7698.  
  7699.     // New fields for DX6
  7700.     dwMaxTextureRepeat : DWORD;
  7701.     dwMaxTextureAspectRatio : DWORD;
  7702.     dwMaxAnisotropy : DWORD;
  7703.  
  7704.     // Guard band that the rasterizer can accommodate
  7705.     // Screen-space vertices inside this space but outside the viewport
  7706.     // will get clipped properly.
  7707.     dvGuardBandLeft : TD3DValue;
  7708.     dvGuardBandTop : TD3DValue;
  7709.     dvGuardBandRight : TD3DValue;
  7710.     dvGuardBandBottom : TD3DValue;
  7711.  
  7712.     dvExtentsAdjust : TD3DValue;
  7713.     dwStencilCaps : DWORD;
  7714.  
  7715.     dwFVFCaps : DWORD;  (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *)
  7716.     dwTextureOpCaps : DWORD;
  7717.     wMaxTextureBlendStages : WORD;
  7718.     wMaxSimultaneousTextures : WORD;
  7719.   end;
  7720.  
  7721.   PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
  7722.   TD3DDeviceDesc7 = packed record
  7723.     dwDevCaps:               DWORD;             (* Capabilities of device *)
  7724.     dpcLineCaps:             TD3DPrimCaps;
  7725.     dpcTriCaps:              TD3DPrimCaps;
  7726.     dwDeviceRenderBitDepth:  DWORD;             (* One of DDBB_8, 16, etc.. *)
  7727.     dwDeviceZBufferBitDepth: DWORD;             (* One of DDBD_16, 32, etc.. *)
  7728.  
  7729.     dwMinTextureWidth, dwMinTextureHeight: DWORD;
  7730.     dwMaxTextureWidth, dwMaxTextureHeight: DWORD;
  7731.  
  7732.     dwMaxTextureRepeat:                    DWORD;
  7733.     dwMaxTextureAspectRatio:               DWORD;
  7734.     dwMaxAnisotropy:                       DWORD;
  7735.  
  7736.     dvGuardBandLeft:                       TD3DValue;
  7737.     dvGuardBandTop:                        TD3DValue;
  7738.     dvGuardBandRight:                      TD3DValue;
  7739.     dvGuardBandBottom:                     TD3DValue;
  7740.  
  7741.     dvExtentsAdjust:                       TD3DValue;
  7742.     dwStencilCaps:                         DWORD;
  7743.  
  7744.     dwFVFCaps:                             DWORD;
  7745.     dwTextureOpCaps:                       DWORD;
  7746.     wMaxTextureBlendStages:                WORD;
  7747.     wMaxSimultaneousTextures:              WORD;
  7748.  
  7749.     dwMaxActiveLights:                     DWORD;
  7750.     dvMaxVertexW:                          TD3DValue;
  7751.     deviceGUID:                            TGUID;
  7752.  
  7753.     wMaxUserClipPlanes:                    WORD;
  7754.     wMaxVertexBlendMatrices:               WORD;
  7755.  
  7756.     dwVertexProcessingCaps:                DWORD;
  7757.  
  7758.     dwReserved1:                           DWORD;
  7759.     dwReserved2:                           DWORD;
  7760.     dwReserved3:                           DWORD;
  7761.     dwReserved4:                           DWORD;
  7762.   end;
  7763.  
  7764. const
  7765.   D3DDEVICEDESCSIZE = sizeof(TD3DDeviceDesc);
  7766.   D3DDEVICEDESC7SIZE = sizeof(TD3DDeviceDesc7);
  7767.  
  7768. type
  7769.   TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device
  7770.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7771.       var lpD3DHWDeviceDesc: TD3DDeviceDesc;
  7772.       var lpD3DHELDeviceDesc: TD3DDeviceDesc;
  7773.       lpContext : pointer) : HResult; stdcall;
  7774.   TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA;
  7775.  
  7776.   TD3DEnumDevicesCallback7A = function (
  7777.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7778.       const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer) : HResult; stdcall;
  7779.   TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A;
  7780.  
  7781. (* TD3DDeviceDesc dwFlags indicating valid fields *)
  7782.  
  7783. const
  7784.   D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
  7785.   D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
  7786.   D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
  7787.   D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
  7788.   D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
  7789.   D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
  7790.   D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
  7791.   D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
  7792.   D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
  7793.   D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
  7794.   D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
  7795.  
  7796. (* TD3DDeviceDesc dwDevCaps flags *)
  7797.  
  7798.   D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
  7799.                                                     (* for post-transform vertex data *)
  7800.   D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
  7801.   D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
  7802.   D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
  7803.  
  7804.   D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
  7805.   D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
  7806.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
  7807.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
  7808.   D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
  7809.   D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
  7810.   D3DDEVCAPS_DRAWPRIMTLVERTEX     = $00000400; (* Device can draw TLVERTEX primitives *)
  7811.   D3DDEVCAPS_CANRENDERAFTERFLIP   = $00000800; (* Device can render without waiting for flip to complete *)
  7812.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; (* Device can texture from nonlocal video memory *)
  7813.   D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; (* Device can support DrawPrimitives2 *)
  7814.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *)
  7815.   D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*)
  7816.   D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *)
  7817.   D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *)
  7818.   D3DDEVCAPS_HWRASTERIZATION         = $00080000; (* Device has HW acceleration for rasterization *)
  7819.  
  7820. (*
  7821.  * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
  7822.  *)
  7823.  
  7824. (* device can do texgen *)
  7825.   D3DVTXPCAPS_TEXGEN              = $00000001;
  7826. (* device can do IDirect3DDevice7 colormaterialsource ops *)
  7827.   D3DVTXPCAPS_MATERIALSOURCE7     = $00000002;
  7828. (* device can do vertex fog *)
  7829.   D3DVTXPCAPS_VERTEXFOG           = $00000004;
  7830. (* device can do directional lights *)
  7831.   D3DVTXPCAPS_DIRECTIONALLIGHTS   = $00000008;
  7832. (* device can do positional lights (includes point and spot) *)
  7833.   D3DVTXPCAPS_POSITIONALLIGHTS    = $00000010;
  7834. (* device can do local viewer *)
  7835.   D3DVTXPCAPS_LOCALVIEWER         = $00000020;
  7836.  
  7837.   D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
  7838.   D3DFDS_GUID              = $00000002; (* Match guid *)
  7839.   D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
  7840.   D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
  7841.   D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
  7842.   D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
  7843.   D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
  7844.   D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
  7845.   D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
  7846.   D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
  7847.   D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
  7848.   D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
  7849.   D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
  7850.   D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
  7851.   D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
  7852.   D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
  7853.  
  7854. (*
  7855.  * FindDevice arguments
  7856.  *)
  7857. type
  7858.   PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
  7859.   TD3DFindDeviceSearch = packed record
  7860.     dwSize: DWORD;
  7861.     dwFlags: DWORD;
  7862.     bHardware: BOOL;
  7863.     dcmColorModel: TD3DColorModel;
  7864.     guid: TGUID;
  7865.     dwCaps: DWORD;
  7866.     dpcPrimCaps: TD3DPrimCaps;
  7867.   end;
  7868.  
  7869.   PD3DFindDeviceResult = ^TD3DFindDeviceResult;
  7870.   TD3DFindDeviceResult = packed record
  7871.     dwSize: DWORD;
  7872.     guid: TGUID;               (* guid which matched *)
  7873.     ddHwDesc: TD3DDeviceDesc;   (* hardware TD3DDeviceDesc *)
  7874.     ddSwDesc: TD3DDeviceDesc;   (* software TD3DDeviceDesc *)
  7875.   end;
  7876.  
  7877. (*
  7878.  * Description of execute buffer.
  7879.  *)
  7880.   PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
  7881.   TD3DExecuteBufferDesc = packed record
  7882.     dwSize: DWORD;         (* size of this structure *)
  7883.     dwFlags: DWORD;        (* flags indicating which fields are valid *)
  7884.     dwCaps: DWORD;         (* capabilities of execute buffer *)
  7885.     dwBufferSize: DWORD;   (* size of execute buffer data *)
  7886.     lpData: Pointer;       (* pointer to actual data *)
  7887.   end;
  7888.  
  7889. (* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
  7890.  
  7891. const
  7892.   D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
  7893.   D3DDEB_CAPS             = $00000002;     (* caps valid *)
  7894.   D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
  7895.  
  7896. (* D3DEXECUTEBUFFER dwCaps *)
  7897.  
  7898.   D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
  7899.   D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
  7900.   D3DDEBCAPS_MEM          = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY);
  7901.  
  7902. type
  7903.   PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
  7904.   TD3DDevInfo_TextureManager = packed record
  7905.     bThrashing:              BOOL;       (* indicates if thrashing *)
  7906.     dwApproxBytesDownloaded: DWORD;      (* Approximate number of bytes downloaded by texture manager *)
  7907.     dwNumEvicts:             DWORD;      (* number of textures evicted *)
  7908.     dwNumVidCreates:         DWORD;      (* number of textures created in video memory *)
  7909.     dwNumTexturesUsed:       DWORD;      (* number of textures used *)
  7910.     dwNumUsedTexInVid:       DWORD;      (* number of used textures present in video memory *)
  7911.     dwWorkingSet:            DWORD;      (* number of textures in video memory *)
  7912.     dwWorkingSetBytes:       DWORD;      (* number of bytes in video memory *)
  7913.     dwTotalManaged:          DWORD;      (* total number of managed textures *)
  7914.     dwTotalBytes:            DWORD;      (* total number of bytes of managed textures *)
  7915.     dwLastPri:               DWORD;      (* priority of last texture evicted *)
  7916.   end;
  7917.  
  7918.   PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
  7919.   TD3DDevInfo_Texturing = packed record
  7920.     dwNumLoads:          DWORD;          (* counts Load() API calls *)
  7921.     dwApproxBytesLoaded: DWORD;          (* Approximate number bytes loaded via Load() *)
  7922.     dwNumPreLoads:       DWORD;          (* counts PreLoad() API calls *)
  7923.     dwNumSet:            DWORD;          (* counts SetTexture() API calls *)
  7924.     dwNumCreates:        DWORD;          (* counts texture creates *)
  7925.     dwNumDestroys:       DWORD;          (* counts texture destroys *)
  7926.     dwNumSetPriorities:  DWORD;          (* counts SetPriority() API calls *)
  7927.     dwNumSetLODs:        DWORD;          (* counts SetLOD() API calls *)
  7928.     dwNumLocks:          DWORD;          (* counts number of texture locks *)
  7929.     dwNumGetDCs:         DWORD;          (* counts number of GetDCs to textures *)
  7930.   end;
  7931.  
  7932. (*==========================================================================;
  7933.  *
  7934.  *
  7935.  *  File:   d3d.h
  7936.  *  Content:    Direct3D include file
  7937.  *
  7938.  ****************************************************************************)
  7939.  
  7940. function D3DErrorString(Value: HResult) : string;
  7941.  
  7942. (*
  7943.  * Interface IID's
  7944.  *)
  7945.  
  7946. const
  7947. (*
  7948.  * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer
  7949.  *)
  7950.   IID_IDirect3DRampDevice: TGUID =
  7951.       (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7952.   IID_IDirect3DRGBDevice: TGUID =
  7953.       (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7954.   IID_IDirect3DHALDevice: TGUID =
  7955.       (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E));
  7956.   IID_IDirect3DMMXDevice: TGUID =
  7957.       (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29));
  7958.  
  7959.   IID_IDirect3DRefDevice: TGUID =
  7960.       (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29));
  7961.   IID_IDirect3DNullDevice: TGUID =
  7962.       (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8));
  7963.  
  7964.   IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}';
  7965.  
  7966. type
  7967.   IDirect3D = interface;
  7968.   IDirect3D2 = interface;
  7969.   IDirect3D3 = interface;
  7970.   IDirect3D7 = interface;
  7971.   IDirect3DDevice = interface;
  7972.   IDirect3DDevice2 = interface;
  7973.   IDirect3DDevice3 = interface;
  7974.   IDirect3DDevice7 = interface;
  7975.   IDirect3DExecuteBuffer = interface;
  7976.   IDirect3DLight = interface;
  7977.   IDirect3DMaterial = interface;
  7978.   IDirect3DMaterial2 = interface;
  7979.   IDirect3DMaterial3 = interface;
  7980.   IDirect3DTexture = interface;
  7981.   IDirect3DTexture2 = interface;
  7982.   IDirect3DViewport = interface;
  7983.   IDirect3DViewport2 = interface;
  7984.   IDirect3DViewport3 = interface;
  7985.   IDirect3DVertexBuffer = interface;
  7986.   IDirect3DVertexBuffer7 = interface;
  7987.  
  7988. (*
  7989.  * Direct3D interfaces
  7990.  *)
  7991.  
  7992.   IDirect3D = interface (IUnknown)
  7993.     ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
  7994.     (*** IDirect3D methods ***)
  7995.     function Initialize (lpREFIID: {REFIID} PGUID) : HResult; stdcall;
  7996.     function EnumDevices (lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  7997.         lpUserArg: Pointer) : HResult; stdcall;
  7998.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  7999.         pUnkOuter: IUnknown) : HResult; stdcall;
  8000.     function CreateMaterial (var lplpDirect3DMaterial: IDirect3DMaterial;
  8001.         pUnkOuter: IUnknown) : HResult; stdcall;
  8002.     function CreateViewport (var lplpD3DViewport: IDirect3DViewport;
  8003.         pUnkOuter: IUnknown) : HResult; stdcall;
  8004.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8005.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8006.   end;
  8007.  
  8008.   IDirect3D2 = interface (IUnknown)
  8009.     ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}']
  8010.     (*** IDirect3D2 methods ***)
  8011.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8012.         lpUserArg: pointer) : HResult; stdcall;
  8013.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8014.         pUnkOuter: IUnknown) : HResult; stdcall;
  8015.     function CreateMaterial (var lplpDirect3DMaterial2: IDirect3DMaterial2;
  8016.         pUnkOuter: IUnknown) : HResult; stdcall;
  8017.     function CreateViewport (var lplpD3DViewport2: IDirect3DViewport2;
  8018.         pUnkOuter: IUnknown) : HResult; stdcall;
  8019.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8020.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8021.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface;
  8022.         out lplpD3DDevice2: IDirect3DDevice2) : HResult; stdcall;
  8023.   end;
  8024.  
  8025.   IDirect3D3 = interface (IUnknown)
  8026.     ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}']
  8027.     (*** IDirect3D3 methods ***)
  8028.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8029.         lpUserArg: pointer) : HResult; stdcall;
  8030.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8031.         pUnkOuter: IUnknown) : HResult; stdcall;
  8032.     function CreateMaterial (var lplpDirect3DMaterial3: IDirect3DMaterial3;
  8033.         pUnkOuter: IUnknown) : HResult; stdcall;
  8034.     function CreateViewport (var lplpD3DViewport3: IDirect3DViewport3;
  8035.         pUnkOuter: IUnknown) : HResult; stdcall;
  8036.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8037.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8038.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4;
  8039.         out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown) : HResult; stdcall;
  8040.     function CreateVertexBuffer (var lpVBDesc: TD3DVertexBufferDesc;
  8041.         var lpD3DVertexBuffer: IDirect3DVertexBuffer;
  8042.         dwFlags: DWORD; pUnkOuter: IUnknown) : HResult; stdcall;
  8043.     function EnumZBufferFormats (const riidDevice: TRefClsID; lpEnumCallback:
  8044.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8045.     function EvictManagedTextures : HResult; stdcall;
  8046.   end;
  8047.  
  8048.   IDirect3D7 = interface (IUnknown)
  8049.     ['{f5049e77-4861-11d2-a407-00a0c90629a8}']
  8050.     (*** IDirect3D7 methods ***)
  8051.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
  8052.         lpUserArg: pointer) : HResult; stdcall;
  8053.     function CreateDevice (const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
  8054.         out lplpD3DDevice: IDirect3DDevice7) : HResult; stdcall;
  8055.     function CreateVertexBuffer (const lpVBDesc: TD3DVertexBufferDesc;
  8056.         out lplpD3DVertexBuffer: IDirect3DVertexBuffer7;
  8057.         dwFlags: DWORD) : HResult; stdcall;
  8058.     function EnumZBufferFormats (const riidDevice: TGUID; lpEnumCallback:
  8059.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8060.     function EvictManagedTextures : HResult; stdcall;
  8061.   end;
  8062.  
  8063. (*
  8064.  * Direct3D Device interfaces
  8065.  *)
  8066.  
  8067.   IDirect3DDevice = interface (IUnknown)
  8068.     ['{64108800-957d-11d0-89ab-00a0c9054129}']
  8069.     (*** IDirect3DDevice methods ***)
  8070.     function Initialize (lpd3d: IDirect3D; lpGUID: PGUID;
  8071.         var lpd3ddvdesc: TD3DDeviceDesc) : HResult; stdcall;
  8072.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8073.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8074.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture;
  8075.         lpD3DTex2: IDirect3DTexture) : HResult; stdcall;
  8076.     function CreateExecuteBuffer (var lpDesc: TD3DExecuteBufferDesc ;
  8077.         var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8078.         pUnkOuter: IUnknown) : HResult; stdcall;
  8079.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8080.     function Execute (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8081.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8082.     function AddViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8083.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8084.     function NextViewport (lpDirect3DViewport: IDirect3DViewport;
  8085.         var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8086.     function Pick (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8087.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
  8088.         var lpRect: TD3DRect) : HResult; stdcall;
  8089.     function GetPickRecords (var lpCount: DWORD;
  8090.         var lpD3DPickRec: TD3DPickRecord) : HResult; stdcall;
  8091.     function EnumTextureFormats (lpd3dEnumTextureProc:
  8092.         TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8093.         HResult; stdcall;
  8094.     function CreateMatrix (var lpD3DMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8095.     function SetMatrix (d3dMatHandle: TD3DMatrixHandle;
  8096.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8097.     function GetMatrix (var lpD3DMatHandle: TD3DMatrixHandle;
  8098.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8099.     function DeleteMatrix (d3dMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8100.     function BeginScene: HResult; stdcall;
  8101.     function EndScene: HResult; stdcall;
  8102.     function GetDirect3D (var lpD3D: IDirect3D) : HResult; stdcall;
  8103.   end;
  8104.  
  8105.   IDirect3DDevice2 = interface (IUnknown)
  8106.     ['{93281501-8cf8-11d0-89ab-00a0c9054129}']
  8107.     (*** IDirect3DDevice2 methods ***)
  8108.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8109.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8110.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture2;
  8111.         lpD3DTex2: IDirect3DTexture2) : HResult; stdcall;
  8112.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8113.     function AddViewport (lpDirect3DViewport2: IDirect3DViewport2) : HResult; stdcall;
  8114.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport2) : HResult; stdcall;
  8115.     function NextViewport (lpDirect3DViewport: IDirect3DViewport2;
  8116.         var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD) :
  8117.         HResult; stdcall;
  8118.     function EnumTextureFormats (
  8119.         lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8120.         HResult; stdcall;
  8121.     function BeginScene: HResult; stdcall;
  8122.     function EndScene: HResult; stdcall;
  8123.     function GetDirect3D (var lpD3D: IDirect3D2) : HResult; stdcall;
  8124.  
  8125.     (*** DrawPrimitive API ***)
  8126.     function SetCurrentViewport (lpd3dViewport2: IDirect3DViewport2)
  8127.         : HResult; stdcall;
  8128.     function GetCurrentViewport (var lplpd3dViewport2: IDirect3DViewport2)
  8129.         : HResult; stdcall;
  8130.  
  8131.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface)
  8132.         : HResult; stdcall;
  8133.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface)
  8134.         : HResult; stdcall;
  8135.  
  8136.     function Begin_ (d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
  8137.         dwFlags: DWORD) : HResult; stdcall;
  8138.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
  8139.         TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD;
  8140.         dwFlags: DWORD) : HResult; stdcall;
  8141.     function Vertex (lpVertexType: pointer) : HResult;  stdcall;
  8142.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8143.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8144.  
  8145.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8146.         var lpdwRenderState) : HResult; stdcall;
  8147.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8148.         dwRenderState: DWORD) : HResult; stdcall;
  8149.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8150.         var lpdwLightState) : HResult; stdcall;
  8151.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8152.         dwLightState: DWORD) : HResult; stdcall;
  8153.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8154.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8155.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8156.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8157.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8158.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8159.  
  8160.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8161.         dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount,
  8162.         dwFlags: DWORD) : HResult; stdcall;
  8163.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8164.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD;
  8165.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8166.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8167.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8168.   end;
  8169.  
  8170.   IDirect3DDevice3 = interface (IUnknown)
  8171.     ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}']
  8172.     (*** IDirect3DDevice2 methods ***)
  8173.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8174.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8175.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8176.     function AddViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8177.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8178.     function NextViewport (lpDirect3DViewport: IDirect3DViewport3;
  8179.         var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD) : HResult; stdcall;
  8180.     function EnumTextureFormats (
  8181.         lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) :
  8182.         HResult; stdcall;
  8183.     function BeginScene: HResult; stdcall;
  8184.     function EndScene: HResult; stdcall;
  8185.     function GetDirect3D (var lpD3D: IDirect3D3) : HResult; stdcall;
  8186.     function SetCurrentViewport (lpd3dViewport: IDirect3DViewport3)
  8187.         : HResult; stdcall;
  8188.     function GetCurrentViewport (var lplpd3dViewport: IDirect3DViewport3)
  8189.         : HResult; stdcall;
  8190.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface4)
  8191.         : HResult; stdcall;
  8192.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface4)
  8193.         : HResult; stdcall;
  8194.     function Begin_ (d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  8195.         dwFlags: DWORD) : HResult; stdcall;
  8196.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType;
  8197.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD;
  8198.         dwFlags: DWORD) : HResult; stdcall;
  8199.     function Vertex (lpVertex: pointer) : HResult;  stdcall;
  8200.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8201.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8202.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8203.         var lpdwRenderState) : HResult; stdcall;
  8204.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8205.         dwRenderState: DWORD) : HResult; stdcall;
  8206.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8207.         var lpdwLightState) : HResult; stdcall;
  8208.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8209.         dwLightState: DWORD) : HResult; stdcall;
  8210.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8211.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8212.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8213.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8214.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8215.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8216.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8217.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8218.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8219.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8220.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8221.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8222.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8223.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8224.     function DrawPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8225.         dwVertexTypeDesc : DWORD;
  8226.         var lpVertexArray: TD3DDrawPrimitiveStridedData;
  8227.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8228.     function DrawIndexedPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8229.         dwVertexTypeDesc : DWORD;
  8230.         var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8231.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8232.     function DrawPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8233.         lpd3dVertexBuffer: IDirect3DVertexBuffer;
  8234.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8235.     function DrawIndexedPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8236.         lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD;
  8237.         dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8238.     function ComputeSphereVisibility (var lpCenters: TD3DVector;
  8239.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8240.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8241.     function GetTexture (dwStage: DWORD; var lplpTexture: IDirect3DTexture2)
  8242.         : HResult; stdcall;
  8243.     function SetTexture (dwStage: DWORD; lplpTexture: IDirect3DTexture2)
  8244.         : HResult; stdcall;
  8245.     function GetTextureStageState (dwStage: DWORD;
  8246.         dwState: TD3DTextureStageStateType; var lpdwValue: DWORD) : HResult; stdcall;
  8247.     function SetTextureStageState (dwStage: DWORD;
  8248.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8249.     function ValidateDevice (var lpdwExtraPasses: DWORD) : HResult; stdcall;
  8250.   end;
  8251.  
  8252.   IDirect3DDevice7 = interface (IUnknown)
  8253.     ['{f5049e79-4861-11d2-a407-00a0c90629a8}']
  8254.     (*** IDirect3DDevice7 methods ***)
  8255.     function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7) : HResult; stdcall;
  8256.     function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) : HResult; stdcall;
  8257.     function BeginScene: HResult; stdcall;
  8258.     function EndScene: HResult; stdcall;
  8259.     function GetDirect3D(out lpD3D: IDirect3D7) : HResult; stdcall;
  8260.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD) : HResult; stdcall;
  8261.     function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7) : HResult; stdcall;
  8262.     function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8263.     function SetTransform(dtstTransformStateType: TD3DTransformStateType;
  8264.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8265.     function GetTransform(dtstTransformStateType: TD3DTransformStateType;
  8266.         out lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8267.     function SetViewport(const lpViewport: TD3DViewport7) : HResult; stdcall;
  8268.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
  8269.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8270.     function GetViewport(out lpViewport: TD3DViewport7) : HResult; stdcall;
  8271.     function SetMaterial(const lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8272.     function GetMaterial(out lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8273.     function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7) : HResult; stdcall;
  8274.     function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7) : HResult; stdcall;
  8275.     function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD) : HResult; stdcall;
  8276.     function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD) : HResult; stdcall;
  8277.     function BeginStateBlock : HResult; stdcall;
  8278.     function EndStateBlock(out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8279.     function PreLoad(lpddsTexture: IDirectDrawSurface7) : HResult; stdcall;
  8280.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8281.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8282.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8283.     function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8284.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8285.         const lpwIndices; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8286.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8287.     function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8288.     function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8289.         dwVertexTypeDesc : DWORD;
  8290.         const lpVertexArray: TD3DDrawPrimitiveStridedData;
  8291.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8292.     function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8293.         dwVertexTypeDesc : DWORD;
  8294.         const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8295.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8296.     function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8297.         lpd3dVertexBuffer: IDirect3DVertexBuffer7;
  8298.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8299.     function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8300.         lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD;
  8301.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8302.     function ComputeSphereVisibility(const lpCenters: TD3DVector;
  8303.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8304.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8305.     function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8306.     function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8307.     function GetTextureStageState(dwStage: DWORD;
  8308.         dwState: TD3DTextureStageStateType; out lpdwValue: DWORD) : HResult; stdcall;
  8309.     function SetTextureStageState(dwStage: DWORD;
  8310.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8311.     function ValidateDevice(out lpdwExtraPasses: DWORD) : HResult; stdcall;
  8312.     function ApplyStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8313.     function CaptureStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8314.     function DeleteStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8315.     function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8316.     function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint;
  8317.         lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD) : HResult; stdcall;
  8318.     function LightEnable(dwLightIndex: DWORD; bEnable: BOOL) : HResult; stdcall;
  8319.     function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL) : HResult; stdcall;
  8320.     function SetClipPlane(dwIndex: DWORD; var pPlaneEquation: TD3DValue) : HResult; stdcall;
  8321.     function GetClipPlane(dwIndex: DWORD; out pPlaneEquation: TD3DValue) : HResult; stdcall;
  8322.     function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD) : HResult; stdcall;
  8323.   end;
  8324.  
  8325. (*
  8326.  * Execute Buffer interface
  8327.  *)
  8328.  
  8329.   IDirect3DExecuteBuffer = interface (IUnknown)
  8330.     ['{4417C145-33AD-11CF-816F-0000C020156E}']
  8331.     (*** IDirect3DExecuteBuffer methods ***)
  8332.     function Initialize (lpDirect3DDevice: IDirect3DDevice;
  8333.         var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8334.     function Lock (var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8335.     function Unlock: HResult; stdcall;
  8336.     function SetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8337.     function GetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8338.     function Validate (var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
  8339.         lpUserArg: Pointer; dwReserved: DWORD) : HResult; stdcall;
  8340.     (*** Warning!  Optimize is defined differently in the header files
  8341.          and the online documentation ***)
  8342.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  8343.   end;
  8344.  
  8345. (*
  8346.  * Light interfaces
  8347.  *)
  8348.  
  8349.   IDirect3DLight = interface (IUnknown)
  8350.     ['{4417C142-33AD-11CF-816F-0000C020156E}']
  8351.     (*** IDirect3DLight methods ***)
  8352.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8353.     function SetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8354.     function GetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8355.   end;
  8356.  
  8357. (*
  8358.  * Material interfaces
  8359.  *)
  8360.  
  8361.   IDirect3DMaterial = interface (IUnknown)
  8362.     ['{4417C144-33AD-11CF-816F-0000C020156E}']
  8363.     (*** IDirect3DMaterial methods ***)
  8364.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8365.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8366.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8367.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8368.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8369.     function Reserve: HResult; stdcall;
  8370.     function Unreserve: HResult; stdcall;
  8371.   end;
  8372.  
  8373.   IDirect3DMaterial2 = interface (IUnknown)
  8374.     ['{93281503-8cf8-11d0-89ab-00a0c9054129}']
  8375.     (*** IDirect3DMaterial2 methods ***)
  8376.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8377.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8378.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8379.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8380.   end;
  8381.  
  8382.   IDirect3DMaterial3 = interface (IUnknown)
  8383.     ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}']
  8384.     (*** IDirect3DMaterial2 methods ***)
  8385.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8386.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8387.     function GetHandle (lpDirect3DDevice: IDirect3DDevice3;
  8388.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8389.   end;
  8390.  
  8391. (*
  8392.  * Texture interfaces
  8393.  *)
  8394.  
  8395.   IDirect3DTexture = interface (IUnknown)
  8396.     ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
  8397.     (*** IDirect3DTexture methods ***)
  8398.     function Initialize (lpD3DDevice: IDirect3DDevice;
  8399.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8400.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8401.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8402.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8403.     function Load (lpD3DTexture: IDirect3DTexture) : HResult; stdcall;
  8404.     function Unload: HResult; stdcall;
  8405.   end;
  8406.  
  8407.   IDirect3DTexture2 = interface (IUnknown)
  8408.     ['{93281502-8cf8-11d0-89ab-00a0c9054129}']
  8409.     (*** IDirect3DTexture2 methods ***)
  8410.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8411.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8412.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8413.     function Load (lpD3DTexture: IDirect3DTexture2) : HResult; stdcall;
  8414.   end;
  8415.  
  8416. (*
  8417.  * Viewport interfaces
  8418.  *)
  8419.  
  8420.   IDirect3DViewport = interface (IUnknown)
  8421.     ['{4417C146-33AD-11CF-816F-0000C020156E}']
  8422.     (*** IDirect3DViewport methods ***)
  8423.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8424.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8425.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8426.     function TransformVertices (dwVertexCount: DWORD;
  8427.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8428.         out lpOffscreen: DWORD) : HResult; stdcall;
  8429.     function LightElements (dwElementCount: DWORD;
  8430.         var lpData: TD3DLightData) : HResult; stdcall;
  8431.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8432.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8433.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8434.         HResult; stdcall;
  8435.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8436.         out lpValid: BOOL) : HResult; stdcall;
  8437.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8438.         HResult; stdcall;
  8439.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8440.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8441.      function NextLight (lpDirect3DLight: IDirect3DLight;
  8442.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8443.   end;
  8444.  
  8445.   IDirect3DViewport2 = interface (IUnknown)
  8446.     ['{93281500-8cf8-11d0-89ab-00a0c9054129}']
  8447.     (*** IDirect3DViewport2 methods ***)
  8448.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8449.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8450.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8451.     function TransformVertices (dwVertexCount: DWORD;
  8452.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8453.         out lpOffscreen: DWORD) : HResult; stdcall;
  8454.     function LightElements (dwElementCount: DWORD;
  8455.         var lpData: TD3DLightData) : HResult; stdcall;
  8456.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8457.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8458.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8459.         HResult; stdcall;
  8460.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8461.         out lpValid: BOOL) : HResult; stdcall;
  8462.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8463.         HResult; stdcall;
  8464.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8465.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8466.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8467.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8468.     (*** IDirect3DViewport2 methods ***)
  8469.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8470.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8471.   end;
  8472.  
  8473.   IDirect3DViewport3 = interface (IUnknown)
  8474.     ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}']
  8475.     (*** IDirect3DViewport3 methods ***)
  8476.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8477.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8478.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8479.     function TransformVertices (dwVertexCount: DWORD;
  8480.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8481.         out lpOffscreen: DWORD) : HResult; stdcall;
  8482.     function LightElements (dwElementCount: DWORD;
  8483.         var lpData: TD3DLightData) : HResult; stdcall;
  8484.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8485.     function GetBackground (var hMat: TD3DMaterialHandle) : HResult; stdcall;
  8486.     function SetBackgroundDepth (
  8487.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8488.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8489.         out lpValid: BOOL) : HResult; stdcall;
  8490.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8491.         HResult; stdcall;
  8492.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8493.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8494.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8495.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8496.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8497.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8498.     function SetBackgroundDepth2 (
  8499.         lpDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  8500.     function GetBackgroundDepth2 (out lplpDDSurface: IDirectDrawSurface4;
  8501.         out lpValid: BOOL) : HResult; stdcall;
  8502.     function Clear2 (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
  8503.         dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8504.   end;
  8505.  
  8506.   IDirect3DVertexBuffer = interface (IUnknown)
  8507.     ['{7a503555-4a83-11d1-a5db-00a0c90367f8}']
  8508.     (*** IDirect3DVertexBuffer methods ***)
  8509.     function Lock (dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD)
  8510.         : HResult; stdcall;
  8511.     function Unlock : HResult; stdcall;
  8512.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8513.         lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
  8514.         lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8515.     function GetVertexBufferDesc (var lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8516.     function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8517.   end;
  8518.  
  8519.   IDirect3DVertexBuffer7 = interface (IUnknown)
  8520.     ['{f5049e7d-4861-11d2-a407-00a0c90629a8}']
  8521.     (*** IDirect3DVertexBuffer methods ***)
  8522.     function Lock (dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD) : HResult; stdcall;
  8523.     function Unlock : HResult; stdcall;
  8524.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8525.         lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD;
  8526.         lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8527.     function GetVertexBufferDesc (out lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8528.     function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8529.     function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD;
  8530.       lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD;
  8531.       lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8532.   end;
  8533.  
  8534. type
  8535.   IID_IDirect3D = IDirect3D;
  8536.   IID_IDirect3D2 = IDirect3D2;
  8537.   IID_IDirect3D3 = IDirect3D3;
  8538.   IID_IDirect3D7 = IDirect3D7;
  8539.  
  8540.   IID_IDirect3DDevice = IDirect3DDevice;
  8541.   IID_IDirect3DDevice2 = IDirect3DDevice2;
  8542.   IID_IDirect3DDevice3 = IDirect3DDevice3;
  8543.   IID_IDirect3DDevice7 = IDirect3DDevice7;
  8544.  
  8545.   IID_IDirect3DTexture = IDirect3DTexture;
  8546.   IID_IDirect3DTexture2 = IDirect3DTexture2;
  8547.   IID_IDirect3DLight = IDirect3DLight;
  8548.   IID_IDirect3DMaterial = IDirect3DMaterial;
  8549.   IID_IDirect3DMaterial2 = IDirect3DMaterial2;
  8550.   IID_IDirect3DMaterial3 = IDirect3DMaterial3;
  8551.   IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer;
  8552.   IID_IDirect3DViewport = IDirect3DViewport;
  8553.   IID_IDirect3DViewport2 = IDirect3DViewport2;
  8554.   IID_IDirect3DViewport3 = IDirect3DViewport3;
  8555.   IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer;
  8556.   IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7;
  8557.  
  8558.  
  8559. const
  8560. (****************************************************************************
  8561.  *
  8562.  * Flags for IDirect3DDevice::NextViewport
  8563.  *
  8564.  ****************************************************************************)
  8565.  
  8566. (*
  8567.  * Return the next viewport
  8568.  *)
  8569.   D3DNEXT_NEXT =        $00000001;
  8570.  
  8571. (*
  8572.  * Return the first viewport
  8573.  *)
  8574.   D3DNEXT_HEAD =        $00000002;
  8575.  
  8576. (*
  8577.  * Return the last viewport
  8578.  *)
  8579.   D3DNEXT_TAIL =        $00000004;
  8580.  
  8581.  
  8582. (****************************************************************************
  8583.  *
  8584.  * Flags for DrawPrimitive/DrawIndexedPrimitive
  8585.  *   Also valid for Begin/BeginIndexed
  8586.  *   Also valid for VertexBuffer::CreateVertexBuffer
  8587.  ****************************************************************************)
  8588.  
  8589. (*
  8590.  * Wait until the device is ready to draw the primitive
  8591.  * This will cause DP to not return DDERR_WASSTILLDRAWING
  8592.  *)
  8593.   D3DDP_WAIT =                                  $00000001;
  8594.  
  8595. (*
  8596.  * Hint that it is acceptable to render the primitive out of order.
  8597.  *)
  8598.   D3DDP_OUTOFORDER            = $00000002;
  8599.  
  8600. (*
  8601.  * Hint that the primitives have been clipped by the application.
  8602.  *)
  8603.   D3DDP_DONOTCLIP =                             $00000004;
  8604.  
  8605. (*
  8606.  * Hint that the extents need not be updated.
  8607.  *)
  8608.   D3DDP_DONOTUPDATEEXTENTS =    $00000008;
  8609.  
  8610. (*
  8611.  * Hint that the lighting should not be applied on vertices.
  8612.  *)
  8613.  
  8614.   D3DDP_DONOTLIGHT            = $00000010;
  8615.  
  8616.  
  8617. (*
  8618.  * Direct3D Errors
  8619.  * DirectDraw error codes are used when errors not specified here.
  8620.  *)
  8621.  
  8622. const
  8623.   MAKE_D3DHRESULT = HResult($88760000);
  8624.  
  8625.   D3D_OK                          = DD_OK;
  8626.   D3DERR_BADMAJORVERSION          = MAKE_D3DHRESULT + 700;
  8627.   D3DERR_BADMINORVERSION          = MAKE_D3DHRESULT + 701;
  8628.  
  8629. (*
  8630.  * An invalid device was requested by the application.
  8631.  *)
  8632.   D3DERR_INVALID_DEVICE   = MAKE_D3DHRESULT + 705;
  8633.   D3DERR_INITFAILED       = MAKE_D3DHRESULT + 706;
  8634.  
  8635. (*
  8636.  * SetRenderTarget attempted on a device that was
  8637.  * QI'd off the render target.
  8638.  *)
  8639.   D3DERR_DEVICEAGGREGATED = MAKE_D3DHRESULT + 707;
  8640.  
  8641.   D3DERR_EXECUTE_CREATE_FAILED    = MAKE_D3DHRESULT + 710;
  8642.   D3DERR_EXECUTE_DESTROY_FAILED   = MAKE_D3DHRESULT + 711;
  8643.   D3DERR_EXECUTE_LOCK_FAILED      = MAKE_D3DHRESULT + 712;
  8644.   D3DERR_EXECUTE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 713;
  8645.   D3DERR_EXECUTE_LOCKED           = MAKE_D3DHRESULT + 714;
  8646.   D3DERR_EXECUTE_NOT_LOCKED       = MAKE_D3DHRESULT + 715;
  8647.  
  8648.   D3DERR_EXECUTE_FAILED           = MAKE_D3DHRESULT + 716;
  8649.   D3DERR_EXECUTE_CLIPPED_FAILED   = MAKE_D3DHRESULT + 717;
  8650.  
  8651.   D3DERR_TEXTURE_NO_SUPPORT       = MAKE_D3DHRESULT + 720;
  8652.   D3DERR_TEXTURE_CREATE_FAILED    = MAKE_D3DHRESULT + 721;
  8653.   D3DERR_TEXTURE_DESTROY_FAILED   = MAKE_D3DHRESULT + 722;
  8654.   D3DERR_TEXTURE_LOCK_FAILED      = MAKE_D3DHRESULT + 723;
  8655.   D3DERR_TEXTURE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 724;
  8656.   D3DERR_TEXTURE_LOAD_FAILED      = MAKE_D3DHRESULT + 725;
  8657.   D3DERR_TEXTURE_SWAP_FAILED      = MAKE_D3DHRESULT + 726;
  8658.   D3DERR_TEXTURE_LOCKED           = MAKE_D3DHRESULT + 727;
  8659.   D3DERR_TEXTURE_NOT_LOCKED       = MAKE_D3DHRESULT + 728;
  8660.   D3DERR_TEXTURE_GETSURF_FAILED   = MAKE_D3DHRESULT + 729;
  8661.  
  8662.   D3DERR_MATRIX_CREATE_FAILED     = MAKE_D3DHRESULT + 730;
  8663.   D3DERR_MATRIX_DESTROY_FAILED    = MAKE_D3DHRESULT + 731;
  8664.   D3DERR_MATRIX_SETDATA_FAILED    = MAKE_D3DHRESULT + 732;
  8665.   D3DERR_MATRIX_GETDATA_FAILED    = MAKE_D3DHRESULT + 733;
  8666.   D3DERR_SETVIEWPORTDATA_FAILED   = MAKE_D3DHRESULT + 734;
  8667.  
  8668.   D3DERR_INVALIDCURRENTVIEWPORT   = MAKE_D3DHRESULT + 735;
  8669.   D3DERR_INVALIDPRIMITIVETYPE     = MAKE_D3DHRESULT + 736;
  8670.   D3DERR_INVALIDVERTEXTYPE        = MAKE_D3DHRESULT + 737;
  8671.   D3DERR_TEXTURE_BADSIZE          = MAKE_D3DHRESULT + 738;
  8672.   D3DERR_INVALIDRAMPTEXTURE       = MAKE_D3DHRESULT + 739;
  8673.  
  8674.   D3DERR_MATERIAL_CREATE_FAILED   = MAKE_D3DHRESULT + 740;
  8675.   D3DERR_MATERIAL_DESTROY_FAILED  = MAKE_D3DHRESULT + 741;
  8676.   D3DERR_MATERIAL_SETDATA_FAILED  = MAKE_D3DHRESULT + 742;
  8677.   D3DERR_MATERIAL_GETDATA_FAILED  = MAKE_D3DHRESULT + 743;
  8678.  
  8679.   D3DERR_INVALIDPALETTE           = MAKE_D3DHRESULT + 744;
  8680.  
  8681.   D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_D3DHRESULT + 745;
  8682.   D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  = MAKE_D3DHRESULT + 746;
  8683.   D3DERR_SURFACENOTINVIDMEM       = MAKE_D3DHRESULT + 747;
  8684.  
  8685.   D3DERR_LIGHT_SET_FAILED         = MAKE_D3DHRESULT + 750;
  8686.   D3DERR_LIGHTHASVIEWPORT         = MAKE_D3DHRESULT + 751;
  8687.   D3DERR_LIGHTNOTINTHISVIEWPORT   = MAKE_D3DHRESULT + 752;
  8688.  
  8689.   D3DERR_SCENE_IN_SCENE           = MAKE_D3DHRESULT + 760;
  8690.   D3DERR_SCENE_NOT_IN_SCENE       = MAKE_D3DHRESULT + 761;
  8691.   D3DERR_SCENE_BEGIN_FAILED       = MAKE_D3DHRESULT + 762;
  8692.   D3DERR_SCENE_END_FAILED         = MAKE_D3DHRESULT + 763;
  8693.  
  8694.   D3DERR_INBEGIN                  = MAKE_D3DHRESULT + 770;
  8695.   D3DERR_NOTINBEGIN               = MAKE_D3DHRESULT + 771;
  8696.   D3DERR_NOVIEWPORTS              = MAKE_D3DHRESULT + 772;
  8697.   D3DERR_VIEWPORTDATANOTSET       = MAKE_D3DHRESULT + 773;
  8698.   D3DERR_VIEWPORTHASNODEVICE      = MAKE_D3DHRESULT + 774;
  8699.   D3DERR_NOCURRENTVIEWPORT        = MAKE_D3DHRESULT + 775;
  8700.  
  8701.   D3DERR_INVALIDVERTEXFORMAT      = MAKE_D3DHRESULT + 2048;
  8702.  
  8703. (*
  8704.  * Attempted to CreateTexture on a surface that had a color key
  8705.  *)
  8706.   D3DERR_COLORKEYATTACHED                 = MAKE_D3DHRESULT + 2050;
  8707.  
  8708.   D3DERR_VERTEXBUFFEROPTIMIZED            = MAKE_D3DHRESULT + 2060;
  8709.   D3DERR_VBUF_CREATE_FAILED               = MAKE_D3DHRESULT + 2061;
  8710.   D3DERR_VERTEXBUFFERLOCKED               = MAKE_D3DHRESULT + 2062;
  8711.  
  8712.   D3DERR_ZBUFFER_NOTPRESENT               = MAKE_D3DHRESULT + 2070;
  8713.   D3DERR_STENCILBUFFER_NOTPRESENT         = MAKE_D3DHRESULT + 2071;
  8714.  
  8715.   D3DERR_WRONGTEXTUREFORMAT               = MAKE_D3DHRESULT + 2072;
  8716.   D3DERR_UNSUPPORTEDCOLOROPERATION        = MAKE_D3DHRESULT + 2073;
  8717.   D3DERR_UNSUPPORTEDCOLORARG              = MAKE_D3DHRESULT + 2074;
  8718.   D3DERR_UNSUPPORTEDALPHAOPERATION        = MAKE_D3DHRESULT + 2075;
  8719.   D3DERR_UNSUPPORTEDALPHAARG              = MAKE_D3DHRESULT + 2076;
  8720.   D3DERR_TOOMANYOPERATIONS                = MAKE_D3DHRESULT + 2077;
  8721.   D3DERR_CONFLICTINGTEXTUREFILTER         = MAKE_D3DHRESULT + 2078;
  8722.   D3DERR_UNSUPPORTEDFACTORVALUE           = MAKE_D3DHRESULT + 2079;
  8723.   D3DERR_CONFLICTINGRENDERSTATE           = MAKE_D3DHRESULT + 2081;
  8724.   D3DERR_UNSUPPORTEDTEXTUREFILTER         = MAKE_D3DHRESULT + 2082;
  8725.   D3DERR_TOOMANYPRIMITIVES                = MAKE_D3DHRESULT + 2083;
  8726.   D3DERR_INVALIDMATRIX                    = MAKE_D3DHRESULT + 2084;
  8727.   D3DERR_TOOMANYVERTICES                  = MAKE_D3DHRESULT + 2085;
  8728.   D3DERR_CONFLICTINGTEXTUREPALETTE        = MAKE_D3DHRESULT + 2086;
  8729.  
  8730.   D3DERR_INVALIDSTATEBLOCK        = MAKE_D3DHRESULT + 2100;
  8731.   D3DERR_INBEGINSTATEBLOCK        = MAKE_D3DHRESULT + 2101;
  8732.   D3DERR_NOTINBEGINSTATEBLOCK     = MAKE_D3DHRESULT + 2102;
  8733.  
  8734. procedure DisableFPUExceptions;
  8735. procedure EnableFPUExceptions;
  8736.  
  8737. (***************************************************************************
  8738.  *
  8739.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  8740.  *
  8741.  *  File:       dxfile.h
  8742.  *
  8743.  *  Content:    DirectX File public header file
  8744.  *
  8745.  ***************************************************************************)
  8746.  
  8747. var
  8748.   DXFileDLL : HMODULE;
  8749.  
  8750. function DXFileErrorString(Value: HResult) : string;
  8751.  
  8752. type
  8753.   TDXFileFormat = (
  8754.     DXFILEFORMAT_BINARY,
  8755.     DXFILEFORMAT_TEXT,
  8756.     DXFILEFORMAT_COMPRESSED
  8757.   );
  8758.  
  8759.   TDXFileLoadOptions = (
  8760.     DXFILELOAD_FROMFILE,
  8761.     DXFILELOAD_FROMRESOURCE,
  8762.     DXFILELOAD_FROMMEMORY,
  8763.     DXFILELOAD_INVALID_3,
  8764.     DXFILELOAD_FROMSTREAM,
  8765.     DXFILELOAD_INVALID_5,
  8766.     DXFILELOAD_INVALID_6,
  8767.     DXFILELOAD_INVALID_7,
  8768.     DXFILELOAD_FROMURL
  8769.   );
  8770.  
  8771.   PDXFileLoadResource = ^TDXFileLoadResource;
  8772.   TDXFileLoadResource = packed record
  8773.     hModule: HModule;
  8774.     lpName: PAnsiChar;
  8775.     lpType: PAnsiChar;
  8776.   end;
  8777.  
  8778.   PDXFileLoadMemory = ^TDXFileLoadMemory;
  8779.   TDXFileLoadMemory = packed record
  8780.     lpMemory: Pointer;
  8781.     dSize: DWORD;
  8782.   end;
  8783.  
  8784. (*
  8785.  * DirectX File object types.
  8786.  *)
  8787.  
  8788.   IDirectXFile = interface;
  8789.   IDirectXFileEnumObject = interface;
  8790.   IDirectXFileSaveObject = interface;
  8791.   IDirectXFileObject = interface;
  8792.   IDirectXFileData = interface;
  8793.   IDirectXFileDataReference = interface;
  8794.   IDirectXFileBinary = interface;
  8795.  
  8796. (*
  8797.  * DirectX File interfaces.
  8798.  *)
  8799.  
  8800.   IDirectXFile = interface (IUnknown)
  8801.     ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
  8802.     function CreateEnumObject (pvSource: Pointer;
  8803.         dwLoadOptions: TDXFileLoadOptions;
  8804.         var ppEnumObj: IDirectXFileEnumObject) : HResult; stdcall;
  8805.     function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
  8806.         var ppSaveObj: IDirectXFileSaveObject) : HResult; stdcall;
  8807.     function RegisterTemplates (pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8808.   end;
  8809.  
  8810.   IDirectXFileEnumObject = interface (IUnknown)
  8811.     ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
  8812.     function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8813.     function GetDataObjectById
  8814.         (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8815.     function GetDataObjectByName
  8816.         (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8817.   end;
  8818.  
  8819.   IDirectXFileSaveObject = interface (IUnknown)
  8820.     ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
  8821.     function SaveTemplates
  8822.         (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
  8823.     function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
  8824.         pguid: PGUID; cbSize: DWORD; pvData: Pointer;
  8825.         var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8826.     function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
  8827.   end;
  8828.  
  8829.   IDirectXFileObject = interface (IUnknown)
  8830.     ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
  8831.     function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
  8832.     function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
  8833.   end;
  8834.  
  8835.   IDirectXFileData = interface (IDirectXFileObject)
  8836.     ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
  8837.     function GetData
  8838.         (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
  8839.     function GetType (var ppguid: PGUID) : HResult; stdcall;
  8840.     function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
  8841.     function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
  8842.     function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
  8843.     function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
  8844.         pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8845.   end;
  8846.  
  8847.   IDirectXFileDataReference = interface (IDirectXFileObject)
  8848.     ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
  8849.     function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8850.   end;
  8851.  
  8852.   IDirectXFileBinary = interface (IDirectXFileObject)
  8853.     ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
  8854.     function GetSize (var pcbSize: DWORD) : HResult; stdcall;
  8855.     function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
  8856.     function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
  8857.   end;
  8858.  
  8859. const
  8860.  
  8861. (*
  8862.  * DirectXFile Object Class Id (for CoCreateInstance())
  8863.  *)
  8864.  
  8865.    CLSID_CDirectXFile: TGUID =
  8866.        (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  8867.  
  8868. (*
  8869.  * DirectX File Interface GUIDs.
  8870.  *)
  8871.  
  8872. type
  8873.   IID_IDirectXFile = IDirectXFile;
  8874.   IID_IDirectXFileEnumObject = IDirectXFileEnumObject;
  8875.   IID_IDirectXFileSaveObject = IDirectXFileSaveObject;
  8876.   IID_IDirectXFileObject = IDirectXFileObject;
  8877.   IID_IDirectXFileData = IDirectXFileData;
  8878.   IID_IDirectXFileDataReference = IDirectXFileDataReference;
  8879.   IID_IDirectXFileBinary = IDirectXFileBinary;
  8880.  
  8881. (*
  8882.  * DirectX File Header template's GUID.
  8883.  *)
  8884. const
  8885.   TID_DXFILEHeader: TGUID =
  8886.       (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  8887.  
  8888. (*
  8889.  * DirectX File errors.
  8890.  *)
  8891.  
  8892. const
  8893.   DXFILE_OK = 0;
  8894.  
  8895.   DXFILEERR_BADOBJECT                 = MAKE_D3DHRESULT or 850;
  8896.   DXFILEERR_BADVALUE                  = MAKE_D3DHRESULT or 851;
  8897.   DXFILEERR_BADTYPE                   = MAKE_D3DHRESULT or 852;
  8898.   DXFILEERR_BADSTREAMHANDLE           = MAKE_D3DHRESULT or 853;
  8899.   DXFILEERR_BADALLOC                  = MAKE_D3DHRESULT or 854;
  8900.   DXFILEERR_NOTFOUND                  = MAKE_D3DHRESULT or 855;
  8901.   DXFILEERR_NOTDONEYET                = MAKE_D3DHRESULT or 856;
  8902.   DXFILEERR_FILENOTFOUND              = MAKE_D3DHRESULT or 857;
  8903.   DXFILEERR_RESOURCENOTFOUND          = MAKE_D3DHRESULT or 858;
  8904.   DXFILEERR_URLNOTFOUND               = MAKE_D3DHRESULT or 859;
  8905.   DXFILEERR_BADRESOURCE               = MAKE_D3DHRESULT or 860;
  8906.   DXFILEERR_BADFILETYPE               = MAKE_D3DHRESULT or 861;
  8907.   DXFILEERR_BADFILEVERSION            = MAKE_D3DHRESULT or 862;
  8908.   DXFILEERR_BADFILEFLOATSIZE          = MAKE_D3DHRESULT or 863;
  8909.   DXFILEERR_BADFILECOMPRESSIONTYPE    = MAKE_D3DHRESULT or 864;
  8910.   DXFILEERR_BADFILE                   = MAKE_D3DHRESULT or 865;
  8911.   DXFILEERR_PARSEERROR                = MAKE_D3DHRESULT or 866;
  8912.   DXFILEERR_NOTEMPLATE                = MAKE_D3DHRESULT or 867;
  8913.   DXFILEERR_BADARRAYSIZE              = MAKE_D3DHRESULT or 868;
  8914.   DXFILEERR_BADDATAREFERENCE          = MAKE_D3DHRESULT or 869;
  8915.   DXFILEERR_INTERNALERROR             = MAKE_D3DHRESULT or 870;
  8916.   DXFILEERR_NOMOREOBJECTS             = MAKE_D3DHRESULT or 871;
  8917.   DXFILEERR_BADINTRINSICS             = MAKE_D3DHRESULT or 872;
  8918.   DXFILEERR_NOMORESTREAMHANDLES       = MAKE_D3DHRESULT or 873;
  8919.   DXFILEERR_NOMOREDATA                = MAKE_D3DHRESULT or 874;
  8920.   DXFILEERR_BADCACHEFILE              = MAKE_D3DHRESULT or 875;
  8921.   DXFILEERR_NOINTERNET                = MAKE_D3DHRESULT or 876;
  8922.  
  8923. {$IFDEF D3DRM}
  8924. (*
  8925.  * API for creating IDirectXFile interface.
  8926.  *)
  8927.  
  8928. var
  8929.   DirectXFileCreate : function
  8930.     (out lplpDirectXFile: IDirectXFile) : HResult; stdcall;
  8931.  
  8932. (* D3DRM XFile templates in binary form *)
  8933. const
  8934.   D3DRM_XTEMPLATE_BYTES = 3215;
  8935.   D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = (
  8936.         $78, $6f, $66, $20, $30, $33, $30, $32, $62,
  8937.         $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  8938.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
  8939.         $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  8940.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  8941.         $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  8942.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
  8943.         $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  8944.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
  8945.         $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  8946.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  8947.         $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  8948.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
  8949.         $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  8950.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
  8951.         0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  8952.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
  8953.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  8954.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
  8955.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  8956.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
  8957.         0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  8958.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
  8959.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  8960.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
  8961.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  8962.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
  8963.         $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  8964.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
  8965.         $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  8966.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  8967.         $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  8968.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
  8969.         $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  8970.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
  8971.         0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  8972.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
  8973.         $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  8974.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
  8975.         $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  8976.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
  8977.         $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  8978.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
  8979.         $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  8980.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
  8981.         $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  8982.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
  8983.         $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  8984.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
  8985.         $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  8986.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8987.         $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  8988.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
  8989.         0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  8990.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
  8991.         $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  8992.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
  8993.         $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  8994.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
  8995.         $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  8996.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
  8997.         $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  8998.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
  8999.         $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  9000.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
  9001.         $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  9002.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
  9003.         0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  9004.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
  9005.         $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  9006.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
  9007.         $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  9008.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
  9009.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9010.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
  9011.         $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  9012.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
  9013.         $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  9014.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
  9015.         0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  9016.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
  9017.         $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  9018.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
  9019.         $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  9020.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
  9021.         $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  9022.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
  9023.         $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  9024.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
  9025.         $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  9026.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
  9027.         $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  9028.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
  9029.         0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  9030.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
  9031.         0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  9032.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
  9033.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  9034.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
  9035.         $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  9036.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
  9037.         0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  9038.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
  9039.         0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  9040.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9041.         0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  9042.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
  9043.         $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  9044.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
  9045.         $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  9046.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
  9047.         0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  9048.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
  9049.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9050.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
  9051.         $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  9052.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
  9053.         $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  9054.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
  9055.         $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  9056.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
  9057.         $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  9058.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
  9059.         $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  9060.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
  9061.         $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  9062.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9063.         $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  9064.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
  9065.         $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  9066.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  9067.         $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  9068.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
  9069.         $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  9070.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  9071.         $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  9072.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
  9073.         $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  9074.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
  9075.         $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  9076.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
  9077.         $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  9078.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
  9079.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  9080.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
  9081.         0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  9082.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
  9083.         0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  9084.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
  9085.         $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  9086.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
  9087.         0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  9088.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
  9089.         0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  9090.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
  9091.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  9092.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
  9093.         $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  9094.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9095.         $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  9096.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
  9097.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  9098.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
  9099.         $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  9100.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
  9101.         $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  9102.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
  9103.         $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  9104.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
  9105.         $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  9106.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9107.         $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  9108.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9109.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9110.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
  9111.         $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  9112.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
  9113.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9114.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
  9115.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9116.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
  9117.         0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  9118.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
  9119.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9120.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
  9121.         $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  9122.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9123.         $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  9124.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
  9125.         $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9126.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
  9127.         $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  9128.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
  9129.         $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  9130.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
  9131.         0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  9132.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
  9133.         $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  9134.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
  9135.         0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  9136.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
  9137.         $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  9138.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
  9139.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9140.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
  9141.         $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  9142.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
  9143.         0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  9144.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9145.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  9146.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
  9147.         $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  9148.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
  9149.         0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  9150.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
  9151.         $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  9152.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
  9153.         $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  9154.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
  9155.         0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  9156.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
  9157.         0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  9158.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
  9159.         $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  9160.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
  9161.         $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  9162.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
  9163.         $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  9164.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
  9165.         $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  9166.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
  9167.         0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  9168.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
  9169.         $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  9170.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
  9171.         $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  9172.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
  9173.         $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  9174.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
  9175.         $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  9176.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
  9177.         0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  9178.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
  9179.         $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  9180.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
  9181.         $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  9182.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
  9183.         0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  9184.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
  9185.         $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  9186.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
  9187.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  9188.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
  9189.         $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  9190.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
  9191.         $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  9192.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
  9193.         $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  9194.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
  9195.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  9196.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9197.         0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  9198.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
  9199.         $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  9200.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  9201.         $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  9202.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
  9203.         $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  9204.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
  9205.         $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  9206.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9207.         $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  9208.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
  9209.         $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  9210.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
  9211.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9212.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
  9213.         $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  9214.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
  9215.         $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  9216.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
  9217.         0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  9218.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
  9219.         $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  9220.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
  9221.         $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  9222.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
  9223.         $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  9224.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
  9225.         0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  9226.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
  9227.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  9228.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
  9229.         $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  9230.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
  9231.         0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  9232.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
  9233.         $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  9234.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
  9235.         0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  9236.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
  9237.         $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  9238.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
  9239.         $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  9240.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
  9241.         0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  9242.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
  9243.         $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  9244.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
  9245.         $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  9246.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
  9247.         $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  9248.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
  9249.         $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  9250.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
  9251.         $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  9252.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
  9253.         $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  9254.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
  9255.         $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  9256.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
  9257.         $12, 0, $f, 0, $b, 0);
  9258.  
  9259. //---------------
  9260.  
  9261. //Direct3DRM file
  9262. (*==========================================================================;
  9263.  *
  9264.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  9265.  *
  9266.  *  Files:      D3DRMDef.h D3DRMObj.h D3DRM.h D3DRMWin.h RMXFGUID.h RMXFTmpl.h
  9267.  *  Content:    Direct3D Retained Mode include files
  9268.  *
  9269.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  9270.  *
  9271.  *  Modified: 10-Sep-2000
  9272.  *
  9273.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  9274.  *  E-Mail: DelphiDirectX@next-reality.com
  9275.  *
  9276.  *
  9277.  ***************************************************************************)
  9278.  
  9279. var
  9280.   D3DRMDLL : HMODULE = 0;
  9281.  
  9282. (*==========================================================================;
  9283.  *
  9284.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9285.  *
  9286.  *  File:       d3drmdef.h
  9287.  *  Content:    Direct3DRM include file
  9288.  *
  9289.  ***************************************************************************)
  9290.  
  9291. type
  9292.   PD3DRMVector4D = ^TD3DRMVector4D;
  9293.   TD3DRMVector4D = packed record
  9294.     x, y, z, w: TD3DValue;
  9295.   end;
  9296.  
  9297.   PD3DRMMatrix4D = ^TD3DRMMatrix4D;
  9298.   TD3DRMMatrix4D = array [0..3, 0..3] of TD3DValue;
  9299.  
  9300.   PD3DRMQuaternion = ^TD3DRMQuaternion;
  9301.   TD3DRMQuaternion = packed record
  9302.     s: TD3DValue;
  9303.     v: TD3DVector;
  9304.   end;
  9305.  
  9306.   PD3DRMRay = ^TD3DRMRay;
  9307.   TD3DRMRay = packed record
  9308.     dvDir: TD3DVector;
  9309.     dvPos: TD3DVector;
  9310.   end;
  9311.  
  9312.   PD3DRMBox = ^TD3DRMBox;
  9313.   TD3DRMBox = packed record
  9314.     min, max: TD3DVector;
  9315.   end;
  9316.  
  9317.   TD3DRMWrapCallback = procedure (var lpD3DVector: TD3DVector;
  9318.       var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB: TD3DVector; lpArg:
  9319.       Pointer); stdcall; // unused ?
  9320.  
  9321.   PD3DRMLightType = ^TD3DRMLightType; // is it 16 or 32 bit ?
  9322.   TD3DRMLightType = (
  9323.     D3DRMLIGHT_AMBIENT,
  9324.     D3DRMLIGHT_POINT,
  9325.     D3DRMLIGHT_SPOT,
  9326.     D3DRMLIGHT_DIRECTIONAL,
  9327.     D3DRMLIGHT_PARALLELPOINT
  9328.   );
  9329.  
  9330.   PD3DRMShadeMode = ^TD3DRMShadeMode;
  9331.   TD3DRMShadeMode = WORD;
  9332.  
  9333. const
  9334.   D3DRMSHADE_FLAT = 0;
  9335.   D3DRMSHADE_GOURAUD = 1;
  9336.   D3DRMSHADE_PHONG = 2;
  9337.   D3DRMSHADE_MASK = 7;
  9338.   D3DRMSHADE_MAX = 8;
  9339.  
  9340. type
  9341.   PD3DRMLightMode = ^TD3DRMLightMode;
  9342.   TD3DRMLightMode = WORD;
  9343.  
  9344. const
  9345.   D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
  9346.   D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
  9347.   D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
  9348.   D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
  9349.  
  9350. type
  9351.   PD3DRMFillMode = ^TD3DRMFillMode;
  9352.   TD3DRMFillMode = WORD;
  9353.  
  9354. const
  9355.   D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
  9356.   D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
  9357.   D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
  9358.   D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
  9359.   D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
  9360.  
  9361. type
  9362.   PD3DRMRenderQuality = ^TD3DRMRenderQuality;
  9363.   TD3DRMRenderQuality = DWORD;
  9364.  
  9365. const
  9366.   D3DRMRENDER_WIREFRAME   =
  9367.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME);
  9368.   D3DRMRENDER_UNLITFLAT   =
  9369.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID);
  9370.   D3DRMRENDER_FLAT        =
  9371.       (D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9372.   D3DRMRENDER_GOURAUD     =
  9373.       (D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9374.   D3DRMRENDER_PHONG       =
  9375.       (D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9376.  
  9377.   D3DRMRENDERMODE_BLENDEDTRANSPARENCY   =  1;
  9378.   D3DRMRENDERMODE_SORTEDTRANSPARENCY    =  2;
  9379.   D3DRMRENDERMODE_LIGHTINMODELSPACE     =  8;
  9380.   D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16;
  9381.  
  9382. type
  9383.   PD3DRMTextureQuality = ^TD3DRMTextureQuality;
  9384.   TD3DRMTextureQuality = (
  9385.     D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
  9386.     D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
  9387.     D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
  9388.     D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
  9389.     D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
  9390.     D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
  9391.   );
  9392.  
  9393. const
  9394. (*
  9395.  * Texture flags
  9396.  *)
  9397.   D3DRMTEXTURE_FORCERESIDENT          = $00000001; (* texture should be kept in video memory *)
  9398.   D3DRMTEXTURE_STATIC                 = $00000002; (* texture will not change *)
  9399.   D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; (* point filtering should be used when downsampling *)
  9400.   D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; (* bilinear filtering should be used when downsampling *)
  9401.   D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; (* reduce bit depth when downsampling *)
  9402.   D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; (* texture should never be downsampled *)
  9403.   D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; (* pixels have changed *)
  9404.   D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; (* palette has changed *)
  9405.   D3DRMTEXTURE_INVALIDATEONLY         = $00000100; (* dirty regions are invalid *)
  9406.  
  9407. (*
  9408.  * Shadow flags
  9409.  *)
  9410.    D3DRMSHADOW_TRUEALPHA               = $00000001; (* shadow should render without artifacts when true alpha is on *)
  9411.  
  9412. type
  9413.   PD3DRMCombineType = ^TD3DRMCombineType;
  9414.   TD3DRMCombineType = (
  9415.     D3DRMCOMBINE_REPLACE,
  9416.     D3DRMCOMBINE_BEFORE,
  9417.     D3DRMCOMBINE_AFTER
  9418.   );
  9419.  
  9420.   PD3DRMColorModel = ^TD3DRMColorModel;
  9421.   TD3DRMColorModel = TD3DColorModel;
  9422.  
  9423.   PD3DRMPaletteFlags = ^TD3DRMPaletteFlags;
  9424.   TD3DRMPaletteFlags = (
  9425.     D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
  9426.     D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
  9427.     D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
  9428.   );
  9429.  
  9430.   PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
  9431.   TD3DRMPaletteEntry = packed record
  9432.     red: Byte;          (* 0 .. 255 *)
  9433.     green: Byte;        (* 0 .. 255 *)
  9434.     blue: Byte;         (* 0 .. 255 *)
  9435.     flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
  9436.   end;
  9437.  
  9438.   PD3DRMImage = ^TD3DRMImage;
  9439.   TD3DRMImage = packed record
  9440.     width, height: Integer;    (* width and height in pixels *)
  9441.     aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
  9442.     depth: Integer;            (* bits per pixel *)
  9443.     rgb: Integer;              (* if false, pixels are indices into a
  9444.                                    palette otherwise, pixels encode
  9445.                                    RGB values. *)
  9446.     bytes_per_line: Integer;   (* number of bytes of memory for a
  9447.                                    scanline. This must be a multiple
  9448.                                    of 4. *)
  9449.     buffer1: Pointer;          (* memory to render into (first buffer). *)
  9450.     buffer2: Pointer;          (* second rendering buffer for double
  9451.                                    buffering, set to NULL for single
  9452.                                    buffering. *)
  9453.     red_mask: DWORD;
  9454.     green_mask: DWORD;
  9455.     blue_mask: DWORD;
  9456.     alpha_mask: DWORD;        (* if rgb is true, these are masks for
  9457.                                    the red, green and blue parts of a
  9458.                                    pixel.  Otherwise, these are masks
  9459.                                    for the significant bits of the
  9460.                                    red, green and blue elements in the
  9461.                                    palette.  For instance, most SVGA
  9462.                                    displays use 64 intensities of red,
  9463.                                    green and blue, so the masks should
  9464.                                    all be set to = $fc. *)
  9465.     palette_size: Integer;     (* number of entries in palette *)
  9466.     palette: PD3DRMPaletteEntry; (* description of the palette (only if
  9467.                                    rgb is false).  Must be (1<<depth)
  9468.                                    elements. *)
  9469.   end;
  9470.  
  9471.   PD3DRMWrapType = ^TD3DRMWrapType;
  9472.   TD3DRMWrapType = (
  9473.     D3DRMWRAP_FLAT,
  9474.     D3DRMWRAP_CYLINDER,
  9475.     D3DRMWRAP_SPHERE,
  9476.     D3DRMWRAP_CHROME,
  9477.     D3DRMWRAP_SHEET,
  9478.     D3DRMWRAP_BOX
  9479.   );
  9480.  
  9481. const
  9482.   D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
  9483.   D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
  9484.  
  9485. type
  9486. (*
  9487.  * Do not use righthanded perspective in Viewport2::SetProjection().
  9488.  * Set up righthanded mode by using IDirect3DRM3::SetOptions().
  9489.  *)
  9490.   PD3DRMProjectionType = ^TD3DRMProjectionType;
  9491.   TD3DRMProjectionType = (
  9492.     D3DRMPROJECT_PERSPECTIVE,
  9493.     D3DRMPROJECT_ORTHOGRAPHIC,
  9494.     D3DRMPROJECT_RIGHTHANDPERSPECTIVE, (* Only valid pre-DX6 *)
  9495.     D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC (* Only valid pre-DX6 *)
  9496.   );
  9497.  
  9498. const
  9499.   D3DRMOPTIONS_LEFTHANDED  = 00000001; (* Default *)
  9500.   D3DRMOPTIONS_RIGHTHANDED = 00000002;
  9501.  
  9502. type
  9503.   PD3DRMXOFFormat = ^TD3DRMXOFFormat;
  9504.   TD3DRMXOFFormat = (
  9505.     D3DRMXOF_BINARY,
  9506.     D3DRMXOF_COMPRESSED,
  9507.     D3DRMXOF_TEXT
  9508.   );
  9509.  
  9510.   TD3DRMSaveOptions = DWORD;
  9511. const
  9512.   D3DRMXOFSAVE_NORMALS = 1;
  9513.   D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
  9514.   D3DRMXOFSAVE_MATERIALS = 4;
  9515.   D3DRMXOFSAVE_TEXTURENAMES = 8;
  9516.   D3DRMXOFSAVE_ALL = 15;
  9517.   D3DRMXOFSAVE_TEMPLATES = 16;
  9518.   D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
  9519.  
  9520. type
  9521.   PD3DRMColorSource = ^TD3DRMColorSource;
  9522.   TD3DRMColorSource = (
  9523.     D3DRMCOLOR_FROMFACE,
  9524.     D3DRMCOLOR_FROMVERTEX
  9525.   );
  9526.  
  9527.   PD3DRMFrameConstraint = ^TD3DRMFrameConstraint;
  9528.   TD3DRMFrameConstraint = (
  9529.     D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
  9530.     D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
  9531.     D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
  9532.   );
  9533.  
  9534.   PD3DRMMaterialMode = ^TD3DRMMaterialMode;
  9535.   TD3DRMMaterialMode = (
  9536.     D3DRMMATERIAL_FROMMESH,
  9537.     D3DRMMATERIAL_FROMPARENT,
  9538.     D3DRMMATERIAL_FROMFRAME
  9539.   );
  9540.  
  9541.   PD3DRMFogMode = ^TD3DRMFogMode;
  9542.   TD3DRMFogMode = (
  9543.     D3DRMFOG_LINEAR,            (* linear between start and end *)
  9544.     D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
  9545.     D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
  9546.   );
  9547.  
  9548.   PD3DRMZBufferMode = ^TD3DRMZBufferMode;
  9549.   TD3DRMZBufferMode = (
  9550.     D3DRMZBUFFER_FROMPARENT,    (* default *)
  9551.     D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
  9552.     D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
  9553.   );
  9554.  
  9555.   PD3DRMSortMode = ^TD3DRMSortMode;
  9556.   TD3DRMSortMode = (
  9557.     D3DRMSORT_FROMPARENT,       (* default *)
  9558.     D3DRMSORT_NONE,             (* don't sort child frames *)
  9559.     D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
  9560.     D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
  9561.   );
  9562.  
  9563.   TD3DRMMaterialOverride = packed record
  9564.     dwSize : DWORD;       (* Size of this structure *)
  9565.     dwFlags : DWORD;      (* Indicate which fields are valid *)
  9566.     dcDiffuse : TD3DColorValue;    (* RGBA *)
  9567.     dcAmbient : TD3DColorValue;    (* RGB *)
  9568.     dcEmissive : TD3DColorValue;   (* RGB *)
  9569.     dcSpecular : TD3DColorValue;   (* RGB *)
  9570.     dvPower : TD3DValue;
  9571.     lpD3DRMTex : IUnknown;
  9572.   end;
  9573.  
  9574. const
  9575.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
  9576.   D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
  9577.   D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
  9578.   D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
  9579.   D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
  9580.   D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
  9581.   D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
  9582.   D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
  9583.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
  9584.   D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
  9585.  
  9586.   D3DRMFPTF_ALPHA                           = $00000001;
  9587.   D3DRMFPTF_NOALPHA                         = $00000002;
  9588.   D3DRMFPTF_PALETTIZED                      = $00000004;
  9589.   D3DRMFPTF_NOTPALETTIZED                   = $00000008;
  9590.  
  9591.   D3DRMSTATECHANGE_UPDATEONLY               = $000000001;
  9592.   D3DRMSTATECHANGE_VOLATILE                 = $000000002;
  9593.   D3DRMSTATECHANGE_NONVOLATILE              = $000000004;
  9594.   D3DRMSTATECHANGE_RENDER                   = $000000020;
  9595.   D3DRMSTATECHANGE_LIGHT                    = $000000040;
  9596.  
  9597. (*
  9598.  * Values for flags in RM3::CreateDeviceFromSurface
  9599.  *)
  9600.   D3DRMDEVICE_NOZBUFFER           = $00000001;
  9601.  
  9602. (*
  9603.  * Values for flags in Object2::SetClientData
  9604.  *)
  9605.   D3DRMCLIENTDATA_NONE            = $00000001;
  9606.   D3DRMCLIENTDATA_LOCALFREE       = $00000002;
  9607.   D3DRMCLIENTDATA_IUNKNOWN        = $00000004;
  9608.  
  9609. (*
  9610.  * Values for flags in Frame2::AddMoveCallback.
  9611.  *)
  9612.   D3DRMCALLBACK_PREORDER                = 0;
  9613.   D3DRMCALLBACK_POSTORDER               = 1;
  9614.  
  9615. (*
  9616.  * Values for flags in MeshBuilder2::RayPick.
  9617.  *)
  9618.   D3DRMRAYPICK_ONLYBOUNDINGBOXES        = 1;
  9619.   D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES  = 2;
  9620.   D3DRMRAYPICK_INTERPOLATEUV            = 4;
  9621.   D3DRMRAYPICK_INTERPOLATECOLOR         = 8;
  9622.   D3DRMRAYPICK_INTERPOLATENORMAL        = $10;
  9623.  
  9624. (*
  9625.  * Values for flags in MeshBuilder3::AddFacesIndexed.
  9626.  *)
  9627.   D3DRMADDFACES_VERTICESONLY             = 1;
  9628.  
  9629. (*
  9630.  * Values for flags in MeshBuilder2::GenerateNormals.
  9631.  *)
  9632.   D3DRMGENERATENORMALS_PRECOMPACT       = 1;
  9633.   D3DRMGENERATENORMALS_USECREASEANGLE   = 2;
  9634.  
  9635. (*
  9636.  * Values for MeshBuilder3::GetParentMesh
  9637.  *)
  9638.   D3DRMMESHBUILDER_DIRECTPARENT          = 1;
  9639.   D3DRMMESHBUILDER_ROOTMESH              = 2;
  9640.  
  9641. (*
  9642.  * Flags for MeshBuilder3::Enable
  9643.  *)
  9644.   D3DRMMESHBUILDER_RENDERENABLE   = $00000001;
  9645.   D3DRMMESHBUILDER_PICKENABLE     = $00000002;
  9646.  
  9647. (*
  9648.  * Flags for Object2::GetAge when used with MeshBuilders
  9649.  *)
  9650.   D3DRMMESHBUILDERAGE_GEOMETRY    = $00000001;
  9651.   D3DRMMESHBUILDERAGE_MATERIALS   = $00000002;
  9652.   D3DRMMESHBUILDERAGE_TEXTURES    = $00000004;
  9653.  
  9654. (*
  9655.  * Format flags for MeshBuilder3::AddTriangles.
  9656.  *)
  9657.   D3DRMFVF_TYPE                   = $00000001;
  9658.   D3DRMFVF_NORMAL                 = $00000002;
  9659.   D3DRMFVF_COLOR                  = $00000004;
  9660.   D3DRMFVF_TEXTURECOORDS          = $00000008;
  9661.  
  9662.   D3DRMVERTEX_STRIP               = $00000001;
  9663.   D3DRMVERTEX_FAN                 = $00000002;
  9664.   D3DRMVERTEX_LIST                = $00000004;
  9665.  
  9666. (*
  9667.  * Values for flags in Viewport2::Clear2
  9668.  *)
  9669.   D3DRMCLEAR_TARGET               = $00000001;
  9670.   D3DRMCLEAR_ZBUFFER              = $00000002;
  9671.   D3DRMCLEAR_DIRTYRECTS           = $00000004;
  9672.   D3DRMCLEAR_ALL                  = (D3DRMCLEAR_TARGET or
  9673.                                          D3DRMCLEAR_ZBUFFER or
  9674.                                          D3DRMCLEAR_DIRTYRECTS);
  9675.  
  9676. (*
  9677.  * Values for flags in Frame3::SetSceneFogMethod
  9678.  *)
  9679.   D3DRMFOGMETHOD_VERTEX          = $00000001;
  9680.   D3DRMFOGMETHOD_TABLE           = $00000002;
  9681.   D3DRMFOGMETHOD_ANY             = $00000004;
  9682.  
  9683. (*
  9684.  * Values for flags in Frame3::SetTraversalOptions
  9685.  *)
  9686.   D3DRMFRAME_RENDERENABLE        = $00000001;
  9687.   D3DRMFRAME_PICKENABLE          = $00000002;
  9688.  
  9689. type
  9690.   TD3DRMAnimationOptions = DWORD;
  9691.  
  9692. const
  9693.   D3DRMANIMATION_OPEN = $01;
  9694.   D3DRMANIMATION_CLOSED = $02;
  9695.   D3DRMANIMATION_LINEARPOSITION = $04;
  9696.   D3DRMANIMATION_SPLINEPOSITION = $08;
  9697.   D3DRMANIMATION_SCALEANDROTATION = $00000010;
  9698.   D3DRMANIMATION_POSITION = $00000020;
  9699.  
  9700. type
  9701.   TD3DRMInterpolationOptions = DWORD;
  9702. const
  9703.   D3DRMINTERPOLATION_OPEN = $01;
  9704.   D3DRMINTERPOLATION_CLOSED = $02;
  9705.   D3DRMINTERPOLATION_NEAREST = $0100;
  9706.   D3DRMINTERPOLATION_LINEAR = $04;
  9707.   D3DRMINTERPOLATION_SPLINE = $08;
  9708.   D3DRMINTERPOLATION_VERTEXCOLOR = $40;
  9709.   D3DRMINTERPOLATION_SLERPNORMALS = $80;
  9710.  
  9711. type
  9712.   TD3DRMLoadOptions = DWORD;
  9713.  
  9714. const
  9715.   D3DRMLOAD_FROMFILE  = $00;
  9716.   D3DRMLOAD_FROMRESOURCE = $01;
  9717.   D3DRMLOAD_FROMMEMORY = $02;
  9718.   D3DRMLOAD_FROMSTREAM = $04;
  9719.   D3DRMLOAD_FROMURL = $08;
  9720.  
  9721.   D3DRMLOAD_BYNAME = $10;
  9722.   D3DRMLOAD_BYPOSITION = $20;
  9723.   D3DRMLOAD_BYGUID = $40;
  9724.   D3DRMLOAD_FIRST = $80;
  9725.  
  9726.   D3DRMLOAD_INSTANCEBYREFERENCE = $100;
  9727.   D3DRMLOAD_INSTANCEBYCOPYING = $200;
  9728.  
  9729.   D3DRMLOAD_ASYNCHRONOUS = $400;
  9730.  
  9731. type
  9732.   PD3DRMLoadResource = ^TD3DRMLoadResource;
  9733.   TD3DRMLoadResource = packed record
  9734.     hModule: HMODULE;
  9735.     lpName: PAnsiChar;
  9736.     lpType: PAnsiChar;
  9737.   end;
  9738.  
  9739.   PD3DRMLoadMemory = ^TD3DRMLoadMemory;
  9740.   TD3DRMLoadMemory = packed record
  9741.     lpMemory: Pointer;
  9742.     dwSize: DWORD;
  9743.   end;
  9744.  
  9745. const
  9746.   D3DRMPMESHSTATUS_VALID = $01;
  9747.   D3DRMPMESHSTATUS_INTERRUPTED = $02;
  9748.   D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
  9749.   D3DRMPMESHSTATUS_COMPLETE = $08;
  9750.   D3DRMPMESHSTATUS_RENDERABLE = $10;
  9751.  
  9752.   D3DRMPMESHEVENT_BASEMESH = $01;
  9753.   D3DRMPMESHEVENT_COMPLETE = $02;
  9754.  
  9755. type
  9756.   PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
  9757.   TD3DRMPMeshLoadStatus = packed record
  9758.     dwSize,            // Size of this structure
  9759.     dwPMeshSize,       // Total Size (bytes)
  9760.     dwBaseMeshSize,    // Total Size of the Base Mesh
  9761.     dwBytesLoaded,     // Total bytes loaded
  9762.     dwVerticesLoaded,  // Number of vertices loaded
  9763.     dwFacesLoaded : DWORD;     // Number of faces loaded
  9764.     dwLoadResult : HResult;    // Result of the load operation
  9765.     dwFlags : DWORD;
  9766.   end;
  9767.  
  9768.   PD3DRMUserVisualReason = ^TD3DRMUserVisualReason;
  9769.   TD3DRMUserVisualReason = (
  9770.     D3DRMUSERVISUAL_CANSEE,
  9771.     D3DRMUSERVISUAL_RENDER
  9772.   );
  9773.  
  9774.   PD3DRMAnimationKey = ^TD3DRMAnimationKey;
  9775.   TD3DRMAnimationKey = packed record
  9776.     dwSize : DWORD;
  9777.     dwKeyType : DWORD;
  9778.     dvTime : TD3DValue;
  9779.     dwID : DWORD;
  9780.     case integer of
  9781.       0 : (dqRotateKey : TD3DRMQuaternion);
  9782.       1 : (dvScaleKey : TD3DVector);
  9783.       2 : (dvPositionKey : TD3DVector);
  9784.       3 : (dvK : array [0..3] of TD3DValue);
  9785.     end;
  9786.  
  9787. procedure D3DRMAnimationGetRotateKey
  9788.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9789.  
  9790. procedure D3DRMAnimationGetScaleKey
  9791.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9792.  
  9793. procedure D3DRMAnimationGetPositionKey
  9794.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9795.  
  9796. procedure D3DRMAnimatioSetRotateKey
  9797.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9798.  
  9799. procedure D3DRMAnimationSetScaleKey
  9800.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9801.  
  9802. procedure D3DRMAnimationSetPositionKey
  9803.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9804.  
  9805. const
  9806.   D3DRMANIMATION_ROTATEKEY = 01;
  9807.   D3DRMANIMATION_SCALEKEY = 02;
  9808.   D3DRMANIMATION_POSITIONKEY = 03;
  9809.  
  9810. type
  9811.   TD3DRMMapping = DWORD;
  9812.   PD3DRMMappingFlag = ^TD3DRMMappingFlag;
  9813.   TD3DRMMappingFlag = DWORD;
  9814.  
  9815. const
  9816.   D3DRMMAP_WRAPU = 1;
  9817.   D3DRMMAP_WRAPV = 2;
  9818.   D3DRMMAP_PERSPCORRECT = 4;
  9819.  
  9820. type
  9821.   PD3DRMVertex = ^TD3DRMVertex;
  9822.   TD3DRMVertex = packed record
  9823.     position: TD3DVector;
  9824.     normal: TD3DVector;
  9825.     tu, tv: TD3DValue;
  9826.     color: TD3DColor;
  9827.   end;
  9828.  
  9829.   TD3DRMGroupIndex = LongInt; (* group indexes begin a 0 *)
  9830.  
  9831. const
  9832.   D3DRMGROUP_ALLGROUPS = -1;
  9833.  
  9834. var
  9835. (*
  9836.  * Create a color from three components in the range 0-1 inclusive.
  9837.  *)
  9838.   D3DRMCreateColorRGB : function (red, green, blue: TD3DValue) : TD3DColor;
  9839.       stdcall;
  9840.  
  9841. (*
  9842.  * Create a color from four components in the range 0-1 inclusive.
  9843.  *)
  9844.   D3DRMCreateColorRGBA : function (red, green, blue, alpha: TD3DValue)
  9845.       : TD3DColor; stdcall;
  9846.  
  9847. (*
  9848.  * Get the red component of a color.
  9849.  *)
  9850.   D3DRMColorGetRed : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9851.  
  9852. (*
  9853.  * Get the green component of a color.
  9854.  *)
  9855.   D3DRMColorGetGreen : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9856.  
  9857. (*
  9858.  * Get the blue component of a color.
  9859.  *)
  9860.   D3DRMColorGetBlue : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9861.  
  9862. (*
  9863.  * Get the alpha component of a color.
  9864.  *)
  9865.   D3DRMColorGetAlpha : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9866.  
  9867. (*
  9868.  * Add two vectors.  Returns its first argument.
  9869.  *)
  9870.   D3DRMVectorAdd : function (var d, s1, s2: TD3DVector) : PD3DVector; stdcall;
  9871.  
  9872. (*
  9873.  * Subtract two vectors.  Returns its first argument.
  9874.  *)
  9875.   D3DRMVectorSubtract : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9876.       stdcall;
  9877.  
  9878. (*
  9879.  * Reflect a ray about a given normal.  Returns its first argument.
  9880.  *)
  9881.   D3DRMVectorReflect : function (var d, ray, norm: TD3DVector) : PD3DVector;
  9882.       stdcall;
  9883.  
  9884. (*
  9885.  * Calculate the vector cross product.  Returns its first argument.
  9886.  *)
  9887.   D3DRMVectorCrossProduct : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9888.       stdcall;
  9889.  
  9890. (*
  9891.  * Return the vector dot product.
  9892.  *)
  9893.   D3DRMVectorDotProduct : function (var s1, s2: TD3DVector) : TD3DValue;
  9894.       stdcall;
  9895.  
  9896. (*
  9897.  * Scale a vector so that its modulus is 1.  Returns its argument or
  9898.  * NULL if there was an error (e.g. a zero vector was passed).
  9899.  *)
  9900.   D3DRMVectorNormalize : function (var lpv: TD3DVector) : PD3DVector; stdcall;
  9901.  
  9902. (*
  9903.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  9904.  *)
  9905.   D3DRMVectorModulus : function (var v: TD3DVector) : TD3DValue; stdcall;
  9906.  
  9907. (*
  9908.  * Set the rotation part of a matrix to be a rotation of theta radians
  9909.  * around the given axis.
  9910.  *)
  9911.   D3DRMVectorRotate : function (var r, v, axis: TD3DVector; theta: TD3DValue) :
  9912.       PD3DVector; stdcall;
  9913.  
  9914. (*
  9915.  * Scale a vector uniformly in all three axes
  9916.  *)
  9917.   D3DRMVectorScale : function (var d, s: TD3DVector; factor: TD3DValue) :
  9918.       PD3DVector; stdcall;
  9919.  
  9920. (*
  9921.  * Return a random unit vector
  9922.  *)
  9923.   D3DRMVectorRandom : function (var d: TD3DVector) : PD3DVector; stdcall;
  9924.  
  9925. (*
  9926.  * Returns a unit quaternion that represents a rotation of theta radians
  9927.  * around the given axis.
  9928.  *)
  9929.  
  9930.   D3DRMQuaternionFromRotation : function (var quat: TD3DRMQuaternion;
  9931.       var v: TD3DVector; theta: TD3DValue) : PD3DRMQuaternion; stdcall;
  9932.  
  9933. (*
  9934.  * Calculate the product of two quaternions
  9935.  *)
  9936.   D3DRMQuaternionMultiply : function (var q, a, b: TD3DRMQuaternion) :
  9937.       PD3DRMQuaternion; stdcall;
  9938.  
  9939. (*
  9940.  * Interpolate between two quaternions
  9941.  *)
  9942.   D3DRMQuaternionSlerp : function (var q, a, b: TD3DRMQuaternion;
  9943.       alpha: TD3DValue) : PD3DRMQuaternion; stdcall;
  9944.  
  9945. (*
  9946.  * Calculate the matrix for the rotation that a unit quaternion represents
  9947.  *)
  9948.   D3DRMMatrixFromQuaternion : procedure (dmMat: TD3DRMMatrix4D; var lpDqQuat:
  9949.       TD3DRMQuaternion); stdcall;
  9950.  
  9951. (*
  9952.  * Calculate the quaternion that corresponds to a rotation matrix
  9953.  *)
  9954.   D3DRMQuaternionFromMatrix : function (var lpQuat: TD3DRMQuaternion;
  9955.       Mat: TD3DRMMatrix4D) : PD3DRMQuaternion; stdcall;
  9956.  
  9957. (*==========================================================================;
  9958.  *
  9959.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9960.  *
  9961.  *  File:       d3drmobj.h
  9962.  *  Content:    Direct3DRM include file
  9963.  *
  9964.  ***************************************************************************)
  9965.  
  9966. (*
  9967.  * Direct3DRM Object classes
  9968.  *)
  9969.  
  9970. const
  9971.   CLSID_CDirect3DRMDevice: TGUID =
  9972.       (D1:$4fa3568e;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9973.   CLSID_CDirect3DRMViewport: TGUID =
  9974.       (D1:$4fa3568f;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9975.   CLSID_CDirect3DRMFrame: TGUID =
  9976.       (D1:$4fa35690;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9977.   CLSID_CDirect3DRMMesh: TGUID =
  9978.       (D1:$4fa35691;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9979.   CLSID_CDirect3DRMMeshBuilder: TGUID =
  9980.       (D1:$4fa35692;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9981.   CLSID_CDirect3DRMFace: TGUID =
  9982.       (D1:$4fa35693;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9983.   CLSID_CDirect3DRMLight: TGUID =
  9984.       (D1:$4fa35694;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9985.   CLSID_CDirect3DRMTexture: TGUID =
  9986.       (D1:$4fa35695;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9987.   CLSID_CDirect3DRMWrap: TGUID =
  9988.       (D1:$4fa35696;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9989.   CLSID_CDirect3DRMMaterial: TGUID =
  9990.       (D1:$4fa35697;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9991.   CLSID_CDirect3DRMAnimation: TGUID =
  9992.       (D1:$4fa35698;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9993.   CLSID_CDirect3DRMAnimationSet: TGUID =
  9994.       (D1:$4fa35699;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9995.   CLSID_CDirect3DRMUserVisual: TGUID =
  9996.       (D1:$4fa3569a;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9997.   CLSID_CDirect3DRMShadow: TGUID =
  9998.       (D1:$4fa3569b;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9999.   CLSID_CDirect3DRMViewportInterpolator: TGUID =
  10000.       (D1:$0de9eaa1;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10001.   CLSID_CDirect3DRMFrameInterpolator: TGUID =
  10002.       (D1:$0de9eaa2;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10003.   CLSID_CDirect3DRMMeshInterpolator: TGUID =
  10004.       (D1:$0de9eaa3;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10005.   CLSID_CDirect3DRMLightInterpolator: TGUID =
  10006.       (D1:$0de9eaa6;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10007.   CLSID_CDirect3DRMMaterialInterpolator: TGUID =
  10008.       (D1:$0de9eaa7;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10009.   CLSID_CDirect3DRMTextureInterpolator: TGUID =
  10010.       (D1:$0de9eaa8;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10011.   CLSID_CDirect3DRMProgressiveMesh: TGUID =
  10012.       (D1:$4516ec40;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10013.   CLSID_CDirect3DRMClippedVisual: TGUID =
  10014.       (D1:$5434e72d;D2:$6d66;D3:$11d1;D4:($bb,$0b,$00,$00,$f8,$75,$86,$5a));
  10015.  
  10016.  
  10017.  
  10018. type
  10019.   IDirect3DRMObject = interface;
  10020.   IDirect3DRMDevice = interface;
  10021.   IDirect3DRMDevice2 = interface;
  10022.   IDirect3DRMDevice3 = interface;
  10023.   IDirect3DRMViewport = interface;
  10024.   IDirect3DRMViewport2 = interface;
  10025.   IDirect3DRMFrame = interface;
  10026.   IDirect3DRMFrame2 = interface;
  10027.   IDirect3DRMFrame3 = interface;
  10028.   IDirect3DRMVisual = interface;
  10029.   IDirect3DRMMesh = interface;
  10030.   IDirect3DRMMeshBuilder = interface;
  10031.   IDirect3DRMMeshBuilder2 = interface;
  10032.   IDirect3DRMMeshBuilder3 = interface;
  10033.   IDirect3DRMFace = interface;
  10034.   IDirect3DRMFace2 = interface;
  10035.   IDirect3DRMLight = interface;
  10036.   IDirect3DRMTexture = interface;
  10037.   IDirect3DRMTexture2 = interface;
  10038.   IDirect3DRMTexture3 = interface;
  10039.   IDirect3DRMWrap = interface;
  10040.   IDirect3DRMMaterial = interface;
  10041.   IDirect3DRMMaterial2 = interface;
  10042.   IDirect3DRMAnimation = interface;
  10043.   IDirect3DRMAnimation2 = interface;
  10044.   IDirect3DRMAnimationSet = interface;
  10045.   IDirect3DRMAnimationSet2 = interface;
  10046.   IDirect3DRMArray = interface;
  10047.   IDirect3DRMObjectArray = interface;
  10048.   IDirect3DRMDeviceArray = interface;
  10049.   IDirect3DRMViewportArray = interface;
  10050.   IDirect3DRMFrameArray = interface;
  10051.   IDirect3DRMVisualArray = interface;
  10052.   IDirect3DRMLightArray = interface;
  10053.   IDirect3DRMPickedArray = interface;
  10054.   IDirect3DRMFaceArray = interface;
  10055.   IDirect3DRMAnimationArray = interface;
  10056.   IDirect3DRMUserVisual = interface;
  10057.   IDirect3DRMShadow = interface;
  10058.   IDirect3DRMShadow2 = interface;
  10059.   IDirect3DRMInterpolator = interface;
  10060.   IDirect3DRMProgressiveMesh = interface;
  10061.   IDirect3DRMPicked2Array = interface;
  10062.   IDirect3DRMClippedVisual = interface;
  10063.  
  10064. (*
  10065.  * Direct3DRM Object interfaces
  10066.  *)
  10067.   IID_IDirect3DRMObject =          IDirect3DRMObject;
  10068.   IID_IDirect3DRMDevice =          IDirect3DRMDevice;
  10069.   IID_IDirect3DRMDevice2 =         IDirect3DRMDevice2;
  10070.   IID_IDirect3DRMDevice3 =         IDirect3DRMDevice3;
  10071.   IID_IDirect3DRMViewport =        IDirect3DRMViewport;
  10072.   IID_IDirect3DRMViewport2 =       IDirect3DRMViewport2;
  10073.   IID_IDirect3DRMFrame =           IDirect3DRMFrame;
  10074.   IID_IDirect3DRMFrame2 =          IDirect3DRMFrame2;
  10075.   IID_IDirect3DRMFrame3 =          IDirect3DRMFrame3;
  10076.   IID_IDirect3DRMVisual =          IDirect3DRMVisual;
  10077.   IID_IDirect3DRMMesh =            IDirect3DRMMesh;
  10078.   IID_IDirect3DRMMeshBuilder =     IDirect3DRMMeshBuilder;
  10079.   IID_IDirect3DRMMeshBuilder2 =    IDirect3DRMMeshBuilder2;
  10080.   IID_IDirect3DRMMeshBuilder3 =    IDirect3DRMMeshBuilder3;
  10081.   IID_IDirect3DRMFace =            IDirect3DRMFace;
  10082.   IID_IDirect3DRMFace2 =           IDirect3DRMFace2;
  10083.   IID_IDirect3DRMLight =           IDirect3DRMLight;
  10084.   IID_IDirect3DRMTexture =         IDirect3DRMTexture;
  10085.   IID_IDirect3DRMTexture2 =        IDirect3DRMTexture2;
  10086.   IID_IDirect3DRMTexture3 =        IDirect3DRMTexture3;
  10087.   IID_IDirect3DRMWrap =            IDirect3DRMWrap;
  10088.   IID_IDirect3DRMMaterial =        IDirect3DRMMaterial;
  10089.   IID_IDirect3DRMMaterial2 =       IDirect3DRMMaterial2;
  10090.   IID_IDirect3DRMAnimation =       IDirect3DRMAnimation;
  10091.   IID_IDirect3DRMAnimation2 =      IDirect3DRMAnimation2;
  10092.   IID_IDirect3DRMAnimationSet =    IDirect3DRMAnimationSet;
  10093.   IID_IDirect3DRMAnimationSet2 =   IDirect3DRMAnimationSet2;
  10094.   IID_IDirect3DRMObjectArray =     IDirect3DRMObjectArray;
  10095.   IID_IDirect3DRMDeviceArray =     IDirect3DRMDeviceArray;
  10096.   IID_IDirect3DRMViewportArray =   IDirect3DRMViewportArray;
  10097.   IID_IDirect3DRMFrameArray =      IDirect3DRMFrameArray;
  10098.   IID_IDirect3DRMVisualArray =     IDirect3DRMVisualArray;
  10099.   IID_IDirect3DRMLightArray =      IDirect3DRMLightArray;
  10100.   IID_IDirect3DRMPickedArray =     IDirect3DRMPickedArray;
  10101.   IID_IDirect3DRMFaceArray =       IDirect3DRMFaceArray;
  10102.   IID_IDirect3DRMAnimationArray =  IDirect3DRMAnimationArray;
  10103.   IID_IDirect3DRMUserVisual =      IDirect3DRMUserVisual;
  10104.   IID_IDirect3DRMShadow =          IDirect3DRMShadow;
  10105.   IID_IDirect3DRMShadow2 =         IDirect3DRMShadow2;
  10106.   IID_IDirect3DRMInterpolator =    IDirect3DRMInterpolator;
  10107.   IID_IDirect3DRMProgressiveMesh = IDirect3DRMProgressiveMesh;
  10108.   IID_IDirect3DRMPicked2Array =    IDirect3DRMPicked2Array;
  10109.   IID_IDirect3DRMClippedVisual =   IDirect3DRMClippedVisual;
  10110.  
  10111.  
  10112.  
  10113.  
  10114.  
  10115.   PIDirect3DRMFaceArray = ^IDirect3DRMFaceArray;
  10116.  
  10117.   TD3DRMObjectCallback = procedure (lpD3DRMobj: IDirect3DRMObject;
  10118.       lpArg: Pointer); cdecl;
  10119.   TD3DRMFrameMoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame;
  10120.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10121.   TD3DRMFrame3MoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame3;
  10122.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10123.   TD3DRMUpdateCallback = procedure (lpobj: IDirect3DRMDevice; lpArg: Pointer;
  10124.       iRectCount: Integer; const d3dRectUpdate: TD3DRect); cdecl;
  10125.   TD3DRMDevice3UpdateCallback = procedure (lpobj: IDirect3DRMDevice3;
  10126.       lpArg: Pointer; iRectCount: Integer; const d3dRectUpdate: TD3DRect);cdecl;
  10127.   TD3DRMUserVisualCallback = function (lpD3DRMUV: IDirect3DRMUserVisual;
  10128.       lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
  10129.       lpD3DRMDev: IDirect3DRMDevice;
  10130.       lpD3DRMview: IDirect3DRMViewport) : Integer; cdecl;
  10131.   TD3DRMLoadTextureCallback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10132.       out lpD3DRMTex: IDirect3DRMTexture) : HResult; cdecl;
  10133.   TD3DRMLoadTexture3Callback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10134.       out lpD3DRMTex: IDirect3DRMTexture3) : HResult; cdecl;
  10135.   TD3DRMLoadCallback = procedure (lpObject: IDirect3DRMObject;
  10136.       const ObjectGuid: TGUID; lpArg: Pointer); cdecl;
  10137.   TD3DRMDownSampleCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10138.       pArg: pointer; pDDSSrc, pDDSDst: IDirectDrawSurface) : HResult; cdecl;
  10139.   TD3DRMValidationCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10140.       pArg: pointer; dwFlags, DWcRects: DWORD; const pRects: TRect) : HResult; cdecl;
  10141.  
  10142.   PD3DRMPickDesc = ^TD3DRMPickDesc;
  10143.   TD3DRMPickDesc = packed record
  10144.     ulFaceIdx: DWORD;
  10145.     lGroupIdx: LongInt;
  10146.     vPosition: TD3DVector;
  10147.   end;
  10148.  
  10149.   PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
  10150.   TD3DRMPickDesc2 = packed record
  10151.     ulFaceIdx: DWORD;
  10152.     lGroupIdx: LongInt;
  10153.     dvPosition: TD3DVector;
  10154.     tu, tv: TD3DValue;
  10155.     dvNormal: TD3DVector;
  10156.     dcColor: TD3DColor;
  10157.   end;
  10158.  
  10159. (*
  10160.  * Base class
  10161.  *)
  10162. {$IFDEF D2COM}
  10163.   IDirect3DRMObject = class (IUnknown)
  10164. {$ELSE}
  10165.   IDirect3DRMObject = interface (IUnknown)
  10166.     ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
  10167. {$ENDIF}
  10168.     (*
  10169.      * The methods for IDirect3DRMObject
  10170.      *)
  10171.     function Clone (pUnkOuter: IUnknown; riid: TGUID;
  10172.         var ppvObj: Pointer) : HResult; stdcall;
  10173.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  10174.         lpArg: Pointer) : HResult; stdcall;
  10175.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  10176.         lpArg: Pointer) : HResult; stdcall;
  10177.     function SetAppData (ulData: DWORD) : HResult; stdcall;
  10178.     function GetAppData: DWORD; stdcall;
  10179.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  10180.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10181.     function GetClassName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10182.   end;
  10183.  
  10184.   IDirect3DRMVisual = interface (IDirect3DRMObject)
  10185.   end;
  10186.  
  10187.   IDirect3DRMDevice = interface (IDirect3DRMObject)
  10188.     ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
  10189.     (*
  10190.      * IDirect3DRMDevice methods
  10191.      *)
  10192.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10193.     function InitFromD3D (lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice) : HResult; stdcall;
  10194.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10195.         width: Integer; height: Integer) : HResult; stdcall;
  10196.     function Update: HResult; stdcall;
  10197.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10198.         arg: Pointer) : HResult; stdcall;
  10199.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10200.         arg: Pointer) : HResult; stdcall;
  10201.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10202.     function GetBufferCount: DWORD; stdcall;
  10203.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10204.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10205.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10206.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10207.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10208.     function GetDither: BOOL; stdcall;
  10209.     function GetShades: DWORD; stdcall;
  10210.     function GetHeight: DWORD; stdcall;
  10211.     function GetWidth: DWORD; stdcall;
  10212.     function GetTrianglesDrawn: DWORD; stdcall;
  10213.     function GetWireframeOptions: DWORD; stdcall;
  10214.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10215.     function GetColorModel: TD3DColorModel; stdcall;
  10216.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10217.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10218.   end;
  10219.  
  10220.   IDirect3DRMDevice2 = interface (IDirect3DRMDevice)
  10221.     ['{4516ec78-8f20-11d0-9b6d-0000c0781bc3}']
  10222.     (*
  10223.      * IDirect3DRMDevice2 methods
  10224.      *)
  10225.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10226.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw; lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10227.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10228.     function GetRenderMode : DWORD; stdcall;
  10229.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10230.   end;
  10231.  
  10232.   IDirect3DRMDevice3 = interface (IDirect3DRMObject)
  10233.     ['{549f498b-bfeb-11d1-8ed8-00a0c967a482}']
  10234.     (*
  10235.      * IDirect3DRMDevice methods
  10236.      *)
  10237.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10238.     function InitFromD3D (lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10239.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10240.         width: Integer; height: Integer) : HResult; stdcall;
  10241.     function Update: HResult; stdcall;
  10242.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10243.         arg: Pointer) : HResult; stdcall;
  10244.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10245.         arg: Pointer) : HResult; stdcall;
  10246.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10247.     function GetBufferCount: DWORD; stdcall;
  10248.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10249.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10250.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10251.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10252.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10253.     function GetDither: BOOL; stdcall;
  10254.     function GetShades: DWORD; stdcall;
  10255.     function GetHeight: DWORD; stdcall;
  10256.     function GetWidth: DWORD; stdcall;
  10257.     function GetTrianglesDrawn: DWORD; stdcall;
  10258.     function GetWireframeOptions: DWORD; stdcall;
  10259.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10260.     function GetColorModel: TD3DColorModel; stdcall;
  10261.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10262.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10263.     (*
  10264.      * IDirect3DRMDevice2 methods
  10265.      *)
  10266.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10267.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  10268.             lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10269.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10270.     function GetRenderMode : DWORD; stdcall;
  10271.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10272.     (*
  10273.      * IDirect3DRMDevice3 methods
  10274.      *)
  10275.     function FindPreferredTextureFormat (dwBitDepths, dwFlags: DWORD;
  10276.         out lpDDPF: TDDPixelFormat) : HResult; stdcall;
  10277.     function RenderStateChange (dwStateNum, dwVal, dwFlags: DWORD) : HResult; stdcall;
  10278.  
  10279.     function LightStateChange (drsType: TD3DLightStateType; // defined different in header and help
  10280.         dwVal, dwFlags: DWORD) : HResult; stdcall;
  10281.     function GetStateChangeOptions (dwStateClass, dwStateNum: DWORD;
  10282.         var pdwFlags: DWORD) : HResult; stdcall;
  10283.     function SetStateChangeOptions ( dwStateClass, dwStateNum, dwFlags: DWORD) : HResult; stdcall;
  10284.   end;
  10285.  
  10286.   IDirect3DRMViewport = interface (IDirect3DRMObject)
  10287.     ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
  10288.     (*
  10289.      * IDirect3DRMViewport methods
  10290.      *)
  10291.     function Init (lpD3DRMDevice: IDirect3DRMDevice;
  10292.         lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos,
  10293.         width, height: DWORD) : HResult; stdcall;
  10294.     function Clear: HResult; stdcall;
  10295.     function Render (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10296.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10297.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10298.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10299.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10300.     function SetCamera (lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10301.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10302.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10303.     function InverseTransform (out lprvDst: TD3DVector;
  10304.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10305.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10306.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10307.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10308.     function GetCamera (out lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10309.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  10310.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10311.         TD3DValue) : HResult; stdcall;
  10312.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10313.     function GetUniformScaling: BOOL;  stdcall;
  10314.     function GetX: LongInt; stdcall;
  10315.     function GetY: LongInt; stdcall;
  10316.     function GetWidth: DWORD; stdcall;
  10317.     function GetHeight: DWORD; stdcall;
  10318.     function GetField: TD3DValue; stdcall;
  10319.     function GetBack: TD3DValue; stdcall;
  10320.     function GetFront: TD3DValue; stdcall;
  10321.     function GetProjection: TD3DRMProjectionType; stdcall;
  10322.     function GetDirect3DViewport (out lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10323.   end;
  10324.  
  10325.   IDirect3DRMViewport2 = interface (IDirect3DRMObject)
  10326.     ['{4a1b1be6-bfed-11d1-8ed8-00a0c967a482}']
  10327.     (*
  10328.      * IDirect3DRMViewport2 methods
  10329.      *)
  10330.     function Init (lpD3DRMDevice: IDirect3DRMDevice3;
  10331.         lpD3DRMFrameCamera: IDirect3DRMFrame3; xpos, ypos,
  10332.         width, height: DWORD) : HResult; stdcall;
  10333.     function Clear (dwFlags: DWORD): HResult; stdcall;
  10334.     function Render (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10335.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10336.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10337.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10338.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10339.     function SetCamera (lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10340.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10341.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10342.     function InverseTransform (out lprvDst: TD3DVector;
  10343.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10344.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10345.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10346.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10347.     function GetCamera (out lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10348.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  10349.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10350.         TD3DValue) : HResult; stdcall;
  10351.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10352.     function GetUniformScaling: BOOL; stdcall;
  10353.     function GetX: LongInt; stdcall;
  10354.     function GetY: LongInt; stdcall;
  10355.     function GetWidth: DWORD; stdcall;
  10356.     function GetHeight: DWORD; stdcall;
  10357.     function GetField: TD3DValue; stdcall;
  10358.     function GetBack: TD3DValue; stdcall;
  10359.     function GetFront: TD3DValue; stdcall;
  10360.     function GetProjection: TD3DRMProjectionType; stdcall;
  10361.     function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10362.     function TransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10363.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10364.     function InverseTransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10365.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10366.   end;
  10367.  
  10368.   IDirect3DRMFrame = interface (IDirect3DRMVisual)
  10369.     ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
  10370.     (*
  10371.      * IDirect3DRMFrame methods
  10372.      *)
  10373.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame) : HResult; stdcall;
  10374.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10375.     function AddMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10376.         lpArg: Pointer) : HResult; stdcall;
  10377.     function AddTransform (rctCombine: TD3DRMCombineType;
  10378.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10379.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10380.         TD3DValue) : HResult; stdcall;
  10381.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10382.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10383.         rvTheta: TD3DValue) : HResult; stdcall;
  10384.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10385.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10386.     function GetColor: TD3DColor; stdcall;
  10387.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10388.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10389.     function GetParent (out lplpParent: IDirect3DRMFrame) : HResult; stdcall;
  10390.     function GetPosition (lpRef: IDirect3DRMFrame; out lprvPos: TD3DVector) : HResult; stdcall;
  10391.     function GetRotation (lpRef: IDirect3DRMFrame; out lprvAxis: TD3DVector;
  10392.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10393.     function GetScene (out lplpRoot: IDirect3DRMFrame) : HResult; stdcall;
  10394.     function GetSortMode: TD3DRMSortMode; stdcall;
  10395.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10396.     function GetTransform (out rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10397.     function GetVelocity (lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
  10398.         fRotVel: BOOL) : HResult; stdcall;
  10399.     function GetOrientation (lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
  10400.         var lprvUp: TD3DVector) : HResult; stdcall;
  10401.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10402.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10403.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10404.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10405.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10406.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer) : HResult; stdcall;
  10407.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame;
  10408.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10409.     function Move (delta: TD3DValue) : HResult; stdcall;
  10410.     function DeleteChild (lpChild: IDirect3DRMFrame) : HResult; stdcall;
  10411.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10412.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10413.         lpArg: Pointer) : HResult; stdcall;
  10414.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10415.     function GetSceneBackground: TD3DColor; stdcall;
  10416.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10417.     function GetSceneFogColor: TD3DColor; stdcall;
  10418.     function GetSceneFogEnable: BOOL; stdcall;
  10419.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10420.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10421.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10422.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10423.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10424.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10425.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10426.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10427.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10428.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10429.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10430.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10431.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10432.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10433.     function SetOrientation (lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
  10434.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10435.     function SetPosition (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10436.     function SetRotation (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
  10437.         rvTheta: TD3DValue) : HResult; stdcall;
  10438.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10439.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10440.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10441.     function SetVelocity (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
  10442.         fRotVel: BOOL) : HResult; stdcall;
  10443.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10444.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10445.   end;
  10446.  
  10447.   IDirect3DRMFrame2 = interface (IDirect3DRMFrame)
  10448.     ['{c3dfbd60-3988-11d0-9ec2-0000c0291ac3}']
  10449.     (*
  10450.      * IDirect3DRMFrame2 methods
  10451.      *)
  10452.     function AddMoveCallback2 (d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
  10453.         Pointer; dwFlags: DWORD) : HResult; stdcall;
  10454.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10455.     function GetBoxEnable : boolean; stdcall;
  10456.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10457.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10458.     function GetInheritAxes : boolean; stdcall;
  10459.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10460.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10461.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10462.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10463.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10464.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10465.     function SetQuaternion (lpRef: IDirect3DRMFrame;
  10466.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10467.     function RayPick (lpRefFrame: IDirect3DRMFrame; var ray: TD3DRMRay;
  10468.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) :
  10469.         HResult; stdcall;
  10470.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10471.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10472.   end;
  10473.  
  10474.   IDirect3DRMFrame3 = interface (IDirect3DRMVisual)
  10475.     ['{ff6b7f70-a40e-11d1-91f9-0000f8758e66}']
  10476.     (*
  10477.      * IDirect3DRMFrame3 methods
  10478.      *)
  10479.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame3) : HResult; stdcall;
  10480.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10481.     function AddMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback;
  10482.         lpArg: Pointer; dwFlags: DWORD) : HResult; stdcall;
  10483.     function AddTransform (rctCombine: TD3DRMCombineType;
  10484.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10485.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10486.         TD3DValue) : HResult; stdcall;
  10487.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10488.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10489.         rvTheta: TD3DValue) : HResult; stdcall;
  10490.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10491.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10492.     function GetColor: TD3DColor; stdcall;
  10493.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10494.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10495.     function GetParent (out lplpParent: IDirect3DRMFrame3) : HResult; stdcall;
  10496.     function GetPosition (lpRef: IDirect3DRMFrame3; out lprvPos: TD3DVector) : HResult; stdcall;
  10497.     function GetRotation (lpRef: IDirect3DRMFrame3; out lprvAxis: TD3DVector;
  10498.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10499.     function GetScene (out lplpRoot: IDirect3DRMFrame3) : HResult; stdcall;
  10500.     function GetSortMode: TD3DRMSortMode; stdcall;
  10501.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10502.     function GetTransform (lpRefFrame: IDirect3DRMFrame3;
  10503.         var rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10504.     function GetVelocity (lpRef: IDirect3DRMFrame3; out lprvVel: TD3DVector;
  10505.         fRotVel: BOOL) : HResult; stdcall;
  10506.     function GetOrientation (lpRef: IDirect3DRMFrame3; out lprvDir: TD3DVector;
  10507.         out lprvUp: TD3DVector) : HResult; stdcall;
  10508.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10509.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10510.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10511.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10512.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer) : HResult; stdcall;
  10513.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame3;
  10514.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10515.     function Move (delta: TD3DValue) : HResult; stdcall;
  10516.     function DeleteChild (lpChild: IDirect3DRMFrame3) : HResult; stdcall;
  10517.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10518.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer) : HResult; stdcall;
  10519.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10520.     function GetSceneBackground: TD3DColor; stdcall;
  10521.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10522.     function GetSceneFogColor: TD3DColor; stdcall;
  10523.     function GetSceneFogEnable: BOOL; stdcall;
  10524.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10525.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10526.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10527.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10528.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10529.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10530.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10531.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10532.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10533.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10534.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10535.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10536.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10537.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10538.     function SetOrientation (lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
  10539.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10540.     function SetPosition (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue) :
  10541.         HResult; stdcall;
  10542.     function SetRotation (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ,
  10543.         rvTheta: TD3DValue) : HResult; stdcall;
  10544.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10545.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10546.     function SetVelocity (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
  10547.         fRotVel: BOOL) : HResult; stdcall;
  10548.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10549.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10550.  
  10551.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10552.     function GetBoxEnable : boolean; stdcall;
  10553.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10554.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10555.     function GetInheritAxes : boolean; stdcall;
  10556.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10557.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10558.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10559.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10560.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10561.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10562.     function SetQuaternion (lpRef: IDirect3DRMFrame3;
  10563.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10564.     function RayPick (lpRefFrame: IDirect3DRMFrame3; var ray: TD3DRMRay;
  10565.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) : HResult; stdcall;
  10566.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10567.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10568.     function TransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10569.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10570.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10571.     function InverseTransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10572.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10573.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10574.     function SetTraversalOptions (dwFlags: DWORD) : HResult; stdcall;
  10575.     function GetTraversalOptions (out lpdwFlags: DWORD) : HResult; stdcall;
  10576.     function SetSceneFogMethod (dwFlags: DWORD) : HResult; stdcall;
  10577.     function GetSceneFogMethod (out lpdwFlags: DWORD) : HResult; stdcall;
  10578.     function SetMaterialOverride (
  10579.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10580.     function GetMaterialOverride (
  10581.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10582.   end;
  10583.  
  10584.  
  10585.   IDirect3DRMMesh = interface (IDirect3DRMVisual)
  10586.     ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
  10587.     (*
  10588.      * IDirect3DRMMesh methods
  10589.      *)
  10590.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10591.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10592.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10593.     function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
  10594.         var returnId: TD3DRMGroupIndex) : HResult; stdcall;
  10595.     function SetVertices (id: TD3DRMGroupIndex; index, count: DWORD;
  10596.         var values: TD3DRMVertex) : HResult; stdcall;
  10597.     function SetGroupColor (id: TD3DRMGroupIndex; value: TD3DColor) : HResult; stdcall;
  10598.     function SetGroupColorRGB (id: TD3DRMGroupIndex; red, green,
  10599.         blue: TD3DValue) : HResult; stdcall;
  10600.     function SetGroupMapping (id: TD3DRMGroupIndex;
  10601.         value: TD3DRMMapping) : HResult; stdcall;
  10602.     function SetGroupQuality (id: TD3DRMGroupIndex;
  10603.         value: TD3DRMRenderQuality) : HResult; stdcall;
  10604.     function SetGroupMaterial (id: TD3DRMGroupIndex; value:
  10605.         IDirect3DRMMaterial) : HResult; stdcall;
  10606.     function SetGroupTexture (id: TD3DRMGroupIndex; value: IDirect3DRMTexture) : HResult; stdcall;
  10607.     function GetGroupCount: DWORD; stdcall;
  10608.     function GetGroup (id: TD3DRMGroupIndex; vCount, fCount, vPerFace : PDWORD;
  10609.         var fDataSize: DWORD; fData: PDWORD) : HResult; stdcall;
  10610.     function GetVertices (id: TD3DRMGroupIndex; index, count : DWORD;
  10611.         out returnPtr : TD3DRMVertex) : HResult; stdcall;
  10612.     function GetGroupColor (id: TD3DRMGroupIndex) : TD3DColor; stdcall;
  10613.     function GetGroupMapping (id: TD3DRMGroupIndex) : TD3DRMMapping; stdcall;
  10614.     function GetGroupQuality (id: TD3DRMGroupIndex) : TD3DRMRenderQuality; stdcall;
  10615.     function GetGroupMaterial (id: TD3DRMGroupIndex;
  10616.         out returnPtr: IDirect3DRMMaterial) : HResult; stdcall;
  10617.     function GetGroupTexture (id: TD3DRMGroupIndex;
  10618.         out returnPtr: IDirect3DRMTexture) : HResult; stdcall;
  10619.   end;
  10620.  
  10621.   IDirect3DRMProgressiveMesh = interface (IDirect3DRMVisual)
  10622.     ['{4516ec79-8f20-11d0-9b6d-0000c0781bc3}']
  10623.     (*
  10624.      * IDirect3DRMProgressiveMesh methods
  10625.      *)
  10626.     function Load (lpSource, lpObjID: pointer; dloLoadflags : TD3DRMLoadOptions;
  10627.         lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer) : HResult; stdcall;
  10628.     function GetLoadStatus (out lpStatus: TD3DRMPMeshLoadStatus) : HResult; stdcall;
  10629.     function SetMinRenderDetail (d3dVal: TD3DValue) : HResult; stdcall;
  10630.     function Abort (dwFlags: DWORD) : HResult; stdcall;
  10631.     function GetFaceDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10632.     function GetVertexDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10633.     function SetFaceDetail (dwCount: DWORD) : HResult; stdcall;
  10634.     function SetVertexDetail (dwCount: DWORD) : HResult; stdcall;
  10635.     function GetFaceDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10636.     function GetVertexDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10637.     function GetDetail (out lpdvVal: TD3DValue) : HResult; stdcall;
  10638.     function SetDetail (lpdvVal: TD3DValue) : HResult; stdcall;
  10639.     function RegisterEvents (hEvent: THANDLE; dwFlags, dwReserved: DWORD) : HResult; stdcall;
  10640.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10641.     function Duplicate (out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh) : HResult; stdcall;
  10642.     function GetBox (out lpBBox: TD3DRMBox) : HResult; stdcall;
  10643.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10644.     function GetQuality (out lpdwquality: TD3DRMRenderQuality) : HResult; stdcall;
  10645.   end;
  10646.  
  10647.   IDirect3DRMShadow = interface (IDirect3DRMVisual)
  10648.     ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
  10649.     (*
  10650.      * IDirect3DRMShadow methods
  10651.      *)
  10652.     function Init (lpD3DRMVisual: IDirect3DRMVisual;
  10653.         lpD3DRMLight: IDirect3DRMLight;
  10654.         px, py, pz, nx, ny, nz: TD3DValue) : HResult; stdcall;
  10655.   end;
  10656.  
  10657.   IDirect3DRMShadow2 = interface (IDirect3DRMShadow)
  10658.     ['{86b44e25-9c82-11d1-bb0b-00a0c981a0a6}']
  10659.     (*
  10660.      * IDirect3DRMShadow2 methods
  10661.      *)
  10662.     function GetVisual (out lplpDirect3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10663.     function SetVisual (lpDirect3DRMVisual: IDirect3DRMVisual;
  10664.         dwFlags: DWORD) : HResult; stdcall;
  10665.     function GetLight (out lplpDirect3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10666.     function SetLight (lplpDirect3DRMLight: IDirect3DRMLight;
  10667.         dwFlags: DWORD) : HResult; stdcall;
  10668.     function GetPlane (
  10669.         var pdvPX, pdvPY, pdvPZ, pdvNX, pdvNY, pdvNZ: TD3DValue) : HResult; stdcall;
  10670.     function SetPlane (px, py, pz, nx, ny, nz: TD3DValue;
  10671.         dwFlags: DWORD) : HResult; stdcall;
  10672.     function GetOptions (out pdwOptions: DWORD) : HResult; stdcall;
  10673.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  10674.  
  10675.   end;
  10676.  
  10677.   IDirect3DRMFace = interface (IDirect3DRMObject)
  10678.     ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
  10679.     (*
  10680.      * IDirect3DRMFace methods
  10681.      *)
  10682.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10683.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10684.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10685.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10686.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10687.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10688.     function SetMaterial (lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10689.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10690.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10691.         out lpNormal: TD3DVector) : HResult; stdcall;
  10692.     function GetVertices (var lpdwVertexCount: DWORD;
  10693.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10694.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10695.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10696.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10697.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10698.     function GetMaterial (out lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10699.     function GetVertexCount: Integer; stdcall;
  10700.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10701.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10702.     function GetColor: TD3DColor; stdcall;
  10703.   end;
  10704.  
  10705.   IDirect3DRMFace2 = interface (IDirect3DRMObject)
  10706.     ['{4516ec81-8f20-11d0-9b6d-0000c0781bc3}']
  10707.     (*
  10708.      * IDirect3DRMFace2 methods
  10709.      *)
  10710.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10711.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10712.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10713.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10714.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10715.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10716.     function SetMaterial (lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10717.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10718.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10719.         out lpNormal: TD3DVector) : HResult; stdcall;
  10720.     function GetVertices (var lpdwVertexCount: DWORD;
  10721.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10722.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10723.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10724.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10725.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10726.     function GetMaterial (out lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10727.     function GetVertexCount: Integer; stdcall;
  10728.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10729.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10730.     function GetColor: TD3DColor; stdcall;
  10731.   end;
  10732.  
  10733.   IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
  10734.     ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
  10735.     (*
  10736.      * IDirect3DRMMeshBuilder methods
  10737.      *)
  10738.     function Load (lpvObjSource, lpvObjID: Pointer; d3drmLOFlags:
  10739.         TD3DRMLoadOptions; d3drmLoadTextureProc: TD3DRMLoadTextureCallback;
  10740.         lpvArg: Pointer) : HResult; stdcall;
  10741.     function Save (lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10742.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10743.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10744.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10745.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10746.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10747.     function GenerateNormals : HResult; stdcall;
  10748.     function GetColorSource: TD3DRMColorSource; stdcall;
  10749.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10750.     function AddMeshBuilder (lpD3DRMMeshBuild: IDirect3DRMMeshBuilder) : HResult; stdcall;
  10751.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10752.     function AddFace (lpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10753.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10754.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10755.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10756.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10757.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10758.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10759.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10760.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10761.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10762.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10763.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10764.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10765.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10766.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10767.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10768.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10769.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10770.     function GetVertices (var vcount: DWORD; var vertices : TD3DVector;
  10771.         var ncount : DWORD;
  10772.         var normals : TD3DVector;
  10773.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10774.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10775.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10776.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10777.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  10778.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10779.     function GetPerspective: BOOL; stdcall;
  10780.     function GetFaceCount: Integer; stdcall;
  10781.     function GetVertexCount: Integer; stdcall;
  10782.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10783.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10784.   end;
  10785.  
  10786.   IDirect3DRMMeshBuilder2 = interface (IDirect3DRMMeshBuilder)
  10787.     ['{4516ec77-8f20-11d0-9b6d-0000c0781bc3}']
  10788.     (*
  10789.      * IDirect3DRMMeshBuilder2 methods
  10790.      *)
  10791.     function GenerateNormals2 (
  10792.         dvCreaseAngle: TD3DValue; dwFlags: DWORD) : HResult; stdcall;
  10793.     function GetFace (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10794.   end;
  10795.  
  10796.   IDirect3DRMMeshBuilder3 = interface (IDirect3DRMVisual)
  10797.     ['{ff6b7f71-a40e-11d1-91f9-0000f8758e66}']
  10798.     (*
  10799.      * IDirect3DRMMeshBuilder3 methods
  10800.      *)
  10801.     function Load (lpvObjSource, lpvObjID: Pointer;
  10802.         d3drmLOFlags: TD3DRMLoadOptions;
  10803.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback;
  10804.         lpvArg: Pointer) : HResult; stdcall;
  10805.     function Save (lpFilename: PAnsiChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10806.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10807.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10808.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10809.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10810.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10811.     function GenerateNormals (
  10812.         dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
  10813.     function GetColorSource: TD3DRMColorSource; stdcall;
  10814.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10815.     function AddMeshBuilder (
  10816.         lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3) : HResult; stdcall;
  10817.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10818.     function AddFace (lpD3DRMFace: IDirect3DRMFace2) : HResult; stdcall;
  10819.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10820.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10821.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10822.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10823.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10824.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10825.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10826.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10827.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10828.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10829.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10830.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10831.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10832.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10833.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10834.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10835.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10836.     function GetGeometry (var vcount: DWORD; var vertices : TD3DVector;
  10837.         var ncount : DWORD; var normals : TD3DVector;
  10838.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10839.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10840.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10841.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10842.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  10843.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10844.     function GetPerspective: BOOL; stdcall;
  10845.     function GetFaceCount: Integer; stdcall;
  10846.     function GetVertexCount: Integer; stdcall;
  10847.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10848.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10849.     function GetFace
  10850.         (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10851.     function GetVertex (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10852.     function GetNormal (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10853.     function DeleteVertices (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10854.     function DeleteNormals (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10855.     function DeleteFace (lpFace: IDirect3DRMFace2) : HResult; stdcall;
  10856.     function Empty (dwFlags: DWORD) : HResult; stdcall;
  10857.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  10858.     function AddFacesIndexed (dwFlags: DWORD; var lpdwvIndices: DWORD;
  10859.         lpdwIndexFirst, lpdwCount: PDWORD) : HResult; stdcall;
  10860.     function CreateSubMesh (out lplpUnk: IUnknown) : HResult; stdcall;
  10861.     function GetParentMesh (dwFlags: DWORD; out lplpUnk: IUnknown) : HResult; stdcall;
  10862.     function GetSubMeshes (lpdwCount: PDWORD; lpUnk: IUnknown) : HResult; stdcall;
  10863.     function DeleteSubMesh (lplpUnk: IUnknown) : HResult; stdcall;
  10864.     function Enable (dwFlags: DWORD) : HResult; stdcall;
  10865.     function GetEnable (out lpdwFlags: DWORD) : HResult; stdcall;
  10866.     function AddTriangles (dwFlags, dwFormat, dwVertexCount:  DWORD;
  10867.         lpData: pointer) : HResult; stdcall;
  10868.     function SetVertices
  10869.         (dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10870.     function GetVertices(dwFirst: DWORD; var lpdwCount: DWORD;
  10871.         lpdvVector: PD3DVector) : HResult; stdcall;
  10872.     function SetNormals(dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10873.     function GetNormals (dwFirst: DWORD; lpdwCount: PDWORD;
  10874.         var lpdvVector: TD3DVector) : HResult; stdcall;
  10875.     function GetNormalCount : integer; stdcall;
  10876.   end;
  10877.  
  10878.   IDirect3DRMLight = interface (IDirect3DRMObject)
  10879.     ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
  10880.     (*
  10881.      * IDirect3DRMLight methods
  10882.      *)
  10883.     function SetType (d3drmtType: TD3DRMLightType) : HResult; stdcall;
  10884.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10885.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10886.     function SetRange (rvRange: TD3DValue) : HResult; stdcall;
  10887.     function SetUmbra (rvAngle: TD3DValue) : HResult; stdcall;
  10888.     function SetPenumbra (rvAngle: TD3DValue) : HResult; stdcall;
  10889.     function SetConstantAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10890.     function SetLinearAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10891.     function SetQuadraticAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10892.     function GetRange: TD3DValue; stdcall;
  10893.     function GetUmbra: TD3DValue; stdcall;
  10894.     function GetPenumbra: TD3DValue; stdcall;
  10895.     function GetConstantAttenuation: TD3DValue; stdcall;
  10896.     function GetLinearAttenuation: TD3DValue; stdcall;
  10897.     function GetQuadraticAttenuation: TD3DValue; stdcall;
  10898.     function GetColor: TD3DColor; stdcall;
  10899.     function GetType: TD3DRMLightType; stdcall;
  10900.     function SetEnableFrame (lpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10901.     function GetEnableFrame (out lplpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10902.   end;
  10903.  
  10904.   IDirect3DRMTexture = interface (IDirect3DRMVisual)
  10905.     ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
  10906.     (*
  10907.      * IDirect3DRMTexture methods
  10908.      *)
  10909.     function InitFromFile (filename: PAnsiChar) : HResult; stdcall;
  10910.     function InitFromSurface (lpDDS: IDirectDrawSurface) : HResult; stdcall;
  10911.     function InitFromResource (rs: HRSRC) : HResult; stdcall;
  10912.     function Changed (bPixels, bPalette: BOOL) : HResult; stdcall;
  10913.     function SetColors (ulColors: DWORD) : HResult; stdcall;
  10914.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10915.     function SetDecalSize (rvWidth, rvHeight: TD3DValue) : HResult; stdcall;
  10916.     function SetDecalOrigin (lX, lY: LongInt) : HResult; stdcall;
  10917.     function SetDecalScale (dwScale: DWORD) : HResult; stdcall;
  10918.     function SetDecalTransparency (bTransp: BOOL) : HResult; stdcall;
  10919.     function SetDecalTransparentColor (rcTransp: TD3DColor) : HResult; stdcall;
  10920.     function GetDecalSize (out lprvWidth, lprvHeight: TD3DValue) : HResult; stdcall;
  10921.     function GetDecalOrigin (out lplX, lplY: LongInt) : HResult; stdcall;
  10922.     function GetImage: PD3DRMImage; stdcall;
  10923.     function GetShades: DWORD; stdcall;
  10924.     function GetColors: DWORD; stdcall;
  10925.     function GetDecalScale: DWORD; stdcall;
  10926.     function GetDecalTransparency: BOOL; stdcall;
  10927.     function GetDecalTransparentColor: TD3DColor; stdcall;
  10928.   end;
  10929.  
  10930.   IDirect3DRMTexture2 = interface (IDirect3DRMTexture)
  10931.     ['{120f30c0-1629-11d0-941c-0080c80cfa7b}']
  10932.     (*
  10933.      * IDirect3DRMTexture2 methods
  10934.      *)
  10935.     function InitFromImage (const lpImage: TD3DRMImage) : HResult; stdcall;
  10936.     function InitFromResource2 (hModule: HModule;
  10937.         strName, strType: PAnsiChar) : HResult; stdcall;
  10938.     function GenerateMIPMap (dwFlags: DWORD) : HResult; stdcall;
  10939.   end;
  10940.  
  10941.   IDirect3DRMTexture3 = interface (IDirect3DRMTexture2)
  10942.     ['{ff6b7f73-a40e-11d1-91f9-0000f8758e66}']
  10943.     (*
  10944.      * IDirect3DRMTexture3 methods
  10945.      *)
  10946.     function GetSurface
  10947.         (dwFlags: DWORD; out lplpDDS: IDirectDrawSurface) : HResult; stdcall;
  10948.     function SetCacheOptions (lImportance: integer; dwFlags: DWORD) : HResult; stdcall;
  10949.     function GetCacheOptions (var lplImportance: integer; var lpdwFlags: DWORD) : HResult; stdcall;
  10950.     function SetDownsampleCallback (
  10951.         pCallback: TD3DRMDownSampleCallback; pArg: pointer) : HResult; stdcall;
  10952.     function SetValidationCallback (
  10953.         pCallback: TD3DRMValidationCallback; pArg: pointer) : HResult; stdcall;
  10954.   end;
  10955.  
  10956.   IDirect3DRMWrap = interface (IDirect3DRMObject)
  10957.     ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
  10958.     (*
  10959.      * IDirect3DRMWrap methods
  10960.      *)
  10961.     function Init (d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
  10962.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue)
  10963.         : HResult; stdcall;
  10964.     function Apply (lpObject: IDirect3DRMObject) : HResult; stdcall;
  10965.     function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject) : HResult; stdcall;
  10966.   end;
  10967.  
  10968.   IDirect3DRMMaterial = interface (IDirect3DRMObject)
  10969.     ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
  10970.     (*
  10971.      * IDirect3DRMMaterial methods
  10972.      *)
  10973.     function SetPower (rvPower: TD3DValue) : HResult; stdcall;
  10974.     function SetSpecular (r, g, b: TD3DValue) : HResult; stdcall;
  10975.     function SetEmissive (r, g, b: TD3DValue) : HResult; stdcall;
  10976.     function GetPower: TD3DValue; stdcall;
  10977.     function GetSpecular (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10978.     function GetEmissive (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10979.   end;
  10980.  
  10981.   IDirect3DRMMaterial2 = interface (IDirect3DRMMaterial)
  10982.     ['{ff6b7f75-a40e-11d1-91f9-0000f8758e66}']
  10983.     (*
  10984.      * IDirect3DRMMaterial2 methods
  10985.      *)
  10986.     function GetAmbient(out r,g,b: TD3DValue) : HResult; stdcall;
  10987.     function SetAmbient(r,g,b: TD3DValue) : HResult; stdcall;
  10988.   end;
  10989.  
  10990.   IDirect3DRMAnimation = interface (IDirect3DRMObject)
  10991.     ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
  10992.     (*
  10993.      * IDirect3DRMAnimation methods
  10994.      *)
  10995.     function SetOptions (d3drmanimFlags: TD3DRMAnimationOptions) : HResult; stdcall;
  10996.     function AddRotateKey (rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion) : HResult; stdcall;
  10997.     function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10998.     function AddScaleKey (time, x, y, z: TD3DValue) : HResult; stdcall;
  10999.     function DeleteKey (time: TD3DValue) : HResult; stdcall;
  11000.     function SetFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11001.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11002.     function GetOptions: TD3DRMAnimationOptions; stdcall;
  11003.   end;
  11004.  
  11005.   IDirect3DRMAnimation2 = interface (IDirect3DRMAnimation)
  11006.     ['{ff6b7f77-a40e-11d1-91f9-0000f8758e66}']
  11007.     (*
  11008.      * IDirect3DRMAnimation methods
  11009.      *)
  11010.     function GetFrame (out lpD3DFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11011.     function DeleteKeyByID (dwID: DWORD) : HResult; stdcall;
  11012.     function AddKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11013.     function ModifyKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11014.     function GetKeys (dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
  11015.         lpKey: PD3DRMAnimationKey) : HResult; stdcall;
  11016.   end;
  11017.  
  11018.   IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
  11019.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11020.     (*
  11021.      * IDirect3DRMAnimationSet methods
  11022.      *)
  11023.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11024.     function Load (lpvObjSource, lpvObjID: Pointer;
  11025.         d3drmLOFlags: TD3DRMLoadOptions;
  11026.         d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
  11027.         lpParentFrame: IDirect3DRMFrame) : HResult; stdcall;
  11028.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11029.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11030.   end;
  11031.  
  11032.   IDirect3DRMAnimationSet2 = interface (IDirect3DRMObject)
  11033.     ['{ff6b7f79-a40e-11d1-91f9-0000f8758e66}']
  11034.     (*
  11035.      * IDirect3DRMAnimationSet methods
  11036.      *)
  11037.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11038.     function Load (lpvObjSource, lpvObjID: Pointer;
  11039.         d3drmLOFlags: TD3DRMLoadOptions;
  11040.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArgLTP: Pointer;
  11041.         lpParentFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11042.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11043.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11044.     function GetAnimations(out lplpArray: IDirect3DRMAnimationArray) : HResult; stdcall;
  11045.   end;
  11046.  
  11047.   IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
  11048.     ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
  11049.     (*
  11050.      * IDirect3DRMUserVisual methods
  11051.      *)
  11052.     function Init (d3drmUVProc: TD3DRMUserVisualCallback;
  11053.         lpArg: Pointer) : HResult; stdcall;
  11054.   end;
  11055.  
  11056.   IDirect3DRMArray = interface (IUnknown)
  11057.     function GetSize: DWORD; stdcall;
  11058.     (* No GetElement method as it would get overloaded
  11059.      * in derived classes, and overloading is
  11060.      * a no-no in COM
  11061.      *)
  11062.   end;
  11063.  
  11064.   IDirect3DRMObjectArray = interface (IDirect3DRMArray)
  11065.         ['{242f6bc2-3849-11d0-9b6d-0000c0781bc3}']
  11066.     function GetElement (index: DWORD; out lplpD3DRMObject:
  11067.         IDirect3DRMObject) : HResult; stdcall;
  11068.   end;
  11069.  
  11070.   IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
  11071.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11072.     function GetElement (index: DWORD; out lplpD3DRMDevice:
  11073.         IDirect3DRMDevice) : HResult; stdcall;
  11074.   end;
  11075.  
  11076.   IDirect3DRMFrameArray = interface (IDirect3DRMArray)
  11077.     ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
  11078.     function GetElement (index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11079.   end;
  11080.  
  11081.   IDirect3DRMViewportArray = interface (IDirect3DRMArray)
  11082.     ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
  11083.     function GetElement (index: DWORD; out lplpD3DRMViewport:
  11084.         IDirect3DRMViewport) : HResult; stdcall;
  11085.   end;
  11086.  
  11087.   IDirect3DRMVisualArray = interface (IDirect3DRMArray)
  11088.     ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
  11089.     function GetElement (index: DWORD; out lplpD3DRMVisual:
  11090.         IDirect3DRMVisual) : HResult; stdcall;
  11091.   end;
  11092.  
  11093.   IDirect3DRMAnimationArray = interface (IDirect3DRMArray)
  11094.     ['{d5f1cae0-4bd7-11d1-b974-0060083e45f3}']
  11095.     function GetElement (index: DWORD; out lplpD3DRMAnimation2:
  11096.         IDirect3DRMAnimation2) : HResult; stdcall;
  11097.   end;
  11098.  
  11099.   IDirect3DRMPickedArray = interface (IDirect3DRMArray)
  11100.     ['{eb16cb16-d271-11ce-ac48-0000c03825a1}']
  11101.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11102.         out lplpFrameArray: IDirect3DRMFrameArray;
  11103.         const lpD3DRMPickDesc: TD3DRMPickDesc) : HResult; stdcall;
  11104.  
  11105.   end;
  11106.  
  11107.   IDirect3DRMLightArray = interface (IDirect3DRMArray)
  11108.     ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
  11109.     function GetElement (index: DWORD; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11110.   end;
  11111.  
  11112.  
  11113.   IDirect3DRMFaceArray = interface (IDirect3DRMArray)
  11114.     ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
  11115.     function GetElement (index: DWORD; out lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  11116.   end;
  11117.  
  11118.   IDirect3DRMPicked2Array = interface (IDirect3DRMArray)
  11119.     ['{4516ec7b-8f20-11d0-9b6d-0000c0781bc3}']
  11120.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11121.         out lplpFrameArray: IDirect3DRMFrameArray; const lpD3DRMPickDesc2:
  11122.         TD3DRMPickDesc2) : HResult; stdcall;
  11123.   end;
  11124.  
  11125.   IDirect3DRMInterpolator = interface (IDirect3DRMObject)
  11126.     ['{242f6bc1-3849-11d0-9b6d-0000c0781bc3}']
  11127.     (*
  11128.      * IDirect3DRMInterpolator methods
  11129.      *)
  11130.     function AttachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11131.     function GetAttachedObjects
  11132.         (lpD3DRMObjectArray: IDirect3DRMObjectArray) : HResult; stdcall;
  11133.     function DetachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11134.     function SetIndex (d3dVal: TD3DValue) : HResult; stdcall;
  11135.     function GetIndex : TD3DValue; stdcall;
  11136.     function Interpolate (d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
  11137.         d3drmInterpFlags: TD3DRMInterpolationOptions) : HResult; stdcall;
  11138.   end;
  11139.  
  11140.   IDirect3DRMClippedVisual = interface (IDirect3DRMObject)
  11141.     ['{5434e733-6d66-11d1-bb0b-0000f875865a}']
  11142.     (*
  11143.      * IDirect3DRMClippedVisual methods
  11144.      *)
  11145.     function Init (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  11146.     function AddPlane (lpRef: IDirect3DRMFrame3;
  11147.         const lpdvPoint, lpdvNormal: TD3DVector;
  11148.         dwFlags: DWORD; out lpdwReturnID: DWORD) : HResult; stdcall;
  11149.     function DeletePlane (dwID, dwFlags: DWORD) : HResult; stdcall;
  11150.     function GetPlaneIDs (var lpdwCount: DWORD; out lpdwID: DWORD; dwFlags: DWORD) : HResult; stdcall;
  11151.     function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11152.         out lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11153.     function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11154.         const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11155.   end;
  11156.  
  11157. (*==========================================================================;
  11158.  *
  11159.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11160.  *
  11161.  *  File:       d3drm.h
  11162.  *  Content:    Direct3DRM include file
  11163.  *
  11164.  ***************************************************************************)
  11165.  
  11166. function D3DRMErrorString(Value: HResult) : string;
  11167.  
  11168. //type
  11169.   //TRefClsID = TGUID;
  11170.  
  11171. type
  11172.   TD3DRMDevicePaletteCallback = procedure (lpDirect3DRMDev: IDirect3DRMDevice;
  11173.       lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); cdecl;
  11174.  
  11175. (*
  11176.  * Direct3DRM Object Class (for CoCreateInstance())
  11177.  *)
  11178. const
  11179.   CLSID_CDirect3DRM: TGUID =
  11180.       (D1:$4516ec41;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  11181.  
  11182. type
  11183.   IDirect3DRM = interface (IUnknown)
  11184.     ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
  11185.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11186.         const riid: TGUID; out ppv) : HResult; stdcall;
  11187.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame;
  11188.         var lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11189.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11190.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11191.         IDirect3DRMMeshBuilder) : HResult; stdcall;
  11192.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11193.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11194.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11195.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11196.     function CreateTexture (var lpImage: TD3DRMImage;
  11197.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11198.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11199.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11200.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11201.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11202.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11203.         IDirect3DRMMaterial) : HResult; stdcall;
  11204.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11205.         IDirect3DRMDevice) : HResult; stdcall;
  11206.  
  11207.     (* Create a Windows Device using DirectDraw surfaces *)
  11208.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11209.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice) :
  11210.         HResult; stdcall;
  11211.  
  11212.       (* Create a Windows Device using D3D objects *)
  11213.     function CreateDeviceFromD3D (lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
  11214.         var lplpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  11215.  
  11216.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11217.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11218.         IDirect3DRMDevice) : HResult; stdcall;
  11219.  
  11220.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11221.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11222.  
  11223.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11224.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11225.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11226.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11227.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11228.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11229.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11230.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11231.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11232.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11233.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11234.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11235.         IDirect3DRMTexture) : HResult; stdcall;
  11236.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11237.         IDirect3DRMTexture) : HResult; stdcall;
  11238.  
  11239.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11240.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11241.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11242.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11243.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11244.  
  11245.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11246.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11247.  
  11248.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11249.  
  11250.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11251.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11252.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11253.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11254.         IDirect3DRMFrame) : HResult; stdcall;
  11255.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11256.   end;
  11257.  
  11258. // Moved from D3DRMObj, to avoid circular unit reference:
  11259.  
  11260.   IDirect3DRMObject2 = interface (IUnknown)
  11261.     ['{4516ec7c-8f20-11d0-9b6d-0000c0781bc3}']
  11262.     (*
  11263.      * IDirect3DRMObject2 methods
  11264.      *)
  11265.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  11266.         lpArg: Pointer) : HResult; stdcall;
  11267.     function Clone (pUnkOuter: IUnknown; const riid: TGUID;
  11268.         out ppvObj) : HResult; stdcall;
  11269.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  11270.         lpArg: Pointer) : HResult; stdcall;
  11271.     function GetClientData (dwID: DWORD; out lplpvData: Pointer) : HResult; stdcall;
  11272.     function GetDirect3DRM (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11273.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  11274.     function SetClientData (dwID: DWORD; lpvData: pointer; dwFlags: DWORD) : HResult; stdcall;
  11275.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  11276.     function GetAge (dwFlags: DWORD; out pdwAge: DWORD) : HResult; stdcall;
  11277.   end;
  11278.  
  11279.   IID_IDirect3DRMObject2 = IDirect3DRMObject2;
  11280.  
  11281.   IDirect3DRM2 = interface (IUnknown)
  11282.     ['{4516ecc8-8f20-11d0-9b6d-0000c0781bc3}']
  11283.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11284.         const riid: TGUID; out ppv) : HResult; stdcall;
  11285.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame2;
  11286.         var lplpD3DRMFrame: IDirect3DRMFrame2) : HResult; stdcall;
  11287.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11288.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11289.         IDirect3DRMMeshBuilder2) : HResult; stdcall;
  11290.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11291.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11292.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11293.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11294.     function CreateTexture (var lpImage: TD3DRMImage;
  11295.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11296.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11297.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11298.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11299.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11300.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11301.         IDirect3DRMMaterial) : HResult; stdcall;
  11302.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11303.         IDirect3DRMDevice2) : HResult; stdcall;
  11304.  
  11305.     (* Create a Windows Device using DirectDraw surfaces *)
  11306.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11307.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice2) :
  11308.         HResult; stdcall;
  11309.  
  11310.       (* Create a Windows Device using D3D objects *)
  11311.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11312.         var lplpD3DRMDevice: IDirect3DRMDevice2) : HResult; stdcall;
  11313.  
  11314.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11315.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11316.         IDirect3DRMDevice2) : HResult; stdcall;
  11317.  
  11318.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11319.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11320.  
  11321.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11322.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11323.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11324.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11325.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11326.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11327.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11328.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11329.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11330.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11331.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11332.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11333.         IDirect3DRMTexture2) : HResult; stdcall;
  11334.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11335.         IDirect3DRMTexture2) : HResult; stdcall;
  11336.  
  11337.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11338.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11339.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11340.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11341.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11342.  
  11343.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11344.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject:
  11345.         IDirect3DRMObject) : HResult; stdcall;
  11346.  
  11347.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11348.  
  11349.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11350.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11351.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11352.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11353.         IDirect3DRMFrame) : HResult; stdcall;
  11354.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11355.     function CreateProgressiveMesh (var lplpD3DRMProgressiveMesh:
  11356.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11357.   end;
  11358.  
  11359.   IDirect3DRM3 = interface (IUnknown)
  11360.     ['{4516ec83-8f20-11d0-9b6d-0000c0781bc3}']
  11361.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11362.         const riid: TGUID; out ppv) : HResult; stdcall;
  11363.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame3;
  11364.         out lplpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11365.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11366.     function CreateMeshBuilder (out lplpD3DRMMeshBuilder:
  11367.         IDirect3DRMMeshBuilder3) : HResult; stdcall;
  11368.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  11369.     function CreateAnimation (out lplpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11370.     function CreateAnimationSet (out lplpD3DRMAnimationSet:
  11371.         IDirect3DRMAnimationSet2) : HResult; stdcall;
  11372.     function CreateTexture (const lpImage: TD3DRMImage;
  11373.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11374.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11375.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11376.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11377.         vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11378.     function CreateMaterial (vPower: TD3DValue; out lplpD3DRMMaterial:
  11379.         IDirect3DRMMaterial2) : HResult; stdcall;
  11380.     function CreateDevice (dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  11381.         IDirect3DRMDevice3) : HResult; stdcall;
  11382.  
  11383.     (* Create a Windows Device using DirectDraw surfaces *)
  11384.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11385.         lpDDSBack: IDirectDrawSurface; dwFlags: DWORD;
  11386.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11387.  
  11388.       (* Create a Windows Device using D3D objects *)
  11389.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11390.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11391.  
  11392.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11393.         lpGUID: PGUID; width, height: Integer;
  11394.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11395.  
  11396.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11397.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11398.  
  11399.     function CreateShadow (pUnk: IUnknown; lpLight: IDirect3DRMLight;
  11400.         px, py, pz, nx, ny, nz: TD3DValue;
  11401.         out lplpShadow: IDirect3DRMShadow2) : HResult; stdcall;
  11402.     function CreateViewport (lpDev: IDirect3DRMDevice3;
  11403.         lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11404.         out lplpD3DRMViewport: IDirect3DRMViewport2) : HResult; stdcall;
  11405.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
  11406.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11407.         out lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11408.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11409.         out lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11410.     function LoadTexture (lpFileName: PAnsiChar; out lplpD3DRMTexture:
  11411.         IDirect3DRMTexture3) : HResult; stdcall;
  11412.     function LoadTextureFromResource (hModule: HMODULE;
  11413.         strName, strType: PAnsiChar;
  11414.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11415.  
  11416.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11417.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11418.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11419.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11420.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11421.  
  11422.     function GetDevices (out lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11423.     function GetNamedObject (lpName: PAnsiChar; out lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11424.  
  11425.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11426.  
  11427.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11428.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11429.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11430.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
  11431.         IDirect3DRMFrame3) : HResult; stdcall;
  11432.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11433.     function CreateProgressiveMesh (out lplpD3DRMProgressiveMesh:
  11434.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11435.  
  11436.     (* Used with IDirect3DRMObject2 *)
  11437.     function RegisterClient (const rguid: TGUID; out lpdwID: DWORD) : HResult; stdcall;
  11438.     function UnregisterClient (const rguid: TGUID) : HResult; stdcall;
  11439.  
  11440.     function CreateClippedVisual (lpVisual: IDirect3DRMVisual;
  11441.         lpClippedVisual: IDirect3DRMClippedVisual) : HResult; stdcall;
  11442.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  11443.     function GetOptions (out lpdwOptions: DWORD) : HResult; stdcall;
  11444.   end;
  11445.  
  11446.   IID_IDirect3DRM =  IDirect3DRM;
  11447.   IID_IDirect3DRM2 = IDirect3DRM2;
  11448.   IID_IDirect3DRM3 = IDirect3DRM3;
  11449.  
  11450. const
  11451.   MAKE_D3RMDHRESULT = HResult($88760000);
  11452.  
  11453.   D3DRM_OK                        = DD_OK;
  11454.   D3DRMERR_BADOBJECT              = MAKE_D3RMDHRESULT + 781;
  11455.   D3DRMERR_BADTYPE                = MAKE_D3RMDHRESULT + 782;
  11456.   D3DRMERR_BADALLOC               = MAKE_D3RMDHRESULT + 783;
  11457.   D3DRMERR_FACEUSED               = MAKE_D3RMDHRESULT + 784;
  11458.   D3DRMERR_NOTFOUND               = MAKE_D3RMDHRESULT + 785;
  11459.   D3DRMERR_NOTDONEYET             = MAKE_D3RMDHRESULT + 786;
  11460.   D3DRMERR_FILENOTFOUND           = MAKE_D3RMDHRESULT + 787;
  11461.   D3DRMERR_BADFILE                = MAKE_D3RMDHRESULT + 788;
  11462.   D3DRMERR_BADDEVICE              = MAKE_D3RMDHRESULT + 789;
  11463.   D3DRMERR_BADVALUE               = MAKE_D3RMDHRESULT + 790;
  11464.   D3DRMERR_BADMAJORVERSION        = MAKE_D3RMDHRESULT + 791;
  11465.   D3DRMERR_BADMINORVERSION        = MAKE_D3RMDHRESULT + 792;
  11466.   D3DRMERR_UNABLETOEXECUTE        = MAKE_D3RMDHRESULT + 793;
  11467.   D3DRMERR_LIBRARYNOTFOUND        = MAKE_D3RMDHRESULT + 794;
  11468.   D3DRMERR_INVALIDLIBRARY         = MAKE_D3RMDHRESULT + 795;
  11469.   D3DRMERR_PENDING                = MAKE_D3RMDHRESULT + 796;
  11470.   D3DRMERR_NOTENOUGHDATA          = MAKE_D3RMDHRESULT + 797;
  11471.   D3DRMERR_REQUESTTOOLARGE        = MAKE_D3RMDHRESULT + 798;
  11472.   D3DRMERR_REQUESTTOOSMALL        = MAKE_D3RMDHRESULT + 799;
  11473.   D3DRMERR_CONNECTIONLOST         = MAKE_D3RMDHRESULT + 800;
  11474.   D3DRMERR_LOADABORTED            = MAKE_D3RMDHRESULT + 801;
  11475.   D3DRMERR_NOINTERNET             = MAKE_D3RMDHRESULT + 802;
  11476.   D3DRMERR_BADCACHEFILE           = MAKE_D3RMDHRESULT + 803;
  11477.   D3DRMERR_BOXNOTSET              = MAKE_D3RMDHRESULT + 804;
  11478.   D3DRMERR_BADPMDATA              = MAKE_D3RMDHRESULT + 805;
  11479.   D3DRMERR_CLIENTNOTREGISTERED    = MAKE_D3RMDHRESULT + 806;
  11480.   D3DRMERR_NOTCREATEDFROMDDS      = MAKE_D3RMDHRESULT + 807;
  11481.   D3DRMERR_NOSUCHKEY              = MAKE_D3RMDHRESULT + 808;
  11482.   D3DRMERR_INCOMPATABLEKEY        = MAKE_D3RMDHRESULT + 809;
  11483.   D3DRMERR_ELEMENTINUSE           = MAKE_D3RMDHRESULT + 810;
  11484.   D3DRMERR_TEXTUREFORMATNOTFOUND  = MAKE_D3RMDHRESULT + 811;
  11485.  
  11486. (* Create a Direct3DRM API *)
  11487. var
  11488.   Direct3DRMCreate : function (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11489.  
  11490. (*==========================================================================;
  11491.  *
  11492.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11493.  *
  11494.  *  File:       d3drmwin.h
  11495.  *  Content:    Direct3DRM include file
  11496.  *
  11497.  ***************************************************************************)
  11498.  
  11499. type
  11500.   IDirect3DRMWinDevice = interface (IDirect3DRMObject)
  11501.     ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
  11502.     (*
  11503.      * IDirect3DRMWinDevice methods
  11504.      *)
  11505.  
  11506.     (* Repaint the window with the last frame which was rendered. *)
  11507.     function HandlePaint (hDC: HDC) : HResult; stdcall;
  11508.  
  11509.     (* Respond to a WM_ACTIVATE message. *)
  11510.     function HandleActivate (wparam: WORD) : HResult; stdcall;
  11511.   end;
  11512.  
  11513. (*
  11514.  * GUIDS used by Direct3DRM Windows interface
  11515.  *)
  11516.   IID_IDirect3DRMWinDevice = IDirect3DRMWinDevice;
  11517.  
  11518. (***************************************************************************
  11519.  *
  11520.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  11521.  *
  11522.  *  File:       rmxfguid.h
  11523.  *
  11524.  *  Content:    Defines GUIDs of D3DRM's templates.
  11525.  *
  11526.  ***************************************************************************)
  11527.  
  11528. const
  11529. (* {2B957100-9E9A-11cf-AB39-0020AF71E433} *)
  11530.   TID_D3DRMInfo: TGUID =
  11531.       (D1:$2b957100;D2:$9e9a;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11532.  
  11533. (* {3D82AB44-62DA-11cf-AB39-0020AF71E433} *)
  11534.   TID_D3DRMMesh: TGUID =
  11535.       (D1:$3d82ab44;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11536.  
  11537. (* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} *)
  11538.   TID_D3DRMVector: TGUID =
  11539.       (D1:$3d82ab5e;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11540.  
  11541. (* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} *)
  11542.   TID_D3DRMMeshFace: TGUID =
  11543.       (D1:$3d82ab5f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11544.  
  11545. (* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} *)
  11546.   TID_D3DRMMaterial: TGUID =
  11547.       (D1:$3d82ab4d;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11548.  
  11549. (* {35FF44E1-6C7C-11cf-8F52-0040333594A3} *)
  11550.   TID_D3DRMMaterialArray: TGUID =
  11551.       (D1:$35ff44e1;D2:$6c7c;D3:$11cf;D4:($8F,$52,$00,$40,$33,$35,$94,$a3));
  11552.  
  11553. (* {3D82AB46-62DA-11cf-AB39-0020AF71E433} *)
  11554.   TID_D3DRMFrame: TGUID =
  11555.       (D1:$3d82ab46;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11556.  
  11557. (* {F6F23F41-7686-11cf-8F52-0040333594A3} *)
  11558.   TID_D3DRMFrameTransformMatrix: TGUID =
  11559.       (D1:$f6f23f41;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11560.  
  11561. (* {F6F23F42-7686-11cf-8F52-0040333594A3} *)
  11562.   TID_D3DRMMeshMaterialList: TGUID =
  11563.       (D1:$f6f23f42;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11564.  
  11565. (* {F6F23F40-7686-11cf-8F52-0040333594A3} *)
  11566.   TID_D3DRMMeshTextureCoords: TGUID =
  11567.       (D1:$f6f23f40;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11568.  
  11569. (* {F6F23F43-7686-11cf-8F52-0040333594A3} *)
  11570.   TID_D3DRMMeshNormals: TGUID =
  11571.       (D1:$f6f23f43;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11572.  
  11573. (* {F6F23F44-7686-11cf-8F52-0040333594A3} *)
  11574.   TID_D3DRMCoords2d: TGUID =
  11575.       (D1:$f6f23f44;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11576.  
  11577. (* {F6F23F45-7686-11cf-8F52-0040333594A3} *)
  11578.   TID_D3DRMMatrix4x4: TGUID =
  11579.       (D1:$f6f23f45;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11580.  
  11581. (* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} *)
  11582.   TID_D3DRMAnimation: TGUID =
  11583.       (D1:$3d82ab4f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11584.  
  11585. (* {3D82AB50-62DA-11cf-AB39-0020AF71E433} *)
  11586.   TID_D3DRMAnimationSet: TGUID =
  11587.       (D1:$3d82ab50;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11588.  
  11589. (* {10DD46A8-775B-11cf-8F52-0040333594A3} *)
  11590.   TID_D3DRMAnimationKey: TGUID =
  11591.       (D1:$10dd46a8;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11592.  
  11593. (* {10DD46A9-775B-11cf-8F52-0040333594A3} *)
  11594.   TID_D3DRMFloatKeys: TGUID =
  11595.       (D1:$10dd46a9;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11596.  
  11597. (* {01411840-7786-11cf-8F52-0040333594A3} *)
  11598.   TID_D3DRMMaterialAmbientColor: TGUID =
  11599.       (D1:$01411840;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11600.  
  11601. (* {01411841-7786-11cf-8F52-0040333594A3} *)
  11602.   TID_D3DRMMaterialDiffuseColor: TGUID =
  11603.       (D1:$01411841;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11604.  
  11605. (* {01411842-7786-11cf-8F52-0040333594A3} *)
  11606.   TID_D3DRMMaterialSpecularColor: TGUID =
  11607.       (D1:$01411842;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11608.  
  11609. (* {D3E16E80-7835-11cf-8F52-0040333594A3} *)
  11610.   TID_D3DRMMaterialEmissiveColor: TGUID =
  11611.       (D1:$d3e16e80;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11612.  
  11613. (* {01411843-7786-11cf-8F52-0040333594A3} *)
  11614.   TID_D3DRMMaterialPower: TGUID =
  11615.       (D1:$01411843;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11616.  
  11617. (* {35FF44E0-6C7C-11cf-8F52-0040333594A3} *)
  11618.   TID_D3DRMColorRGBA: TGUID =
  11619.       (D1:$35ff44e0;D2:$6c7c;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11620.  
  11621. (* {D3E16E81-7835-11cf-8F52-0040333594A3} *)
  11622.   TID_D3DRMColorRGB: TGUID =
  11623.       (D1:$d3e16e81;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11624.  
  11625. (* {A42790E0-7810-11cf-8F52-0040333594A3} *)
  11626.   TID_D3DRMGuid: TGUID =
  11627.       (D1:$a42790e0;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11628.  
  11629. (* {A42790E1-7810-11cf-8F52-0040333594A3} *)
  11630.   TID_D3DRMTextureFilename: TGUID =
  11631.       (D1:$a42790e1;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11632.  
  11633. (* {A42790E2-7810-11cf-8F52-0040333594A3} *)
  11634.   TID_D3DRMTextureReference: TGUID =
  11635.       (D1:$a42790e2;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11636.  
  11637. (* {1630B820-7842-11cf-8F52-0040333594A3} *)
  11638.   TID_D3DRMIndexedColor: TGUID =
  11639.       (D1:$1630b820;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11640.  
  11641. (* {1630B821-7842-11cf-8F52-0040333594A3} *)
  11642.   TID_D3DRMMeshVertexColors: TGUID =
  11643.       (D1:$1630b821;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11644.  
  11645. (* {4885AE60-78E8-11cf-8F52-0040333594A3} *)
  11646.   TID_D3DRMMaterialWrap: TGUID =
  11647.       (D1:$4885ae60;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11648.  
  11649. (* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} *)
  11650.   TID_D3DRMBoolean: TGUID =
  11651.       (D1:$537da6a0;D2:$ca37;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11652.  
  11653. (* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} *)
  11654.   TID_D3DRMMeshFaceWraps: TGUID =
  11655.       (D1:$ed1ec5c0;D2:$c0a8;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11656.  
  11657. (* {4885AE63-78E8-11cf-8F52-0040333594A3} *)
  11658.   TID_D3DRMBoolean2d: TGUID =
  11659.       (D1:$4885ae63;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11660.  
  11661. (* {F406B180-7B3B-11cf-8F52-0040333594A3} *)
  11662.   TID_D3DRMTimedFloatKeys: TGUID =
  11663.       (D1:$f406b180;D2:$7b3b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11664.  
  11665. (* {E2BF56C0-840F-11cf-8F52-0040333594A3} *)
  11666.   TID_D3DRMAnimationOptions: TGUID =
  11667.       (D1:$e2bf56c0;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11668.  
  11669. (* {E2BF56C1-840F-11cf-8F52-0040333594A3} *)
  11670.   TID_D3DRMFramePosition: TGUID =
  11671.       (D1:$e2bf56c1;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11672.  
  11673. (* {E2BF56C2-840F-11cf-8F52-0040333594A3} *)
  11674.   TID_D3DRMFrameVelocity: TGUID =
  11675.       (D1:$e2bf56c2;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11676.  
  11677. (* {E2BF56C3-840F-11cf-8F52-0040333594A3} *)
  11678.   TID_D3DRMFrameRotation: TGUID =
  11679.       (D1:$e2bf56c3;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11680.  
  11681. (* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} *)
  11682.   TID_D3DRMLight: TGUID =
  11683.       (D1:$3d82ab4a;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11684.  
  11685. (* {3D82AB51-62DA-11cf-AB39-0020AF71E433} *)
  11686.   TID_D3DRMCamera: TGUID =
  11687.       (D1:$3d82ab51;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11688.  
  11689. (* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} *)
  11690.   TID_D3DRMAppData: TGUID =
  11691.       (D1:$e5745280;D2:$b24f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11692.  
  11693. (* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} *)
  11694.   TID_D3DRMLightUmbra: TGUID =
  11695.       (D1:$aed22740;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11696.  
  11697. (* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} *)
  11698.   TID_D3DRMLightRange: TGUID =
  11699.       (D1:$aed22742;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11700.  
  11701. (* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} *)
  11702.   TID_D3DRMLightPenumbra: TGUID =
  11703.       (D1:$aed22741;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11704.  
  11705. (* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} *)
  11706.   TID_D3DRMLightAttenuation: TGUID =
  11707.       (D1:$a8a98ba0;D2:$c5e5;D3:$11cf;D4:($b9,$41,$00,$80,$c8,$0c,$fa,$7b));
  11708.  
  11709. (* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} *)
  11710.   TID_D3DRMInlineData: TGUID =
  11711.       (D1:$3a23eea0;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11712.  
  11713. (* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} *)
  11714.   TID_D3DRMUrl: TGUID =
  11715.       (D1:$3a23eea1;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11716.  
  11717. (* {8A63C360-997D-11d0-941C-0080C80CFA7B} *)
  11718.   TID_D3DRMProgressiveMesh: TGUID =
  11719.       (D1:$8A63C360;D2:$997D;D3:$11d0;D4:($94,$1C,$00,$80,$C8,$0C,$FA,$7B));
  11720.  
  11721. (* {98116AA0-BDBA-11d1-82C0-00A0C9697271} *)
  11722.   TID_D3DRMExternalVisual: TGUID =
  11723.       (D1:$98116AA0;D2:$BDBA;D3:$11d1;D4:($82,$C0,$00,$A0,$C9,$69,$72,$71));
  11724.  
  11725. (* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} *)
  11726.   TID_D3DRMStringProperty: TGUID =
  11727.       (D1:$7f0f21e0;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11728.  
  11729. (* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} *)
  11730.   TID_D3DRMPropertyBag: TGUID =
  11731.       (D1:$7f0f21e1;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11732.  
  11733. // {7F5D5EA0-D53A-11d1-82C0-00A0C9697271}
  11734.   TID_D3DRMRightHanded: TGUID =
  11735.       (D1:$7f5d5ea0;D2:$d53a;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11736.  
  11737. (*==========================================================================;
  11738.  *
  11739.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11740.  *
  11741.  *  File:       rmxftmpl.h
  11742.  *  Content:    D3DRM XFile templates in binary form
  11743.  *
  11744.  ***************************************************************************)
  11745.  
  11746. const
  11747.   D3DRM_XTEMPLATE_BYTES_2  = 3278;
  11748.  
  11749.   D3DRM_XTEMPLATES_2: array [0..D3DRM_XTEMPLATE_BYTES_2-1] of byte = (
  11750.         $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  11751.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  11752.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  11753.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  11754.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  11755.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  11756.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  11757.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  11758.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  11759.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  11760.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  11761.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11762.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11763.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  11764.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  11765.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  11766.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  11767.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  11768.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  11769.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  11770.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  11771.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  11772.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  11773.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  11774.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  11775.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  11776.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  11777.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  11778.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  11779.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  11780.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  11781.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  11782.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  11783.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  11784.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  11785.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  11786.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  11787.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  11788.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  11789.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  11790.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  11791.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  11792.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  11793.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  11794.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  11795.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  11796.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  11797.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  11798.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  11799.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  11800.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  11801.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  11802.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  11803.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  11804.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  11805.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  11806.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11807.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  11808.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  11809.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  11810.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  11811.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  11812.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  11813.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  11814.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  11815.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  11816.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  11817.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  11818.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  11819.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  11820.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  11821.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11822.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  11823.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  11824.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  11825.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  11826.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  11827.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  11828.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  11829.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  11830.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  11831.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  11832.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  11833.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  11834.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  11835.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  11836.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11837.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  11838.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  11839.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11840.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  11841.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11842.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  11843.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  11844.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  11845.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  11846.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  11847.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  11848.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  11849.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  11850.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  11851.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  11852.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  11853.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  11854.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11855.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  11856.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  11857.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  11858.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  11859.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  11860.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  11861.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  11862.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  11863.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  11864.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  11865.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  11866.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  11867.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  11868.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  11869.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  11870.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  11871.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  11872.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  11873.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  11874.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  11875.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  11876.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  11877.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  11878.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  11879.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  11880.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  11881.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  11882.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  11883.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  11884.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  11885.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  11886.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  11887.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  11888.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  11889.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  11890.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  11891.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  11892.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  11893.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  11894.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  11895.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  11896.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  11897.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  11898.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  11899.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  11900.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  11901.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  11902.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  11903.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  11904.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  11905.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  11906.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  11907.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  11908.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  11909.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  11910.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0,
  11911.         $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0,
  11912.         $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c,
  11913.         0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0);
  11914.  
  11915. //---------------
  11916. {$ENDIF}
  11917. //DirectInput file
  11918. (*==========================================================================;
  11919.  *
  11920.  *  Copyright (C) 1996-1999 Microsoft Corporation.  All Rights Reserved.
  11921.  *
  11922.  *  File:       dinput.h
  11923.  *  Content:    DirectInput include file
  11924.  *
  11925.  *  DirectX 7.0 Delphi adaptation by Erik Unger, input format
  11926.  *  variable structure & other fixups by Arne Schäpers (as)
  11927.  *
  11928.  *  Modified: 10-Sep-2000
  11929.  *
  11930.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  11931.  *  E-Mail: DelphiDirectX@next-reality.com
  11932.  *          a.schaepers@digitalpublishing.de            
  11933.  *
  11934.  ***************************************************************************)
  11935.  
  11936. { Some notes from as:
  11937.   1. DirectInput Enum callback functions which are documented with result
  11938.   type BOOL in the SDK had to be changed to result type integer because the debug
  11939.   version of DINPUT.DLL (which is the same for SDK versions 5.0, 5.2, 6.0, and 6.1)
  11940.   explicitely checks for two possible return values:
  11941.  
  11942.   0 - FALSE in C and in Delphi
  11943.   1 - TRUE in C, defined as DIENUM_CONTINUE
  11944.  
  11945.   In Delphi, TRUE means $FFFFFFFF (= -1) for the LongBool (= BOOL) data
  11946.   type, and AL = 1 (upper three bytes undefined) for the Boolean data type.
  11947.   The debug version of DINPUT.DLL will throw an external exception
  11948.   ("invalid return value for callback") when fed with either value.
  11949.  
  11950.   This change affects the following methods:
  11951.   EnumDevices, EnumObjects, EnumEffects, EnumCreatedEffectObjects
  11952.  
  11953.   2. Windows 98 and DX6 debug versions DInput and DSound
  11954.  
  11955.   Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
  11956.   and DSound.DLL, i.e. makes you end up with the retail version of these two
  11957.   files without any notice.
  11958.   The debug versions of DInput.DLL and DSound.DLL can be found in the
  11959.   \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
  11960.   "manually".
  11961.  
  11962.   This problem has been fixed with DX7 where the SDK installs the debug versions
  11963.   of DInput and DSound without any "manual" help.
  11964.  
  11965. }
  11966.  
  11967.  
  11968. var
  11969.   DInputDLL : HMODULE;
  11970.  
  11971. {$IFDEF DIRECTX3}
  11972. const DIRECTINPUT_VERSION = $0300;
  11973. {$ELSE}
  11974. const DIRECTINPUT_VERSION = $0700;
  11975. {$ENDIF}
  11976.  
  11977. function DIErrorString(Value: HResult) : string;
  11978.  
  11979. //type
  11980. //  TRefGUID = packed record
  11981. //    case integer of
  11982. //    1: (guid : PGUID);
  11983. //    2: (dwFlags : DWORD);
  11984. //  end;
  11985.  
  11986. (****************************************************************************
  11987.  *
  11988.  *      Class IDs
  11989.  *
  11990.  ****************************************************************************)
  11991. const
  11992.   CLSID_DirectInput: TGUID =
  11993.       (D1:$25E609E0;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11994.   CLSID_DirectInputDevice: TGUID =
  11995.       (D1:$25E609E1;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11996.  
  11997. (****************************************************************************
  11998.  *
  11999.  *      Predefined object types
  12000.  *
  12001.  ****************************************************************************)
  12002.  
  12003.   GUID_XAxis: TGUID =
  12004.       (D1:$A36D02E0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12005.   GUID_YAxis: TGUID =
  12006.       (D1:$A36D02E1;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12007.   GUID_ZAxis: TGUID =
  12008.       (D1:$A36D02E2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12009.   GUID_RxAxis: TGUID =
  12010.       (D1:$A36D02F4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12011.   GUID_RyAxis: TGUID =
  12012.       (D1:$A36D02F5;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12013.   GUID_RzAxis: TGUID =
  12014.       (D1:$A36D02E3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12015.   GUID_Slider: TGUID =
  12016.       (D1:$A36D02E4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12017.  
  12018.   GUID_Button: TGUID =
  12019.       (D1:$A36D02F0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12020.   GUID_Key: TGUID =
  12021.       (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12022.  
  12023.   GUID_POV: TGUID =
  12024.       (D1:$A36D02F2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12025.  
  12026.   GUID_Unknown: TGUID =
  12027.       (D1:$A36D02F3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12028.  
  12029. (****************************************************************************
  12030.  *
  12031.  *      Predefined product GUIDs
  12032.  *
  12033.  ****************************************************************************)
  12034.  
  12035.   GUID_SysMouse: TGUID =
  12036.       (D1:$6F1D2B60;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12037.   GUID_SysKeyboard: TGUID =
  12038.       (D1:$6F1D2B61;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12039.   GUID_Joystick: TGUID =
  12040.       (D1:$6F1D2B70;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12041.   GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
  12042.   GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
  12043.   GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
  12044.   GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
  12045.  
  12046. (****************************************************************************
  12047.  *
  12048.  *      Predefined force feedback effects
  12049.  *
  12050.  ****************************************************************************)
  12051.  
  12052.   GUID_ConstantForce: TGUID =
  12053.       (D1:$13541C20;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12054.   GUID_RampForce: TGUID =
  12055.       (D1:$13541C21;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12056.   GUID_Square: TGUID =
  12057.       (D1:$13541C22;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12058.   GUID_Sine: TGUID =
  12059.       (D1:$13541C23;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12060.   GUID_Triangle: TGUID =
  12061.       (D1:$13541C24;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12062.   GUID_SawtoothUp: TGUID =
  12063.       (D1:$13541C25;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12064.   GUID_SawtoothDown: TGUID =
  12065.       (D1:$13541C26;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12066.   GUID_Spring: TGUID =
  12067.       (D1:$13541C27;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12068.   GUID_Damper: TGUID =
  12069.       (D1:$13541C28;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12070.   GUID_Inertia: TGUID =
  12071.       (D1:$13541C29;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12072.   GUID_Friction: TGUID =
  12073.       (D1:$13541C2A;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12074.   GUID_CustomForce: TGUID =
  12075.       (D1:$13541C2B;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12076.  
  12077.  
  12078.  
  12079. (****************************************************************************
  12080.  *
  12081.  *      Interfaces and Structures...
  12082.  *
  12083.  ****************************************************************************)
  12084.  
  12085. (****************************************************************************
  12086.  *
  12087.  *      IDirectInputEffect
  12088.  *
  12089.  ****************************************************************************)
  12090.  
  12091. const
  12092.   DIEFT_ALL                   = $00000000;
  12093.  
  12094.   DIEFT_CONSTANTFORCE         = $00000001;
  12095.   DIEFT_RAMPFORCE             = $00000002;
  12096.   DIEFT_PERIODIC              = $00000003;
  12097.   DIEFT_CONDITION             = $00000004;
  12098.   DIEFT_CUSTOMFORCE           = $00000005;
  12099.   DIEFT_HARDWARE              = $000000FF;
  12100.  
  12101.   DIEFT_FFATTACK              = $00000200;
  12102.   DIEFT_FFFADE                = $00000400;
  12103.   DIEFT_SATURATION            = $00000800;
  12104.   DIEFT_POSNEGCOEFFICIENTS    = $00001000;
  12105.   DIEFT_POSNEGSATURATION      = $00002000;
  12106.   DIEFT_DEADBAND              = $00004000;
  12107.   DIEFT_STARTDELAY            = $00008000;
  12108.  
  12109. function DIEFT_GETTYPE(n: variant) : byte;
  12110.  
  12111. const
  12112.   DI_DEGREES                  =     100;
  12113.   DI_FFNOMINALMAX             =   10000;
  12114.   DI_SECONDS                  = 1000000;
  12115.  
  12116. type
  12117.   PDIConstantForce = ^TDIConstantForce;
  12118.   TDIConstantForce = packed record
  12119.     lMagnitude : LongInt;
  12120.   end;
  12121.  
  12122.   PDIRampForce = ^TDIRampForce;
  12123.   TDIRampForce = packed record
  12124.     lStart : LongInt;
  12125.     lEnd : LongInt;
  12126.   end;
  12127.  
  12128.   PDIPeriodic = ^TDIPeriodic;
  12129.   TDIPeriodic = packed record
  12130.     dwMagnitude : DWORD;
  12131.     lOffset : LongInt;
  12132.     dwPhase : DWORD;
  12133.     dwPeriod : DWORD;
  12134.   end;
  12135.  
  12136.   PDICondition = ^TDICondition;
  12137.   TDICondition = packed record
  12138.     lOffset : LongInt;
  12139.     lPositiveCoefficient : LongInt;
  12140.     lNegativeCoefficient : LongInt;
  12141.     dwPositiveSaturation : DWORD;
  12142.     dwNegativeSaturation : DWORD;
  12143.     lDeadBand : LongInt;
  12144.   end;
  12145.  
  12146.   PDICustomForce = ^TDICustomForce;
  12147.   TDICustomForce = packed record
  12148.     cChannels : DWORD;
  12149.     dwSamplePeriod : DWORD;
  12150.     cSamples : DWORD;
  12151.     rglForceData : PLongInt;
  12152.   end;
  12153.  
  12154.   PDIEnvelope = ^TDIEnvelope;
  12155.   TDIEnvelope = packed record
  12156.     dwSize : DWORD;                   (* sizeof(DIENVELOPE)   *)
  12157.     dwAttackLevel : DWORD;
  12158.     dwAttackTime : DWORD;             (* Microseconds         *)
  12159.     dwFadeLevel : DWORD;
  12160.     dwFadeTime : DWORD;               (* Microseconds         *)
  12161.   end;
  12162.  
  12163.   PDIEffect_DX5 = ^TDIEffect_DX5;
  12164.   TDIEffect_DX5 = packed record
  12165.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12166.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12167.     dwDuration : DWORD;               (* Microseconds         *)
  12168.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12169.     dwGain : DWORD;
  12170.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12171.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12172.     cAxes : DWORD;                    (* Number of axes       *)
  12173.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12174.     rglDirection : PLongInt;          (* Array of directions  *)
  12175.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12176.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12177.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12178.   end;
  12179.  
  12180.   PDIEffect_DX6 = ^TDIEffect_DX6;
  12181.   TDIEffect_DX6 = packed record
  12182.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12183.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12184.     dwDuration : DWORD;               (* Microseconds         *)
  12185.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12186.     dwGain : DWORD;
  12187.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12188.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12189.     cAxes : DWORD;                    (* Number of axes       *)
  12190.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12191.     rglDirection : PLongInt;          (* Array of directions  *)
  12192.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12193.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12194.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12195.     dwStartDelay: DWORD;              (* Microseconds         *)
  12196.   end;
  12197.  
  12198.   PDIEffect = ^TDIEffect;
  12199. {$IFDEF DIRECTX5}
  12200.   TDIEffect = TDIEffect_DX5;
  12201. {$ELSE}
  12202.   TDIEffect = TDIEffect_DX6;
  12203. {$ENDIF}
  12204.  
  12205.   PDIFileEffect = ^TDIFileEffect;
  12206.   TDIFileEffect = packed record
  12207.     dwSize : DWORD;
  12208.     GuidEffect: TGUID;
  12209.     lpDiEffect: PDIEffect;
  12210.     szFriendlyName : array [0..MAX_PATH-1] of AnsiChar;
  12211.   end;
  12212.  
  12213. const
  12214.   DIEFF_OBJECTIDS             = $00000001;
  12215.   DIEFF_OBJECTOFFSETS         = $00000002;
  12216.   DIEFF_CARTESIAN             = $00000010;
  12217.   DIEFF_POLAR                 = $00000020;
  12218.   DIEFF_SPHERICAL             = $00000040;
  12219.  
  12220.   DIEP_DURATION               = $00000001;
  12221.   DIEP_SAMPLEPERIOD           = $00000002;
  12222.   DIEP_GAIN                   = $00000004;
  12223.   DIEP_TRIGGERBUTTON          = $00000008;
  12224.   DIEP_TRIGGERREPEATINTERVAL  = $00000010;
  12225.   DIEP_AXES                   = $00000020;
  12226.   DIEP_DIRECTION              = $00000040;
  12227.   DIEP_ENVELOPE               = $00000080;
  12228.   DIEP_TYPESPECIFICPARAMS     = $00000100;
  12229. {$IFDEF DIRECTX5}
  12230.   DIEP_ALLPARAMS              = $000001FF;
  12231. {$ELSE}
  12232.   DIEP_STARTDELAY             = $00000200;
  12233.   DIEP_ALLPARAMS_DX5          = $000001FF;
  12234.   DIEP_ALLPARAMS              = $000003FF;
  12235. {$ENDIF}
  12236.   DIEP_START                  = $20000000;
  12237.   DIEP_NORESTART              = $40000000;
  12238.   DIEP_NODOWNLOAD             = $80000000;
  12239.   DIEB_NOTRIGGER              = $FFFFFFFF;
  12240.  
  12241.   DIES_SOLO                   = $00000001;
  12242.   DIES_NODOWNLOAD             = $80000000;
  12243.  
  12244.   DIEGES_PLAYING              = $00000001;
  12245.   DIEGES_EMULATED             = $00000002;
  12246.  
  12247.  
  12248. type
  12249.   PDIEffEscape = ^TDIEffEscape;
  12250.   TDIEffEscape = packed record
  12251.     dwSize : DWORD;
  12252.     dwCommand : DWORD;
  12253.     lpvInBuffer : pointer;
  12254.     cbInBuffer : DWORD;
  12255.     lpvOutBuffer : pointer;
  12256.     cbOutBuffer : DWORD;
  12257.   end;
  12258.  
  12259.  
  12260. //
  12261. // IDirectSoundCapture  // as: ???
  12262. //
  12263.   IDirectInputEffect = interface (IUnknown)
  12264.     ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
  12265.     (** IDirectInputEffect methods ***)
  12266.     function Initialize(hinst: THandle; dwVersion: DWORD;
  12267.         const rguid: TGUID) : HResult;  stdcall;
  12268.     function GetEffectGuid(var pguid: TGUID) : HResult;  stdcall;
  12269.     function GetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12270.     function SetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12271.     function Start(dwIterations: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12272.     function Stop : HResult;  stdcall;
  12273.     function GetEffectStatus(var pdwFlags : DWORD) : HResult;  stdcall;
  12274.     function Download : HResult;  stdcall;
  12275.     function Unload : HResult;  stdcall;
  12276.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12277.   end;
  12278.  
  12279. (****************************************************************************
  12280.  *
  12281.  *      IDirectInputDevice
  12282.  *
  12283.  ****************************************************************************)
  12284.  
  12285. const
  12286.   DIDEVTYPE_DEVICE = 1;
  12287.   DIDEVTYPE_MOUSE = 2;
  12288.   DIDEVTYPE_KEYBOARD = 3;
  12289.   DIDEVTYPE_JOYSTICK = 4;
  12290.   DIDEVTYPE_HID = $00010000;
  12291.  
  12292.   DIDEVTYPEMOUSE_UNKNOWN = 1;
  12293.   DIDEVTYPEMOUSE_TRADITIONAL = 2;
  12294.   DIDEVTYPEMOUSE_FINGERSTICK = 3;
  12295.   DIDEVTYPEMOUSE_TOUCHPAD = 4;
  12296.   DIDEVTYPEMOUSE_TRACKBALL = 5;
  12297.  
  12298.   DIDEVTYPEKEYBOARD_UNKNOWN = 0;
  12299.   DIDEVTYPEKEYBOARD_PCXT = 1;
  12300.   DIDEVTYPEKEYBOARD_OLIVETTI = 2;
  12301.   DIDEVTYPEKEYBOARD_PCAT = 3;
  12302.   DIDEVTYPEKEYBOARD_PCENH = 4;
  12303.   DIDEVTYPEKEYBOARD_NOKIA1050 = 5;
  12304.   DIDEVTYPEKEYBOARD_NOKIA9140 = 6;
  12305.   DIDEVTYPEKEYBOARD_NEC98 = 7;
  12306.   DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
  12307.   DIDEVTYPEKEYBOARD_NEC98106 = 9;
  12308.   DIDEVTYPEKEYBOARD_JAPAN106 = 10;
  12309.   DIDEVTYPEKEYBOARD_JAPANAX = 11;
  12310.   DIDEVTYPEKEYBOARD_J3100 = 12;
  12311.  
  12312.   DIDEVTYPEJOYSTICK_UNKNOWN = 1;
  12313.   DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
  12314.   DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
  12315.   DIDEVTYPEJOYSTICK_GAMEPAD = 4;
  12316.   DIDEVTYPEJOYSTICK_RUDDER = 5;
  12317.   DIDEVTYPEJOYSTICK_WHEEL = 6;
  12318.   DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
  12319.  
  12320. function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
  12321. function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
  12322.  
  12323. type
  12324.   PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
  12325.   TDIDevCaps_DX3 = packed record
  12326.     dwSize: DWORD;
  12327.     dwFlags: DWORD;
  12328.     dwDevType: DWORD;
  12329.     dwAxes: DWORD;
  12330.     dwButtons: DWORD;
  12331.     dwPOVs: DWORD;
  12332.   end;
  12333.  
  12334.   PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
  12335.   TDIDevCaps_DX5 = packed record
  12336.     dwSize: DWORD;
  12337.     dwFlags: DWORD;
  12338.     dwDevType: DWORD;
  12339.     dwAxes: DWORD;
  12340.     dwButtons: DWORD;
  12341.     dwPOVs: DWORD;
  12342.     dwFFSamplePeriod: DWORD;
  12343.     dwFFMinTimeResolution: DWORD;
  12344.     dwFirmwareRevision: DWORD;
  12345.     dwHardwareRevision: DWORD;
  12346.     dwFFDriverVersion: DWORD;
  12347.   end;
  12348.  
  12349.   PDIDevCaps = ^TDIDevCaps;
  12350. {$IFDEF DIRECTX3}
  12351.   TDIDevCaps = TDIDevCaps_DX3;
  12352. {$ELSE}
  12353.   TDIDevCaps = TDIDevCaps_DX5;
  12354. {$ENDIF}
  12355.  
  12356. const
  12357.   DIDC_ATTACHED           = $00000001;
  12358.   DIDC_POLLEDDEVICE       = $00000002;
  12359.   DIDC_EMULATED           = $00000004;
  12360.   DIDC_POLLEDDATAFORMAT   = $00000008;
  12361.   DIDC_FORCEFEEDBACK      = $00000100;
  12362.   DIDC_FFATTACK           = $00000200;
  12363.   DIDC_FFFADE             = $00000400;
  12364.   DIDC_SATURATION         = $00000800;
  12365.   DIDC_POSNEGCOEFFICIENTS = $00001000;
  12366.   DIDC_POSNEGSATURATION   = $00002000;
  12367.   DIDC_DEADBAND           = $00004000;
  12368.   DIDC_STARTDELAY         = $00008000;
  12369.   DIDC_ALIAS              = $00010000;
  12370.   DIDC_PHANTOM            = $00020000;
  12371.  
  12372.   DIDFT_ALL = $00000000;
  12373.  
  12374.   DIDFT_RELAXIS = $00000001;
  12375.   DIDFT_ABSAXIS = $00000002;
  12376.   DIDFT_AXIS    = $00000003;
  12377.  
  12378.   DIDFT_PSHBUTTON = $00000004;
  12379.   DIDFT_TGLBUTTON = $00000008;
  12380.   DIDFT_BUTTON    = $0000000C;
  12381.  
  12382.   DIDFT_POV        = $00000010;
  12383.   DIDFT_COLLECTION = $00000040;
  12384.   DIDFT_NODATA     = $00000080;
  12385.  
  12386.   DIDFT_ANYINSTANCE = $00FFFF00;
  12387.   DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
  12388. function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
  12389. function DIDFT_GETTYPE(n: variant) : byte;
  12390. function DIDFT_GETINSTANCE(n: variant) : DWORD;
  12391. const
  12392.   DIDFT_FFACTUATOR        = $01000000;
  12393.   DIDFT_FFEFFECTTRIGGER   = $02000000;
  12394.   DIDFT_OUTPUT            = $10000000;
  12395.   DIDFT_VENDORDEFINED     = $04000000;
  12396.   DIDFT_ALIAS             = $08000000;
  12397.  
  12398. function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
  12399. const
  12400.   DIDFT_NOCOLLECTION = $00FFFF00;
  12401.  
  12402.  
  12403.  
  12404. type
  12405.   PDIObjectDataFormat = ^TDIObjectDataFormat;
  12406.   TDIObjectDataFormat = packed record
  12407.     pguid: PGUID;
  12408.     dwOfs: DWORD;
  12409.     dwType: DWORD;
  12410.     dwFlags: DWORD;
  12411.   end;
  12412.  
  12413.   PDIDataFormat = ^TDIDataFormat;
  12414.   TDIDataFormat = packed record
  12415.     dwSize: DWORD;  
  12416.     dwObjSize: DWORD;
  12417.     dwFlags: DWORD;  
  12418.     dwDataSize: DWORD;  
  12419.     dwNumObjs: DWORD;  
  12420.     rgodf: PDIObjectDataFormat;
  12421.   end;
  12422.  
  12423. const
  12424.   DIDF_ABSAXIS = $00000001;
  12425.   DIDF_RELAXIS = $00000002;
  12426.  
  12427. type
  12428.   PDIDeviceObjectInstance_DX3A = ^TDIDeviceObjectInstance_DX3A;
  12429.   TDIDeviceObjectInstance_DX3A = packed record
  12430.     dwSize: DWORD;
  12431.     guidType: TGUID;
  12432.     dwOfs: DWORD;
  12433.     dwType: DWORD;
  12434.     dwFlags: DWORD;
  12435.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12436.   end;
  12437.  
  12438.   PDIDeviceObjectInstance_DX3W = ^TDIDeviceObjectInstance_DX3W;
  12439.   TDIDeviceObjectInstance_DX3W = packed record
  12440.     dwSize: DWORD;
  12441.     guidType: TGUID;
  12442.     dwOfs: DWORD;
  12443.     dwType: DWORD;
  12444.     dwFlags: DWORD;
  12445.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12446.   end;
  12447.  
  12448.   PDIDeviceObjectInstance_DX3 = ^TDIDeviceObjectInstance_DX3;
  12449. {$IFDEF UNICODE}
  12450.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3W;
  12451. {$ELSE}
  12452.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3A;
  12453. {$ENDIF}
  12454.  
  12455.   PDIDeviceObjectInstance_DX5A = ^TDIDeviceObjectInstance_DX5A;
  12456.   TDIDeviceObjectInstance_DX5A = packed record
  12457.     dwSize: DWORD;
  12458.     guidType: TGUID;
  12459.     dwOfs: DWORD;
  12460.     dwType: DWORD;
  12461.     dwFlags: DWORD;
  12462.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12463.     dwFFMaxForce: DWORD;
  12464.     dwFFForceResolution: DWORD;
  12465.     wCollectionNumber: WORD;
  12466.     wDesignatorIndex: WORD;
  12467.     wUsagePage: WORD;
  12468.     wUsage: WORD;
  12469.     dwDimension: DWORD;
  12470.     wExponent: WORD;
  12471.     wReserved: WORD;
  12472.   end;
  12473.  
  12474.   PDIDeviceObjectInstance_DX5W = ^TDIDeviceObjectInstance_DX5W;
  12475.   TDIDeviceObjectInstance_DX5W = packed record
  12476.     dwSize: DWORD;
  12477.     guidType: TGUID;
  12478.     dwOfs: DWORD;
  12479.     dwType: DWORD;
  12480.     dwFlags: DWORD;
  12481.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12482.     dwFFMaxForce: DWORD;
  12483.     dwFFForceResolution: DWORD;
  12484.     wCollectionNumber: WORD;
  12485.     wDesignatorIndex: WORD;
  12486.     wUsagePage: WORD;
  12487.     wUsage: WORD;
  12488.     dwDimension: DWORD;
  12489.     wExponent: WORD;
  12490.     wReserved: WORD;
  12491.   end;
  12492.  
  12493.   PDIDeviceObjectInstance_DX5 = ^TDIDeviceObjectInstance_DX5;
  12494. {$IFDEF UNICODE}
  12495.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5W;
  12496. {$ELSE}
  12497.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5A;
  12498. {$ENDIF}
  12499.  
  12500.   PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
  12501.   PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceA;
  12502.   PDIDeviceObjectInstance = ^TDIDeviceObjectInstance;
  12503. {$IFDEF DIRECTX3}
  12504.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX3A;
  12505.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX3W;
  12506.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX3;
  12507. {$ELSE}
  12508.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX5A;
  12509.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX5W;
  12510.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX5;
  12511. {$ENDIF}
  12512.  
  12513.   // Bug fix (and deviation from the SDK). Callback *must* return
  12514.   // DIENUM_STOP (= 0) or DIENUM_CONTINUE (=1) in order to work
  12515.   // with the debug version of DINPUT.DLL
  12516.   TDIEnumDeviceObjectsCallbackA = function (
  12517.       var lpddoi: TDIDeviceObjectInstanceA; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12518.   TDIEnumDeviceObjectsCallbackW = function (
  12519.       var lpddoi: TDIDeviceObjectInstanceW; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12520.   TDIEnumDeviceObjectsCallback = function (
  12521.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12522.  
  12523.   TDIEnumDeviceObjectsProc = function (
  12524.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12525.  
  12526. const
  12527.   DIDOI_FFACTUATOR        = $00000001;
  12528.   DIDOI_FFEFFECTTRIGGER   = $00000002;
  12529.   DIDOI_POLLED            = $00008000;
  12530.   DIDOI_ASPECTPOSITION    = $00000100;
  12531.   DIDOI_ASPECTVELOCITY    = $00000200;
  12532.   DIDOI_ASPECTACCEL       = $00000300;
  12533.   DIDOI_ASPECTFORCE       = $00000400;
  12534.   DIDOI_ASPECTMASK        = $00000F00;
  12535.   DIDOI_GUIDISUSAGE       = $00010000;
  12536.  
  12537. type
  12538.   PDIPropHeader = ^TDIPropHeader;
  12539.   TDIPropHeader = packed record
  12540.     dwSize: DWORD;
  12541.     dwHeaderSize: DWORD;
  12542.     dwObj: DWORD;
  12543.     dwHow: DWORD;
  12544.   end;
  12545.  
  12546. const
  12547.   DIPH_DEVICE = 0;
  12548.   DIPH_BYOFFSET = 1;
  12549.   DIPH_BYID = 2;
  12550.   DIPH_BYUSAGE = 3;
  12551.  
  12552. function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
  12553.  
  12554. type
  12555.   PDIPropDWord = ^TDIPropDWord;
  12556.   TDIPropDWord = packed record
  12557.     diph: TDIPropHeader;
  12558.     dwData: DWORD;
  12559.   end;
  12560.  
  12561.   PDIPropRange = ^TDIPropRange;
  12562.   TDIPropRange = packed record
  12563.     diph: TDIPropHeader;
  12564.     lMin: Longint;
  12565.     lMax: Longint;
  12566.   end;
  12567.  
  12568. const
  12569.   DIPROPRANGE_NOMIN = $80000000;
  12570.   DIPROPRANGE_NOMAX = $7FFFFFFF;
  12571.  
  12572. type
  12573.   PDIPropCal = ^TDIPropCal;
  12574.   TDIPropCal = packed record
  12575.     diph: TDIPropHeader;
  12576.     lMin:    LongInt;
  12577.     lCenter: LongInt;
  12578.     lMax:    LongInt;
  12579.   end;
  12580.  
  12581.   PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
  12582.   TDIPropGUIDAndPath = packed record
  12583.     diph: TDIPropHeader;
  12584.     guidClass: TGUID;
  12585.     wszPath: array [0..MAX_PATH-1] of WideChar;
  12586.   end;
  12587.  
  12588.   PDIPropString = ^TDIPropString;
  12589.   TDIPropString = packed record
  12590.     diph: TDIPropHeader;
  12591.     wsz: array [0..MAX_PATH-1] of WideChar;
  12592.   end;
  12593.  
  12594. type
  12595.   MAKEDIPROP = PGUID;
  12596.  
  12597. const
  12598.   DIPROP_BUFFERSIZE = MAKEDIPROP(1);
  12599.  
  12600.   DIPROP_AXISMODE = MAKEDIPROP(2);
  12601.  
  12602.   DIPROPAXISMODE_ABS = 0;
  12603.   DIPROPAXISMODE_REL = 1;
  12604.  
  12605.   DIPROP_GRANULARITY = MAKEDIPROP(3);
  12606.  
  12607.   DIPROP_RANGE = MAKEDIPROP(4);
  12608.  
  12609.   DIPROP_DEADZONE = MAKEDIPROP(5);
  12610.  
  12611.   DIPROP_SATURATION = MAKEDIPROP(6);
  12612.  
  12613.   DIPROP_FFGAIN = MAKEDIPROP(7);
  12614.  
  12615.   DIPROP_FFLOAD = MAKEDIPROP(8);
  12616.  
  12617.   DIPROP_AUTOCENTER = MAKEDIPROP(9);
  12618.  
  12619.   DIPROPAUTOCENTER_OFF = 0;
  12620.   DIPROPAUTOCENTER_ON = 1;
  12621.  
  12622.   DIPROP_CALIBRATIONMODE = MAKEDIPROP(10);
  12623.  
  12624.   DIPROPCALIBRATIONMODE_COOKED = 0;
  12625.   DIPROPCALIBRATIONMODE_RAW = 1;
  12626.  
  12627.   DIPROP_CALIBRATION      = MAKEDIPROP(11);
  12628.  
  12629.   DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
  12630.  
  12631.   DIPROP_INSTANCENAME     = MAKEDIPROP(13);
  12632.  
  12633.   DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
  12634.  
  12635.   DIPROP_JOYSTICKID       = MAKEDIPROP(15);
  12636.  
  12637.   DIPROP_GETPORTDISPLAYNAME       = MAKEDIPROP(16);
  12638.  
  12639.  
  12640.   DIPROP_ENABLEREPORTID       = MAKEDIPROP(17);
  12641.  
  12642.  
  12643.   DIPROP_GETPHYSICALRANGE            = MAKEDIPROP(18);
  12644.  
  12645.   DIPROP_GETLOGICALRANGE            = MAKEDIPROP(19);
  12646.  
  12647.  
  12648. type
  12649.   PDIDeviceObjectData = ^TDIDeviceObjectData;
  12650.   TDIDeviceObjectData = packed record
  12651.     dwOfs: DWORD;
  12652.     dwData: DWORD;
  12653.     dwTimeStamp: DWORD;
  12654.     dwSequence: DWORD;
  12655.   end;
  12656.  
  12657. const
  12658.   DIGDD_PEEK = $00000001;
  12659. {
  12660. #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
  12661.                          (int) ((dwSequence1) - (dwSequence2))  cmp 0
  12662. }
  12663.  
  12664.   DISCL_EXCLUSIVE  = $00000001;
  12665.   DISCL_NONEXCLUSIVE = $00000002;
  12666.   DISCL_FOREGROUND = $00000004;
  12667.   DISCL_BACKGROUND = $00000008;
  12668.   DISCL_NOWINKEY   = $00000010;
  12669.  
  12670.  
  12671. type
  12672.  
  12673.   PDIDeviceInstance_DX3A = ^TDIDeviceInstance_DX3A;
  12674.   TDIDeviceInstance_DX3A = packed record
  12675.     dwSize: DWORD;
  12676.     guidInstance: TGUID;
  12677.     guidProduct: TGUID;
  12678.     dwDevType: DWORD;
  12679.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12680.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12681.   end;
  12682.  
  12683.   PDIDeviceInstance_DX3W = ^TDIDeviceInstance_DX3W;
  12684.   TDIDeviceInstance_DX3W = packed record
  12685.     dwSize: DWORD;
  12686.     guidInstance: TGUID;
  12687.     guidProduct: TGUID;
  12688.     dwDevType: DWORD;
  12689.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12690.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12691.   end;
  12692.  
  12693.   PDIDeviceInstance_DX3 = ^TDIDeviceInstance_DX3;
  12694. {$IFDEF UNICODE}
  12695.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3W;
  12696. {$ELSE}
  12697.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3A;
  12698. {$ENDIF}
  12699.  
  12700.   PDIDeviceInstance_DX5A = ^TDIDeviceInstance_DX5A;
  12701.   TDIDeviceInstance_DX5A = packed record
  12702.     dwSize: DWORD;
  12703.     guidInstance: TGUID;
  12704.     guidProduct: TGUID;
  12705.     dwDevType: DWORD;
  12706.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12707.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12708.     guidFFDriver: TGUID;
  12709.     wUsagePage: WORD;
  12710.     wUsage: WORD;
  12711.   end;
  12712.  
  12713.   PDIDeviceInstance_DX5W = ^TDIDeviceInstance_DX5W;
  12714.   TDIDeviceInstance_DX5W = packed record
  12715.     dwSize: DWORD;
  12716.     guidInstance: TGUID;
  12717.     guidProduct: TGUID;
  12718.     dwDevType: DWORD;
  12719.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12720.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12721.     guidFFDriver: TGUID;
  12722.     wUsagePage: WORD;
  12723.     wUsage: WORD;
  12724.   end;
  12725.  
  12726.   PDIDeviceInstance_DX5 = ^TDIDeviceInstance_DX5;
  12727. {$IFDEF UNICODE}
  12728.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5W;
  12729. {$ELSE}
  12730.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5A;
  12731. {$ENDIF}
  12732.  
  12733.   PDIDeviceInstanceA = ^TDIDeviceInstanceA;
  12734.   PDIDeviceInstanceW = ^TDIDeviceInstanceW;
  12735.   PDIDeviceInstance = ^TDIDeviceInstance;
  12736. {$IFDEF DIRECTX3}
  12737.   TDIDeviceInstanceA = TDIDeviceInstance_DX3A;
  12738.   TDIDeviceInstanceW = TDIDeviceInstance_DX3W;
  12739.   TDIDeviceInstance = TDIDeviceInstance_DX3;
  12740. {$ELSE}
  12741.   TDIDeviceInstanceA = TDIDeviceInstance_DX5A;
  12742.   TDIDeviceInstanceW = TDIDeviceInstance_DX5W;
  12743.   TDIDeviceInstance = TDIDeviceInstance_DX5;
  12744. {$ENDIF}
  12745.  
  12746.   IDirectInputDeviceA = interface (IUnknown)
  12747.     ['{5944E680-C92E-11CF-BFC7-444553540000}']
  12748.     (*** IDirectInputDeviceA methods ***)
  12749.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12750.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
  12751.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12752.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12753.         HResult;  stdcall;
  12754.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader) :
  12755.         HResult;  stdcall;
  12756.     function Acquire : HResult;  stdcall;
  12757.     function Unacquire : HResult;  stdcall;
  12758.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12759.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12760.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12761.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12762.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12763.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12764.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
  12765.         dwHow: DWORD) : HResult;  stdcall;
  12766.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceA) : HResult;  stdcall;
  12767.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12768.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12769.   end;
  12770.  
  12771.   IDirectInputDeviceW = interface (IUnknown)
  12772.     ['{5944E681-C92E-11CF-BFC7-444553540000}']
  12773.     (*** IDirectInputDeviceW methods ***)
  12774.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12775.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
  12776.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12777.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12778.         HResult;  stdcall;
  12779.     function SetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12780.         HResult;  stdcall;
  12781.     function Acquire : HResult;  stdcall;
  12782.     function Unacquire : HResult;  stdcall;
  12783.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12784.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12785.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12786.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12787.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12788.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12789.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
  12790.         dwHow: DWORD) : HResult;  stdcall;
  12791.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceW) : HResult;  stdcall;
  12792.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12793.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12794.   end;
  12795.  
  12796. {$IFDEF UNICODE}
  12797.   IDirectInputDevice = IDirectInputDeviceW;
  12798. {$ELSE}
  12799.   IDirectInputDevice = IDirectInputDeviceA;
  12800. {$ENDIF}
  12801.  
  12802. const
  12803.   DISFFC_RESET            = $00000001;
  12804.   DISFFC_STOPALL          = $00000002;
  12805.   DISFFC_PAUSE            = $00000004;
  12806.   DISFFC_CONTINUE         = $00000008;
  12807.   DISFFC_SETACTUATORSON   = $00000010;
  12808.   DISFFC_SETACTUATORSOFF  = $00000020;
  12809.  
  12810.   DIGFFS_EMPTY            = $00000001;
  12811.   DIGFFS_STOPPED          = $00000002;
  12812.   DIGFFS_PAUSED           = $00000004;
  12813.   DIGFFS_ACTUATORSON      = $00000010;
  12814.   DIGFFS_ACTUATORSOFF     = $00000020;
  12815.   DIGFFS_POWERON          = $00000040;
  12816.   DIGFFS_POWEROFF         = $00000080;
  12817.   DIGFFS_SAFETYSWITCHON   = $00000100;
  12818.   DIGFFS_SAFETYSWITCHOFF  = $00000200;
  12819.   DIGFFS_USERFFSWITCHON   = $00000400;
  12820.   DIGFFS_USERFFSWITCHOFF  = $00000800;
  12821.   DIGFFS_DEVICELOST       = $80000000;
  12822.  
  12823. type
  12824.   PDIEffectInfoA = ^TDIEffectInfoA;
  12825.   TDIEffectInfoA = packed record
  12826.     dwSize : DWORD;
  12827.     guid : TGUID;
  12828.     dwEffType : DWORD;
  12829.     dwStaticParams : DWORD;
  12830.     dwDynamicParams : DWORD;
  12831.     tszName : array [0..MAX_PATH-1] of CHAR;
  12832.   end;
  12833.  
  12834.   PDIEffectInfoW = ^TDIEffectInfoW;
  12835.   TDIEffectInfoW = packed record
  12836.     dwSize : DWORD;
  12837.     guid : TGUID;
  12838.     dwEffType : DWORD;
  12839.     dwStaticParams : DWORD;
  12840.     dwDynamicParams : DWORD;
  12841.     tszName : array [0..MAX_PATH-1] of WCHAR;
  12842.   end;
  12843.  
  12844.   PDIEffectInfo = ^TDIEffectInfo;
  12845. {$IFDEF UNICODE}
  12846.   TDIEffectInfo = TDIEffectInfoW;
  12847. {$ELSE}
  12848.   TDIEffectInfo = TDIEffectInfoA;
  12849. {$ENDIF}
  12850.  
  12851. const
  12852.   DISDD_CONTINUE          = $00000001;
  12853.  
  12854.   // Bug fix & deviation from the SDK: Must return DIENUM_STOP or
  12855.   // DIENUM_CONTINUE (=1) in order to work with the debug version of DINPUT.DLL
  12856. type
  12857.   TDIEnumEffectsCallbackA =
  12858.       function(var pdei: TDIEffectInfoA; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12859.   TDIEnumEffectsCallbackW =
  12860.       function(var pdei: TDIEffectInfoW; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12861.   TDIEnumEffectsCallback =
  12862.       function(var pdei: TDIEffectInfo; pvRef: pointer) : Integer; stdcall; // BOOL; stdcall;
  12863.   TDIEnumEffectsProc = TDIEnumEffectsCallback;
  12864.  
  12865.   TDIEnumCreatedEffectObjectsCallback =
  12866.       function(peff: IDirectInputEffect; pvRev: pointer): Integer; stdcall; // BOOL; stdcall;
  12867.   TDIEnumCreatedEffectObjectsProc = TDIEnumCreatedEffectObjectsCallback;
  12868.  
  12869.   IDirectInputDevice2A = interface (IDirectInputDeviceA)
  12870.     ['{5944E682-C92E-11CF-BFC7-444553540000}']
  12871.     (*** IDirectInputDevice2A methods ***)
  12872.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12873.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12874.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackA;
  12875.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12876.     function GetEffectInfo(pdei: TDIEffectInfoA; const rguid: TGUID) : HResult;  stdcall;
  12877.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12878.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12879.     function EnumCreatedEffectObjects(lpCallback:
  12880.         TDIEnumCreatedEffectObjectsCallback;
  12881.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12882.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12883.     function Poll : HResult;  stdcall;
  12884.     function SendDeviceData
  12885.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12886.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12887.   end;
  12888.  
  12889.   IDirectInputDevice2W = interface (IDirectInputDeviceW)
  12890.     ['{5944E683-C92E-11CF-BFC7-444553540000}']
  12891.     (*** IDirectInputDevice2W methods ***)
  12892.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12893.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12894.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackW;
  12895.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12896.     function GetEffectInfo(pdei: TDIEffectInfoW; const rguid: TGUID) : HResult;  stdcall;
  12897.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12898.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12899.     function EnumCreatedEffectObjects(lpCallback:
  12900.         TDIEnumCreatedEffectObjectsCallback;
  12901.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12902.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12903.     function Poll : HResult;  stdcall;
  12904.     function SendDeviceData
  12905.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12906.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12907.   end;
  12908.  
  12909. {$IFDEF UNICODE}
  12910.   IDirectInputDevice2 = IDirectInputDevice2W;
  12911. {$ELSE}
  12912.   IDirectInputDevice2 = IDirectInputDevice2A;
  12913. {$ENDIF}
  12914.  
  12915. const
  12916.   DIFEF_DEFAULT               = $00000000;
  12917.   DIFEF_INCLUDENONSTANDARD    = $00000001;
  12918.   DIFEF_MODIFYIFNEEDED          = $00000010;
  12919.  
  12920. ///Weitermachen:  (as: nur die Deklarationen eingefüllt, die ich zum Testen gebraucht habe)
  12921.  
  12922. type
  12923.   TEnumEffectsInFileCallback = function(gaga, huhu: Integer): HResult;
  12924.  
  12925. type
  12926.   IDirectInputDevice7W = interface (IDirectInputDevice2W)
  12927.     ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
  12928.     (*** IDirectInputDevice7A methods ***)
  12929.     function EnumEffectsInFile(const lpszFileName: PChar;
  12930.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12931.     function WriteEffectToFile(const lpszFileName: PChar;
  12932.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12933.   end;
  12934.  
  12935.   IDirectInputDevice7A = interface (IDirectInputDevice2A)
  12936.     ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
  12937.     function EnumEffectsInFile(const lpszFileName: PChar;
  12938.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12939.     function WriteEffectToFile(const lpszFileName: PChar;
  12940.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12941.   end;
  12942.  
  12943. {$IFDEF UNICODE}
  12944.   IDirectInputDevice7 = IDirectInputDevice7W;
  12945. {$ELSE}
  12946.   IDirectInputDevice7 = IDirectInputDevice7A;
  12947. {$ENDIF}
  12948.  
  12949. (****************************************************************************
  12950.  *
  12951.  *      Mouse
  12952.  *
  12953.  ****************************************************************************)
  12954.  
  12955. type
  12956.   PDIMouseState = ^TDIMouseState;
  12957.   TDIMouseState = packed record
  12958.     lX: Longint;
  12959.     lY: Longint;
  12960.     lZ: Longint;
  12961.     rgbButtons: Array [0..3] of BYTE;  // up to 4 buttons
  12962.   end;
  12963.  
  12964.   PDIMouseState2 = ^TDIMouseState2;
  12965.   TDIMouseState2 = packed record
  12966.     lX: Longint;
  12967.     lY: Longint;
  12968.     lZ: Longint;
  12969.     rgbButtons: Array [0..7] of BYTE;  // up to 8 buttons
  12970.   end;
  12971.  
  12972. const
  12973.   DIMOFS_X       = 0;
  12974.   DIMOFS_Y       = 4;
  12975.   DIMOFS_Z       = 8;
  12976.   DIMOFS_BUTTON0 = 12;
  12977.   DIMOFS_BUTTON1 = 13;
  12978.   DIMOFS_BUTTON2 = 14;
  12979.   DIMOFS_BUTTON3 = 15;
  12980.   // DX7 supports up to 8 mouse buttons
  12981.   DIMOFS_BUTTON4 = DIMOFS_BUTTON0+4;
  12982.   DIMOFS_BUTTON5 = DIMOFS_BUTTON0+5;
  12983.   DIMOFS_BUTTON6 = DIMOFS_BUTTON0+6;