--- configure	2007-03-13 05:04:44.109375000 -0500
+++ configure.new	2007-03-13 05:10:57.718750000 -0500
@@ -20308,6 +20308,8 @@
 
 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"
--- configure.ac	2007-03-13 05:04:47.343750000 -0500
+++ configure.ac.new	2007-03-13 05:10:14.421875000 -0500
@@ -1560,6 +1560,7 @@
 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])
--- include/Makefile.in	2007-03-13 05:18:15.531250000 -0500
+++ include/Makefile.in.new	2007-03-13 05:18:47.671875000 -0500
@@ -92,6 +92,7 @@
 	d3dcaps.h \
 	d3dhal.h \
 	d3drm.h \
+	d3drmdef.h \
 	d3dtypes.h \
 	d3dvec.inl \
 	d3dx8core.h \
--- /dev/null	2007-03-13 05:29:32.359375000 -0500
+++ include/d3drmdef.h	2007-03-13 05:22:36.796875000 -0500
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 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
+ */
+
+#ifndef __WINE_D3DRMDEF_H__
+#define __WINE_D3DRMDEF_H__
+
+#include <stddef.h>
+#include "d3dtypes.h"
+
+#define D3DRMAPI WINAPI 
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+typedef struct _D3DRMVECTOR4D
+{
+    D3DVALUE x, y, z, w;
+} D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
+
+typedef D3DVALUE D3DRMMATRIX4D[4][4];
+
+typedef struct _D3DRMQUATERNION
+{
+    D3DVALUE s;
+    D3DVECTOR v;
+} D3DRMQUATERNION, *LPD3DRMQUATERNION;
+
+void D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D, LPD3DRMQUATERNION);
+
+LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION ,LPD3DVECTOR,D3DVALUE);
+LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION, LPD3DRMQUATERNION, LPD3DRMQUATERNION);
+LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION, LPD3DRMQUATERNION, LPD3DRMQUATERNION, D3DVALUE);
+LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromMatrix(LPD3DRMQUATERNION, D3DRMMATRIX4D);
+
+LPD3DVECTOR D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR);
+LPD3DVECTOR D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR);
+D3DVALUE D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR, LPD3DVECTOR);
+LPD3DVECTOR D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
+
+#define D3DRMVectorNormalise D3DRMVectorNormalize
+
+D3DVALUE D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR);
+LPD3DVECTOR D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR);
+LPD3DVECTOR D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR, D3DVALUE);
+LPD3DVECTOR D3DRMAPI D3DRMVectorScale(LPD3DVECTOR, LPD3DVECTOR, D3DVALUE);
+
+#if defined(__cplusplus)
+};
+#endif
+
+#endif /* __WINE_D3DRMDEF_H__ */
--- dlls/d3drm/Makefile.in	2007-03-13 05:07:46.562500000 -0500
+++ dlls/d3drm/Makefile.in.new	2007-03-13 05:09:02.828125000 -0500
@@ -6,7 +6,9 @@
 IMPORTLIB = libd3drm.$(IMPLIBEXT)
 IMPORTS   = kernel32
 
-C_SRCS = d3drm_main.c
+C_SRCS = \
+	d3drm_main.c \
+	vector.c
 
 RC_SRCS = version.rc
 
--- /dev/null	2007-03-13 05:31:11.218750000 -0500
+++ dlls/d3drm/vector.c	2007-03-13 05:05:06.250000000 -0500
@@ -0,0 +1,203 @@
+/*
+ * 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 "d3drmdef.h"
+#include <math.h>
+#include <time.h>
+#include <stdlib.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;
+    TRACE("Input vector1=(%f,%f,%f)\n",s1->x,s1->y,s1->z);
+    TRACE("Input vector2=(%f,%f,%f)\n",s2->x,s2->y,s2->z);
+    TRACE("Add of vectors=(%f,%f,%f)=\n",d->x,d->y,d->z); 
+    return d;
+}
+
+/* Substract Two Vectors */
+LPD3DVECTOR D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d, LPD3DVECTOR s1, LPD3DVECTOR s2)
+{
+    d->x=s1->x - s2->x;
+    d->y=s1->y - s2->y;
+    d->z=s1->z - s2->z;
+    TRACE("Input vector1=(%f,%f,%f)\n",s1->x,s1->y,s1->z);
+    TRACE("Input vector2=(%f,%f,%f)\n",s2->x,s2->y,s2->z);
+    TRACE("Subtract of vectors=(%f,%f,%f)=\n",d->x,d->y,d->z); 
+    return d;
+}
+
+/* Cross Product of Two Vectors */
+LPD3DVECTOR D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d, LPD3DVECTOR s1, LPD3DVECTOR s2)
+{
+
+    d->x=s1->y * s2->z - s1->z * s2->y;
+    d->y=s1->z * s2->x - s1->x * s2->z;
+    d->z=s1->x * s2->y - s1->y * s2->x;
+    TRACE("Input vector1=(%f,%f,%f)\n",s1->x,s1->y,s1->z);
+    TRACE("Input vector2=(%f,%f,%f)\n",s2->x,s2->y,s2->z);
+    TRACE("Crossproduct of vectors=(%f,%f,%f)=\n",d->x,d->y,d->z); 
+    return d;
+}
+
+/* Dot Product of Two vectors */
+D3DVALUE D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1, LPD3DVECTOR s2)
+{
+
+    D3DVALUE dot_product;
+    dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z;
+    TRACE("Input vector1=(%f,%f,%f)\n",s1->x,s1->y,s1->z);
+    TRACE("Input vector2=(%f,%f,%f)\n",s2->x,s2->y,s2->z);
+    TRACE("Dot product of vectors=%f\n",dot_product);
+    return dot_product;
+}
+
+/* Norm of a vector */
+D3DVALUE D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v)
+{
+
+    D3DVALUE result;
+    result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z);
+    TRACE("Input vector=(%f,%f,%f)\n",v->x,v->y,v->z);
+    TRACE("Modulus of vector=%f\n",result);
+    return result;
+}
+
+/* Normalize a vector.  Returns NULL if INPUT is the vector null. */
+LPD3DVECTOR D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR u)
+{
+
+    LPD3DVECTOR result=NULL;
+    D3DVALUE modulus;
+    modulus=D3DRMVectorModulus(u);
+    if(modulus)
+    {
+        result=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DVECTOR));
+        
+        result->x=u->x / modulus;
+        result->y=u->y / modulus;
+        result->z=u->z / modulus;
+        TRACE("Input vector=(%f,%f,%f)\n",u->x,u->y,u->z);
+        TRACE("Normalized vector=(%f,%f,%f)\n",result->x,result->y,result->z);
+    }
+    return result; 
+}
+
+/* Rotation of a vector */
+LPD3DVECTOR D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta)
+{
+
+LPD3DRMQUATERNION quaternion,quaternion1, quaternion2, quaternion3, resultq;
+LPD3DVECTOR NORM;
+
+quaternion1=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DRMQUATERNION));
+quaternion2=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DRMQUATERNION));
+quaternion3=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DRMQUATERNION));
+quaternion=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DRMQUATERNION));
+resultq=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DRMQUATERNION));
+NORM=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DVECTOR));
+
+quaternion1->s=cos(theta);
+quaternion2->s=cos(theta);
+NORM=D3DRMVectorNormalize(axis);
+D3DRMVectorScale(&(quaternion1->v),NORM,sin(theta * .5));
+D3DRMVectorScale(&(quaternion2->v),NORM,-sin(theta * .5));
+quaternion3->s=0;
+quaternion3->v=*v;
+D3DRMQuaternionMultiply(quaternion,quaternion1,quaternion3);
+D3DRMQuaternionMultiply(resultq,quaternion,quaternion2);
+*r=resultq->v;
+TRACE("axis=(%f,%f,%f)\n",axis->x,axis->y,axis->z);
+TRACE("Vector=(%f,%f,%f)\n",v->x,v->y,v->z);
+TRACE("Theta=%f\n",theta);
+TRACE("Rotated vector=(%f,%f,%f)\n",r->x,r->y,r->z);
+
+/*Heapfree(resultq); 
+HeapFree(quaternion);
+HeapFree(quaternion1);
+HeapFree(quaternion2);
+HeapFree(quaternion3);
+HeapFree(NORM);*/
+
+return r;
+}
+
+/* Scale a vector */
+LPD3DVECTOR D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor)
+{
+
+    d->x=factor * s->x;
+    d->y=factor * s->y;
+    d->z=factor * s->z;
+    TRACE("Input vector=(%f,%f,%f)\n",s->x,s->y,s->z);
+    TRACE("Scale=%f\n",factor);
+    TRACE("Scaled vector=(%f,%f,%f)\n",d->x,d->y,d->z);  
+    return d;
+}
+
+/* Returns a random unit vector */
+LPD3DVECTOR D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d)
+{
+
+    srand(time(NULL));
+    d->x=(D3DVALUE)(rand());
+    d->y=(D3DVALUE)(rand());
+    d->z=(D3DVALUE)(rand());
+    d=D3DRMNormalizeVector(d);
+    TRACE("Random vector=(%f,%f,%f)\n",d->x,d->y,d->z);
+    return d;
+}
+
+/* Matrix for the Rotation that a unit quaternion represents */
+/*void D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D m, LPD3DRMQUATERNION q)
+{
+   
+}*/
+
+/* Returns a unit quaternion that represents a rotation of an angle around an axis */
+LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION q, LPD3DVECTOR v, D3DVALUE theta)
+{
+    q->s=cos(theta/2);
+    q->v=sin(theta/2)*D3DRMNormalizeVector(v);
+    TRACE("Rotation Quaternion =(%f,%f,%f,%f)=\n",q->s,(q->v).x,(q->v).y,(q->v).z);
+    return q;
+}
+
+/* Product of 2 quaternions */
+LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q, LPD3DRMQUATERNION a, LPD3DRMQUATERNION b)
+{
+    LPD3DVECTOR cross_product=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LPD3DVECTOR));
+    D3DRMVectorCrossProduct(cross_product,&(a->v),&(b->v));
+    q->s=a->s * b->s-D3DRMVectorDotProduct(&(a->v),&(b->v));
+    q->v.x=a->s * (b->v).x + b->s * (a->v).x + cross_product->x;
+    q->v.y=a->s * (b->v).y + b->s * (a->v).y + cross_product->y;
+    q->v.z=a->s * (b->v).z + b->s * (a->v).z + cross_product->z;
+    TRACE("Input quaternion1=(%f,%f,%f,%f)=\n",a->s,(a->v).x,(a->v).y,(a->v).z);
+    TRACE("Input quaternion2=(%f,%f,%f,%f)=\n",b->s,(b->v).x,(b->v).y,(b->v).z);
+    HeapFree(cross_product);
+    TRACE("Quaternion product=(%f,%f,%f,%f)=\n",q->s,(q->v).x,(q->v).y,(q->v).z);
+    return q;
+}
--- /dev/null	2007-03-13 05:32:18.500000000 -0500
+++ dlls/d3drm/tests/Makefile.in	2007-03-13 05:08:07.781250000 -0500
@@ -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
--- /dev/null	2007-03-13 05:32:24.250000000 -0500
+++ dlls/d3drm/tests/vector.c	2007-03-13 05:05:19.906250000 -0500
@@ -0,0 +1,118 @@
+/*
+ * 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 "wine/test.h"
+#include "d3drmdef.h"
+
+#define expect_vec(expectedvec gotvec) \
+  ok( ((expectedvec.x==gotvec.x)&&(expectedvec.y==gotvec.y)&&(expectedvec.z==gotvec.z)), \
+  "Expected Vector %f %f %f , Got Vector %f %f %f\n", \
+  expectedvec.x,expectedvec.y,expectedvec.z, \
+  gotvec.x, gotvec.y, gotvec.z);
+
+#define expect_quat(expectedquat gotquat) \
+  ok( ((expectedquat.s==gotquat.s)&&(expectedquat.v.x==gotquat.v.x)&&(expectedquat.v.y==gotquat.v.y)&&(expectedquat.v.z==gotquat.v.z)), \
+  "Expected Quaternion %f %f %f %f , Got Quaternion %f %f %f %f\n", \
+  expectedquat.s,expectedquat.v.x,expectedquat.v.y,expectedquat.v.z, \
+  gotquat.s,gotquat.v.x, gotquat.v.y, gotquat.v.z);
+
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorAdd)(LPD3DVECTOR,LPD3DVECTOR,LPD3DVECTOR);
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorSubstract)(LPD3DVECTOR,LPD3DVECTOR,LPD3DVECTOR);
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorCrossProduct)(LPD3DVECTOR,LPD3DVECTOR,LPD3DVECTOR);
+static D3DVALUE (D3DRMAPI *pD3DRMVectorDotProduct)(LPD3DVECTOR,LPD3DVECTOR);
+static D3DVALUE (D3DRMAPI *pD3DRMVectorModulus)(LPD3DVECTOR);
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorNormalize)(LPD3DVECTOR);
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorRotate)(LPD3DVECTOR,LPD3DVECTOR,LPD3DVECTOR,D3DVALUE);
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorScale)(LPD3DVECTOR,LPD3DVECTOR,D3DVALUE);
+static LPD3DVECTOR (D3DRMAPI *pD3DRMVectorRandom)(LPD3DVECTOR);
+
+static LPD3DRMQUATERNION (D3DRMAPI *pD3DRMQuaternionFromRotation)(LPD3DRMQUATERNION,LPD3DVECTOR,D3DVALUE);
+static LPD3DRMQUATERNION (D3DRMAPI *pD3DRMQuaternionMultiply)(LPD3DRMQUATERNION,LPD3DRMQUATERNION,LPD3DRMQUATERNION);
+ 
+static void init_function_pointers(void)
+{
+    HMODULE hmod = GetModuleHandleA("d3drm.dll");
+
+    if(hmod)
+    {
+        pD3DRMVectorAdd = (void*)GetProcAddress(hmod, "D3DRMVectorAdd");
+		pD3DRMVectorSubstract = (void*)GetProcAddress(hmod, "D3DRMVectorSubstract");
+		pD3DRMVectorCrossProduct = (void*)GetProcAddress(hmod, "D3DRMVectorCrossProduct");
+		pD3DRMVectorDotProduct = (void*)GetProcAddress(hmod, "D3DRMVectorDotProduct");
+		pD3DRMVectorModulus = (void*)GetProcAddress(hmod, "D3DRMVectorModulus");
+		pD3DRMVectorNormalize = (void*)GetProcAddress(hmod, "D3DRMVectorNormalize");
+		pD3DRMVectorRotate = (void*)GetProcAddress(hmod, "D3DRMVectorRotate");
+		pD3DRMVectorScale = (void*)GetProcAddress(hmod, "D3DRMVectorScale");
+		pD3DRMVectorRandom = (void*)GetProcAddress(hmod, "D3DRMVectorRandom");
+		
+		pD3DRMQuaternionFromRotation = (void*)GetProcAddress(hmod, "D3DRMQuaternionFromRotation");
+		pD3DRMQuaternionMultiply = (void*)GetProcAddress(hmod, "D3DRMQuaternionMultiply");
+    }
+}
+
+static void VectorTest(void)
+{
+    D3DVALUE theta=PI*0.5;
+	D3DVECTOR u = { 2, 2, 1};
+    D3DVECTOR v = { 4, 4, 0};	
+	D3DVECTOR axis = { 0, 0, 1};
+	D3DVALUE mod;
+	D3DVECTOR r;
+	D3DVECTOR e;
+	
+	pD3DRMVectorAdd(&r,&u,&v);
+	e.x=6f;e.y=6f;e.z=1f;
+	expect_vec(e,r);
+	
+	pD3DRMVectorSubstract(&r,&u,&v);
+	e.x=2f;e.y=2f;e.z=-1f;
+	expect_vec(e,r);
+	
+	pD3DRMVectorCrossProduct(&r,&u,&v);
+	e.x=4f;e.y=-4f;e.z=0f;
+	expect_vec(e,r);
+	
+	mod=pD3DRMVectorDotProduct(&u,&v);
+	ok((mod == 16f), "Expected 16.0, Got %f",mod);
+	
+	mod=pD3DRMVectorModulus(&u);
+	ok((mod == 9f), "Expected 9.0, Got %f",mod);
+	
+	pD3DRMVectorNormalize(&u);
+	e.x=2f/3f;e.y=2f/3f;e.z=1f/3f;
+	expect_vec(e,u);	
+}
+
+static void QuaternionTest(void)
+{
+	D3DVECTOR axis = { 1, 1, 1};
+	D3DVALUE theta=2*PI/3;
+	D3DRMQUATERNION q,r;
+	
+	pD3DRMQuaternionFromRotation(&r,&axis,theta);
+	q.s=0.5f;q.v.x=0.5f;q.v.y=.05f;q.v.z=0.5f;
+	expect_quat(q,r);
+}
+
+START_TEST(d3drm)
+{
+   init_function_pointers();
+   
+   VectorTest();
+   QuaternionTest();
+}
+
