#include "d3dx8.h"

#ifndef _D3DX8MATH_H
#define _D3DX8MATH_H

/* D3DX math types and functions */

#include <math.h>

#ifndef __PODX8API
#if __POCC__ >= 274
#define __PODX8API  __declspec(dllimport)
#else
#define __PODX8API
#endif
#endif /* __PODX8API */

#define D3DX_PI  ((FLOAT)3.141592654f)
#define D3DX_1BYPI  ((FLOAT)0.318309886f)

#define D3DXToRadian(degree)  ((degree)*(D3DX_PI/180.0f))
#define D3DXToDegree(radian)  ((radian)*(180.0f/D3DX_PI))

typedef struct D3DXVECTOR2 {
#ifdef __cplusplus
public:
    D3DXVECTOR2() {};
    D3DXVECTOR2(CONST FLOAT*);
    D3DXVECTOR2(FLOAT,FLOAT);

    operator FLOAT* ();
    operator CONST FLOAT* () const;

    D3DXVECTOR2& operator += (CONST D3DXVECTOR2&);
    D3DXVECTOR2& operator -= (CONST D3DXVECTOR2&);
    D3DXVECTOR2& operator *= (FLOAT);
    D3DXVECTOR2& operator /= (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 == (CONST D3DXVECTOR2&) const;
    BOOL operator != (CONST D3DXVECTOR2&) const;

public:
#endif /* __cplusplus */
    FLOAT x, y;
} D3DXVECTOR2, *LPD3DXVECTOR2;

#ifdef __cplusplus
typedef struct D3DXVECTOR3 : public D3DVECTOR {
public:
    D3DXVECTOR3() {};
    D3DXVECTOR3(CONST FLOAT*);
    D3DXVECTOR3(CONST D3DVECTOR&);
    D3DXVECTOR3(FLOAT,FLOAT,FLOAT);

    operator FLOAT* ();
    operator CONST FLOAT* () const;

    D3DXVECTOR3& operator += (CONST D3DXVECTOR3&);
    D3DXVECTOR3& operator -= (CONST D3DXVECTOR3&);
    D3DXVECTOR3& operator *= (FLOAT);
    D3DXVECTOR3& operator /= (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 == (CONST D3DXVECTOR3&) const;
    BOOL operator != (CONST D3DXVECTOR3&) const;

} D3DXVECTOR3, *LPD3DXVECTOR3;
#else
typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
#endif /* __cplusplus */

typedef struct D3DXVECTOR4 {
#ifdef __cplusplus
public:
    D3DXVECTOR4() {};
    D3DXVECTOR4(CONST FLOAT*);
    D3DXVECTOR4(FLOAT,FLOAT,FLOAT,FLOAT);

    operator FLOAT* ();
    operator CONST FLOAT* () const;

    D3DXVECTOR4& operator += (CONST D3DXVECTOR4&);
    D3DXVECTOR4& operator -= (CONST D3DXVECTOR4&);
    D3DXVECTOR4& operator *= (FLOAT);
    D3DXVECTOR4& operator /= (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 == (CONST D3DXVECTOR4&) const;
    BOOL operator != (CONST D3DXVECTOR4&) const;

public:
#endif /* __cplusplus */
    FLOAT x, y, z, w;
} D3DXVECTOR4, *LPD3DXVECTOR4;

#ifdef __cplusplus
typedef struct D3DXMATRIX : public D3DMATRIX {
public:
    D3DXMATRIX() {};
    D3DXMATRIX(CONST FLOAT*);
    D3DXMATRIX(CONST D3DMATRIX&);
    D3DXMATRIX(FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT);

    FLOAT& operator () (UINT,UINT);
    FLOAT  operator () (UINT,UINT) const;

    operator FLOAT* ();
    operator CONST FLOAT* () const;

    D3DXMATRIX& operator *= (CONST D3DXMATRIX&);
    D3DXMATRIX& operator += (CONST D3DXMATRIX&);
    D3DXMATRIX& operator -= (CONST D3DXMATRIX&);
    D3DXMATRIX& operator *= (FLOAT);
    D3DXMATRIX& operator /= (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 == (CONST D3DXMATRIX&) const;
    BOOL operator != (CONST D3DXMATRIX&) const;

} D3DXMATRIX, *LPD3DXMATRIX;
#else
typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
#endif /* __cplusplus */

#ifdef __cplusplus
typedef struct _D3DXMATRIXA16 : public D3DXMATRIX
{
    _D3DXMATRIXA16() {}
    _D3DXMATRIXA16(CONST FLOAT*): D3DXMATRIX(f) {}
    _D3DXMATRIXA16(CONST D3DMATRIX& m): D3DXMATRIX(m) {}
    _D3DXMATRIXA16(FLOAT _11,FLOAT _12,FLOAT _13,FLOAT _14,FLOAT _21,FLOAT _22,FLOAT _23,FLOAT _24,
        FLOAT _31,FLOAT _32,FLOAT _33,FLOAT _34,FLOAT _41,FLOAT _42,FLOAT _43,FLOAT _44) :
        D3DXMATRIX(_11,_12,_13,_14,_21,_22,_23,_24,_31,_32,_33,_34,_41,_42,_43,_44) {}
    void* operator new(size_t s)
    {
        LPBYTE p = ::new BYTE[s + 16];
        if (p)
        {
            BYTE offset = (BYTE)(16 - ((ULONG_PTR)p & 15));
            p += offset;
            p[-1] = offset;
        }
        return p;
    };

    void* operator new[](size_t s)
    {
        LPBYTE p = ::new BYTE[s + 16];
        if (p)
        {
            BYTE offset = (BYTE)(16 - ((ULONG_PTR)p & 15));
            p += offset;
            p[-1] = offset;
        }
        return p;
    };

    void operator delete(void* p)
    {
        if(p)
        {
            BYTE* pb = static_cast<BYTE*>(p);
            pb -= pb[-1];
            ::delete [] pb;
        }
    };

    void operator delete[](void* p)
    {
        if(p)
        {
            BYTE* pb = static_cast<BYTE*>(p);
            pb -= pb[-1];
            ::delete [] pb;
        }
    };

    struct _D3DXMATRIXA16& operator=(CONST D3DXMATRIX& rhs)
    {
        memcpy(&_11, &rhs, sizeof(D3DXMATRIX));
        return *this;
    };
} _D3DXMATRIXA16;
#else
typedef D3DXMATRIX  _D3DXMATRIXA16;
#endif /* __cplusplus */

#define _ALIGN_16

#define D3DXMATRIXA16 _ALIGN_16 _D3DXMATRIXA16

typedef D3DXMATRIXA16 *LPD3DXMATRIXA16;

typedef struct D3DXQUATERNION {
#ifdef __cplusplus
public:
    D3DXQUATERNION() {}
    D3DXQUATERNION(CONST FLOAT*);
    D3DXQUATERNION(FLOAT,FLOAT,FLOAT,FLOAT);

    operator FLOAT* ();
    operator CONST FLOAT* () const;

    D3DXQUATERNION& operator += (CONST D3DXQUATERNION&);
    D3DXQUATERNION& operator -= (CONST D3DXQUATERNION&);
    D3DXQUATERNION& operator *= (CONST D3DXQUATERNION&);
    D3DXQUATERNION& operator *= (FLOAT);
    D3DXQUATERNION& operator /= (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 == (CONST D3DXQUATERNION&) const;
    BOOL operator != (CONST D3DXQUATERNION&) const;

#endif /* __cplusplus */
    FLOAT x, y, z, w;
} D3DXQUATERNION, *LPD3DXQUATERNION;

typedef struct D3DXPLANE {
#ifdef __cplusplus
public:
    D3DXPLANE() {}
    D3DXPLANE(CONST FLOAT*);
    D3DXPLANE(FLOAT,FLOAT,FLOAT,FLOAT);

    operator FLOAT* ();
    operator CONST FLOAT* () const;

    D3DXPLANE operator + () const;
    D3DXPLANE operator - () const;

    BOOL operator == (CONST D3DXPLANE&) const;
    BOOL operator != (CONST D3DXPLANE&) const;

#endif /* __cplusplus */
    FLOAT a, b, c, d;
} D3DXPLANE, *LPD3DXPLANE;

typedef struct D3DXCOLOR {
#ifdef __cplusplus
public:
    D3DXCOLOR() {}
    D3DXCOLOR(DWORD);
    D3DXCOLOR(CONST FLOAT*);
    D3DXCOLOR(CONST D3DCOLORVALUE&);
    D3DXCOLOR(FLOAT,FLOAT,FLOAT,FLOAT);

    operator DWORD () const;
    operator FLOAT* ();
    operator CONST FLOAT* () const;
    operator D3DCOLORVALUE* ();
    operator CONST D3DCOLORVALUE* () const;
    operator D3DCOLORVALUE& ();
    operator CONST D3DCOLORVALUE& () const;

    D3DXCOLOR& operator += (CONST D3DXCOLOR&);
    D3DXCOLOR& operator -= (CONST D3DXCOLOR&);
    D3DXCOLOR& operator *= (FLOAT);
    D3DXCOLOR& operator /= (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 == (CONST D3DXCOLOR&) const;
    BOOL operator != (CONST D3DXCOLOR&) const;

#endif /* __cplusplus */
    FLOAT r, g, b, a;
} D3DXCOLOR, *LPD3DXCOLOR;

typedef interface ID3DXMatrixStack ID3DXMatrixStack;
typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK;

DEFINE_GUID(IID_ID3DXMatrixStack,0xe3357330,0xcc5e,0x11d2,0xa4,0x34,0x0,0xa0,0xc9,0x6,0x29,0xa8);

#undef INTERFACE
#define INTERFACE ID3DXMatrixStack
DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown)
{
    STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
    STDMETHOD_(ULONG,Release)(THIS) PURE;
    STDMETHOD(Pop)(THIS) PURE;
    STDMETHOD(Push)(THIS) PURE;
    STDMETHOD(LoadIdentity)(THIS) PURE;
    STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX*) PURE;
    STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX*) PURE;
    STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX*) PURE;
    STDMETHOD(RotateAxis)(THIS_ CONST D3DXVECTOR3*,FLOAT) PURE;
    STDMETHOD(RotateAxisLocal)(THIS_ CONST D3DXVECTOR3*,FLOAT) PURE;
    STDMETHOD(RotateYawPitchRoll)(THIS_ FLOAT,FLOAT,FLOAT) PURE;
    STDMETHOD(RotateYawPitchRollLocal)(THIS_ FLOAT,FLOAT,FLOAT) PURE;
    STDMETHOD(Scale)(THIS_ FLOAT,FLOAT,FLOAT) PURE;
    STDMETHOD(ScaleLocal)(THIS_ FLOAT,FLOAT,FLOAT) PURE;
    STDMETHOD(Translate)(THIS_ FLOAT,FLOAT,FLOAT) PURE;
    STDMETHOD(TranslateLocal)(THIS_ FLOAT,FLOAT,FLOAT) PURE;
    STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE;
};

FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *);
FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2*);
FLOAT D3DXVec2Dot(CONST D3DXVECTOR2*,CONST D3DXVECTOR2*);
FLOAT D3DXVec2CCW(CONST D3DXVECTOR2*,CONST D3DXVECTOR2*);

D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*);
D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*);
D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*);
D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*);
D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2*,CONST D3DXVECTOR2*,FLOAT);
D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,FLOAT);

FLOAT D3DXVec3Length(CONST D3DXVECTOR3*);
FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3*);
FLOAT D3DXVec3Dot(CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3*,CONST D3DXVECTOR3*,FLOAT);
D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,FLOAT);

FLOAT D3DXVec4Length(CONST D3DXVECTOR4*);
FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4*);
FLOAT D3DXVec4Dot(CONST D3DXVECTOR4*,CONST D3DXVECTOR4*);
D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*);
D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*);
D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*);
D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*);
D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4*,CONST D3DXVECTOR4*,FLOAT);
D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,FLOAT);

D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX*);
BOOL D3DXMatrixIsIdentity(CONST D3DXMATRIX*);

FLOAT D3DXQuaternionLength(CONST D3DXQUATERNION*);
FLOAT D3DXQuaternionLengthSq(CONST D3DXQUATERNION*);
FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION*,CONST D3DXQUATERNION*);
D3DXQUATERNION* D3DXQuaternionIdentity(D3DXQUATERNION*);
BOOL D3DXQuaternionIsIdentity(CONST D3DXQUATERNION*);
D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION*,CONST D3DXQUATERNION*);

FLOAT D3DXPlaneDot(CONST D3DXPLANE*,CONST D3DXVECTOR4*);
FLOAT D3DXPlaneDotCoord(CONST D3DXPLANE*,CONST D3DXVECTOR3*);
FLOAT D3DXPlaneDotNormal(CONST D3DXPLANE*,CONST D3DXVECTOR3*);

D3DXCOLOR* D3DXColorNegative(D3DXCOLOR*,CONST D3DXCOLOR*);
D3DXCOLOR* D3DXColorAdd(D3DXCOLOR*,CONST D3DXCOLOR*,CONST D3DXCOLOR*);
D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR*,CONST D3DXCOLOR*,CONST D3DXCOLOR*);
D3DXCOLOR* D3DXColorScale(D3DXCOLOR*,CONST D3DXCOLOR*,FLOAT);
D3DXCOLOR* D3DXColorModulate(D3DXCOLOR*,CONST D3DXCOLOR*,CONST D3DXCOLOR*);
D3DXCOLOR* D3DXColorLerp(D3DXCOLOR*,CONST D3DXCOLOR*,CONST D3DXCOLOR*,FLOAT);

#ifdef __cplusplus
extern "C" {
#endif

__PODX8API D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2*,CONST D3DXVECTOR2*);
__PODX8API D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,FLOAT);
__PODX8API D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,FLOAT);
__PODX8API D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXVECTOR2*,FLOAT,FLOAT);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4*,CONST D3DXVECTOR2*,CONST D3DXMATRIX*);
__PODX8API D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXMATRIX*);
__PODX8API D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2*,CONST D3DXVECTOR2*,CONST D3DXMATRIX*);

__PODX8API D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3*,CONST D3DXVECTOR3*);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,FLOAT);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3CatmullRom(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,FLOAT);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,FLOAT,FLOAT);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4*,CONST D3DXVECTOR3*,CONST D3DXMATRIX*);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXMATRIX*);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXMATRIX*);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3Project(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DVIEWPORT8*,CONST D3DXMATRIX*,CONST D3DXMATRIX*,CONST D3DXMATRIX*);
__PODX8API D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DVIEWPORT8*,CONST D3DXMATRIX*,CONST D3DXMATRIX*,CONST D3DXMATRIX*);

__PODX8API D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4*,CONST D3DXVECTOR4*);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,FLOAT);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,FLOAT);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXVECTOR4*,FLOAT,FLOAT);
__PODX8API D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4*,CONST D3DXVECTOR4*,CONST D3DXMATRIX*);

__PODX8API FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX*,CONST D3DXMATRIX*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX*,CONST D3DXMATRIX*,CONST D3DXMATRIX*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose(D3DXMATRIX*,CONST D3DXMATRIX*,CONST D3DXMATRIX*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX*,FLOAT*,CONST D3DXMATRIX*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX*,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX*,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX*,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX*,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX*,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX*,CONST D3DXVECTOR3*,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX*,CONST D3DXQUATERNION*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX*,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixTransformation(D3DXMATRIX*,CONST D3DXVECTOR3*,CONST D3DXQUATERNION*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXQUATERNION*,CONST D3DXVECTOR3*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX*,FLOAT,CONST D3DXVECTOR3*,CONST D3DXQUATERNION*,CONST D3DXVECTOR3*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixLookAtRH(D3DXMATRIX*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX*,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX*,CONST D3DXVECTOR4*,CONST D3DXPLANE*);
__PODX8API D3DXMATRIX* WINAPI D3DXMatrixReflect(D3DXMATRIX*,CONST D3DXPLANE*);

__PODX8API void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION*,D3DXVECTOR3*,FLOAT*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION*,CONST D3DXMATRIX*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION*,CONST D3DXVECTOR3*,FLOAT);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION*,FLOAT,FLOAT,FLOAT);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION*,CONST D3DXQUATERNION*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION*,CONST D3DXQUATERNION*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION*,CONST D3DXQUATERNION*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION*,CONST D3DXQUATERNION*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,FLOAT);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,FLOAT);
__PODX8API void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION*,D3DXQUATERNION*,D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*);
__PODX8API D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,CONST D3DXQUATERNION*,FLOAT,FLOAT);

__PODX8API D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE*,CONST D3DXPLANE*);
__PODX8API D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3*,CONST D3DXPLANE*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
__PODX8API D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
__PODX8API D3DXPLANE* WINAPI D3DXPlaneFromPoints(D3DXPLANE*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*,CONST D3DXVECTOR3*);
__PODX8API D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE*,CONST D3DXPLANE*,CONST D3DXMATRIX*);

__PODX8API D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR*,CONST D3DXCOLOR*,FLOAT);
__PODX8API D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR*,CONST D3DXCOLOR*,FLOAT);

__PODX8API FLOAT WINAPI D3DXFresnelTerm(FLOAT,FLOAT);

__PODX8API HRESULT WINAPI D3DXCreateMatrixStack(DWORD, LPD3DXMATRIXSTACK*);

#ifdef __cplusplus
}
#endif

/* #include "d3dx8math.inl" */

#endif /* _D3DX8MATH_H */
