📄 d3dxmath.h
字号:
( D3DXMATRIX *pOut, float w, float h, float zn, float zf );
// Build a perspective projection matrix. (left-handed)
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH
( D3DXMATRIX *pOut, float w, float h, float zn, float zf );
// Build a perspective projection matrix. (right-handed)
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFov
( D3DXMATRIX *pOut, float fovy, float aspect, float zn, float zf );
// Build a perspective projection matrix. (left-handed)
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH
( D3DXMATRIX *pOut, float fovy, float aspect, float zn, float zf );
// Build a perspective projection matrix. (right-handed)
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenter
( D3DXMATRIX *pOut, float l, float r, float b, float t, float zn,
float zf );
// Build a perspective projection matrix. (left-handed)
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH
( D3DXMATRIX *pOut, float l, float r, float b, float t, float zn,
float zf );
// Build an ortho projection matrix. (right-handed)
D3DXMATRIX* WINAPI D3DXMatrixOrtho
( D3DXMATRIX *pOut, float w, float h, float zn, float zf );
// Build an ortho projection matrix. (left-handed)
D3DXMATRIX* WINAPI D3DXMatrixOrthoLH
( D3DXMATRIX *pOut, float w, float h, float zn, float zf );
// Build an ortho projection matrix. (right-handed)
D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenter
( D3DXMATRIX *pOut, float l, float r, float b, float t, float zn,
float zf );
// Build an ortho projection matrix. (left-handed)
D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH
( D3DXMATRIX *pOut, float l, float r, float b, float t, float zn,
float zf );
// Build a matrix which flattens geometry into a plane, as if casting
// a shadow from a light.
D3DXMATRIX* WINAPI D3DXMatrixShadow
( D3DXMATRIX *pOut, const D3DXVECTOR4 *pLight,
const D3DXPLANE *pPlane );
// Build a matrix which reflects the coordinate system about a plane
D3DXMATRIX* WINAPI D3DXMatrixReflect
( D3DXMATRIX *pOut, const D3DXPLANE *pPlane );
#ifdef __cplusplus
}
#endif
//--------------------------
// Quaternion
//--------------------------
// inline
float D3DXQuaternionLength
( const D3DXQUATERNION *pQ );
// Length squared, or "norm"
float D3DXQuaternionLengthSq
( const D3DXQUATERNION *pQ );
float D3DXQuaternionDot
( const D3DXQUATERNION *pQ1, const D3DXQUATERNION *pQ2 );
// (0, 0, 0, 1)
D3DXQUATERNION* D3DXQuaternionIdentity
( D3DXQUATERNION *pOut );
BOOL D3DXQuaternionIsIdentity
( const D3DXQUATERNION *pQ );
// (-x, -y, -z, w)
D3DXQUATERNION* D3DXQuaternionConjugate
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ );
// non-inline
#ifdef __cplusplus
extern "C" {
#endif
// Compute a quaternin's axis and angle of rotation. Expects unit quaternions.
void WINAPI D3DXQuaternionToAxisAngle
( const D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, float *pAngle );
// Build a quaternion from a rotation matrix.
D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix
( D3DXQUATERNION *pOut, const D3DXMATRIX *pM);
// Rotation about arbitrary axis.
D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis
( D3DXQUATERNION *pOut, const D3DXVECTOR3 *pV, float angle );
// Yaw around the Y axis, a pitch around the X axis,
// and a roll around the Z axis.
D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll
( D3DXQUATERNION *pOut, float yaw, float pitch, float roll );
// Quaternion multiplication. The result represents the rotation Q2
// followed by the rotation Q1. (Out = Q2 * Q1)
D3DXQUATERNION* WINAPI D3DXQuaternionMultiply
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ1,
const D3DXQUATERNION *pQ2 );
D3DXQUATERNION* WINAPI D3DXQuaternionNormalize
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ );
// Conjugate and re-norm
D3DXQUATERNION* WINAPI D3DXQuaternionInverse
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ );
// Expects unit quaternions.
// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v)
D3DXQUATERNION* WINAPI D3DXQuaternionLn
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ );
// Expects pure quaternions. (w == 0) w is ignored in calculation.
// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v)
D3DXQUATERNION* WINAPI D3DXQuaternionExp
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ );
// Spherical linear interpolation between Q1 (s == 0) and Q2 (s == 1).
// Expects unit quaternions.
D3DXQUATERNION* WINAPI D3DXQuaternionSlerp
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ1,
const D3DXQUATERNION *pQ2, float t );
// Spherical quadrangle interpolation.
// Slerp(Slerp(Q1, Q4, t), Slerp(Q2, Q3, t), 2t(1-t))
D3DXQUATERNION* WINAPI D3DXQuaternionSquad
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ1,
const D3DXQUATERNION *pQ2, const D3DXQUATERNION *pQ3,
const D3DXQUATERNION *pQ4, float t );
// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g))
D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric
( D3DXQUATERNION *pOut, const D3DXQUATERNION *pQ1,
const D3DXQUATERNION *pQ2, const D3DXQUATERNION *pQ3,
float f, float g );
#ifdef __cplusplus
}
#endif
//--------------------------
// Plane
//--------------------------
// inline
// ax + by + cz + dw
float D3DXPlaneDot
( const D3DXPLANE *pP, const D3DXVECTOR4 *pV);
// ax + by + cz + d
float D3DXPlaneDotCoord
( const D3DXPLANE *pP, const D3DXVECTOR3 *pV);
// ax + by + cz
float D3DXPlaneDotNormal
( const D3DXPLANE *pP, const D3DXVECTOR3 *pV);
// non-inline
#ifdef __cplusplus
extern "C" {
#endif
// Normalize plane (so that |a,b,c| == 1)
D3DXPLANE* WINAPI D3DXPlaneNormalize
( D3DXPLANE *pOut, const D3DXPLANE *pP);
// Find the intersection between a plane and a line. If the line is
// parallel to the plane, NULL is returned.
D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine
( D3DXVECTOR3 *pOut, const D3DXPLANE *pP, const D3DXVECTOR3 *pV1,
const D3DXVECTOR3 *pV2);
// Construct a plane from a point and a normal
D3DXPLANE* WINAPI D3DXPlaneFromPointNormal
( D3DXPLANE *pOut, const D3DXVECTOR3 *pPoint, const D3DXVECTOR3 *pNormal);
// Construct a plane from 3 points
D3DXPLANE* WINAPI D3DXPlaneFromPoints
( D3DXPLANE *pOut, const D3DXVECTOR3 *pV1, const D3DXVECTOR3 *pV2,
const D3DXVECTOR3 *pV3);
// Transform a plane by a matrix. The vector (a,b,c) must be normal.
// M must be an affine transform.
D3DXPLANE* WINAPI D3DXPlaneTransform
( D3DXPLANE *pOut, const D3DXPLANE *pP, const D3DXMATRIX *pM );
#ifdef __cplusplus
}
#endif
//--------------------------
// Color
//--------------------------
// inline
// (1-r, 1-g, 1-b, a)
D3DXCOLOR* D3DXColorNegative
(D3DXCOLOR *pOut, const D3DXCOLOR *pC);
D3DXCOLOR* D3DXColorAdd
(D3DXCOLOR *pOut, const D3DXCOLOR *pC1, const D3DXCOLOR *pC2);
D3DXCOLOR* D3DXColorSubtract
(D3DXCOLOR *pOut, const D3DXCOLOR *pC1, const D3DXCOLOR *pC2);
D3DXCOLOR* D3DXColorScale
(D3DXCOLOR *pOut, const D3DXCOLOR *pC, float s);
// (r1*r2, g1*g2, b1*b2, a1*a2)
D3DXCOLOR* D3DXColorModulate
(D3DXCOLOR *pOut, const D3DXCOLOR *pC1, const D3DXCOLOR *pC2);
// Linear interpolation of r,g,b, and a. C1 + s(C2-C1)
D3DXCOLOR* D3DXColorLerp
(D3DXCOLOR *pOut, const D3DXCOLOR *pC1, const D3DXCOLOR *pC2, float s);
// non-inline
#ifdef __cplusplus
extern "C" {
#endif
// Interpolate r,g,b between desaturated color and color.
// DesaturatedColor + s(Color - DesaturatedColor)
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation
(D3DXCOLOR *pOut, const D3DXCOLOR *pC, float s);
// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey)
D3DXCOLOR* WINAPI D3DXColorAdjustContrast
(D3DXCOLOR *pOut, const D3DXCOLOR *pC, float c);
#ifdef __cplusplus
}
#endif
//===========================================================================
//
// Matrix Stack
//
//===========================================================================
DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown)
{
//
// IUnknown methods
//
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
//
// ID3DXMatrixStack methods
//
// Pops the top of the stack, returns the current top
// *after* popping the top.
STDMETHOD(Pop)(THIS) PURE;
// Pushes the stack by one, duplicating the current matrix.
STDMETHOD(Push)(THIS) PURE;
// Loads identity in the current matrix.
STDMETHOD(LoadIdentity)(THIS) PURE;
// Loads the given matrix into the current matrix
STDMETHOD(LoadMatrix)(THIS_ const D3DXMATRIX* pM ) PURE;
// Right-Multiplies the given matrix to the current matrix.
// (transformation is about the current world origin)
STDMETHOD(MultMatrix)(THIS_ const D3DXMATRIX* pM ) PURE;
// Left-Multiplies the given matrix to the current matrix
// (transformation is about the local origin of the object)
STDMETHOD(MultMatrixLocal)(THIS_ const D3DXMATRIX* pM ) PURE;
// 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( DWORD flags, LPD3DXMATRIXSTACK *ppStack );
#ifdef __cplusplus
}
#endif
#include "d3dxmath.inl"
#pragma warning(default:4201)
#endif // __D3DXMATH_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -