From 5524923c07d47adc091d61d7d70f8b80e26b2755 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 19 Apr 2007 21:09:48 +0200 Subject: [PATCH] d3drm: Implement D3DRMVectorscale. --- dlls/d3drm/d3drm.spec | 2 +- dlls/d3drm/math.c | 9 +++++++++ dlls/d3drm/tests/vector.c | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec index b736405b447..1efbfd47255 100644 --- a/dlls/d3drm/d3drm.spec +++ b/dlls/d3drm/d3drm.spec @@ -16,7 +16,7 @@ @ stub D3DRMVectorRandom @ stub D3DRMVectorReflect @ stub D3DRMVectorRotate -@ stub D3DRMVectorScale +@ stdcall D3DRMVectorScale(ptr ptr long) @ stdcall D3DRMVectorSubtract(ptr ptr ptr) @ stub Direct3DRMCreate @ stub DllCanUnloadNow diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c index 5b311710214..77f176eb131 100644 --- a/dlls/d3drm/math.c +++ b/dlls/d3drm/math.c @@ -74,3 +74,12 @@ D3DVALUE WINAPI D3DRMVectorModulus(LPD3DVECTOR v) result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z); return result; } + +/* Scale a vector */ +LPD3DVECTOR WINAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor) +{ + d->x=factor * s->x; + d->y=factor * s->y; + d->z=factor * s->z; + return d; +} diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c index 83f64466750..6f45801dd40 100644 --- a/dlls/d3drm/tests/vector.c +++ b/dlls/d3drm/tests/vector.c @@ -32,7 +32,7 @@ void VectorTest(void) { - D3DVALUE mod; + D3DVALUE mod,par; D3DVECTOR e,r,u,v; u.x=2.0;u.y=2.0;u.z=1.0; @@ -60,6 +60,12 @@ void VectorTest(void) /*_______________________VectorModulus_____________________________*/ mod=D3DRMVectorModulus(&u); ok((mod == 3.0), "Expected 3.0, Got %f",mod); + +/*_______________________VectorScale__________________________*/ + par=2.5; + D3DRMVectorScale(&r,&v,par); + e.x=10.0; e.y=10.0; e.z=0.0; + expect_vec(e,r); } START_TEST(vector)