Patch [14/15]: Implements D3DRMQuaternionMultiply [try 2]

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


-------------- next part --------------
>From ef29fe1f3a06d2e2ed61fd5b70a3c0536c8a0ce8 Mon Sep 17 00:00:00 2001
From: Adam <David.Adam at math.cnrs.fr>
Date: Fri, 20 Apr 2007 03:30:19 +0200
Subject: [PATCH] Implements D3DRMQuaternionMultiply.

---
 dlls/d3drm/d3drm.spec |    2 +-
 dlls/d3drm/math.c     |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec
index 8ae3687..c73b416 100644
--- a/dlls/d3drm/d3drm.spec
+++ b/dlls/d3drm/d3drm.spec
@@ -6,7 +6,7 @@
 @ stub D3DRMCreateColorRGBA
 @ stdcall D3DRMMatrixFromQuaternion(ptr ptr)
 @ stdcall D3DRMQuaternionFromRotation(ptr ptr long)
-@ stub D3DRMQuaternionMultiply
+@ stdcall D3DRMQuaternionMultiply(ptr ptr ptr)
 @ stub D3DRMQuaternionSlerp
 @ stdcall D3DRMVectorAdd(ptr ptr ptr)
 @ stdcall D3DRMVectorCrossProduct(ptr ptr ptr)
diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c
index 73d4e26..a561e50 100644
--- a/dlls/d3drm/math.c
+++ b/dlls/d3drm/math.c
@@ -51,6 +51,18 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternion
     return q;
 }
 
+/* Product of 2 quaternions */
+LPD3DRMQUATERNION WINAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q, LPD3DRMQUATERNION a, LPD3DRMQUATERNION b)
+{
+    D3DVECTOR cross_product;
+    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;
+    return q;
+}
+
 /* Add Two Vectors */
 LPD3DVECTOR WINAPI D3DRMVectorAdd(LPD3DVECTOR d, LPD3DVECTOR s1, LPD3DVECTOR s2)
 {
-- 
1.4.2



More information about the wine-patches mailing list