d3dx9: Fix D3DXVec3TransformCoord to make tests pass in Windows.

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

View File

@ -1598,20 +1598,12 @@ D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3
norm = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] *pv->z + pm->u.m[3][3];
if ( norm )
{
CONST D3DXVECTOR3 v = *pv;
out.x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[2][0] * v.z + pm->u.m[3][0]) / norm;
out.y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[2][1] * v.z + pm->u.m[3][1]) / norm;
out.z = (pm->u.m[0][2] * v.x + pm->u.m[1][2] * v.y + pm->u.m[2][2] * v.z + pm->u.m[3][2]) / norm;
}
else
{
out.x = 0.0f;
out.y = 0.0f;
out.z = 0.0f;
}
out.x = (pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[2][0] * pv->z + pm->u.m[3][0]) / norm;
out.y = (pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[2][1] * pv->z + pm->u.m[3][1]) / norm;
out.z = (pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[2][2] * pv->z + pm->u.m[3][2]) / norm;
*pout = out;
return pout;
}

View File

@ -1115,7 +1115,7 @@ static void D3DXVector2Test(void)
static void D3DXVector3Test(void)
{
D3DVIEWPORT9 viewport;
D3DXVECTOR3 expectedvec, gotvec, nul, nulproj, u, v, w, x;
D3DXVECTOR3 expectedvec, gotvec, nul, u, v, w, x;
LPD3DXVECTOR3 funcpointer;
D3DXVECTOR4 expectedtrans, gottrans;
D3DXMATRIX mat, projection, view, world;
@ -1290,11 +1290,6 @@ static void D3DXVector3Test(void)
expectedvec.x = 70.0f/124.0f; expectedvec.y = 88.0f/124.0f; expectedvec.z = 106.0f/124.0f;
D3DXVec3TransformCoord(&gotvec,&u,&mat);
expect_vec3(expectedvec,gotvec);
/* Test the nul projected vector */
nulproj.x = 1.0f; nulproj.y = -1.0f, nulproj.z = -1.0f;
expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
D3DXVec3TransformCoord(&gotvec,&nulproj,&mat);
expect_vec3(expectedvec,gotvec);
/*_______________D3DXVec3TransformNormal______________________*/
expectedvec.x = 57.0f; expectedvec.y = 74.0f; expectedvec.z = 91.0f;