Commit 15f029a5 authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Implement D3DXMatrixRotationYawPitchRoll.

parent 11bd418a
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
@ stdcall D3DXMatrixRotationZ(ptr long) @ stdcall D3DXMatrixRotationZ(ptr long)
@ stdcall D3DXMatrixRotationAxis(ptr ptr long) @ stdcall D3DXMatrixRotationAxis(ptr ptr long)
@ stdcall D3DXMatrixRotationQuaternion(ptr ptr) @ stdcall D3DXMatrixRotationQuaternion(ptr ptr)
@ stub D3DXMatrixRotationYawPitchRoll @ stdcall D3DXMatrixRotationYawPitchRoll(ptr long long long)
@ stub D3DXMatrixTransformation @ stub D3DXMatrixTransformation
@ stub D3DXMatrixAffineTransformation @ stub D3DXMatrixAffineTransformation
@ stub D3DXMatrixLookAtRH @ stub D3DXMatrixLookAtRH
......
...@@ -111,6 +111,19 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle) ...@@ -111,6 +111,19 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle)
return pout; return pout;
} }
D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, FLOAT pitch, FLOAT roll)
{
D3DXMATRIX m, pout1, pout2, pout3;
D3DXMatrixIdentity(&pout3);
D3DXMatrixRotationZ(&m,roll);
D3DXMatrixMultiply(&pout2,&pout3,&m);
D3DXMatrixRotationX(&m,pitch);
D3DXMatrixMultiply(&pout1,&pout2,&m);
D3DXMatrixRotationY(&m,yaw);
D3DXMatrixMultiply(pout,&pout1,&m);
return pout;
}
D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle) D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle)
{ {
D3DXMatrixIdentity(pout); D3DXMatrixIdentity(pout);
......
...@@ -236,6 +236,14 @@ static void D3DXMatrixTest(void) ...@@ -236,6 +236,14 @@ static void D3DXMatrixTest(void)
D3DXMatrixRotationY(&gotmat,angle); D3DXMatrixRotationY(&gotmat,angle);
expect_mat(expectedmat,gotmat); expect_mat(expectedmat,gotmat);
/*____________D3DXMatrixRotationYawPitchRoll____*/
expectedmat.m[0][0] = 0.888777f; expectedmat.m[0][1] = 0.091875f; expectedmat.m[0][2] = -0.449037f; expectedmat.m[0][3] = 0.0f;
expectedmat.m[1][0] = 0.351713f; expectedmat.m[1][1] = 0.491487f; expectedmat.m[1][2] = 0.796705f; expectedmat.m[1][3] = 0.0f;
expectedmat.m[2][0] = 0.293893f; expectedmat.m[2][1] = -0.866025f; expectedmat.m[2][2] = 0.404509f; expectedmat.m[2][3] = 0.0f;
expectedmat.m[3][0] = 0.0f; expectedmat.m[3][1] = 0.0f; expectedmat.m[3][2] = 0.0f; expectedmat.m[3][3] = 1.0f;
D3DXMatrixRotationYawPitchRoll(&gotmat, 3.0f*angle/5.0f, angle, 3.0f*angle/17.0f);
expect_mat(expectedmat,gotmat);
/*____________D3DXMatrixRotationZ______________*/ /*____________D3DXMatrixRotationZ______________*/
expectedmat.m[0][0] = 0.5f; expectedmat.m[0][1] = sqrt(3.0f)/2.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f; expectedmat.m[0][0] = 0.5f; expectedmat.m[0][1] = sqrt(3.0f)/2.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f;
expectedmat.m[1][0] = -sqrt(3.0f)/2.0f; expectedmat.m[1][1] = 0.5f; expectedmat.m[1][2] = 0.0f; expectedmat.m[1][3] = 0.0f; expectedmat.m[1][0] = -sqrt(3.0f)/2.0f; expectedmat.m[1][1] = 0.5f; expectedmat.m[1][2] = 0.0f; expectedmat.m[1][3] = 0.0f;
......
...@@ -64,6 +64,7 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *p ...@@ -64,6 +64,7 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *p
D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3DXQUATERNION *pq); D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3DXQUATERNION *pq);
D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle); D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle); D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, FLOAT pitch, FLOAT roll);
D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle); D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz); D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz);
D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z); D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment