[PATCH] Header files for d3dx9_xx dlls.

David Adam David.Adam at math.cnrs.fr
Mon Nov 26 17:36:20 CST 2007


---
 include/Makefile.in   |    2 +
 include/d3dx9.h       |   27 +
 include/d3dx9math.h   |  350 ++++++++++++++
 include/d3dx9math.inl | 1268 ++++++++++++++++++++++++++++++++++++++++++++++=
+++
 4 files changed, 1647 insertions(+), 0 deletions(-)
 create mode 100644 include/d3dx9.h
 create mode 100644 include/d3dx9math.h
 create mode 100644 include/d3dx9math.inl

diff --git a/include/Makefile.in b/include/Makefile.in
index e1d53da..bf970cc 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -112,6 +112,8 @@ SRCDIR_INCLUDES =3D \
 =09d3dx8core.h \
 =09d3dx8math.h \
 =09d3dx8math.inl \
+=09d3dx9.h \
+=09d3dx9math.h \
 =09dbghelp.h \
 =09dbinit.idl \
 =09dbprop.idl \
diff --git a/include/d3dx9.h b/include/d3dx9.h
new file mode 100644
index 0000000..f1f2228
--- /dev/null
+++ b/include/d3dx9.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2007 David Adam
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
+ */
+
+#ifndef __D3DX9_H__
+#define __D3DX9_H__
+
+#include <limits.h>
+
+#include "d3d9.h"
+#include "d3dx9math.h"
+
+#endif
diff --git a/include/d3dx9math.h b/include/d3dx9math.h
new file mode 100644
index 0000000..bfbeba0
--- /dev/null
+++ b/include/d3dx9math.h
@@ -0,0 +1,350 @@
+/*
+ * Copyright (C) 2007 David Adam
+ * Copyright (C) 2007 Tony Wasserka
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
+ */
+
+#include <d3dx9.h>
+
+#ifndef __D3DX9MATH_H__
+#define __D3DX9MATH_H__
+
+#include <math.h>
+
+#define D3DX_PI    ((FLOAT)3.141592654)
+#define D3DX_1BYPI ((FLOAT)0.318309886)
+
+#define D3DXToRadian(degree) ((degree) * (D3DX_PI / 180.0f))
+#define D3DXToDegree(radian) ((radian) * (180.0f / D3DX_PI))
+
+typedef struct D3DXVECTOR2
+{
+#ifdef __cplusplus
+    D3DXVECTOR2();
+    D3DXVECTOR2(CONST FLOAT *pf);
+    D3DXVECTOR2(FLOAT fx, FLOAT fy);
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXVECTOR2& operator +=3D (CONST D3DXVECTOR2&);
+    D3DXVECTOR2& operator -=3D (CONST D3DXVECTOR2&);
+    D3DXVECTOR2& operator *=3D (FLOAT);
+    D3DXVECTOR2& operator /=3D (FLOAT);
+
+    D3DXVECTOR2 operator + () const;
+    D3DXVECTOR2 operator - () const;
+
+    D3DXVECTOR2 operator + (CONST D3DXVECTOR2&) const;
+    D3DXVECTOR2 operator - (CONST D3DXVECTOR2&) const;
+    D3DXVECTOR2 operator * (FLOAT) const;
+    D3DXVECTOR2 operator / (FLOAT) const;
+
+    friend D3DXVECTOR2 operator * (FLOAT, CONST D3DXVECTOR2&);
+
+    BOOL operator =3D=3D (CONST D3DXVECTOR2&) const;
+    BOOL operator !=3D (CONST D3DXVECTOR2&) const;
+#endif /* __cplusplus */
+    FLOAT x, y;
+} D3DXVECTOR2, *LPD3DXVECTOR2;
+
+#ifdef __cplusplus
+typedef struct D3DXVECTOR3 : public D3DVECTOR
+{
+    D3DXVECTOR3();
+    D3DXVECTOR3(CONST FLOAT *pf);
+    D3DXVECTOR3(CONST D3DVECTOR& v);
+    D3DXVECTOR3(FLOAT fx, FLOAT fy, FLOAT fz);
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXVECTOR3& operator +=3D (CONST D3DXVECTOR3&);
+    D3DXVECTOR3& operator -=3D (CONST D3DXVECTOR3&);
+    D3DXVECTOR3& operator *=3D (FLOAT);
+    D3DXVECTOR3& operator /=3D (FLOAT);
+
+    D3DXVECTOR3 operator + () const;
+    D3DXVECTOR3 operator - () const;
+
+    D3DXVECTOR3 operator + (CONST D3DXVECTOR3&) const;
+    D3DXVECTOR3 operator - (CONST D3DXVECTOR3&) const;
+    D3DXVECTOR3 operator * (FLOAT) const;
+    D3DXVECTOR3 operator / (FLOAT) const;
+
+    friend D3DXVECTOR3 operator * (FLOAT, CONST struct D3DXVECTOR3&);
+
+    BOOL operator =3D=3D (CONST D3DXVECTOR3&) const;
+    BOOL operator !=3D (CONST D3DXVECTOR3&) const;
+} D3DXVECTOR3, *LPD3DXVECTOR3;
+#else /* !__cplusplus */
+typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
+#endif /* !__cplusplus */
+
+typedef struct D3DXVECTOR4
+{
+#ifdef __cplusplus
+    D3DXVECTOR4();
+    D3DXVECTOR4(CONST FLOAT *pf);
+    D3DXVECTOR4(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw);
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXVECTOR4& operator +=3D (CONST D3DXVECTOR4&);
+    D3DXVECTOR4& operator -=3D (CONST D3DXVECTOR4&);
+    D3DXVECTOR4& operator *=3D (FLOAT);
+    D3DXVECTOR4& operator /=3D (FLOAT);
+
+    D3DXVECTOR4 operator + () const;
+    D3DXVECTOR4 operator - () const;
+
+    D3DXVECTOR4 operator + (CONST D3DXVECTOR4&) const;
+    D3DXVECTOR4 operator - (CONST D3DXVECTOR4&) const;
+    D3DXVECTOR4 operator * (FLOAT) const;
+    D3DXVECTOR4 operator / (FLOAT) const;
+
+    friend D3DXVECTOR4 operator * (FLOAT, CONST D3DXVECTOR4&);
+
+    BOOL operator =3D=3D (CONST D3DXVECTOR4&) const;
+    BOOL operator !=3D (CONST D3DXVECTOR4&) const;
+#endif /* __cplusplus */
+    FLOAT x, y, z, w;
+} D3DXVECTOR4, *LPD3DXVECTOR4;
+
+#ifdef __cplusplus
+typedef struct D3DXMATRIX : public D3DMATRIX
+{
+    D3DXMATRIX();
+    D3DXMATRIX(CONST FLOAT *pf);
+    D3DXMATRIX(CONST D3DMATRIX& mat);
+    D3DXMATRIX(FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14,
+               FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24,
+               FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34,
+               FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44);
+
+    FLOAT& operator () (UINT row, UINT col);
+    FLOAT operator () (UINT row, UINT col) const;
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXMATRIX& operator *=3D (CONST D3DXMATRIX&);
+    D3DXMATRIX& operator +=3D (CONST D3DXMATRIX&);
+    D3DXMATRIX& operator -=3D (CONST D3DXMATRIX&);
+    D3DXMATRIX& operator *=3D (FLOAT);
+    D3DXMATRIX& operator /=3D (FLOAT);
+
+    D3DXMATRIX operator + () const;
+    D3DXMATRIX operator - () const;
+
+    D3DXMATRIX operator * (CONST D3DXMATRIX&) const;
+    D3DXMATRIX operator + (CONST D3DXMATRIX&) const;
+    D3DXMATRIX operator - (CONST D3DXMATRIX&) const;
+    D3DXMATRIX operator * (FLOAT) const;
+    D3DXMATRIX operator / (FLOAT) const;
+
+    friend D3DXMATRIX operator * (FLOAT, CONST D3DXMATRIX&);
+
+    BOOL operator =3D=3D (CONST D3DXMATRIX&) const;
+    BOOL operator !=3D (CONST D3DXMATRIX&) const;
+} D3DXMATRIX, *LPD3DXMATRIX;
+#else /* !__cplusplus */
+typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
+#endif /* !__cplusplus */
+
+typedef struct D3DXQUATERNION
+{
+#ifdef __cplusplus
+    D3DXQUATERNION();
+    D3DXQUATERNION(CONST FLOAT *pf);
+    D3DXQUATERNION(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw);
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXQUATERNION& operator +=3D (CONST D3DXQUATERNION&);
+    D3DXQUATERNION& operator -=3D (CONST D3DXQUATERNION&);
+    D3DXQUATERNION& operator *=3D (CONST D3DXQUATERNION&);
+    D3DXQUATERNION& operator *=3D (FLOAT);
+    D3DXQUATERNION& operator /=3D (FLOAT);
+
+    D3DXQUATERNION  operator + () const;
+    D3DXQUATERNION  operator - () const;
+
+    D3DXQUATERNION operator + (CONST D3DXQUATERNION&) const;
+    D3DXQUATERNION operator - (CONST D3DXQUATERNION&) const;
+    D3DXQUATERNION operator * (CONST D3DXQUATERNION&) const;
+    D3DXQUATERNION operator * (FLOAT) const;
+    D3DXQUATERNION operator / (FLOAT) const;
+
+    friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION&);
+
+    BOOL operator =3D=3D (CONST D3DXQUATERNION&) const;
+    BOOL operator !=3D (CONST D3DXQUATERNION&) const;
+#endif /* __cplusplus */
+    FLOAT x, y, z, w;
+} D3DXQUATERNION, *LPD3DXQUATERNION;
+
+typedef struct D3DXPLANE
+{
+#ifdef __cplusplus
+    D3DXPLANE();
+    D3DXPLANE(CONST FLOAT *pf);
+    D3DXPLANE(FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd);
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    D3DXPLANE operator + () const;
+    D3DXPLANE operator - () const;
+
+    BOOL operator =3D=3D (CONST D3DXPLANE&) const;
+    BOOL operator !=3D (CONST D3DXPLANE&) const;
+#endif /* __cplusplus */
+    FLOAT a, b, c, d;
+} D3DXPLANE, *LPD3DXPLANE;
+
+typedef struct D3DXCOLOR
+{
+#ifdef __cplusplus
+    D3DXCOLOR();
+    D3DXCOLOR(DWORD col);
+    D3DXCOLOR(CONST FLOAT *pf);
+    D3DXCOLOR(CONST D3DCOLORVALUE& col);
+    D3DXCOLOR(FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa);
+
+    operator DWORD () const;
+
+    operator FLOAT* ();
+    operator CONST FLOAT* () const;
+
+    operator D3DCOLORVALUE* ();
+    operator CONST D3DCOLORVALUE* () const;
+
+    operator D3DCOLORVALUE& ();
+    operator CONST D3DCOLORVALUE& () const;
+
+    D3DXCOLOR& operator +=3D (CONST D3DXCOLOR&);
+    D3DXCOLOR& operator -=3D (CONST D3DXCOLOR&);
+    D3DXCOLOR& operator *=3D (FLOAT);
+    D3DXCOLOR& operator /=3D (FLOAT);
+
+    D3DXCOLOR operator + () const;
+    D3DXCOLOR operator - () const;
+
+    D3DXCOLOR operator + (CONST D3DXCOLOR&) const;
+    D3DXCOLOR operator - (CONST D3DXCOLOR&) const;
+    D3DXCOLOR operator * (FLOAT) const;
+    D3DXCOLOR operator / (FLOAT) const;
+
+    friend D3DXCOLOR operator * (FLOAT, CONST D3DXCOLOR&);
+
+    BOOL operator =3D=3D (CONST D3DXCOLOR&) const;
+    BOOL operator !=3D (CONST D3DXCOLOR&) const;
+#endif /* __cplusplus */
+    FLOAT r, g, b, a;
+} D3DXCOLOR, *LPD3DXCOLOR;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR =
*pc, FLOAT s);
+D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLO=
R *pc, FLOAT s);
+
+D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float s=
caling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *=
translation);
+FLOAT WINAPI D3DXMatrixDeterminant(CONST D3DXMATRIX *pm);
+D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant,=
 CONST D3DXMATRIX *pm);
+D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *=
peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup);
+D3DXMATRIX* WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *=
peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup);
+D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, CONST D3DXMATRIX *p=
m1, CONST D3DXMATRIX *pm2);
+D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose(D3DXMATRIX *pout, CONST D3DX=
MATRIX *pm1, CONST D3DXMATRIX *pm2);
+D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FL=
OAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FL=
OAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FL=
OAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FL=
OAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FL=
OAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy,=
 FLOAT aspect, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy,=
 FLOAT aspect, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT=
 h, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT=
 l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT=
 l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT=
 h, FLOAT zn, FLOAT zf);
+D3DXMATRIX* WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, CONST D3DXPLANE *ppl=
ane);
+D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTO=
R3 *pv, FLOAT angle);
+D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3D=
XQUATERNION *pq);
+D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle);
+D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle);
+D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT y=
aw, FLOAT pitch, FLOAT roll);
+D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle);
+D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, =
FLOAT sz);
+D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, CONST D3DXVECTOR4 *pl=
ight, CONST D3DXPLANE *pPlane);
+D3DXMATRIX* D3DXMatrixTransformation(D3DXMATRIX *pout, CONST D3DXVECTOR3 *p=
scalingcenter, CONST D3DXQUATERNION *pscalingrotation, CONST D3DXVECTOR3 *ps=
caling, CONST D3DXVECTOR3 *protationcenter, CONST D3DXQUATERNION *protation,=
 CONST D3DXVECTOR3 *ptranslation);
+D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y=
, FLOAT z);
+D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *=
pm);
+
+D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, CONST D3DXVECTO=
R3 *pvpoint, CONST D3DXVECTOR3 *pvnormal);
+D3DXPLANE* WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, CONST D3DXVECTOR3 *p=
v1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3);
+D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, CONST D3DXPLA=
NE *pp, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2);
+D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, CONST D3DXPLANE *pp);
+D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *ppla=
ne, CONST D3DXMATRIX *pm);
+
+D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONS=
T D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3,=
 FLOAT f, FLOAT g);
+D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, CONST D3DXQU=
ATERNION *pq);
+D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3=
DXQUATERNION *pq);
+D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, CONST D3DXQUA=
TERNION *pq);
+D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D=
3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2);
+D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST =
D3DXQUATERNION *pq);
+D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CON=
ST D3DXVECTOR3 *pv, FLOAT angle);
+D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, C=
ONST D3DXMATRIX *pm);
+D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *p=
out, FLOAT yaw, FLOAT pitch, FLOAT roll);
+D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DX=
QUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t);
+D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DX=
QUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST=
 D3DXQUATERNION *pq4, FLOAT t);
+void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3=
 *paxis, FLOAT *pangle);
+
+D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR=
2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g);
+D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2=
 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv=
3, FLOAT s);
+D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *p=
v1, CONST D3DXVECTOR2 *pt1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pt2, =
FLOAT s);
+D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 =
*pv);
+D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 =
*pv, CONST D3DXMATRIX *pm);
+D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVEC=
TOR2 *pv, CONST D3DXMATRIX *pm);
+D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, CONST D3DXVE=
CTOR2 *pv, CONST D3DXMATRIX *pm);
+
+D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR=
3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g);
+D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR=
3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *p=
v3, FLOAT s);
+D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *p=
v1, CONST D3DXVECTOR3 *pt1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pt2, =
FLOAT s);
+D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 =
*pv);
+D3DXVECTOR3* WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *p=
v, CONST D3DVIEWPORT9 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXM=
ATRIX *pview, CONST D3DXMATRIX *pworld);
+D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 =
*pv, CONST D3DXMATRIX *pm);
+D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVEC=
TOR3 *pv, CONST D3DXMATRIX *pm);
+D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVE=
CTOR3 *pv, CONST D3DXMATRIX *pm);
+D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 =
*pv, CONST D3DVIEWPORT9 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3D=
XMATRIX *pview, CONST D3DXMATRIX *pworld);
+
+D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR=
4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g);
+D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, CONST D3DXVECTOR4=
 *pv0, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv=
3, FLOAT s);
+D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1=
, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3);
+D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *p=
v1, CONST D3DXVECTOR4 *pt1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pt2, =
FLOAT s);
+D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 =
*pv);
+D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 =
*pv, CONST D3DXMATRIX *pm);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <d3dx9math.inl>
+
+#endif /* __D3DX9MATH_H__ */
diff --git a/include/d3dx9math.inl b/include/d3dx9math.inl
new file mode 100644
index 0000000..3cd078a
--- /dev/null
+++ b/include/d3dx9math.inl
@@ -0,0 +1,1268 @@
+/*
+ * Copyright (C) 2007 David Adam
+ * Copyright (C) 2007 Tony Wasserka
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
+ */
+
+#ifndef __D3DX9MATH_INL__
+#define __D3DX9MATH_INL__
+
+/* constructors & operators */
+#ifdef __cplusplus
+
+inline D3DXVECTOR2::D3DXVECTOR2()
+{
+}
+
+inline D3DXVECTOR2::D3DXVECTOR2(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    x =3D pf[0];
+    y =3D pf[1];
+}
+
+inline D3DXVECTOR2::D3DXVECTOR2(FLOAT fx, FLOAT fy)
+{
+    x =3D fx;
+    y =3D fy;
+}
+
+inline D3DXVECTOR2::operator FLOAT* ()
+{
+    return (FLOAT*)&x;
+}
+
+inline D3DXVECTOR2::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&x;
+}
+
+inline D3DXVECTOR2& D3DXVECTOR2::operator +=3D (CONST D3DXVECTOR2& v)
+{
+    x +=3D v.x;
+    y +=3D v.y;
+    return *this;
+}
+
+inline D3DXVECTOR2& D3DXVECTOR2::operator -=3D (CONST D3DXVECTOR2& v)
+{
+    x -=3D v.x;
+    y -=3D v.y;
+    return *this;
+}
+
+inline D3DXVECTOR2& D3DXVECTOR2::operator *=3D (FLOAT f)
+{
+    x *=3D f;
+    y *=3D f;
+    return *this;
+}
+
+inline D3DXVECTOR2& D3DXVECTOR2::operator /=3D (FLOAT f)
+{
+    x /=3D f;
+    y /=3D f;
+    return *this;
+}
+
+inline D3DXVECTOR2 D3DXVECTOR2::operator + () const
+{
+    return *this;
+}
+
+inline D3DXVECTOR2 D3DXVECTOR2::operator - () const
+{
+    return D3DXVECTOR2(-x, -y);
+}
+
+inline D3DXVECTOR2 D3DXVECTOR2::operator + (CONST D3DXVECTOR2& v) const
+{
+    return D3DXVECTOR2(x + v.x, y + v.y);
+}
+
+inline D3DXVECTOR2 D3DXVECTOR2::operator - (CONST D3DXVECTOR2& v) const
+{
+    return D3DXVECTOR2(x - v.x, y - v.y);
+}
+
+inline D3DXVECTOR2 D3DXVECTOR2::operator * (FLOAT f) const
+{
+    return D3DXVECTOR2(x * f, y * f);
+}
+
+inline D3DXVECTOR2 D3DXVECTOR2::operator / (FLOAT f) const
+{
+    return D3DXVECTOR2(x / f, y / f);
+}
+
+inline D3DXVECTOR2 operator * (FLOAT f, CONST D3DXVECTOR2& v)
+{
+    return D3DXVECTOR2(f * v.x, f * v.y);
+}
+
+inline BOOL D3DXVECTOR2::operator =3D=3D (CONST D3DXVECTOR2& v) const
+{
+    return x =3D=3D v.x && y =3D=3D v.y;
+}
+
+inline BOOL D3DXVECTOR2::operator !=3D (CONST D3DXVECTOR2& v) const
+{
+    return x !=3D v.x || y !=3D v.y;
+}
+
+inline D3DXVECTOR3::D3DXVECTOR3()
+{
+}
+
+inline D3DXVECTOR3::D3DXVECTOR3(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    x =3D pf[0];
+    y =3D pf[1];
+    z =3D pf[2];
+}
+
+inline D3DXVECTOR3::D3DXVECTOR3(CONST D3DVECTOR& v)
+{
+    x =3D v.x;
+    y =3D v.y;
+    z =3D v.z;
+}
+
+inline D3DXVECTOR3::D3DXVECTOR3(FLOAT fx, FLOAT fy, FLOAT fz)
+{
+    x =3D fx;
+    y =3D fy;
+    z =3D fz;
+}
+
+inline D3DXVECTOR3::operator FLOAT* ()
+{
+    return (FLOAT*)&x;
+}
+
+inline D3DXVECTOR3::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&x;
+}
+
+inline D3DXVECTOR3& D3DXVECTOR3::operator +=3D (CONST D3DXVECTOR3& v)
+{
+    x +=3D v.x;
+    y +=3D v.y;
+    z +=3D v.z;
+    return *this;
+}
+
+inline D3DXVECTOR3& D3DXVECTOR3::operator -=3D (CONST D3DXVECTOR3& v)
+{
+    x -=3D v.x;
+    y -=3D v.y;
+    z -=3D v.z;
+    return *this;
+}
+
+inline D3DXVECTOR3& D3DXVECTOR3::operator *=3D (FLOAT f)
+{
+    x *=3D f;
+    y *=3D f;
+    z *=3D f;
+    return *this;
+}
+
+inline D3DXVECTOR3& D3DXVECTOR3::operator /=3D (FLOAT f)
+{
+    x /=3D f;
+    y /=3D f;
+    z /=3D f;
+    return *this;
+}
+
+inline D3DXVECTOR3 D3DXVECTOR3::operator + () const
+{
+    return *this;
+}
+
+inline D3DXVECTOR3 D3DXVECTOR3::operator - () const
+{
+    return D3DXVECTOR3(-x, -y, -z);
+}
+
+inline D3DXVECTOR3 D3DXVECTOR3::operator + (CONST D3DXVECTOR3& v) const
+{
+    return D3DXVECTOR3(x + v.x, y + v.y, z + v.z);
+}
+
+inline D3DXVECTOR3 D3DXVECTOR3::operator - (CONST D3DXVECTOR3& v) const
+{
+    return D3DXVECTOR3(x - v.x, y - v.y, z - v.z);
+}
+
+inline D3DXVECTOR3 D3DXVECTOR3::operator * (FLOAT f) const
+{
+    return D3DXVECTOR3(x * f, y * f, z * f);
+}
+
+inline D3DXVECTOR3 D3DXVECTOR3::operator / (FLOAT f) const
+{
+    return D3DXVECTOR3(x / f, y / f, z / f);
+}
+
+inline D3DXVECTOR3 operator * (FLOAT f, CONST D3DXVECTOR3& v)
+{
+    return D3DXVECTOR3(f * v.x, f * v.y, f * v.z);
+}
+
+inline BOOL D3DXVECTOR3::operator =3D=3D (CONST D3DXVECTOR3& v) const
+{
+    return x =3D=3D v.x && y =3D=3D v.y && z =3D=3D v.z;
+}
+
+inline BOOL D3DXVECTOR3::operator !=3D (CONST D3DXVECTOR3& v) const
+{
+    return x !=3D v.x || y !=3D v.y || z !=3D v.z;
+}
+
+inline D3DXVECTOR4::D3DXVECTOR4()
+{
+}
+
+inline D3DXVECTOR4::D3DXVECTOR4(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    x =3D pf[0];
+    y =3D pf[1];
+    z =3D pf[2];
+    w =3D pf[3];
+}
+
+inline D3DXVECTOR4::D3DXVECTOR4(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw)
+{
+    x =3D fx;
+    y =3D fy;
+    z =3D fz;
+    w =3D fw;
+}
+
+inline D3DXVECTOR4::operator FLOAT* ()
+{
+    return (FLOAT*)&x;
+}
+
+inline D3DXVECTOR4::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&x;
+}
+
+inline D3DXVECTOR4& D3DXVECTOR4::operator +=3D (CONST D3DXVECTOR4& v)
+{
+    x +=3D v.x;
+    y +=3D v.y;
+    z +=3D v.z;
+    w +=3D v.w;
+    return *this;
+}
+
+inline D3DXVECTOR4& D3DXVECTOR4::operator -=3D (CONST D3DXVECTOR4& v)
+{
+    x -=3D v.x;
+    y -=3D v.y;
+    z -=3D v.z;
+    w -=3D v.w;
+    return *this;
+}
+
+inline D3DXVECTOR4& D3DXVECTOR4::operator *=3D (FLOAT f)
+{
+    x *=3D f;
+    y *=3D f;
+    z *=3D f;
+    w *=3D f;
+    return *this;
+}
+
+inline D3DXVECTOR4& D3DXVECTOR4::operator /=3D (FLOAT f)
+{
+    x /=3D f;
+    y /=3D f;
+    z /=3D f;
+    w /=3D f;
+    return *this;
+}
+
+inline D3DXVECTOR4 D3DXVECTOR4::operator + () const
+{
+    return *this;
+}
+
+inline D3DXVECTOR4 D3DXVECTOR4::operator - () const
+{
+    return D3DXVECTOR4(-x, -y, -z, -w);
+}
+
+inline D3DXVECTOR4 D3DXVECTOR4::operator + (CONST D3DXVECTOR4& v) const
+{
+    return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w);
+}
+
+inline D3DXVECTOR4 D3DXVECTOR4::operator - (CONST D3DXVECTOR4& v) const
+{
+    return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w);
+}
+
+inline D3DXVECTOR4 D3DXVECTOR4::operator * (FLOAT f) const
+{
+    return D3DXVECTOR4(x * f, y * f, z * f, w * f);
+}
+
+inline D3DXVECTOR4 D3DXVECTOR4::operator / (FLOAT f) const
+{
+    return D3DXVECTOR4(x / f, y / f, z / f, w / f);
+}
+
+inline D3DXVECTOR4 operator * (FLOAT f, CONST D3DXVECTOR4& v)
+{
+    return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w);
+}
+
+inline BOOL D3DXVECTOR4::operator =3D=3D (CONST D3DXVECTOR4& v) const
+{
+    return x =3D=3D v.x && y =3D=3D v.y && z =3D=3D v.z && w =3D=3D v.w;
+}
+
+inline BOOL D3DXVECTOR4::operator !=3D (CONST D3DXVECTOR4& v) const
+{
+    return x !=3D v.x || y !=3D v.y || z !=3D v.z || w !=3D v.w;
+}
+
+inline D3DXMATRIX::D3DXMATRIX()
+{
+}
+
+inline D3DXMATRIX::D3DXMATRIX(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    memcpy(&_11, pf, sizeof(D3DXMATRIX));
+}
+
+inline D3DXMATRIX::D3DXMATRIX(CONST D3DMATRIX& mat)
+{
+    memcpy(&_11, &mat, sizeof(D3DXMATRIX));
+}
+
+inline D3DXMATRIX::D3DXMATRIX(FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14,
+                              FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24,
+                              FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34,
+                              FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44)
+{
+    _11 =3D f11; _12 =3D f12; _13 =3D f13; _14 =3D f14;
+    _21 =3D f21; _22 =3D f22; _23 =3D f23; _24 =3D f24;
+    _31 =3D f31; _32 =3D f32; _33 =3D f33; _34 =3D f34;
+    _41 =3D f41; _42 =3D f42; _43 =3D f43; _44 =3D f44;
+}
+
+inline FLOAT& D3DXMATRIX::operator () (UINT row, UINT col)
+{
+    return m[row][col];
+}
+
+inline FLOAT D3DXMATRIX::operator () (UINT row, UINT col) const
+{
+    return m[row][col];
+}
+
+inline D3DXMATRIX::operator FLOAT* ()
+{
+    return (FLOAT*)&_11;
+}
+
+inline D3DXMATRIX::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&_11;
+}
+
+inline D3DXMATRIX& D3DXMATRIX::operator *=3D (CONST D3DXMATRIX& mat)
+{
+    D3DXMatrixMultiply(this, this, &mat);
+    return *this;
+}
+
+inline D3DXMATRIX& D3DXMATRIX::operator +=3D (CONST D3DXMATRIX& mat)
+{
+    _11 +=3D mat._11; _12 +=3D mat._12; _13 +=3D mat._13; _14 +=3D mat._14;
+    _21 +=3D mat._21; _22 +=3D mat._22; _23 +=3D mat._23; _24 +=3D mat._24;
+    _31 +=3D mat._31; _32 +=3D mat._32; _33 +=3D mat._33; _34 +=3D mat._34;
+    _41 +=3D mat._41; _42 +=3D mat._42; _43 +=3D mat._43; _44 +=3D mat._44;
+    return *this;
+}
+
+inline D3DXMATRIX& D3DXMATRIX::operator -=3D (CONST D3DXMATRIX& mat)
+{
+    _11 -=3D mat._11; _12 -=3D mat._12; _13 -=3D mat._13; _14 -=3D mat._14;
+    _21 -=3D mat._21; _22 -=3D mat._22; _23 -=3D mat._23; _24 -=3D mat._24;
+    _31 -=3D mat._31; _32 -=3D mat._32; _33 -=3D mat._33; _34 -=3D mat._34;
+    _41 -=3D mat._41; _42 -=3D mat._42; _43 -=3D mat._43; _44 -=3D mat._44;
+    return *this;
+}
+
+inline D3DXMATRIX& D3DXMATRIX::operator *=3D (FLOAT f)
+{
+    _11 *=3D f; _12 *=3D f; _13 *=3D f; _14 *=3D f;
+    _21 *=3D f; _22 *=3D f; _23 *=3D f; _24 *=3D f;
+    _31 *=3D f; _32 *=3D f; _33 *=3D f; _34 *=3D f;
+    _41 *=3D f; _42 *=3D f; _43 *=3D f; _44 *=3D f;
+    return *this;
+}
+
+inline D3DXMATRIX& D3DXMATRIX::operator /=3D (FLOAT f)
+{
+    FLOAT inv =3D 1.0f / f;
+    _11 *=3D inv; _12 *=3D inv; _13 *=3D inv; _14 *=3D inv;
+    _21 *=3D inv; _22 *=3D inv; _23 *=3D inv; _24 *=3D inv;
+    _31 *=3D inv; _32 *=3D inv; _33 *=3D inv; _34 *=3D inv;
+    _41 *=3D inv; _42 *=3D inv; _43 *=3D inv; _44 *=3D inv;
+    return *this;
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator + () const
+{
+    return *this;
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator - () const
+{
+    return D3DXMATRIX(-_11, -_12, -_13, -_14,
+                      -_21, -_22, -_23, -_24,
+                      -_31, -_32, -_33, -_34,
+                      -_41, -_42, -_43, -_44);
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator * (CONST D3DXMATRIX& mat) const
+{
+    D3DXMATRIX buf;
+    D3DXMatrixMultiply(&buf, this, &mat);
+    return buf;
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator + (CONST D3DXMATRIX& mat) const
+{
+    return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + ma=
t._14,
+                      _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + ma=
t._24,
+                      _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + ma=
t._34,
+                      _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + ma=
t._44);
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator - (CONST D3DXMATRIX& mat) const
+{
+    return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - ma=
t._14,
+                      _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - ma=
t._24,
+                      _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - ma=
t._34,
+                      _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - ma=
t._44);
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator * (FLOAT f) const
+{
+    return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f,
+                      _21 * f, _22 * f, _23 * f, _24 * f,
+                      _31 * f, _32 * f, _33 * f, _34 * f,
+                      _41 * f, _42 * f, _43 * f, _44 * f);
+}
+
+inline D3DXMATRIX D3DXMATRIX::operator / (FLOAT f) const
+{
+    FLOAT inv =3D 1.0f / f;
+    return D3DXMATRIX(_11 * inv, _12 * inv, _13 * inv, _14 * inv,
+                      _21 * inv, _22 * inv, _23 * inv, _24 * inv,
+                      _31 * inv, _32 * inv, _33 * inv, _34 * inv,
+                      _41 * inv, _42 * inv, _43 * inv, _44 * inv);
+}
+
+inline D3DXMATRIX operator * (FLOAT f, CONST D3DXMATRIX& mat)
+{
+    return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14,
+                      f * mat._21, f * mat._22, f * mat._23, f * mat._24,
+                      f * mat._31, f * mat._32, f * mat._33, f * mat._34,
+                      f * mat._41, f * mat._42, f * mat._43, f * mat._44);
+}
+
+inline BOOL D3DXMATRIX::operator =3D=3D (CONST D3DXMATRIX& mat) const
+{
+    return (memcmp(this, &mat, sizeof(D3DXMATRIX)) =3D=3D 0);
+}
+
+inline BOOL D3DXMATRIX::operator !=3D (CONST D3DXMATRIX& mat) const
+{
+    return (memcmp(this, &mat, sizeof(D3DXMATRIX)) !=3D 0);
+}
+
+inline D3DXQUATERNION::D3DXQUATERNION()
+{
+}
+
+inline D3DXQUATERNION::D3DXQUATERNION(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    x =3D pf[0];
+    y =3D pf[1];
+    z =3D pf[2];
+    w =3D pf[3];
+}
+
+inline D3DXQUATERNION::D3DXQUATERNION(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT f=
w)
+{
+    x =3D fx;
+    y =3D fy;
+    z =3D fz;
+    w =3D fw;
+}
+
+inline D3DXQUATERNION::operator FLOAT* ()
+{
+    return (FLOAT*)&x;
+}
+
+inline D3DXQUATERNION::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&x;
+}
+
+inline D3DXQUATERNION& D3DXQUATERNION::operator +=3D (CONST D3DXQUATERNION&=
 quat)
+{
+    x +=3D quat.x;
+    y +=3D quat.y;
+    z +=3D quat.z;
+    w +=3D quat.w;
+    return *this;
+}
+
+inline D3DXQUATERNION& D3DXQUATERNION::operator -=3D (CONST D3DXQUATERNION&=
 quat)
+{
+    x -=3D quat.x;
+    y -=3D quat.y;
+    z -=3D quat.z;
+    w -=3D quat.w;
+    return *this;
+}
+
+/* TODO: uncomment this when D3DXQuaternionMultiply has been implemented
+inline D3DXQUATERNION& D3DXQUATERNION::operator *=3D (CONST D3DXQUATERNION&=
 quat)
+{
+    D3DXQuaternionMultiply(this, this, &quat);
+    return *this;
+}
+*/
+
+inline D3DXQUATERNION& D3DXQUATERNION::operator *=3D (FLOAT f)
+{
+    x *=3D f;
+    y *=3D f;
+    z *=3D f;
+    w *=3D f;
+    return *this;
+}
+
+inline D3DXQUATERNION& D3DXQUATERNION::operator /=3D (FLOAT f)
+{
+    FLOAT inv =3D 1.0f / f;
+    x *=3D inv;
+    y *=3D inv;
+    z *=3D inv;
+    w *=3D inv;
+    return *this;
+}
+
+inline D3DXQUATERNION D3DXQUATERNION::operator + () const
+{
+    return *this;
+}
+
+inline D3DXQUATERNION D3DXQUATERNION::operator - () const
+{
+    return D3DXQUATERNION(-x, -y, -z, -w);
+}
+
+inline D3DXQUATERNION D3DXQUATERNION::operator + (CONST D3DXQUATERNION& qua=
t) const
+{
+    return D3DXQUATERNION(x + quat.x, y + quat.y, z + quat.z, w + quat.w);
+}
+
+inline D3DXQUATERNION D3DXQUATERNION::operator - (CONST D3DXQUATERNION& qua=
t) const
+{
+    return D3DXQUATERNION(x - quat.x, y - quat.y, z - quat.z, w - quat.w);
+}
+
+/* TODO: uncomment this when D3DXQuaternionMultiply has been implemented
+inline D3DXQUATERNION D3DXQUATERNION::operator * (CONST D3DXQUATERNION& qua=
t) const
+{
+    D3DXQUATERNION buf;
+    D3DXQuaternionMultiply(&buf, this, &quat);
+    return buf;
+}
+*/
+
+inline D3DXQUATERNION D3DXQUATERNION::operator * (FLOAT f) const
+{
+    return D3DXQUATERNION(x * f, y * f, z * f, w * f);
+}
+
+inline D3DXQUATERNION D3DXQUATERNION::operator / (FLOAT f) const
+{
+    FLOAT inv =3D 1.0f / f;
+    return D3DXQUATERNION(x * inv, y * inv, z * inv, w * inv);
+}
+
+inline D3DXQUATERNION operator * (FLOAT f, CONST D3DXQUATERNION& quat)
+{
+    return D3DXQUATERNION(f * quat.x, f * quat.y, f * quat.z, f * quat.w);
+}
+
+inline BOOL D3DXQUATERNION::operator =3D=3D (CONST D3DXQUATERNION& quat) co=
nst
+{
+    return x =3D=3D quat.x && y =3D=3D quat.y && z =3D=3D quat.z && w =3D=
=3D quat.w;
+}
+
+inline BOOL D3DXQUATERNION::operator !=3D (CONST D3DXQUATERNION& quat) cons=
t
+{
+    return x !=3D quat.x || y !=3D quat.y || z !=3D quat.z || w !=3D quat.w=
;
+}
+
+inline D3DXPLANE::D3DXPLANE()
+{
+}
+
+inline D3DXPLANE::D3DXPLANE(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    a =3D pf[0];
+    b =3D pf[1];
+    c =3D pf[2];
+    d =3D pf[3];
+}
+
+inline D3DXPLANE::D3DXPLANE(FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd)
+{
+    a =3D fa;
+    b =3D fb;
+    c =3D fc;
+    d =3D fd;
+}
+
+inline D3DXPLANE::operator FLOAT* ()
+{
+    return (FLOAT*)&a;
+}
+
+inline D3DXPLANE::operator CONST FLOAT* () const
+{
+    return (CONST FLOAT*)&a;
+}
+
+inline D3DXPLANE D3DXPLANE::operator + () const
+{
+    return *this;
+}
+
+inline D3DXPLANE D3DXPLANE::operator - () const
+{
+    return D3DXPLANE(-a, -b, -c, -d);
+}
+
+inline BOOL D3DXPLANE::operator =3D=3D (CONST D3DXPLANE& pl) const
+{
+    return a =3D=3D pl.a && b =3D=3D pl.b && c =3D=3D pl.c && d =3D=3D pl.d=
;
+}
+
+inline BOOL D3DXPLANE::operator !=3D (CONST D3DXPLANE& pl) const
+{
+    return a !=3D pl.a || b !=3D pl.b || c !=3D pl.c || d !=3D pl.d;
+}
+
+inline D3DXCOLOR::D3DXCOLOR()
+{
+}
+
+inline D3DXCOLOR::D3DXCOLOR(DWORD col)
+{
+    CONST FLOAT f =3D 1.0f / 255.0f;
+    r =3D f * (FLOAT)(unsigned char)(col >> 16);
+    g =3D f * (FLOAT)(unsigned char)(col >>  8);
+    b =3D f * (FLOAT)(unsigned char)col;
+    a =3D f * (FLOAT)(unsigned char)(col >> 24);
+}
+
+inline D3DXCOLOR::D3DXCOLOR(CONST FLOAT *pf)
+{
+    if(!pf) return;
+    r =3D pf[0];
+    g =3D pf[1];
+    b =3D pf[2];
+    a =3D pf[3];
+}
+
+inline D3DXCOLOR::D3DXCOLOR(CONST D3DCOLORVALUE& col)
+{
+    r =3D col.r;
+    g =3D col.g;
+    b =3D col.b;
+    a =3D col.a;
+}
+
+inline D3DXCOLOR::D3DXCOLOR(FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa)
+{
+    r =3D fr;
+    g =3D fg;
+    b =3D fb;
+    a =3D fa;
+}
+
+inline D3DXCOLOR::operator DWORD () const
+{
+    DWORD _r =3D r >=3D 1.0f ? 0xff : r <=3D 0.0f ? 0x00 : (DWORD)(r * 255.=
0f + 0.5f);
+    DWORD _g =3D g >=3D 1.0f ? 0xff : g <=3D 0.0f ? 0x00 : (DWORD)(g * 255.=
0f + 0.5f);
+    DWORD _b =3D b >=3D 1.0f ? 0xff : b <=3D 0.0f ? 0x00 : (DWORD)(b * 255.=
0f + 0.5f);
+    DWORD _a =3D a >=3D 1.0f ? 0xff : a <=3D 0.0f ? 0x00 : (DWORD)(a * 255.=
0f + 0.5f);
+
+    return (_a << 24) | (_r << 16) | (_g << 8) | _b;
+}
+
+inline D3DXCOLOR::operator FLOAT * ()
+{
+    return (FLOAT*)&r;
+}
+
+inline D3DXCOLOR::operator CONST FLOAT * () const
+{
+    return (CONST FLOAT*)&r;
+}
+
+inline D3DXCOLOR::operator D3DCOLORVALUE * ()
+{
+    return (D3DCOLORVALUE*)&r;
+}
+
+inline D3DXCOLOR::operator CONST D3DCOLORVALUE * () const
+{
+    return (CONST D3DCOLORVALUE*)&r;
+}
+
+inline D3DXCOLOR::operator D3DCOLORVALUE& ()
+{
+    return *((D3DCOLORVALUE*)&r);
+}
+
+inline D3DXCOLOR::operator CONST D3DCOLORVALUE& () const
+{
+    return *((CONST D3DCOLORVALUE*)&r);
+}
+
+inline D3DXCOLOR& D3DXCOLOR::operator +=3D (CONST D3DXCOLOR& col)
+{
+    r +=3D col.r;
+    g +=3D col.g;
+    b +=3D col.b;
+    a +=3D col.a;
+    return *this;
+}
+
+inline D3DXCOLOR& D3DXCOLOR::operator -=3D (CONST D3DXCOLOR& col)
+{
+    r -=3D col.r;
+    g -=3D col.g;
+    b -=3D col.b;
+    a -=3D col.a;
+    return *this;
+}
+
+inline D3DXCOLOR& D3DXCOLOR::operator *=3D (FLOAT f)
+{
+    r *=3D f;
+    g *=3D f;
+    b *=3D f;
+    a *=3D f;
+    return *this;
+}
+
+inline D3DXCOLOR& D3DXCOLOR::operator /=3D (FLOAT f)
+{
+    FLOAT inv =3D 1.0f / f;
+    r *=3D inv;
+    g *=3D inv;
+    b *=3D inv;
+    a *=3D inv;
+    return *this;
+}
+
+inline D3DXCOLOR D3DXCOLOR::operator + () const
+{
+    return *this;
+}
+
+inline D3DXCOLOR D3DXCOLOR::operator - () const
+{
+    return D3DXCOLOR(-r, -g, -b, -a);
+}
+
+inline D3DXCOLOR D3DXCOLOR::operator + (CONST D3DXCOLOR& col) const
+{
+    return D3DXCOLOR(r + col.r, g + col.g, b + col.b, a + col.a);
+}
+
+inline D3DXCOLOR D3DXCOLOR::operator - (CONST D3DXCOLOR& col) const
+{
+    return D3DXCOLOR(r - col.r, g - col.g, b - col.b, a - col.a);
+}
+
+inline D3DXCOLOR D3DXCOLOR::operator * (FLOAT f) const
+{
+    return D3DXCOLOR(r * f, g * f, b * f, a * f);
+}
+
+inline D3DXCOLOR D3DXCOLOR::operator / (FLOAT f) const
+{
+    FLOAT inv =3D 1.0f / f;
+    return D3DXCOLOR(r * inv, g * inv, b * inv, a * inv);
+}
+
+inline D3DXCOLOR operator * (FLOAT f, CONST D3DXCOLOR& col)
+{
+    return D3DXCOLOR(f * col.r, f * col.g, f * col.b, f * col.a);
+}
+
+inline BOOL D3DXCOLOR::operator =3D=3D (CONST D3DXCOLOR& col) const
+{
+    return r =3D=3D col.r && g =3D=3D col.g && b =3D=3D col.b && a =3D=3D c=
ol.a;
+}
+
+inline BOOL D3DXCOLOR::operator !=3D (CONST D3DXCOLOR& col) const
+{
+    return r !=3D col.r || g !=3D col.g || b !=3D col.b || a !=3D col.a;
+}
+
+#endif /* __cplusplus */
+
+/*_______________D3DXCOLOR_____________________*/
+
+static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1=
, CONST D3DXCOLOR *pc2)
+{
+    if ( !pout || !pc1 || !pc2 ) return NULL;
+    pout->r =3D (pc1->r) + (pc2->r);
+    pout->g =3D (pc1->g) + (pc2->g);
+    pout->b =3D (pc1->b) + (pc2->b);
+    pout->a =3D (pc1->a) + (pc2->a);
+    return pout;
+}
+
+static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc=
1, CONST D3DXCOLOR *pc2, FLOAT s)
+{
+    if ( !pout || !pc1 || !pc2 ) return NULL;
+    pout->r =3D (1-s) * (pc1->r) + s *(pc2->r);
+    pout->g =3D (1-s) * (pc1->g) + s *(pc2->g);
+    pout->b =3D (1-s) * (pc1->b) + s *(pc2->b);
+    pout->a =3D (1-s) * (pc1->a) + s *(pc2->a);
+    return pout;
+}
+
+static inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR *pout, CONST D3DXCOLOR=
 *pc1, CONST D3DXCOLOR *pc2)
+{
+    if ( !pout || !pc1 || !pc2 ) return NULL;
+    pout->r =3D (pc1->r) * (pc2->r);
+    pout->g =3D (pc1->g) * (pc2->g);
+    pout->b =3D (pc1->b) * (pc2->b);
+    pout->a =3D (pc1->a) * (pc2->a);
+    return pout;
+}
+
+static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR=
 *pc)
+{
+    if ( !pout || !pc ) return NULL;
+    pout->r =3D 1.0f - pc->r;
+    pout->g =3D 1.0f - pc->g;
+    pout->b =3D 1.0f - pc->b;
+    pout->a =3D pc->a;
+    return pout;
+}
+
+static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *p=
c, FLOAT s)
+{
+    if ( !pout || !pc ) return NULL;
+    pout->r =3D s* (pc->r);
+    pout->g =3D s* (pc->g);
+    pout->b =3D s* (pc->b);
+    pout->a =3D s* (pc->a);
+    return pout;
+}
+
+static inline D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR *pout, CONST D3DXCOLOR=
 *pc1, CONST D3DXCOLOR *pc2)
+{
+    if ( !pout || !pc1 || !pc2 ) return NULL;
+    pout->r =3D (pc1->r) - (pc2->r);
+    pout->g =3D (pc1->g) - (pc2->g);
+    pout->b =3D (pc1->b) - (pc2->b);
+    pout->a =3D (pc1->a) - (pc2->a);
+    return pout;
+}
+
+/*_______________D3DXVECTOR2________________________*/
+
+static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2=
 *pv1, CONST D3DXVECTOR2 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D pv1->x + pv2->x;
+    pout->y =3D pv1->y + pv2->y;
+    return pout;
+}
+
+static inline FLOAT D3DXVec2CCW(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *=
pv2)
+{
+    if ( !pv1 || !pv2) return 0.0f;
+    return ( (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x) );
+}
+
+static inline FLOAT D3DXVec2Dot(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *=
pv2)
+{
+    if ( !pv1 || !pv2) return 0.0f;
+    return ( (pv1->x * pv2->x + pv1->y * pv2->y) );
+}
+
+static inline FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv)
+{
+    if (!pv) return 0.0f;
+    return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
+}
+
+static inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
+{
+    if (!pv) return 0.0f;
+    return( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
+}
+
+static inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR=
2 *pv1, CONST D3DXVECTOR2 *pv2, FLOAT s)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D (1-s) * (pv1->x) + s * (pv2->x);
+    pout->y =3D (1-s) * (pv1->y) + s * (pv2->y);
+    return pout;
+}
+
+static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVE=
CTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D max(pv1->x , pv2->x);
+    pout->y =3D max(pv1->y , pv2->y);
+    return pout;
+}
+
+static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVE=
CTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D min(pv1->x , pv2->x);
+    pout->y =3D min(pv1->y , pv2->y);
+    return pout;
+}
+
+static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTO=
R2 *pv, FLOAT s)
+{
+    if ( !pout || !pv) return NULL;
+    pout->x =3D s * (pv->x);
+    pout->y =3D s * (pv->y);
+    return pout;
+}
+
+static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVE=
CTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D pv1->x - pv2->x;
+    pout->y =3D pv1->y - pv2->y;
+    return pout;
+}
+
+/*__________________D3DXVECTOR3_______________________*/
+
+static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3=
 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D pv1->x + pv2->x;
+    pout->y =3D pv1->y + pv2->y;
+    pout->z =3D pv1->z + pv2->z;
+    return pout;
+}
+
+static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTO=
R3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
+    pout->y =3D (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
+    pout->z =3D (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x);
+    return pout;
+}
+
+static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *=
pv2)
+{
+    if ( !pv1 || !pv2 ) return 0.0f;
+    return (pv1->x) * (pv2->x) + (pv1->y) * (pv2->y) + (pv1->z) * (pv2->z);
+}
+
+static inline FLOAT D3DXVec3Length(CONST D3DXVECTOR3 *pv)
+{
+    if (!pv) return 0.0f;
+    return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) =
);
+}
+
+static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv)
+{
+    if (!pv) return 0.0f;
+    return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z);
+}
+
+static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR=
3 *pv1, CONST D3DXVECTOR3 *pv2, FLOAT s)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D (1-s) * (pv1->x) + s * (pv2->x);
+    pout->y =3D (1-s) * (pv1->y) + s * (pv2->y);
+    pout->z =3D (1-s) * (pv1->z) + s * (pv2->z);
+    return pout;
+}
+
+static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVE=
CTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D max(pv1->x , pv2->x);
+    pout->y =3D max(pv1->y , pv2->y);
+    pout->z =3D max(pv1->z , pv2->z);
+    return pout;
+}
+
+static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVE=
CTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D min(pv1->x , pv2->x);
+    pout->y =3D min(pv1->y , pv2->y);
+    pout->z =3D min(pv1->z , pv2->z);
+    return pout;
+}
+
+static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTO=
R3 *pv, FLOAT s)
+{
+    if ( !pout || !pv) return NULL;
+    pout->x =3D s * (pv->x);
+    pout->y =3D s * (pv->y);
+    pout->z =3D s * (pv->z);
+    return pout;
+}
+
+static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVE=
CTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D pv1->x - pv2->x;
+    pout->y =3D pv1->y - pv2->y;
+    pout->z =3D pv1->z - pv2->z;
+    return pout;
+}
+/*__________________D3DXVECTOR4_______________________*/
+
+static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, CONST D3DXVECTOR4=
 *pv1, CONST D3DXVECTOR4 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D pv1->x + pv2->x;
