d3drm: Implement D3DRMVectorDotProduct.

This commit is contained in:
David Adam 2007-04-19 21:07:54 +02:00 committed by Alexandre Julliard
parent d152211e21
commit de77d8e9fc
3 changed files with 14 additions and 1 deletions

View File

@ -10,7 +10,7 @@
@ stub D3DRMQuaternionSlerp
@ stdcall D3DRMVectorAdd(ptr ptr ptr)
@ stdcall D3DRMVectorCrossProduct(ptr ptr ptr)
@ stub D3DRMVectorDotProduct
@ stdcall D3DRMVectorDotProduct(ptr ptr)
@ stub D3DRMVectorModulus
@ stub D3DRMVectorNormalize
@ stub D3DRMVectorRandom

View File

@ -58,3 +58,11 @@ LPD3DVECTOR WINAPI D3DRMVectorCrossProduct(LPD3DVECTOR d, LPD3DVECTOR s1, LPD3DV
d->z=s1->x * s2->y - s1->y * s2->x;
return d;
}
/* Dot Product of Two vectors */
D3DVALUE WINAPI D3DRMVectorDotProduct(LPD3DVECTOR s1, LPD3DVECTOR s2)
{
D3DVALUE dot_product;
dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z;
return dot_product;
}

View File

@ -32,6 +32,7 @@
void VectorTest(void)
{
D3DVALUE mod;
D3DVECTOR e,r,u,v;
u.x=2.0;u.y=2.0;u.z=1.0;
@ -51,6 +52,10 @@ void VectorTest(void)
D3DRMVectorCrossProduct(&r,&u,&v);
e.x=-4.0;e.y=4.0;e.z=0.0;
expect_vec(e,r);
/*_______________________VectorDotProduct__________________________*/
mod=D3DRMVectorDotProduct(&u,&v);
ok((mod == 16.0), "Expected 16.0, Got %f",mod);
}
START_TEST(vector)