David Adam : d3drm: Implement D3DRMQuaternionMultiply.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 23 14:26:22 CDT 2007


Module: wine
Branch: master
Commit: f289cf312901130bf91a1d4a262a0fb510fdf6e6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f289cf312901130bf91a1d4a262a0fb510fdf6e6

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Thu Apr 19 21:14:47 2007 +0200

d3drm: Implement 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 19361a9..1cb0ff7 100644
--- a/dlls/d3drm/d3drm.spec
+++ b/dlls/d3drm/d3drm.spec
@@ -6,7 +6,7 @@
 @ stub D3DRMCreateColorRGBA
 @ stub D3DRMMatrixFromQuaternion
 @ stub D3DRMQuaternionFromRotation
-@ 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 b0de7d6..1dbff45 100644
--- a/dlls/d3drm/math.c
+++ b/dlls/d3drm/math.c
@@ -32,6 +32,18 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
 
+/* 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)
 {




More information about the wine-cvs mailing list