+    pout->y =3D pv1->y + pv2->y;
+    pout->z =3D pv1->z + pv2->z;
+    pout->w =3D pv1->w + pv2->w;
+    return pout;
+}
+
+static inline FLOAT D3DXVec4Dot(CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *=
pv2)
+{
+    if (!pv1 || !pv2 ) return 0.0f;
+    return (pv1->x) * (pv2->x) + (pv1->y) * (pv2->y) + (pv1->z) * (pv2->z) =
+ (pv1->w) * (pv2->w);
+}
+
+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) );
+}
+
+static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv)
+{
+    if (!pv) return 0.0f;
+    return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv-=
>w) * (pv->w);
+}
+
+static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR=
4 *pv1, CONST D3DXVECTOR4 *pv2, FLOAT s)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D (1-s) * (pv1->x) + s * (pv2->x);
+    pout->y =3D (1-s) * (pv1->y) + s * (pv2->y);
+    pout->z =3D (1-s) * (pv1->z) + s * (pv2->z);
+    pout->w =3D (1-s) * (pv1->w) + s * (pv2->w);
+    return pout;
+}
+
+
+static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVE=
CTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D max(pv1->x , pv2->x);
+    pout->y =3D max(pv1->y , pv2->y);
+    pout->z =3D max(pv1->z , pv2->z);
+    pout->w =3D max(pv1->w , pv2->w);
+    return pout;
+}
+
+static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVE=
CTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D min(pv1->x , pv2->x);
+    pout->y =3D min(pv1->y , pv2->y);
+    pout->z =3D min(pv1->z , pv2->z);
+    pout->w =3D min(pv1->w , pv2->w);
+    return pout;
+}
+
+static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTO=
R4 *pv, FLOAT s)
+{
+    if ( !pout || !pv) return NULL;
+    pout->x =3D s * (pv->x);
+    pout->y =3D s * (pv->y);
+    pout->z =3D s * (pv->z);
+    pout->w =3D s * (pv->w);
+    return pout;
+}
+
+static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVE=
CTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x =3D pv1->x - pv2->x;
+    pout->y =3D pv1->y - pv2->y;
+    pout->z =3D pv1->z - pv2->z;
+    pout->w =3D pv1->w - pv2->w;
+    return pout;
+}
+
+/*__________________D3DXMatrix____________________*/
+#ifdef NONAMELESSUNION
+# define D3DX_U(x)  (x).u
+#else
+# define D3DX_U(x)  (x)
+#endif
+
+static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout)
+{
+    if ( !pout ) return NULL;
+    D3DX_U(*pout).m[0][1] =3D 0.0f;
+    D3DX_U(*pout).m[0][2] =3D 0.0f;
+    D3DX_U(*pout).m[0][3] =3D 0.0f;
+    D3DX_U(*pout).m[1][0] =3D 0.0f;
+    D3DX_U(*pout).m[1][2] =3D 0.0f;
+    D3DX_U(*pout).m[1][3] =3D 0.0f;
+    D3DX_U(*pout).m[2][0] =3D 0.0f;
+    D3DX_U(*pout).m[2][1] =3D 0.0f;
+    D3DX_U(*pout).m[2][3] =3D 0.0f;
+    D3DX_U(*pout).m[3][0] =3D 0.0f;
+    D3DX_U(*pout).m[3][1] =3D 0.0f;
+    D3DX_U(*pout).m[3][2] =3D 0.0f;
+    D3DX_U(*pout).m[0][0] =3D 1.0f;
+    D3DX_U(*pout).m[1][1] =3D 1.0f;
+    D3DX_U(*pout).m[2][2] =3D 1.0f;
+    D3DX_U(*pout).m[3][3] =3D 1.0f;
+    return pout;
+}
+
+static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
+{
+    int i,j;
+    D3DXMATRIX testmatrix;
+
+    if ( !pm ) return FALSE;
+    D3DXMatrixIdentity(&testmatrix);
+    for (i=3D0; i<4; i++)
+    {
+     for (j=3D0; j<4; j++)
+     {
+      if ( D3DX_U(*pm).m[i][j] !=3D D3DX_U(testmatrix).m[i][j] ) return FAL=
SE;
+     }
+    }
+    return TRUE;
+}
+#undef D3DX_U
+
+/*__________________D3DXPLANE____________________*/
+
+static inline FLOAT D3DXPlaneDot(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *pv=
)
+{
+    if ( !pp || !pv ) return 0.0f;
+    return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (p=
p->d) * (pv->w) );
+}
+
+static inline FLOAT D3DXPlaneDotCoord(CONST D3DXPLANE *pp, CONST D3DXVECTOR=
4 *pv)
+{
+    if ( !pp || !pv ) return 0.0f;
+    return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (p=
p->d) );
+}
+
+static inline FLOAT D3DXPlaneDotNormal(CONST D3DXPLANE *pp, CONST D3DXVECTO=
R4 *pv)
+{
+    if ( !pp || !pv ) return 0.0f;
+    return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) );
+}
+
+/*__________________D3DXQUATERNION____________________*/
+
+static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout,=
 CONST D3DXQUATERNION *pq)
+{
+    if ( !pout || !pq) return NULL;
+    pout->x =3D -pq->x;
+    pout->y =3D -pq->y;
+    pout->z =3D -pq->z;
+    pout->w =3D pq->w;
+    return pout;
+}
+
+static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DX=
QUATERNION *pq2)
+{
+    if ( !pq1 || !pq2 ) return 0.0f;
+    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 =3D 0.0f;
+    pout->y =3D 0.0f;
+    pout->z =3D 0.0f;
+    pout->w =3D 1.0f;
+    return pout;
+}
+
+static inline BOOL D3DXQuaternionIsIdentity(D3DXQUATERNION *pq)
+{
+    if ( !pq) return FALSE;
+    return ( (pq->x =3D=3D 0.0f) && (pq->y =3D=3D 0.0f) && (pq->z =3D=3D 0.=
0f) && (pq->w =3D=3D 1.0f) );
+}
+
+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) );
+}
+
+static inline FLOAT D3DXQuaternionLengthSq(CONST D3DXQUATERNION *pq)
+{
+    if (!pq) return 0.0f;
+    return (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq-=
>w) * (pq->w);
+}
+
+#endif
--=20
1.5.3.2


--=_50smm6s8s408--



More information about the wine-patches mailing list