From 878bcb519c4b87a4c751effd60135f965e1648e7 Mon Sep 17 00:00:00 2001 From: David Adam Date: Fri, 17 Jul 2009 18:18:32 +0200 Subject: [PATCH] d3dx9: Fix D3DXVec3TransformCoord to make tests pass in Windows. --- dlls/d3dx9_36/math.c | 18 +++++------------- dlls/d3dx9_36/tests/math.c | 7 +------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 31078e521a0..13678840ce4 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -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; } diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index 8879e1c6edd..4b764cf0614 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -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;