⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 direct3d8.pas

📁 3D GameStudio 的Delphi开发包
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{******************************************************************************}
{*                                                                            *}
{*  Copyright (C) Microsoft Corporation.  All Rights Reserved.                *}
{*                                                                            *}
{*  Files:      d3d8types.h d3d8caps.h d3d8.h                                 *}
{*  Content:    Direct3D8 include files                                       *}
{*                                                                            *}
{*  DirectX 8.1 Delphi adaptation by Alexey Barkovoy                          *}
{*  E-Mail: directx@clootie.ru                                                *}
{*                                                                            *}
{*  Modified: 19-Jan-2004                                                     *}
{*                                                                            *}
{*  Partly based upon :                                                       *}
{*    DirectX 7.0 Object Pascal adaptation by                                 *}
{*      Erik Unger, e-Mail: DelphiDirectX@next-reality.com                    *}
{*    DirectXGraphics 8.0 ObjectPascal adaptation by                          *}
{*      Tim Baumgarten, e-Mail: ampaze@gmx.net                                *}
{*                                                                            *}
{*  Latest version can be downloaded from:                                    *}
{*    http://clootie.ru                                                       *}
{*    http://sourceforge.net/projects/delphi-dx9sdk                           *}
{*                                                                            *}
{*  This File contains only Direct3D 8.x definitions.                         *}
{*  If you want to use older versions of D3D use Direct3D.pas from Erik Unger *}
{*                                                                            *}
{******************************************************************************}
{                                                                              }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{                                                                              }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{                                                                              }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{                                                                              }
{******************************************************************************}

{$I DirectX.inc}

unit Direct3D8;

interface

// Global level dynamic loading support    
{$IFDEF DYNAMIC_LINK_ALL}
  {$DEFINE DIRECT3D8_DYNAMIC_LINK}
{$ENDIF}
{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL}
  {$DEFINE DIRECT3D8_DYNAMIC_LINK_EXPLICIT}
{$ENDIF}

// Remove "dots" below to force some kind of dynamic linking
{.$DEFINE DIRECT3D8_DYNAMIC_LINK}
{.$DEFINE DIRECT3D8_DYNAMIC_LINK_EXPLICIT}

(*$HPPEMIT '#include <d3d8types.h>' *)
(*$HPPEMIT '#include <d3d8caps.h>' *)
(*$HPPEMIT '#include <d3d8.h>' *)

uses Windows, DXTypes;

///// Helper constants (for use in SetRenderState) /////
const
  iTrue  = DWORD(True);
  iFalse = DWORD(False);

(*==========================================================================;
 *
 *  Copyright (C) 1995-2000 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:       d3d8types.h
 *  Content:    Direct3D capabilities include file
 *
 ***************************************************************************)

type
  // D3DCOLOR is equivalent to D3DFMT_A8R8G8B8
  D3DCOLOR = DXTypes.D3DCOLOR;
  {$EXTERNALSYM D3DCOLOR}
  TD3DColor = DXTypes.TD3DColor;

// maps unsigned 8 bits/channel to D3DCOLOR
// #define D3DCOLOR_ARGB(a,r,g,b) \
//     ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
function D3DCOLOR_ARGB(a,r,g,b: DWord): TD3DColor;
{$EXTERNALSYM D3DCOLOR_ARGB}
// #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor;
{$EXTERNALSYM D3DCOLOR_RGBA}
// #define D3DCOLOR_XRGB(r,g,b)   D3DCOLOR_ARGB(0xff,r,g,b)
function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor;
{$EXTERNALSYM D3DCOLOR_XRGB}

// maps floating point channels (0.f to 1.f range) to D3DCOLOR
// #define D3DCOLOR_COLORVALUE(r,g,b,a) \
//     D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
function D3DCOLOR_COLORVALUE(r,g,b,a: Single): TD3DColor;
{$EXTERNALSYM D3DCOLOR_COLORVALUE}

type
  _D3DVECTOR = DXTypes._D3DVECTOR;
  {$EXTERNALSYM _D3DVECTOR}
  D3DVECTOR = DXTypes.D3DVECTOR;
  {$EXTERNALSYM D3DVECTOR}
  TD3DVector = DXTypes.TD3DVector;
  PD3DVector = DXTypes.PD3DVector;

  PD3DColorValue = ^TD3DColorValue;
  _D3DCOLORVALUE = packed record
    r: Single;
    g: Single;
    b: Single;
    a: Single;
  end {_D3DCOLORVALUE};
  {$EXTERNALSYM _D3DCOLORVALUE}
  D3DCOLORVALUE = _D3DCOLORVALUE;
  {$EXTERNALSYM D3DCOLORVALUE}
  TD3DColorValue = _D3DCOLORVALUE;

  PD3DRect = ^TD3DRect;
  _D3DRECT = packed record
    x1: LongInt;
    y1: LongInt;
    x2: LongInt;
    y2: LongInt;
  end {_D3DRECT};
  {$EXTERNALSYM _D3DRECT}
  D3DRECT = _D3DRECT;
  {$EXTERNALSYM D3DRECT}
  TD3DRect = _D3DRECT;

  PD3DMatrix = ^TD3DMatrix;
  _D3DMATRIX = packed record
    case integer of
      0 : (_11, _12, _13, _14: Single;
           _21, _22, _23, _24: Single;
           _31, _32, _33, _34: Single;
           _41, _42, _43, _44: Single);
      1 : (m : array [0..3, 0..3] of Single);
  end {_D3DMATRIX};
  {$EXTERNALSYM _D3DMATRIX}
  D3DMATRIX = _D3DMATRIX;
  {$EXTERNALSYM D3DMATRIX}
  TD3DMatrix = _D3DMATRIX;

  PD3DViewport8 = ^TD3DViewport8;
  _D3DVIEWPORT8 = packed record
    X: DWord;
    Y: DWord;         { Viewport Top left }
    Width: DWord;
    Height: DWord;    { Viewport Dimensions }
    MinZ: Single;       { Min/max of clip Volume }
    MaxZ: Single;
  end {_D3DVIEWPORT8};
  {$EXTERNALSYM _D3DVIEWPORT8}
  D3DVIEWPORT8 = _D3DVIEWPORT8;
  {$EXTERNALSYM D3DVIEWPORT8}
  TD3DViewport8 = _D3DVIEWPORT8;

(*
 * Values for clip fields.
 *)

const
  // Max number of user clipping planes, supported in D3D.
  D3DMAXUSERCLIPPLANES = 32;
  {$EXTERNALSYM D3DMAXUSERCLIPPLANES}

  // These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE
  //
  D3DCLIPPLANE0 = (1 shl 0);
  {$EXTERNALSYM D3DCLIPPLANE0}
  D3DCLIPPLANE1 = (1 shl 1);
  {$EXTERNALSYM D3DCLIPPLANE1}
  D3DCLIPPLANE2 = (1 shl 2);
  {$EXTERNALSYM D3DCLIPPLANE2}
  D3DCLIPPLANE3 = (1 shl 3);
  {$EXTERNALSYM D3DCLIPPLANE3}
  D3DCLIPPLANE4 = (1 shl 4);
  {$EXTERNALSYM D3DCLIPPLANE4}
  D3DCLIPPLANE5 = (1 shl 5);
  {$EXTERNALSYM D3DCLIPPLANE5}

  // The following bits are used in the ClipUnion and ClipIntersection
  // members of the D3DCLIPSTATUS8
  //
  D3DCS_LEFT    = $00000001;
  {$EXTERNALSYM D3DCS_LEFT}
  D3DCS_RIGHT   = $00000002;
  {$EXTERNALSYM D3DCS_RIGHT}
  D3DCS_TOP     = $00000004;
  {$EXTERNALSYM D3DCS_TOP}
  D3DCS_BOTTOM  = $00000008;
  {$EXTERNALSYM D3DCS_BOTTOM}
  D3DCS_FRONT   = $00000010;
  {$EXTERNALSYM D3DCS_FRONT}
  D3DCS_BACK    = $00000020;
  {$EXTERNALSYM D3DCS_BACK}
  D3DCS_PLANE0  = $00000040;
  {$EXTERNALSYM D3DCS_PLANE0}
  D3DCS_PLANE1  = $00000080;
  {$EXTERNALSYM D3DCS_PLANE1}
  D3DCS_PLANE2  = $00000100;
  {$EXTERNALSYM D3DCS_PLANE2}
  D3DCS_PLANE3  = $00000200;
  {$EXTERNALSYM D3DCS_PLANE3}
  D3DCS_PLANE4  = $00000400;
  {$EXTERNALSYM D3DCS_PLANE4}
  D3DCS_PLANE5  = $00000800;
  {$EXTERNALSYM D3DCS_PLANE5}

  D3DCS_ALL     = D3DCS_LEFT   or
                  D3DCS_RIGHT  or
                  D3DCS_TOP    or
                  D3DCS_BOTTOM or
                  D3DCS_FRONT  or
                  D3DCS_BACK   or
                  D3DCS_PLANE0 or
                  D3DCS_PLANE1 or
                  D3DCS_PLANE2 or
                  D3DCS_PLANE3 or
                  D3DCS_PLANE4 or
                  D3DCS_PLANE5;
  {$EXTERNALSYM D3DCS_ALL}

type
  PD3DClipStatus8 = ^TD3DClipStatus8;
  _D3DCLIPSTATUS8 = packed record
    ClipUnion: DWord;
    ClipIntersection: DWord;
  end {_D3DCLIPSTATUS8};
  {$EXTERNALSYM _D3DCLIPSTATUS8}
  D3DCLIPSTATUS8 = _D3DCLIPSTATUS8;
  {$EXTERNALSYM D3DCLIPSTATUS8}
  TD3DClipStatus8 = _D3DCLIPSTATUS8;

  PD3DMaterial8 = ^TD3DMaterial8;
  _D3DMATERIAL8 = packed record
    Diffuse: TD3DColorValue;   { Diffuse color RGBA }
    Ambient: TD3DColorValue;   { Ambient color RGB }
    Specular: TD3DColorValue;  { Specular 'shininess' }
    Emissive: TD3DColorValue;  { Emissive color RGB }
    Power: Single;             { Sharpness if specular highlight }
  end {_D3DMATERIAL8};
  {$EXTERNALSYM _D3DMATERIAL8}
  D3DMATERIAL8 = _D3DMATERIAL8;
  {$EXTERNALSYM D3DMATERIAL8}
  TD3DMaterial8 = _D3DMATERIAL8;

  _D3DLIGHTTYPE = (
  {$IFNDEF SUPPORTS_EXPL_ENUMS}
    D3DLIGHT_INVALID_0, {= 0}
    D3DLIGHT_POINT,     {= 1}
    D3DLIGHT_SPOT,      {= 2}
    D3DLIGHT_DIRECTIONAL{= 3}
  {$ELSE}
    D3DLIGHT_POINT       = 1,
    D3DLIGHT_SPOT        = 2,
    D3DLIGHT_DIRECTIONAL = 3
  {$ENDIF}
  );
  {$EXTERNALSYM _D3DLIGHTTYPE}
  D3DLIGHTTYPE = _D3DLIGHTTYPE;
  {$EXTERNALSYM D3DLIGHTTYPE}
  TD3DLightType = _D3DLIGHTTYPE;

  PD3DLight8 = ^TD3DLight8;
  _D3DLIGHT8 = packed record
    _Type: TD3DLightType;       { Type of light source }
    Diffuse: TD3DColorValue;    { Diffuse color of light }
    Specular: TD3DColorValue;   { Specular color of light }
    Ambient: TD3DColorValue;    { Ambient color of light }
    Position: TD3DVector;       { Position in world space }
    Direction: TD3DVector;      { Direction in world space }
    Range: Single;              { Cutoff range }
    Falloff: Single;            { Falloff }
    Attenuation0: Single;       { Constant attenuation }
    Attenuation1: Single;       { Linear attenuation }
    Attenuation2: Single;       { Quadratic attenuation }
    Theta: Single;              { Inner angle of spotlight cone }
    Phi: Single;                { Outer angle of spotlight cone }
  end {_D3DLIGHT8};
  {$EXTERNALSYM _D3DLIGHT8}
  D3DLIGHT8 = _D3DLIGHT8;
  {$EXTERNALSYM D3DLIGHT8}
  TD3DLight8 = _D3DLIGHT8;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -