📄 d3dx8.pas
字号:
(*==========================================================================;
*
* Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
*
* File: d3dx8.h, d3dx8core.h, d3dx8effect.h, d3dx8math.h, d3dx8mesh.h,
* d3dx8shape.h, d3dx8tex.h
* Content: Direct3DX 8.0 headers
*
* Direct3DX 8.0 Delphi adaptation by Alexey Barkovoy
* E-Mail: clootie@reactor.ru
*
* completely revised by Tim Baumgarten
*
* Modified: 02-Apr-2001 (041MO2001 Edition)
*
* 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://www.delphi-jedi.org/DelphiGraphics/
*
* This File contains only Direct3DX 8.0 Definitions.
* If you want to use D3DX7 version of D3DX use translation by Arne Sch鋚ers
*
***************************************************************************)
(*==========================================================================;
* History :
*
* 02-Apr-2001 (Tim Baumgarten) : Removed "Var" from D3DXComputeNormals.
* ??-Feb-2001 (Tim Baumgarten) : Added some more Overloads. But I have yet to do "some" more.
* 04-Feb-2001 (Tim Baumgarten) : Added a lot of Overloads.
* 23-Dec-2000 (Tim Baumgarten) : Changed all types that are declared as UInt in C to be Cardinal in Delphi
* : Changed all types that are declared as DWord in C to be LongWord in Delphi
*
***************************************************************************)
{$MINENUMSIZE 4}
{$ALIGN ON}
unit D3DX8;
interface
uses Windows, directxgraphics, DXFile, SysUtils, ActiveX;
type
PCardinal = ^Cardinal;
const
d3dx8dll = 'D3DX8ab.dll';
// d3dx8dll = 'D3DX8abd.dll'; //Debug Version
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 1998 Microsoft Corporation. All Rights Reserved.
//
// File: d3dx8math.h
// Content: D3DX math types and functions
//
//////////////////////////////////////////////////////////////////////////////
//===========================================================================
//
// General purpose utilities
//
//===========================================================================
const
D3DX_PI : Single = 3.141592654;
D3DX_1BYPI : Single = 0.318309886;
D3DX_DEFAULT : Cardinal = $FFFFFFFF;
// D3DX_DEFAULT_FLOAT : MAXSINGLE; ??
function D3DXErrorString(DXErrorCode : HResult) : String;
function D3DXToRadian(Degree : Single) : Single;
function D3DXToDegree(Radian : Single) : Single;
//===========================================================================
//
// Vectors
//
//===========================================================================
//--------------------------
// 2D Vector
//--------------------------
type
PD3DXVector2 = ^TD3DXVector2;
TD3DXVector2 = packed record
x, y : Single;
end;
// Some pascal equalents of C++ class functions & operators
const D3DXVector2Zero : TD3DXVector2 = (x : 0; y : 0);
function D3DXVector2(const x, y : Single) : TD3DXVector2;
function D3DXVector2Equal(const v1, v2 : TD3DXVector2) : Boolean;
//--------------------------
// 3D Vector
//--------------------------
type
PD3DXVector3 = ^TD3DXVector3;
TD3DXVector3 = TD3DVector;
// Some pascal equalents of C++ class functions & operators
const D3DXVector3Zero : TD3DXVector3 = (x : 0; y : 0; z : 0);
function D3DXVector3(const x, y, z : Single) : TD3DXVector3;
function D3DXVector3Equal(const v1, v2 : TD3DXVector3) : Boolean;
//--------------------------
// 4D Vector
//--------------------------
type
PD3DXVector4 = ^TD3DXVector4;
TD3DXVector4 = packed record
x, y, z, w : Single;
end;
// Some pascal equalents of C++ class functions & operators
const D3DXVector4Zero : TD3DXVector4 = (x : 0; y : 0; z : 0; w : 0);
function D3DXVector4(const x, y, z, w : Single) : TD3DXVector4;
function D3DXVector4Equal(const v1, v2 : TD3DXVector4) : Boolean;
//===========================================================================
//
// Matrices
//
//===========================================================================
type
PD3DXMatrix = ^TD3DXMatrix;
TD3DXMatrix = TD3DMatrix;
// Some pascal equalents of C++ class functions & operators
function D3DXMatrix(const m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33 : Single) : TD3DXMatrix;
function D3DXMatrixAdd(const m1,m2 : TD3DXMatrix; out mOut : TD3DXMatrix) : TD3DXMatrix;
function D3DXMatrixSubtract(const m1, m2 : TD3DXMatrix; out mOut : TD3DXMatrix) : TD3DXMatrix;
function D3DXMatrixMul(const m : TD3DXMatrix; MulBy : Single; out mOut : TD3DXMatrix) : TD3DXMatrix;
function D3DXMatrixEqual(const m1, m2 : TD3DXMatrix) : Boolean;
//===========================================================================
//
// Quaternions
//
//===========================================================================
type
PD3DXQuaternion = ^TD3DXQuaternion;
TD3DXQuaternion = packed record
x, y, z, w : Single;
end;
// Some pascal equalents of C++ class functions & operators
function D3DXQuaternion(const 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(const q : TD3DXQuaternion; s : Single) : TD3DXQuaternion;
//===========================================================================
//
// Planes
//
//===========================================================================
type
PD3DXPlane = ^TD3DXPlane;
TD3DXPlane = packed record
a, b, c, d : Single;
end;
// Some pascal equalents of C++ class functions & operators
const D3DXPlaneZero : TD3DXPlane = (a : 0; b : 0; c : 0; d : 0);
function D3DXPlane(const a, b, c, d : Single) : TD3DXPlane;
function D3DXPlaneEqual(const p1, p2 : TD3DXPlane) : Boolean;
//===========================================================================
//
// Colors
//
//===========================================================================
type
PD3DXColor = ^TD3DXColor;
TD3DXColor = packed record
r, g, b, a : Single;
end;
function D3DXColor(const r, g, b, a : Single) : TD3DXColor;
function D3DXColorToDWord(c : TD3DXColor) : LongWord;
function D3DXColorFromDWord(c : LongWord) : 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;
function D3DXVec2LengthSq(const v : TD3DXVector2) : Single;
function D3DXVec2Dot(const v1, v2 : TD3DXVector2) : Single;
// Z component of ((x1,y1,0) cross (x2,y2,0))
function D3DXVec2CCW (const v1, v2 : TD3DXVector2) : Single;
function D3DXVec2Add(const v1, v2 : TD3DXVector2) : TD3DXVector2;
function D3DXVec2Subtract(const v1, v2 : TD3DXVector2) : TD3DXVector2;
// Minimize each component. x = min(x1, x2), y = min(y1, y2)
function D3DXVec2Minimize(out vOut : TD3DXVector2; const v1, v2 : TD3DXVEctor2) : TD3DXVector2;
// Maximize each component. x = max(x1, x2), y = max(y1, y2)
function D3DXVec2Maximize(out vOut : TD3DXVector2; const v1, v2 : TD3DXVector2) : TD3DXVector2;
function D3DXVec2Scale(out vOut : TD3DXVector2; const v : TD3DXVector2; s : Single) : TD3DXVector2;
// Linear interpolation. V1 + s(V2-V1)
function D3DXVec2Lerp(out vOut : TD3DXVector2; const v1, v2 : TD3DXVector2; s : Single) : TD3DXVector2;
// non-inline
function D3DXVec2Normalize(var vOut : TD3DXVector2; var v : TD3DXVector2) : PD3DXVector2; stdcall; overload;
function D3DXVec2Normalize(var vOut : TD3DXVector2; v : PD3DXVector2) : PD3DXVector2; stdcall; overload;
function D3DXVec2Normalize(vOut : PD3DXVector2; var v : TD3DXVector2) : PD3DXVector2; stdcall; overload;
function D3DXVec2Normalize(vOut : PD3DXVector2; v : PD3DXVector2) : PD3DXVector2; stdcall; overload;
// Hermite interpolation between position V1, tangent T1 (when s == 0)
// and position V2, tangent T2 (when s == 1).
function D3DXVec2Hermite(var vOut : TD3DXVector2; var v1, t1, v2, t2 : TD3DXVector2; const s : Single) : PD3DXVector2; stdcall; overload;
function D3DXVec2Hermite(var vOut : TD3DXVector2; v1, t1, v2, t2 : PD3DXVector2; const s : Single) : PD3DXVector2; stdcall; overload;
function D3DXVec2Hermite(vOut : PD3DXVector2; var v1, t1, v2, t2 : TD3DXVector2; const s : Single) : PD3DXVector2; stdcall; overload;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -