From de77d8e9fc73aae40e4f7301a4c721a4544469c9 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 19 Apr 2007 21:07:54 +0200 Subject: [PATCH] d3drm: Implement D3DRMVectorDotProduct. --- dlls/d3drm/d3drm.spec | 2 +- dlls/d3drm/math.c | 8 ++++++++ dlls/d3drm/tests/vector.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec index 4347160ecb5..59c1e037d6d 100644 --- a/dlls/d3drm/d3drm.spec +++ b/dlls/d3drm/d3drm.spec @@ -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 diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c index 39b96d0247f..d9078fe4e73 100644 --- a/dlls/d3drm/math.c +++ b/dlls/d3drm/math.c @@ -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; +} diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c index 52c81e892b5..4b76ba2ba62 100644 --- a/dlls/d3drm/tests/vector.c +++ b/dlls/d3drm/tests/vector.c @@ -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)