2007-10-05 18:03:41 +00:00
|
|
|
/*
|
|
|
|
* 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, 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
|
|
|
|
{
|
|
|
|
FLOAT x, y;
|
|
|
|
} D3DXVECTOR2, *LPD3DXVECTOR2;
|
|
|
|
|
2007-10-11 15:48:49 +00:00
|
|
|
typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
|
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;
|
|
|
|
|
2007-10-30 13:30:58 +00:00
|
|
|
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);
|
2007-11-03 08:59:33 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
|
2007-11-03 08:57:33 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
|
2007-11-03 08:50:53 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf);
|
2007-11-03 08:48:43 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf);
|
2007-11-03 08:46:37 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
|
2007-11-03 08:54:39 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
|
2007-11-03 08:52:45 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
|
2007-11-03 08:43:11 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
|
2007-10-30 15:04:32 +00:00
|
|
|
D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pv, FLOAT angle);
|
2007-11-03 08:26:14 +00:00
|
|
|
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);
|
2007-11-03 08:30:14 +00:00
|
|
|
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);
|
2007-10-30 14:31:18 +00:00
|
|
|
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-30 13:30:58 +00:00
|
|
|
|
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
|
|
|
|
2007-10-16 12:09:43 +00:00
|
|
|
#include <d3dx8math.inl>
|
2007-10-13 22:39:54 +00:00
|
|
|
|
2007-10-05 18:03:41 +00:00
|
|
|
#endif /* __D3DX8MATH_H__ */
|