第3.6节 转换函数


我们总结了DirectX Math相关的转换函数供参考。

// Constructs a scaling matrix:构造一个缩放矩阵:
XMMATRIX XM_CALLCONV XMMatrixScaling(float ScaleX,float ScaleY,float ScaleZ); // Scaling factors缩放因子
// Constructs a scaling matrix from components invector:从组件invector构造一个缩放矩阵:
XMMATRIX XM_CALLCONV XMMatrixScalingFromVector(FXMVECTOR Scale); // Scaling factors (sx, sy,sz)缩放因子向量
// Constructs a x-axis rotation matrix Rx:构造绕一个x轴旋转矩阵Rx:
XMMATRIX XM_CALLCONV XMMatrixRotationX(float Angle); // Clockwise angle θ torotate顺时针角度θ旋转
// Constructs a y-axis rotation matrix Ry:构造绕一个y轴旋转矩阵Rx:
XMMATRIX XM_CALLCONV XMMatrixRotationY(float Angle); // Clockwise angle θ torotate顺时针角度θ旋转
// Constructs a z-axis rotation matrix Rz:构造绕一个z轴旋转矩阵Rx:
XMMATRIX XM_CALLCONV XMMatrixRotationZ(float Angle); // Clockwise angle θ torotate顺时针角度θ旋转
// Constructs an arbitrary axis rotation matrix Rn:构造绕任意轴旋转矩阵Rn:
XMMATRIX XM_CALLCONV XMMatrixRotationAxis(
FXMVECTOR Axis, // Axis n to rotate about绕轴n旋转
float Angle); // Clockwise angle θ to rotate顺时针角度θ旋转
Constructs a translation matrix:构造一个转置矩阵:
XMMATRIX XM_CALLCONV XMMatrixTranslation(float OffsetX,float OffsetY,float OffsetZ); // Translation factors
Constructs a translation matrix from components in a vector:从矢量中的组件构造一个转换矩阵:
XMMATRIX XM_CALLCONV XMMatrixTranslationFromVector(
FXMVECTOR Offset); // Translation factors (tx,ty, tz)
// Computes the vector-matrix product vM where vw = 1 for transforming points:计算矢量矩阵乘积vM,其中vw = 1用于变换点:
XMVECTOR XM_CALLCONV XMVector3TransformCoord(
FXMVECTOR V, // Input v
CXMMATRIX M); // Input M
// Computes the vector-matrix product vM where vw = 0 for transforming vectors:计算矢量矩阵乘积vM,其中vw = 0用于变换矢量:
XMVECTOR XM_CALLCONV XMVector3TransformNormal(
FXMVECTOR V, // Input v

CXMMATRIX M); // Input M

对于最后两个函数XMVector3TransformCoord和XMVector3TransformNormal,您不需要明确设置w坐标。 对于XMVector3TransformCoord和XMVector3TransformNormal,函数总是分别使用vw = 1和vw = 0。

你可能感兴趣的:(d3d第3.6节)