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

Delphi控件源码

开发平台:

Delphi

  1. {******************************************************************************}
  2. {*                                                                            *}
  3. {*  Copyright (C) 1999 Microsoft Corporation.  All Rights Reserved.           *}
  4. {*                                                                            *}
  5. {*  File:       dx7todx8.h                                                    *}
  6. {*  Content:    DX7 to DX8 Direct3D aliases to aid porting DX7 apps to DX8    *}
  7. {*                                                                            *}
  8. {*  Direct3D 8.x Delphi adaptation by Alexey Barkovoy                         *}
  9. {*  E-Mail: clootie@reactor.ru                                                *}
  10. {*                                                                            *}
  11. {*  Modified: 16-Feb-2001                                                     *}
  12. {*                                                                            *}
  13. {*  Partly based upon :                                                       *}
  14. {*    Direct3DX 7.0 Delphi adaptation by                                      *}
  15. {*      Arne Sch鋚ers, e-Mail: [look at www.delphi-jedi.org/DelphiGraphics/]  *}
  16. {*                                                                            *}
  17. {*  Lastest version can be downloaded from:                                   *}
  18. {*     http://clootie.narod.ru/DelphiGraphics/index.html                      *}
  19. {*     http://delphi-jedi.org                                                 *}
  20. {*                                                                            *}
  21. {******************************************************************************}
  22. {                                                                              }
  23. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  24. {                                                                              }
  25. { The contents of this file are used with permission, subject to the Mozilla   }
  26. { Public License Version 1.1 (the "License"); you may not use this file except }
  27. { in compliance with the License. You may obtain a copy of the License at      }
  28. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  29. {                                                                              }
  30. { Software distributed under the License is distributed on an "AS IS" basis,   }
  31. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  32. { the specific language governing rights and limitations under the License.    }
  33. {                                                                              }
  34. { Alternatively, the contents of this file may be used under the terms of the  }
  35. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  36. { provisions of the LGPL License are applicable instead of those above.        }
  37. { If you wish to allow use of your version of this file only under the terms   }
  38. { of the LGPL License and not to allow others to use your version of this file }
  39. { under the MPL, indicate your decision by deleting  the provisions above and  }
  40. { replace  them with the notice and other provisions required by the LGPL      }
  41. { License.  If you do not delete the provisions above, a recipient may use     }
  42. { your version of this file under either the MPL or the LGPL License.          }
  43. {                                                                              }
  44. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  45. {                                                                              }
  46. {******************************************************************************}
  47. unit DX7toDX8;
  48. interface
  49. uses
  50.   Windows, {$I UseD3D8.inc};
  51. {$NOINCLUDE System}
  52. {$NOINCLUDE SysInit}
  53. {$NOINCLUDE Windows}
  54. {$NOINCLUDE Direct3D8}
  55. {$HPPEMIT '#include <dx7todx8.h>'}
  56. ///////////////////////////////////////////////////////////////////////////////
  57. //
  58. // d3d8types.h
  59. //
  60. ///////////////////////////////////////////////////////////////////////////////
  61. const
  62.   D3DTRANSFORMSTATE_WORLD               = D3DTS_WORLD;
  63.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD}
  64.   D3DTRANSFORMSTATE_VIEW                = D3DTS_VIEW;
  65.   {$EXTERNALSYM D3DTRANSFORMSTATE_VIEW}
  66.   D3DTRANSFORMSTATE_PROJECTION          = D3DTS_PROJECTION;
  67.   {$EXTERNALSYM D3DTRANSFORMSTATE_PROJECTION}
  68.   D3DTRANSFORMSTATE_WORLD1              = D3DTS_WORLD1;
  69.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD1}
  70.   D3DTRANSFORMSTATE_WORLD2              = D3DTS_WORLD2;
  71.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD2}
  72.   D3DTRANSFORMSTATE_WORLD3              = D3DTS_WORLD3;
  73.   {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD3}
  74.   D3DTRANSFORMSTATE_TEXTURE0            = D3DTS_TEXTURE0;
  75.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE0}
  76.   D3DTRANSFORMSTATE_TEXTURE1            = D3DTS_TEXTURE1;
  77.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE1}
  78.   D3DTRANSFORMSTATE_TEXTURE2            = D3DTS_TEXTURE2;
  79.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE2}
  80.   D3DTRANSFORMSTATE_TEXTURE3            = D3DTS_TEXTURE3;
  81.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE3}
  82.   D3DTRANSFORMSTATE_TEXTURE4            = D3DTS_TEXTURE4;
  83.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE4}
  84.   D3DTRANSFORMSTATE_TEXTURE5            = D3DTS_TEXTURE5;
  85.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE5}
  86.   D3DTRANSFORMSTATE_TEXTURE6            = D3DTS_TEXTURE6;
  87.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE6}
  88.   D3DTRANSFORMSTATE_TEXTURE7            = D3DTS_TEXTURE7;
  89.   {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE7}
  90.   D3DTRANSFORMSTATE_FORCE_DWORD         = D3DTS_FORCE_DWORD;
  91.   {$EXTERNALSYM D3DTRANSFORMSTATE_FORCE_DWORD}
  92.   D3DRENDERSTATE_ZENABLE                = D3DRS_ZENABLE;
  93.   {$EXTERNALSYM D3DRENDERSTATE_ZENABLE}
  94.   D3DRENDERSTATE_FILLMODE               = D3DRS_FILLMODE;
  95.   {$EXTERNALSYM D3DRENDERSTATE_FILLMODE}
  96.   D3DRENDERSTATE_SHADEMODE              = D3DRS_SHADEMODE;
  97.   {$EXTERNALSYM D3DRENDERSTATE_SHADEMODE}
  98.   D3DRENDERSTATE_LINEPATTERN            = D3DRS_LINEPATTERN;
  99.   {$EXTERNALSYM D3DRENDERSTATE_LINEPATTERN}
  100.   D3DRENDERSTATE_ZWRITEENABLE           = D3DRS_ZWRITEENABLE;
  101.   {$EXTERNALSYM D3DRENDERSTATE_ZWRITEENABLE}
  102.   D3DRENDERSTATE_ALPHATESTENABLE        = D3DRS_ALPHATESTENABLE;
  103.   {$EXTERNALSYM D3DRENDERSTATE_ALPHATESTENABLE}
  104.   D3DRENDERSTATE_LASTPIXEL              = D3DRS_LASTPIXEL;
  105.   {$EXTERNALSYM D3DRENDERSTATE_LASTPIXEL}
  106.   D3DRENDERSTATE_SRCBLEND               = D3DRS_SRCBLEND;
  107.   {$EXTERNALSYM D3DRENDERSTATE_SRCBLEND}
  108.   D3DRENDERSTATE_DESTBLEND              = D3DRS_DESTBLEND;
  109.   {$EXTERNALSYM D3DRENDERSTATE_DESTBLEND}
  110.   D3DRENDERSTATE_CULLMODE               = D3DRS_CULLMODE;
  111.   {$EXTERNALSYM D3DRENDERSTATE_CULLMODE}
  112.   D3DRENDERSTATE_ZFUNC                  = D3DRS_ZFUNC;
  113.   {$EXTERNALSYM D3DRENDERSTATE_ZFUNC}
  114.   D3DRENDERSTATE_ALPHAREF               = D3DRS_ALPHAREF;
  115.   {$EXTERNALSYM D3DRENDERSTATE_ALPHAREF}
  116.   D3DRENDERSTATE_ALPHAFUNC              = D3DRS_ALPHAFUNC;
  117.   {$EXTERNALSYM D3DRENDERSTATE_ALPHAFUNC}
  118.   D3DRENDERSTATE_DITHERENABLE           = D3DRS_DITHERENABLE;
  119.   {$EXTERNALSYM D3DRENDERSTATE_DITHERENABLE}
  120.   D3DRENDERSTATE_ALPHABLENDENABLE       = D3DRS_ALPHABLENDENABLE;
  121.   {$EXTERNALSYM D3DRENDERSTATE_ALPHABLENDENABLE}
  122.   D3DRENDERSTATE_FOGENABLE              = D3DRS_FOGENABLE;
  123.   {$EXTERNALSYM D3DRENDERSTATE_FOGENABLE}
  124.   D3DRENDERSTATE_SPECULARENABLE         = D3DRS_SPECULARENABLE;
  125.   {$EXTERNALSYM D3DRENDERSTATE_SPECULARENABLE}
  126.   D3DRENDERSTATE_ZVISIBLE               = D3DRS_ZVISIBLE;
  127.   {$EXTERNALSYM D3DRENDERSTATE_ZVISIBLE}
  128.   D3DRENDERSTATE_FOGCOLOR               = D3DRS_FOGCOLOR;
  129.   {$EXTERNALSYM D3DRENDERSTATE_FOGCOLOR}
  130.   D3DRENDERSTATE_FOGTABLEMODE           = D3DRS_FOGTABLEMODE;
  131.   {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEMODE}
  132.   D3DRENDERSTATE_FOGSTART               = D3DRS_FOGSTART;
  133.   {$EXTERNALSYM D3DRENDERSTATE_FOGSTART}
  134.   D3DRENDERSTATE_FOGEND                 = D3DRS_FOGEND;
  135.   {$EXTERNALSYM D3DRENDERSTATE_FOGEND}
  136.   D3DRENDERSTATE_FOGDENSITY             = D3DRS_FOGDENSITY;
  137.   {$EXTERNALSYM D3DRENDERSTATE_FOGDENSITY}
  138.   D3DRENDERSTATE_EDGEANTIALIAS          = D3DRS_EDGEANTIALIAS;
  139.   {$EXTERNALSYM D3DRENDERSTATE_EDGEANTIALIAS}
  140.   D3DRENDERSTATE_ZBIAS                  = D3DRS_ZBIAS;
  141.   {$EXTERNALSYM D3DRENDERSTATE_ZBIAS}
  142.   D3DRENDERSTATE_RANGEFOGENABLE         = D3DRS_RANGEFOGENABLE;
  143.   {$EXTERNALSYM D3DRENDERSTATE_RANGEFOGENABLE}
  144.   D3DRENDERSTATE_STENCILENABLE          = D3DRS_STENCILENABLE;
  145.   {$EXTERNALSYM D3DRENDERSTATE_STENCILENABLE}
  146.   D3DRENDERSTATE_STENCILFAIL            = D3DRS_STENCILFAIL;
  147.   {$EXTERNALSYM D3DRENDERSTATE_STENCILFAIL}
  148.   D3DRENDERSTATE_STENCILZFAIL           = D3DRS_STENCILZFAIL;
  149.   {$EXTERNALSYM D3DRENDERSTATE_STENCILZFAIL}
  150.   D3DRENDERSTATE_STENCILPASS            = D3DRS_STENCILPASS;
  151.   {$EXTERNALSYM D3DRENDERSTATE_STENCILPASS}
  152.   D3DRENDERSTATE_STENCILFUNC            = D3DRS_STENCILFUNC;
  153.   {$EXTERNALSYM D3DRENDERSTATE_STENCILFUNC}
  154.   D3DRENDERSTATE_STENCILREF             = D3DRS_STENCILREF;
  155.   {$EXTERNALSYM D3DRENDERSTATE_STENCILREF}
  156.   D3DRENDERSTATE_STENCILMASK            = D3DRS_STENCILMASK;
  157.   {$EXTERNALSYM D3DRENDERSTATE_STENCILMASK}
  158.   D3DRENDERSTATE_STENCILWRITEMASK       = D3DRS_STENCILWRITEMASK;
  159.   {$EXTERNALSYM D3DRENDERSTATE_STENCILWRITEMASK}
  160.   D3DRENDERSTATE_TEXTUREFACTOR          = D3DRS_TEXTUREFACTOR;
  161.   {$EXTERNALSYM D3DRENDERSTATE_TEXTUREFACTOR}
  162.   D3DRENDERSTATE_WRAP0                  = D3DRS_WRAP0;
  163.   {$EXTERNALSYM D3DRENDERSTATE_WRAP0}
  164.   D3DRENDERSTATE_WRAP1                  = D3DRS_WRAP1;
  165.   {$EXTERNALSYM D3DRENDERSTATE_WRAP1}
  166.   D3DRENDERSTATE_WRAP2                  = D3DRS_WRAP2;
  167.   {$EXTERNALSYM D3DRENDERSTATE_WRAP2}
  168.   D3DRENDERSTATE_WRAP3                  = D3DRS_WRAP3;
  169.   {$EXTERNALSYM D3DRENDERSTATE_WRAP3}
  170.   D3DRENDERSTATE_WRAP4                  = D3DRS_WRAP4;
  171.   {$EXTERNALSYM D3DRENDERSTATE_WRAP4}
  172.   D3DRENDERSTATE_WRAP5                  = D3DRS_WRAP5;
  173.   {$EXTERNALSYM D3DRENDERSTATE_WRAP5}
  174.   D3DRENDERSTATE_WRAP6                  = D3DRS_WRAP6;
  175.   {$EXTERNALSYM D3DRENDERSTATE_WRAP6}
  176.   D3DRENDERSTATE_WRAP7                  = D3DRS_WRAP7;
  177.   {$EXTERNALSYM D3DRENDERSTATE_WRAP7}
  178.   D3DRENDERSTATE_CLIPPING               = D3DRS_CLIPPING;
  179.   {$EXTERNALSYM D3DRENDERSTATE_CLIPPING}
  180.   D3DRENDERSTATE_LIGHTING               = D3DRS_LIGHTING;
  181.   {$EXTERNALSYM D3DRENDERSTATE_LIGHTING}
  182. //  D3DRENDERSTATE_EXTENTS                = D3DRS_EXTENTS; //BAA: Not found in SDK
  183.   D3DRENDERSTATE_AMBIENT                = D3DRS_AMBIENT;
  184.   {$EXTERNALSYM D3DRENDERSTATE_AMBIENT}
  185.   D3DRENDERSTATE_FOGVERTEXMODE          = D3DRS_FOGVERTEXMODE;
  186.   {$EXTERNALSYM D3DRENDERSTATE_FOGVERTEXMODE}
  187.   D3DRENDERSTATE_COLORVERTEX            = D3DRS_COLORVERTEX;
  188.   {$EXTERNALSYM D3DRENDERSTATE_COLORVERTEX}
  189.   D3DRENDERSTATE_LOCALVIEWER            = D3DRS_LOCALVIEWER;
  190.   {$EXTERNALSYM D3DRENDERSTATE_LOCALVIEWER}
  191.   D3DRENDERSTATE_NORMALIZENORMALS       = D3DRS_NORMALIZENORMALS;
  192.   {$EXTERNALSYM D3DRENDERSTATE_NORMALIZENORMALS}
  193.   D3DRENDERSTATE_DIFFUSEMATERIALSOURCE  = D3DRS_DIFFUSEMATERIALSOURCE;
  194.   {$EXTERNALSYM D3DRENDERSTATE_DIFFUSEMATERIALSOURCE}
  195.   D3DRENDERSTATE_SPECULARMATERIALSOURCE = D3DRS_SPECULARMATERIALSOURCE;
  196.   {$EXTERNALSYM D3DRENDERSTATE_SPECULARMATERIALSOURCE}
  197.   D3DRENDERSTATE_AMBIENTMATERIALSOURCE  = D3DRS_AMBIENTMATERIALSOURCE;
  198.   {$EXTERNALSYM D3DRENDERSTATE_AMBIENTMATERIALSOURCE}
  199.   D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = D3DRS_EMISSIVEMATERIALSOURCE;
  200.   {$EXTERNALSYM D3DRENDERSTATE_EMISSIVEMATERIALSOURCE}
  201.   D3DRENDERSTATE_VERTEXBLEND            = D3DRS_VERTEXBLEND;
  202.   {$EXTERNALSYM D3DRENDERSTATE_VERTEXBLEND}
  203.   D3DRENDERSTATE_CLIPPLANEENABLE        = D3DRS_CLIPPLANEENABLE;
  204.   {$EXTERNALSYM D3DRENDERSTATE_CLIPPLANEENABLE}
  205. //#define RGBA_MAKE                               D3DCOLOR_RGBA
  206. function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor;
  207. {$EXTERNALSYM RGBA_MAKE}
  208. //#define RGB_MAKE                                D3DCOLOR_XRGB
  209. function RGB_MAKE(r, g, b: DWORD): TD3DColor;
  210. {$EXTERNALSYM RGB_MAKE}
  211. //#define D3DRGBA                                 D3DCOLOR_COLORVALUE
  212. function D3DRGBA(r, g, b, a: Single): TD3DColor;
  213. {$EXTERNALSYM D3DRGBA}
  214. //#define D3DRGB(_r,_g,_b)                        D3DCOLOR_COLORVALUE(_r,_g,_b,1.f)
  215. function D3DRGB(r, g, b: Single): TD3DColor;
  216. {$EXTERNALSYM D3DRGB}
  217. implementation
  218. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  219. function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor;
  220. begin
  221.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  222. end;
  223. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  224. function RGB_MAKE(r, g, b: DWORD): TD3DColor;
  225. begin
  226.   Result := (r shl 16) or (g shl 8) or b;
  227. end;
  228. // #define D3DRGBA(r, g, b, a) 
  229. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) 
  230. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) 
  231. //    )
  232. function D3DRGBA(r, g, b, a: Single): TD3DColor;
  233. begin
  234.   Result := (round(a * 255) shl 24) or (round(r * 255) shl 16)
  235.                                     or (round(g * 255) shl 8)
  236.                                     or round(b * 255);
  237. end;
  238. // #define D3DRGB(r, g, b) 
  239. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  240. function D3DRGB(r, g, b: Single): TD3DColor;
  241. begin
  242.   Result := $ff000000 or (round(r * 255) shl 16)
  243.                       or (round(g * 255) shl 8)
  244.                       or round(b * 255);
  245. end;
  246. end.