D3DX9.pas
上传用户:ctlcnc
上传日期:2021-12-10
资源大小:4933k
文件大小:443k
- {******************************************************************************}
- {* *}
- {* Copyright (C) Microsoft Corporation. All Rights Reserved. *}
- {* *}
- {* File: d3dx9.h, d3dx9anim.h, d3dx9core.h, d3dx9effect.h, *}
- {* d3dx9math.h, d3dx9math.inl, d3dx9mesh.h, d3dx9shader.h, *}
- {* d3dx9shape.h, d3dx9tex.h, d3dx9xof.h *}
- {* *}
- {* Content: Direct3DX 9.0 headers *}
- {* *}
- {* Direct3DX 9.0 October 2006 Delphi adaptation by Alexey Barkovoy *}
- {* E-Mail: directx@clootie.ru *}
- {* *}
- {* Latest version can be downloaded from: *}
- {* http://www.clootie.ru *}
- {* http://sourceforge.net/projects/delphi-dx9sdk *}
- {* *}
- {*----------------------------------------------------------------------------*}
- {* $Id: D3DX9.par,v 1.32 2006/10/29 22:32:12 clootie Exp $ }
- {******************************************************************************}
- { }
- { 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 "D3DX9.par"
- {$I DirectX.inc}
- unit D3DX9;
- interface
- // Remove "dot" below to link with debug version of D3DX9
- // (for Delphi it works only in JEDI version of headers)
- {.$DEFINE DEBUG}
- // Remove "dot" below to link with separate DLL's (one DLL per part of D3DX9 API)
- // instead of monolithic "all-in-one" version of D3DX9 (not supported currently)
- {.$DEFINE D3DX_SEPARATE}
- (*$HPPEMIT '#include "d3dx9.h"' *)
- (*$HPPEMIT 'namespace D3dx9' *)
- (*$HPPEMIT '{' *)
- //Clootie: has to temporary disable INLINE support for FreePascal
- // due to bug in compiler
- {$IFDEF SUPPORTS_INLINE}
- {$DEFINE ALLOW_INLINE}
- {$ENDIF}
- uses
- Windows, ActiveX,
- SysUtils, Direct3D9, DXTypes;
- const
- //////////// DLL export definitions ///////////////////////////////////////
- d3dx9MicrosoftDLL = 'd3dx9_31.dll';
- d3dx9MicrosoftDebugDLL = 'd3dx9d_31.dll';
- d3dx9BorlandDLL = d3dx9MicrosoftDLL; // Compatibility with previous header releases
- d3dx9dll = {$IFDEF DEBUG}d3dx9MicrosoftDebugDLL{$ELSE}d3dx9MicrosoftDLL{$ENDIF};
- {$UNDEF D3DX_SEPARATE}
- d3dx9mathDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abMath.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9coreDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abCore.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9shaderDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abShader.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9effectDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abEffect.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9meshDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abMesh.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9shapesDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abShapes.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9texDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abTex.dll'{$ELSE}d3dx9dll{$ENDIF};
- d3dx9animDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abAnim.dll'{$ELSE}d3dx9dll{$ENDIF};
- {$IFNDEF COMPILER6_UP}
- type
- PPointer = ^Pointer;
- PPAnsiChar = ^PAnsiChar;
- {$ENDIF}
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright (C) Microsoft Corporation. All Rights Reserved.
- //
- // File: d3dx9.h
- // Content: D3DX utility library
- //
- //////////////////////////////////////////////////////////////////////////////
- const
- // #define D3DX_DEFAULT ULONG_MAX
- // #define D3DX_DEFAULT ((UINT) -1)
- D3DX_DEFAULT = Cardinal(-1);
- {$EXTERNALSYM D3DX_DEFAULT}
- // #define D3DX_DEFAULT_NONPOW2 ((UINT) -2)
- D3DX_DEFAULT_NONPOW2 = Cardinal(-2);
- {$EXTERNALSYM D3DX_DEFAULT_NONPOW2}
- 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}
- const
- D3DX_FROM_FILE = LongWord(-3);
- {$EXTERNALSYM D3DX_FROM_FILE}
- D3DFMT_FROM_FILE = TD3DFormat(-3);
- {$EXTERNALSYM D3DFMT_FROM_FILE}
- type
- _D3DXERR = HResult;
- {$EXTERNALSYM _D3DXERR}
- const
- D3DXERR_CANNOTMODIFYINDEXBUFFER = HResult(MAKE_D3DHRESULT_R or 2900);
- {$EXTERNALSYM D3DXERR_CANNOTMODIFYINDEXBUFFER}
- D3DXERR_INVALIDMESH = HResult(MAKE_D3DHRESULT_R or 2901);
- {$EXTERNALSYM D3DXERR_INVALIDMESH}
- D3DXERR_CANNOTATTRSORT = HResult(MAKE_D3DHRESULT_R or 2902);
- {$EXTERNALSYM D3DXERR_CANNOTATTRSORT}
- D3DXERR_SKINNINGNOTSUPPORTED = HResult(MAKE_D3DHRESULT_R or 2903);
- {$EXTERNALSYM D3DXERR_SKINNINGNOTSUPPORTED}
- D3DXERR_TOOMANYINFLUENCES = HResult(MAKE_D3DHRESULT_R or 2904);
- {$EXTERNALSYM D3DXERR_TOOMANYINFLUENCES}
- D3DXERR_INVALIDDATA = HResult(MAKE_D3DHRESULT_R or 2905);
- {$EXTERNALSYM D3DXERR_INVALIDDATA}
- D3DXERR_LOADEDMESHASNODATA = HResult(MAKE_D3DHRESULT_R or 2906);
- {$EXTERNALSYM D3DXERR_LOADEDMESHASNODATA}
- D3DXERR_DUPLICATENAMEDFRAGMENT = HResult(MAKE_D3DHRESULT_R or 2907);
- {$EXTERNALSYM D3DXERR_DUPLICATENAMEDFRAGMENT}
- D3DXERR_CANNOTREMOVELASTITEM = HResult(MAKE_D3DHRESULT_R or 2908);
- {$EXTERNALSYM D3DXERR_CANNOTREMOVELASTITEM}
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright (C) Microsoft Corporation. All Rights Reserved.
- //
- // File: d3dx9math.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;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXToRadian}
- //#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI))
- function D3DXToDegree(Radian: Single): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXToDegree}
- //===========================================================================
- //
- // 16 bit floating point numbers
- //
- //===========================================================================
- const
- D3DX_16F_DIG = 3; // # of decimal digits of precision
- {$EXTERNALSYM D3DX_16F_DIG}
- D3DX_16F_EPSILON = 4.8875809e-4; // smallest such that 1.0 + epsilon <> 1.0
- {$EXTERNALSYM D3DX_16F_EPSILON}
- D3DX_16F_MANT_DIG = 11; // # of bits in mantissa
- {$EXTERNALSYM D3DX_16F_MANT_DIG}
- D3DX_16F_MAX = 6.550400e+004; // max value
- {$EXTERNALSYM D3DX_16F_MAX}
- D3DX_16F_MAX_10_EXP = 4; // max decimal exponent
- {$EXTERNALSYM D3DX_16F_MAX_10_EXP}
- D3DX_16F_MAX_EXP = 15; // max binary exponent
- {$EXTERNALSYM D3DX_16F_MAX_EXP}
- D3DX_16F_MIN = 6.1035156e-5; // min positive value
- {$EXTERNALSYM D3DX_16F_MIN}
- D3DX_16F_MIN_10_EXP = -4; // min decimal exponent
- {$EXTERNALSYM D3DX_16F_MIN_10_EXP}
- D3DX_16F_MIN_EXP = -14; // min binary exponent
- {$EXTERNALSYM D3DX_16F_MIN_EXP}
- D3DX_16F_RADIX = 2; // exponent radix
- {$EXTERNALSYM D3DX_16F_RADIX}
- D3DX_16F_ROUNDS = 1; // addition rounding: near
- {$EXTERNALSYM D3DX_16F_ROUNDS}
- type
- (*$HPPEMIT 'typedef D3DXFLOAT16 TD3DXFloat16;' *)
- (*$HPPEMIT 'typedef D3DXFLOAT16 *PD3DXFloat16;' *)
- PD3DXFloat16 = ^TD3DXFloat16;
- {$EXTERNALSYM PD3DXFloat16}
- TD3DXFloat16 = packed record
- value: Word;
- end;
- {$NODEFINE TD3DXFloat16}
- // Some pascal equalents of C++ class functions & operators
- const D3DXFloat16Zero: TD3DXFloat16 = (value:0); // 0
- function D3DXFloat16(value: Single): TD3DXFloat16;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXFloat16Equal(const v1, v2: TD3DXFloat16): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXFloat16ToFloat(value: TD3DXFloat16): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //===========================================================================
- //
- // Vectors
- //
- //===========================================================================
- //--------------------------
- // 2D Vector
- //--------------------------
- type
- (*$HPPEMIT 'typedef D3DXVECTOR2 TD3DXVector2;' *)
- (*$HPPEMIT 'typedef D3DXVECTOR2 *PD3DXVector2;' *)
- PD3DXVector2 = ^TD3DXVector2;
- {$EXTERNALSYM PD3DXVector2}
- TD3DXVector2 = 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;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //--------------------------
- // 2D Vector (16 bit)
- //--------------------------
- type
- (*$HPPEMIT 'typedef D3DXVECTOR2_16F TD3DXVector2_16F;' *)
- (*$HPPEMIT 'typedef D3DXVECTOR2_16F *PD3DXVector2_16F;' *)
- PD3DXVector2_16F = ^TD3DXVector2_16F;
- {$EXTERNALSYM PD3DXVector2_16F}
- TD3DXVector2_16F = packed record
- x, y: TD3DXFloat16;
- end;
- {$NODEFINE TD3DXVector2_16F}
- // Some pascal equalents of C++ class functions & operators
- const D3DXVector2_16fZero: TD3DXVector2_16F = (x:(value:0); y:(value:0)); // (0,0)
- function D3DXVector2_16F(_x, _y: TD3DXFloat16): TD3DXVector2_16F;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector2_16fEqual(const v1, v2: TD3DXVector2_16F): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector2_16fFromVector2(const v: TD3DXVector2): TD3DXVector2_16f;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector2FromVector2_16f(const v: TD3DXVector2_16f): TD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //--------------------------
- // 3D Vector
- //--------------------------
- type
- (*$HPPEMIT 'typedef D3DXVECTOR3 TD3DXVector3;' *)
- (*$HPPEMIT 'typedef D3DXVECTOR3 *PD3DXVector3;' *)
- PD3DXVector3 = ^TD3DXVector3;
- {$EXTERNALSYM 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;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //--------------------------
- // 3D Vector (16 bit)
- //--------------------------
- type
- (*$HPPEMIT 'typedef D3DXVECTOR3_16F TD3DXVector3_16F;' *)
- (*$HPPEMIT 'typedef D3DXVECTOR3_16F *PD3DXVector3_16F;' *)
- PD3DXVector3_16F = ^TD3DXVector3_16F;
- {$EXTERNALSYM PD3DXVector3}
- TD3DXVector3_16F = packed record
- x, y, z: TD3DXFloat16;
- end;
- {$NODEFINE TD3DXVector3_16F}
- // Some pascal equalents of C++ class functions & operators
- const D3DXVector3_16fZero: TD3DXVector3_16F = (x:(value:0); y:(value:0); z:(value:0)); // (0,0,0)
- function D3DXVector3_16F(_x, _y, _z: TD3DXFloat16): TD3DXVector3_16F;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector3_16fEqual(const v1, v2: TD3DXVector3_16F): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector3_16fFromVector3(const v: TD3DXVector3): TD3DXVector3_16f;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector3FromVector3_16f(const v: TD3DXVector3_16f): TD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //--------------------------
- // 4D Vector
- //--------------------------
- type
- (*$HPPEMIT 'typedef D3DXVECTOR4 TD3DXVector4;' *)
- (*$HPPEMIT 'typedef D3DXVECTOR4 *PD3DXVector4;' *)
- PD3DXVector4 = ^TD3DXVector4;
- {$EXTERNALSYM PD3DXVector4}
- TD3DXVector4 = 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; overload;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector4(xyz: TD3DXVector3; _w: Single): TD3DXVector4; overload;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //--------------------------
- // 4D Vector (16 bit)
- //--------------------------
- type
- (*$HPPEMIT 'typedef D3DXVECTOR4_16F TD3DXVector4_16F;' *)
- (*$HPPEMIT 'typedef D3DXVECTOR4_16F *PD3DXVector4_16F;' *)
- PD3DXVector4_16F = ^TD3DXVector4_16F;
- {$EXTERNALSYM PD3DXVector4_16F}
- TD3DXVector4_16F = packed record
- x, y, z, w: TD3DXFloat16;
- end;
- {$NODEFINE TD3DXVector4_16F}
- // Some pascal equalents of C++ class functions & operators
- const D3DXVector4_16fZero: TD3DXVector4_16F = (x:(value:0); y:(value:0); z:(value:0); w:(value:0)); // (0,0,0,0)
- function D3DXVector4_16F(_x, _y, _z, _w: TD3DXFloat16): TD3DXVector4_16F; overload;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector4_16F(xyz: TD3DXVector3_16f; _w: TD3DXFloat16): TD3DXVector4_16F; overload;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector4_16fEqual(const v1, v2: TD3DXVector4_16F): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector4_16fFromVector4(const v: TD3DXVector4): TD3DXVector4_16f;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXVector4FromVector4_16f(const v: TD3DXVector4_16f): TD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //===========================================================================
- //
- // Matrices
- //
- //===========================================================================
- type
- (*$HPPEMIT 'typedef D3DXMATRIX TD3DXMatrix;' *)
- (*$HPPEMIT 'typedef D3DXMATRIX *PD3DXMatrix;' *)
- (*$HPPEMIT 'typedef D3DXMATRIX **PPD3DXMatrix;' *)
- PPD3DXMatrix = ^PD3DXMatrix;
- PD3DXMatrix = ^TD3DXMatrix;
- {$EXTERNALSYM 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;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //---------------------------------------------------------------------------
- // 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
- (*$HPPEMIT 'typedef D3DXQUATERNION TD3DXQuaternion;' *)
- PD3DXQuaternion = ^TD3DXQuaternion;
- TD3DXQuaternion = record
- x, y, z, w: Single;
- end;
- {$NODEFINE TD3DXQuaternion}
- // Some pascal equalents of C++ class functions & operators
- function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion;
- s: Single): PD3DXQuaternion;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //===========================================================================
- //
- // Planes
- //
- //===========================================================================
- type
- (*$HPPEMIT 'typedef D3DXPLANE TD3DXPlane;' *)
- PD3DXPlane = ^TD3DXPlane;
- TD3DXPlane = record
- a, b, c, d: Single;
- end;
- {$NODEFINE 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;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //===========================================================================
- //
- // Colors
- //
- //===========================================================================
- type
- (*$HPPEMIT 'typedef D3DXCOLOR TD3DXColor;' *)
- (*$HPPEMIT 'typedef D3DXCOLOR *PD3DXColor;' *)
- PD3DXColor = PD3DColorValue;
- {$EXTERNALSYM PD3DXColor}
- TD3DXColor = TD3DColorValue;
- {$EXTERNALSYM TD3DXColor}
- function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXColorToDWord(c: TD3DXColor): DWord;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXColorFromDWord(c: DWord): TD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- //===========================================================================
- //
- // 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.
- //
- //===========================================================================
- //--------------------------
- // Float16
- //--------------------------
- // non-inline
- // Converts an array 32-bit floats to 16-bit floats
- function D3DXFloat32To16Array(pOut: PD3DXFloat16; pIn: PSingle; n: LongWord): PD3DXFloat16; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXFloat32To16Array}
- // Converts an array 16-bit floats to 32-bit floats
- function D3DXFloat16To32Array(pOut: PSingle; pIn: PD3DXFloat16; n: LongWord): PSingle; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXFloat16To32Array}
- //--------------------------
- // 2D Vector
- //--------------------------
- // inline
- function D3DXVec2Length(const v: TD3DXVector2): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Length}
- function D3DXVec2LengthSq(const v: TD3DXVector2): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2LengthSq}
- function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Dot}
- // Z component of ((x1,y1,0) cross (x2,y2,0))
- function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2CCW}
- function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Add}
- function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Subtract}
- // Minimize each component. x = min(x1, x2), y = min(y1, y2)
- function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Minimize}
- // Maximize each component. x = max(x1, x2), y = max(y1, y2)
- function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Maximize}
- function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Scale}
- // Linear interpolation. V1 + s(V2-V1)
- function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec2Lerp}
- // non-inline
- function D3DXVec2Normalize(out vOut: TD3DXVector2; const v: TD3DXVector2): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2Normalize}
- // Hermite interpolation between position V1, tangent T1 (when s == 0)
- // and position V2, tangent T2 (when s == 1).
- function D3DXVec2Hermite(out vOut: TD3DXVector2;
- const v1, t1, v2, t2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2Hermite}
- // CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
- function D3DXVec2CatmullRom(out vOut: TD3DXVector2;
- const v0, v1, v2, v3: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2CatmullRom}
- // Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
- function D3DXVec2BaryCentric(out vOut: TD3DXVector2;
- const v1, v2, v3: TD3DXVector2; f, g: Single): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2BaryCentric}
- // Transform (x, y, 0, 1) by matrix.
- function D3DXVec2Transform(out vOut: TD3DXVector4;
- const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2Transform}
- // Transform (x, y, 0, 1) by matrix, project result back into w=1.
- function D3DXVec2TransformCoord(out vOut: TD3DXVector2;
- const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2TransformCoord}
- // Transform (x, y, 0, 0) by matrix.
- function D3DXVec2TransformNormal(out vOut: TD3DXVector2;
- const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2TransformNormal}
- // Transform Array (x, y, 0, 1) by matrix.
- function D3DXVec2TransformArray(pOut: PD3DXVector4; OutStride: LongWord;
- pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2TransformArray}
- // Transform Array (x, y, 0, 1) by matrix, project result back into w=1.
- function D3DXVec2TransformCoordArray(pOut: PD3DXVector2; OutStride: LongWord;
- pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2TransformCoordArray}
- // Transform Array (x, y, 0, 0) by matrix.
- function D3DXVec2TransformNormalArray(pOut: PD3DXVector2; OutStride: LongWord;
- pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector2; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec2TransformNormalArray}
- //--------------------------
- // 3D Vector
- //--------------------------
- // inline
- function D3DXVec3Length(const v: TD3DXVector3): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Length}
- function D3DXVec3LengthSq(const v: TD3DXVector3): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3LengthSq}
- function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Dot}
- function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Cross}
- function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Add}
- function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Subtract}
- // Minimize each component. x = min(x1, x2), y = min(y1, y2), ...
- function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Minimize}
- // Maximize each component. x = max(x1, x2), y = max(y1, y2), ...
- function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Maximize}
- function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Scale}
- // Linear interpolation. V1 + s(V2-V1)
- function D3DXVec3Lerp(out vOut: TD3DXVector3;
- const v1, v2: TD3DXVector3; s: Single): PD3DXVector3;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec3Lerp}
- // non-inline
- function D3DXVec3Normalize(out vOut: TD3DXVector3;
- const v: TD3DXVector3): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3Normalize}
- // Hermite interpolation between position V1, tangent T1 (when s == 0)
- // and position V2, tangent T2 (when s == 1).
- function D3DXVec3Hermite(out vOut: TD3DXVector3;
- const v1, t1, v2, t2: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3Hermite}
- // CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
- function D3DXVec3CatmullRom(out vOut: TD3DXVector3;
- const v0, v1, v2, v3: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3CatmullRom}
- // Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
- function D3DXVec3BaryCentric(out vOut: TD3DXVector3;
- const v1, v2, v3: TD3DXVector3; f, g: Single): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3BaryCentric}
- // Transform (x, y, z, 1) by matrix.
- function D3DXVec3Transform(out vOut: TD3DXVector4;
- const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3Transform}
- // Transform (x, y, z, 1) by matrix, project result back into w=1.
- function D3DXVec3TransformCoord(out vOut: TD3DXVector3;
- const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3TransformCoord}
- // Transform (x, y, z, 0) by matrix. If you transforming a normal by a
- // non-affine matrix, the matrix you pass to this function should be the
- // transpose of the inverse of the matrix you would use to transform a coord.
- function D3DXVec3TransformNormal(out vOut: TD3DXVector3;
- const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3TransformNormal}
- // Transform Array (x, y, z, 1) by matrix.
- function D3DXVec3TransformArray(pOut: PD3DXVector4; OutStride: LongWord;
- pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3TransformArray}
- // Transform Array (x, y, z, 1) by matrix, project result back into w=1.
- function D3DXVec3TransformCoordArray(pOut: PD3DXVector3; OutStride: LongWord;
- pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3TransformCoordArray}
- // Transform (x, y, z, 0) by matrix. If you transforming a normal by a
- // non-affine matrix, the matrix you pass to this function should be the
- // transpose of the inverse of the matrix you would use to transform a coord.
- function D3DXVec3TransformNormalArray(pOut: PD3DXVector3; OutStride: LongWord;
- pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3TransformNormalArray}
- // Project vector from object space into screen space
- function D3DXVec3Project(out vOut: TD3DXVector3;
- const v: TD3DXVector3; const pViewport: TD3DViewport9;
- const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3Project}
- // Project vector from screen space into object space
- function D3DXVec3Unproject(out vOut: TD3DXVector3;
- const v: TD3DXVector3; const pViewport: TD3DViewport9;
- const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3Unproject}
- // Project vector Array from object space into screen space
- function D3DXVec3ProjectArray(pOut: PD3DXVector3; OutStride: LongWord;
- pV: PD3DXVector3; VStride: LongWord; const pViewport: TD3DViewport9;
- const pProjection, pView, pWorld: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3ProjectArray}
- // Project vector Array from screen space into object space
- function D3DXVec3UnprojectArray(pOut: PD3DXVector3; OutStride: LongWord;
- pV: PD3DXVector3; VStride: LongWord; const pViewport: TD3DViewport9;
- const pProjection, pView, pWorld: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec3UnprojectArray}
- //--------------------------
- // 4D Vector
- //--------------------------
- // inline
- function D3DXVec4Length(const v: TD3DXVector4): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Length}
- function D3DXVec4LengthSq(const v: TD3DXVector4): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4LengthSq}
- function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Dot}
- function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Add}
- function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Subtract}
- // Minimize each component. x = min(x1, x2), y = min(y1, y2), ...
- function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Minimize}
- // Maximize each component. x = max(x1, x2), y = max(y1, y2), ...
- function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Maximize}
- function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Scale}
- // Linear interpolation. V1 + s(V2-V1)
- function D3DXVec4Lerp(out vOut: TD3DXVector4;
- const v1, v2: TD3DXVector4; s: Single): PD3DXVector4;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXVec4Lerp}
- // non-inline
- // Cross-product in 4 dimensions.
- function D3DXVec4Cross(out vOut: TD3DXVector4;
- const v1, v2, v3: TD3DXVector4): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4Cross}
- function D3DXVec4Normalize(out vOut: TD3DXVector4;
- const v: TD3DXVector4): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4Normalize}
- // Hermite interpolation between position V1, tangent T1 (when s == 0)
- // and position V2, tangent T2 (when s == 1).
- function D3DXVec4Hermite(out vOut: TD3DXVector4;
- const v1, t1, v2, t2: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4Hermite}
- // CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
- function D3DXVec4CatmullRom(out vOut: TD3DXVector4;
- const v0, v1, v2, v3: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4CatmullRom}
- // Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
- function D3DXVec4BaryCentric(out vOut: TD3DXVector4;
- const v1, v2, v3: TD3DXVector4; f, g: Single): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4BaryCentric}
- // Transform vector by matrix.
- function D3DXVec4Transform(out vOut: TD3DXVector4;
- const v: TD3DXVector4; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4Transform}
- // Transform vector array by matrix.
- function D3DXVec4TransformArray(pOut: PD3DXVector4; OutStride: LongWord;
- pV: PD3DXVector4; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXVec4TransformArray}
- //--------------------------
- // 4D Matrix
- //--------------------------
- // inline
- function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXMatrixIdentity}
- function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXMatrixIsIdentity}
- // non-inline
- function D3DXMatrixDeterminant(const m: TD3DXMatrix): Single; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixDeterminant}
- function D3DXMatrixDecompose(pOutScale: PD3DXVector3; pOutRotation: PD3DXQuaternion;
- pOutTranslation: PD3DXVector3; const M: TD3DXMatrix): HRESULT; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixDecompose}
- function D3DXMatrixTranspose(out pOut: TD3DXMatrix; const pM: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixTranspose}
- // Matrix multiplication. The result represents the transformation M2
- // followed by the transformation M1. (Out = M1 * M2)
- function D3DXMatrixMultiply(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixMultiply}
- // Matrix multiplication, followed by a transpose. (Out = T(M1 * M2))
- function D3DXMatrixMultiplyTranspose(out pOut: TD3DXMatrix; const pM1, pM2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixMultiplyTranspose}
- // Calculate inverse of matrix. Inversion my fail, in which case NULL will
- // be returned. The determinant of pM is also returned it pfDeterminant
- // is non-NULL.
- function D3DXMatrixInverse(out mOut: TD3DXMatrix; pfDeterminant: PSingle;
- const m: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixInverse}
- // Build a matrix which scales by (sx, sy, sz)
- function D3DXMatrixScaling(out mOut: TD3DXMatrix; sx, sy, sz: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixScaling}
- // Build a matrix which translates by (x, y, z)
- function D3DXMatrixTranslation(out mOut: TD3DXMatrix; x, y, z: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixTranslation}
- // Build a matrix which rotates around the X axis
- function D3DXMatrixRotationX(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixRotationX}
- // Build a matrix which rotates around the Y axis
- function D3DXMatrixRotationY(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixRotationY}
- // Build a matrix which rotates around the Z axis
- function D3DXMatrixRotationZ(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixRotationZ}
- // Build a matrix which rotates around an arbitrary axis
- function D3DXMatrixRotationAxis(out mOut: TD3DXMatrix; const v: TD3DXVector3;
- angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixRotationAxis}
- // Build a matrix from a quaternion
- function D3DXMatrixRotationQuaternion(out mOut: TD3DXMatrix; const Q: TD3DXQuaternion): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixRotationQuaternion}
- // Yaw around the Y axis, a pitch around the X axis,
- // and a roll around the Z axis.
- function D3DXMatrixRotationYawPitchRoll(out mOut: TD3DXMatrix; yaw, pitch, roll: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixRotationYawPitchRoll}
- // Build transformation matrix. NULL arguments are treated as identity.
- // Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt
- function D3DXMatrixTransformation(out mOut: TD3DXMatrix;
- pScalingCenter: PD3DXVector3;
- pScalingRotation: PD3DXQuaternion; pScaling, pRotationCenter: PD3DXVector3;
- pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixTransformation}
- // Build 2D transformation matrix in XY plane. NULL arguments are treated as identity.
- // Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt
- function D3DXMatrixTransformation2D(out pOut: TD3DXMatrix;
- pScalingCenter: PD3DXVector2;
- ScalingRotation: Single; pScaling: PD3DXVector2; pRotationCenter: PD3DXVector2;
- Rotation: Single; pTranslation: PD3DXVector2): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixTransformation2D}
- // Build affine transformation matrix. NULL arguments are treated as identity.
- // Mout = Ms * Mrc-1 * Mr * Mrc * Mt
- function D3DXMatrixAffineTransformation(out mOut: TD3DXMatrix;
- Scaling: Single; pRotationCenter: PD3DXVector3;
- pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixAffineTransformation}
- // Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity.
- // Mout = Ms * Mrc-1 * Mr * Mrc * Mt
- function D3DXMatrixAffineTransformation2D(out mOut: TD3DXMatrix;
- Scaling: Single; pRotationCenter: PD3DXVector2;
- Rotation: Single; pTranslation: PD3DXVector2): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixAffineTransformation2D}
- // Build a lookat matrix. (right-handed)
- function D3DXMatrixLookAtRH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixLookAtRH}
- // Build a lookat matrix. (left-handed)
- function D3DXMatrixLookAtLH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixLookAtLH}
- // Build a perspective projection matrix. (right-handed)
- function D3DXMatrixPerspectiveRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixPerspectiveRH}
- // Build a perspective projection matrix. (left-handed)
- function D3DXMatrixPerspectiveLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixPerspectiveLH}
- // Build a perspective projection matrix. (right-handed)
- function D3DXMatrixPerspectiveFovRH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixPerspectiveFovRH}
- // Build a perspective projection matrix. (left-handed)
- function D3DXMatrixPerspectiveFovLH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixPerspectiveFovLH}
- // Build a perspective projection matrix. (right-handed)
- function D3DXMatrixPerspectiveOffCenterRH(out mOut: TD3DXMatrix;
- l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixPerspectiveOffCenterRH}
- // Build a perspective projection matrix. (left-handed)
- function D3DXMatrixPerspectiveOffCenterLH(out mOut: TD3DXMatrix;
- l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixPerspectiveOffCenterLH}
- // Build an ortho projection matrix. (right-handed)
- function D3DXMatrixOrthoRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixOrthoRH}
- // Build an ortho projection matrix. (left-handed)
- function D3DXMatrixOrthoLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixOrthoLH}
- // Build an ortho projection matrix. (right-handed)
- function D3DXMatrixOrthoOffCenterRH(out mOut: TD3DXMatrix;
- l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixOrthoOffCenterRH}
- // Build an ortho projection matrix. (left-handed)
- function D3DXMatrixOrthoOffCenterLH(out mOut: TD3DXMatrix;
- l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixOrthoOffCenterLH}
- // Build a matrix which flattens geometry into a plane, as if casting
- // a shadow from a light.
- function D3DXMatrixShadow(out mOut: TD3DXMatrix;
- const Light: TD3DXVector4; const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixShadow}
- // Build a matrix which reflects the coordinate system about a plane
- function D3DXMatrixReflect(out mOut: TD3DXMatrix;
- const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXMatrixReflect}
- //--------------------------
- // Quaternion
- //--------------------------
- // inline
- function D3DXQuaternionLength(const q: TD3DXQuaternion): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXQuaternionLength}
- // Length squared, or "norm"
- function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXQuaternionLengthSq}
- function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXQuaternionDot}
- // (0, 0, 0, 1)
- function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXQuaternionIdentity}
- function D3DXQuaternionIsIdentity (const q: TD3DXQuaternion): BOOL;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXQuaternionIsIdentity}
- // (-x, -y, -z, w)
- function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion;
- const q: TD3DXQuaternion): PD3DXQuaternion;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXQuaternionConjugate}
- // non-inline
- // Compute a quaternin's axis and angle of rotation. Expects unit quaternions.
- procedure D3DXQuaternionToAxisAngle(const q: TD3DXQuaternion;
- out Axis: TD3DXVector3; out Angle: Single); stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionToAxisAngle}
- // Build a quaternion from a rotation matrix.
- function D3DXQuaternionRotationMatrix(out qOut: TD3DXQuaternion;
- const m: TD3DXMatrix): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionRotationMatrix}
- // Rotation about arbitrary axis.
- function D3DXQuaternionRotationAxis(out qOut: TD3DXQuaternion;
- const v: TD3DXVector3; Angle: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionRotationAxis}
- // Yaw around the Y axis, a pitch around the X axis,
- // and a roll around the Z axis.
- function D3DXQuaternionRotationYawPitchRoll(out qOut: TD3DXQuaternion;
- yaw, pitch, roll: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionRotationYawPitchRoll}
- // Quaternion multiplication. The result represents the rotation Q2
- // followed by the rotation Q1. (Out = Q2 * Q1)
- function D3DXQuaternionMultiply(out qOut: TD3DXQuaternion;
- const q1, q2: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionMultiply}
- function D3DXQuaternionNormalize(out qOut: TD3DXQuaternion;
- const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionNormalize}
- // Conjugate and re-norm
- function D3DXQuaternionInverse(out qOut: TD3DXQuaternion;
- const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionInverse}
- // Expects unit quaternions.
- // if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v)
- function D3DXQuaternionLn(out qOut: TD3DXQuaternion;
- const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionLn}
- // Expects pure quaternions. (w == 0) w is ignored in calculation.
- // if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v)
- function D3DXQuaternionExp(out qOut: TD3DXQuaternion;
- const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionExp}
- // Spherical linear interpolation between Q1 (s == 0) and Q2 (s == 1).
- // Expects unit quaternions.
- function D3DXQuaternionSlerp(out qOut: TD3DXQuaternion;
- const q1, q2: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionSlerp}
- // Spherical quadrangle interpolation.
- // Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t))
- function D3DXQuaternionSquad(out qOut: TD3DXQuaternion;
- const pQ1, pA, pB, pC: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionSquad}
- // Setup control points for spherical quadrangle interpolation
- // from Q1 to Q2. The control points are chosen in such a way
- // to ensure the continuity of tangents with adjacent segments.
- procedure D3DXQuaternionSquadSetup(out pAOut, pBOut, pCOut: TD3DXQuaternion;
- const pQ0, pQ1, pQ2, pQ3: TD3DXQuaternion); stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionSquadSetup}
- // Barycentric interpolation.
- // Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g))
- function D3DXQuaternionBaryCentric(out qOut: TD3DXQuaternion;
- const q1, q2, q3: TD3DXQuaternion; f, g: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXQuaternionBaryCentric}
- //--------------------------
- // Plane
- //--------------------------
- // inline
- // ax + by + cz + dw
- function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXPlaneDot}
- // ax + by + cz + d
- function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXPlaneDotCoord}
- // ax + by + cz
- function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXPlaneDotNormal}
- function D3DXPlaneScale(out pOut: TD3DXPlane; const pP: TD3DXPlane; s: Single): PD3DXPlane;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXPlaneScale}
- // non-inline
- // Normalize plane (so that |a,b,c| == 1)
- function D3DXPlaneNormalize(out pOut: TD3DXPlane; const p: TD3DXPlane): PD3DXPlane; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXPlaneNormalize}
- // Find the intersection between a plane and a line. If the line is
- // parallel to the plane, NULL is returned.
- function D3DXPlaneIntersectLine(out pOut: TD3DXVector3;
- const p: TD3DXPlane; const v1, v2: TD3DXVector3): PD3DXVector3; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXPlaneIntersectLine}
- // Construct a plane from a point and a normal
- function D3DXPlaneFromPointNormal(out pOut: TD3DXPlane;
- const vPoint, vNormal: TD3DXVector3): PD3DXPlane; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXPlaneFromPointNormal}
- // Construct a plane from 3 points
- function D3DXPlaneFromPoints(out pOut: TD3DXPlane;
- const v1, v2, v3: TD3DXVector3): PD3DXPlane; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXPlaneFromPoints}
- // Transform a plane by a matrix. The vector (a,b,c) must be normal.
- // M should be the inverse transpose of the transformation desired.
- function D3DXPlaneTransform(out pOut: TD3DXPlane; const p: TD3DXPlane; const m: TD3DXMatrix): PD3DXPlane; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXPlaneTransform}
- // Transform an array of planes by a matrix. The vectors (a,b,c) must be normal.
- // M should be the inverse transpose of the transformation desired.
- function D3DXPlaneTransformArray(pOut: PD3DXPlane; OutStride: LongWord;
- pP: PD3DXPlane; PStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXPlane; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXPlaneTransformArray}
- //--------------------------
- // Color
- //--------------------------
- // inline
- // (1-r, 1-g, 1-b, a)
- function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXColorNegative}
- function D3DXColorAdd(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXColorAdd}
- function D3DXColorSubtract(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXColorSubtract}
- function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXColorScale}
- // (r1*r2, g1*g2, b1*b2, a1*a2)
- function D3DXColorModulate(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXColorModulate}
- // Linear interpolation of r,g,b, and a. C1 + s(C2-C1)
- function D3DXColorLerp(out cOut: TD3DXColor; const c1, c2: TD3DXColor; s: Single): PD3DXColor;{$IFDEF ALLOW_INLINE} inline;{$ENDIF}
- {$EXTERNALSYM D3DXColorLerp}
- // non-inline
- // Interpolate r,g,b between desaturated color and color.
- // DesaturatedColor + s(Color - DesaturatedColor)
- function D3DXColorAdjustSaturation(out cOut: TD3DXColor;
- const pC: TD3DXColor; s: Single): PD3DXColor; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXColorAdjustSaturation}
- // Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey)
- function D3DXColorAdjustContrast(out cOut: TD3DXColor;
- const pC: TD3DXColor; c: Single): PD3DXColor; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXColorAdjustContrast}
- //--------------------------
- // Misc
- //--------------------------
- // Calculate Fresnel term given the cosine of theta (likely obtained by
- // taking the dot of two normals), and the refraction index of the material.
- function D3DXFresnelTerm(CosTheta, RefractionIndex: Single): Single; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXFresnelTerm}
- //===========================================================================
- //
- // Matrix Stack
- //
- //===========================================================================
- type
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMatrixStack);'}
- {$EXTERNALSYM ID3DXMatrixStack}
- ID3DXMatrixStack = interface(IUnknown)
- ['{C7885BA7-F990-4fe7-922D-8515E477DD85}']
- //
- // ID3DXMatrixStack methods
- //
- // Pops the top of the stack, returns the current top
- // *after* popping the top.
- function Pop: HResult; stdcall;
- // Pushes the stack by one, duplicating the current matrix.
- function Push: HResult; stdcall;
- // Loads identity in the current matrix.
- function LoadIdentity: HResult; stdcall;
- // Loads the given matrix into the current matrix
- function LoadMatrix(const M: TD3DXMatrix): HResult; stdcall;
- // Right-Multiplies the given matrix to the current matrix.
- // (transformation is about the current world origin)
- function MultMatrix(const M: TD3DXMatrix): HResult; stdcall;
- // Left-Multiplies the given matrix to the current matrix
- // (transformation is about the local origin of the object)
- function MultMatrixLocal(const M: TD3DXMatrix): HResult; stdcall;
- // Right multiply the current matrix with the computed rotation
- // matrix, counterclockwise about the given axis with the given angle.
- // (rotation is about the current world origin)
- function RotateAxis(const V: TD3DXVector3; Angle: Single): HResult; stdcall;
- // Left multiply the current matrix with the computed rotation
- // matrix, counterclockwise about the given axis with the given angle.
- // (rotation is about the local origin of the object)
- function RotateAxisLocal(const V: TD3DXVector3; Angle: Single): HResult; stdcall;
- // Right multiply the current matrix with the computed rotation
- // matrix. All angles are counterclockwise. (rotation is about the
- // current world origin)
- // The rotation is composed of a yaw around the Y axis, a pitch around
- // the X axis, and a roll around the Z axis.
- function RotateYawPitchRoll(yaw, pitch, roll: Single): HResult; stdcall;
- // Left multiply the current matrix with the computed rotation
- // matrix. All angles are counterclockwise. (rotation is about the
- // local origin of the object)
- // The rotation is composed of a yaw around the Y axis, a pitch around
- // the X axis, and a roll around the Z axis.
- function RotateYawPitchRollLocal(yaw, pitch, roll: Single): HResult; stdcall;
- // Right multiply the current matrix with the computed scale
- // matrix. (transformation is about the current world origin)
- function Scale(x, y, z: Single): HResult; stdcall;
- // Left multiply the current matrix with the computed scale
- // matrix. (transformation is about the local origin of the object)
- function ScaleLocal(x, y, z: Single): HResult; stdcall;
- // Right multiply the current matrix with the computed translation
- // matrix. (transformation is about the current world origin)
- function Translate(x, y, z: Single): HResult; stdcall;
- // Left multiply the current matrix with the computed translation
- // matrix. (transformation is about the local origin of the object)
- function TranslateLocal(x, y, z: Single): HResult; stdcall;
- // Obtain the current matrix at the top of the stack
- function GetTop: PD3DXMatrix; stdcall;
- end;
- type
- IID_ID3DXMatrixStack = ID3DXMatrixStack;
- {$EXTERNALSYM IID_ID3DXMatrixStack}
- function D3DXCreateMatrixStack(Flags: DWord; out Stack: ID3DXMatrixStack): HResult; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXCreateMatrixStack}
- //===========================================================================
- //
- // Spherical Harmonic Runtime Routines
- //
- // NOTE:
- // * Most of these functions can take the same object as in and out parameters.
- // The exceptions are the rotation functions.
- //
- // * Out parameters are typically also returned as return values, so that
- // the output of one function may be used as a parameter to another.
- //
- //============================================================================
- //============================================================================
- //
- // Basic Spherical Harmonic math routines
- //
- //============================================================================
- const
- D3DXSH_MINORDER = 2;
- {$EXTERNALSYM D3DXSH_MINORDER}
- D3DXSH_MAXORDER = 6;
- {$EXTERNALSYM D3DXSH_MAXORDER}
- //============================================================================
- //
- // D3DXSHEvalDirection:
- // --------------------
- // Evaluates the Spherical Harmonic basis functions
- //
- // Parameters:
- // pOut
- // Output SH coefficients - basis function Ylm is stored at l*l + m+l
- // This is the pointer that is returned.
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pDir
- // Direction to evaluate in - assumed to be normalized
- //
- //============================================================================
- function D3DXSHEvalDirection(pOut: PSingle; Order: LongWord;
- const pDir: TD3DXVector3): PSingle; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHEvalDirection}
- //============================================================================
- //
- // D3DXSHRotate:
- // --------------------
- // Rotates SH vector by a rotation matrix
- //
- // Parameters:
- // pOut
- // Output SH coefficients - basis function Ylm is stored at l*l + m+l
- // This is the pointer that is returned (should not alias with pIn.)
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pMatrix
- // Matrix used for rotation - rotation sub matrix should be orthogonal
- // and have a unit determinant.
- // pIn
- // Input SH coeffs (rotated), incorect results if this is also output.
- //
- //============================================================================
- function D3DXSHRotate(pOut: PSingle; Order: LongWord;
- const pMatrix: TD3DXMatrix; pIn: PSingle): PSingle; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHRotate}
- //============================================================================
- //
- // D3DXSHRotateZ:
- // --------------------
- // Rotates the SH vector in the Z axis by an angle
- //
- // Parameters:
- // pOut
- // Output SH coefficients - basis function Ylm is stored at l*l + m+l
- // This is the pointer that is returned (should not alias with pIn.)
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // Angle
- // Angle in radians to rotate around the Z axis.
- // pIn
- // Input SH coeffs (rotated), incorect results if this is also output.
- //
- //============================================================================
- function D3DXSHRotateZ(pOut: PSingle; Order: LongWord;
- Angle: Single; pIn: PSingle): PSingle; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHRotateZ}
- //============================================================================
- //
- // D3DXSHAdd:
- // --------------------
- // Adds two SH vectors, pOut[i] = pA[i] + pB[i];
- //
- // Parameters:
- // pOut
- // Output SH coefficients - basis function Ylm is stored at l*l + m+l
- // This is the pointer that is returned.
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pA
- // Input SH coeffs.
- // pB
- // Input SH coeffs (second vector.)
- //
- //============================================================================
- function D3DXSHAdd(pOut: PSingle; Order: LongWord;
- pA, pB: PSingle): PSingle; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHAdd}
- //============================================================================
- //
- // D3DXSHScale:
- // --------------------
- // Adds two SH vectors, pOut[i] = pA[i]*Scale;
- //
- // Parameters:
- // pOut
- // Output SH coefficients - basis function Ylm is stored at l*l + m+l
- // This is the pointer that is returned.
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pIn
- // Input SH coeffs.
- // Scale
- // Scale factor.
- //
- //============================================================================
- function D3DXSHScale(pOut: PSingle; Order: LongWord;
- pIn: PSingle; Scale: Single): PSingle; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHScale}
- //============================================================================
- //
- // D3DXSHDot:
- // --------------------
- // Computes the dot product of two SH vectors
- //
- // Parameters:
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pA
- // Input SH coeffs.
- // pB
- // Second set of input SH coeffs.
- //
- //============================================================================
- function D3DXSHDot(Order: LongWord; pA, pB: PSingle): Single; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHDot}
- //============================================================================
- //
- // Basic Spherical Harmonic lighting routines
- //
- //============================================================================
- //============================================================================
- //
- // D3DXSHEvalDirectionalLight:
- // --------------------
- // Evaluates a directional light and returns spectral SH data. The output
- // vector is computed so that if the intensity of R/G/B is unit the resulting
- // exit radiance of a point directly under the light on a diffuse object with
- // an albedo of 1 would be 1.0. This will compute 3 spectral samples, pROut
- // has to be specified, while pGout and pBout are optional.
- //
- // Parameters:
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pDir
- // Direction light is coming from (assumed to be normalized.)
- // RIntensity
- // Red intensity of light.
- // GIntensity
- // Green intensity of light.
- // BIntensity
- // Blue intensity of light.
- // pROut
- // Output SH vector for Red.
- // pGOut
- // Output SH vector for Green (optional.)
- // pBOut
- // Output SH vector for Blue (optional.)
- //
- //============================================================================
- function D3DXSHEvalDirectionalLight(Order: LongWord; const pDir: TD3DXVector3;
- RIntensity: Single; GIntensity: Single; BIntensity: Single;
- pROut, pGOut, pBOut: PSingle): HResult; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHEvalDirectionalLight}
- //============================================================================
- //
- // D3DXSHEvalSphericalLight:
- // --------------------
- // Evaluates a spherical light and returns spectral SH data. There is no
- // normalization of the intensity of the light like there is for directional
- // lights, care has to be taken when specifiying the intensities. This will
- // compute 3 spectral samples, pROut has to be specified, while pGout and
- // pBout are optional.
- //
- // Parameters:
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pPos
- // Position of light - reciever is assumed to be at the origin.
- // Radius
- // Radius of the spherical light source.
- // RIntensity
- // Red intensity of light.
- // GIntensity
- // Green intensity of light.
- // BIntensity
- // Blue intensity of light.
- // pROut
- // Output SH vector for Red.
- // pGOut
- // Output SH vector for Green (optional.)
- // pBOut
- // Output SH vector for Blue (optional.)
- //
- //============================================================================
- function D3DXSHEvalSphericalLight(Order: LongWord; const pPos: TD3DXVector3; Radius: Single;
- RIntensity: Single; GIntensity: Single; BIntensity: Single;
- pROut, pGOut, pBOut: PSingle): HResult; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHEvalSphericalLight}
- //============================================================================
- //
- // D3DXSHEvalConeLight:
- // --------------------
- // Evaluates a light that is a cone of constant intensity and returns spectral
- // SH data. The output vector is computed so that if the intensity of R/G/B is
- // unit the resulting exit radiance of a point directly under the light oriented
- // in the cone direction on a diffuse object with an albedo of 1 would be 1.0.
- // This will compute 3 spectral samples, pROut has to be specified, while pGout
- // and pBout are optional.
- //
- // Parameters:
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pDir
- // Direction light is coming from (assumed to be normalized.)
- // Radius
- // Radius of cone in radians.
- // RIntensity
- // Red intensity of light.
- // GIntensity
- // Green intensity of light.
- // BIntensity
- // Blue intensity of light.
- // pROut
- // Output SH vector for Red.
- // pGOut
- // Output SH vector for Green (optional.)
- // pBOut
- // Output SH vector for Blue (optional.)
- //
- //============================================================================
- function D3DXSHEvalConeLight(Order: LongWord; const pDir: TD3DXVector3; Radius: Single;
- RIntensity: Single; GIntensity: Single; BIntensity: Single;
- pROut, pGOut, pBOut: PSingle): HResult; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHEvalConeLight}
-
- //============================================================================
- //
- // D3DXSHEvalHemisphereLight:
- // --------------------
- // Evaluates a light that is a linear interpolant between two colors over the
- // sphere. The interpolant is linear along the axis of the two points, not
- // over the surface of the sphere (ie: if the axis was (0,0,1) it is linear in
- // Z, not in the azimuthal angle.) The resulting spherical lighting function
- // is normalized so that a point on a perfectly diffuse surface with no
- // shadowing and a normal pointed in the direction pDir would result in exit
- // radiance with a value of 1 if the top color was white and the bottom color
- // was black. This is a very simple model where Top represents the intensity
- // of the "sky" and Bottom represents the intensity of the "ground".
- //
- // Parameters:
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pDir
- // Axis of the hemisphere.
- // Top
- // Color of the upper hemisphere.
- // Bottom
- // Color of the lower hemisphere.
- // pROut
- // Output SH vector for Red.
- // pGOut
- // Output SH vector for Green
- // pBOut
- // Output SH vector for Blue
- //
- //============================================================================
- function D3DXSHEvalHemisphereLight(Order: LongWord; const pDir: TD3DXVector3;
- Top, Bottom: TD3DXColor;
- pROut, pGOut, pBOut: PSingle): HResult; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHEvalHemisphereLight}
- //============================================================================
- //
- // Basic Spherical Harmonic projection routines
- //
- //============================================================================
- //============================================================================
- //
- // D3DXSHProjectCubeMap:
- // --------------------
- // Projects a function represented on a cube map into spherical harmonics.
- //
- // Parameters:
- // Order
- // Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
- // pCubeMap
- // CubeMap that is going to be projected into spherical harmonics
- // pROut
- // Output SH vector for Red.
- // pGOut
- // Output SH vector for Green
- // pBOut
- // Output SH vector for Blue
- //
- //============================================================================
- function D3DXSHProjectCubeMap(Order: LongWord; pCubeMap: IDirect3DCubeTexture9;
- pROut, pGOut, pBOut: PSingle): HResult; stdcall; external d3dx9mathDLL;
- {$EXTERNALSYM D3DXSHProjectCubeMap}
- ///////////////////////////////////////////////////////////////////////////
- //
- // Copyright (C) Microsoft Corporation. All Rights Reserved.
- //
- // File: d3dx9core.h
- // Content: D3DX core types and functions
- //
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
- // D3DX_SDK_VERSION:
- // -----------------
- // This identifier is passed to D3DXCheckVersion in order to ensure that an
- // application was built against the correct header files and lib files.
- // This number is incremented whenever a header (or other) change would
- // require applications to be rebuilt. If the version doesn't match,
- // D3DXCheckVersion will return FALSE. (The number itself has no meaning.)
- ///////////////////////////////////////////////////////////////////////////
- const
- D3DX_VERSION = $0902;
- {$EXTERNALSYM D3DX_VERSION}
- D3DX_SDK_VERSION = 31;
- {$EXTERNALSYM D3DX_SDK_VERSION}
- function D3DXCheckVersion(D3DSdkVersion, D3DXSdkVersion: LongWord): BOOL; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXCheckVersion}
- ///////////////////////////////////////////////////////////////////////////
- // D3DXDebugMute
- // Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute)
- //
- // returns previous mute value
- //
- ///////////////////////////////////////////////////////////////////////////
- function D3DXDebugMute(Mute: BOOL): BOOL; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXDebugMute}
- ///////////////////////////////////////////////////////////////////////////
- // D3DXGetDriverLevel:
- // Returns driver version information:
- //
- // 700 - DX7 level driver
- // 800 - DX8 level driver
- // 900 - DX9 level driver
- ///////////////////////////////////////////////////////////////////////////
- function D3DXGetDriverLevel(pDevice: IDirect3DDevice9): LongWord; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXGetDriverLevel}
- ///////////////////////////////////////////////////////////////////////////
- // ID3DXBuffer:
- // ------------
- // The buffer object is used by D3DX to return arbitrary size data.
- //
- // GetBufferPointer -
- // Returns a pointer to the beginning of the buffer.
- //
- // GetBufferSize -
- // Returns the size of the buffer, in bytes.
- ///////////////////////////////////////////////////////////////////////////
- type
- PID3DXBuffer = ^ID3DXBuffer;
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBuffer);'}
- {$EXTERNALSYM ID3DXBuffer}
- ID3DXBuffer = interface(IUnknown)
- ['{8BA5FB08-5195-40e2-AC58-0D989C3A0102}']
- // ID3DXBuffer
- function GetBufferPointer: Pointer; stdcall;
- function GetBufferSize: DWord; stdcall;
- end;
- IID_ID3DXBuffer = ID3DXBuffer;
- {$EXTERNALSYM IID_ID3DXBuffer}
- //////////////////////////////////////////////////////////////////////////////
- // D3DXSPRITE flags:
- // -----------------
- // D3DXSPRITE_DONOTSAVESTATE
- // Specifies device state is not to be saved and restored in Begin/End.
- // D3DXSPRITE_DONOTMODIFY_RENDERSTATE
- // Specifies device render state is not to be changed in Begin. The device
- // is assumed to be in a valid state to draw vertices containing POSITION0,
- // TEXCOORD0, and COLOR0 data.
- // D3DXSPRITE_OBJECTSPACE
- // The WORLD, VIEW, and PROJECTION transforms are NOT modified. The
- // transforms currently set to the device are used to transform the sprites
- // when the batch is drawn (at Flush or End). If this is not specified,
- // WORLD, VIEW, and PROJECTION transforms are modified so that sprites are
- // drawn in screenspace coordinates.
- // D3DXSPRITE_BILLBOARD
- // Rotates each sprite about its center so that it is facing the viewer.
- // D3DXSPRITE_ALPHABLEND
- // Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0).
- // ID3DXFont expects this to be set when drawing text.
- // D3DXSPRITE_SORT_TEXTURE
- // Sprites are sorted by texture prior to drawing. This is recommended when
- // drawing non-overlapping sprites of uniform depth. For example, drawing
- // screen-aligned text with ID3DXFont.
- // D3DXSPRITE_SORT_DEPTH_FRONTTOBACK
- // Sprites are sorted by depth front-to-back prior to drawing. This is
- // recommended when drawing opaque sprites of varying depths.
- // D3DXSPRITE_SORT_DEPTH_BACKTOFRONT
- // Sprites are sorted by depth back-to-front prior to drawing. This is
- // recommended when drawing transparent sprites of varying depths.
- //////////////////////////////////////////////////////////////////////////////
- const
- D3DXSPRITE_DONOTSAVESTATE = (1 shl 0);
- {$EXTERNALSYM D3DXSPRITE_DONOTSAVESTATE}
- D3DXSPRITE_DONOTMODIFY_RENDERSTATE = (1 shl 1);
- {$EXTERNALSYM D3DXSPRITE_DONOTMODIFY_RENDERSTATE}
- D3DXSPRITE_OBJECTSPACE = (1 shl 2);
- {$EXTERNALSYM D3DXSPRITE_OBJECTSPACE}
- D3DXSPRITE_BILLBOARD = (1 shl 3);
- {$EXTERNALSYM D3DXSPRITE_BILLBOARD}
- D3DXSPRITE_ALPHABLEND = (1 shl 4);
- {$EXTERNALSYM D3DXSPRITE_ALPHABLEND}
- D3DXSPRITE_SORT_TEXTURE = (1 shl 5);
- {$EXTERNALSYM D3DXSPRITE_SORT_TEXTURE}
- D3DXSPRITE_SORT_DEPTH_FRONTTOBACK = (1 shl 6);
- {$EXTERNALSYM D3DXSPRITE_SORT_DEPTH_FRONTTOBACK}
- D3DXSPRITE_SORT_DEPTH_BACKTOFRONT = (1 shl 7);
- {$EXTERNALSYM D3DXSPRITE_SORT_DEPTH_BACKTOFRONT}
- //////////////////////////////////////////////////////////////////////////////
- // ID3DXSprite:
- // ------------
- // This object intends to provide an easy way to drawing sprites using D3D.
- //
- // Begin -
- // Prepares device for drawing sprites.
- //
- // Draw -
- // Draws a sprite. Before transformation, the sprite is the size of
- // SrcRect, with its top-left corner specified by Position. The color
- // and alpha channels are modulated by Color.
- //
- // Flush -
- // Forces all batched sprites to submitted to the device.
- //
- // End -
- // Restores device state to how it was when Begin was called.
- //
- // OnLostDevice, OnResetDevice -
- // Call OnLostDevice() on this object before calling Reset() on the
- // device, so that this object can release any stateblocks and video
- // memory resources. After Reset(), the call OnResetDevice().
- //////////////////////////////////////////////////////////////////////////////
- type
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSprite);'}
- {$EXTERNALSYM ID3DXSprite}
- ID3DXSprite = interface(IUnknown)
- ['{BA0B762D-7D28-43ec-B9DC-2F84443B0614}']
- // ID3DXSprite
- function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
- function GetTransform(out pTransform: TD3DXMatrix): HResult; stdcall;
- function SetTransform(const pTransform: TD3DXMatrix): HResult; stdcall;
- function SetWorldViewRH(pWorld, pView: PD3DXMatrix): HResult; stdcall;
- function SetWorldViewLH(pWorld, pView: PD3DXMatrix): HResult; stdcall;
- function _Begin(Flags: DWORD): HResult; stdcall;
- function Draw(pTexture: IDirect3DTexture9; pSrcRect: PRect; pCenter, pPosition: PD3DXVector3; Color: TD3DColor): HResult; stdcall;
- function Flush: HResult; stdcall;
- function _End: HResult; stdcall;
- function OnLostDevice: HResult; stdcall;
- function OnResetDevice: HResult; stdcall;
- end;
- IID_ID3DXSprite = ID3DXSprite;
- {$EXTERNALSYM IID_ID3DXSprite}
- function D3DXCreateSprite(pDevice: IDirect3DDevice9;
- out ppSprite: ID3DXSprite): HResult; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXCreateSprite}
- //////////////////////////////////////////////////////////////////////////////
- // ID3DXFont:
- // ----------
- // Font objects contain the textures and resources needed to render a specific
- // font on a specific device.
- //
- // GetGlyphData -
- // Returns glyph cache data, for a given glyph.
- //
- // PreloadCharacters/PreloadGlyphs/PreloadText -
- // Preloads glyphs into the glyph cache textures.
- //
- // DrawText -
- // Draws formatted text on a D3D device. Some parameters are
- // surprisingly similar to those of GDI's DrawText function. See GDI
- // documentation for a detailed description of these parameters.
- // If pSprite is NULL, an internal sprite object will be used.
- //
- // OnLostDevice, OnResetDevice -
- // Call OnLostDevice() on this object before calling Reset() on the
- // device, so that this object can release any stateblocks and video
- // memory resources. After Reset(), the call OnResetDevice().
- //////////////////////////////////////////////////////////////////////////////
- type
- PD3DXFontDescA = ^TD3DXFontDescA;
- PD3DXFontDescW = ^TD3DXFontDescW;
- PD3DXFontDesc = PD3DXFontDescA;
- _D3DXFONT_DESCA = record
- Height: Integer;
- Width: Longint;
- Weight: LongWord;
- MipLevels: LongWord;
- Italic: BOOL;
- CharSet: Byte;
- OutputPrecision: Byte;
- Quality: Byte;
- PitchAndFamily: Byte;
- FaceName: array[0..LF_FACESIZE-1] of AnsiChar;
- end;
- {$EXTERNALSYM _D3DXFONT_DESCA}
- _D3DXFONT_DESCW = record
- Height: Integer;
- Width: Longint;
- Weight: LongWord;
- MipLevels: LongWord;
- Italic: BOOL;
- CharSet: Byte;
- OutputPrecision: Byte;
- Quality: Byte;
- PitchAndFamily: Byte;
- FaceName: array[0..LF_FACESIZE-1] of WideChar;
- end;
- {$EXTERNALSYM _D3DXFONT_DESCW}
- _D3DXFONT_DESC = _D3DXFONT_DESCA;
- {$EXTERNALSYM _D3DXFONT_DESC}
- D3DXFONT_DESCA = _D3DXFONT_DESCA;
- {$EXTERNALSYM D3DXFONT_DESCA}
- D3DXFONT_DESCW = _D3DXFONT_DESCW;
- {$EXTERNALSYM D3DXFONT_DESCW}
- D3DXFONT_DESC = D3DXFONT_DESCA;
- {$EXTERNALSYM D3DXFONT_DESC}
- TD3DXFontDescA = _D3DXFONT_DESCA;
- TD3DXFontDescW = _D3DXFONT_DESCW;
- TD3DXFontDesc = TD3DXFontDescA;
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFont);'}
- {$EXTERNALSYM ID3DXFont}
- ID3DXFont = interface(IUnknown)
- ['{D79DBB70-5F21-4d36-BBC2-FF525C213CDC}']
- // ID3DXFont
- function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
- function GetDescA(out pDesc: TD3DXFontDescA): HResult; stdcall;
- function GetDescW(out pDesc: TD3DXFontDescW): HResult; stdcall;
- function GetTextMetricsA(out pTextMetrics: TTextMetricA): BOOL; stdcall;
- function GetTextMetricsW(out pTextMetrics: TTextMetricW): BOOL; stdcall;
- function GetDC: HDC; stdcall;
- function GetGlyphData(Glyph: LongWord; out ppTexture: IDirect3DTexture9; pBlackBox: PRect; pCellInc: PPoint): HResult; stdcall;
- function PreloadCharacters(First, Last: LongWord): HResult; stdcall;
- function PreloadGlyphs(First, Last: LongWord): HResult; stdcall;
- function PreloadTextA(pString: PAnsiChar; Count: Integer): HResult; stdcall;
- function PreloadTextW(pString: PWideChar; Count: Integer): HResult; stdcall;
- function DrawTextA(pSprite: ID3DXSprite; pString: PAnsiChar; Count: Integer; pRect: PRect; Format: DWORD; Color: TD3DColor): Integer; stdcall;
- function DrawTextW(pSprite: ID3DXSprite; pString: PWideChar; Count: Integer; pRect: PRect; Format: DWORD; Color: TD3DColor): Integer; stdcall;
- function OnLostDevice: HResult; stdcall;
- function OnResetDevice: HResult; stdcall;
- end;
- IID_ID3DXFont = ID3DXFont;
- {$EXTERNALSYM IID_ID3DXFont}
- function D3DXCreateFontA(
- pDevice: IDirect3DDevice9;
- Height: Integer;
- Width: Longint;
- Weight: LongWord;
- MipLevels: LongWord;
- Italic: BOOL;
- CharSet: DWORD;
- OutputPrecision: DWORD;
- Quality: DWORD;
- PitchAndFamily: DWORD;
- pFaceName: PAnsiChar;
- out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL name 'D3DXCreateFontA';
- {$EXTERNALSYM D3DXCreateFontA}
- function D3DXCreateFontW(
- pDevice: IDirect3DDevice9;
- Height: Integer;
- Width: Longint;
- Weight: LongWord;
- MipLevels: LongWord;
- Italic: BOOL;
- CharSet: DWORD;
- OutputPrecision: DWORD;
- Quality: DWORD;
- PitchAndFamily: DWORD;
- pFaceName: PWideChar;
- out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL name 'D3DXCreateFontW';
- {$EXTERNALSYM D3DXCreateFontW}
- function D3DXCreateFont(
- pDevice: IDirect3DDevice9;
- Height: Integer;
- Width: Longint;
- Weight: LongWord;
- MipLevels: LongWord;
- Italic: BOOL;
- CharSet: DWORD;
- OutputPrecision: DWORD;
- Quality: DWORD;
- PitchAndFamily: DWORD;
- pFaceName: PChar;
- out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL name 'D3DXCreateFontA';
- {$EXTERNALSYM D3DXCreateFont}
- function D3DXCreateFontIndirectA(
- pDevice: IDirect3DDevice9;
- const pDesc: TD3DXFontDescA;
- out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL name 'D3DXCreateFontIndirectA';
- {$EXTERNALSYM D3DXCreateFontIndirectA}
- function D3DXCreateFontIndirectW(
- pDevice: IDirect3DDevice9;
- const pDesc: TD3DXFontDescW;
- out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL name 'D3DXCreateFontIndirectW';
- {$EXTERNALSYM D3DXCreateFontIndirectW}
- function D3DXCreateFontIndirect(
- pDevice: IDirect3DDevice9;
- const pDesc: TD3DXFontDesc;
- out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL name 'D3DXCreateFontIndirectA';
- {$EXTERNALSYM D3DXCreateFontIndirect}
- ///////////////////////////////////////////////////////////////////////////
- // ID3DXRenderToSurface:
- // ---------------------
- // This object abstracts rendering to surfaces. These surfaces do not
- // necessarily need to be render targets. If they are not, a compatible
- // render target is used, and the result copied into surface at end scene.
- //
- // BeginScene, EndScene -
- // Call BeginScene() and EndScene() at the beginning and ending of your
- // scene. These calls will setup and restore render targets, viewports,
- // etc..
- //
- // OnLostDevice, OnResetDevice -
- // Call OnLostDevice() on this object before calling Reset() on the
- // device, so that this object can release any stateblocks and video
- // memory resources. After Reset(), the call OnResetDevice().
- ///////////////////////////////////////////////////////////////////////////
- type
- PD3DXRTSDesc = ^TD3DXRTSDesc;
- _D3DXRTS_DESC = record
- Width: LongWord;
- Height: LongWord;
- Format: TD3DFormat;
- DepthStencil: BOOL;
- DepthStencilFormat: TD3DFormat;
- end {_D3DXRTS_DESC};
- {$EXTERNALSYM _D3DXRTS_DESC}
- D3DXRTS_DESC = _D3DXRTS_DESC;
- {$EXTERNALSYM D3DXRTS_DESC}
- TD3DXRTSDesc = _D3DXRTS_DESC;
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToSurface);'}
- {$EXTERNALSYM ID3DXRenderToSurface}
- ID3DXRenderToSurface = interface(IUnknown)
- ['{6985F346-2C3D-43b3-BE8B-DAAE8A03D894}']
- // ID3DXRenderToSurface
- function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
- function GetDesc(out pDesc: TD3DXRTSDesc): HResult; stdcall;
- function BeginScene(pSurface: IDirect3DSurface9; pViewport: PD3DViewport9): HResult; stdcall;
- function EndScene(MipFilter: DWORD): HResult; stdcall;
- function OnLostDevice: HResult; stdcall;
- function OnResetDevice: HResult; stdcall;
- end;
- IID_ID3DXRenderToSurface = ID3DXRenderToSurface;
- {$EXTERNALSYM IID_ID3DXRenderToSurface}
- function D3DXCreateRenderToSurface(ppDevice: IDirect3DDevice9;
- Width: LongWord;
- Height: LongWord;
- Format: TD3DFormat;
- DepthStencil: BOOL;
- DepthStencilFormat: TD3DFormat;
- out ppRenderToSurface: ID3DXRenderToSurface): HResult; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXCreateRenderToSurface}
- ///////////////////////////////////////////////////////////////////////////
- // ID3DXRenderToEnvMap:
- // --------------------
- // This object abstracts rendering to environment maps. These surfaces
- // do not necessarily need to be render targets. If they are not, a
- // compatible render target is used, and the result copied into the
- // environment map at end scene.
- //
- // BeginCube, BeginSphere, BeginHemisphere, BeginParabolic -
- // This function initiates the rendering of the environment map. As
- // parameters, you pass the textures in which will get filled in with
- // the resulting environment map.
- //
- // Face -
- // Call this function to initiate the drawing of each face. For each
- // environment map, you will call this six times.. once for each face
- // in D3DCUBEMAP_FACES.
- //
- // End -
- // This will restore all render targets, and if needed compose all the
- // rendered faces into the environment map surfaces.
- //
- // OnLostDevice, OnResetDevice -
- // Call OnLostDevice() on this object before calling Reset() on the
- // device, so that this object can release any stateblocks and video
- // memory resources. After Reset(), the call OnResetDevice().
- ///////////////////////////////////////////////////////////////////////////
- type
- PD3DXRTEDesc = ^TD3DXRTEDesc;
- _D3DXRTE_DESC = record
- Size: LongWord;
- MipLevels: LongWord;
- Format: TD3DFormat;
- DepthStencil: Bool;
- DepthStencilFormat: TD3DFormat;
- end {_D3DXRTE_DESC};
- {$EXTERNALSYM _D3DXRTE_DESC}
- D3DXRTE_DESC = _D3DXRTE_DESC;
- {$EXTERNALSYM D3DXRTE_DESC}
- TD3DXRTEDesc = _D3DXRTE_DESC;
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToEnvMap);'}
- {$EXTERNALSYM ID3DXRenderToEnvMap}
- ID3DXRenderToEnvMap = interface(IUnknown)
- ['{313F1B4B-C7B0-4fa2-9D9D-8D380B64385E}']
- // ID3DXRenderToEnvMap
- function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
- function GetDesc(out pDesc: TD3DXRTEDesc): HResult; stdcall;
- function BeginCube(pCubeTex: IDirect3DCubeTexture9): HResult; stdcall;
- function BeginSphere(pTex: IDirect3DTexture9): HResult; stdcall;
- function BeginHemisphere(pTexZPos, pTexZNeg: IDirect3DTexture9): HResult; stdcall;
- function BeginParabolic(pTexZPos, pTexZNeg: IDirect3DTexture9): HResult; stdcall;
- function Face(Face: TD3DCubemapFaces; MipFilter: DWORD): HResult; stdcall;
- function _End(MipFilter: DWORD): HResult; stdcall;
- function OnLostDevice: HResult; stdcall;
- function OnResetDevice: HResult; stdcall;
- end;
- IID_ID3DXRenderToEnvMap = ID3DXRenderToEnvMap;
- {$EXTERNALSYM IID_ID3DXRenderToEnvMap}
- function D3DXCreateRenderToEnvMap(ppDevice: IDirect3DDevice9;
- Size: LongWord;
- MipLevels: LongWord;
- Format: TD3DFormat;
- DepthStencil: BOOL;
- DepthStencilFormat: TD3DFormat;
- out ppRenderToEnvMap: ID3DXRenderToEnvMap): HResult; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXCreateRenderToEnvMap}
- ///////////////////////////////////////////////////////////////////////////
- // ID3DXLine:
- // ------------
- // This object intends to provide an easy way to draw lines using D3D.
- //
- // Begin -
- // Prepares device for drawing lines
- //
- // Draw -
- // Draws a line strip in screen-space.
- // Input is in the form of a array defining points on the line strip. of D3DXVECTOR2
- //
- // DrawTransform -
- // Draws a line in screen-space with a specified input transformation matrix.
- //
- // End -
- // Restores device state to how it was when Begin was called.
- //
- // SetPattern -
- // Applies a stipple pattern to the line. Input is one 32-bit
- // DWORD which describes the stipple pattern. 1 is opaque, 0 is
- // transparent.
- //
- // SetPatternScale -
- // Stretches the stipple pattern in the u direction. Input is one
- // floating-point value. 0.0f is no scaling, whereas 1.0f doubles
- // the length of the stipple pattern.
- //
- // SetWidth -
- // Specifies the thickness of the line in the v direction. Input is
- // one floating-point value.
- //
- // SetAntialias -
- // Toggles line antialiasing. Input is a BOOL.
- // TRUE = Antialiasing on.
- // FALSE = Antialiasing off.
- //
- // SetGLLines -
- // Toggles non-antialiased OpenGL line emulation. Input is a BOOL.
- // TRUE = OpenGL line emulation on.
- // FALSE = OpenGL line emulation off.
- //
- // OpenGL line: Regular line:
- // * *
- // | /
- // | *
- // *
- //
- // * *
- // | /
- // | *
- // *
- //
- // OnLostDevice, OnResetDevice -
- // Call OnLostDevice() on this object before calling Reset() on the
- // device, so that this object can release any stateblocks and video
- // memory resources. After Reset(), the call OnResetDevice().
- ///////////////////////////////////////////////////////////////////////////
- type
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXLine);'}
- {$EXTERNALSYM ID3DXLine}
- ID3DXLine = interface(IUnknown)
- ['{D379BA7F-9042-4ac4-9F5E-58192A4C6BD8}']
- // ID3DXLine
- function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
- function _Begin: HResult; stdcall;
- function Draw(pVertexList: PD3DXVector2; dwVertexListCount: DWORD; Color: TD3DColor): HResult; stdcall;
- function DrawTransform(pVertexList: PD3DXVector3; dwVertexListCount: DWORD;
- const pTransform: TD3DXMatrix; Color: TD3DColor): HResult; stdcall;
- function SetPattern(dwPattern: DWORD): HResult; stdcall;
- function GetPattern: DWORD; stdcall;
- function SetPatternScale(fPatternScale: Single): HResult; stdcall;
- function GetPatternScale: Single; stdcall;
- function SetWidth(fWidth: Single): HResult; stdcall;
- function GetWidth: Single; stdcall;
- function SetAntialias(bAntialias: BOOL): HResult; stdcall;
- function GetAntialias: BOOL; stdcall;
- function SetGLLines(bGLLines: BOOL): HResult; stdcall;
- function GetGLLines: BOOL; stdcall;
- function _End: HResult; stdcall;
- function OnLostDevice: HResult; stdcall;
- function OnResetDevice: HResult; stdcall;
- end;
- IID_ID3DXLine = ID3DXLine;
- {$EXTERNALSYM IID_ID3DXLine}
- function D3DXCreateLine(ppDevice: IDirect3DDevice9;
- out ppLine: ID3DXLine): HResult; stdcall; external d3dx9coreDLL;
- {$EXTERNALSYM D3DXCreateLine}
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //
- // File: d3dx9shader.h
- // Content: D3DX Shader APIs
- //
- //////////////////////////////////////////////////////////////////////////////
- //---------------------------------------------------------------------------
- // D3DXTX_VERSION:
- // --------------
- // Version token used to create a procedural texture filler in effects
- // Used by D3DXFill[]TX functions
- //---------------------------------------------------------------------------
- // #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
- function D3DXTX_VERSION(_Major, _Minor: Byte): DWORD;
- {$EXTERNALSYM D3DXTX_VERSION}
- //----------------------------------------------------------------------------
- // D3DXSHADER flags:
- // -----------------
- // D3DXSHADER_DEBUG
- // Insert debug file/line/type/symbol information.
- //
- // D3DXSHADER_SKIPVALIDATION
- // Do not validate the generated code against known capabilities and
- // constraints. This option is only recommended when compiling shaders
- // you KNOW will work. (ie. have compiled before without this option.)
- // Shaders are always validated by D3D before they are set to the device.
- //
- // D3DXSHADER_SKIPOPTIMIZATION
- // Instructs the compiler to skip optimization steps during code generation.
- // Unless you are trying to isolate a problem in your code using this option
- // is not recommended.
- //
- // D3DXSHADER_PACKMATRIX_ROWMAJOR
- // Unless explicitly specified, matrices will be packed in row-major order
- // on input and output from the shader.
- //
- // D3DXSHADER_PACKMATRIX_COLUMNMAJOR
- // Unless explicitly specified, matrices will be packed in column-major
- // order on input and output from the shader. This is generally more
- // efficient, since it allows vector-matrix multiplication to be performed
- // using a series of dot-products.
- //
- // D3DXSHADER_PARTIALPRECISION
- // Force all computations in resulting shader to occur at partial precision.
- // This may result in faster evaluation of shaders on some hardware.
- //
- // D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT
- // Force compiler to compile against the next highest available software
- // target for vertex shaders. This flag also turns optimizations off,
- // and debugging on.
- //
- // D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT
- // Force compiler to compile against the next highest available software
- // target for pixel shaders. This flag also turns optimizations off,
- // and debugging on.
- //
- // D3DXSHADER_NO_PRESHADER
- // Disables Preshaders. Using this flag will cause the compiler to not
- // pull out static expression for evaluation on the host cpu
- //
- // D3DXSHADER_AVOID_FLOW_CONTROL
- // Hint compiler to avoid flow-control constructs where possible.
- //
- // D3DXSHADER_PREFER_FLOW_CONTROL
- // Hint compiler to prefer flow-control constructs where possible.
- //
- //----------------------------------------------------------------------------
- const
- D3DXSHADER_DEBUG = (1 shl 0);
- {$EXTERNALSYM D3DXSHADER_DEBUG}
- D3DXSHADER_SKIPVALIDATION = (1 shl 1);
- {$EXTERNALSYM D3DXSHADER_SKIPVALIDATION}
- D3DXSHADER_SKIPOPTIMIZATION = (1 shl 2);
- {$EXTERNALSYM D3DXSHADER_SKIPOPTIMIZATION}
- D3DXSHADER_PACKMATRIX_ROWMAJOR = (1 shl 3);
- {$EXTERNALSYM D3DXSHADER_PACKMATRIX_ROWMAJOR}
- D3DXSHADER_PACKMATRIX_COLUMNMAJOR = (1 shl 4);
- {$EXTERNALSYM D3DXSHADER_PACKMATRIX_COLUMNMAJOR}
- D3DXSHADER_PARTIALPRECISION = (1 shl 5);
- {$EXTERNALSYM D3DXSHADER_PARTIALPRECISION}
- D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT = (1 shl 6);
- {$EXTERNALSYM D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT}
- D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT = (1 shl 7);
- {$EXTERNALSYM D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT}
- D3DXSHADER_NO_PRESHADER = (1 shl 8);
- {$EXTERNALSYM D3DXSHADER_NO_PRESHADER}
- D3DXSHADER_AVOID_FLOW_CONTROL = (1 shl 9);
- {$EXTERNALSYM D3DXSHADER_AVOID_FLOW_CONTROL}
- D3DXSHADER_PREFER_FLOW_CONTROL = (1 shl 10);
- {$EXTERNALSYM D3DXSHADER_PREFER_FLOW_CONTROL}
- //----------------------------------------------------------------------------
- // D3DXHANDLE:
- // -----------
- // Handle values used to efficiently reference shader and effect parameters.
- // Strings can be used as handles. However, handles are not always strings.
- //----------------------------------------------------------------------------
- type
- {$HPPEMIT 'typedef D3DXHANDLE TD3DXHandle;'}
- {$HPPEMIT 'typedef D3DXHANDLE *PD3DXHandle;'}
- PD3DXHandle = ^TD3DXHandle;
- {$EXTERNALSYM PD3DXHandle}
- TD3DXHandle = {$IFDEF TYPE_IDENTITY}type {$ENDIF}PAnsiChar;
- {$NODEFINE TD3DXHandle}
- //----------------------------------------------------------------------------
- // D3DXMACRO:
- // ----------
- // Preprocessor macro definition. The application pass in a NULL-terminated
- // array of this structure to various D3DX APIs. This enables the application
- // to #define tokens at runtime, before the file is parsed.
- //----------------------------------------------------------------------------
- PD3DXMacro = ^TD3DXMacro;
- _D3DXMACRO = record
- Name: PAnsiChar;
- Definition: PAnsiChar;
- end;
- {$EXTERNALSYM _D3DXMACRO}
- D3DXMACRO = _D3DXMACRO;
- {$EXTERNALSYM D3DXMACRO}
- TD3DXMacro = _D3DXMACRO;
- //----------------------------------------------------------------------------
- // D3DXSEMANTIC:
- //----------------------------------------------------------------------------
- PD3DXSemantic = ^TD3DXSemantic;
- _D3DXSEMANTIC = record
- Usage: LongWord;
- UsageIndex: LongWord;
- end;
- {$EXTERNALSYM _D3DXSEMANTIC}
- D3DXSEMANTIC = _D3DXSEMANTIC;
- {$EXTERNALSYM D3DXSEMANTIC}
- TD3DXSemantic = _D3DXSEMANTIC;
- //----------------------------------------------------------------------------
- // D3DXFRAGMENT_DESC:
- //----------------------------------------------------------------------------
- PD3DXFragmentDesc = ^TD3DXFragmentDesc;
- _D3DXFRAGMENT_DESC = record
- Name: PAnsiChar;
- Target: DWORD;
- end;
- {$EXTERNALSYM _D3DXFRAGMENT_DESC}
- D3DXFRAGMENT_DESC = _D3DXFRAGMENT_DESC;
- {$EXTERNALSYM D3DXFRAGMENT_DESC}
- TD3DXFragmentDesc = _D3DXFRAGMENT_DESC;
- //----------------------------------------------------------------------------
- // D3DXREGISTER_SET:
- //----------------------------------------------------------------------------
- _D3DXREGISTER_SET = (
- D3DXRS_BOOL,
- D3DXRS_INT4,
- D3DXRS_FLOAT4,
- D3DXRS_SAMPLER
- );
- {$EXTERNALSYM _D3DXREGISTER_SET}
- D3DXREGISTER_SET = _D3DXREGISTER_SET;
- {$EXTERNALSYM D3DXREGISTER_SET}
- TD3DXRegisterSet = _D3DXREGISTER_SET;
- //----------------------------------------------------------------------------
- // D3DXPARAMETER_CLASS:
- //----------------------------------------------------------------------------
- _D3DXPARAMETER_CLASS = (
- D3DXPC_SCALAR,
- D3DXPC_VECTOR,
- D3DXPC_MATRIX_ROWS,
- D3DXPC_MATRIX_COLUMNS,
- D3DXPC_OBJECT,
- D3DXPC_STRUCT
- );
- {$EXTERNALSYM _D3DXPARAMETER_CLASS}
- D3DXPARAMETER_CLASS = _D3DXPARAMETER_CLASS;
- {$EXTERNALSYM D3DXPARAMETER_CLASS}
- TD3DXParameterClass = _D3DXPARAMETER_CLASS;
- //----------------------------------------------------------------------------
- // D3DXPARAMETER_TYPE:
- //----------------------------------------------------------------------------
- _D3DXPARAMETER_TYPE = (
- D3DXPT_VOID,
- D3DXPT_BOOL,
- D3DXPT_INT,
- D3DXPT_FLOAT,
- D3DXPT_STRING,
- D3DXPT_TEXTURE,
- D3DXPT_TEXTURE1D,
- D3DXPT_TEXTURE2D,
- D3DXPT_TEXTURE3D,
- D3DXPT_TEXTURECUBE,
- D3DXPT_SAMPLER,
- D3DXPT_SAMPLER1D,
- D3DXPT_SAMPLER2D,
- D3DXPT_SAMPLER3D,
- D3DXPT_SAMPLERCUBE,
- D3DXPT_PIXELSHADER,
- D3DXPT_VERTEXSHADER,
- D3DXPT_PIXELFRAGMENT,
- D3DXPT_VERTEXFRAGMENT
- );
- {$EXTERNALSYM _D3DXPARAMETER_TYPE}
- D3DXPARAMETER_TYPE = _D3DXPARAMETER_TYPE;
- {$EXTERNALSYM D3DXPARAMETER_TYPE}
- TD3DXParameterType = _D3DXPARAMETER_TYPE;
- //----------------------------------------------------------------------------
- // D3DXCONSTANTTABLE_DESC:
- //----------------------------------------------------------------------------
- PD3DXConstantTableDesc = ^TD3DXConstantTableDesc;
- _D3DXCONSTANTTABLE_DESC = record
- Creator: PAnsiChar; // Creator string
- Version: DWORD; // Shader version
- Constants: LongWord; // Number of constants
- end;
- {$EXTERNALSYM _D3DXCONSTANTTABLE_DESC}
- D3DXCONSTANTTABLE_DESC = _D3DXCONSTANTTABLE_DESC;
- {$EXTERNALSYM D3DXCONSTANTTABLE_DESC}
- TD3DXConstantTableDesc = _D3DXCONSTANTTABLE_DESC;
- //----------------------------------------------------------------------------
- // D3DXCONSTANT_DESC:
- //----------------------------------------------------------------------------
- PD3DXConstantDesc = ^TD3DXConstantDesc;
- _D3DXCONSTANT_DESC = record
- Name: PAnsiChar; // Constant name
- RegisterSet: TD3DXRegisterSet; // Register set
- RegisterIndex: LongWord; // Register index
- RegisterCount: LongWord; // Number of registers occupied
- _Class: TD3DXParameterClass; // Class
- _Type: TD3DXParameterType; // Component type
- Rows: LongWord; // Number of rows
- Columns: LongWord; // Number of columns
- Elements: LongWord; // Number of array elements
- StructMembers: LongWord; // Number of structure member sub-parameters
- Bytes: LongWord; // Data size, in bytes
- DefaultValue: Pointer; // Pointer to default value
- end;
- {$EXTERNALSYM _D3DXCONSTANT_DESC}
- D3DXCONSTANT_DESC = _D3DXCONSTANT_DESC;
- {$EXTERNALSYM D3DXCONSTANT_DESC}
- TD3DXConstantDesc = _D3DXCONSTANT_DESC;
- //----------------------------------------------------------------------------
- // ID3DXConstantTable:
- //----------------------------------------------------------------------------
- PID3DXConstantTable = ^ID3DXConstantTable;
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXConstantTable);'}
- {$EXTERNALSYM ID3DXConstantTable}
- ID3DXConstantTable = interface(ID3DXBuffer)
- ['{AB3C758F-093E-4356-B762-4DB18F1B3A01}']
- // Descs
- function GetDesc(out pDesc: TD3DXConstantTableDesc): HResult; stdcall;
- function GetConstantDesc(hConstant: TD3DXHandle; pConstantDesc: PD3DXConstantDesc; var pCount: LongWord): HResult; stdcall;
- function GetSamplerIndex(hConstant: TD3DXHandle): LongWord; stdcall;
- // Handle operations
- function GetConstant(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
- function GetConstantByName(hConstant: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall;
- function GetConstantElement(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
- // Set Constants
- function SetDefaults(pDevice: IDirect3DDevice9): HResult; stdcall;
- function SetValue(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall;
- function SetBool(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; b: BOOL): HResult; stdcall;
- function SetBoolArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall;
- function SetInt(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; n: Integer): HResult; stdcall;
- function SetIntArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall;
- function SetFloat(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; f: Single): HResult; stdcall;
- function SetFloatArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall;
- function SetVector(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pVector: TD3DXVector4): HResult; stdcall;
- function SetVectorArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall;
- function SetMatrix(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
- function SetMatrixArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
- function SetMatrixPointerArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
- function SetMatrixTranspose(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
- function SetMatrixTransposeArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
- function SetMatrixTransposePointerArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
- end;
- IID_ID3DXConstantTable = ID3DXConstantTable;
- {$EXTERNALSYM IID_ID3DXConstantTable}
- //----------------------------------------------------------------------------
- // ID3DXTextureShader:
- //----------------------------------------------------------------------------
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXTextureShader);'}
- {$EXTERNALSYM ID3DXTextureShader}
- ID3DXTextureShader = interface(IUnknown)
- ['{3E3D67F8-AA7A-405d-A857-BA01D4758426}']
- // Gets
- function GetFunction(out ppFunction: ID3DXBuffer): HResult; stdcall;
- function GetConstantBuffer(out ppConstantBuffer: ID3DXBuffer): HResult; stdcall;
- // Descs
- function GetDesc(out pDesc: TD3DXConstantTableDesc): HResult; stdcall;
- function GetConstantDesc(hConstant: TD3DXHandle; pConstantDesc: PD3DXConstantDesc; out pCount: LongWord): HResult; stdcall;
- // Handle operations
- function GetConstant(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
- function GetConstantByName(hConstant: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall;
- function GetConstantElement(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall;
- // Set Constants
- function SetDefaults: HResult; stdcall;
- function SetValue(hConstant: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall;
- function SetBool(hConstant: TD3DXHandle; b: BOOL): HResult; stdcall;
- function SetBoolArray(hConstant: TD3DXHandle; const pb: PBOOL; Count: LongWord): HResult; stdcall;
- function SetInt(hConstant: TD3DXHandle; n: Integer): HResult; stdcall;
- function SetIntArray(hConstant: TD3DXHandle; const pn: PInteger; Count: LongWord): HResult; stdcall;
- function SetFloat(hConstant: TD3DXHandle; f: Single): HResult; stdcall;
- function SetFloatArray(hConstant: TD3DXHandle; const pf: PSingle; Count: LongWord): HResult; stdcall;
- function SetVector(hConstant: TD3DXHandle; const pVector: TD3DXVector4): HResult; stdcall;
- function SetVectorArray(hConstant: TD3DXHandle; const pVector: PD3DXVector4; Count: LongWord): HResult; stdcall;
- function SetMatrix(hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
- function SetMatrixArray(hConstant: TD3DXHandle; const pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
- function SetMatrixPointerArray(hConstant: TD3DXHandle; const ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
- function SetMatrixTranspose(hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall;
- function SetMatrixTransposeArray(hConstant: TD3DXHandle; const pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall;
- function SetMatrixTransposePointerArray(hConstant: TD3DXHandle; const ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall;
- end;
- IID_ID3DXTextureShader = ID3DXTextureShader;
- {$EXTERNALSYM IID_ID3DXTextureShader}
- //----------------------------------------------------------------------------
- // ID3DXFragmentLinker
- //----------------------------------------------------------------------------
- {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFragmentLinker);'}
- {$EXTERNALSYM ID3DXFragmentLinker}
- ID3DXFragmentLinker = interface(IUnknown)
- ['{1A2C0CC2-E5B6-4ebc-9E8D-390E057811B6}']
- // ID3DXFragmentLinker
- // fragment access and information retrieval functions
- function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
- function GetNumberOfFragments: LongWord; stdcall;
- function GetFragmentHandleByIndex(Index: LongWord): TD3DXHandle; stdcall;
- function GetFragmentHandleByName(Name: PAnsiChar): TD3DXHandle; stdcall;
- function GetFragmentDesc(Name: TD3DXHandle; out FragDesc: TD3DXFragmentDesc): HResult; stdcall;
- // add the fragments in the buffer to the linker
- function AddFragments(Fragments: PDWORD): HResult; stdcall;
- // Create a buffer containing the fragments. Suitable for saving to disk
- function GetAllFragments(out ppBuffer: ID3DXBuffer): HResult; stdcall;
- function GetFragment(Name: TD3DXHandle; out ppBuffer: ID3DXBuffer): HResult; stdcall;
- function LinkShader(pProfile: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out ppBuffer: ID3DXBuffer; ppErrorMsgs: PID3DXBuffer): HResult; stdcall;
- function LinkVertexShader(pProfile: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out pVShader: IDirect3DVertexShader9; ppErrorMsgs: PID3DXBuffer): HResult; stdcall;
- function LinkPixelShader(pProfile: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out pPShader: IDirect3DPixelShader9; ppErrorMsgs: PID3DXBuffer): HResult; stdcall;
- function ClearCache: HResult; stdcall;
- end;
- //----------------------------------------------------------------------------
- // D3DXINCLUDE_TYPE:
- //----------------------------------------------------------------------------
- type
- PD3DXIncludeType = ^TD3DXIncludeType;
- _D3DXINCLUDE_TYPE = (
- D3DXINC_LOCAL,
- D3DXINC_SYSTEM
- );
- {$EXTERNALSYM _D3DXINCLUDE_TYPE}
- D3DXINCLUDE_TYPE = _D3DXINCLUDE_TYPE;
- {$EXTERNALSYM D3DXINCLUDE_TYPE}
- TD3DXIncludeType = _D3DXINCLUDE_TYPE;
- //----------------------------------------------------------------------------
- // ID3DXInclude:
- // -------------
- // This interface is intended to be implemented by the application, and can
- // be used by various D3DX APIs. This enables application-specific handling
- // of #include directives in source files.
- //
- // Open()
- // Opens an include file. If successful, it should fill in ppData and
- // pBytes. The data pointer returned must remain valid until Close is
- // subsequently called.
- // Close()
- // Closes an include file. If Open was successful, Close is guaranteed
- // to be called before the API using this interface returns.
- //----------------------------------------------------------------------------
- PID3DXInclude = ^ID3DXInclude;
- {$EXTERNALSYM ID3DXInclude}
- ID3DXInclude = class
- function Open(IncludeType: TD3DXIncludeType; pFileName: PAnsiChar; pParentData: Pointer; out ppData: Pointer; out pBytes: LongWord): HResult; virtual; stdcall; abstract;
- function Close(pData: Pointer): HResult; virtual; stdcall; abstract;
- end;
- //////////////////////////////////////////////////////////////////////////////
- // APIs //////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- //----------------------------------------------------------------------------
- // D3DXAssembleShader:
- // -------------------
- // Assembles a shader.
- //
- // Parameters:
- // pSrcFile
- // Source file name
- // hSrcModule
- // Module handle. if NULL, current module will be used
- // pSrcResource
- // Resource name in module
- // pSrcData
- // Pointer to source code
- // SrcDataLen
- // Size of source code, in bytes
- // pDefines
- // Optional NULL-terminated array of preprocessor macro definitions.
- // pInclude
- // Optional interface pointer to use for handling #include directives.
- // If this parameter is NULL, #includes will be honored when assembling
- // from file, and will error when assembling from resource or memory.
- // Flags
- // See D3DXSHADER_xxx flags
- // ppShader
- // Returns a buffer containing the created shader. This buffer contains
- // the assembled shader code, as well as any embedded debug info.
- // ppErrorMsgs
- // Returns a buffer containing a listing of errors and warnings that were
- // encountered during assembly. If you are running in a debugger,
- // these are the same messages you will see in your debug output.
- //----------------------------------------------------------------------------
- function D3DXAssembleShaderFromFileA(
- pSrcFile: PAnsiChar;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWORD;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileA';
- {$EXTERNALSYM D3DXAssembleShaderFromFileA}
- function D3DXAssembleShaderFromFileW(
- pSrcFile: PWideChar;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWORD;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileW';
- {$EXTERNALSYM D3DXAssembleShaderFromFileW}
- function D3DXAssembleShaderFromFile(
- pSrcFile: PChar;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWORD;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileA';
- {$EXTERNALSYM D3DXAssembleShaderFromFile}
- function D3DXAssembleShaderFromResourceA(
- hSrcModule: HModule;
- pSrcResource: PAnsiChar;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWord;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceA';
- {$EXTERNALSYM D3DXAssembleShaderFromResourceA}
- function D3DXAssembleShaderFromResourceW(
- hSrcModule: HModule;
- pSrcResource: PWideChar;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWord;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceW';
- {$EXTERNALSYM D3DXAssembleShaderFromResourceW}
- function D3DXAssembleShaderFromResource(
- hSrcModule: HModule;
- pSrcResource: PChar;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWord;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceA';
- {$EXTERNALSYM D3DXAssembleShaderFromResource}
- function D3DXAssembleShader(
- pSrcData: PAnsiChar;
- SrcDataLen: LongWord;
- pDefines: PD3DXMacro;
- pInclude: ID3DXInclude;
- Flags: DWord;
- ppShader: PID3DXBuffer;
- ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL;
- {$EXTERNALSYM D3DXAssembleShader}
-
- //----------------------------------------------------------------------------
- // D3DXCompileShader:
- // ------------------
- // Compiles a shader.
- //
- // Parameters:
- // pSrcFile
- // Source file name.
- // hSrcModule
- // Module handle. if NULL, current module will be used.
- // pSrcResource
- // Resource name in module.
- // pSrcData
- // Pointer to source code.
- // SrcDataLen
- // Size of source code, in bytes.
- // pDefines
- // Optional NULL-terminated array of preprocessor macro definitions.
- // pInclude
- // Optional interface pointer to use for handling #include directives.
- // If this parameter is NULL, #includes will be honored when compiling
- // from file, and will error when compiling from resource or memory.
- // pFunctionName
- // Name of the entrypoint function where execution should begin.
- // pProfile
- // Instruction set to be used when generating code. Currently supported
- // profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1",
- // "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0"
- // Flags
- // See D3DXSHADER_xxx flags.
- // ppShader
- // Returns a buffer containing the created shader. This buffer contains
- // the compiled shader code, as well as any embedded debug and symbol
- // table info. (See D3DXGetShaderConstantTable)
- // ppErrorMsgs
- // Returns a buffer containing a listing of errors and warnings that were
- // encountered during the compile. If you are running in a debugger,
- // these are the same messages you will see in your debug output.
- // ppConstantTable
- // Returns a ID3DXConstantTable object which can be used to set
- // shader constants to the device. Alternatively, an application can
- // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
- // the shader.
- //----------------------------------------------------------------------------
- function D3DXCompileShaderFromFileA(
- pSrcFile: PAnsiChar;