d3dx9: Fix D3DXVec4Normalize to make tests pass in Windows.
This commit is contained in:
parent
878bcb519c
commit
8823decbd4
|
@ -1725,20 +1725,12 @@ D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv)
|
||||||
FLOAT norm;
|
FLOAT norm;
|
||||||
|
|
||||||
norm = D3DXVec4Length(pv);
|
norm = D3DXVec4Length(pv);
|
||||||
if ( !norm )
|
|
||||||
{
|
out.x = pv->x / norm;
|
||||||
out.x = 0.0f;
|
out.y = pv->y / norm;
|
||||||
out.y = 0.0f;
|
out.z = pv->z / norm;
|
||||||
out.z = 0.0f;
|
out.w = pv->w / norm;
|
||||||
out.w = 0.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
out.x = pv->x / norm;
|
|
||||||
out.y = pv->y / norm;
|
|
||||||
out.z = pv->z / norm;
|
|
||||||
out.w = pv->w / norm;
|
|
||||||
}
|
|
||||||
*pout = out;
|
*pout = out;
|
||||||
return pout;
|
return pout;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1419,10 +1419,6 @@ static void D3DXVector4Test(void)
|
||||||
expectedvec.x = 1.0f/11.0f; expectedvec.y = 2.0f/11.0f; expectedvec.z = 4.0f/11.0f; expectedvec.w = 10.0f/11.0f;
|
expectedvec.x = 1.0f/11.0f; expectedvec.y = 2.0f/11.0f; expectedvec.z = 4.0f/11.0f; expectedvec.w = 10.0f/11.0f;
|
||||||
D3DXVec4Normalize(&gotvec,&u);
|
D3DXVec4Normalize(&gotvec,&u);
|
||||||
expect_vec4(expectedvec,gotvec);
|
expect_vec4(expectedvec,gotvec);
|
||||||
/* Test the nul vector */
|
|
||||||
expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f; expectedvec.w = 0.0f;
|
|
||||||
D3DXVec4Normalize(&gotvec,&nul);
|
|
||||||
expect_vec4(expectedvec,gotvec);
|
|
||||||
|
|
||||||
/*_______________D3DXVec4Scale____________________________*/
|
/*_______________D3DXVec4Scale____________________________*/
|
||||||
expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f;
|
expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f;
|
||||||
|
|
Loading…
Reference in New Issue