DitectX 90 3D 基本变换函数

基本变换

平移矩阵(translation matrix

用于创建平移矩阵的D3DX函数

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

};

比例变换矩阵 (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

);

 向量变换的函数

D3DXVec3TransformCoord 函数对点进行变换, 并假定向量的第个分量为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用于向量的变换, 并假定微量的第4个分量为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



用于点数组的函数

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.

用于向量的数组的变换:

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 should be a transposed-inverse transformation matrix.

n

[in] Number of elements in the array.

查看DirectX9.0 3D SDK

《DirectX 9.0 3D游戏开发编程基础》 笔记

江西理工大学 FangSH 2010-4-17 整理

原文地址:https://www.cnblogs.com/fangshenghui/p/1714318.html