|
|

楼主 |
发表于 2008-3-7 16:29:00
|
显示全部楼层
Re: Re:哪位高人指点一下落不明D3DMatrixScaling函数
earlyfly: Re:哪位高人指点一下落不明D3DMatrixScaling函数
D3DXMatrixScaling
Builds a matrix that scales along the x-axis, the y-axis, and the z-axis.
D3...
呵呵,可是我书上有一个程序又像是一个单位矩阵经过一系列的变化得到的,具体代码如下:
一个物体在Z轴方向上放大5倍,然后又绕Y轴旋转60度,最后沿X轴平移30个单位,其实现代码如下:
D3DXMATRIX matWorld;
DEDXMATRIX matTranlate,matRotation,matScale;
DEDXMatrixScaling(&matScale,1.0f,1.0f,5.0f); //在Z轴方向上放大5倍
FLOAT fAngle=60*(2.0f*D3DX_PI)/360.0f;
D3DXMatrixRotationY(&matRotation,fAngle); //绕Y轴旋转60度
D3DXMatrixMultiply(&matWorld,&matScale,&matRotation); //先放大,后旋转的复合
D3DXMatrixTranslation(&matTranlate,30.0f,0.0f,0.0f); //沿X轴平移30个单位
D3DXMatrixMultiply(&matWorld,&matWold,&matTanlate);//最后结果
g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
照这个例子看的话,那矩阵又好像是单位矩阵经过变换而来的呀 |
|