David Adam : d3dx8: Implement D3DXQuaternionIdentity.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 09:55:47 CDT 2007


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

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Thu Oct 18 21:01:24 2007 +0200

d3dx8: Implement D3DXQuaternionIdentity.

---

 dlls/d3dx8/tests/math.c |    8 ++++++++
 include/d3dx8math.inl   |   10 ++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 8c5baa3..42898c8 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -62,6 +62,14 @@ static void D3X8QuaternionTest(void)
     got = D3DXQuaternionDot(NULL,NULL);
     ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
 
+/*_______________D3DXQuaternionIdentity________________*/
+    expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
+    D3DXQuaternionIdentity(&gotquat);
+    expect_vec4(expectedquat,gotquat);
+    /* Test the NULL case */
+    funcpointer = D3DXQuaternionIdentity(NULL);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+
 /*_______________D3DXQuaternionLength__________________________*/
    expected = 11.0f;
    got = D3DXQuaternionLength(&q);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index a2fd8bf..0a4b24c 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -274,6 +274,16 @@ static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATE
     return (pq1->x) * (pq2->x) + (pq1->y) * (pq2->y) + (pq1->z) * (pq2->z) + (pq1->w) * (pq2->w);
 }
 
+static inline D3DXQUATERNION* D3DXQuaternionIdentity(D3DXQUATERNION *pout)
+{
+    if ( !pout) return NULL;
+    pout->x = 0.0f;
+    pout->y = 0.0f;
+    pout->z = 0.0f;
+    pout->w = 1.0f;
+    return pout;
+}
+
 static inline FLOAT D3DXQuaternionLength(CONST D3DXQUATERNION *pq)
 {
     if (!pq) return 0.0f;




More information about the wine-cvs mailing list