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