Basic Transformation
Translation matrix)
D3DX function used to create the translation matrix
D3DXMATIX * D3DXMatrixTranslation (
D3DXMATRIX * pOut, // result
FLOAT x, // Number of units to translate on x-axis
FLOAT y, // Number of units to translate on y-axis
FLOAT z // Number of units to translate on z-axis
)
Rotation matrix)
D3DXMATRIX * D3DXMatrixRotationX (
D3DXMATRIX * pOut, // result
FLOAT Angle // Angle of rotation measured in radians
};
Proportional Transformation Matrix(Scaling Matrix)
D3DXMATRIX * D3DXMatrixScaling (
D3DXMATRIX * pOut, // result.
FLOAT sx, // Number of units to translate on x-axis
FLOAT sy, // Number of units to translate on y-axis
FLOAT sz // Number of units to translate on z-axis
);
Vector transformation Functions
The D3DXVec3TransformCoord function transforms the point and assumes that the first component of the vector is 1.
D3DXVECTOR * D3DVXec3TransformCoord (
D3DXVECTOR3 * pOut, // result
CONST D3DXVECTOR3 * pv, // The point to transform
CONT D3DXMATRIX * pM // The transformation matrix
);
D3DXMATRIX T (...); // Initialize a transformation matrix
D3DXVECTOR p (...); // Initialize a point
D3DXVec3TransformCoord (& p, & p, & T); // transform the point
D3DXVec3TransformNormal is used for vector transformation, and assuming that the first part of the trace is 0
D3DXVECTOR3 * D3DXVec3TransformNormal (
D3DXVECTOR3 * pOut, // result.
CONST D3DXVECTOR3 * pv, // The vector to transform
CONT D3DXMATRIX * pM // The transformation matrix
);
D3DXMATRIX T (...); // Initialize a transformation matrix
D3DXVECTOR v (...); // Initialize a vector
D3DXVec3TransformCoord (& v, & v, & T); // transform the point
Function used for vertex Array
D3DXVECTOR3 * WINAPI D3DXVec3TransformCoordArray (
D3DXVECTOR3 * pOut,
UINT OutStride,
CONST D3DXVECTOR3 * pV,
UINT VStride,
CONST D3DXMATRIX * pM,
UINT n
);
POut
[In, out] Pointer to the D3DXVECTOR3 structure that is the result of the operation.
OutStride
[In] Stride between vectors in the output data stream.
PV
[In] Pointer to the source D3DXVECTOR3 array.
VStride
[In] Stride between vectors in the input data stream.
PM
[In] Pointer to the source D3DXMATRIX structure.
N
[In] Number of elements in the array.
Used for Vector Array Transformation:
D3DXVECTOR3 * WINAPI D3DXVec3TransformNormalArray (
D3DXVECTOR3 * pOut,
UINT OutStride,
CONST D3DXVECTOR3 * pV,
UINT VStride,
CONST D3DXMATRIX * pM,
UINT n
);
POut
[In, out] Pointer to the D3DXVECTOR3 array that is the result of the operation.
OutStride
[In] Stride between vectors in the output data stream.
PV
[In] Pointer to the source D3DXVECTOR3 array.
VStride
[In] Stride between vectors in the input data stream.
PM
[In] Pointer to the source D3DXMATRIX structure. To transpose a normal with a non-affine matrix, this matrix shocould be a transposed-inverse transformation matrix.
N
[In] Number of elements in the array.
View DirectX9.0 3D SDK
DirectX 9.0 3D Game Development Programming Basics
Jiangxi University of Technology FangSH 2010-4- Organize