Commit 0af9415a authored by Luis C. Busquets Pérez's avatar Luis C. Busquets Pérez Committed by Alexandre Julliard

d3dx9: Implement D3DXMatrixDecompose.

parent 36cf25b5
......@@ -198,7 +198,7 @@
@ stub D3DXLoadVolumeFromVolume
@ stdcall D3DXMatrixAffineTransformation(ptr long ptr ptr ptr) d3dx8.D3DXMatrixAffineTransformation
@ stub D3DXMatrixAffineTransformation2D
@ stub D3DXMatrixDecompose
@ stdcall D3DXMatrixDecompose(ptr ptr ptr ptr)
@ stdcall D3DXMatrixDeterminant(ptr) d3dx8.D3DXMatrixfDeterminant
@ stdcall D3DXMatrixInverse(ptr ptr ptr) d3dx8.D3DXMatrixInverse
@ stdcall D3DXMatrixLookAtLH(ptr ptr ptr ptr) d3dx8.D3DXMatrixLookAtLH
......
......@@ -27,6 +27,60 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
/*************************************************************************
* D3DXMatrixDecompose
*/
HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutrotation, D3DXVECTOR3 *pouttranslation, D3DXMATRIX *pm)
{
D3DXMATRIX normalized;
D3DXVECTOR3 vec;
if (!pm)
{
return D3DERR_INVALIDCALL;
}
/*Compute the scaling part.*/
vec.x=pm->m[0][0];
vec.y=pm->m[0][1];
vec.z=pm->m[0][2];
poutscale->x=D3DXVec3Length(&vec);
vec.x=pm->m[1][0];
vec.y=pm->m[1][1];
vec.z=pm->m[1][2];
poutscale->y=D3DXVec3Length(&vec);
vec.x=pm->m[2][0];
vec.y=pm->m[2][1];
vec.z=pm->m[2][2];
poutscale->z=D3DXVec3Length(&vec);
/*Compute the translation part.*/
pouttranslation->x=pm->m[3][0];
pouttranslation->y=pm->m[3][1];
pouttranslation->z=pm->m[3][2];
/*Let's calculate the rotation now*/
if ( (poutscale->x == 0.0f) || (poutscale->y == 0.0f) || (poutscale->z == 0.0f) )
{
return D3DERR_INVALIDCALL;
}
normalized.m[0][0]=pm->m[0][0]/poutscale->x;
normalized.m[0][1]=pm->m[0][1]/poutscale->x;
normalized.m[0][2]=pm->m[0][2]/poutscale->x;
normalized.m[1][0]=pm->m[1][0]/poutscale->y;
normalized.m[1][1]=pm->m[1][1]/poutscale->y;
normalized.m[1][2]=pm->m[1][2]/poutscale->y;
normalized.m[2][0]=pm->m[2][0]/poutscale->z;
normalized.m[2][1]=pm->m[2][1]/poutscale->z;
normalized.m[2][2]=pm->m[2][2]/poutscale->z;
D3DXQuaternionRotationMatrix(poutrotation,&normalized);
return S_OK;
}
/*************************************************************************
* D3DXPlaneTransformArray
*/
D3DXPLANE* WINAPI D3DXPlaneTransformArray(
......
......@@ -267,6 +267,7 @@ D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR *pc,
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s);
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float scaling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation);
HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutrotation, D3DXVECTOR3 *pouttranslation, D3DXMATRIX *pm);
FLOAT WINAPI D3DXMatrixDeterminant(CONST D3DXMATRIX *pm);
D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm);
D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup);
......
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