source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/d3dx9math.h@ 1171

Last change on this file since 1171 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 23.5 KB
RevLine 
[1166]1#undef INTERFACE
2/*
3 * Copyright (C) 2007 David Adam
4 * Copyright (C) 2007 Tony Wasserka
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "d3dx9.h"
22
23#ifndef __D3DX9MATH_H__
24#define __D3DX9MATH_H__
25
26#include <math.h>
27
28#define D3DX_PI ((FLOAT)3.141592654)
29#define D3DX_1BYPI ((FLOAT)0.318309886)
30
31#define D3DXSH_MINORDER 2
32#define D3DXSH_MAXORDER 6
33
34#define D3DXToRadian(degree) ((degree) * (D3DX_PI / 180.0f))
35#define D3DXToDegree(radian) ((radian) * (180.0f / D3DX_PI))
36
37typedef struct D3DXVECTOR2
38{
39#ifdef __cplusplus
40 D3DXVECTOR2();
41 D3DXVECTOR2(const FLOAT *pf);
42 D3DXVECTOR2(FLOAT fx, FLOAT fy);
43
44 operator FLOAT* ();
45 operator const FLOAT* () const;
46
47 D3DXVECTOR2& operator += (const D3DXVECTOR2&);
48 D3DXVECTOR2& operator -= (const D3DXVECTOR2&);
49 D3DXVECTOR2& operator *= (FLOAT);
50 D3DXVECTOR2& operator /= (FLOAT);
51
52 D3DXVECTOR2 operator + () const;
53 D3DXVECTOR2 operator - () const;
54
55 D3DXVECTOR2 operator + (const D3DXVECTOR2&) const;
56 D3DXVECTOR2 operator - (const D3DXVECTOR2&) const;
57 D3DXVECTOR2 operator * (FLOAT) const;
58 D3DXVECTOR2 operator / (FLOAT) const;
59
60 friend D3DXVECTOR2 operator * (FLOAT, const D3DXVECTOR2&);
61
62 WINBOOL operator == (const D3DXVECTOR2&) const;
63 WINBOOL operator != (const D3DXVECTOR2&) const;
64#endif /* __cplusplus */
65 FLOAT x, y;
66} D3DXVECTOR2, *LPD3DXVECTOR2;
67
68#ifdef __cplusplus
69typedef struct D3DXVECTOR3 : public D3DVECTOR
70{
71 D3DXVECTOR3();
72 D3DXVECTOR3(const FLOAT *pf);
73 D3DXVECTOR3(const D3DVECTOR& v);
74 D3DXVECTOR3(FLOAT fx, FLOAT fy, FLOAT fz);
75
76 operator FLOAT* ();
77 operator const FLOAT* () const;
78
79 D3DXVECTOR3& operator += (const D3DXVECTOR3&);
80 D3DXVECTOR3& operator -= (const D3DXVECTOR3&);
81 D3DXVECTOR3& operator *= (FLOAT);
82 D3DXVECTOR3& operator /= (FLOAT);
83
84 D3DXVECTOR3 operator + () const;
85 D3DXVECTOR3 operator - () const;
86
87 D3DXVECTOR3 operator + (const D3DXVECTOR3&) const;
88 D3DXVECTOR3 operator - (const D3DXVECTOR3&) const;
89 D3DXVECTOR3 operator * (FLOAT) const;
90 D3DXVECTOR3 operator / (FLOAT) const;
91
92 friend D3DXVECTOR3 operator * (FLOAT, const struct D3DXVECTOR3&);
93
94 WINBOOL operator == (const D3DXVECTOR3&) const;
95 WINBOOL operator != (const D3DXVECTOR3&) const;
96} D3DXVECTOR3, *LPD3DXVECTOR3;
97#else /* !__cplusplus */
98typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3;
99#endif /* !__cplusplus */
100
101typedef struct D3DXVECTOR4
102{
103#ifdef __cplusplus
104 D3DXVECTOR4();
105 D3DXVECTOR4(const FLOAT *pf);
106 D3DXVECTOR4(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw);
107
108 operator FLOAT* ();
109 operator const FLOAT* () const;
110
111 D3DXVECTOR4& operator += (const D3DXVECTOR4&);
112 D3DXVECTOR4& operator -= (const D3DXVECTOR4&);
113 D3DXVECTOR4& operator *= (FLOAT);
114 D3DXVECTOR4& operator /= (FLOAT);
115
116 D3DXVECTOR4 operator + () const;
117 D3DXVECTOR4 operator - () const;
118
119 D3DXVECTOR4 operator + (const D3DXVECTOR4&) const;
120 D3DXVECTOR4 operator - (const D3DXVECTOR4&) const;
121 D3DXVECTOR4 operator * (FLOAT) const;
122 D3DXVECTOR4 operator / (FLOAT) const;
123
124 friend D3DXVECTOR4 operator * (FLOAT, const D3DXVECTOR4&);
125
126 WINBOOL operator == (const D3DXVECTOR4&) const;
127 WINBOOL operator != (const D3DXVECTOR4&) const;
128#endif /* __cplusplus */
129 FLOAT x, y, z, w;
130} D3DXVECTOR4, *LPD3DXVECTOR4;
131
132#ifdef __cplusplus
133typedef struct D3DXMATRIX : public D3DMATRIX
134{
135 D3DXMATRIX();
136 D3DXMATRIX(const FLOAT *pf);
137 D3DXMATRIX(const D3DMATRIX& mat);
138 D3DXMATRIX(FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14,
139 FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24,
140 FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34,
141 FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44);
142
143 FLOAT& operator () (UINT row, UINT col);
144 FLOAT operator () (UINT row, UINT col) const;
145
146 operator FLOAT* ();
147 operator const FLOAT* () const;
148
149 D3DXMATRIX& operator *= (const D3DXMATRIX&);
150 D3DXMATRIX& operator += (const D3DXMATRIX&);
151 D3DXMATRIX& operator -= (const D3DXMATRIX&);
152 D3DXMATRIX& operator *= (FLOAT);
153 D3DXMATRIX& operator /= (FLOAT);
154
155 D3DXMATRIX operator + () const;
156 D3DXMATRIX operator - () const;
157
158 D3DXMATRIX operator * (const D3DXMATRIX&) const;
159 D3DXMATRIX operator + (const D3DXMATRIX&) const;
160 D3DXMATRIX operator - (const D3DXMATRIX&) const;
161 D3DXMATRIX operator * (FLOAT) const;
162 D3DXMATRIX operator / (FLOAT) const;
163
164 friend D3DXMATRIX operator * (FLOAT, const D3DXMATRIX&);
165
166 WINBOOL operator == (const D3DXMATRIX&) const;
167 WINBOOL operator != (const D3DXMATRIX&) const;
168} D3DXMATRIX, *LPD3DXMATRIX;
169#else /* !__cplusplus */
170typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
171#endif /* !__cplusplus */
172
173typedef struct D3DXQUATERNION
174{
175#ifdef __cplusplus
176 D3DXQUATERNION();
177 D3DXQUATERNION(const FLOAT *pf);
178 D3DXQUATERNION(FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw);
179
180 operator FLOAT* ();
181 operator const FLOAT* () const;
182
183 D3DXQUATERNION& operator += (const D3DXQUATERNION&);
184 D3DXQUATERNION& operator -= (const D3DXQUATERNION&);
185 D3DXQUATERNION& operator *= (const D3DXQUATERNION&);
186 D3DXQUATERNION& operator *= (FLOAT);
187 D3DXQUATERNION& operator /= (FLOAT);
188
189 D3DXQUATERNION operator + () const;
190 D3DXQUATERNION operator - () const;
191
192 D3DXQUATERNION operator + (const D3DXQUATERNION&) const;
193 D3DXQUATERNION operator - (const D3DXQUATERNION&) const;
194 D3DXQUATERNION operator * (const D3DXQUATERNION&) const;
195 D3DXQUATERNION operator * (FLOAT) const;
196 D3DXQUATERNION operator / (FLOAT) const;
197
198 friend D3DXQUATERNION operator * (FLOAT, const D3DXQUATERNION&);
199
200 WINBOOL operator == (const D3DXQUATERNION&) const;
201 WINBOOL operator != (const D3DXQUATERNION&) const;
202#endif /* __cplusplus */
203 FLOAT x, y, z, w;
204} D3DXQUATERNION, *LPD3DXQUATERNION;
205
206typedef struct D3DXPLANE
207{
208#ifdef __cplusplus
209 D3DXPLANE();
210 D3DXPLANE(const FLOAT *pf);
211 D3DXPLANE(FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd);
212
213 operator FLOAT* ();
214 operator const FLOAT* () const;
215
216 D3DXPLANE operator + () const;
217 D3DXPLANE operator - () const;
218
219 WINBOOL operator == (const D3DXPLANE&) const;
220 WINBOOL operator != (const D3DXPLANE&) const;
221#endif /* __cplusplus */
222 FLOAT a, b, c, d;
223} D3DXPLANE, *LPD3DXPLANE;
224
225typedef struct D3DXCOLOR
226{
227#ifdef __cplusplus
228 D3DXCOLOR();
229 D3DXCOLOR(DWORD col);
230 D3DXCOLOR(const FLOAT *pf);
231 D3DXCOLOR(const D3DCOLORVALUE& col);
232 D3DXCOLOR(FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa);
233
234 operator DWORD () const;
235
236 operator FLOAT* ();
237 operator const FLOAT* () const;
238
239 operator D3DCOLORVALUE* ();
240 operator const D3DCOLORVALUE* () const;
241
242 operator D3DCOLORVALUE& ();
243 operator const D3DCOLORVALUE& () const;
244
245 D3DXCOLOR& operator += (const D3DXCOLOR&);
246 D3DXCOLOR& operator -= (const D3DXCOLOR&);
247 D3DXCOLOR& operator *= (FLOAT);
248 D3DXCOLOR& operator /= (FLOAT);
249
250 D3DXCOLOR operator + () const;
251 D3DXCOLOR operator - () const;
252
253 D3DXCOLOR operator + (const D3DXCOLOR&) const;
254 D3DXCOLOR operator - (const D3DXCOLOR&) const;
255 D3DXCOLOR operator * (FLOAT) const;
256 D3DXCOLOR operator / (FLOAT) const;
257
258 friend D3DXCOLOR operator * (FLOAT, const D3DXCOLOR&);
259
260 WINBOOL operator == (const D3DXCOLOR&) const;
261 WINBOOL operator != (const D3DXCOLOR&) const;
262#endif /* __cplusplus */
263 FLOAT r, g, b, a;
264} D3DXCOLOR, *LPD3DXCOLOR;
265
266typedef struct D3DXFLOAT16
267{
268#ifdef __cplusplus
269 D3DXFLOAT16();
270 D3DXFLOAT16(FLOAT f);
271 D3DXFLOAT16(const D3DXFLOAT16 &f);
272
273 operator FLOAT ();
274
275 WINBOOL operator == (const D3DXFLOAT16 &) const;
276 WINBOOL operator != (const D3DXFLOAT16 &) const;
277#endif /* __cplusplus */
278 WORD value;
279} D3DXFLOAT16, *LPD3DXFLOAT16;
280
281#ifdef __cplusplus
282extern "C" {
283#endif
284
285D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s);
286D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s);
287
288FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex);
289
290D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, const D3DXVECTOR3 *rotationcenter, const D3DXQUATERNION *rotation,
291 const D3DXVECTOR3 *translation);
292D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D(D3DXMATRIX *pout, FLOAT scaling, const D3DXVECTOR2 *protationcenter, FLOAT rotation,
293 const D3DXVECTOR2 *ptranslation);
294HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutrotation, D3DXVECTOR3 *pouttranslation, const D3DXMATRIX *pm);
295FLOAT WINAPI D3DXMatrixDeterminant(const D3DXMATRIX *pm);
296D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm);
297D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *pout, const D3DXVECTOR3 *peye, const D3DXVECTOR3 *pat, const D3DXVECTOR3 *pup);
298D3DXMATRIX* WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *pout, const D3DXVECTOR3 *peye, const D3DXVECTOR3 *pat, const D3DXVECTOR3 *pup);
299D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2);
300D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2);
301D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
302D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
303D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
304D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
305D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf);
306D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf);
307D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
308D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
309D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
310D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
311D3DXMATRIX* WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, const D3DXPLANE *pplane);
312D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, const D3DXVECTOR3 *pv, FLOAT angle);
313D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, const D3DXQUATERNION *pq);
314D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle);
315D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle);
316D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, FLOAT pitch, FLOAT roll);
317D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle);
318D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz);
319D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, const D3DXVECTOR4 *plight, const D3DXPLANE *pPlane);
320D3DXMATRIX* WINAPI D3DXMatrixTransformation(D3DXMATRIX *pout, const D3DXVECTOR3 *pscalingcenter, const D3DXQUATERNION *pscalingrotation, const D3DXVECTOR3 *pscaling, const D3DXVECTOR3 *protationcenter,
321 const D3DXQUATERNION *protation, const D3DXVECTOR3 *ptranslation);
322D3DXMATRIX* WINAPI D3DXMatrixTransformation2D(D3DXMATRIX *pout, const D3DXVECTOR2 *pscalingcenter, FLOAT scalingrotation, const D3DXVECTOR2 *pscaling,
323 const D3DXVECTOR2 *protationcenter, FLOAT rotation, const D3DXVECTOR2 *ptranslation);
324D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z);
325D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, const D3DXMATRIX *pm);
326
327D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, const D3DXVECTOR3 *pvpoint, const D3DXVECTOR3 *pvnormal);
328D3DXPLANE* WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3);
329D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, const D3DXPLANE *pp, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2);
330D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, const D3DXPLANE *pp);
331D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm);
332D3DXPLANE* WINAPI D3DXPlaneTransformArray(D3DXPLANE *pout, UINT outstride, const D3DXPLANE *pplane, UINT pstride, const D3DXMATRIX *pm, UINT n);
333
334D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, FLOAT f, FLOAT g);
335D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, const D3DXQUATERNION *pq);
336D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, const D3DXQUATERNION *pq);
337D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, const D3DXQUATERNION *pq);
338D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2);
339D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, const D3DXQUATERNION *pq);
340D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, const D3DXVECTOR3 *pv, FLOAT angle);
341D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, const D3DXMATRIX *pm);
342D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll);
343D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, FLOAT t);
344D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3,
345 const D3DXQUATERNION *pq4, FLOAT t);
346void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, const D3DXQUATERNION *pq0,
347 const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3);
348void WINAPI D3DXQuaternionToAxisAngle(const D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle);
349
350D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT f, FLOAT g);
351D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv0, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT s);
352D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pt1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pt2, FLOAT s);
353D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv);
354D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm);
355D3DXVECTOR4* WINAPI D3DXVec2TransformArray(D3DXVECTOR4 *pout, UINT outstride, const D3DXVECTOR2 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
356D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm);
357D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray(D3DXVECTOR2 *pout, UINT outstride, const D3DXVECTOR2 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
358D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm);
359D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray(D3DXVECTOR2 *pout, UINT outstride, const D3DXVECTOR2 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
360
361D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT f, FLOAT g);
362D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv0, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT s);
363D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pt1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pt2, FLOAT s);
364D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv);
365D3DXVECTOR3* WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection,
366 const D3DXMATRIX *pview, const D3DXMATRIX *pworld);
367D3DXVECTOR3* WINAPI D3DXVec3ProjectArray(D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DVIEWPORT9 *pviewport,
368 const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld, UINT n);
369D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm);
370D3DXVECTOR4* WINAPI D3DXVec3TransformArray(D3DXVECTOR4 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
371D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm);
372D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray(D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
373D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm);
374D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray(D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
375D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection,
376 const D3DXMATRIX *pview, const D3DXMATRIX *pworld);
377D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray(D3DXVECTOR3 *pout, UINT outstride, const D3DXVECTOR3 *pv, UINT vstride, const D3DVIEWPORT9 *pviewport,
378 const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld, UINT n);
379D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3, FLOAT f, FLOAT g);
380D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv0, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3, FLOAT s);
381D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pv3);
382D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pt1, const D3DXVECTOR4 *pv2, const D3DXVECTOR4 *pt2, FLOAT s);
383D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv);
384D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, const D3DXMATRIX *pm);
385D3DXVECTOR4* WINAPI D3DXVec4TransformArray(D3DXVECTOR4 *pout, UINT outstride, const D3DXVECTOR4 *pv, UINT vstride, const D3DXMATRIX *pm, UINT n);
386
387D3DXFLOAT16 *WINAPI D3DXFloat32To16Array(D3DXFLOAT16 *pout, const FLOAT *pin, UINT n);
388FLOAT *WINAPI D3DXFloat16To32Array(FLOAT *pout, const D3DXFLOAT16 *pin, UINT n);
389
390FLOAT* WINAPI D3DXSHAdd(FLOAT *out, UINT order, const FLOAT *a, const FLOAT *b);
391FLOAT WINAPI D3DXSHDot(UINT order, const FLOAT *a, const FLOAT *b);
392HRESULT WINAPI D3DXSHEvalConeLight(UINT order, const D3DXVECTOR3 *dir, FLOAT radius, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout);
393FLOAT* WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir);
394HRESULT WINAPI D3DXSHEvalDirectionalLight(UINT order, const D3DXVECTOR3 *dir, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout);
395HRESULT WINAPI D3DXSHEvalHemisphereLight(UINT order, const D3DXVECTOR3 *dir, D3DXCOLOR top, D3DXCOLOR bottom, FLOAT *rout, FLOAT *gout, FLOAT *bout);
396HRESULT WINAPI D3DXSHEvalSphericalLight(UINT order, const D3DXVECTOR3 *dir, FLOAT radius, FLOAT Rintensity, FLOAT Gintensity, FLOAT Bintensity, FLOAT *rout, FLOAT *gout, FLOAT *bout);
397FLOAT* WINAPI D3DXSHMultiply2(FLOAT *out, const FLOAT *a, const FLOAT *b);
398FLOAT* WINAPI D3DXSHMultiply3(FLOAT *out, const FLOAT *a, const FLOAT *b);
399FLOAT* WINAPI D3DXSHMultiply4(FLOAT *out, const FLOAT *a, const FLOAT *b);
400FLOAT* WINAPI D3DXSHRotate(FLOAT *out, UINT order, const D3DXMATRIX *matrix, const FLOAT *in);
401FLOAT* WINAPI D3DXSHRotateZ(FLOAT *out, UINT order, FLOAT angle, const FLOAT *in);
402FLOAT* WINAPI D3DXSHScale(FLOAT *out, UINT order, const FLOAT *a, const FLOAT scale);
403
404#ifdef __cplusplus
405}
406#endif
407
408typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK;
409
410DEFINE_GUID(IID_ID3DXMatrixStack,
4110xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85);
412
413#undef INTERFACE
414#define INTERFACE ID3DXMatrixStack
415
416DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown)
417{
418 STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE;
419 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
420 STDMETHOD_(ULONG,Release)(THIS) PURE;
421 STDMETHOD(Pop)(THIS) PURE;
422 STDMETHOD(Push)(THIS) PURE;
423 STDMETHOD(LoadIdentity)(THIS) PURE;
424 STDMETHOD(LoadMatrix)(THIS_ const D3DXMATRIX* pM ) PURE;
425 STDMETHOD(MultMatrix)(THIS_ const D3DXMATRIX* pM ) PURE;
426 STDMETHOD(MultMatrixLocal)(THIS_ const D3DXMATRIX* pM ) PURE;
427 STDMETHOD(RotateAxis)(THIS_ const D3DXVECTOR3* pV, FLOAT Angle) PURE;
428 STDMETHOD(RotateAxisLocal)(THIS_ const D3DXVECTOR3* pV, FLOAT Angle) PURE;
429 STDMETHOD(RotateYawPitchRoll)(THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE;
430 STDMETHOD(RotateYawPitchRollLocal)(THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE;
431 STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
432 STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
433 STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE;
434 STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE;
435 STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE;
436};
437
438#undef INTERFACE
439
440#if !defined(__cplusplus) || defined(CINTERFACE)
441
442#define ID3DXMatrixStack_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
443#define ID3DXMatrixStack_AddRef(p) (p)->lpVtbl->AddRef(p)
444#define ID3DXMatrixStack_Release(p) (p)->lpVtbl->Release(p)
445#define ID3DXMatrixStack_Pop(p) (p)->lpVtbl->Pop(p)
446#define ID3DXMatrixStack_Push(p) (p)->lpVtbl->Push(p)
447#define ID3DXMatrixStack_LoadIdentity(p) (p)->lpVtbl->LoadIdentity(p)
448#define ID3DXMatrixStack_LoadMatrix(p,a) (p)->lpVtbl->LoadMatrix(p,a)
449#define ID3DXMatrixStack_MultMatrix(p,a) (p)->lpVtbl->MultMatrix(p,a)
450#define ID3DXMatrixStack_MultMatrixLocal(p,a) (p)->lpVtbl->MultMatrixLocal(p,a)
451#define ID3DXMatrixStack_RotateAxis(p,a,b) (p)->lpVtbl->RotateAxis(p,a,b)
452#define ID3DXMatrixStack_RotateAxisLocal(p,a,b) (p)->lpVtbl->RotateAxisLocal(p,a,b)
453#define ID3DXMatrixStack_RotateYawPitchRoll(p,a,b,c) (p)->lpVtbl->RotateYawPitchRoll(p,a,b,c)
454#define ID3DXMatrixStack_RotateYawPitchRollLocal(p,a,b,c) (p)->lpVtbl->RotateYawPitchRollLocal(p,a,b,c)
455#define ID3DXMatrixStack_Scale(p,a,b,c) (p)->lpVtbl->Scale(p,a,b,c)
456#define ID3DXMatrixStack_ScaleLocal(p,a,b,c) (p)->lpVtbl->ScaleLocal(p,a,b,c)
457#define ID3DXMatrixStack_Translate(p,a,b,c) (p)->lpVtbl->Translate(p,a,b,c)
458#define ID3DXMatrixStack_TranslateLocal(p,a,b,c) (p)->lpVtbl->TranslateLocal(p,a,b,c)
459#define ID3DXMatrixStack_GetTop(p) (p)->lpVtbl->GetTop(p)
460
461#endif
462
463#ifdef __cplusplus
464extern "C" {
465#endif
466
467HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, ID3DXMatrixStack **stack);
468
469#ifdef __cplusplus
470}
471#endif
472
473#include "d3dx9math.inl"
474
475#endif /* __D3DX9MATH_H__ */
Note: See TracBrowser for help on using the repository browser.