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