d3dx9: Fix D3DXVec2TransformCoord to make tests pass in Windows.

This commit is contained in:
David Adam 2009-07-17 18:14:32 +02:00 committed by Alexandre Julliard
parent eff5de1231
commit e37aff31b4
2 changed files with 7 additions and 17 deletions

View file

@ -1440,20 +1440,15 @@ D3DXVECTOR4* WINAPI D3DXVec2TransformArray(D3DXVECTOR4* out, UINT outstride, CON
D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm)
{
D3DXVECTOR2 v;
FLOAT norm;
v = *pv;
norm = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[3][3];
if ( norm )
{
CONST D3DXVECTOR2 v = *pv;
pout->x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[3][0]) / norm;
pout->y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[3][1]) / norm;
}
else
{
pout->x = 0.0f;
pout->y = 0.0f;
}
pout->x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[3][0]) / norm;
pout->y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[3][1]) / norm;
return pout;
}

View file

@ -950,7 +950,7 @@ static void D3DXQuaternionTest(void)
static void D3DXVector2Test(void)
{
D3DXVECTOR2 expectedvec, gotvec, nul, nulproj, u, v, w, x;
D3DXVECTOR2 expectedvec, gotvec, nul, u, v, w, x;
LPD3DXVECTOR2 funcpointer;
D3DXVECTOR4 expectedtrans, gottrans;
D3DXMATRIX mat;
@ -1105,11 +1105,6 @@ static void D3DXVector2Test(void)
expectedvec.x = 0.6f; expectedvec.y = 11.0f/15.0f;
D3DXVec2TransformCoord(&gotvec,&u,&mat);
expect_vec(expectedvec,gotvec);
/* Test the nul projected vector */
nulproj.x = -2.0f; nulproj.y = -1.0f;
expectedvec.x = 0.0f; expectedvec.y = 0.0f;
D3DXVec2TransformCoord(&gotvec,&nulproj,&mat);
expect_vec(expectedvec,gotvec);
/*_______________D3DXVec2TransformNormal______________________*/
expectedvec.x = 23.0f; expectedvec.y = 30.0f;