Module: wine Branch: master Commit: d882ee27464060c6ff212c80ed00e99a42e55617 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d882ee27464060c6ff212c80ed...
Author: David Adam David.Adam@math.cnrs.fr Date: Thu Apr 19 21:08:56 2007 +0200
d3drm: Implement D3DRMVectorModulus.
---
dlls/d3drm/d3drm.spec | 2 +- dlls/d3drm/math.c | 8 ++++++++ dlls/d3drm/tests/vector.c | 4 ++++ 3 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec index 59c1e03..b736405 100644 --- a/dlls/d3drm/d3drm.spec +++ b/dlls/d3drm/d3drm.spec @@ -11,7 +11,7 @@ @ stdcall D3DRMVectorAdd(ptr ptr ptr) @ stdcall D3DRMVectorCrossProduct(ptr ptr ptr) @ stdcall D3DRMVectorDotProduct(ptr ptr) -@ stub D3DRMVectorModulus +@ stdcall D3DRMVectorModulus(ptr) @ stub D3DRMVectorNormalize @ stub D3DRMVectorRandom @ stub D3DRMVectorReflect diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c index d9078fe..5b31171 100644 --- a/dlls/d3drm/math.c +++ b/dlls/d3drm/math.c @@ -66,3 +66,11 @@ D3DVALUE WINAPI D3DRMVectorDotProduct(LPD3DVECTOR s1, LPD3DVECTOR s2) dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z; return dot_product; } + +/* Norm of a vector */ +D3DVALUE WINAPI D3DRMVectorModulus(LPD3DVECTOR v) +{ + D3DVALUE result; + result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z); + return result; +} diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c index 4b76ba2..83f6446 100644 --- a/dlls/d3drm/tests/vector.c +++ b/dlls/d3drm/tests/vector.c @@ -56,6 +56,10 @@ void VectorTest(void) /*_______________________VectorDotProduct__________________________*/ mod=D3DRMVectorDotProduct(&u,&v); ok((mod == 16.0), "Expected 16.0, Got %f",mod); + +/*_______________________VectorModulus_____________________________*/ + mod=D3DRMVectorModulus(&u); + ok((mod == 3.0), "Expected 3.0, Got %f",mod); }
START_TEST(vector)