Implememts D3DRMQuaternionMultiply

David.Adam at math.cnrs.fr David.Adam at math.cnrs.fr
Sun Apr 15 18:39:24 CDT 2007


-------------- next part --------------
>From 34ba693025149d5a86ea93f652c4dad70a064a65 Mon Sep 17 00:00:00 2001
From: Adam <David.Adam at math.cnrs.fr>
Date: Sun, 15 Apr 2007 14:34:11 +0200
Subject: [PATCH] [13] 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 fd42527..a23caff 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 912870c..b89796f 100644
--- a/dlls/d3drm/math.c
+++ b/dlls/d3drm/math.c
@@ -51,6 +51,18 @@ LPD3DRMQUATERNION D3DRMAPI D3DRMQuaterni
     return q;
 }
 
+/* Product of 2 quaternions */
+LPD3DRMQUATERNION D3DRMAPI 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 D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d, LPD3DVECTOR s1, LPD3DVECTOR s2)
 {
-- 
1.4.2



More information about the wine-patches mailing list