http://bugs.winehq.org/show_bug.cgi?id=33456
Bug #: 33456 Summary: D3DXMatrixTransformation: Broken calculation when scalingrotation and scaling is used Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: NEW Keywords: testcase Severity: normal Priority: P2 Component: directx-d3dx9 AssignedTo: wine-bugs@winehq.org ReportedBy: kgbricola@web.de CC: wine-bugs@winehq.org Classification: Unclassified
Created attachment 44286 --> http://bugs.winehq.org/attachment.cgi?id=44286 D3DXMatrixTransformation test case - 22 failed tests
While trying to improve the speed of D3DXMatrixTransformation(), I found that the calculation when using scalingrotation and scaling at the same time is wrong.
The full formula is (according to msdn): Mout = (Msc)-1 * (Msr)-1 * Ms * Msr * Msc * (Mrc)-1 * Mr * Mrc * Mt while the failing part is: (Msr)-1 * Ms * Msr
So this might not be the correct equivalent: ... D3DXMatrixRotationQuaternion(&m4, pscalingrotation); //Msr D3DXMatrixInverse(&m2, NULL, &m4); //Msr-1 D3DXMatrixScaling(&m3, pscaling->x, pscaling->y, pscaling->z); //Ms ... D3DXMatrixMultiply(&m1, &m1, &m2); D3DXMatrixMultiply(&m1, &m1, &m3); D3DXMatrixMultiply(&m1, &m1, &m4); ...
This may affect other functions as well (e.g. D3DXMatrixTransformation2D()).