patch [9/15]: Implements D3DRMVectorRandom [try 2]
David.Adam at math.cnrs.fr
David.Adam at math.cnrs.fr
Thu Apr 19 14:11:02 CDT 2007
-------------- next part --------------
>From a62354cf9857f10a387587652ba551c5b1c4eeb3 Mon Sep 17 00:00:00 2001
From: Adam <David.Adam at math.cnrs.fr>
Date: Fri, 20 Apr 2007 02:06:58 +0200
Subject: [PATCH] Implements D3DRMVectorRandom. Test useless.
---
dlls/d3drm/d3drm.spec | 2 +-
dlls/d3drm/math.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec
index d5ccb2a..575b097 100644
--- a/dlls/d3drm/d3drm.spec
+++ b/dlls/d3drm/d3drm.spec
@@ -13,7 +13,7 @@
@ stdcall D3DRMVectorDotProduct(ptr)
@ stdcall D3DRMVectorModulus(ptr)
@ stdcall D3DRMVectorNormalize(ptr)
-@ stub D3DRMVectorRandom
+@ stdcall D3DRMVectorRandom(ptr)
@ stub D3DRMVectorReflect
@ stub D3DRMVectorRotate
@ stdcall D3DRMVectorScale(ptr ptr long)
diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c
index 5f9d85d..98e7796 100644
--- a/dlls/d3drm/math.c
+++ b/dlls/d3drm/math.c
@@ -90,6 +90,17 @@ LPD3DVECTOR WINAPI D3DRMVectorNormalize(
return u;
}
+/* Returns a random unit vector */
+LPD3DVECTOR WINAPI D3DRMVectorRandom(LPD3DVECTOR d)
+{
+ srand(time(NULL));
+ d->x=(D3DVALUE)(rand());
+ d->y=(D3DVALUE)(rand());
+ d->z=(D3DVALUE)(rand());
+ D3DRMVectorNormalize(d);
+ return d;
+}
+
/* Scale a vector */
LPD3DVECTOR WINAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor)
{
--
1.4.2
More information about the wine-patches
mailing list