Commit 78224944 authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3drm: The input quaternions are not changed when calling D3DRMQuaternionSlerp.

parent b45d4aa1
...@@ -128,6 +128,7 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION q, LPD3DV ...@@ -128,6 +128,7 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION q, LPD3DV
LPD3DRMQUATERNION WINAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q, LPD3DRMQUATERNION a, LPD3DRMQUATERNION b, D3DVALUE alpha) LPD3DRMQUATERNION WINAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q, LPD3DRMQUATERNION a, LPD3DRMQUATERNION b, D3DVALUE alpha)
{ {
D3DVALUE dot, epsilon, temp, theta, u; D3DVALUE dot, epsilon, temp, theta, u;
D3DVECTOR v1, v2;
dot = a->s * b->s + D3DRMVectorDotProduct(&a->v, &b->v); dot = a->s * b->s + D3DRMVectorDotProduct(&a->v, &b->v);
epsilon = 1.0f; epsilon = 1.0f;
...@@ -145,8 +146,9 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q, LPD3DRMQUATER ...@@ -145,8 +146,9 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q, LPD3DRMQUATER
u = sin(theta * alpha) / sin(theta); u = sin(theta * alpha) / sin(theta);
} }
q->s = temp * a->s + epsilon * u * b->s; q->s = temp * a->s + epsilon * u * b->s;
D3DRMVectorAdd(&q->v, D3DRMVectorScale(&a->v, &a->v, temp), D3DRMVectorScale(&v1, &a->v, temp);
D3DRMVectorScale(&b->v, &b->v, epsilon * u)); D3DRMVectorScale(&v2, &b->v, epsilon * u);
D3DRMVectorAdd(&q->v, &v1, &v2);
return q; return q;
} }
......
...@@ -243,7 +243,7 @@ static void QuaternionTest(void) ...@@ -243,7 +243,7 @@ static void QuaternionTest(void)
{ {
D3DVECTOR axis; D3DVECTOR axis;
D3DVALUE par,theta; D3DVALUE par,theta;
D3DRMQUATERNION q,q1,q2,r; D3DRMQUATERNION q,q1,q1final,q2,q2final,r;
/*_________________QuaternionFromRotation___________________*/ /*_________________QuaternionFromRotation___________________*/
U1(axis).x=1.0f; U2(axis).y=1.0f; U3(axis).z=1.0f; U1(axis).x=1.0f; U2(axis).y=1.0f; U3(axis).z=1.0f;
...@@ -275,8 +275,15 @@ static void QuaternionTest(void) ...@@ -275,8 +275,15 @@ static void QuaternionTest(void)
q1.s=0.1f; U1(q1.v).x=0.2f; U2(q1.v).y=0.3f; U3(q1.v).z=0.4f; q1.s=0.1f; U1(q1.v).x=0.2f; U2(q1.v).y=0.3f; U3(q1.v).z=0.4f;
q2.s=0.5f; U1(q2.v).x=0.6f; U2(q2.v).y=0.7f; U3(q2.v).z=0.8f; q2.s=0.5f; U1(q2.v).x=0.6f; U2(q2.v).y=0.7f; U3(q2.v).z=0.8f;
q.s = 0.243943f; U1(q.v).x = 0.351172f; U2(q.v).y = 0.458401f; U3(q.v).z = 0.565629f; q.s = 0.243943f; U1(q.v).x = 0.351172f; U2(q.v).y = 0.458401f; U3(q.v).z = 0.565629f;
q1final=q1;
q2final=q2;
pD3DRMQuaternionSlerp(&r,&q1,&q2,par); pD3DRMQuaternionSlerp(&r,&q1,&q2,par);
expect_quat(q,r); expect_quat(q,r);
/* Test to show that the input quaternions are not changed */
expect_quat(q1,q1final);
expect_quat(q2,q2final);
} }
static void ColorTest(void) static void ColorTest(void)
......
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