From d6377d2fd8a97c32c830e89ba25e7dd826ca6e90 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 18 Oct 2007 14:03:03 +0200 Subject: [PATCH] d3dx8: Implement D3DX*Length with a test. --- dlls/d3dx8/tests/math.c | 54 +++++++++++++++++++++++++++++++++++++++++ include/d3dx8math.inl | 30 +++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 9ae9018111b..d0d0b0390aa 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -26,6 +26,23 @@ #define expect_vec(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) ); +} + +/*__________________D3DXVECTOR4_______________________*/ + +static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv) +{ + if (!pv) return 0.0f; + return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w) ); +} + + +/*__________________D3DXQUATERNION____________________*/ + +static inline FLOAT D3DXQuaternionLength( CONST D3DXQUATERNION *pq) +{ + if (!pq) return 0.0f; + return sqrt( (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w) ); +} + + + + #endif