Direct3D.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:214k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. {******************************************************************************}
  2. {*                                                                            *}
  3. {*  Copyright (C) Microsoft Corporation.  All Rights Reserved.                *}
  4. {*                                                                            *}
  5. {*  Files:      d3dtypes.h d3dcaps.h d3d.h                                    *}
  6. {*  Content:    Direct3D8 include files                                       *}
  7. {*                                                                            *}
  8. {*  DirectX 9.0 Delphi adaptation by Alexey Barkovoy                          *}
  9. {*  E-Mail: clootie@reactor.ru                                                *}
  10. {*                                                                            *}
  11. {*  Modified: 26-Jan-2003                                                     *}
  12. {*                                                                            *}
  13. {*  Partly based upon :                                                       *}
  14. {*    DirectX 7.0 Object Pascal adaptation by                                 *}
  15. {*      Erik Unger, e-Mail: DelphiDirectX@next-reality.com                    *}
  16. {*                                                                            *}
  17. {*  Latest version can be downloaded from:                                    *}
  18. {*     http://clootie.narod.ru/delphi/                                        *}
  19. {*                                                                            *}
  20. {******************************************************************************}
  21. {                                                                              }
  22. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  23. {                                                                              }
  24. { The contents of this file are used with permission, subject to the Mozilla   }
  25. { Public License Version 1.1 (the "License"); you may not use this file except }
  26. { in compliance with the License. You may obtain a copy of the License at      }
  27. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  28. {                                                                              }
  29. { Software distributed under the License is distributed on an "AS IS" basis,   }
  30. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  31. { the specific language governing rights and limitations under the License.    }
  32. {                                                                              }
  33. { Alternatively, the contents of this file may be used under the terms of the  }
  34. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  35. { provisions of the LGPL License are applicable instead of those above.        }
  36. { If you wish to allow use of your version of this file only under the terms   }
  37. { of the LGPL License and not to allow others to use your version of this file }
  38. { under the MPL, indicate your decision by deleting  the provisions above and  }
  39. { replace  them with the notice and other provisions required by the LGPL      }
  40. { License.  If you do not delete the provisions above, a recipient may use     }
  41. { your version of this file under either the MPL or the LGPL License.          }
  42. {                                                                              }
  43. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  44. {                                                                              }
  45. {******************************************************************************}
  46. ///////////////////////////////////////////////////////////////////////////////
  47. // Notes:
  48. //----------------------------------------------------------------------------
  49. // Possible input defines for this file, mapped to original C values:
  50. //   DIRECT3D_VERSION_8 : DIRECT3D_VERSION = 0x0800,
  51. //   DIRECT3D_VERSION_7 : DIRECT3D_VERSION = 0x0700,
  52. //   DIRECT3D_VERSION_6 : DIRECT3D_VERSION = 0x0600,
  53. //   DIRECT3D_VERSION_5 : DIRECT3D_VERSION = 0x0500,
  54. //   DIRECT3D_VERSION_LESS_5 : DIRECT3D_VERSION < 0x0500,
  55. //
  56. // By default DIRECT3D_VERSION_7 (DIRECT3D_VERSION = 0x0700) is assumed
  57. ///////////////////////////////////////////////////////////////////////////////
  58. unit Direct3D;
  59. {$I DirectX.inc}
  60. // Remove "dots" below to exclude DXFile interfaces - these interfaces
  61. // are included for compatibility with original Erik Unger translation
  62. {$DEFINE EXCLUDE_DXFILE_FROM_DIRECT3D}
  63. // Assume for what Direct3D version we will compile headers
  64. {$IFNDEF DIRECT3D_VERSION_8}
  65.   {$IFNDEF DIRECT3D_VERSION_7}
  66.     {$IFNDEF DIRECT3D_VERSION_6}
  67.       {$IFNDEF DIRECT3D_VERSION_5}
  68.         {$IFNDEF DIRECT3D_VERSION_LESS_5}
  69.           {$DEFINE DIRECT3D_VERSION_7} // Compiling for Direct3D7 by default
  70.         {$ENDIF}
  71.       {$ENDIF}
  72.     {$ENDIF}
  73.   {$ENDIF}
  74. {$ENDIF}
  75. // Emit conditionals to C++Builder compiler
  76. {$IFDEF DIRECT3D_VERSION_8}
  77.   {$HPPEMIT '#define DIRECT3D_VERSION         0x0800'}
  78. {$ENDIF}
  79. {$IFDEF DIRECT3D_VERSION_7}
  80.   {$HPPEMIT '#define DIRECT3D_VERSION         0x0700'}
  81. {$ENDIF}
  82. {$IFDEF DIRECT3D_VERSION_6}
  83.   {$HPPEMIT '#define DIRECT3D_VERSION         0x0600'}
  84. {$ENDIF}
  85. {$IFDEF DIRECT3D_VERSION_5}
  86.   {$HPPEMIT '#define DIRECT3D_VERSION         0x0500'}
  87. {$ENDIF}
  88. {$IFDEF DIRECT3D_VERSION_LESS_5}
  89.   {$HPPEMIT '#define DIRECT3D_VERSION         0x0300'}
  90. {$ENDIF}
  91. // Define symbols for '>=' comparision
  92. {$IFDEF DIRECT3D_VERSION_8}
  93.   {$DEFINE DIRECT3D_VERSION_7}
  94. {$ENDIF}
  95. {$IFDEF DIRECT3D_VERSION_7}
  96.   {$DEFINE DIRECT3D_VERSION_6}
  97. {$ENDIF}
  98. {$IFDEF DIRECT3D_VERSION_6}
  99.   {$DEFINE DIRECT3D_VERSION_5}
  100. {$ENDIF}
  101. // Define symbols for '<' comparision
  102. {$IFNDEF DIRECT3D_VERSION_8}
  103.   {$DEFINE DIRECT3D_VERSION_LESS_8}
  104. {$ENDIF}
  105. {$IFNDEF DIRECT3D_VERSION_7}
  106.   {$DEFINE DIRECT3D_VERSION_LESS_7}
  107. {$ENDIF}
  108. {$IFNDEF DIRECT3D_VERSION_6}
  109.   {$DEFINE DIRECT3D_VERSION_LESS_6}
  110. {$ENDIF}
  111. {$IFNDEF DIRECT3D_VERSION_5}
  112.   {$DEFINE DIRECT3D_VERSION_LESS_5}
  113. {$ENDIF}
  114. interface
  115. uses
  116.   Windows, DXTypes, DirectDraw{$IFDEF DIRECT3D_VERSION_8}, Direct3D8{$ENDIF};
  117. {$NOINCLUDE Windows}
  118. {$NOINCLUDE DXTypes}
  119. {$NOINCLUDE DirectDraw}
  120. {$IFDEF DIRECT3D_VERSION_8}
  121.   {$NOINCLUDE Direct3D8}
  122. {$ENDIF}
  123. {$HPPEMIT '#include "d3d.h"'}
  124. {$HPPEMIT '#include "d3dtypes.h"'}
  125. {$HPPEMIT '#include "d3dcaps.h"'}
  126. (* TD3DValue is the fundamental Direct3D fractional data type *)
  127. type
  128.   TRefClsID = TGUID;
  129. type
  130.   D3DVALUE = DXTypes.D3DVALUE;
  131.   {$EXTERNALSYM D3DVALUE}
  132.   TD3DValue = DXTypes.TD3DValue;
  133.   {$NODEFINE TD3DValue}
  134.   PD3DValue = DXTypes.PD3DValue;
  135.   {$NODEFINE PD3DValue}
  136.   D3DFIXED = Longint;
  137.   {$EXTERNALSYM D3DFIXED}
  138.   TD3DFixed = D3DFIXED;
  139.   float = TD3DValue;
  140.   {$EXTERNALSYM float}
  141.   D3DCOLOR = DXTypes.D3DCOLOR;
  142.   {$EXTERNALSYM D3DCOLOR}
  143.   TD3DColor = DXTypes.TD3DColor;
  144.   {$NODEFINE TD3DColor}
  145.   PD3DColor = DXTypes.PD3DColor;
  146.   {$NODEFINE PD3DColor}
  147. function D3DVal(val: Variant): Single;
  148. {$EXTERNALSYM D3DVal}
  149. function D3DDivide(a, b: Double): Single;
  150. {$EXTERNALSYM D3DDivide}
  151. function D3DMultiply(a, b: Double): Single;
  152. {$EXTERNALSYM D3DMultiply}
  153. (*
  154.  * Format of CI colors is
  155.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  156.  *  |    alpha      |         color index           |   fraction    |
  157.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  158.  *)
  159. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  160. function CI_GETALPHA(ci: DWORD): DWORD;
  161. {$EXTERNALSYM CI_GETALPHA}
  162. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  163. function CI_GETINDEX(ci: DWORD): DWORD;
  164. {$EXTERNALSYM CI_GETINDEX}
  165. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  166. function CI_GETFRACTION(ci: DWORD): DWORD;
  167. {$EXTERNALSYM CI_GETFRACTION}
  168. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  169. function CI_ROUNDINDEX(ci: DWORD): DWORD;
  170. {$EXTERNALSYM CI_ROUNDINDEX}
  171. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  172. function CI_MASKALPHA(ci: DWORD): DWORD;
  173. {$EXTERNALSYM CI_MASKALPHA}
  174. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  175. function CI_MAKE(a,i,f: DWORD): DWORD;
  176. {$EXTERNALSYM CI_MAKE}
  177. (*
  178.  * Format of RGBA colors is
  179.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  180.  *  |    alpha      |      red      |     green     |     blue      |
  181.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  182.  *)
  183. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  184. function RGBA_GETALPHA(rgb: TD3DColor): DWORD;
  185. {$EXTERNALSYM RGBA_GETALPHA}
  186. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  187. function RGBA_GETRED(rgb: TD3DColor): DWORD;
  188. {$EXTERNALSYM RGBA_GETRED}
  189. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  190. function RGBA_GETGREEN(rgb: TD3DColor): DWORD;
  191. {$EXTERNALSYM RGBA_GETGREEN}
  192. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  193. function RGBA_GETBLUE(rgb: TD3DColor): DWORD;
  194. {$EXTERNALSYM RGBA_GETBLUE}
  195. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  196. function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor;
  197. {$EXTERNALSYM RGBA_MAKE}
  198. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  199.  * The float values must be in the range 0..1
  200.  *)
  201. // #define D3DRGB(r, g, b) 
  202. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  203. function D3DRGB(r, g, b: Single): TD3DColor;
  204. {$EXTERNALSYM D3DRGB}
  205. // #define D3DRGBA(r, g, b, a) 
  206. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) 
  207. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) 
  208. //    )
  209. function D3DRGBA(r, g, b, a: Single): TD3DColor;
  210. {$EXTERNALSYM D3DRGBA}
  211. (*
  212.  * Format of RGB colors is
  213.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  214.  *  |    ignored    |      red      |     green     |     blue      |
  215.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  216.  *)
  217. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  218. function RGB_GETRED(rgb: TD3DColor): DWORD;
  219. {$EXTERNALSYM RGB_GETRED}
  220. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  221. function RGB_GETGREEN(rgb: TD3DColor): DWORD;
  222. {$EXTERNALSYM RGB_GETGREEN}
  223. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  224. function RGB_GETBLUE(rgb: TD3DColor): DWORD;
  225. {$EXTERNALSYM RGB_GETBLUE}
  226. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  227. function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD): TD3DColor;
  228. {$EXTERNALSYM RGBA_SETALPHA}
  229. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  230. function RGB_MAKE(r, g, b: DWORD): TD3DColor;
  231. {$EXTERNALSYM RGB_MAKE}
  232. // #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
  233. function RGBA_TORGB(rgba: TD3DColor): TD3DColor;
  234. {$EXTERNALSYM RGBA_TORGB}
  235. // #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
  236. function RGB_TORGBA(rgb: TD3DColor): TD3DColor;
  237. {$EXTERNALSYM RGB_TORGBA}
  238. (*
  239.  * Flags for Enumerate functions
  240.  *)
  241. const
  242. (*
  243.  * Stop the enumeration
  244.  *)
  245.   D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
  246.   {$EXTERNALSYM D3DENUMRET_CANCEL}
  247. (*
  248.  * Continue the enumeration
  249.  *)
  250.   D3DENUMRET_OK                            = DDENUMRET_OK;
  251.   {$EXTERNALSYM D3DENUMRET_OK}
  252. type
  253.   TD3DValidateCallback = function (lpUserArg: Pointer;
  254.       dwOffset: DWORD): HResult; stdcall;
  255.   {$NODEFINE TD3DValidateCallback}
  256.   {$HPPEMIT 'typedef LPD3DVALIDATECALLBACK TD3DValidateCallback;'}
  257.   TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
  258.       lpContext: Pointer): HResult; stdcall;
  259.   {$NODEFINE TD3DEnumTextureFormatsCallback}
  260.   {$HPPEMIT 'typedef LPD3DENUMTEXTUREFORMATSCALLBACK TD3DEnumTextureFormatsCallback;'}
  261.   TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
  262.       lpContext: Pointer): HResult; stdcall;
  263.   {$NODEFINE TD3DEnumPixelFormatsCallback}
  264.   {$HPPEMIT 'typedef LPD3DENUMPIXELFORMATSCALLBACK TD3DEnumPixelFormatsCallback;'}
  265.   PD3DMaterialHandle = ^TD3DMaterialHandle;
  266.   TD3DMaterialHandle = DWORD;
  267.   PD3DTextureHandle = ^TD3DTextureHandle;
  268.   TD3DTextureHandle = DWORD;
  269.   PD3DMatrixHandle = ^TD3DMatrixHandle;
  270.   TD3DMatrixHandle = DWORD;
  271.   PD3DColorValue = ^TD3DColorValue;
  272.   _D3DCOLORVALUE = packed record
  273.     case Integer of
  274.     0: (
  275.       r: TD3DValue;
  276.       g: TD3DValue;
  277.       b: TD3DValue;
  278.       a: TD3DValue;
  279.      );
  280.     1: (
  281.       dvR: TD3DValue;
  282.       dvG: TD3DValue;
  283.       dvB: TD3DValue;
  284.       dvA: TD3DValue;
  285.      );
  286.   end {_D3DCOLORVALUE};
  287.   {$EXTERNALSYM _D3DCOLORVALUE}
  288.   D3DCOLORVALUE = _D3DCOLORVALUE;
  289.   {$EXTERNALSYM D3DCOLORVALUE}
  290.   TD3DColorValue = _D3DCOLORVALUE;
  291.   PD3DRect = ^TD3DRect;
  292.   _D3DRECT = packed record
  293.     case Integer of
  294.     0: (
  295.       x1: LongInt;
  296.       y1: LongInt;
  297.       x2: LongInt;
  298.       y2: LongInt;
  299.      );
  300.     1: (
  301.       lX1: LongInt;
  302.       lY1: LongInt;
  303.       lX2: LongInt;
  304.       lY2: LongInt;
  305.      );
  306.      2: (
  307.        a: array[0..3] of LongInt;
  308.      );
  309.   end {_D3DRECT};
  310.   {$EXTERNALSYM _D3DRECT}
  311.   D3DRECT = _D3DRECT;
  312.   {$EXTERNALSYM D3DRECT}
  313.   TD3DRect = _D3DRECT;
  314.   PD3DVector = ^TD3DVector;
  315.   _D3DVECTOR = packed record
  316.     case Integer of
  317.     0: (
  318.       x: TD3DValue;
  319.       y: TD3DValue;
  320.       z: TD3DValue;
  321.      );
  322.     1: (
  323.       dvX: TD3DValue;
  324.       dvY: TD3DValue;
  325.       dvZ: TD3DValue;
  326.      );
  327.   end {_D3DVECTOR};
  328.   {$EXTERNALSYM _D3DVECTOR}
  329.   D3DVECTOR = _D3DVECTOR;
  330.   {$EXTERNALSYM D3DVECTOR}
  331.   TD3DVector = _D3DVECTOR;
  332. {$HPPEMIT ''}
  333. {$HPPEMIT '#ifndef DX_SHARED_DEFINES_BCB'}
  334. {$HPPEMIT ''}
  335. {$HPPEMIT 'typedef D3DVALUE TD3DValue;'}
  336. {$HPPEMIT 'typedef D3DVALUE *PD3DValue;'}
  337. {$HPPEMIT ''}
  338. {$HPPEMIT '#ifndef D3DCOLOR_DEFINED_BCB'}
  339. {$HPPEMIT 'typedef D3DCOLOR TD3DColor;'}
  340. {$HPPEMIT 'typedef D3DCOLOR *PD3DColor;'}
  341. {$HPPEMIT '#define D3DCOLOR_DEFINED_BCB'}
  342. {$HPPEMIT '#endif'}
  343. {$HPPEMIT ''}
  344. {$HPPEMIT '#define D3DVECTOR_DEFINED_BCB'}
  345. {$HPPEMIT ''}
  346. {$HPPEMIT '#define DX_SHARED_DEFINES_BCB'}
  347. {$HPPEMIT '#endif // DX_SHARED_DEFINES_BCB'}
  348. {$HPPEMIT ''}
  349. (******************************************************************
  350.  *                                                                *
  351.  *   D3DVec.inl                                                   *
  352.  *                                                                *
  353.  *   float-valued 3D vector class for Direct3D.                   *
  354.  *                                                                *
  355.  *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
  356.  *                                                                *
  357.  ******************************************************************)
  358.     // Addition and subtraction
  359.   function VectorAdd(const v1, v2: TD3DVector): TD3DVector;
  360.   function VectorSub(const v1, v2: TD3DVector): TD3DVector;
  361.     // Scalar multiplication and division
  362.   function VectorMulS(const v: TD3DVector; s: TD3DValue): TD3DVector;
  363.   function VectorDivS(const v: TD3DVector; s: TD3DValue): TD3DVector;
  364.     // Memberwise multiplication and division
  365.   function VectorMul(const v1, v2: TD3DVector): TD3DVector;
  366.   function VectorDiv(const v1, v2: TD3DVector): TD3DVector;
  367.     // Vector dominance
  368.   function VectorSmaller(v1, v2: TD3DVector): Boolean;
  369.   function VectorSmallerEqual(v1, v2: TD3DVector): Boolean;
  370.     // Bitwise equality
  371.   function VectorEqual(v1, v2: TD3DVector): Boolean;
  372.     // Length-related functions
  373.   function VectorSquareMagnitude(v: TD3DVector): TD3DValue;
  374.   function VectorMagnitude(v: TD3DVector): TD3DValue;
  375.     // Returns vector with same direction and unit length
  376.   function VectorNormalize(const v: TD3DVector): TD3DVector;
  377.     // Return min/max component of the input vector
  378.   function VectorMin(v: TD3DVector): TD3DValue;
  379.   function VectorMax(v: TD3DVector): TD3DValue;
  380.     // Return memberwise min/max of input vectors
  381.   function VectorMinimize(const v1, v2: TD3DVector): TD3DVector;
  382.   function VectorMaximize(const v1, v2: TD3DVector): TD3DVector;
  383.     // Dot and cross product
  384.   function VectorDotProduct(v1, v2: TD3DVector): TD3DValue;
  385.   function VectorCrossProduct(const v1, v2: TD3DVector): TD3DVector;
  386. type
  387. (*
  388.  * Vertex data types supported in an ExecuteBuffer.
  389.  *)
  390. (*
  391.  * Homogeneous vertices
  392.  *)
  393.   PD3DHVertex = ^TD3DHVertex;
  394.   _D3DHVERTEX = packed record
  395.     dwFlags: DWORD;        (* Homogeneous clipping flags *)
  396.     case Integer of
  397.     0: (
  398.       hx: TD3DValue;
  399.       hy: TD3DValue;
  400.       hz: TD3DValue;
  401.      );
  402.     1: (
  403.       dvHX: TD3DValue;
  404.       dvHY: TD3DValue;
  405.       dvHZ: TD3DValue;
  406.      );
  407.   end;
  408.   {$EXTERNALSYM _D3DHVERTEX}
  409.   D3DHVERTEX = _D3DHVERTEX;
  410.   {$EXTERNALSYM D3DHVERTEX}
  411.   TD3DHVertex = _D3DHVERTEX;
  412. (*
  413.  * Transformed/lit vertices
  414.  *)
  415.   PD3DTLVertex = ^TD3DTLVertex;
  416.   _D3DTLVERTEX = packed record
  417.     case Integer of
  418.     0: (
  419.       sx: TD3DValue;             (* Screen coordinates *)
  420.       sy: TD3DValue;
  421.       sz: TD3DValue;
  422.       rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
  423.       color: TD3DColor;          (* Vertex color *)
  424.       specular: TD3DColor;       (* Specular component of vertex *)
  425.       tu: TD3DValue;             (* Texture coordinates *)
  426.       tv: TD3DValue;
  427.      );
  428.     1: (
  429.       dvSX: TD3DValue;
  430.       dvSY: TD3DValue;
  431.       dvSZ: TD3DValue;
  432.       dvRHW: TD3DValue;
  433.       dcColor: TD3DColor;
  434.       dcSpecular: TD3DColor;
  435.       dvTU: TD3DValue;
  436.       dvTV: TD3DValue;
  437.      );
  438.   end;
  439.   {$EXTERNALSYM _D3DTLVERTEX}
  440.   D3DTLVERTEX = _D3DTLVERTEX;
  441.   {$EXTERNALSYM D3DTLVERTEX}
  442.   TD3DTLVertex = _D3DTLVERTEX;
  443. (*
  444.  * Untransformed/lit vertices
  445.  *)
  446.   PD3DLVertex = ^TD3DLVertex;
  447.   _D3DLVERTEX = packed record
  448.     case Integer of
  449.     0: (
  450.       x: TD3DValue;             (* Homogeneous coordinates *)
  451.       y: TD3DValue;
  452.       z: TD3DValue;
  453.       dwReserved: DWORD;
  454.       color: TD3DColor;         (* Vertex color *)
  455.       specular: TD3DColor;      (* Specular component of vertex *)
  456.       tu: TD3DValue;            (* Texture coordinates *)
  457.       tv: TD3DValue;
  458.      );
  459.     1: (
  460.       dvX: TD3DValue;
  461.       dvY: TD3DValue;
  462.       dvZ: TD3DValue;
  463.       UNIONFILLER1d: DWORD;
  464.       dcColor: TD3DColor;
  465.       dcSpecular: TD3DColor;
  466.       dvTU: TD3DValue;
  467.       dvTV: TD3DValue;
  468.      );
  469.   end;
  470.   {$EXTERNALSYM _D3DLVERTEX}
  471.   D3DLVERTEX = _D3DLVERTEX;
  472.   {$EXTERNALSYM D3DLVERTEX}
  473.   TD3DLVertex = _D3DLVERTEX;
  474. (*
  475.  * Untransformed/unlit vertices
  476.  *)
  477.   PD3DVertex = ^TD3DVertex;
  478.   _D3DVERTEX = packed record
  479.     case Integer of
  480.     0: (
  481.       x: TD3DValue;             (* Homogeneous coordinates *)
  482.       y: TD3DValue;
  483.       z: TD3DValue;
  484.       nx: TD3DValue;            (* Normal *)
  485.       ny: TD3DValue;
  486.       nz: TD3DValue;
  487.       tu: TD3DValue;            (* Texture coordinates *)
  488.       tv: TD3DValue;
  489.      );
  490.     1: (
  491.       dvX: TD3DValue;
  492.       dvY: TD3DValue;
  493.       dvZ: TD3DValue;
  494.       dvNX: TD3DValue;
  495.       dvNY: TD3DValue;
  496.       dvNZ: TD3DValue;
  497.       dvTU: TD3DValue;
  498.       dvTV: TD3DValue;
  499.      );
  500.   end;
  501.   {$EXTERNALSYM _D3DVERTEX}
  502.   D3DVERTEX = _D3DVERTEX;
  503.   {$EXTERNALSYM D3DVERTEX}
  504.   TD3DVertex = _D3DVERTEX;
  505. (*
  506.  * Matrix, viewport, and tranformation structures and definitions.
  507.  *)
  508.   PD3DMatrix = ^TD3DMatrix;
  509.   _D3DMATRIX = packed record
  510.     case integer of
  511.       0 : (_11, _12, _13, _14: TD3DValue;
  512.            _21, _22, _23, _24: TD3DValue;
  513.            _31, _32, _33, _34: TD3DValue;
  514.            _41, _42, _43, _44: TD3DValue);
  515.       1 : (m : array [0..3, 0..3] of TD3DValue);
  516.   end {_D3DMATRIX};
  517.   {$EXTERNALSYM _D3DMATRIX}
  518.   D3DMATRIX = _D3DMATRIX;
  519.   {$EXTERNALSYM D3DMATRIX}
  520.   TD3DMatrix = _D3DMATRIX;
  521.   PD3DViewport = ^TD3DViewport;
  522.   _D3DVIEWPORT = packed record
  523.     dwSize: DWORD;
  524.     dwX: DWORD;
  525.     dwY: DWORD;                (* Top left *)
  526.     dwWidth: DWORD;
  527.     dwHeight: DWORD;           (* Dimensions *)
  528.     dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
  529.     dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
  530.     dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
  531.     dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
  532.     dvMinZ: TD3DValue;
  533.     dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
  534.   end {_D3DVIEWPORT};
  535.   {$EXTERNALSYM _D3DVIEWPORT}
  536.   D3DVIEWPORT = _D3DVIEWPORT;
  537.   {$EXTERNALSYM D3DVIEWPORT}
  538.   TD3DViewport = _D3DVIEWPORT;
  539. {$IFDEF DIRECT3D_VERSION_5}
  540.   PD3DViewport2 = ^TD3DViewport2;
  541.   _D3DVIEWPORT2 = packed record
  542.     dwSize: DWORD;
  543.     dwX: DWORD;
  544.     dwY: DWORD;                (* Viewport Top left *)
  545.     dwWidth: DWORD;
  546.     dwHeight: DWORD;           (* Viewport Dimensions *)
  547.     dvClipX: TD3DValue;        (* Top left of clip volume *)
  548.     dvClipY: TD3DValue;
  549.     dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
  550.     dvClipHeight: TD3DValue;
  551.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  552.     dvMaxZ: TD3DValue;
  553.   end;
  554.   {$EXTERNALSYM _D3DVIEWPORT2}
  555.   D3DVIEWPORT2 = _D3DVIEWPORT2;
  556.   {$EXTERNALSYM D3DVIEWPORT2}
  557.   TD3DViewport2 = _D3DVIEWPORT2;
  558. {$ENDIF} // DIRECT3D_VERSION_5
  559. {$IFDEF DIRECT3D_VERSION_7}
  560.   PD3DViewport7 = ^TD3DViewport7;
  561.   _D3DVIEWPORT7 = packed record
  562.     dwX: DWORD;
  563.     dwY: DWORD;                (* Viewport Top left *)
  564.     dwWidth: DWORD;
  565.     dwHeight: DWORD;           (* Viewport Dimensions *)
  566.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  567.     dvMaxZ: TD3DValue;
  568.   end;
  569.   {$EXTERNALSYM _D3DVIEWPORT7}
  570.   D3DVIEWPORT7 = _D3DVIEWPORT7;
  571.   {$EXTERNALSYM D3DVIEWPORT7}
  572.   TD3DViewport7 = _D3DVIEWPORT7;
  573. {$ENDIF} // DIRECT3D_VERSION_7
  574. (*
  575.  * Values for clip fields.
  576.  *)
  577. {$IFDEF DIRECT3D_VERSION_7}
  578. const
  579. // Max number of user clipping planes, supported in D3D.
  580.   D3DMAXUSERCLIPPLANES  = 32;
  581.   {$EXTERNALSYM D3DMAXUSERCLIPPLANES}
  582. // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
  583. //
  584.   D3DCLIPPLANE0 = (1 shl 0);
  585.   {$EXTERNALSYM D3DCLIPPLANE0}
  586.   D3DCLIPPLANE1 = (1 shl 1);
  587.   {$EXTERNALSYM D3DCLIPPLANE1}
  588.   D3DCLIPPLANE2 = (1 shl 2);
  589.   {$EXTERNALSYM D3DCLIPPLANE2}
  590.   D3DCLIPPLANE3 = (1 shl 3);
  591.   {$EXTERNALSYM D3DCLIPPLANE3}
  592.   D3DCLIPPLANE4 = (1 shl 4);
  593.   {$EXTERNALSYM D3DCLIPPLANE4}
  594.   D3DCLIPPLANE5 = (1 shl 5);
  595.   {$EXTERNALSYM D3DCLIPPLANE5}
  596. {$ENDIF} // DIRECT3D_VERSION_7
  597. const
  598.   D3DCLIP_LEFT                            = $00000001;
  599.   {$EXTERNALSYM D3DCLIP_LEFT}
  600.   D3DCLIP_RIGHT                           = $00000002;
  601.   {$EXTERNALSYM D3DCLIP_RIGHT}
  602.   D3DCLIP_TOP                             = $00000004;
  603.   {$EXTERNALSYM D3DCLIP_TOP}
  604.   D3DCLIP_BOTTOM                          = $00000008;
  605.   {$EXTERNALSYM D3DCLIP_BOTTOM}
  606.   D3DCLIP_FRONT                           = $00000010;
  607.   {$EXTERNALSYM D3DCLIP_FRONT}
  608.   D3DCLIP_BACK                            = $00000020;
  609.   {$EXTERNALSYM D3DCLIP_BACK}
  610.   D3DCLIP_GEN0                            = $00000040;
  611.   {$EXTERNALSYM D3DCLIP_GEN0}
  612.   D3DCLIP_GEN1                            = $00000080;
  613.   {$EXTERNALSYM D3DCLIP_GEN1}
  614.   D3DCLIP_GEN2                            = $00000100;
  615.   {$EXTERNALSYM D3DCLIP_GEN2}
  616.   D3DCLIP_GEN3                            = $00000200;
  617.   {$EXTERNALSYM D3DCLIP_GEN3}
  618.   D3DCLIP_GEN4                            = $00000400;
  619.   {$EXTERNALSYM D3DCLIP_GEN4}
  620.   D3DCLIP_GEN5                            = $00000800;
  621.   {$EXTERNALSYM D3DCLIP_GEN5}
  622. (*
  623.  * Values for d3d status.
  624.  *)
  625.   D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
  626.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONLEFT}
  627.   D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
  628.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONRIGHT}
  629.   D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
  630.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONTOP}
  631.   D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
  632.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONBOTTOM}
  633.   D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
  634.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONFRONT}
  635.   D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
  636.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONBACK}
  637.   D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
  638.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN0}
  639.   D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
  640.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN1}
  641.   D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
  642.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN2}
  643.   D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
  644.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN3}
  645.   D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
  646.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN4}
  647.   D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
  648.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN5}
  649.   D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
  650.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONLEFT}
  651.   D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
  652.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONRIGHT}
  653.   D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
  654.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONTOP}
  655.   D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
  656.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONBOTTOM}
  657.   D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
  658.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONFRONT}
  659.   D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
  660.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONBACK}
  661.   D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
  662.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN0}
  663.   D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
  664.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN1}
  665.   D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
  666.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN2}
  667.   D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
  668.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN3}
  669.   D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
  670.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN4}
  671.   D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
  672.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN5}
  673.   D3DSTATUS_ZNOTVISIBLE                   = $01000000;
  674.   {$EXTERNALSYM D3DSTATUS_ZNOTVISIBLE}
  675. (* Do not use 0x80000000 for any status flags in future as it is reserved *)
  676.   D3DSTATUS_CLIPUNIONALL = (
  677.             D3DSTATUS_CLIPUNIONLEFT or
  678.             D3DSTATUS_CLIPUNIONRIGHT or
  679.             D3DSTATUS_CLIPUNIONTOP or
  680.             D3DSTATUS_CLIPUNIONBOTTOM or
  681.             D3DSTATUS_CLIPUNIONFRONT or
  682.             D3DSTATUS_CLIPUNIONBACK or
  683.             D3DSTATUS_CLIPUNIONGEN0 or
  684.             D3DSTATUS_CLIPUNIONGEN1 or
  685.             D3DSTATUS_CLIPUNIONGEN2 or
  686.             D3DSTATUS_CLIPUNIONGEN3 or
  687.             D3DSTATUS_CLIPUNIONGEN4 or
  688.             D3DSTATUS_CLIPUNIONGEN5);
  689.   {$EXTERNALSYM D3DSTATUS_CLIPUNIONALL}
  690.   D3DSTATUS_CLIPINTERSECTIONALL = (
  691.             D3DSTATUS_CLIPINTERSECTIONLEFT or
  692.             D3DSTATUS_CLIPINTERSECTIONRIGHT or
  693.             D3DSTATUS_CLIPINTERSECTIONTOP or
  694.             D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  695.             D3DSTATUS_CLIPINTERSECTIONFRONT or
  696.             D3DSTATUS_CLIPINTERSECTIONBACK or
  697.             D3DSTATUS_CLIPINTERSECTIONGEN0 or
  698.             D3DSTATUS_CLIPINTERSECTIONGEN1 or
  699.             D3DSTATUS_CLIPINTERSECTIONGEN2 or
  700.             D3DSTATUS_CLIPINTERSECTIONGEN3 or
  701.             D3DSTATUS_CLIPINTERSECTIONGEN4 or
  702.             D3DSTATUS_CLIPINTERSECTIONGEN5);
  703.   {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONALL}
  704.   D3DSTATUS_DEFAULT = (
  705.             D3DSTATUS_CLIPINTERSECTIONALL or
  706.             D3DSTATUS_ZNOTVISIBLE);
  707.   {$EXTERNALSYM D3DSTATUS_DEFAULT}
  708. (*
  709.  * Options for direct transform calls
  710.  *)
  711.   D3DTRANSFORM_CLIPPED       = $00000001;
  712.   {$EXTERNALSYM D3DTRANSFORM_CLIPPED}
  713.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  714.   {$EXTERNALSYM D3DTRANSFORM_UNCLIPPED}
  715. type
  716.   PD3DTransformData = ^TD3DTransformData;
  717.   _D3DTRANSFORMDATA = packed record
  718.     dwSize: DWORD;
  719.     lpIn: Pointer;             (* Input vertices *)
  720.     dwInSize: DWORD;           (* Stride of input vertices *)
  721.     lpOut: Pointer;            (* Output vertices *)
  722.     dwOutSize: DWORD;          (* Stride of output vertices *)
  723.     lpHOut: ^TD3DHVertex;      (* Output homogeneous vertices *)
  724.     dwClip: DWORD;             (* Clipping hint *)
  725.     dwClipIntersection: DWORD;
  726.     dwClipUnion: DWORD;        (* Union of all clip flags *)
  727.     drExtent: TD3DRect;        (* Extent of transformed vertices *)
  728.   end;
  729.   {$EXTERNALSYM _D3DTRANSFORMDATA}
  730.   D3DTRANSFORMDATA = _D3DTRANSFORMDATA;
  731.   {$EXTERNALSYM D3DTRANSFORMDATA}
  732.   TD3DTransformData = _D3DTRANSFORMDATA;
  733. (*
  734.  * Structure defining position and direction properties for lighting.
  735.  *)
  736.   PD3DLightingElement = ^TD3DLightingElement;
  737.   _D3DLIGHTINGELEMENT = packed record
  738.     dvPosition: TD3DVector;           (* Lightable point in model space *)
  739.     dvNormal: TD3DVector;             (* Normalised unit vector *)
  740.   end;
  741.   {$EXTERNALSYM _D3DLIGHTINGELEMENT}
  742.   D3DLIGHTINGELEMENT = _D3DLIGHTINGELEMENT;
  743.   {$EXTERNALSYM D3DLIGHTINGELEMENT}
  744.   TD3DLightingElement = _D3DLIGHTINGELEMENT;
  745. (*
  746.  * Structure defining material properties for lighting.
  747.  *)
  748.   PD3DMaterial = ^TD3DMaterial;
  749.   _D3DMATERIAL = packed record
  750.     dwSize: DWORD;
  751.     case Integer of
  752.     0: (
  753.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  754.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  755.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  756.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  757.       power: TD3DValue;               (* Sharpness if specular highlight *)
  758.       hTexture: TD3DTextureHandle;    (* Handle to texture map *)
  759.       dwRampSize: DWORD;
  760.      );
  761.     1: (
  762.       dcvDiffuse: TD3DColorValue;
  763.       dcvAmbient: TD3DColorValue;
  764.       dcvSpecular: TD3DColorValue;
  765.       dcvEmissive: TD3DColorValue;
  766.       dvPower: TD3DValue;
  767.      );
  768.   end;
  769.   {$EXTERNALSYM _D3DMATERIAL}
  770.   D3DMATERIAL = _D3DMATERIAL;
  771.   {$EXTERNALSYM D3DMATERIAL}
  772.   TD3DMaterial = _D3DMATERIAL;
  773. {$IFDEF DIRECT3D_VERSION_7}
  774.   PD3DMaterial7 = ^TD3DMaterial7;
  775.   _D3DMATERIAL7 = packed record
  776.     case Integer of
  777.     0: (
  778.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  779.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  780.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  781.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  782.       power: TD3DValue;               (* Sharpness if specular highlight *)
  783.      );
  784.     1: (
  785.       dcvDiffuse: TD3DColorValue;
  786.       dcvAmbient: TD3DColorValue;
  787.       dcvSpecular: TD3DColorValue;
  788.       dcvEmissive: TD3DColorValue;
  789.       dvPower: TD3DValue;
  790.      );
  791.   end;
  792.   {$EXTERNALSYM _D3DMATERIAL7}
  793.   D3DMATERIAL7 = _D3DMATERIAL7;
  794.   {$EXTERNALSYM D3DMATERIAL7}
  795.   TD3DMaterial7 = _D3DMATERIAL7;
  796. {$ENDIF} // DIRECT3D_VERSION_7
  797. {$IFDEF DIRECT3D_VERSION_LESS_8}
  798.   PD3DLightType = ^TD3DLightType;
  799.   _D3DLIGHTTYPE = (
  800.     D3DLIGHT_INVALID_0,
  801.     D3DLIGHT_POINT,
  802.     D3DLIGHT_SPOT,
  803.     D3DLIGHT_DIRECTIONAL,
  804. // Note: The following light type (D3DLIGHT_PARALLELPOINT)
  805. // is no longer supported from D3D for DX7 onwards.
  806.     D3DLIGHT_PARALLELPOINT
  807. {$IFDEF DIRECT3D_VERSION_LESS_5}, // For backward compatible headers
  808.     D3DLIGHT_GLSPOT
  809. {$ENDIF} // DIRECT3D_VERSION_LESS_5
  810.   );
  811.   {$EXTERNALSYM _D3DLIGHTTYPE}
  812.   D3DLIGHTTYPE = _D3DLIGHTTYPE;
  813.   {$EXTERNALSYM D3DLIGHTTYPE}
  814.   TD3DLightType = _D3DLIGHTTYPE;
  815. {$ELSE}
  816. const
  817.   D3DLIGHT_PARALLELPOINT  = TD3DLightType(4);
  818.   {$EXTERNALSYM D3DLIGHT_PARALLELPOINT}
  819.   D3DLIGHT_GLSPOT         = TD3DLightType(5);
  820.   {$EXTERNALSYM D3DLIGHT_GLSPOT}
  821. type
  822. {$ENDIF} //(DIRECT3D_VERSION < 0x0800)
  823. (*
  824.  * Structure defining a light source and its properties.
  825.  *)
  826.   PD3DLight = ^TD3DLight;
  827.   _D3DLIGHT = packed record
  828.     dwSize: DWORD;
  829.     dltType: TD3DLightType;     (* Type of light source *)
  830.     dcvColor: TD3DColorValue;   (* Color of light *)
  831.     dvPosition: TD3DVector;     (* Position in world space *)
  832.     dvDirection: TD3DVector;    (* Direction in world space *)
  833.     dvRange: TD3DValue;         (* Cutoff range *)
  834.     dvFalloff: TD3DValue;       (* Falloff *)
  835.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  836.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  837.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  838.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  839.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  840.   end;
  841.   {$EXTERNALSYM _D3DLIGHT}
  842.   D3DLIGHT = _D3DLIGHT;
  843.   {$EXTERNALSYM D3DLIGHT}
  844.   TD3DLight = _D3DLIGHT;
  845. {$IFDEF DIRECT3D_VERSION_7}
  846.   PD3DLight7 = ^TD3DLight7;
  847.   _D3DLIGHT7 = packed record
  848.     dltType: TD3DLightType;     (* Type of light source *)
  849.     dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
  850.     dcvSpecular: TD3DColorValue;(* Specular color of light *)
  851.     dcvAmbient: TD3DColorValue; (* Ambient color of light *)
  852.     dvPosition: TD3DVector;     (* Position in world space *)
  853.     dvDirection: TD3DVector;    (* Direction in world space *)
  854.     dvRange: TD3DValue;         (* Cutoff range *)
  855.     dvFalloff: TD3DValue;       (* Falloff *)
  856.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  857.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  858.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  859.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  860.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  861.   end;
  862.   {$EXTERNALSYM _D3DLIGHT7}
  863.   D3DLIGHT7 = _D3DLIGHT7;
  864.   {$EXTERNALSYM D3DLIGHT7}
  865.   TD3DLight7 = _D3DLIGHT7;
  866. {$ENDIF} // DIRECT3D_VERSION_7
  867. {$IFDEF DIRECT3D_VERSION_5}
  868. (*
  869.  * Structure defining a light source and its properties.
  870.  *)
  871. (* flags bits *)
  872. const
  873.   D3DLIGHT_ACTIVE       = $00000001;
  874.   {$EXTERNALSYM D3DLIGHT_ACTIVE}
  875.   D3DLIGHT_NO_SPECULAR  = $00000002;
  876.   {$EXTERNALSYM D3DLIGHT_NO_SPECULAR}
  877.   D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
  878.   {$EXTERNALSYM D3DLIGHT_ALL}
  879. (* maximum valid light range *)
  880.   D3DLIGHT_RANGE_MAX = 1.8439088915e+18; //sqrt(FLT_MAX);
  881.   {$EXTERNALSYM D3DLIGHT_RANGE_MAX}
  882. type
  883.   PD3DLight2 = ^TD3DLight2;
  884.   _D3DLIGHT2 = packed record
  885.     dwSize: DWORD;
  886.     dltType: TD3DLightType;     (* Type of light source *)
  887.     dcvColor: TD3DColorValue;   (* Color of light *)
  888.     dvPosition: TD3DVector;     (* Position in world space *)
  889.     dvDirection: TD3DVector;    (* Direction in world space *)
  890.     dvRange: TD3DValue;         (* Cutoff range *)
  891.     dvFalloff: TD3DValue;       (* Falloff *)
  892.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  893.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  894.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  895.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  896.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  897.     dwFlags: DWORD;
  898.   end;
  899.   {$EXTERNALSYM _D3DLIGHT2}
  900.   D3DLIGHT2 = _D3DLIGHT2;
  901.   {$EXTERNALSYM D3DLIGHT2}
  902.   TD3DLight2 = _D3DLIGHT2;
  903. {$ELSE}
  904.   PD3DLight2 = PD3DLight;
  905.   TD3DLight2 = TD3DLight;
  906. {$ENDIF} // DIRECT3D_VERSION_5
  907.   PD3DLightData = ^TD3DLightData;
  908.   _D3DLIGHTDATA = packed record
  909.     dwSize: DWORD;
  910.     lpIn: ^TD3DLightingElement; (* Input positions and normals *)
  911.     dwInSize: DWORD;            (* Stride of input elements *)
  912.     lpOut: ^TD3DTLVertex;       (* Output colors *)
  913.     dwOutSize: DWORD;           (* Stride of output colors *)
  914.   end;
  915.   {$EXTERNALSYM _D3DLIGHTDATA}
  916.   D3DLIGHTDATA = _D3DLIGHTDATA;
  917.   {$EXTERNALSYM D3DLIGHTDATA}
  918.   TD3DLightData = _D3DLIGHTDATA;
  919. (*
  920.  * Before DX5, these values were in an enum called
  921.  * TD3DColorModel. This was not correct, since they are
  922.  * bit flags. A driver can surface either or both flags
  923.  * in the dcmColorModel member of D3DDEVICEDESC.
  924.  *)
  925. type
  926.   TD3DColorModel = DWORD;
  927. const
  928.   D3DCOLOR_MONO = 1;
  929.   {$EXTERNALSYM D3DCOLOR_MONO}
  930.   D3DCOLOR_RGB  = 2;
  931.   {$EXTERNALSYM D3DCOLOR_RGB}
  932. (*
  933.  * Options for clearing
  934.  *)
  935. const
  936.   D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
  937.   {$EXTERNALSYM D3DCLEAR_TARGET}
  938.   D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
  939.   {$EXTERNALSYM D3DCLEAR_ZBUFFER}
  940. {$IFDEF DIRECT3D_VERSION_6}
  941.   D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
  942.   {$EXTERNALSYM D3DCLEAR_STENCIL}
  943. {$ENDIF} // DIRECT3D_VERSION_6
  944. (*
  945.  * Execute buffers are allocated via Direct3D.  These buffers may then
  946.  * be filled by the application with instructions to execute along with
  947.  * vertex data.
  948.  *)
  949. (*
  950.  * Supported op codes for execute instructions.
  951.  *)
  952. type
  953.   PD3DOpcode = ^TD3DOpcode;
  954.   _D3DOPCODE = (
  955.     D3DOP_INVALID_0,
  956.     D3DOP_POINT,
  957.     D3DOP_LINE,
  958.     D3DOP_TRIANGLE,
  959.     D3DOP_MATRIXLOAD,
  960.     D3DOP_MATRIXMULTIPLY,
  961.     D3DOP_STATETRANSFORM,
  962.     D3DOP_STATELIGHT,
  963.     D3DOP_STATERENDER,
  964.     D3DOP_PROCESSVERTICES,
  965.     D3DOP_TEXTURELOAD,
  966.     D3DOP_EXIT,
  967.     D3DOP_BRANCHFORWARD,
  968.     D3DOP_SPAN,
  969.     D3DOP_SETSTATUS);
  970.   {$EXTERNALSYM _D3DOPCODE}
  971.   D3DOPCODE = _D3DOPCODE;
  972.   {$EXTERNALSYM D3DOPCODE}
  973.   TD3DOpcode = _D3DOPCODE;
  974.   PD3DInstruction = ^TD3DInstruction;
  975.   _D3DINSTRUCTION = packed record
  976.     bOpcode: Byte;   (* Instruction opcode *)
  977.     bSize: Byte;     (* Size of each instruction data unit *)
  978.     wCount: Word;    (* Count of instruction data units to follow *)
  979.   end;
  980.   {$EXTERNALSYM _D3DINSTRUCTION}
  981.   D3DINSTRUCTION = _D3DINSTRUCTION;
  982.   {$EXTERNALSYM D3DINSTRUCTION}
  983.   TD3DInstruction = _D3DINSTRUCTION;
  984. (*
  985.  * Structure for texture loads
  986.  *)
  987.   PD3DTextureLoad = ^TD3DTextureLoad;
  988.   _D3DTEXTURELOAD = packed record
  989.     hDestTexture: TD3DTextureHandle;
  990.     hSrcTexture: TD3DTextureHandle;
  991.   end;
  992.   {$EXTERNALSYM _D3DTEXTURELOAD}
  993.   D3DTEXTURELOAD = _D3DTEXTURELOAD;
  994.   {$EXTERNALSYM D3DTEXTURELOAD}
  995.   TD3DTextureLoad = _D3DTEXTURELOAD;
  996. (*
  997.  * Structure for picking
  998.  *)
  999.   PD3DPickRecord = ^TD3DPickRecord;
  1000.   _D3DPICKRECORD = packed record
  1001.     bOpcode: Byte;
  1002.     bPad: Byte;
  1003.     dwOffset: DWORD;
  1004.     dvZ: TD3DValue;
  1005.   end;
  1006.   {$EXTERNALSYM _D3DPICKRECORD}
  1007.   D3DPICKRECORD = _D3DPICKRECORD;
  1008.   {$EXTERNALSYM D3DPICKRECORD}
  1009.   TD3DPickRecord = _D3DPICKRECORD;
  1010. (*
  1011.  * The following defines the rendering states which can be set in the
  1012.  * execute buffer.
  1013.  *)
  1014. {$IFDEF DIRECT3D_VERSION_LESS_8}
  1015.   PD3DShadeMode = ^TD3DShadeMode;
  1016.   _D3DSHADEMODE = (
  1017.     D3DSHADE_INVALID_0,
  1018.     D3DSHADE_FLAT,
  1019.     D3DSHADE_GOURAUD,
  1020.     D3DSHADE_PHONG);
  1021.   {$EXTERNALSYM _D3DSHADEMODE}
  1022.   D3DSHADEMODE = _D3DSHADEMODE;
  1023.   {$EXTERNALSYM D3DSHADEMODE}
  1024.   TD3DShadeMode = _D3DSHADEMODE;
  1025.   PD3DFillMode = ^TD3DFillMode;
  1026.   _D3DFILLMODE = (
  1027.     D3DFILL_INVALID_0,
  1028.     D3DFILL_POINT,
  1029.     D3DFILL_WIREFRAME,
  1030.     D3DFILL_SOLID);
  1031.   {$EXTERNALSYM _D3DFILLMODE}
  1032.   D3DFILLMODE = _D3DFILLMODE;
  1033.   {$EXTERNALSYM D3DFILLMODE}
  1034.   TD3DFillMode = _D3DFILLMODE;
  1035.   PD3DLinePattern = ^TD3DLinePattern;
  1036.   _D3DLINEPATTERN = packed record
  1037.     wRepeatFactor: WORD;
  1038.     wLinePattern: WORD;
  1039.   end;
  1040.   {$EXTERNALSYM _D3DLINEPATTERN}
  1041.   D3DLINEPATTERN = _D3DLINEPATTERN;
  1042.   {$EXTERNALSYM D3DLINEPATTERN}
  1043.   TD3DLinePattern = _D3DLINEPATTERN;
  1044. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1045.   PD3DTextureFilter = ^TD3DTextureFilter;
  1046.   _D3DTEXTUREFILTER = (
  1047.     D3DFILTER_INVALID_0,
  1048.     D3DFILTER_NEAREST,
  1049.     D3DFILTER_LINEAR,
  1050.     D3DFILTER_MIPNEAREST,
  1051.     D3DFILTER_MIPLINEAR,
  1052.     D3DFILTER_LINEARMIPNEAREST,
  1053.     D3DFILTER_LINEARMIPLINEAR);
  1054.   {$EXTERNALSYM _D3DTEXTUREFILTER}
  1055.   D3DTEXTUREFILTER = _D3DTEXTUREFILTER;
  1056.   {$EXTERNALSYM D3DTEXTUREFILTER}
  1057.   TD3DTextureFilter = _D3DTEXTUREFILTER;
  1058. {$IFDEF DIRECT3D_VERSION_LESS_8}
  1059.   PD3DBlend = ^TD3DBlend;
  1060.   _D3DBLEND = (
  1061.     D3DBLEND_INVALID_0,
  1062.     D3DBLEND_ZERO,
  1063.     D3DBLEND_ONE,
  1064.     D3DBLEND_SRCCOLOR,
  1065.     D3DBLEND_INVSRCCOLOR,
  1066.     D3DBLEND_SRCALPHA,
  1067.     D3DBLEND_INVSRCALPHA,
  1068.     D3DBLEND_DESTALPHA,
  1069.     D3DBLEND_INVDESTALPHA,
  1070.     D3DBLEND_DESTCOLOR,
  1071.     D3DBLEND_INVDESTCOLOR,
  1072.     D3DBLEND_SRCALPHASAT,
  1073.     D3DBLEND_BOTHSRCALPHA,
  1074.     D3DBLEND_BOTHINVSRCALPHA);
  1075.   {$EXTERNALSYM _D3DBLEND}
  1076.   D3DBLEND = _D3DBLEND;
  1077.   {$EXTERNALSYM D3DBLEND}
  1078.   TD3DBlend = _D3DBLEND;
  1079. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1080.   PD3DTextureBlend = ^TD3DTextureBlend;
  1081.   _D3DTEXTUREBLEND = (
  1082.     D3DTBLEND_INVALID_0,
  1083.     D3DTBLEND_DECAL,
  1084.     D3DTBLEND_MODULATE,
  1085.     D3DTBLEND_DECALALPHA,
  1086.     D3DTBLEND_MODULATEALPHA,
  1087.     D3DTBLEND_DECALMASK,
  1088.     D3DTBLEND_MODULATEMASK,
  1089.     D3DTBLEND_COPY
  1090. {$IFDEF DIRECT3D_VERSION_5},
  1091.     D3DTBLEND_ADD
  1092. {$ENDIF} // DIRECT3D_VERSION_5
  1093.   );
  1094.   {$EXTERNALSYM _D3DTEXTUREBLEND}
  1095.   D3DTEXTUREBLEND = _D3DTEXTUREBLEND;
  1096.   {$EXTERNALSYM D3DTEXTUREBLEND}
  1097.   TD3DTextureBlend = _D3DTEXTUREBLEND;
  1098. {$IFDEF DIRECT3D_VERSION_LESS_8}
  1099.   PD3DTextureAddress = ^TD3DTextureAddress;
  1100.   _D3DTEXTUREADDRESS = (
  1101.     D3DTADDRESS_INVALID_0,
  1102.     D3DTADDRESS_WRAP,
  1103.     D3DTADDRESS_MIRROR,
  1104.     D3DTADDRESS_CLAMP
  1105. {$IFDEF DIRECT3D_VERSION_5},
  1106.     D3DTADDRESS_BORDER
  1107. {$ENDIF} // DIRECT3D_VERSION_5
  1108.   );
  1109.   {$EXTERNALSYM _D3DTEXTUREADDRESS}
  1110.   D3DTEXTUREADDRESS = _D3DTEXTUREADDRESS;
  1111.   {$EXTERNALSYM D3DTEXTUREADDRESS}
  1112.   TD3DTextureAddress = _D3DTEXTUREADDRESS;
  1113.   PD3DCull = ^TD3DCull;
  1114.   _D3DCULL = (
  1115.     D3DCULL_INVALID_0,
  1116.     D3DCULL_NONE,
  1117.     D3DCULL_CW,
  1118.     D3DCULL_CCW);
  1119.   {$EXTERNALSYM _D3DCULL}
  1120.   D3DCULL = _D3DCULL;
  1121.   {$EXTERNALSYM D3DCULL}
  1122.   TD3DCull = _D3DCULL;
  1123.   PD3DCmpFunc = ^TD3DCmpFunc;
  1124.   _D3DCMPFUNC = (
  1125.     D3DCMP_INVALID_0,
  1126.     D3DCMP_NEVER,
  1127.     D3DCMP_LESS,
  1128.     D3DCMP_EQUAL,
  1129.     D3DCMP_LESSEQUAL,
  1130.     D3DCMP_GREATER,
  1131.     D3DCMP_NOTEQUAL,
  1132.     D3DCMP_GREATEREQUAL,
  1133.     D3DCMP_ALWAYS);
  1134.   {$EXTERNALSYM _D3DCMPFUNC}
  1135.   D3DCMPFUNC = _D3DCMPFUNC;
  1136.   {$EXTERNALSYM D3DCMPFUNC}
  1137.   TD3DCmpFunc = _D3DCMPFUNC;
  1138. {$IFDEF DIRECT3D_VERSION_6}
  1139.   PD3DStencilOp = ^TD3DStencilOp;
  1140.   _D3DSTENCILOP = (
  1141.     D3DSTENCILOP_INVALID_0,
  1142.     D3DSTENCILOP_KEEP,
  1143.     D3DSTENCILOP_ZERO,
  1144.     D3DSTENCILOP_REPLACE,
  1145.     D3DSTENCILOP_INCRSAT,
  1146.     D3DSTENCILOP_DECRSAT,
  1147.     D3DSTENCILOP_INVERT,
  1148.     D3DSTENCILOP_INCR,
  1149.     D3DSTENCILOP_DECR);
  1150.   {$EXTERNALSYM _D3DSTENCILOP}
  1151.   D3DSTENCILOP = _D3DSTENCILOP;
  1152.   {$EXTERNALSYM D3DSTENCILOP}
  1153.   TD3DStencilOp = _D3DSTENCILOP;
  1154. {$ENDIF} // DIRECT3D_VERSION_6
  1155.   PD3DFogMode = ^TD3DFogMode;
  1156.   _D3DFOGMODE = (
  1157.     D3DFOG_NONE,
  1158.     D3DFOG_EXP,
  1159.     D3DFOG_EXP2
  1160. {$IFDEF DIRECT3D_VERSION_5},
  1161.     D3DFOG_LINEAR
  1162. {$ENDIF} // DIRECT3D_VERSION_5
  1163.   );
  1164.   {$EXTERNALSYM _D3DFOGMODE}
  1165.   D3DFOGMODE = _D3DFOGMODE;
  1166.   {$EXTERNALSYM D3DFOGMODE}
  1167.   TD3DFogMode = _D3DFOGMODE;
  1168. {$IFDEF DIRECT3D_VERSION_6}
  1169.   PD3DZBufferType = ^TD3DZBufferType;
  1170.   _D3DZBUFFERTYPE = (
  1171.     D3DZB_FALSE,
  1172.     D3DZB_TRUE,   // Z buffering
  1173.     D3DZB_USEW);  // W buffering
  1174.   {$EXTERNALSYM _D3DZBUFFERTYPE}
  1175.   D3DZBUFFERTYPE = _D3DZBUFFERTYPE;
  1176.   {$EXTERNALSYM D3DZBUFFERTYPE}
  1177.   TD3DZBufferType = _D3DZBUFFERTYPE;
  1178. {$ENDIF} // DIRECT3D_VERSION_6
  1179. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1180. {$IFDEF DIRECT3D_VERSION_5}
  1181.   PD3DAntialiasMode = ^TD3DAntialiasMode;
  1182.   _D3DANTIALIASMODE = (
  1183.     D3DANTIALIAS_NONE,
  1184.     D3DANTIALIAS_SORTDEPENDENT,
  1185.     D3DANTIALIAS_SORTINDEPENDENT);
  1186.   {$EXTERNALSYM _D3DANTIALIASMODE}
  1187.   D3DANTIALIASMODE = _D3DANTIALIASMODE;
  1188.   {$EXTERNALSYM D3DANTIALIASMODE}
  1189.   TD3DAntialiasMode = _D3DANTIALIASMODE;
  1190. // Vertex types supported by Direct3D
  1191.   PD3DVertexType = ^TD3DVertexType;
  1192.   _D3DVERTEXTYPE = (
  1193.     D3DVT_INVALID_0,
  1194.     D3DVT_VERTEX,
  1195.     D3DVT_LVERTEX,
  1196.     D3DVT_TLVERTEX);
  1197.   {$EXTERNALSYM _D3DVERTEXTYPE}
  1198.   D3DVERTEXTYPE = _D3DVERTEXTYPE;
  1199.   {$EXTERNALSYM D3DVERTEXTYPE}
  1200.   TD3DVertexType = _D3DVERTEXTYPE;
  1201. {$IFDEF DIRECT3D_VERSION_LESS_8}
  1202. // Primitives supported by draw-primitive API
  1203.   PD3DPrimitiveType = ^TD3DPrimitiveType;
  1204.   _D3DPRIMITIVETYPE = (
  1205.     D3DPT_INVALID_0,
  1206.     D3DPT_POINTLIST,
  1207.     D3DPT_LINELIST,
  1208.     D3DPT_LINESTRIP,
  1209.     D3DPT_TRIANGLELIST,
  1210.     D3DPT_TRIANGLESTRIP,
  1211.     D3DPT_TRIANGLEFAN);
  1212.   {$EXTERNALSYM _D3DPRIMITIVETYPE}
  1213.   D3DPRIMITIVETYPE = _D3DPRIMITIVETYPE;
  1214.   {$EXTERNALSYM D3DPRIMITIVETYPE}
  1215.   TD3DPrimitiveType = _D3DPRIMITIVETYPE;
  1216. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1217. {$ENDIF} // DIRECT3D_VERSION_5
  1218. (*
  1219.  * Amount to add to a state to generate the override for that state.
  1220.  *)
  1221. const
  1222.   D3DSTATE_OVERRIDE_BIAS          = 256;
  1223.   {$EXTERNALSYM D3DSTATE_OVERRIDE_BIAS}
  1224. (*
  1225.  * A state which sets the override flag for the specified state type.
  1226.  *)
  1227. function D3DSTATE_OVERRIDE(StateType: DWORD): DWORD;
  1228. {$EXTERNALSYM D3DSTATE_OVERRIDE}
  1229. {$IFDEF DIRECT3D_VERSION_8}
  1230. //
  1231. // legacy transform state names
  1232. //
  1233. {$ENDIF} // DIRECT3D_VERSION_8
  1234. type
  1235.   PD3DTransformStateType = ^TD3DTransformStateType;
  1236.   TD3DTransformStateType = DWORD;
  1237. const
  1238.   D3DTRANSFORMSTATE_WORLD         = TD3DTransformStateType(1);
  1239.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD}
  1240.   D3DTRANSFORMSTATE_VIEW          = TD3DTransformStateType(2);
  1241.   {$EXTERNALSYM D3DTRANSFORMSTATE_VIEW}
  1242.   D3DTRANSFORMSTATE_PROJECTION    = TD3DTransformStateType(3);
  1243.   {$EXTERNALSYM D3DTRANSFORMSTATE_PROJECTION}
  1244. {$IFDEF DIRECT3D_VERSION_7}
  1245.   D3DTRANSFORMSTATE_WORLD1        = TD3DTransformStateType(4);  // 2nd matrix to blend
  1246.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD1}
  1247.   D3DTRANSFORMSTATE_WORLD2        = TD3DTransformStateType(5);  // 3rd matrix to blend
  1248.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD2}
  1249.   D3DTRANSFORMSTATE_WORLD3        = TD3DTransformStateType(6);  // 4th matrix to blend
  1250.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD3}
  1251.   D3DTRANSFORMSTATE_TEXTURE0      = TD3DTransformStateType(16);
  1252.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE0}
  1253.   D3DTRANSFORMSTATE_TEXTURE1      = TD3DTransformStateType(17);
  1254.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE1}
  1255.   D3DTRANSFORMSTATE_TEXTURE2      = TD3DTransformStateType(18);
  1256.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE2}
  1257.   D3DTRANSFORMSTATE_TEXTURE3      = TD3DTransformStateType(19);
  1258.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE3}
  1259.   D3DTRANSFORMSTATE_TEXTURE4      = TD3DTransformStateType(20);
  1260.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE4}
  1261.   D3DTRANSFORMSTATE_TEXTURE5      = TD3DTransformStateType(21);
  1262.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE5}
  1263.   D3DTRANSFORMSTATE_TEXTURE6      = TD3DTransformStateType(22);
  1264.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE6}
  1265.   D3DTRANSFORMSTATE_TEXTURE7      = TD3DTransformStateType(23);
  1266.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE7}
  1267. {$ENDIF} // DIRECT3D_VERSION_7
  1268. type
  1269.   PD3DLightStateType = ^TD3DLightStateType;
  1270.   _D3DLIGHTSTATETYPE = (
  1271.     D3DLIGHTSTATE_INVALID_0,
  1272.     D3DLIGHTSTATE_MATERIAL,
  1273.     D3DLIGHTSTATE_AMBIENT,
  1274.     D3DLIGHTSTATE_COLORMODEL,
  1275.     D3DLIGHTSTATE_FOGMODE,
  1276.     D3DLIGHTSTATE_FOGSTART,
  1277.     D3DLIGHTSTATE_FOGEND,
  1278.     D3DLIGHTSTATE_FOGDENSITY
  1279. {$IFDEF DIRECT3D_VERSION_6},
  1280.     D3DLIGHTSTATE_COLORVERTEX
  1281.   {$EXTERNALSYM _D3DLIGHTSTATETYPE}
  1282. {$ENDIF} // DIRECT3D_VERSION_6
  1283.   );
  1284.   D3DLIGHTSTATETYPE = _D3DLIGHTSTATETYPE;
  1285.   {$EXTERNALSYM D3DLIGHTSTATETYPE}
  1286.   TD3DLightStateType = _D3DLIGHTSTATETYPE;
  1287. type  
  1288.   PD3DRenderStateType = ^TD3DRenderStateType;
  1289.   TD3DRenderStateType = DWORD;
  1290. const
  1291.   D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
  1292.   {$EXTERNALSYM D3DRENDERSTATE_ANTIALIAS}
  1293.   D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
  1294.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREPERSPECTIVE}
  1295.   D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
  1296.   {$EXTERNALSYM D3DRENDERSTATE_ZENABLE}
  1297.   D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
  1298.   {$EXTERNALSYM D3DRENDERSTATE_FILLMODE}
  1299.   D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
  1300.   {$EXTERNALSYM D3DRENDERSTATE_SHADEMODE}
  1301.   D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
  1302.   {$EXTERNALSYM D3DRENDERSTATE_LINEPATTERN}
  1303.   D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
  1304.   {$EXTERNALSYM D3DRENDERSTATE_ZWRITEENABLE}
  1305.   D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
  1306.   {$EXTERNALSYM D3DRENDERSTATE_ALPHATESTENABLE}
  1307.   D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
  1308.   {$EXTERNALSYM D3DRENDERSTATE_LASTPIXEL}
  1309.   D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
  1310.   {$EXTERNALSYM D3DRENDERSTATE_SRCBLEND}
  1311.   D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
  1312.   {$EXTERNALSYM D3DRENDERSTATE_DESTBLEND}
  1313.   D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
  1314.   {$EXTERNALSYM D3DRENDERSTATE_CULLMODE}
  1315.   D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
  1316.   {$EXTERNALSYM D3DRENDERSTATE_ZFUNC}
  1317.   D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
  1318.   {$EXTERNALSYM D3DRENDERSTATE_ALPHAREF}
  1319.   D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
  1320.   {$EXTERNALSYM D3DRENDERSTATE_ALPHAFUNC}
  1321.   D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
  1322.   {$EXTERNALSYM D3DRENDERSTATE_DITHERENABLE}
  1323. {$IFDEF DIRECT3D_VERSION_5}
  1324.   D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
  1325.   {$EXTERNALSYM D3DRENDERSTATE_ALPHABLENDENABLE}
  1326. {$ENDIF} // DIRECT3D_VERSION_5
  1327.   D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
  1328.   {$EXTERNALSYM D3DRENDERSTATE_FOGENABLE}
  1329.   D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
  1330.   {$EXTERNALSYM D3DRENDERSTATE_SPECULARENABLE}
  1331.   D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
  1332.   {$EXTERNALSYM D3DRENDERSTATE_ZVISIBLE}
  1333.   D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
  1334.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEDALPHA}
  1335.   D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
  1336.   {$EXTERNALSYM D3DRENDERSTATE_FOGCOLOR}
  1337.   D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
  1338.   {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEMODE}
  1339. {$IFDEF DIRECT3D_VERSION_7}
  1340.   D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
  1341.   {$EXTERNALSYM D3DRENDERSTATE_FOGSTART}
  1342.   D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
  1343.   {$EXTERNALSYM D3DRENDERSTATE_FOGEND}
  1344.   D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
  1345.   {$EXTERNALSYM D3DRENDERSTATE_FOGDENSITY}
  1346. {$ENDIF} // DIRECT3D_VERSION_7
  1347. {$IFDEF DIRECT3D_VERSION_5}
  1348.   D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
  1349.   {$EXTERNALSYM D3DRENDERSTATE_EDGEANTIALIAS}
  1350.   D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
  1351.   {$EXTERNALSYM D3DRENDERSTATE_COLORKEYENABLE}
  1352.   D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
  1353.   {$EXTERNALSYM D3DRENDERSTATE_ZBIAS}
  1354.   D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
  1355.   {$EXTERNALSYM D3DRENDERSTATE_RANGEFOGENABLE}
  1356. {$ENDIF} // DIRECT3D_VERSION_5
  1357. {$IFDEF DIRECT3D_VERSION_6}
  1358.   D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
  1359.   {$EXTERNALSYM D3DRENDERSTATE_STENCILENABLE}
  1360.   D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
  1361.   {$EXTERNALSYM D3DRENDERSTATE_STENCILFAIL}
  1362.   D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
  1363.   {$EXTERNALSYM D3DRENDERSTATE_STENCILZFAIL}
  1364.   D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
  1365.   {$EXTERNALSYM D3DRENDERSTATE_STENCILPASS}
  1366.   D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
  1367.   {$EXTERNALSYM D3DRENDERSTATE_STENCILFUNC}
  1368.   D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
  1369.   {$EXTERNALSYM D3DRENDERSTATE_STENCILREF}
  1370.   D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
  1371.   {$EXTERNALSYM D3DRENDERSTATE_STENCILMASK}
  1372.   D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
  1373.   {$EXTERNALSYM D3DRENDERSTATE_STENCILWRITEMASK}
  1374.   D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
  1375.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREFACTOR}
  1376. {$ENDIF} // DIRECT3D_VERSION_6
  1377. {$IFDEF DIRECT3D_VERSION_6}
  1378.   (*
  1379.    * 128 values [128; 255] are reserved for texture coordinate wrap flags.
  1380.    * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  1381.    * a flags word preserves forward compatibility with texture coordinates
  1382.    * that are >2D.
  1383.    *)
  1384.   D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
  1385.   {$EXTERNALSYM D3DRENDERSTATE_WRAP0}
  1386.   D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
  1387.   {$EXTERNALSYM D3DRENDERSTATE_WRAP1}
  1388.   D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
  1389.   {$EXTERNALSYM D3DRENDERSTATE_WRAP2}
  1390.   D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
  1391.   {$EXTERNALSYM D3DRENDERSTATE_WRAP3}
  1392.   D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
  1393.   {$EXTERNALSYM D3DRENDERSTATE_WRAP4}
  1394.   D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
  1395.   {$EXTERNALSYM D3DRENDERSTATE_WRAP5}
  1396.   D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
  1397.   {$EXTERNALSYM D3DRENDERSTATE_WRAP6}
  1398.   D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
  1399.   {$EXTERNALSYM D3DRENDERSTATE_WRAP7}
  1400. {$ENDIF} // DIRECT3D_VERSION_6
  1401. {$IFDEF DIRECT3D_VERSION_7}
  1402.   D3DRENDERSTATE_CLIPPING            = 136;
  1403.   {$EXTERNALSYM D3DRENDERSTATE_CLIPPING}
  1404.   D3DRENDERSTATE_LIGHTING            = 137;
  1405.   {$EXTERNALSYM D3DRENDERSTATE_LIGHTING}
  1406.   D3DRENDERSTATE_EXTENTS             = 138;
  1407.   {$EXTERNALSYM D3DRENDERSTATE_EXTENTS}
  1408.   D3DRENDERSTATE_AMBIENT             = 139;
  1409.   {$EXTERNALSYM D3DRENDERSTATE_AMBIENT}
  1410.   D3DRENDERSTATE_FOGVERTEXMODE       = 140;
  1411.   {$EXTERNALSYM D3DRENDERSTATE_FOGVERTEXMODE}
  1412.   D3DRENDERSTATE_COLORVERTEX         = 141;
  1413.   {$EXTERNALSYM D3DRENDERSTATE_COLORVERTEX}
  1414.   D3DRENDERSTATE_LOCALVIEWER         = 142;
  1415.   {$EXTERNALSYM D3DRENDERSTATE_LOCALVIEWER}
  1416.   D3DRENDERSTATE_NORMALIZENORMALS    = 143;
  1417.   {$EXTERNALSYM D3DRENDERSTATE_NORMALIZENORMALS}
  1418.   D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
  1419.   {$EXTERNALSYM D3DRENDERSTATE_COLORKEYBLENDENABLE}
  1420.   D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
  1421.   {$EXTERNALSYM D3DRENDERSTATE_DIFFUSEMATERIALSOURCE}
  1422.   D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
  1423.   {$EXTERNALSYM D3DRENDERSTATE_SPECULARMATERIALSOURCE}
  1424.   D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
  1425.   {$EXTERNALSYM D3DRENDERSTATE_AMBIENTMATERIALSOURCE}
  1426.   D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
  1427.   {$EXTERNALSYM D3DRENDERSTATE_EMISSIVEMATERIALSOURCE}
  1428.   D3DRENDERSTATE_VERTEXBLEND              = 151;
  1429.   {$EXTERNALSYM D3DRENDERSTATE_VERTEXBLEND}
  1430.   D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
  1431.   {$EXTERNALSYM D3DRENDERSTATE_CLIPPLANEENABLE}
  1432. {$ENDIF} // DIRECT3D_VERSION_7
  1433. //
  1434. // retired renderstates - not supported for DX7 interfaces
  1435. //
  1436.   D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
  1437.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREHANDLE}
  1438.   D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
  1439.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREADDRESS}
  1440.   D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
  1441.   {$EXTERNALSYM D3DRENDERSTATE_WRAPU}
  1442.   D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
  1443.   {$EXTERNALSYM D3DRENDERSTATE_WRAPV}
  1444.   D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
  1445.   {$EXTERNALSYM D3DRENDERSTATE_MONOENABLE}
  1446.   D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
  1447.   {$EXTERNALSYM D3DRENDERSTATE_ROP2}
  1448.   D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
  1449.   {$EXTERNALSYM D3DRENDERSTATE_PLANEMASK}
  1450.   D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
  1451.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREMAG}
  1452.   D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
  1453.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREMIN}
  1454.   D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
  1455.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREMAPBLEND}
  1456.   D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
  1457.   {$EXTERNALSYM D3DRENDERSTATE_SUBPIXEL}
  1458.   D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
  1459.   {$EXTERNALSYM D3DRENDERSTATE_SUBPIXELX}
  1460.   D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
  1461.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEENABLE}
  1462. {$IFDEF DIRECT3D_VERSION_5}
  1463.   D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
  1464.   {$EXTERNALSYM D3DRENDERSTATE_BORDERCOLOR}
  1465.   D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
  1466.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREADDRESSU}
  1467.   D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
  1468.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREADDRESSV}
  1469.   D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
  1470.   {$EXTERNALSYM D3DRENDERSTATE_MIPMAPLODBIAS}
  1471.   D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
  1472.   {$EXTERNALSYM D3DRENDERSTATE_ANISOTROPY}
  1473. {$ENDIF} // DIRECT3D_VERSION_5
  1474.   D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
  1475.   {$EXTERNALSYM D3DRENDERSTATE_FLUSHBATCH}
  1476. {$IFDEF DIRECT3D_VERSION_6}
  1477.   D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
  1478.   {$EXTERNALSYM D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT}
  1479. {$ENDIF} // DIRECT3D_VERSION_6
  1480.   D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
  1481.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN00}
  1482.   D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
  1483.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN01}
  1484.   D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
  1485.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN02}
  1486.   D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
  1487.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN03}
  1488.   D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
  1489.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN04}
  1490.   D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
  1491.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN05}
  1492.   D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
  1493.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN06}
  1494.   D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
  1495.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN07}
  1496.   D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
  1497.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN08}
  1498.   D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
  1499.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN09}
  1500.   D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
  1501.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN10}
  1502.   D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
  1503.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN11}
  1504.   D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
  1505.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN12}
  1506.   D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
  1507.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN13}
  1508.   D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
  1509.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN14}
  1510.   D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
  1511.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN15}
  1512.   D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
  1513.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN16}
  1514.   D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
  1515.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN17}
  1516.   D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
  1517.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN18}
  1518.   D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
  1519.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN19}
  1520.   D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
  1521.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN20}
  1522.   D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
  1523.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN21}
  1524.   D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
  1525.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN22}
  1526.   D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
  1527.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN23}
  1528.   D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
  1529.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN24}
  1530.   D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
  1531.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN25}
  1532.   D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
  1533.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN26}
  1534.   D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
  1535.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN27}
  1536.   D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
  1537.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN28}
  1538.   D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
  1539.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN29}
  1540.   D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
  1541.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN30}
  1542.   D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
  1543.   {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN31}
  1544. //
  1545. // retired renderstate names - the values are still used under new naming conventions
  1546. //
  1547.   D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
  1548.   {$EXTERNALSYM D3DRENDERSTATE_FOGTABLESTART}
  1549.   D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
  1550.   {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEEND}
  1551.   D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
  1552.   {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEDENSITY}
  1553. {$IFDEF DIRECT3D_VERSION_LESS_8}
  1554. type
  1555. // Values for material source
  1556.   PD3DMateralColorSource = ^TD3DMateralColorSource;
  1557.   _D3DMATERIALCOLORSOURCE = (
  1558.     D3DMCS_MATERIAL,              // Color from material is used
  1559.     D3DMCS_COLOR1,                // Diffuse vertex color is used
  1560.     D3DMCS_COLOR2                 // Specular vertex color is used
  1561.   );
  1562.   {$EXTERNALSYM _D3DMATERIALCOLORSOURCE}
  1563.   D3DMATERIALCOLORSOURCE = _D3DMATERIALCOLORSOURCE;
  1564.   {$EXTERNALSYM D3DMATERIALCOLORSOURCE}
  1565.   TD3DMateralColorSource = _D3DMATERIALCOLORSOURCE;
  1566. {$IFDEF DIRECT3D_VERSION_5}
  1567. const
  1568.   // For back-compatibility with legacy compilations
  1569.   D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
  1570.   {$EXTERNALSYM D3DRENDERSTATE_BLENDENABLE}
  1571. {$ENDIF} // DIRECT3D_VERSION_5
  1572. {$IFDEF DIRECT3D_VERSION_6}
  1573. // Bias to apply to the texture coordinate set to apply a wrap to.
  1574.    D3DRENDERSTATE_WRAPBIAS                = 128;
  1575.    {$EXTERNALSYM D3DRENDERSTATE_WRAPBIAS}
  1576. (* Flags to construct the WRAP render states *)
  1577.   D3DWRAP_U   = $00000001;
  1578.   {$EXTERNALSYM D3DWRAP_U}
  1579.   D3DWRAP_V   = $00000002;
  1580.   {$EXTERNALSYM D3DWRAP_V}
  1581. {$ENDIF} // DIRECT3D_VERSION_6
  1582. {$IFDEF DIRECT3D_VERSION_7}
  1583. (* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
  1584.   D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
  1585.   {$EXTERNALSYM D3DWRAPCOORD_0}
  1586.   D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
  1587.   {$EXTERNALSYM D3DWRAPCOORD_1}
  1588.   D3DWRAPCOORD_2   = $00000004;
  1589.   {$EXTERNALSYM D3DWRAPCOORD_2}
  1590.   D3DWRAPCOORD_3   = $00000008;
  1591.   {$EXTERNALSYM D3DWRAPCOORD_3}
  1592. {$ENDIF} // DIRECT3D_VERSION_7
  1593. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1594. function D3DRENDERSTATE_STIPPLEPATTERN(y: Integer): TD3DRenderStateType;
  1595. {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN}
  1596. type
  1597.   PD3DState = ^TD3DState;
  1598.   _D3DSTATE = packed record
  1599.     case Integer of
  1600.     {$IFDEF DIRECT3D_VERSION_LESS_8}
  1601.     0: (
  1602.       dtstTransformStateType: TD3DTransformStateType;
  1603.      );
  1604.     {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1605.     1: (
  1606.       dlstLightStateType: TD3DLightStateType;
  1607.       dwArg: array [0..0] of DWORD;
  1608.      );
  1609.     2: (
  1610.       drstRenderStateType: TD3DRenderStateType;
  1611.       dvArg: array [0..0] of TD3DValue;
  1612.      );
  1613.   end;
  1614.   {$EXTERNALSYM _D3DSTATE}
  1615.   D3DSTATE = _D3DSTATE;
  1616.   {$EXTERNALSYM D3DSTATE}
  1617.   TD3DState = _D3DSTATE;
  1618. (*
  1619.  * Operation used to load matrices
  1620.  * hDstMat = hSrcMat
  1621.  *)
  1622.   PD3DMatrixLoad = ^TD3DMatrixLoad;
  1623.   _D3DMATRIXLOAD = packed record
  1624.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  1625.     hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
  1626.   end;
  1627.   {$EXTERNALSYM _D3DMATRIXLOAD}
  1628.   D3DMATRIXLOAD = _D3DMATRIXLOAD;
  1629.   {$EXTERNALSYM D3DMATRIXLOAD}
  1630.   TD3DMatrixLoad = _D3DMATRIXLOAD;
  1631. (*
  1632.  * Operation used to multiply matrices
  1633.  * hDstMat = hSrcMat1 * hSrcMat2
  1634.  *)
  1635.   PD3DMatrixMultiply = ^TD3DMatrixMultiply;
  1636.   _D3DMATRIXMULTIPLY = packed record
  1637.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  1638.     hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
  1639.     hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
  1640.   end;
  1641.   {$EXTERNALSYM _D3DMATRIXMULTIPLY}
  1642.   D3DMATRIXMULTIPLY = _D3DMATRIXMULTIPLY;
  1643.   {$EXTERNALSYM D3DMATRIXMULTIPLY}
  1644.   TD3DMatrixMultiply = _D3DMATRIXMULTIPLY;
  1645. (*
  1646.  * Operation used to transform and light vertices.
  1647.  *)
  1648.   PD3DProcessVertices = ^TD3DProcessVertices;
  1649.   _D3DPROCESSVERTICES = packed record
  1650.     dwFlags: DWORD;           (* Do we transform or light or just copy? *)
  1651.     wStart: WORD;             (* Index to first vertex in source *)
  1652.     wDest: WORD;              (* Index to first vertex in local buffer *)
  1653.     dwCount: DWORD;           (* Number of vertices to be processed *)
  1654.     dwReserved: DWORD;        (* Must be zero *)
  1655.   end;
  1656.   {$EXTERNALSYM _D3DPROCESSVERTICES}
  1657.   D3DPROCESSVERTICES = _D3DPROCESSVERTICES;
  1658.   {$EXTERNALSYM D3DPROCESSVERTICES}
  1659.   TD3DProcessVertices = _D3DPROCESSVERTICES;
  1660. const
  1661.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  1662.   {$EXTERNALSYM D3DPROCESSVERTICES_TRANSFORMLIGHT}
  1663.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  1664.   {$EXTERNALSYM D3DPROCESSVERTICES_TRANSFORM}
  1665.   D3DPROCESSVERTICES_COPY                 = $00000002;
  1666.   {$EXTERNALSYM D3DPROCESSVERTICES_COPY}
  1667.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  1668.   {$EXTERNALSYM D3DPROCESSVERTICES_OPMASK}
  1669.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  1670.   {$EXTERNALSYM D3DPROCESSVERTICES_UPDATEEXTENTS}
  1671.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  1672.   {$EXTERNALSYM D3DPROCESSVERTICES_NOCOLOR}
  1673. {$IFDEF DIRECT3D_VERSION_6}
  1674. {$IFDEF DIRECT3D_VERSION_LESS_8}
  1675. (*
  1676.  * State enumerants for per-stage texture processing.
  1677.  *)
  1678. type
  1679.   PD3DTextureStageStateType = ^TD3DTextureStageStateType;
  1680.   TD3DTextureStageStateType = DWORD;
  1681. const
  1682.   D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
  1683.   {$EXTERNALSYM D3DTSS_COLOROP}
  1684.   D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
  1685.   {$EXTERNALSYM D3DTSS_COLORARG1}
  1686.   D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
  1687.   {$EXTERNALSYM D3DTSS_COLORARG2}
  1688.   D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
  1689.   {$EXTERNALSYM D3DTSS_ALPHAOP}
  1690.   D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
  1691.   {$EXTERNALSYM D3DTSS_ALPHAARG1}
  1692.   D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
  1693.   {$EXTERNALSYM D3DTSS_ALPHAARG2}
  1694.   D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
  1695.   {$EXTERNALSYM D3DTSS_BUMPENVMAT00}
  1696.   D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
  1697.   {$EXTERNALSYM D3DTSS_BUMPENVMAT01}
  1698.   D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
  1699.   {$EXTERNALSYM D3DTSS_BUMPENVMAT10}
  1700.   D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
  1701.   {$EXTERNALSYM D3DTSS_BUMPENVMAT11}
  1702.   D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
  1703.   {$EXTERNALSYM D3DTSS_TEXCOORDINDEX}
  1704.   D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
  1705.   {$EXTERNALSYM D3DTSS_ADDRESS}
  1706.   D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
  1707.   {$EXTERNALSYM D3DTSS_ADDRESSU}
  1708.   D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
  1709.   {$EXTERNALSYM D3DTSS_ADDRESSV}
  1710.   D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
  1711.   {$EXTERNALSYM D3DTSS_BORDERCOLOR}
  1712.   D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
  1713.   {$EXTERNALSYM D3DTSS_MAGFILTER}
  1714.   D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
  1715.   {$EXTERNALSYM D3DTSS_MINFILTER}
  1716.   D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
  1717.   {$EXTERNALSYM D3DTSS_MIPFILTER}
  1718.   D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
  1719.   {$EXTERNALSYM D3DTSS_MIPMAPLODBIAS}
  1720.   D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
  1721.   {$EXTERNALSYM D3DTSS_MAXMIPLEVEL}
  1722.   D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
  1723.   {$EXTERNALSYM D3DTSS_MAXANISOTROPY}
  1724.   D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
  1725.   {$EXTERNALSYM D3DTSS_BUMPENVLSCALE}
  1726.   D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
  1727.   {$EXTERNALSYM D3DTSS_BUMPENVLOFFSET}
  1728. {$IFDEF DIRECT3D_VERSION_7}
  1729.   D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
  1730.   {$EXTERNALSYM D3DTSS_TEXTURETRANSFORMFLAGS}
  1731. {$ENDIF}
  1732. {$IFDEF DIRECT3D_VERSION_7}
  1733. // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
  1734. // and normal in the camera space) should be taken as texture coordinates
  1735. // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
  1736. //
  1737.   D3DTSS_TCI_PASSTHRU                             = $00000000;
  1738.   {$EXTERNALSYM D3DTSS_TCI_PASSTHRU}
  1739.   D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
  1740.   {$EXTERNALSYM D3DTSS_TCI_CAMERASPACENORMAL}
  1741.   D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
  1742.   {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEPOSITION}
  1743.   D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
  1744.   {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR}
  1745. {$ENDIF}
  1746. type
  1747. (*
  1748.  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
  1749.  * texture processing stage controls in D3DRENDERSTATE.
  1750.  *)
  1751.   PD3DTextureOp = ^TD3DTextureOp;
  1752.   _D3DTEXTUREOP = (
  1753.     D3DTOP_INVALID_0,
  1754. // Control
  1755.     D3DTOP_DISABLE   ,      // disables stage
  1756.     D3DTOP_SELECTARG1,      // the default
  1757.     D3DTOP_SELECTARG2,
  1758. // Modulate
  1759.     D3DTOP_MODULATE  ,      // multiply args together
  1760.     D3DTOP_MODULATE2X,      // multiply and  1 bit
  1761.     D3DTOP_MODULATE4X,      // multiply and  2 bits
  1762. // Add
  1763.     D3DTOP_ADD        ,   // add arguments together
  1764.     D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
  1765.     D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
  1766.     D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
  1767.     D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
  1768.                           // Arg1 + Arg2 - Arg1*Arg2
  1769.                           // = Arg1 + (1-Arg1)*Arg2
  1770. // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  1771.     D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
  1772.     D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
  1773.     D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  1774.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  1775.     D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
  1776.     D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
  1777. // Specular mapping
  1778.     D3DTOP_PREMODULATE           ,     // modulate with next texture before use
  1779.     D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
  1780.                                        // COLOROP only
  1781.     D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
  1782.                                             // COLOROP only
  1783.     D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  1784.                                        // COLOROP only
  1785.     D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  1786.                                             // COLOROP only
  1787. // Bump mapping
  1788.     D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
  1789.     D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
  1790.     // This can do either diffuse or specular bump mapping with correct input.
  1791.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  1792.     // where each component has been scaled and offset to make it signed.
  1793.     // The result is replicated into all four (including alpha) channels.
  1794.     // This is a valid COLOROP only.
  1795.     D3DTOP_DOTPRODUCT3
  1796.   );
  1797.   {$EXTERNALSYM _D3DTEXTUREOP}
  1798.   D3DTEXTUREOP = _D3DTEXTUREOP;
  1799.   {$EXTERNALSYM D3DTEXTUREOP}
  1800.   TD3DTextureOp = _D3DTEXTUREOP;
  1801. (*
  1802.  * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  1803.  * set in texture processing stage controls in D3DRENDERSTATE.
  1804.  *)
  1805. const
  1806.   D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
  1807.   {$EXTERNALSYM D3DTA_SELECTMASK}
  1808.   D3DTA_DIFFUSE           = $00000000;  // select diffuse color
  1809.   {$EXTERNALSYM D3DTA_DIFFUSE}
  1810.   D3DTA_CURRENT           = $00000001;  // select result of previous stage
  1811.   {$EXTERNALSYM D3DTA_CURRENT}
  1812.   D3DTA_TEXTURE           = $00000002;  // select texture color
  1813.   {$EXTERNALSYM D3DTA_TEXTURE}
  1814.   D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
  1815.   {$EXTERNALSYM D3DTA_TFACTOR}
  1816. {$IFDEF DIRECT3D_VERSION_7}
  1817.   D3DTA_SPECULAR          = $00000004;  // select specular color
  1818.   {$EXTERNALSYM D3DTA_SPECULAR}
  1819. {$ENDIF}
  1820.   D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
  1821.   {$EXTERNALSYM D3DTA_COMPLEMENT}
  1822.   D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
  1823.   {$EXTERNALSYM D3DTA_ALPHAREPLICATE}
  1824. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  1825. (*
  1826.  *  IDirect3DTexture2 State Filter Types
  1827.  *)
  1828. type
  1829.   PD3DTextureMagFilter = ^TD3DTextureMagFilter;
  1830.   _D3DTEXTUREMAGFILTER = (
  1831.     D3DTFG_INVALID_0,
  1832.     D3DTFG_POINT        ,    // nearest
  1833.     D3DTFG_LINEAR       ,    // linear interpolation
  1834.     D3DTFG_FLATCUBIC    ,    // cubic
  1835.     D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
  1836.     D3DTFG_ANISOTROPIC
  1837.   );
  1838.   {$EXTERNALSYM _D3DTEXTUREMAGFILTER}
  1839.   D3DTEXTUREMAGFILTER = _D3DTEXTUREMAGFILTER;
  1840.   {$EXTERNALSYM D3DTEXTUREMAGFILTER}
  1841.   TD3DTextureMagFilter = _D3DTEXTUREMAGFILTER;
  1842.   PD3DTextureMinFilter = ^TD3DTextureMinFilter;
  1843.   _D3DTEXTUREMINFILTER = (
  1844.     D3DTFN_INVALID_0,
  1845.     D3DTFN_POINT      ,    // nearest
  1846.     D3DTFN_LINEAR     ,    // linear interpolation
  1847.     D3DTFN_ANISOTROPIC
  1848.   );
  1849.   {$EXTERNALSYM _D3DTEXTUREMINFILTER}
  1850.   D3DTEXTUREMINFILTER = _D3DTEXTUREMINFILTER;
  1851.   {$EXTERNALSYM D3DTEXTUREMINFILTER}
  1852.   TD3DTextureMinFilter = _D3DTEXTUREMINFILTER;
  1853.   PD3DTextureMipFilter = ^TD3DTextureMipFilter;
  1854.   _D3DTEXTUREMIPFILTER = (
  1855.     D3DTFP_INVALID_0,
  1856.     D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
  1857.     D3DTFP_POINT  ,    // nearest
  1858.     D3DTFP_LINEAR      // linear interpolation
  1859.   );
  1860.   {$EXTERNALSYM _D3DTEXTUREMIPFILTER}
  1861.   D3DTEXTUREMIPFILTER = _D3DTEXTUREMIPFILTER;
  1862.   {$EXTERNALSYM D3DTEXTUREMIPFILTER}
  1863.   TD3DTextureMipFilter = _D3DTEXTUREMIPFILTER;
  1864. {$ENDIF} // DIRECT3D_VERSION_6
  1865. (*
  1866.  * Triangle flags
  1867.  *)
  1868. (*
  1869.  * Tri strip and fan flags.
  1870.  * START loads all three vertices
  1871.  * EVEN and ODD load just v3 with even or odd culling
  1872.  * START_FLAT contains a count from 0 to 29 that allows the
  1873.  * whole strip or fan to be culled in one hit.
  1874.  * e.g. for a quad len = 1
  1875.  *)
  1876. const
  1877.   D3DTRIFLAG_START                        = $00000000;
  1878.   {$EXTERNALSYM D3DTRIFLAG_START}
  1879. // #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
  1880. function D3DTRIFLAG_STARTFLAT(len: DWORD): DWORD;
  1881. {$EXTERNALSYM D3DTRIFLAG_STARTFLAT}
  1882. const
  1883.   D3DTRIFLAG_ODD                          = $0000001e;
  1884.   {$EXTERNALSYM D3DTRIFLAG_ODD}
  1885.   D3DTRIFLAG_EVEN                         = $0000001f;
  1886.   {$EXTERNALSYM D3DTRIFLAG_EVEN}
  1887. (*
  1888.  * Triangle edge flags
  1889.  * enable edges for wireframe or antialiasing
  1890.  *)
  1891.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
  1892.   {$EXTERNALSYM D3DTRIFLAG_EDGEENABLE1}
  1893.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
  1894.   {$EXTERNALSYM D3DTRIFLAG_EDGEENABLE2}
  1895.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
  1896.   {$EXTERNALSYM D3DTRIFLAG_EDGEENABLE3}
  1897.   D3DTRIFLAG_EDGEENABLETRIANGLE = (
  1898.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
  1899.   {$EXTERNALSYM D3DTRIFLAG_EDGEENABLETRIANGLE}
  1900. (*
  1901.  * Primitive structures and related defines.  Vertex offsets are to types
  1902.  * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
  1903.  *)
  1904. (*
  1905.  * Triangle list primitive structure
  1906.  *)
  1907. type
  1908.   PD3DTriangle = ^TD3DTriangle;
  1909.   _D3DTRIANGLE = packed record
  1910.     case Integer of
  1911.     0: (
  1912.       v1: WORD;            (* Vertex indices *)
  1913.       v2: WORD;
  1914.       v3: WORD;
  1915.       wFlags: WORD;        (* Edge (and other) flags *)
  1916.      );
  1917.     1: (
  1918.       wV1: WORD;
  1919.       wV2: WORD;
  1920.       wV3: WORD;
  1921.      );
  1922.   end;
  1923.   {$EXTERNALSYM _D3DTRIANGLE}
  1924.   D3DTRIANGLE = _D3DTRIANGLE;
  1925.   {$EXTERNALSYM D3DTRIANGLE}
  1926.   TD3DTriangle = _D3DTRIANGLE;
  1927. (*
  1928.  * Line strip structure.
  1929.  * The instruction count - 1 defines the number of line segments.
  1930.  *)
  1931.   PD3DLine = ^TD3DLine;
  1932.   _D3DLINE = packed record
  1933.     case Integer of
  1934.     0: (
  1935.       v1: WORD;            (* Vertex indices *)
  1936.       v2: WORD;
  1937.      );
  1938.     1: (
  1939.       wV1: WORD;
  1940.       wV2: WORD;
  1941.      );
  1942.   end;
  1943.   {$EXTERNALSYM _D3DLINE}
  1944.   D3DLINE = _D3DLINE;
  1945.   {$EXTERNALSYM D3DLINE}
  1946.   TD3DLine = _D3DLINE;
  1947. (*
  1948.  * Span structure
  1949.  * Spans join a list of points with the same y value.
  1950.  * If the y value changes, a new span is started.
  1951.  *)
  1952.   PD3DSpan = ^TD3DSpan;
  1953.   _D3DSPAN = packed record
  1954.     wCount: WORD;        (* Number of spans *)
  1955.     wFirst: WORD;        (* Index to first vertex *)
  1956.   end;
  1957.   {$EXTERNALSYM _D3DSPAN}
  1958.   D3DSPAN = _D3DSPAN;
  1959.   {$EXTERNALSYM D3DSPAN}
  1960.   TD3DSpan = _D3DSPAN;
  1961. (*
  1962.  * Point structure
  1963.  *)
  1964.   PD3DPoint = ^TD3DPoint;
  1965.   _D3DPOINT = packed record
  1966.     wCount: WORD;        (* number of points         *)
  1967.     wFirst: WORD;        (* index to first vertex    *)
  1968.   end;
  1969.   {$EXTERNALSYM _D3DPOINT}
  1970.   D3DPOINT = _D3DPOINT;
  1971.   {$EXTERNALSYM D3DPOINT}
  1972.   TD3DPoint = _D3DPOINT;
  1973. (*
  1974.  * Forward branch structure.
  1975.  * Mask is logically anded with the driver status mask
  1976.  * if the result equals 'value', the branch is taken.
  1977.  *)
  1978.   PD3DBranch = ^TD3DBranch;
  1979.   _D3DBRANCH = packed record
  1980.     dwMask: DWORD;         (* Bitmask against D3D status *)
  1981.     dwValue: DWORD;
  1982.     bNegate: BOOL;         (* TRUE to negate comparison *)
  1983.     dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
  1984.   end;
  1985.   {$EXTERNALSYM _D3DBRANCH}
  1986.   D3DBRANCH = _D3DBRANCH;
  1987.   {$EXTERNALSYM D3DBRANCH}
  1988.   TD3DBranch = _D3DBRANCH;
  1989. (*
  1990.  * Status used for set status instruction.
  1991.  * The D3D status is initialised on device creation
  1992.  * and is modified by all execute calls.
  1993.  *)
  1994.   PD3DStatus = ^TD3DStatus;
  1995.   _D3DSTATUS = packed record
  1996.     dwFlags: DWORD;        (* Do we set extents or status *)
  1997.     dwStatus: DWORD;       (* D3D status *)
  1998.     drExtent: TD3DRect;
  1999.   end;
  2000.   {$EXTERNALSYM _D3DSTATUS}
  2001.   D3DSTATUS = _D3DSTATUS;
  2002.   {$EXTERNALSYM D3DSTATUS}
  2003.   TD3DStatus = _D3DSTATUS;
  2004. const
  2005.   D3DSETSTATUS_STATUS    = $00000001;
  2006.   {$EXTERNALSYM D3DSETSTATUS_STATUS}
  2007.   D3DSETSTATUS_EXTENTS   = $00000002;
  2008.   {$EXTERNALSYM D3DSETSTATUS_EXTENTS}
  2009.   D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
  2010.   {$EXTERNALSYM D3DSETSTATUS_ALL}
  2011. {$IFDEF DIRECT3D_VERSION_5}
  2012. type
  2013.   PD3DClipStatus = ^TD3DClipStatus;
  2014.   _D3DCLIPSTATUS = packed record
  2015.     dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
  2016.     dwStatus : DWORD; (* Clip status *)
  2017.     minx, maxx : Single; (* X extents *)
  2018.     miny, maxy : Single; (* Y extents *)
  2019.     minz, maxz : Single; (* Z extents *)
  2020.   end;
  2021.   {$EXTERNALSYM _D3DCLIPSTATUS}
  2022.   D3DCLIPSTATUS = _D3DCLIPSTATUS;
  2023.   {$EXTERNALSYM D3DCLIPSTATUS}
  2024.   TD3DClipStatus = _D3DCLIPSTATUS;
  2025. const
  2026.   D3DCLIPSTATUS_STATUS        = $00000001;
  2027.   {$EXTERNALSYM D3DCLIPSTATUS_STATUS}
  2028.   D3DCLIPSTATUS_EXTENTS2      = $00000002;
  2029.   {$EXTERNALSYM D3DCLIPSTATUS_EXTENTS2}
  2030.   D3DCLIPSTATUS_EXTENTS3      = $00000004;
  2031.   {$EXTERNALSYM D3DCLIPSTATUS_EXTENTS3}
  2032. {$ENDIF} // DIRECT3D_VERSION_5
  2033. (*
  2034.  * Statistics structure
  2035.  *)
  2036. type
  2037.   PD3DStats = ^TD3DStats;
  2038.   _D3DSTATS = packed record
  2039.     dwSize: DWORD;
  2040.     dwTrianglesDrawn: DWORD;
  2041.     dwLinesDrawn: DWORD;
  2042.     dwPointsDrawn: DWORD;
  2043.     dwSpansDrawn: DWORD;
  2044.     dwVerticesProcessed: DWORD;
  2045.   end;
  2046.   {$EXTERNALSYM _D3DSTATS}
  2047.   D3DSTATS = _D3DSTATS;
  2048.   {$EXTERNALSYM D3DSTATS}
  2049.   TD3DStats = _D3DSTATS;
  2050. (*
  2051.  * Execute options.
  2052.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  2053.  * inside the buffer must be contained within the viewport.
  2054.  *)
  2055. const
  2056.   D3DEXECUTE_CLIPPED       = $00000001;
  2057.   {$EXTERNALSYM D3DEXECUTE_CLIPPED}
  2058.   D3DEXECUTE_UNCLIPPED     = $00000002;
  2059.   {$EXTERNALSYM D3DEXECUTE_UNCLIPPED}
  2060. type
  2061.   PD3DExecuteData = ^TD3DExecuteData;
  2062.   _D3DEXECUTEDATA = packed record
  2063.     dwSize: DWORD;
  2064.     dwVertexOffset: DWORD;
  2065.     dwVertexCount: DWORD;
  2066.     dwInstructionOffset: DWORD;
  2067.     dwInstructionLength: DWORD;
  2068.     dwHVertexOffset: DWORD;
  2069.     dsStatus: TD3DStatus;       (* Status after execute *)
  2070.   end;
  2071.   {$EXTERNALSYM _D3DEXECUTEDATA}
  2072.   D3DEXECUTEDATA = _D3DEXECUTEDATA;
  2073.   {$EXTERNALSYM D3DEXECUTEDATA}
  2074.   TD3DExecuteData = _D3DEXECUTEDATA;
  2075. (*
  2076.  * Palette flags.
  2077.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  2078.  *)
  2079. const
  2080.   D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
  2081.   {$EXTERNALSYM D3DPAL_FREE}
  2082.   D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
  2083.   {$EXTERNALSYM D3DPAL_READONLY}
  2084.   D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
  2085.   {$EXTERNALSYM D3DPAL_RESERVED}
  2086. {$IFDEF DIRECT3D_VERSION_6}
  2087. type
  2088.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  2089.   _D3DVERTEXBUFFERDESC = packed record
  2090.     dwSize : DWORD;
  2091.     dwCaps : DWORD;
  2092.     dwFVF : DWORD;
  2093.     dwNumVertices : DWORD;
  2094.   end;
  2095.   {$EXTERNALSYM _D3DVERTEXBUFFERDESC}
  2096.   D3DVERTEXBUFFERDESC = _D3DVERTEXBUFFERDESC;
  2097.   {$EXTERNALSYM D3DVERTEXBUFFERDESC}
  2098.   TD3DVertexBufferDesc = _D3DVERTEXBUFFERDESC;
  2099. const
  2100. (* These correspond to DDSCAPS_* flags *)
  2101.   D3DVBCAPS_SYSTEMMEMORY      = $00000800;
  2102.   {$EXTERNALSYM D3DVBCAPS_SYSTEMMEMORY}
  2103.   D3DVBCAPS_WRITEONLY         = $00010000;
  2104.   {$EXTERNALSYM D3DVBCAPS_WRITEONLY}
  2105.   D3DVBCAPS_OPTIMIZED         = $80000000;
  2106.   {$EXTERNALSYM D3DVBCAPS_OPTIMIZED}
  2107.   D3DVBCAPS_DONOTCLIP         = $00000001;
  2108.   {$EXTERNALSYM D3DVBCAPS_DONOTCLIP}
  2109. (* Vertex Operations for ProcessVertices *)
  2110.   D3DVOP_LIGHT      = (1 shl 10);
  2111.   {$EXTERNALSYM D3DVOP_LIGHT}
  2112.   D3DVOP_TRANSFORM  = (1 shl 0);
  2113.   {$EXTERNALSYM D3DVOP_TRANSFORM}
  2114.   D3DVOP_CLIP       = (1 shl 2);
  2115.   {$EXTERNALSYM D3DVOP_CLIP}
  2116.   D3DVOP_EXTENTS    = (1 shl 3);
  2117.   {$EXTERNALSYM D3DVOP_EXTENTS}
  2118. {$IFDEF DIRECT3D_VERSION_LESS_8}
  2119. (* The maximum number of vertices user can pass to any d3d
  2120.    drawing function or to create vertex buffer with
  2121. *)
  2122.   D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
  2123.   {$EXTERNALSYM D3DMAXNUMVERTICES}
  2124. (* The maximum number of primitives user can pass to any d3d
  2125.    drawing function.
  2126. *)
  2127.   D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
  2128.   {$EXTERNALSYM D3DMAXNUMPRIMITIVES}
  2129. {$IFDEF DIRECT3D_VERSION_7}
  2130. (* Bits for dwFlags in ProcessVertices call *)
  2131.   D3DPV_DONOTCOPYDATA = (1 shl 0);
  2132.   {$EXTERNALSYM D3DPV_DONOTCOPYDATA}
  2133. {$ENDIF} // DIRECT3D_VERSION_7
  2134. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  2135. //-------------------------------------------------------------------
  2136. {$IFDEF DIRECT3D_VERSION_LESS_8}
  2137. // Flexible vertex format bits
  2138. //
  2139.   D3DFVF_RESERVED0        = $001;
  2140.   {$EXTERNALSYM D3DFVF_RESERVED0}
  2141.   D3DFVF_POSITION_MASK    = $00E;
  2142.   {$EXTERNALSYM D3DFVF_POSITION_MASK}
  2143.   D3DFVF_XYZ              = $002;
  2144.   {$EXTERNALSYM D3DFVF_XYZ}
  2145.   D3DFVF_XYZRHW           = $004;
  2146.   {$EXTERNALSYM D3DFVF_XYZRHW}
  2147. {$IFDEF DIRECT3D_VERSION_7}
  2148.   D3DFVF_XYZB1            = $006;
  2149.   {$EXTERNALSYM D3DFVF_XYZB1}
  2150.   D3DFVF_XYZB2            = $008;
  2151.   {$EXTERNALSYM D3DFVF_XYZB2}
  2152.   D3DFVF_XYZB3            = $00a;
  2153.   {$EXTERNALSYM D3DFVF_XYZB3}
  2154.   D3DFVF_XYZB4            = $00c;
  2155.   {$EXTERNALSYM D3DFVF_XYZB4}
  2156.   D3DFVF_XYZB5            = $00e;
  2157.   {$EXTERNALSYM D3DFVF_XYZB5}
  2158. {$ENDIF} // DIRECT3D_VERSION_7
  2159.   D3DFVF_NORMAL           = $010;
  2160.   {$EXTERNALSYM D3DFVF_NORMAL}
  2161.   D3DFVF_RESERVED1        = $020;
  2162.   {$EXTERNALSYM D3DFVF_RESERVED1}
  2163.   D3DFVF_DIFFUSE          = $040;
  2164.   {$EXTERNALSYM D3DFVF_DIFFUSE}
  2165.   D3DFVF_SPECULAR         = $080;
  2166.   {$EXTERNALSYM D3DFVF_SPECULAR}
  2167.   D3DFVF_TEXCOUNT_MASK    = $f00;
  2168.   {$EXTERNALSYM D3DFVF_TEXCOUNT_MASK}
  2169.   D3DFVF_TEXCOUNT_SHIFT   = 8;
  2170.   {$EXTERNALSYM D3DFVF_TEXCOUNT_SHIFT}
  2171.   D3DFVF_TEX0             = $000;
  2172.   {$EXTERNALSYM D3DFVF_TEX0}
  2173.   D3DFVF_TEX1             = $100;
  2174.   {$EXTERNALSYM D3DFVF_TEX1}
  2175.   D3DFVF_TEX2             = $200;
  2176.   {$EXTERNALSYM D3DFVF_TEX2}
  2177.   D3DFVF_TEX3             = $300;
  2178.   {$EXTERNALSYM D3DFVF_TEX3}
  2179.   D3DFVF_TEX4             = $400;
  2180.   {$EXTERNALSYM D3DFVF_TEX4}
  2181.   D3DFVF_TEX5             = $500;
  2182.   {$EXTERNALSYM D3DFVF_TEX5}
  2183.   D3DFVF_TEX6             = $600;
  2184.   {$EXTERNALSYM D3DFVF_TEX6}
  2185.   D3DFVF_TEX7             = $700;
  2186.   {$EXTERNALSYM D3DFVF_TEX7}
  2187.   D3DFVF_TEX8             = $800;
  2188.   {$EXTERNALSYM D3DFVF_TEX8}
  2189.   D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
  2190.   {$EXTERNALSYM D3DFVF_RESERVED2}
  2191. {$ELSE}
  2192.   D3DFVF_RESERVED1        = $020;
  2193.   {$EXTERNALSYM D3DFVF_RESERVED1}
  2194. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  2195.   D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
  2196.   {$EXTERNALSYM D3DFVF_VERTEX}
  2197.   D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
  2198.                          D3DFVF_SPECULAR or D3DFVF_TEX1 );
  2199.   {$EXTERNALSYM D3DFVF_LVERTEX}
  2200.   D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
  2201.                           D3DFVF_TEX1 );
  2202.   {$EXTERNALSYM D3DFVF_TLVERTEX}
  2203. type
  2204.   PD3DDP_PtrStride = ^TD3DDP_PtrStride;
  2205.   _D3DDP_PTRSTRIDE = packed record
  2206.     lpvData : pointer;
  2207.     dwStride : DWORD;
  2208.   end;
  2209.   {$EXTERNALSYM _D3DDP_PTRSTRIDE}
  2210.   D3DDP_PTRSTRIDE = _D3DDP_PTRSTRIDE;
  2211.   {$EXTERNALSYM D3DDP_PTRSTRIDE}
  2212.   TD3DDP_PtrStride = _D3DDP_PTRSTRIDE;
  2213.   TD3DDPPtrStride = _D3DDP_PTRSTRIDE;
  2214.   PD3DDPPtrStride = ^TD3DDPPtrStride;
  2215. const
  2216.   D3DDP_MAXTEXCOORD = 8;
  2217.   {$EXTERNALSYM D3DDP_MAXTEXCOORD}
  2218. type
  2219.   PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
  2220.   _D3DDRAWPRIMITIVESTRIDEDDATA = packed record
  2221.     position : TD3DDP_PtrStride;
  2222.     normal : TD3DDP_PtrStride;
  2223.     diffuse : TD3DDP_PtrStride;
  2224.     specular : TD3DDP_PtrStride;
  2225.     textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
  2226.   end;
  2227.   {$EXTERNALSYM _D3DDRAWPRIMITIVESTRIDEDDATA}
  2228.   D3DDRAWPRIMITIVESTRIDEDDATA = _D3DDRAWPRIMITIVESTRIDEDDATA;
  2229.   {$EXTERNALSYM D3DDRAWPRIMITIVESTRIDEDDATA}
  2230.   TD3DDrawPrimitiveStridedData = _D3DDRAWPRIMITIVESTRIDEDDATA;
  2231. //---------------------------------------------------------------------
  2232. // ComputeSphereVisibility return values
  2233. //
  2234. const
  2235.   D3DVIS_INSIDE_FRUSTUM      = 0;
  2236.   {$EXTERNALSYM D3DVIS_INSIDE_FRUSTUM}
  2237.   D3DVIS_INTERSECT_FRUSTUM   = 1;
  2238.   {$EXTERNALSYM D3DVIS_INTERSECT_FRUSTUM}
  2239.   D3DVIS_OUTSIDE_FRUSTUM     = 2;
  2240.   {$EXTERNALSYM D3DVIS_OUTSIDE_FRUSTUM}
  2241.   D3DVIS_INSIDE_LEFT         = 0;
  2242.   {$EXTERNALSYM D3DVIS_INSIDE_LEFT}
  2243.   D3DVIS_INTERSECT_LEFT      = (1 shl 2);
  2244.   {$EXTERNALSYM D3DVIS_INTERSECT_LEFT}
  2245.   D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
  2246.   {$EXTERNALSYM D3DVIS_OUTSIDE_LEFT}
  2247.   D3DVIS_INSIDE_RIGHT        = 0;
  2248.   {$EXTERNALSYM D3DVIS_INSIDE_RIGHT}
  2249.   D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
  2250.   {$EXTERNALSYM D3DVIS_INTERSECT_RIGHT}
  2251.   D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
  2252.   {$EXTERNALSYM D3DVIS_OUTSIDE_RIGHT}
  2253.   D3DVIS_INSIDE_TOP          = 0;
  2254.   {$EXTERNALSYM D3DVIS_INSIDE_TOP}
  2255.   D3DVIS_INTERSECT_TOP       = (1 shl 6);
  2256.   {$EXTERNALSYM D3DVIS_INTERSECT_TOP}
  2257.   D3DVIS_OUTSIDE_TOP         = (2 shl 6);
  2258.   {$EXTERNALSYM D3DVIS_OUTSIDE_TOP}
  2259.   D3DVIS_INSIDE_BOTTOM       = 0;
  2260.   {$EXTERNALSYM D3DVIS_INSIDE_BOTTOM}
  2261.   D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
  2262.   {$EXTERNALSYM D3DVIS_INTERSECT_BOTTOM}
  2263.   D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
  2264.   {$EXTERNALSYM D3DVIS_OUTSIDE_BOTTOM}
  2265.   D3DVIS_INSIDE_NEAR         = 0;
  2266.   {$EXTERNALSYM D3DVIS_INSIDE_NEAR}
  2267.   D3DVIS_INTERSECT_NEAR      = (1 shl 10);
  2268.   {$EXTERNALSYM D3DVIS_INTERSECT_NEAR}
  2269.   D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
  2270.   {$EXTERNALSYM D3DVIS_OUTSIDE_NEAR}
  2271.   D3DVIS_INSIDE_FAR          = 0;
  2272.   {$EXTERNALSYM D3DVIS_INSIDE_FAR}
  2273.   D3DVIS_INTERSECT_FAR       = (1 shl 12);
  2274.   {$EXTERNALSYM D3DVIS_INTERSECT_FAR}
  2275.   D3DVIS_OUTSIDE_FAR         = (2 shl 12);
  2276.   {$EXTERNALSYM D3DVIS_OUTSIDE_FAR}
  2277.   D3DVIS_MASK_FRUSTUM        = (3 shl 0);
  2278.   {$EXTERNALSYM D3DVIS_MASK_FRUSTUM}
  2279.   D3DVIS_MASK_LEFT           = (3 shl 2);
  2280.   {$EXTERNALSYM D3DVIS_MASK_LEFT}
  2281.   D3DVIS_MASK_RIGHT          = (3 shl 4);
  2282.   {$EXTERNALSYM D3DVIS_MASK_RIGHT}
  2283.   D3DVIS_MASK_TOP            = (3 shl 6);
  2284.   {$EXTERNALSYM D3DVIS_MASK_TOP}
  2285.   D3DVIS_MASK_BOTTOM         = (3 shl 8);
  2286.   {$EXTERNALSYM D3DVIS_MASK_BOTTOM}
  2287.   D3DVIS_MASK_NEAR           = (3 shl 10);
  2288.   {$EXTERNALSYM D3DVIS_MASK_NEAR}
  2289.   D3DVIS_MASK_FAR            = (3 shl 12);
  2290.   {$EXTERNALSYM D3DVIS_MASK_FAR}
  2291. {$ENDIF} // DIRECT3D_VERSION_6
  2292. {$IFDEF DIRECT3D_VERSION_LESS_8}
  2293. {$IFDEF DIRECT3D_VERSION_7}
  2294. // To be used with GetInfo()
  2295.   D3DDEVINFOID_TEXTUREMANAGER    = 1;
  2296.   {$EXTERNALSYM D3DDEVINFOID_TEXTUREMANAGER}
  2297.   D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
  2298.   {$EXTERNALSYM D3DDEVINFOID_D3DTEXTUREMANAGER}
  2299.   D3DDEVINFOID_TEXTURING         = 3;
  2300.   {$EXTERNALSYM D3DDEVINFOID_TEXTURING}
  2301. type
  2302.   PD3DStateBlockType = ^TD3DStateBlockType;
  2303.   _D3DSTATEBLOCKTYPE = (
  2304.     D3DSBT_INVALID_0   ,
  2305.     D3DSBT_ALL         , // capture all state
  2306.     D3DSBT_PIXELSTATE  , // capture pixel state
  2307.     D3DSBT_VERTEXSTATE   // capture vertex state
  2308.   );
  2309.   {$EXTERNALSYM _D3DSTATEBLOCKTYPE}
  2310.   D3DSTATEBLOCKTYPE = _D3DSTATEBLOCKTYPE;
  2311.   {$EXTERNALSYM D3DSTATEBLOCKTYPE}
  2312.   TD3DStateBlockType = _D3DSTATEBLOCKTYPE;
  2313. // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
  2314. //
  2315.   PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
  2316.   _D3DVERTEXBLENDFLAGS = (
  2317.     D3DVBLEND_DISABLE , // Disable vertex blending
  2318.     D3DVBLEND_1WEIGHT , // blend between 2 matrices
  2319.     D3DVBLEND_2WEIGHTS, // blend between 3 matrices
  2320.     D3DVBLEND_3WEIGHTS  // blend between 4 matrices
  2321.   );
  2322.   {$EXTERNALSYM _D3DVERTEXBLENDFLAGS}
  2323.   D3DVERTEXBLENDFLAGS = _D3DVERTEXBLENDFLAGS;
  2324.   {$EXTERNALSYM D3DVERTEXBLENDFLAGS}
  2325.   TD3DVertexBlendFlags = _D3DVERTEXBLENDFLAGS;
  2326.   PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
  2327.   _D3DTEXTURETRANSFORMFLAGS = (
  2328.     D3DTTFF_DISABLE ,    // texture coordinates are passed directly
  2329.     D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
  2330.     D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
  2331.     D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
  2332.     D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
  2333.   );
  2334.   {$EXTERNALSYM _D3DTEXTURETRANSFORMFLAGS}
  2335.   D3DTEXTURETRANSFORMFLAGS = _D3DTEXTURETRANSFORMFLAGS;
  2336.   {$EXTERNALSYM D3DTEXTURETRANSFORMFLAGS}
  2337.   TD3DTextureTransformFlags = _D3DTEXTURETRANSFORMFLAGS;
  2338. const
  2339.   D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
  2340.   {$EXTERNALSYM D3DTTFF_PROJECTED}
  2341. // Macros to set texture coordinate format bits in the FVF id
  2342.   D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
  2343.   {$EXTERNALSYM D3DFVF_TEXTUREFORMAT2}
  2344.   D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
  2345.   {$EXTERNALSYM D3DFVF_TEXTUREFORMAT1}
  2346.   D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
  2347.   {$EXTERNALSYM D3DFVF_TEXTUREFORMAT3}
  2348.   D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
  2349.   {$EXTERNALSYM D3DFVF_TEXTUREFORMAT4}
  2350. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD): DWORD;
  2351. {$EXTERNALSYM D3DFVF_TEXCOORDSIZE3}
  2352. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD): DWORD;
  2353. {$EXTERNALSYM D3DFVF_TEXCOORDSIZE2}
  2354. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD): DWORD;
  2355. {$EXTERNALSYM D3DFVF_TEXCOORDSIZE4}
  2356. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD): DWORD;
  2357. {$EXTERNALSYM D3DFVF_TEXCOORDSIZE1}
  2358. {$ENDIF} // DIRECT3D_VERSION_7
  2359. {$ELSE}
  2360. //
  2361. // legacy vertex blend names
  2362. //
  2363. type
  2364.   PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
  2365.   TD3DVertexBlendFlags = Direct3D8.TD3DVertexBlendFlags;
  2366.   D3DVERTEXBLENDFLAGS = Direct3D8.D3DVERTEXBLENDFLAGS;
  2367.   _D3DVERTEXBLENDFLAGS = Direct3D8._D3DVERTEXBLENDFLAGS;
  2368. {$ENDIF} // DIRECT3D_VERSION_LESS_8
  2369. (*==========================================================================;
  2370.  *
  2371.  *
  2372.  *  File:       d3dcaps.h
  2373.  *  Content:    Direct3D capabilities include file
  2374.  *
  2375.  ***************************************************************************)
  2376. (* Description of capabilities of transform *)
  2377. type
  2378.   PD3DTransformCaps = ^TD3DTransformCaps;
  2379.   _D3DTRANSFORMCAPS = packed record
  2380.     dwSize: DWORD;
  2381.     dwCaps: DWORD;
  2382.   end;
  2383.   {$EXTERNALSYM _D3DTRANSFORMCAPS}
  2384.   D3DTRANSFORMCAPS = _D3DTRANSFORMCAPS;
  2385.   {$EXTERNALSYM D3DTRANSFORMCAPS}
  2386.   TD3DTransformCaps = _D3DTRANSFORMCAPS;
  2387. const
  2388.   D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
  2389.   {$EXTERNALSYM D3DTRANSFORMCAPS_CLIP}
  2390. (* Description of capabilities of lighting *)
  2391. type
  2392.   PD3DLightingCaps = ^TD3DLightingCaps;
  2393.   _D3DLIGHTINGCAPS = packed record
  2394.     dwSize: DWORD;
  2395.     dwCaps: DWORD;                   (* Lighting caps *)
  2396.     dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
  2397.     dwNumLights: DWORD;              (* Number of lights that can be handled *)
  2398.   end;
  2399.   {$EXTERNALSYM _D3DLIGHTINGCAPS}
  2400.   D3DLIGHTINGCAPS = _D3DLIGHTINGCAPS;
  2401.   {$EXTERNALSYM D3DLIGHTINGCAPS}
  2402.   TD3DLightingCaps = _D3DLIGHTINGCAPS;
  2403. const
  2404.   D3DLIGHTINGMODEL_RGB            = $00000001;
  2405.   {$EXTERNALSYM D3DLIGHTINGMODEL_RGB}
  2406.   D3DLIGHTINGMODEL_MONO           = $00000002;
  2407.   {$EXTERNALSYM D3DLIGHTINGMODEL_MONO}
  2408.   D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
  2409.   {$EXTERNALSYM D3DLIGHTCAPS_POINT}
  2410.   D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
  2411.   {$EXTERNALSYM D3DLIGHTCAPS_SPOT}
  2412.   D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
  2413.   {$EXTERNALSYM D3DLIGHTCAPS_DIRECTIONAL}
  2414. {$IFDEF DIRECT3D_VERSION_LESS_7}
  2415.   D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
  2416.   {$EXTERNALSYM D3DLIGHTCAPS_PARALLELPOINT}
  2417. {$ENDIF} // DIRECT3D_VERSION_LESS_7
  2418. {$IFDEF DIRECT3D_VERSION_LESS_5}
  2419.   D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
  2420.   {$EXTERNALSYM D3DLIGHTCAPS_GLSPOT}
  2421. {$ENDIF} // DIRECT3D_VERSION_LESS_5
  2422. (* Description of capabilities for each primitive type *)
  2423. type
  2424.   PD3DPrimCaps = ^TD3DPrimCaps;
  2425.   _D3DPrimCaps = packed record
  2426.     dwSize: DWORD;
  2427.     dwMiscCaps: DWORD;                 (* Capability flags *)
  2428.     dwRasterCaps: DWORD;
  2429.     dwZCmpCaps: DWORD;
  2430.     dwSrcBlendCaps: DWORD;
  2431.     dwDestBlendCaps: DWORD;
  2432.     dwAlphaCmpCaps: DWORD;
  2433.     dwShadeCaps: DWORD;
  2434.     dwTextureCaps: DWORD;
  2435.     dwTextureFilterCaps: DWORD;
  2436.     dwTextureBlendCaps: DWORD;
  2437.     dwTextureAddressCaps: DWORD;
  2438.     dwStippleWidth: DWORD;             (* maximum width and height of *)
  2439.     dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
  2440.   end;
  2441.   {$EXTERNALSYM _D3DPrimCaps}
  2442.   D3DPrimCaps = _D3DPrimCaps;
  2443.   {$EXTERNALSYM D3DPrimCaps}
  2444.   TD3DPrimCaps = _D3DPrimCaps;
  2445. const
  2446. (* TD3DPrimCaps dwMiscCaps *)
  2447.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  2448.   {$EXTERNALSYM D3DPMISCCAPS_MASKPLANES}
  2449.   D3DPMISCCAPS_MASKZ              = $00000002;
  2450.   {$EXTERNALSYM D3DPMISCCAPS_MASKZ}
  2451.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  2452.   {$EXTERNALSYM D3DPMISCCAPS_LINEPATTERNREP}
  2453.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  2454.   {$EXTERNALSYM D3DPMISCCAPS_CONFORMANT}
  2455.   D3DPMISCCAPS_CULLNONE           = $00000010;
  2456.   {$EXTERNALSYM D3DPMISCCAPS_CULLNONE}
  2457.   D3DPMISCCAPS_CULLCW             = $00000020;
  2458.   {$EXTERNALSYM D3DPMISCCAPS_CULLCW}
  2459.   D3DPMISCCAPS_CULLCCW            = $00000040;
  2460.   {$EXTERNALSYM D3DPMISCCAPS_CULLCCW}
  2461. (* TD3DPrimCaps dwRasterCaps *)
  2462.   D3DPRASTERCAPS_DITHER           = $00000001;
  2463.   {$EXTERNALSYM D3DPRASTERCAPS_DITHER}
  2464.   D3DPRASTERCAPS_ROP2             = $00000002;
  2465.   {$EXTERNALSYM D3DPRASTERCAPS_ROP2}
  2466.   D3DPRASTERCAPS_XOR              = $00000004;
  2467.   {$EXTERNALSYM D3DPRASTERCAPS_XOR}
  2468.   D3DPRASTERCAPS_PAT              = $00000008;
  2469.   {$EXTERNALSYM D3DPRASTERCAPS_PAT}
  2470.   D3DPRASTERCAPS_ZTEST            = $00000010;
  2471.   {$EXTERNALSYM D3DPRASTERCAPS_ZTEST}
  2472.   D3DPRASTERCAPS_SUBPIXEL         = $00000020;
  2473.   {$EXTERNALSYM D3DPRASTERCAPS_SUBPIXEL}
  2474.   D3DPRASTERCAPS_SUBPIXELX        = $00000040;
  2475.   {$EXTERNALSYM D3DPRASTERCAPS_SUBPIXELX}
  2476.   D3DPRASTERCAPS_FOGVERTEX        = $00000080;
  2477.   {$EXTERNALSYM D3DPRASTERCAPS_FOGVERTEX}
  2478.   D3DPRASTERCAPS_FOGTABLE         = $00000100;
  2479.   {$EXTERNALSYM D3DPRASTERCAPS_FOGTABLE}
  2480.   D3DPRASTERCAPS_STIPPLE          = $00000200;
  2481.   {$EXTERNALSYM D3DPRASTERCAPS_STIPPLE}
  2482. {$IFDEF DIRECT3D_VERSION_5}
  2483.   D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
  2484.   {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT}
  2485.   D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
  2486.   {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT}
  2487.   D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
  2488.   {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASEDGES}
  2489.   D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
  2490.   {$EXTERNALSYM D3DPRASTERCAPS_MIPMAPLODBIAS}
  2491.   D3DPRASTERCAPS_ZBIAS                    = $00004000;
  2492.   {$EXTERNALSYM D3DPRASTERCAPS_ZBIAS}
  2493.   D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
  2494.   {$EXTERNALSYM D3DPRASTERCAPS_ZBUFFERLESSHSR}
  2495.   D3DPRASTERCAPS_FOGRANGE                 = $00010000;
  2496.   {$EXTERNALSYM D3DPRASTERCAPS_FOGRANGE}
  2497.   D3DPRASTERCAPS_ANISOTROPY               = $00020000;
  2498.   {$EXTERNALSYM D3DPRASTERCAPS_ANISOTROPY}
  2499. {$ENDIF} // DIRECT3D_VERSION_5
  2500. {$IFDEF DIRECT3D_VERSION_6}
  2501.   D3DPRASTERCAPS_WBUFFER                      = $00040000;
  2502.   {$EXTERNALSYM D3DPRASTERCAPS_WBUFFER}
  2503.   D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
  2504.   {$EXTERNALSYM D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT}
  2505.   D3DPRASTERCAPS_WFOG                         = $00100000;
  2506.   {$EXTERNALSYM D3DPRASTERCAPS_WFOG}
  2507.   D3DPRASTERCAPS_ZFOG                         = $00200000;
  2508.   {$EXTERNALSYM D3DPRASTERCAPS_ZFOG}
  2509. {$ENDIF} // DIRECT3D_VERSION_6
  2510. (* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
  2511. const
  2512.   D3DPCMPCAPS_NEVER               = $00000001;
  2513.   {$EXTERNALSYM D3DPCMPCAPS_NEVER}
  2514.   D3DPCMPCAPS_LESS                = $00000002;
  2515.   {$EXTERNALSYM D3DPCMPCAPS_LESS}
  2516.   D3DPCMPCAPS_EQUAL               = $00000004;
  2517.   {$EXTERNALSYM D3DPCMPCAPS_EQUAL}
  2518.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  2519.   {$EXTERNALSYM D3DPCMPCAPS_LESSEQUAL}
  2520.   D3DPCMPCAPS_GREATER             = $00000010;
  2521.   {$EXTERNALSYM D3DPCMPCAPS_GREATER}
  2522.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  2523.   {$EXTERNALSYM D3DPCMPCAPS_NOTEQUAL}
  2524.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  2525.   {$EXTERNALSYM D3DPCMPCAPS_GREATEREQUAL}
  2526.   D3DPCMPCAPS_ALWAYS              = $00000080;
  2527.   {$EXTERNALSYM D3DPCMPCAPS_ALWAYS}