📄 d3dx10math.h
字号:
// 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)
STDMETHOD(RotateAxis)
(THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE;
// 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)
STDMETHOD(RotateAxisLocal)
(THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE;
// 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.
STDMETHOD(RotateYawPitchRoll)
(THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE;
// 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.
STDMETHOD(RotateYawPitchRollLocal)
(THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE;
// Right multiply the current matrix with the computed scale
// matrix. (transformation is about the current world origin)
STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
// Left multiply the current matrix with the computed scale
// matrix. (transformation is about the local origin of the object)
STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
// Right multiply the current matrix with the computed translation
// matrix. (transformation is about the current world origin)
STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE;
// Left multiply the current matrix with the computed translation
// matrix. (transformation is about the local origin of the object)
STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
// Obtain the current matrix at the top of the stack
STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE;
};
#ifdef __cplusplus
extern "C" {
#endif
HRESULT WINAPI
D3DXCreateMatrixStack(
UINT Flags,
LPD3DXMATRIXSTACK* ppStack);
#ifdef __cplusplus
}
#endif
// non-inline
#ifdef __cplusplus
extern "C" {
#endif
//============================================================================
//
// Basic Spherical Harmonic math routines
//
//============================================================================
#define D3DXSH_MINORDER 2
#define D3DXSH_MAXORDER 6
//============================================================================
//
// 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
//
//============================================================================
FLOAT* WINAPI D3DXSHEvalDirection
( FLOAT *pOut, UINT Order, CONST D3DXVECTOR3 *pDir );
//============================================================================
//
// 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.
//
//============================================================================
FLOAT* WINAPI D3DXSHRotate
( FLOAT *pOut, UINT Order, CONST D3DXMATRIX *pMatrix, CONST FLOAT *pIn );
//============================================================================
//
// 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.
//
//============================================================================
FLOAT* WINAPI D3DXSHRotateZ
( FLOAT *pOut, UINT Order, FLOAT Angle, CONST FLOAT *pIn );
//============================================================================
//
// 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.)
//
//============================================================================
FLOAT* WINAPI D3DXSHAdd
( FLOAT *pOut, UINT Order, CONST FLOAT *pA, CONST FLOAT *pB );
//============================================================================
//
// 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.
//
//============================================================================
FLOAT* WINAPI D3DXSHScale
( FLOAT *pOut, UINT Order, CONST FLOAT *pIn, CONST FLOAT Scale );
//============================================================================
//
// 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.
//
//============================================================================
FLOAT WINAPI D3DXSHDot
( UINT Order, CONST FLOAT *pA, CONST FLOAT *pB );
//============================================================================
//
// 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.)
//
//============================================================================
HRESULT WINAPI D3DXSHEvalDirectionalLight
( UINT Order, CONST D3DXVECTOR3 *pDir,
FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity,
FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut );
//============================================================================
//
// 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.)
//
//============================================================================
HRESULT WINAPI D3DXSHEvalSphericalLight
( UINT Order, CONST D3DXVECTOR3 *pPos, FLOAT Radius,
FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity,
FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut );
//============================================================================
//
// 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.)
//
//============================================================================
HRESULT WINAPI D3DXSHEvalConeLight
( UINT Order, CONST D3DXVECTOR3 *pDir, FLOAT Radius,
FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity,
FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut );
//============================================================================
//
// 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
//
//============================================================================
HRESULT WINAPI D3DXSHEvalHemisphereLight
( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom,
FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut );
// Math intersection functions
BOOL WINAPI D3DXIntersectTri
(
CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position
CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position
CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position
CONST D3DXVECTOR3 *pRayPos, // Ray origin
CONST D3DXVECTOR3 *pRayDir, // Ray direction
FLOAT *pU, // Barycentric Hit Coordinates
FLOAT *pV, // Barycentric Hit Coordinates
FLOAT *pDist); // Ray-Intersection Parameter Distance
BOOL WINAPI
D3DXSphereBoundProbe(
CONST D3DXVECTOR3 *pCenter,
FLOAT Radius,
CONST D3DXVECTOR3 *pRayPosition,
CONST D3DXVECTOR3 *pRayDirection);
BOOL WINAPI
D3DXBoxBoundProbe(
CONST D3DXVECTOR3 *pMin,
CONST D3DXVECTOR3 *pMax,
CONST D3DXVECTOR3 *pRayPosition,
CONST D3DXVECTOR3 *pRayDirection);
HRESULT WINAPI
D3DXComputeBoundingSphere(
CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position
DWORD NumVertices,
DWORD dwStride, // count in bytes to subsequent position vectors
D3DXVECTOR3 *pCenter,
FLOAT *pRadius);
HRESULT WINAPI
D3DXComputeBoundingBox(
CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position
DWORD NumVertices,
DWORD dwStride, // count in bytes to subsequent position vectors
D3DXVECTOR3 *pMin,
D3DXVECTOR3 *pMax);
///////////////////////////////////////////////////////////////////////////
// CPU Optimization:
///////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------
// D3DX_CPU_OPTIMIZATION flags:
// ----------------------------
// D3DX_NOT_OPTIMIZED Use Intel Pentium optimizations
// D3DX_3DNOW_OPTIMIZED Use AMD 3DNow optimizations
// D3DX_SSE_OPTIMIZED Use Intel Pentium III SSE optimizations
// D3DX_SSE2_OPTIMIZED Use Intel Pentium IV SSE2 optimizations
//-------------------------------------------------------------------------
typedef enum _D3DX_CPU_OPTIMIZATION
{
D3DX_NOT_OPTIMIZED = 0,
D3DX_3DNOW_OPTIMIZED,
D3DX_SSE2_OPTIMIZED,
D3DX_SSE_OPTIMIZED
} D3DX_CPU_OPTIMIZATION;
//-------------------------------------------------------------------------
// D3DXCpuOptimizations:
// ---------------------
// Enables or disables CPU optimizations. Returns the type of CPU, which
// was detected, and for which optimizations exist.
//
// Parameters:
// Enable
// TRUE to enable CPU optimizations. FALSE to disable.
//-------------------------------------------------------------------------
D3DX_CPU_OPTIMIZATION WINAPI
D3DXCpuOptimizations(BOOL Enable);
#ifdef __cplusplus
}
#endif
#include "D3DX10math.inl"
#if _MSC_VER >= 1200
#pragma warning(pop)
#else
#pragma warning(default:4201)
#endif
#endif // __D3DX9MATH_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -