Module: wine Branch: master Commit: f50800b25d44c62848b8aa56e3c61a6308f51a1e URL: http://source.winehq.org/git/wine.git/?a=commit;h=f50800b25d44c62848b8aa56e3...
Author: David Adam David.Adam@math.cnrs.fr Date: Thu Apr 19 21:03:53 2007 +0200
d3drm: Implement D3DRMVectorAdd.
---
.gitignore | 4 +++ Makefile.in | 2 + configure | 3 ++ configure.ac | 1 + dlls/Makefile.in | 1 + dlls/d3drm/Makefile.in | 4 ++- dlls/d3drm/d3drm.spec | 2 +- dlls/d3drm/math.c | 42 +++++++++++++++++++++++++++++++++++ dlls/d3drm/tests/Makefile.in | 13 +++++++++++ dlls/d3drm/tests/vector.c | 49 +++++++++++++++++++++++++++++++++++++++++ programs/winetest/Makefile.in | 3 ++ programs/winetest/winetest.rc | 1 + 12 files changed, 123 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore index b4298a7..0de124f 100644 --- a/.gitignore +++ b/.gitignore @@ -175,6 +175,9 @@ dlls/d3d9/version.res dlls/d3dim/libd3dim.def dlls/d3dim/version.res dlls/d3drm/libd3drm.def +dlls/d3drm/tests/*.ok +dlls/d3drm/tests/d3drm_crosstest.exe +dlls/d3drm/tests/testlist.c dlls/d3drm/version.res dlls/d3dx8/libd3dx8.def dlls/d3dxof/libd3dxof.def @@ -819,6 +822,7 @@ programs/winetest/comdlg32_test.exe programs/winetest/crypt32_test.exe programs/winetest/d3d8_test.exe programs/winetest/d3d9_test.exe +programs/winetest/d3drm_test.exe programs/winetest/ddraw_test.exe programs/winetest/dinput_test.exe programs/winetest/dnsapi_test.exe diff --git a/Makefile.in b/Makefile.in index 565871c..bd31162 100644 --- a/Makefile.in +++ b/Makefile.in @@ -195,6 +195,7 @@ ALL_MAKEFILES = \ dlls/d3d9/tests/Makefile \ dlls/d3dim/Makefile \ dlls/d3drm/Makefile \ + dlls/d3drm/tests/Makefile \ dlls/d3dx8/Makefile \ dlls/d3dxof/Makefile \ dlls/dbghelp/Makefile \ @@ -538,6 +539,7 @@ dlls/d3d9/Makefile: dlls/d3d9/Makefile.in dlls/Makedll.rules dlls/d3d9/tests/Makefile: dlls/d3d9/tests/Makefile.in dlls/Maketest.rules dlls/d3dim/Makefile: dlls/d3dim/Makefile.in dlls/Makedll.rules dlls/d3drm/Makefile: dlls/d3drm/Makefile.in dlls/Makedll.rules +dlls/d3drm/tests/Makefile: dlls/d3drm/tests/Makefile.in dlls/Maketest.rules dlls/d3dx8/Makefile: dlls/d3dx8/Makefile.in dlls/Makedll.rules dlls/d3dxof/Makefile: dlls/d3dxof/Makefile.in dlls/Makedll.rules dlls/dbghelp/Makefile: dlls/dbghelp/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 1d26cb6..3e550ea 100755 --- a/configure +++ b/configure @@ -20395,6 +20395,8 @@ ac_config_files="$ac_config_files dlls/d3dim/Makefile"
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" @@ -21580,6 +21582,7 @@ do "dlls/d3d9/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3d9/tests/Makefile" ;; "dlls/d3dim/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dim/Makefile" ;; "dlls/d3drm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3drm/Makefile" ;; + "dlls/d3drm/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3drm/tests/Makefile" ;; "dlls/d3dx8/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx8/Makefile" ;; "dlls/d3dxof/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dxof/Makefile" ;; "dlls/dbghelp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dbghelp/Makefile" ;; diff --git a/configure.ac b/configure.ac index 4fd97f3..1ea3ad2 100644 --- a/configure.ac +++ b/configure.ac @@ -1522,6 +1522,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/Makefile.in b/dlls/Makefile.in index 6594762..1a07abf 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -234,6 +234,7 @@ TESTSUBDIRS = \ crypt32/tests \ d3d8/tests \ d3d9/tests \ + d3drm/tests \ ddraw/tests \ dinput/tests \ dnsapi/tests \ 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..969e9d4 --- /dev/null +++ b/dlls/d3drm/math.c @@ -0,0 +1,42 @@ +/* + * Copyright 2007 David Adam + * Copyright 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 "windef.h" +#include "winbase.h" +#include "wingdi.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..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 + +@MAKE_TEST_RULES@ + +@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..2278d84 --- /dev/null +++ b/dlls/d3drm/tests/vector.c @@ -0,0 +1,49 @@ +/* + * Copyright 2007 Vijay Kiran Kamuju + * Copyright 2007 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(); +} diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index d9e6d22..a15819c 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -33,6 +33,7 @@ TESTBINS = \ crypt32_test.exe \ d3d8_test.exe \ d3d9_test.exe \ + d3drm_test.exe \ ddraw_test.exe \ dinput_test.exe \ dnsapi_test.exe \ @@ -105,6 +106,8 @@ d3d8_test.exe: $(DLLDIR)/d3d8/tests/d3d8_test.exe$(DLLEXT) cp $(DLLDIR)/d3d8/tests/d3d8_test.exe$(DLLEXT) $@ && $(STRIP) $@ d3d9_test.exe: $(DLLDIR)/d3d9/tests/d3d9_test.exe$(DLLEXT) cp $(DLLDIR)/d3d9/tests/d3d9_test.exe$(DLLEXT) $@ && $(STRIP) $@ +d3drm_test.exe: $(DLLDIR)/d3drm/tests/d3drm_test.exe$(DLLEXT) + cp $(DLLDIR)/d3drm/tests/d3drm_test.exe$(DLLEXT) $@ && $(STRIP) $@ ddraw_test.exe: $(DLLDIR)/ddraw/tests/ddraw_test.exe$(DLLEXT) cp $(DLLDIR)/ddraw/tests/ddraw_test.exe$(DLLEXT) $@ && $(STRIP) $@ dinput_test.exe: $(DLLDIR)/dinput/tests/dinput_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 0e62589..3e7d002 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -156,6 +156,7 @@ comdlg32_test.exe TESTRES "comdlg32_test.exe" crypt32_test.exe TESTRES "crypt32_test.exe" d3d8_test.exe TESTRES "d3d8_test.exe" d3d9_test.exe TESTRES "d3d9_test.exe" +d3drm_test.exe TESTRES "d3drm_test.exe" ddraw_test.exe TESTRES "ddraw_test.exe" dinput_test.exe TESTRES "dinput_test.exe" dnsapi_test.exe TESTRES "dnsapi_test.exe"