patch [2/15]: Implements D3DRMVectorAdd [try 2]

David.Adam at math.cnrs.fr David.Adam at math.cnrs.fr
Thu Apr 19 14:03:53 CDT 2007


-------------- next part --------------
>From fc5522157b42e22787949bae650faaaeaf67fcd9 Mon Sep 17 00:00:00 2001
From: Adam <David.Adam at math.cnrs.fr>
Date: Fri, 20 Apr 2007 01:46:23 +0200
Subject: [PATCH] Implements D3DRMVectorAdd with tests.

---
 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    |   49 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index e086a93..46205f7 100755
--- a/configure
+++ b/configure
@@ -20279,6 +20279,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 5f718c7..c47e419 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1530,6 +1530,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..ab06f89
--- /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 WINAPI 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..05785d5
--- /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
\ No newline at end of file
diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c
new file mode 100644
index 0000000..6067146
--- /dev/null
+++ b/dlls/d3drm/tests/vector.c
@@ -0,0 +1,49 @@
+/*
+ * 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 PI 4*atan(1.0)
+#define admit_error 0.000001
+
+#define expect_vec(expectedvec,gotvec) \
+  ok( ((fabs(expectedvec.x-gotvec.x)<admit_error)&&(fabs(expectedvec.y-gotvec.y)<admit_error)&&(fabs(expectedvec.z-gotvec.z)<admit_error)), \
+  "Expected Vector= (%f, %f, %f)\n , Got Vector= (%f, %f, %f)\n", \
+  expectedvec.x,expectedvec.y,expectedvec.z, gotvec.x, gotvec.y, gotvec.z);
+
+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_________________________________*/
+    D3DRMVectorAdd(&r,&u,&v);
+    e.x=6.0;e.y=6.0;e.z=1.0;
+    expect_vec(e,r);
+}
+
+START_TEST(vector)
+{
+    VectorTest();
+}
-- 
1.4.2



More information about the wine-patches mailing list