Commit 8d8a5f06 authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Implement D3DXVec2Lerp with a test.

parent 18123a93
......@@ -88,6 +88,16 @@ static void D3X8Vector2Test(void)
got = D3DXVec2LengthSq(NULL);
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXVec2Lerp__________________________*/
expectedvec.x = 68.0f; expectedvec.y = -28.5f;
D3DXVec2Lerp(&gotvec,&u,&v,scale);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
funcpointer = D3DXVec2Lerp(&gotvec,NULL,&v,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
funcpointer = D3DXVec2Lerp(NULL,NULL,NULL,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec2Maximize__________________________*/
expectedvec.x = 3.0f; expectedvec.y = 9.0f;
D3DXVec2Maximize(&gotvec,&u,&v);
......
......@@ -63,6 +63,7 @@ FLOAT D3DXVec2CCW(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
FLOAT D3DXVec2Dot(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv);
FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv);
D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, FLOAT s);
D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, FLOAT s);
......
......@@ -51,6 +51,14 @@ extern inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
return( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
}
extern inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (1-s) * (pv1->x) + s * (pv2->x);
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
return pout;
}
extern inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
......@@ -66,6 +74,7 @@ extern inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2
pout->y = min(pv1->y , pv2->y);
return pout;
}
extern inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment