Commit 5bfe680d authored by David Adam's avatar David Adam Committed by Alexandre Julliard

include: Remove useless headers.

parent 14a98e3d
......@@ -139,11 +139,6 @@ SRCDIR_INCLUDES = \
d3drmobj.h \
d3dtypes.h \
d3dvec.inl \
d3dx8.h \
d3dx8core.h \
d3dx8math.h \
d3dx8math.inl \
d3dx8mesh.h \
d3dx9.h \
d3dx9core.h \
d3dx9math.h \
......
/*
* 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
*/
#ifndef __D3DX8_H__
#define __D3DX8_H__
#include <d3d8.h>
#include <limits.h>
#include <d3dx8math.h>
#include <d3dx8core.h>
/* FIXME: #include <d3dx8tex.h> */
#include <d3dx8mesh.h>
/* FIXME: #include <d3dx8shape.h> */
/* FIXME: #include <d3dx8effect.h> */
#endif
/*
* Copyright (C) 2002 Raphael Junqueira
*
* 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
*/
#ifndef __WINE_D3DX8CORE_H
#define __WINE_D3DX8CORE_H
#include <d3d8.h>
/*****************************************************************************
* #defines and error codes
*/
#define D3DXASM_DEBUG 1
#define D3DXASM_SKIPVALIDATION 2
#define _FACD3D 0x876
#define MAKE_D3DXHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
/*
* Direct3D Errors
*/
#define D3DXERR_CANNOTATTRSORT MAKE_D3DXHRESULT(2158)
#define D3DXERR_CANNOTMODIFYINDEXBUFFER MAKE_D3DXHRESULT(2159)
#define D3DXERR_INVALIDMESH MAKE_D3DXHRESULT(2160)
#define D3DXERR_SKINNINGNOTSUPPORTED MAKE_D3DXHRESULT(2161)
#define D3DXERR_TOOMANYINFLUENCES MAKE_D3DXHRESULT(2162)
#define D3DXERR_INVALIDDATA MAKE_D3DXHRESULT(2163)
/*****************************************************************************
* Predeclare the interfaces
*/
DEFINE_GUID(IID_ID3DXBuffer, 0x1,0x1,0x4,0xB0,0xCF,0x98,0xFE,0xFD,0xFF,0x95,0x12);/* FIXME */
typedef struct ID3DXBuffer *LPD3DXBUFFER;
DEFINE_GUID(IID_ID3DXFont, 0x1,0x1,0x4,0xB0,0xCF,0x98,0xFE,0xFD,0xFF,0x95,0x13);/* FIXME */
typedef struct ID3DXFont *LPD3DXFONT;
/*****************************************************************************
* ID3DXBuffer interface
*/
#define INTERFACE ID3DXBuffer
DECLARE_INTERFACE_(ID3DXBuffer,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ID3DXBuffer methods ***/
STDMETHOD_(LPVOID,GetBufferPointer)(THIS) PURE;
STDMETHOD_(DWORD,GetBufferSize)(THIS) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define ID3DXBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define ID3DXBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define ID3DXBuffer_Release(p) (p)->lpVtbl->Release(p)
/*** ID3DXBuffer methods ***/
#define ID3DXBuffer_GetBufferPointer(p) (p)->lpVtbl->GetBufferPointer(p)
#define ID3DXBuffer_GetBufferSize(p) (p)->lpVtbl->GetBufferSize(p)
#endif
/*****************************************************************************
* ID3DXFont interface
*/
#define INTERFACE ID3DXFont
DECLARE_INTERFACE_(ID3DXFont,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ID3DXFont methods ***/
STDMETHOD(Begin)(THIS) PURE;
STDMETHOD(DrawTextA)(THIS) PURE;
STDMETHOD(End)(THIS) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define ID3DXFont_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define ID3DXFont_AddRef(p) (p)->lpVtbl->AddRef(p)
#define ID3DXFont_Release(p) (p)->lpVtbl->Release(p)
/*** ID3DXFont methods ***/
#define ID3DXFont_Begin(p) (p)->lpVtbl->Begin(p)
#define ID3DXFont_DrawTextA(p,a,b,c,d,e)(p)->lpVtbl->DrawText(p,a,b,c,d,e)
#define ID3DXFont_End(p) (p)->lpVtbl->End(p)
#endif
/*************************************************************************************
* Define entrypoints
*/
#ifdef __cplusplus
extern "C" {
#endif
HRESULT WINAPI D3DXCreateFont(LPDIRECT3DDEVICE8 pDevice, HFONT hFont, LPD3DXFONT* ppFont);
HRESULT WINAPI D3DXAssembleShader(LPCVOID pSrcData, UINT SrcDataLen, DWORD Flags,
LPD3DXBUFFER* ppConstants,
LPD3DXBUFFER* ppCompiledShader,
LPD3DXBUFFER* ppCompilationErrors);
HRESULT WINAPI D3DXAssembleShaderFromFileA(LPCSTR pSrcFile, DWORD Flags,
LPD3DXBUFFER* ppConstants,
LPD3DXBUFFER* ppCompiledShader,
LPD3DXBUFFER* ppCompilationErrors);
HRESULT WINAPI D3DXAssembleShaderFromFileW(LPCWSTR pSrcFile, DWORD Flags,
LPD3DXBUFFER* ppConstants,
LPD3DXBUFFER* ppCompiledShader,
LPD3DXBUFFER* ppCompilationErrors);
#ifdef __cplusplus
}
#endif
#endif /* __WINE_D3DX8CORE_H */
/*
* 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, 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 ID3DXMatrixStack *LPD3DXMATRIXSTACK;
DEFINE_GUID(IID_ID3DXMatrixStack,
0xe3357330, 0xcc5e, 0x11d2, 0xa4, 0x34, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8);
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 */
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 */
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 += (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;
#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 *= (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 /* !__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 += (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
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 == (CONST D3DXPLANE&) const;
BOOL operator != (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 += (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;
#ifdef __cplusplus
extern "C" {
#endif
D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s);
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s);
FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex);
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation);
FLOAT WINAPI D3DXMatrixfDeterminant(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 *pm1, CONST D3DXMATRIX *pm2);
D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose(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 D3DXMatrixReflect(D3DXMATRIX *pout, CONST D3DXPLANE *pplane);
D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pv, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3DXQUATERNION *pq);
D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle);
D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, 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 *plight, CONST D3DXPLANE *pPlane);
D3DXMATRIX* WINAPI D3DXMatrixTransformation(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pscalingcenter, CONST D3DXQUATERNION *pscalingrotation, CONST D3DXVECTOR3 *pscaling, 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 D3DXVECTOR3 *pvpoint, CONST D3DXVECTOR3 *pvnormal);
D3DXPLANE* WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3);
D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, CONST D3DXPLANE *pp, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2);
D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, CONST D3DXPLANE *pp);
D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *pplane, CONST D3DXMATRIX *pm);
D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, FLOAT f, FLOAT g);
D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2);
D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);
D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle);
D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXMATRIX *pm);
D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll);
D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t);
D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *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 D3DXVECTOR2 *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 *pv3, FLOAT s);
D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, 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 D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm);
D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm);
D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g);
D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT s);
D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, 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 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld);
D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld);
D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *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 *pv3, FLOAT s);
D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3);
D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, 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
#define INTERFACE ID3DXMatrixStack
DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown)
{
STDMETHOD_(HRESULT,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_(LPD3DXMATRIX, GetTop)(THIS) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
#define ID3DXMatrixStack_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define ID3DXMatrixStack_AddRef(p) (p)->lpVtbl->AddRef(p)
#define ID3DXMatrixStack_Release(p) (p)->lpVtbl->Release(p)
#define ID3DXMatrixStack_Pop(p) (p)->lpVtbl->Pop(p)
#define ID3DXMatrixStack_Push(p) (p)->lpVtbl->Push(p)
#define ID3DXMatrixStack_LoadIdentity(p) (p)->lpVtbl->LoadIdentity(p)
#define ID3DXMatrixStack_LoadMatrix(p,a) (p)->lpVtbl->LoadMatrix(p,a)
#define ID3DXMatrixStack_MultMatrix(p,a) (p)->lpVtbl->MultMatrix(p,a)
#define ID3DXMatrixStack_MultMatrixLocal(p,a) (p)->lpVtbl->MultMatrixLocal(p,a)
#define ID3DXMatrixStack_RotateAxis(p,a,b) (p)->lpVtbl->RotateAxis(p,a,b)
#define ID3DXMatrixStack_RotateAxisLocal(p,a,b) (p)->lpVtbl->RotateAxisLocal(p,a,b)
#define ID3DXMatrixStack_RotateYawPitchRoll(p,a,b,c) (p)->lpVtbl->RotateYawPitchRoll(p,a,b,c)
#define ID3DXMatrixStack_RotateYawPitchRollLocal(p,a,b,c) (p)->lpVtbl->RotateYawPitchRollLocal(p,a,b,c)
#define ID3DXMatrixStack_Scale(p,a,b,c) (p)->lpVtbl->Scale(p,a,b,c)
#define ID3DXMatrixStack_ScaleLocal(p,a,b,c) (p)->lpVtbl->ScaleLocal(p,a,b,c)
#define ID3DXMatrixStack_Translate(p,a,b,c) (p)->lpVtbl->Translate(p,a,b,c)
#define ID3DXMatrixStack_TranslateLocal(p,a,b,c) (p)->lpVtbl->TranslateLocal(p,a,b,c)
#define ID3DXMatrixStack_GetTop(p) (p)->lpVtbl->GetTop(p)
#endif
#ifdef __cplusplus
extern "C" {
#endif
HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, LPD3DXMATRIXSTACK* ppstack);
#ifdef __cplusplus
}
#endif
#include <d3dx8math.inl>
#endif /* __D3DX8MATH_H__ */
/*
* 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, USA
*/
#ifndef __D3DX8MATH_INL__
#define __D3DX8MATH_INL__
/* constructors & operators */
#ifdef __cplusplus
inline D3DXVECTOR2::D3DXVECTOR2()
{
}
inline D3DXVECTOR2::D3DXVECTOR2(CONST FLOAT *pf)
{
if(!pf) return;
x = pf[0];
y = pf[1];
}
inline D3DXVECTOR2::D3DXVECTOR2(FLOAT fx, FLOAT fy)
{
x = fx;
y = fy;
}
inline D3DXVECTOR2::operator FLOAT* ()
{
return (FLOAT*)&x;
}
inline D3DXVECTOR2::operator CONST FLOAT* () const
{
return (CONST FLOAT*)&x;
}
inline D3DXVECTOR2& D3DXVECTOR2::operator += (CONST D3DXVECTOR2& v)
{
x += v.x;
y += v.y;
return *this;
}
inline D3DXVECTOR2& D3DXVECTOR2::operator -= (CONST D3DXVECTOR2& v)
{
x -= v.x;
y -= v.y;
return *this;
}
inline D3DXVECTOR2& D3DXVECTOR2::operator *= (FLOAT f)
{
x *= f;
y *= f;
return *this;
}
inline D3DXVECTOR2& D3DXVECTOR2::operator /= (FLOAT f)
{
x /= f;
y /= 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 == (CONST D3DXVECTOR2& v) const
{
return x == v.x && y == v.y;
}
inline BOOL D3DXVECTOR2::operator != (CONST D3DXVECTOR2& v) const
{
return x != v.x || y != v.y;
}
inline D3DXVECTOR3::D3DXVECTOR3()
{
}
inline D3DXVECTOR3::D3DXVECTOR3(CONST FLOAT *pf)
{
if(!pf) return;
x = pf[0];
y = pf[1];
z = pf[2];
}
inline D3DXVECTOR3::D3DXVECTOR3(CONST D3DVECTOR& v)
{
x = v.x;
y = v.y;
z = v.z;
}
inline D3DXVECTOR3::D3DXVECTOR3(FLOAT fx, FLOAT fy, FLOAT fz)
{
x = fx;
y = fy;
z = fz;
}
inline D3DXVECTOR3::operator FLOAT* ()
{
return (FLOAT*)&x;
}
inline D3DXVECTOR3::operator CONST FLOAT* () const
{
return (CONST FLOAT*)&x;
}
inline D3DXVECTOR3& D3DXVECTOR3::operator += (CONST D3DXVECTOR3& v)
{
x += v.x;
y += v.y;
z += v.z;
return *this;
}
inline D3DXVECTOR3& D3DXVECTOR3::operator -= (CONST D3DXVECTOR3& v)
{
x -= v.x;
y -= v.y;
z -= v.z;
return *this;
}
inline D3DXVECTOR3& D3DXVECTOR3::operator *= (FLOAT f)
{
x *= f;
y *= f;
z *= f;
return *this;
}
inline D3DXVECTOR3& D3DXVECTOR3::operator /= (FLOAT f)
{
x /= f;
y /= f;
z /= 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 == (CONST D3DXVECTOR3& v) const
{
return x == v.x && y == v.y && z == v.z;
}
inline BOOL D3DXVECTOR3::operator != (CONST D3DXVECTOR3& v) const
{
return x != v.x || y != v.y || z != v.z;
}
inline D3DXVECTOR4::D3DXVECTOR4()
{
}
inline D3DXVECTOR4::D3DXVECTOR4(CONST FLOAT *pf)
{
if(!pf) return;
x = pf[0];
y = pf[1];
z = pf[2];
w = pf[3];
}
inline D3DXVECTOR4::D3DXVECTOR4(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw)
{
x = fx;
y = fy;
z = fz;
w = fw;
}
inline D3DXVECTOR4::operator FLOAT* ()
{
return (FLOAT*)&x;
}
inline D3DXVECTOR4::operator CONST FLOAT* () const
{
return (CONST FLOAT*)&x;
}
inline D3DXVECTOR4& D3DXVECTOR4::operator += (CONST D3DXVECTOR4& v)
{
x += v.x;
y += v.y;
z += v.z;
w += v.w;
return *this;
}
inline D3DXVECTOR4& D3DXVECTOR4::operator -= (CONST D3DXVECTOR4& v)
{
x -= v.x;
y -= v.y;
z -= v.z;
w -= v.w;
return *this;
}
inline D3DXVECTOR4& D3DXVECTOR4::operator *= (FLOAT f)
{
x *= f;
y *= f;
z *= f;
w *= f;
return *this;
}
inline D3DXVECTOR4& D3DXVECTOR4::operator /= (FLOAT f)
{
x /= f;
y /= f;
z /= f;
w /= 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 == (CONST D3DXVECTOR4& v) const
{
return x == v.x && y == v.y && z == v.z && w == v.w;
}
inline BOOL D3DXVECTOR4::operator != (CONST D3DXVECTOR4& v) const
{
return x != v.x || y != v.y || z != v.z || w != 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 = f11; _12 = f12; _13 = f13; _14 = f14;
_21 = f21; _22 = f22; _23 = f23; _24 = f24;
_31 = f31; _32 = f32; _33 = f33; _34 = f34;
_41 = f41; _42 = f42; _43 = f43; _44 = 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 *= (CONST D3DXMATRIX& mat)
{
D3DXMatrixMultiply(this, this, &mat);
return *this;
}
inline D3DXMATRIX& D3DXMATRIX::operator += (CONST D3DXMATRIX& mat)
{
_11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14;
_21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24;
_31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34;
_41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44;
return *this;
}
inline D3DXMATRIX& D3DXMATRIX::operator -= (CONST D3DXMATRIX& mat)
{
_11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14;
_21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24;
_31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34;
_41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44;
return *this;
}
inline D3DXMATRIX& D3DXMATRIX::operator *= (FLOAT f)
{
_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;
return *this;
}
inline D3DXMATRIX& D3DXMATRIX::operator /= (FLOAT f)
{
FLOAT inv = 1.0f / f;
_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;
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 + mat._14,
_21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24,
_31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34,
_41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44);
}
inline D3DXMATRIX D3DXMATRIX::operator - (CONST D3DXMATRIX& mat) const
{
return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14,
_21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24,
_31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34,
_41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._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 = 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 == (CONST D3DXMATRIX& mat) const
{
return (memcmp(this, &mat, sizeof(D3DXMATRIX)) == 0);
}
inline BOOL D3DXMATRIX::operator != (CONST D3DXMATRIX& mat) const
{
return (memcmp(this, &mat, sizeof(D3DXMATRIX)) != 0);
}
inline D3DXQUATERNION::D3DXQUATERNION()
{
}
inline D3DXQUATERNION::D3DXQUATERNION(CONST FLOAT *pf)
{
if(!pf) return;
x = pf[0];
y = pf[1];
z = pf[2];
w = pf[3];
}
inline D3DXQUATERNION::D3DXQUATERNION(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw)
{
x = fx;
y = fy;
z = fz;
w = fw;
}
inline D3DXQUATERNION::operator FLOAT* ()
{
return (FLOAT*)&x;
}
inline D3DXQUATERNION::operator CONST FLOAT* () const
{
return (CONST FLOAT*)&x;
}
inline D3DXQUATERNION& D3DXQUATERNION::operator += (CONST D3DXQUATERNION& quat)
{
x += quat.x;
y += quat.y;
z += quat.z;
w += quat.w;
return *this;
}
inline D3DXQUATERNION& D3DXQUATERNION::operator -= (CONST D3DXQUATERNION& quat)
{
x -= quat.x;
y -= quat.y;
z -= quat.z;
w -= quat.w;
return *this;
}
/* TODO: uncomment this when D3DXQuaternionMultiply has been implemented
inline D3DXQUATERNION& D3DXQUATERNION::operator *= (CONST D3DXQUATERNION& quat)
{
D3DXQuaternionMultiply(this, this, &quat);
return *this;
}
*/
inline D3DXQUATERNION& D3DXQUATERNION::operator *= (FLOAT f)
{
x *= f;
y *= f;
z *= f;
w *= f;
return *this;
}
inline D3DXQUATERNION& D3DXQUATERNION::operator /= (FLOAT f)
{
FLOAT inv = 1.0f / f;
x *= inv;
y *= inv;
z *= inv;
w *= 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& quat) const
{
return D3DXQUATERNION(x + quat.x, y + quat.y, z + quat.z, w + quat.w);
}
inline D3DXQUATERNION D3DXQUATERNION::operator - (CONST D3DXQUATERNION& quat) 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& quat) 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 = 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 == (CONST D3DXQUATERNION& quat) const
{
return x == quat.x && y == quat.y && z == quat.z && w == quat.w;
}
inline BOOL D3DXQUATERNION::operator != (CONST D3DXQUATERNION& quat) const
{
return x != quat.x || y != quat.y || z != quat.z || w != quat.w;
}
inline D3DXPLANE::D3DXPLANE()
{
}
inline D3DXPLANE::D3DXPLANE(CONST FLOAT *pf)
{
if(!pf) return;
a = pf[0];
b = pf[1];
c = pf[2];
d = pf[3];
}
inline D3DXPLANE::D3DXPLANE(FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd)
{
a = fa;
b = fb;
c = fc;
d = 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 == (CONST D3DXPLANE& pl) const
{
return a == pl.a && b == pl.b && c == pl.c && d == pl.d;
}
inline BOOL D3DXPLANE::operator != (CONST D3DXPLANE& pl) const
{
return a != pl.a || b != pl.b || c != pl.c || d != pl.d;
}
inline D3DXCOLOR::D3DXCOLOR()
{
}
inline D3DXCOLOR::D3DXCOLOR(DWORD col)
{
CONST FLOAT f = 1.0f / 255.0f;
r = f * (FLOAT)(unsigned char)(col >> 16);
g = f * (FLOAT)(unsigned char)(col >> 8);
b = f * (FLOAT)(unsigned char)col;
a = f * (FLOAT)(unsigned char)(col >> 24);
}
inline D3DXCOLOR::D3DXCOLOR(CONST FLOAT *pf)
{
if(!pf) return;
r = pf[0];
g = pf[1];
b = pf[2];
a = pf[3];
}
inline D3DXCOLOR::D3DXCOLOR(CONST D3DCOLORVALUE& col)
{
r = col.r;
g = col.g;
b = col.b;
a = col.a;
}
inline D3DXCOLOR::D3DXCOLOR(FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa)
{
r = fr;
g = fg;
b = fb;
a = fa;
}
inline D3DXCOLOR::operator DWORD () const
{
DWORD _r = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (DWORD)(r * 255.0f + 0.5f);
DWORD _g = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (DWORD)(g * 255.0f + 0.5f);
DWORD _b = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (DWORD)(b * 255.0f + 0.5f);
DWORD _a = a >= 1.0f ? 0xff : a <= 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 += (CONST D3DXCOLOR& col)
{
r += col.r;
g += col.g;
b += col.b;
a += col.a;
return *this;
}
inline D3DXCOLOR& D3DXCOLOR::operator -= (CONST D3DXCOLOR& col)
{
r -= col.r;
g -= col.g;
b -= col.b;
a -= col.a;
return *this;
}
inline D3DXCOLOR& D3DXCOLOR::operator *= (FLOAT f)
{
r *= f;
g *= f;
b *= f;
a *= f;
return *this;
}
inline D3DXCOLOR& D3DXCOLOR::operator /= (FLOAT f)
{
FLOAT inv = 1.0f / f;
r *= inv;
g *= inv;
b *= inv;
a *= 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 = 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 == (CONST D3DXCOLOR& col) const
{
return r == col.r && g == col.g && b == col.b && a == col.a;
}
inline BOOL D3DXCOLOR::operator != (CONST D3DXCOLOR& col) const
{
return r != col.r || g != col.g || b != col.b || a != 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 = (pc1->r) + (pc2->r);
pout->g = (pc1->g) + (pc2->g);
pout->b = (pc1->b) + (pc2->b);
pout->a = (pc1->a) + (pc2->a);
return pout;
}
static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2, FLOAT s)
{
if ( !pout || !pc1 || !pc2 ) return NULL;
pout->r = (1-s) * (pc1->r) + s *(pc2->r);
pout->g = (1-s) * (pc1->g) + s *(pc2->g);
pout->b = (1-s) * (pc1->b) + s *(pc2->b);
pout->a = (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 = (pc1->r) * (pc2->r);
pout->g = (pc1->g) * (pc2->g);
pout->b = (pc1->b) * (pc2->b);
pout->a = (pc1->a) * (pc2->a);
return pout;
}
static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc)
{
if ( !pout || !pc ) return NULL;
pout->r = 1.0f - pc->r;
pout->g = 1.0f - pc->g;
pout->b = 1.0f - pc->b;
pout->a = pc->a;
return pout;
}
static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s)
{
if ( !pout || !pc ) return NULL;
pout->r = s* (pc->r);
pout->g = s* (pc->g);
pout->b = s* (pc->b);
pout->a = 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 = (pc1->r) - (pc2->r);
pout->g = (pc1->g) - (pc2->g);
pout->b = (pc1->b) - (pc2->b);
pout->a = (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 = pv1->x + pv2->x;
pout->y = 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 D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (1-s) * (pv1->x) + s * (pv2->x);
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
return pout;
}
static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = max(pv1->x , pv2->x);
pout->y = max(pv1->y , pv2->y);
return pout;
}
static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = min(pv1->x , pv2->x);
pout->y = min(pv1->y , pv2->y);
return pout;
}
static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
pout->x = s * (pv->x);
pout->y = s * (pv->y);
return pout;
}
static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = pv1->x - pv2->x;
pout->y = 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 = pv1->x + pv2->x;
pout->y = pv1->y + pv2->y;
pout->z = pv1->z + pv2->z;
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
pout->y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
pout->z = (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 D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (1-s) * (pv1->x) + s * (pv2->x);
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
pout->z = (1-s) * (pv1->z) + s * (pv2->z);
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = max(pv1->x , pv2->x);
pout->y = max(pv1->y , pv2->y);
pout->z = max(pv1->z , pv2->z);
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = min(pv1->x , pv2->x);
pout->y = min(pv1->y , pv2->y);
pout->z = min(pv1->z , pv2->z);
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
pout->x = s * (pv->x);
pout->y = s * (pv->y);
pout->z = s * (pv->z);
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = pv1->x - pv2->x;
pout->y = pv1->y - pv2->y;
pout->z = 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 = pv1->x + pv2->x;
pout->y = pv1->y + pv2->y;
pout->z = pv1->z + pv2->z;
pout->w = 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 D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (1-s) * (pv1->x) + s * (pv2->x);
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
pout->z = (1-s) * (pv1->z) + s * (pv2->z);
pout->w = (1-s) * (pv1->w) + s * (pv2->w);
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = max(pv1->x , pv2->x);
pout->y = max(pv1->y , pv2->y);
pout->z = max(pv1->z , pv2->z);
pout->w = max(pv1->w , pv2->w);
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = min(pv1->x , pv2->x);
pout->y = min(pv1->y , pv2->y);
pout->z = min(pv1->z , pv2->z);
pout->w = min(pv1->w , pv2->w);
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
pout->x = s * (pv->x);
pout->y = s * (pv->y);
pout->z = s * (pv->z);
pout->w = s * (pv->w);
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = pv1->x - pv2->x;
pout->y = pv1->y - pv2->y;
pout->z = pv1->z - pv2->z;
pout->w = 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] = 0.0f;
D3DX_U(*pout).m[0][2] = 0.0f;
D3DX_U(*pout).m[0][3] = 0.0f;
D3DX_U(*pout).m[1][0] = 0.0f;
D3DX_U(*pout).m[1][2] = 0.0f;
D3DX_U(*pout).m[1][3] = 0.0f;
D3DX_U(*pout).m[2][0] = 0.0f;
D3DX_U(*pout).m[2][1] = 0.0f;
D3DX_U(*pout).m[2][3] = 0.0f;
D3DX_U(*pout).m[3][0] = 0.0f;
D3DX_U(*pout).m[3][1] = 0.0f;
D3DX_U(*pout).m[3][2] = 0.0f;
D3DX_U(*pout).m[0][0] = 1.0f;
D3DX_U(*pout).m[1][1] = 1.0f;
D3DX_U(*pout).m[2][2] = 1.0f;
D3DX_U(*pout).m[3][3] = 1.0f;
return pout;
}
static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
{
int i,j;
D3DXMATRIX testmatrix;
if ( !pm ) return FALSE;
D3DXMatrixIdentity(&testmatrix);
for (i=0; i<4; i++)
{
for (j=0; j<4; j++)
{
if ( D3DX_U(*pm).m[i][j] != D3DX_U(testmatrix).m[i][j] ) return FALSE;
}
}
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) + (pp->d) * (pv->w) );
}
static inline FLOAT D3DXPlaneDotCoord(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) + (pp->d) );
}
static inline FLOAT D3DXPlaneDotNormal(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) );
}
/*__________________D3DXQUATERNION____________________*/
static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
{
if ( !pout || !pq) return NULL;
pout->x = -pq->x;
pout->y = -pq->y;
pout->z = -pq->z;
pout->w = pq->w;
return pout;
}
static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *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 = 0.0f;
pout->y = 0.0f;
pout->z = 0.0f;
pout->w = 1.0f;
return pout;
}
static inline BOOL D3DXQuaternionIsIdentity(D3DXQUATERNION *pq)
{
if ( !pq) return FALSE;
return ( (pq->x == 0.0f) && (pq->y == 0.0f) && (pq->z == 0.0f) && (pq->w == 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
/*
* Copyright (C) 2008 Francois Gouget
*
* 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
*/
#ifndef __WINE_D3DX8MESH_H
#define __WINE_D3DX8MESH_H
#include <d3dx8.h>
#include <dxfile.h>
#ifdef __cplusplus
extern "C" {
#endif
HRESULT WINAPI D3DXCreateBuffer(DWORD,LPD3DXBUFFER*);
UINT WINAPI D3DXGetFVFVertexSize(DWORD);
BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *);
BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *,FLOAT,CONST D3DXVECTOR3 *,CONST D3DXVECTOR3 *);
BOOL CDECL D3DXIntersectTri(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, FLOAT *, FLOAT *, FLOAT *);
HRESULT WINAPI D3DXComputeBoundingBox(PVOID, DWORD, DWORD, D3DXVECTOR3 *, D3DXVECTOR3 *);
HRESULT WINAPI D3DXComputeBoundingSphere(PVOID, DWORD, DWORD, D3DXVECTOR3 *, FLOAT *);
#ifdef __cplusplus
}
#endif
#endif /* __WINE_D3DX8MESH_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment