ReactOS 0.4.17-dev-934-g091855f
d3dx10math.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Alistair Leslie-Hughes
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "d3dx10.h"
20
21/* This guard is the same as D3DX9 to prevent double-inclusion */
22#ifndef __D3DX9MATH_H__
23#define __D3DX9MATH_H__
24
25#include <math.h>
26
27#ifndef D3DVECTOR_DEFINED
28#define D3DVECTOR_DEFINED
29typedef struct _D3DVECTOR
30{
31 float x;
32 float y;
33 float z;
34} D3DVECTOR;
35#endif
36
37#ifndef D3DMATRIX_DEFINED
38#define D3DMATRIX_DEFINED
39typedef struct _D3DMATRIX
40{
41 union
42 {
43 struct
44 {
45 float _11, _12, _13, _14;
46 float _21, _22, _23, _24;
47 float _31, _32, _33, _34;
48 float _41, _42, _43, _44;
49 };
50 float m[4][4];
51 };
52} D3DMATRIX;
53#endif
54
56{
62
63typedef struct D3DXFLOAT16
64{
65#ifdef __cplusplus
67 D3DXFLOAT16(float f);
69
70 operator float();
71
72 BOOL operator==(const D3DXFLOAT16 &f) const;
73 BOOL operator!=(const D3DXFLOAT16 &f) const;
74#endif
75 WORD value;
77
78typedef struct D3DXCOLOR
79{
80#ifdef __cplusplus
81public:
82 D3DXCOLOR(){};
84 D3DXCOLOR(const float *color);
86 D3DXCOLOR(float r, float g, float b, float a);
87
88 operator UINT() const;
89 operator float *();
90 operator const float *() const;
91
94 D3DXCOLOR & operator*=(float n);
95 D3DXCOLOR & operator/=(float n);
96
97 D3DXCOLOR operator+() const;
98 D3DXCOLOR operator-() const;
99
100 D3DXCOLOR operator+(const D3DXCOLOR &color) const;
101 D3DXCOLOR operator-(const D3DXCOLOR &color) const;
102 D3DXCOLOR operator*(float n) const;
103 D3DXCOLOR operator/(float n) const;
104
105 friend D3DXCOLOR operator*(float n, const D3DXCOLOR &color);
106
107 BOOL operator==(const D3DXCOLOR &color) const;
108 BOOL operator!=(const D3DXCOLOR &color) const;
109#endif
110 float r, g, b, a;
112
113typedef struct D3DXVECTOR2
114{
115#ifdef __cplusplus
116 D3DXVECTOR2() {};
117 D3DXVECTOR2(const float *pf);
118 D3DXVECTOR2(float fx, float fy);
119
120 operator float* ();
121 operator const float* () const;
122
124 D3DXVECTOR2& operator -= (const D3DXVECTOR2&);
125 D3DXVECTOR2& operator *= (float);
126 D3DXVECTOR2& operator /= (float);
127
128 D3DXVECTOR2 operator + () const;
129 D3DXVECTOR2 operator - () const;
130
131 D3DXVECTOR2 operator + (const D3DXVECTOR2&) const;
132 D3DXVECTOR2 operator - (const D3DXVECTOR2&) const;
133 D3DXVECTOR2 operator * (float) const;
134 D3DXVECTOR2 operator / (float) const;
135
136 friend D3DXVECTOR2 operator * (float, const D3DXVECTOR2&);
137
138 BOOL operator == (const D3DXVECTOR2&) const;
139 BOOL operator != (const D3DXVECTOR2&) const;
140#endif /* __cplusplus */
141 float x, y;
143
144#ifdef __cplusplus
145typedef struct D3DXVECTOR3 : public D3DVECTOR
146{
147 D3DXVECTOR3() {};
148 D3DXVECTOR3(const float *pf);
149 D3DXVECTOR3(const D3DVECTOR& v);
150 D3DXVECTOR3(float fx, float fy, float fz);
151
152 operator float* ();
153 operator const float* () const;
154
156 D3DXVECTOR3& operator -= (const D3DXVECTOR3&);
157 D3DXVECTOR3& operator *= (float);
158 D3DXVECTOR3& operator /= (float);
159
160 D3DXVECTOR3 operator + () const;
161 D3DXVECTOR3 operator - () const;
162
163 D3DXVECTOR3 operator + (const D3DXVECTOR3&) const;
164 D3DXVECTOR3 operator - (const D3DXVECTOR3&) const;
165 D3DXVECTOR3 operator * (float) const;
166 D3DXVECTOR3 operator / (float) const;
167
168 friend D3DXVECTOR3 operator * (float, const struct D3DXVECTOR3&);
169
170 BOOL operator == (const D3DXVECTOR3&) const;
171 BOOL operator != (const D3DXVECTOR3&) const;
173#else /* !__cplusplus */
175#endif /* !__cplusplus */
176
177typedef struct D3DXVECTOR4
178{
179#ifdef __cplusplus
180 D3DXVECTOR4() {};
181 D3DXVECTOR4(const float *pf);
182 D3DXVECTOR4(float fx, float fy, float fz, float fw);
183
184 operator float* ();
185 operator const float* () const;
186
188 D3DXVECTOR4& operator -= (const D3DXVECTOR4&);
189 D3DXVECTOR4& operator *= (float);
190 D3DXVECTOR4& operator /= (float);
191
192 D3DXVECTOR4 operator + () const;
193 D3DXVECTOR4 operator - () const;
194
195 D3DXVECTOR4 operator + (const D3DXVECTOR4&) const;
196 D3DXVECTOR4 operator - (const D3DXVECTOR4&) const;
197 D3DXVECTOR4 operator * (float) const;
198 D3DXVECTOR4 operator / (float) const;
199
200 friend D3DXVECTOR4 operator * (float, const D3DXVECTOR4&);
201
202 BOOL operator == (const D3DXVECTOR4&) const;
203 BOOL operator != (const D3DXVECTOR4&) const;
204#endif /* __cplusplus */
205 float x, y, z, w;
207
208#ifdef __cplusplus
209typedef struct D3DXMATRIX : public D3DMATRIX
210{
211 D3DXMATRIX() {};
212 D3DXMATRIX(const float *pf);
213 D3DXMATRIX(const D3DMATRIX& mat);
214 D3DXMATRIX(float f11, float f12, float f13, float f14,
215 float f21, float f22, float f23, float f24,
216 float f31, float f32, float f33, float f34,
217 float f41, float f42, float f43, float f44);
218
219 float& operator () (UINT row, UINT col);
220 float operator () (UINT row, UINT col) const;
221
222 operator float* ();
223 operator const float* () const;
224
225 D3DXMATRIX& operator *= (const D3DXMATRIX&);
227 D3DXMATRIX& operator -= (const D3DXMATRIX&);
228 D3DXMATRIX& operator *= (float);
229 D3DXMATRIX& operator /= (float);
230
231 D3DXMATRIX operator + () const;
232 D3DXMATRIX operator - () const;
233
234 D3DXMATRIX operator * (const D3DXMATRIX&) const;
235 D3DXMATRIX operator + (const D3DXMATRIX&) const;
236 D3DXMATRIX operator - (const D3DXMATRIX&) const;
237 D3DXMATRIX operator * (float) const;
238 D3DXMATRIX operator / (float) const;
239
240 friend D3DXMATRIX operator * (float, const D3DXMATRIX&);
241
242 BOOL operator == (const D3DXMATRIX&) const;
243 BOOL operator != (const D3DXMATRIX&) const;
245#else /* !__cplusplus */
247#endif /* !__cplusplus */
248
249#ifdef __cplusplus
250extern "C" {
251#endif
252
259
260#ifdef __cplusplus
261}
262#endif
263
264#endif /* __D3DX9MATH_H__ */
bool _STLP_CALL operator!=(const allocator< _T1 > &, const allocator< _T2 > &) _STLP_NOTHROW
Definition: _alloc.h:384
complex< _Tp > _STLP_CALL operator/(const _Tp &__x, const complex< _Tp > &__z)
Definition: _complex.h:652
complex< _Tp > _STLP_CALL operator-(const complex< _Tp > &__z)
Definition: _complex.h:622
complex< _Tp > _STLP_CALL operator*(const _Tp &__x, const complex< _Tp > &__z)
Definition: _complex.h:644
rope< _CharT, _Alloc > & operator+=(rope< _CharT, _Alloc > &__left, const rope< _CharT, _Alloc > &__right)
Definition: _rope.h:2202
CHString WINAPI operator+(CHSTRING_WCHAR ch, const CHString &string)
Definition: chstring.cpp:1356
struct _D3DVECTOR D3DVECTOR
struct _D3DMATRIX D3DMATRIX
D3DXCOLOR * D3DXColorSubtract(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2)
struct D3DXFLOAT16 D3DXFLOAT16
struct D3DXVECTOR2 D3DXVECTOR2
D3DXCOLOR * D3DXColorAdd(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2)
struct D3DXCOLOR D3DXCOLOR
enum _D3DX_CPU_OPTIMIZATION D3DX_CPU_OPTIMIZATION
struct D3DXVECTOR4 D3DXVECTOR4
struct _D3DMATRIX D3DXMATRIX
Definition: d3dx10math.h:246
struct D3DXVECTOR2 * LPD3DXVECTOR2
struct D3DXVECTOR4 * LPD3DXVECTOR4
struct _D3DMATRIX * LPD3DXMATRIX
Definition: d3dx10math.h:246
D3DXCOLOR * D3DXColorLerp(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2, float s)
struct _D3DVECTOR D3DXVECTOR3
Definition: d3dx10math.h:174
struct _D3DVECTOR * LPD3DXVECTOR3
Definition: d3dx10math.h:174
D3DX_CPU_OPTIMIZATION WINAPI D3DXCpuOptimizations(BOOL enable)
D3DXCOLOR * D3DXColorScale(D3DXCOLOR *out, D3DXCOLOR c, float s)
D3DXCOLOR * D3DXColorModulate(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2)
_D3DX_CPU_OPTIMIZATION
Definition: d3dx10math.h:56
@ D3DX_SSE_OPTIMIZED
Definition: d3dx10math.h:60
@ D3DX_3DNOW_OPTIMIZED
Definition: d3dx10math.h:58
@ D3DX_SSE2_OPTIMIZED
Definition: d3dx10math.h:59
@ D3DX_NOT_OPTIMIZED
Definition: d3dx10math.h:57
struct D3DXCOLOR * LPD3DXCOLOR
struct D3DXFLOAT16 * LPD3DXFLOAT16
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
struct _D3DMATRIX D3DXMATRIX
Definition: d3dx9math.h:169
struct _D3DVECTOR D3DXVECTOR3
Definition: d3dx9math.h:97
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
const GLdouble * v
Definition: gl.h:2040
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean enable
Definition: glext.h:11120
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
const GLfloat * m
Definition: glext.h:10848
unsigned int UINT
Definition: sysinfo.c:13
static const MAT2 mat
Definition: font.c:51
static float(__cdecl *square_half_float)(float x
T & operator-=(T &lhs, SafeInt< U, E > rhs)
Definition: safeint.h:1457
T & operator/=(T &lhs, SafeInt< U, E > rhs)
Definition: safeint.h:1475
T & operator*=(T &lhs, SafeInt< U, E > rhs)
Definition: safeint.h:1466
#define UINT
Definition: utils.c:29
float a
Definition: d3dx10math.h:110
FLOAT g
Definition: d3dx9math.h:262
FLOAT b
Definition: d3dx9math.h:262
FLOAT r
Definition: d3dx9math.h:262
WORD value
Definition: d3dx9math.h:277
FLOAT y
Definition: d3dx9math.h:64
float _32
Definition: d3d8types.h:1113
float _42
Definition: d3d8types.h:1114
float _13
Definition: d3d8types.h:1111
float _44
Definition: d3d8types.h:1114
float _14
Definition: d3d8types.h:1111
float _11
Definition: d3d8types.h:1111
float _33
Definition: d3d8types.h:1113
float _24
Definition: d3d8types.h:1112
float _31
Definition: d3d8types.h:1113
float _34
Definition: d3d8types.h:1113
float _12
Definition: d3d8types.h:1111
float _21
Definition: d3d8types.h:1112
float _41
Definition: d3d8types.h:1114
float _23
Definition: d3d8types.h:1112
float _43
Definition: d3d8types.h:1114
float _22
Definition: d3d8types.h:1112
bool operator==(const TKeyDef &t1, const TKeyDef &t2)
Definition: tkeydef.cpp:122
GLfixed fx
Definition: tritemp.h:484
GLfixed fy
Definition: tritemp.h:490
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6