?? d3dx8.pas
字號:
{******************************************************************************}
{* *}
{* Copyright (C) Microsoft Corporation. All Rights Reserved. *}
{* *}
{* File: d3dx8.h, d3dx8core.h, d3dx8math.h, d3dx8math.inl, *}
{* d3dx8effect.h, d3dx8mesh.h, d3dx8shape.h, d3dx8tex.h *}
{* Content: Direct3DX 8.1 headers *}
{* *}
{* Direct3DX 8.1 Delphi adaptation by Alexey Barkovoy *}
{* E-Mail: clootie@reactor.ru *}
{* *}
{* Modified: 27-Apr-2003 *}
{* *}
{* Partly based upon : *}
{* Direct3DX 7.0 Delphi adaptation by *}
{* Arne Sch鋚ers, e-Mail: [look at www.delphi-jedi.org/DelphiGraphics/] *}
{* *}
{* Latest version can be downloaded from: *}
{* http://clootie.narod.ru/delphi *}
{* *}
{* This File contains only Direct3DX 8.x Definitions. *}
{* If you want to use D3DX7 version of D3DX use translation by Arne Sch鋚ers *}
{* *}
{******************************************************************************)
{ }
{ 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 }
{ }
{******************************************************************************}
// Original source contained in "D3DX8.par"
{$I DirectX.inc}
unit D3DX8;
interface
// Remove "dot" below to link with debug version of D3DX8
// (only in JEDI or TMT pascal version)
{.$DEFINE DEBUG}
// Remove "dot" below to link with DirectXGraphics and Direct3D
{.$DEFINE DXG_COMPAT}
(*$HPPEMIT '#include "d3dx8.h"' *)
(*$HPPEMIT '#include "dxfile.h"' *)
// Do not emit <DXFile.hpp> to C++Builder
(*$NOINCLUDE DXFile *)
(*$HPPEMIT 'namespace D3dx8' *)
(*$HPPEMIT '{' *)
uses
Windows,
ActiveX,
SysUtils,
{$I UseD3D8.inc},
DXFile;
const
//////////// DLL export definitions ///////////////////////////////////////
d3dx8dll ={$IFDEF DEBUG} 'd3dx8d.dll'{$ELSE} 'D3DX81ab.dll'{$ENDIF};
///////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx8.h
// Content: D3DX utility library
//
///////////////////////////////////////////////////////////////////////////
const
// #define D3DX_DEFAULT ULONG_MAX
D3DX_DEFAULT = $FFFFFFFF;
{$EXTERNALSYM D3DX_DEFAULT}
var
// #define D3DX_DEFAULT_FLOAT FLT_MAX
// Forced to define as 'var' cos pascal compiler treats all consts as Double
D3DX_DEFAULT_FLOAT: Single = 3.402823466e+38; // max single value
{$EXTERNALSYM D3DX_DEFAULT_FLOAT}
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// File: d3dx8math.h
// Content: D3DX math types and functions
//
//////////////////////////////////////////////////////////////////////////////
//===========================================================================
//
// General purpose utilities
//
//===========================================================================
const
D3DX_PI: Single = 3.141592654;
{$EXTERNALSYM D3DX_PI}
D3DX_1BYPI: Single = 0.318309886;
{$EXTERNALSYM D3DX_1BYPI}
//#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f))
function D3DXToRadian(Degree: Single): Single;
{$EXTERNALSYM D3DXToRadian}
//#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI))
function D3DXToDegree(Radian: Single): Single;
{$EXTERNALSYM D3DXToDegree}
//===========================================================================
//
// Vectors
//
//===========================================================================
//--------------------------
// 2D Vector
//--------------------------
type
{$HPPEMIT 'typedef D3DXVECTOR2 TD3DXVector2;'}
{$HPPEMIT 'typedef D3DXVECTOR2 *PD3DXVector2;'}
PD3DXVector2 = ^TD3DXVector2;
{$NODEFINE PD3DXVector2}
TD3DXVector2 = packed record
x, y: Single;
end;
{$NODEFINE TD3DXVector2}
// Some pascal equalents of C++ class functions & operators
const D3DXVector2Zero: TD3DXVector2 = (x:0; y:0); // (0,0)
function D3DXVector2(_x, _y: Single): TD3DXVector2;
function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean;
//--------------------------
// 3D Vector
//--------------------------
type
{$HPPEMIT 'typedef D3DXVECTOR3 TD3DXVector3;'}
{$HPPEMIT 'typedef D3DXVECTOR3 *PD3DXVector3;'}
PD3DXVector3 = ^TD3DXVector3;
{$NODEFINE PD3DXVector3}
TD3DXVector3 = TD3DVector;
{$NODEFINE TD3DXVector3}
// Some pascal equalents of C++ class functions & operators
const D3DXVector3Zero: TD3DXVector3 = (x:0; y:0; z:0); // (0,0,0)
function D3DXVector3(_x, _y, _z: Single): TD3DXVector3;
function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean;
//--------------------------
// 4D Vector
//--------------------------
type
{$HPPEMIT 'typedef D3DXVECTOR4 TD3DXVector4;'}
{$HPPEMIT 'typedef D3DXVECTOR4 *PD3DXVector4;'}
PD3DXVector4 = ^TD3DXVector4;
{$NODEFINE PD3DXVector4}
TD3DXVector4 = packed record
x, y, z, w: Single;
end;
{$NODEFINE TD3DXVector4}
// Some pascal equalents of C++ class functions & operators
const D3DXVector4Zero: TD3DXVector4 = (x:0; y:0; z:0; w:0); // (0,0,0,0)
function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4;
function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean;
//===========================================================================
//
// Matrices
//
//===========================================================================
type
{$HPPEMIT 'typedef D3DXMATRIX TD3DXMatrix;'}
{$HPPEMIT 'typedef D3DXMATRIX *PD3DXMatrix;'}
PD3DXMatrix = ^TD3DXMatrix;
{$NODEFINE PD3DXMatrix}
TD3DXMatrix = TD3DMatrix;
{$NODEFINE TD3DXMatrix}
// Some pascal equalents of C++ class functions & operators
function D3DXMatrix(
_m00, _m01, _m02, _m03,
_m10, _m11, _m12, _m13,
_m20, _m21, _m22, _m23,
_m30, _m31, _m32, _m33: Single): TD3DXMatrix;
function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;
function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;
function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix;
function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean;
//===========================================================================
//
// Aligned Matrices
//
// This class helps keep matrices 16-byte aligned as preferred by P4 cpus.
// It aligns matrices on the stack and on the heap or in global scope.
// It does this using __declspec(align(16)) which works on VC7 and on VC 6
// with the processor pack. Unfortunately there is no way to detect the
// latter so this is turned on only on VC7. On other compilers this is the
// the same as D3DXMATRIX.
// Using this class on a compiler that does not actually do the alignment
// can be dangerous since it will not expose bugs that ignore alignment.
// E.g if an object of this class in inside a struct or class, and some code
// memcopys data in it assuming tight packing. This could break on a compiler
// that eventually start aligning the matrix.
//
//===========================================================================
// Translator comments: None of current pascal compilers can even align data
// inside records to 16 byte boundary, so we just leave aligned matrix
// declaration equal to standart matrix
type
PD3DXMatrixA16 = ^TD3DXMatrixA16;
TD3DXMatrixA16 = TD3DXMatrix;
//===========================================================================
//
// Quaternions
//
//===========================================================================
type
PD3DXQuaternion = ^TD3DXQuaternion;
TD3DXQuaternion = packed record
x, y, z, w: Single;
end;
{$NODEFINE TD3DXQuaternion}
{$HPPEMIT 'typedef D3DXQUATERNION TD3DXQuaternion;'}
// Some pascal equalents of C++ class functions & operators
function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion;
function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;
function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;
function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean;
function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion;
s: Single): PD3DXQuaternion;
//===========================================================================
//
// Planes
//
//===========================================================================
type
PD3DXPlane = ^TD3DXPlane;
TD3DXPlane = packed record
a, b, c, d: Single;
end;
{$NODEFINE TD3DXPlane}
{$HPPEMIT 'typedef D3DXPLANE TD3DXPlane;'}
// Some pascal equalents of C++ class functions & operators
const D3DXPlaneZero: TD3DXPlane = (a:0; b:0; c:0; d:0); // (0,0,0,0)
function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane;
function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean;
//===========================================================================
//
// Colors
//
//===========================================================================
type
{$HPPEMIT 'typedef D3DXCOLOR TD3DXColor;'}
{$HPPEMIT 'typedef D3DXCOLOR *PD3DXColor;'}
PD3DXColor = PD3DColorValue;
{$NODEFINE PD3DXColor}
TD3DXColor = TD3DColorValue;
{$NODEFINE TD3DXColor}
function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor;
function D3DXColorToDWord(c: TD3DXColor): DWord;
function D3DXColorFromDWord(c: DWord): TD3DXColor;
function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean;
//===========================================================================
//
// D3DX math functions:
//
// NOTE:
// * All these functions can take the same object as in and out parameters.
//
// * Out parameters are typically also returned as return values, so that
// the output of one function may be used as a parameter to another.
//
//===========================================================================
//--------------------------
// 2D Vector
//--------------------------
// inline
function D3DXVec2Length(const v: TD3DXVector2): Single;
{$EXTERNALSYM D3DXVec2Length}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -