wine/include/d3dx8math.h

172 lines
8.3 KiB
C
Raw Normal View History

2007-10-05 18:03:41 +00:00
/*
* Copyright (C) 2007 David Adam
* Copyright (C) 2007 Tony Wasserka
2007-10-05 18:03:41 +00:00
*
* 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, USA
*/
#include <d3dx8.h>
#ifndef __D3DX8MATH_H__
#define __D3DX8MATH_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 += (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;
#endif /* __cplusplus */
2007-10-05 18:03:41 +00:00
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 += (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 /* !__cplusplus */
typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
#endif /* !__cplusplus */
2007-10-05 18:03:41 +00:00
typedef struct D3DXVECTOR4
{
FLOAT x, y, z, w;
} D3DXVECTOR4, *LPD3DXVECTOR4;
typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
typedef struct D3DXQUATERNION
{
FLOAT x, y, z, w;
} D3DXQUATERNION, *LPD3DXQUATERNION;
typedef struct D3DXPLANE
{
FLOAT a, b, c, d;
} D3DXPLANE, *LPD3DXPLANE;
typedef struct D3DXCOLOR
{
FLOAT r, g, b, a;
} D3DXCOLOR, *LPD3DXCOLOR;
FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm);
2007-11-03 08:39:30 +00:00
D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup);
2007-11-03 08:33:51 +00:00
D3DXMATRIX* WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup);
2007-10-30 13:46:19 +00:00
D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, CONST D3DXMATRIX *pm1, CONST D3DXMATRIX *pm2);
D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT 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 D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pv, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3DXQUATERNION *pq);
2007-10-30 14:38:50 +00:00
D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle);
2007-10-30 14:47:07 +00:00
D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, FLOAT pitch, FLOAT roll);
2007-10-30 14:53:19 +00:00
D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle);
2007-10-30 14:24:17 +00:00
D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz);
D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z);
2007-10-30 14:16:12 +00:00
D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *pm);
2007-10-26 16:01:49 +00:00
D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
2007-10-26 16:58:28 +00:00
D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g);
2007-10-26 19:43:46 +00:00
D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT s);
2007-10-26 19:02:30 +00:00
D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pt1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pt2, FLOAT s);
2007-10-26 16:01:49 +00:00
D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv);
2007-10-27 09:00:07 +00:00
D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm);
2007-10-27 09:54:25 +00:00
D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm);
2007-10-27 10:21:47 +00:00
D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm);
2007-10-26 16:01:49 +00:00
2007-10-26 16:58:28 +00:00
D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g);
2007-10-26 19:43:46 +00:00
D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT s);
2007-10-26 19:02:30 +00:00
D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pt1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pt2, FLOAT s);
2007-10-26 16:01:49 +00:00
D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv);
2007-10-27 09:00:07 +00:00
D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
2007-10-27 09:54:25 +00:00
D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
2007-10-27 10:21:47 +00:00
D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
2007-10-26 16:01:49 +00:00
2007-10-26 16:58:28 +00:00
D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g);
2007-10-26 19:43:46 +00:00
D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv0, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT s);
2007-10-27 12:23:25 +00:00
D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3);
2007-10-26 19:02:30 +00:00
D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pt1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pt2, FLOAT s);
2007-10-26 16:01:49 +00:00
D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv);
2007-10-27 09:00:07 +00:00
D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, CONST D3DXMATRIX *pm);
2007-10-26 16:01:49 +00:00
#include <d3dx8math.inl>
2007-10-05 18:03:41 +00:00
#endif /* __D3DX8MATH_H__ */