David Adam : d3dx8: Implement D3DXQuaternionConjugate.
Alexandre Julliard
julliard at winehq.org
Mon Oct 22 09:55:47 CDT 2007
Module: wine
Branch: master
Commit: 77f5d4c88c02287f852c961962e3e9c12570c91d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=77f5d4c88c02287f852c961962e3e9c12570c91d
Author: David Adam <David.Adam at math.cnrs.fr>
Date: Thu Oct 18 20:28:36 2007 +0200
d3dx8: Implement D3DXQuaternionConjugate.
---
dlls/d3dx8/tests/math.c | 14 +++++++++++++-
include/d3dx8math.inl | 10 ++++++++++
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index b7302b1..8c5baa3 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -32,12 +32,24 @@
static void D3X8QuaternionTest(void)
{
- D3DXQUATERNION q, r;
+ D3DXQUATERNION expectedquat, gotquat, q, r;
+ LPD3DXQUATERNION funcpointer;
FLOAT expected, got;
q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
+/*_______________D3DXQuaternionConjugate________________*/
+ expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
+ D3DXQuaternionConjugate(&gotquat,&q);
+ expect_vec4(expectedquat,gotquat);
+ /* Test the NULL case */
+ funcpointer = D3DXQuaternionConjugate(&gotquat,NULL);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+ funcpointer = D3DXQuaternionConjugate(NULL,NULL);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+
+
/*_______________D3DXQuaternionDot______________________*/
expected = 55.0f;
got = D3DXQuaternionDot(&q,&r);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 87e1289..a2fd8bf 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -258,6 +258,16 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
/*__________________D3DXQUATERNION____________________*/
+static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
+{
+ if ( !pout || !pq) return NULL;
+ pout->x = -pq->x;
+ pout->y = -pq->y;
+ pout->z = -pq->z;
+ pout->w = pq->w;
+ return pout;
+}
+
static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2)
{
if ( !pq1 || !pq2 ) return 0.0f;
More information about the wine-cvs
mailing list