📄 d3dx9.pas
字号:
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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -