annotate lib/legacy_dx/d3dvec.inl @ 2:2ca04ccb612a

NoCD, main menu, various
author Nomad
date Wed, 10 Oct 2012 14:21:15 +0200
parents 8b8875f5b359
children
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 /******************************************************************
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 * *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 * D3DVec.inl *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 * *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 * Float-valued 3D vector class for Direct3D. *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 * *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8 * Copyright (c) Microsoft Corp. All rights reserved. *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9 * *
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10 ******************************************************************/
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12 #include <math.h>
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14 // =====================================
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15 // Constructors
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 // =====================================
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 inline
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 _D3DVECTOR::_D3DVECTOR(D3DVALUE f)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 x = y = z = f;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24 inline
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25 _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 x = _x; y = _y; z = _z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 inline
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 _D3DVECTOR::_D3DVECTOR(const D3DVALUE f[3])
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33 x = f[0]; y = f[1]; z = f[2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 // =====================================
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 // Access grants
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 // =====================================
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40 inline const D3DVALUE&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 _D3DVECTOR::operator[](int i) const
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 return (&x)[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46 inline D3DVALUE&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 _D3DVECTOR::operator[](int i)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49 return (&x)[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53 // =====================================
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
54 // Assignment operators
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 // =====================================
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57 inline _D3DVECTOR&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
58 _D3DVECTOR::operator += (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 x += v.x; y += v.y; z += v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 return *_this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 inline _D3DVECTOR&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 _D3DVECTOR::operator -= (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 x -= v.x; y -= v.y; z -= v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 return *_this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71 inline _D3DVECTOR&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 _D3DVECTOR::operator *= (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74 x *= v.x; y *= v.y; z *= v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 return *_this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 inline _D3DVECTOR&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 _D3DVECTOR::operator /= (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 x /= v.x; y /= v.y; z /= v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 return *_this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 inline _D3DVECTOR&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 _D3DVECTOR::operator *= (D3DVALUE s)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88 x *= s; y *= s; z *= s;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 return *_this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92 inline _D3DVECTOR&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93 _D3DVECTOR::operator /= (D3DVALUE s)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95 x /= s; y /= s; z /= s;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
96 return *_this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 operator + (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 return v;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 operator - (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 return _D3DVECTOR(-v.x, -v.y, -v.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118 operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 return _D3DVECTOR(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132 return _D3DVECTOR(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135 inline int
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138 return v1[0] < v2[0] && v1[1] < v2[1] && v1[2] < v2[2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 inline int
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 return v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 operator * (const _D3DVECTOR& v, D3DVALUE s)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154 operator * (D3DVALUE s, const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156 return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 operator / (const _D3DVECTOR& v, D3DVALUE s)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 inline int
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166 operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 return v1.x==v2.x && v1.y==v2.y && v1.z == v2.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171 inline D3DVALUE
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172 Magnitude (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 return (D3DVALUE) sqrt(SquareMagnitude(v));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 inline D3DVALUE
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178 SquareMagnitude (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
180 return v.x*v.x + v.y*v.y + v.z*v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
181 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
182
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
184 Normalize (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
185 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
186 return v / Magnitude(v);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
187 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
188
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
189 inline D3DVALUE
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
190 Min (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
191 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 D3DVALUE ret = v.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 if (v.y < ret) ret = v.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
194 if (v.z < ret) ret = v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
195 return ret;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
196 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
197
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
198 inline D3DVALUE
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
199 Max (const _D3DVECTOR& v)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
200 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
201 D3DVALUE ret = v.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
202 if (ret < v.y) ret = v.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
203 if (ret < v.z) ret = v.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
204 return ret;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
205 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
206
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
207 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
208 Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
209 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
210 return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0],
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
211 v1[1] < v2[1] ? v1[1] : v2[1],
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
212 v1[2] < v2[2] ? v1[2] : v2[2]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
213 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
214
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
215 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
216 Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
217 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
218 return _D3DVECTOR( v1[0] > v2[0] ? v1[0] : v2[0],
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
219 v1[1] > v2[1] ? v1[1] : v2[1],
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
220 v1[2] > v2[2] ? v1[2] : v2[2]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
221 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
222
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
223 inline D3DVALUE
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
224 DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
225 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
226 return v1.x*v2.x + v1.y * v2.y + v1.z*v2.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
227 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
228
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
229 inline _D3DVECTOR
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
230 CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 _D3DVECTOR result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
233
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
234 result[0] = v1[1] * v2[2] - v1[2] * v2[1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
235 result[1] = v1[2] * v2[0] - v1[0] * v2[2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
236 result[2] = v1[0] * v2[1] - v1[1] * v2[0];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
239 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
240
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
241 inline _D3DMATRIX
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
242 operator* (const _D3DMATRIX& a, const _D3DMATRIX& b)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 _D3DMATRIX ret;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
245 for (int i=0; i<4; i++) {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
246 for (int j=0; j<4; j++) {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
247 ret(i, j) = 0.0f;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
248 for (int k=0; k<4; k++) {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 ret(i, j) += a(i, k) * b(k, j);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
251 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
252 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
253 return ret;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
255