mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
d3dx8: Implement D3DXQuaternionSlerp.
This commit is contained in:
parent
54e8d08e45
commit
cb954ca6b4
4 changed files with 30 additions and 3 deletions
|
@ -58,7 +58,7 @@
|
|||
@ stdcall D3DXQuaternionInverse(ptr ptr)
|
||||
@ stub D3DXQuaternionLn
|
||||
@ stub D3DXQuaternionExp
|
||||
@ stub D3DXQuaternionSlerp
|
||||
@ stdcall D3DXQuaternionSlerp(ptr ptr ptr long)
|
||||
@ stub D3DXQuaternionSquad
|
||||
@ stub D3DXQuaternionBaryCentric
|
||||
@ stdcall D3DXPlaneNormalize(ptr ptr)
|
||||
|
|
|
@ -635,6 +635,21 @@ D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQ
|
|||
}
|
||||
return pout;
|
||||
}
|
||||
|
||||
D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t)
|
||||
{
|
||||
FLOAT dot, epsilon;
|
||||
|
||||
epsilon = 1.0f;
|
||||
dot = D3DXQuaternionDot(pq1, pq2);
|
||||
if ( dot < 0.0f) epsilon = -1.0f;
|
||||
pout->x = (1.0f - t) * pq1->x + epsilon * t * pq2->x;
|
||||
pout->y = (1.0f - t) * pq1->y + epsilon * t * pq2->y;
|
||||
pout->z = (1.0f - t) * pq1->z + epsilon * t * pq2->z;
|
||||
pout->w = (1.0f - t) * pq1->w + epsilon * t * pq2->w;
|
||||
return pout;
|
||||
}
|
||||
|
||||
/*_________________D3DXVec2_____________________*/
|
||||
|
||||
D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g)
|
||||
|
|
|
@ -552,14 +552,17 @@ static void D3DXPlaneTest(void)
|
|||
|
||||
static void D3X8QuaternionTest(void)
|
||||
{
|
||||
D3DXQUATERNION expectedquat, gotquat, nul, q, r, s;
|
||||
D3DXQUATERNION expectedquat, gotquat, nul, q, r, s, t;
|
||||
LPD3DXQUATERNION funcpointer;
|
||||
FLOAT expected, got;
|
||||
FLOAT expected, got, scale;
|
||||
BOOL expectedbool, gotbool;
|
||||
|
||||
nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f; nul.w = 0.0f;
|
||||
q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
|
||||
r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
|
||||
t.x = -1111.0f, t.y= 111.0f; t.z = -11.0f; t.w = 1.0f;
|
||||
|
||||
scale = 0.3f;
|
||||
|
||||
/*_______________D3DXQuaternionConjugate________________*/
|
||||
expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
|
||||
|
@ -644,6 +647,14 @@ static void D3X8QuaternionTest(void)
|
|||
expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
|
||||
D3DXQuaternionNormalize(&gotquat,&nul);
|
||||
expect_vec4(expectedquat,gotquat);
|
||||
|
||||
/*_______________D3DXQuaternionSlerp________________________*/
|
||||
expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f;
|
||||
D3DXQuaternionSlerp(&gotquat,&q,&r,scale);
|
||||
expect_vec4(expectedquat,gotquat);
|
||||
expectedquat.x = 334.0f; expectedquat.y = -31.9f; expectedquat.z = 6.1f; expectedquat.w = 6.7f;
|
||||
D3DXQuaternionSlerp(&gotquat,&q,&t,scale);
|
||||
expect_vec4(expectedquat,gotquat);
|
||||
}
|
||||
|
||||
static void D3X8Vector2Test(void)
|
||||
|
|
|
@ -305,6 +305,7 @@ D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *pplane, C
|
|||
D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
|
||||
D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2);
|
||||
D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
|
||||
D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t);
|
||||
|
||||
D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g);
|
||||
D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT s);
|
||||
|
|
Loading…
Reference in a new issue