d3dx8: Implement D3DX*Scale.

This commit is contained in:
David Adam 2007-10-18 19:53:30 +02:00 committed by Alexandre Julliard
parent c1892f258f
commit 9657611878
2 changed files with 39 additions and 0 deletions

View File

@ -263,6 +263,16 @@ static void D3X8Vector3Test(void)
funcpointer = D3DXVec3Minimize(NULL,NULL,NULL);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Scale____________________________*/
expectedvec.x = -58.5f; expectedvec.y = -39.0f; expectedvec.z = -13.0f;
D3DXVec3Scale(&gotvec,&u,scale);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
funcpointer = D3DXVec3Scale(&gotvec,NULL,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
funcpointer = D3DXVec3Scale(NULL,NULL,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Subtract_______________________*/
expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f;
D3DXVec3Subtract(&gotvec,&u,&v);
@ -355,6 +365,16 @@ static void D3X8Vector4Test(void)
funcpointer = D3DXVec4Minimize(NULL,NULL,NULL);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec4Scale____________________________*/
expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f;
D3DXVec4Scale(&gotvec,&u,scale);
expect_vec4(expectedvec,gotvec);
/* Tests the case NULL */
funcpointer = D3DXVec4Scale(&gotvec,NULL,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
funcpointer = D3DXVec4Scale(NULL,NULL,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec4Subtract__________________________*/
expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f;
D3DXVec4Subtract(&gotvec,&u,&v);

View File

@ -149,6 +149,15 @@ static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
pout->x = s * (pv->x);
pout->y = s * (pv->y);
pout->z = s * (pv->z);
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
@ -218,6 +227,16 @@ static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
pout->x = s * (pv->x);
pout->y = s * (pv->y);
pout->z = s * (pv->z);
pout->w = s * (pv->w);
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;