implements D3DRMVectorAdd

David.Adam at math.cnrs.fr David.Adam at math.cnrs.fr
Sun Apr 15 18:29:54 CDT 2007


-------------- next part --------------
>From 7e76281a0ef2b22c8683ea9d9c67eeb2724687b7 Mon Sep 17 00:00:00 2001
From: Adam <David.Adam at math.cnrs.fr>
Date: Sun, 15 Apr 2007 12:20:06 +0200
Subject: [PATCH] [2] Implement D3DRMVectorAdd with test.

---
 configure                    |    2 +
 configure.ac                 |    1 +
 dlls/d3drm/Makefile.in       |    4 ++-
 dlls/d3drm/d3drm.spec        |    2 +
 dlls/d3drm/math.c            |   41 +++++++++++++++++++++++++++
 dlls/d3drm/tests/Makefile.in |   13 +++++++++
 dlls/d3drm/tests/vector.c    |   64 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 125 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 85b24c5..a5fe716 100755
--- a/configure
+++ b/configure
@@ -20277,6 +20277,8 @@ ac_config_files="$ac_config_files dlls/d
 
 ac_config_files="$ac_config_files dlls/d3drm/Makefile"
 
+ac_config_files="$ac_config_files dlls/d3drm/tests/Makefile"
+
 ac_config_files="$ac_config_files dlls/d3dx8/Makefile"
 
 ac_config_files="$ac_config_files dlls/d3dxof/Makefile"
diff --git a/configure.ac b/configure.ac
index c9766dc..cd25a18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1529,6 +1529,7 @@ AC_CONFIG_FILES([dlls/d3d9/Makefile])
 AC_CONFIG_FILES([dlls/d3d9/tests/Makefile])
 AC_CONFIG_FILES([dlls/d3dim/Makefile])
 AC_CONFIG_FILES([dlls/d3drm/Makefile])
+AC_CONFIG_FILES([dlls/d3drm/tests/Makefile])
 AC_CONFIG_FILES([dlls/d3dx8/Makefile])
 AC_CONFIG_FILES([dlls/d3dxof/Makefile])
 AC_CONFIG_FILES([dlls/dbghelp/Makefile])
diff --git a/dlls/d3drm/Makefile.in b/dlls/d3drm/Makefile.in
index 2883af1..f070c1d 100644
--- a/dlls/d3drm/Makefile.in
+++ b/dlls/d3drm/Makefile.in
@@ -6,7 +6,9 @@ MODULE    = d3drm.dll
 IMPORTLIB = libd3drm.$(IMPLIBEXT)
 IMPORTS   = kernel32
 
-C_SRCS = d3drm_main.c
+C_SRCS = \
+	d3drm_main.c \
+	math.c
 
 RC_SRCS = version.rc
 
diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec
index 9964085..f0aa67f 100644
--- a/dlls/d3drm/d3drm.spec
+++ b/dlls/d3drm/d3drm.spec
@@ -8,7 +8,7 @@
 @ stub D3DRMQuaternionFromRotation
 @ stub D3DRMQuaternionMultiply
 @ stub D3DRMQuaternionSlerp
-@ stub D3DRMVectorAdd
+@ stdcall D3DRMVectorAdd(ptr ptr ptr)
 @ stub D3DRMVectorCrossProduct
 @ stub D3DRMVectorDotProduct
 @ stub D3DRMVectorModulus
diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c
new file mode 100644
index 0000000..96af2f0
--- /dev/null
+++ b/dlls/d3drm/math.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2007 David Adam
+ *           2007 Vijay Kiran Kamuju
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <math.h>
+#include <time.h>
+#include "windef.h"
+#include "winbase.h"
+#include "d3drmdef.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+
+/* Add Two Vectors */
+LPD3DVECTOR D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d, LPD3DVECTOR s1, LPD3DVECTOR s2)
+{
+    d->x=s1->x + s2->x;
+    d->y=s1->y + s2->y;
+    d->z=s1->z + s2->z;
+    return d;
+}
diff --git a/dlls/d3drm/tests/Makefile.in b/dlls/d3drm/tests/Makefile.in
new file mode 100644
index 0000000..1e682e7
--- /dev/null
+++ b/dlls/d3drm/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = d3drm.dll
+IMPORTS   = d3drm kernel32
+EXTRALIBS = -ldxguid
+
+CTESTS = vector.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c
new file mode 100644
index 0000000..c4cbd53
--- /dev/null
+++ b/dlls/d3drm/tests/vector.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 Vijay Kiran Kamuju
+ *                David Adam 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+ 
+#include <assert.h>
+#include "wine/test.h"
+#include "d3drmdef.h"
+#include <math.h>
+
+#define expect_vec(expectedvec,gotvec) \
+  ok( ((fabs(expectedvec.x-gotvec.x)<0.000001)&&(fabs(expectedvec.y-gotvec.y)<0.000001)&&(fabs(expectedvec.z-gotvec.z)<0.000001)), \
+  "Expected Vector= (%f, %f, %f)\n , Got Vector= (%f, %f, %f)\n", \
+  expectedvec.x,expectedvec.y,expectedvec.z, gotvec.x, gotvec.y, gotvec.z);
+
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorAdd)(LPD3DVECTOR,LPD3DVECTOR,LPD3DVECTOR);
+
+static void init_function_pointers(void)
+{
+    HMODULE hmod = LoadLibraryA("d3drm.dll");
+
+    if(!hmod)
+    {
+        skip("Could not load d3drm.dll");
+        return;
+    }
+
+    pD3DRMVectorAdd = (void*)GetProcAddress(hmod, "D3DRMVectorAdd");
+}
+
+static void VectorTest(void)
+{
+    D3DVECTOR e,r,u,v;
+
+    u.x=2.0;u.y=2.0;u.z=1.0;
+    v.x=4.0;v.y=4.0;v.z=0.0;
+
+/*______________________VectorAdd_________________________________*/
+    pD3DRMVectorAdd(&r,&u,&v);
+    e.x=6.0;e.y=6.0;e.z=1.0;
+    todo_wine {
+    expect_vec(e,r);
+              }
+}
+
+START_TEST(vector)
+{
+   init_function_pointers();
+   VectorTest();
+}
-- 
1.4.2



More information about the wine-patches mailing list