1
///////////////////////////////////////////////////////////////////////////////////
2
/// OpenGL Mathematics (glm.g-truc.net)
4
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
/// of this software and associated documentation files (the "Software"), to deal
7
/// in the Software without restriction, including without limitation the rights
8
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
/// copies of the Software, and to permit persons to whom the Software is
10
/// furnished to do so, subject to the following conditions:
12
/// The above copyright notice and this permission notice shall be included in
13
/// all copies or substantial portions of the Software.
15
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
/// @file glm/core/type_mat4x4.inl
25
/// @date 2005-01-27 / 2011-06-15
26
/// @author Christophe Riccio
27
///////////////////////////////////////////////////////////////////////////////////
33
GLM_FUNC_QUALIFIER typename tmat4x4<T>::size_type tmat4x4<T>::length() const
39
GLM_FUNC_QUALIFIER typename tmat4x4<T>::size_type tmat4x4<T>::col_size()
45
GLM_FUNC_QUALIFIER typename tmat4x4<T>::size_type tmat4x4<T>::row_size()
50
//////////////////////////////////////
54
GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type &
55
tmat4x4<T>::operator[]
60
assert(i < this->length());
61
return this->value[i];
65
GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type const &
66
tmat4x4<T>::operator[]
71
assert(i < this->length());
72
return this->value[i];
75
//////////////////////////////////////////////////////////////
79
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4()
83
this->value[0] = col_type(One, Zero, Zero, Zero);
84
this->value[1] = col_type(Zero, One, Zero, Zero);
85
this->value[2] = col_type(Zero, Zero, One, Zero);
86
this->value[3] = col_type(Zero, Zero, Zero, One);
90
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
95
this->value[0] = m.value[0];
96
this->value[1] = m.value[1];
97
this->value[2] = m.value[2];
98
this->value[3] = m.value[3];
101
template <typename T>
102
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
108
template <typename T>
109
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
114
value_type const Zero(0);
115
this->value[0] = col_type(s, Zero, Zero, Zero);
116
this->value[1] = col_type(Zero, s, Zero, Zero);
117
this->value[2] = col_type(Zero, Zero, s, Zero);
118
this->value[3] = col_type(Zero, Zero, Zero, s);
121
template <typename T>
122
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
124
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
125
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
126
value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2,
127
value_type const & x3, value_type const & y3, value_type const & z3, value_type const & w3
130
this->value[0] = col_type(x0, y0, z0, w0);
131
this->value[1] = col_type(x1, y1, z1, w1);
132
this->value[2] = col_type(x2, y2, z2, w2);
133
this->value[3] = col_type(x3, y3, z3, w3);
136
template <typename T>
137
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
151
template <typename T>
152
template <typename U>
153
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
158
this->value[0] = col_type(m[0]);
159
this->value[1] = col_type(m[1]);
160
this->value[2] = col_type(m[2]);
161
this->value[3] = col_type(m[3]);
164
//////////////////////////////////////
165
// Convertion constructors
166
template <typename T>
167
template <typename U>
168
GLM_FUNC_DECL tmat4x4<T>::tmat4x4
173
GLM_STATIC_ASSERT(detail::type<U>::is_float || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
175
value_type const Zero(0);
176
this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
177
this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
178
this->value[2] = tvec4<T>(Zero, Zero, value_type(s), Zero);
179
this->value[3] = tvec4<T>(Zero, Zero, Zero, value_type(s));
182
template <typename T>
184
typename X1, typename Y1, typename Z1, typename W1,
185
typename X2, typename Y2, typename Z2, typename W2,
186
typename X3, typename Y3, typename Z3, typename W3,
187
typename X4, typename Y4, typename Z4, typename W4>
188
GLM_FUNC_DECL tmat4x4<T>::tmat4x4
190
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
191
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
192
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
193
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4
196
GLM_STATIC_ASSERT(detail::type<X1>::is_float || std::numeric_limits<X1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
197
GLM_STATIC_ASSERT(detail::type<Y1>::is_float || std::numeric_limits<Y1>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
198
GLM_STATIC_ASSERT(detail::type<Z1>::is_float || std::numeric_limits<Z1>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
199
GLM_STATIC_ASSERT(detail::type<W1>::is_float || std::numeric_limits<W1>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
201
GLM_STATIC_ASSERT(detail::type<X2>::is_float || std::numeric_limits<X2>::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid.");
202
GLM_STATIC_ASSERT(detail::type<Y2>::is_float || std::numeric_limits<Y2>::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid.");
203
GLM_STATIC_ASSERT(detail::type<Z2>::is_float || std::numeric_limits<Z2>::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid.");
204
GLM_STATIC_ASSERT(detail::type<W2>::is_float || std::numeric_limits<W2>::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid.");
206
GLM_STATIC_ASSERT(detail::type<X3>::is_float || std::numeric_limits<X3>::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid.");
207
GLM_STATIC_ASSERT(detail::type<Y3>::is_float || std::numeric_limits<Y3>::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid.");
208
GLM_STATIC_ASSERT(detail::type<Z3>::is_float || std::numeric_limits<Z3>::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid.");
209
GLM_STATIC_ASSERT(detail::type<W3>::is_float || std::numeric_limits<W3>::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid.");
211
GLM_STATIC_ASSERT(detail::type<X4>::is_float || std::numeric_limits<X4>::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid.");
212
GLM_STATIC_ASSERT(detail::type<Y4>::is_float || std::numeric_limits<Y4>::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid.");
213
GLM_STATIC_ASSERT(detail::type<Z4>::is_float || std::numeric_limits<Z4>::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid.");
214
GLM_STATIC_ASSERT(detail::type<W4>::is_float || std::numeric_limits<W4>::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid.");
216
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
217
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
218
this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3));
219
this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4), value_type(w4));
222
template <typename T>
223
template <typename V1, typename V2, typename V3, typename V4>
224
GLM_FUNC_DECL tmat4x4<T>::tmat4x4
226
tvec4<V1> const & v1,
227
tvec4<V2> const & v2,
228
tvec4<V3> const & v3,
232
GLM_STATIC_ASSERT(detail::type<V1>::is_float || std::numeric_limits<V1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
233
GLM_STATIC_ASSERT(detail::type<V2>::is_float || std::numeric_limits<V2>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
234
GLM_STATIC_ASSERT(detail::type<V3>::is_float || std::numeric_limits<V3>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
235
GLM_STATIC_ASSERT(detail::type<V4>::is_float || std::numeric_limits<V4>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
237
this->value[0] = col_type(v1);
238
this->value[1] = col_type(v2);
239
this->value[2] = col_type(v3);
240
this->value[3] = col_type(v4);
243
//////////////////////////////////////
244
// Matrix convertion constructors
245
template <typename T>
246
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
251
this->value[0] = col_type(m[0], detail::tvec2<T>(0));
252
this->value[1] = col_type(m[1], detail::tvec2<T>(0));
253
this->value[2] = col_type(value_type(0));
254
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
257
template <typename T>
258
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
263
this->value[0] = col_type(m[0], value_type(0));
264
this->value[1] = col_type(m[1], value_type(0));
265
this->value[2] = col_type(m[2], value_type(0));
266
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
269
template <typename T>
270
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
275
this->value[0] = col_type(m[0], value_type(0));
276
this->value[1] = col_type(m[1], value_type(0));
277
this->value[2] = col_type(value_type(0));
278
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
281
template <typename T>
282
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
287
this->value[0] = col_type(m[0], detail::tvec2<T>(0));
288
this->value[1] = col_type(m[1], detail::tvec2<T>(0));
289
this->value[2] = col_type(m[2], detail::tvec2<T>(0));
290
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
293
template <typename T>
294
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
299
this->value[0] = m[0];
300
this->value[1] = m[1];
301
this->value[2] = col_type(T(0));
302
this->value[3] = col_type(T(0), T(0), T(0), T(1));
305
template <typename T>
306
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
311
this->value[0] = col_type(m[0], detail::tvec2<T>(0));
312
this->value[1] = col_type(m[1], detail::tvec2<T>(0));
313
this->value[2] = col_type(T(0));
314
this->value[3] = col_type(T(0), T(0), T(0), T(1));
317
template <typename T>
318
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
323
this->value[0] = m[0];
324
this->value[1] = m[1];
325
this->value[2] = m[2];
326
this->value[3] = col_type(T(0), T(0), T(0), T(1));
329
template <typename T>
330
GLM_FUNC_QUALIFIER tmat4x4<T>::tmat4x4
335
this->value[0] = col_type(m[0], T(0));
336
this->value[1] = col_type(m[1], T(0));
337
this->value[2] = col_type(m[2], T(0));
338
this->value[3] = col_type(m[3], T(1));
341
//////////////////////////////////////////////////////////////
344
template <typename T>
345
GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator=
350
//memcpy could be faster
351
//memcpy(&this->value, &m.value, 16 * sizeof(valType));
352
this->value[0] = m[0];
353
this->value[1] = m[1];
354
this->value[2] = m[2];
355
this->value[3] = m[3];
359
template <typename T>
360
template <typename U>
361
GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator=
366
//memcpy could be faster
367
//memcpy(&this->value, &m.value, 16 * sizeof(valType));
368
this->value[0] = m[0];
369
this->value[1] = m[1];
370
this->value[2] = m[2];
371
this->value[3] = m[3];
375
template <typename T>
376
template <typename U>
377
GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator+=
389
template <typename T>
390
template <typename U>
391
GLM_FUNC_QUALIFIER tmat4x4<T>& tmat4x4<T>::operator+=
396
this->value[0] += m[0];
397
this->value[1] += m[1];
398
this->value[2] += m[2];
399
this->value[3] += m[3];
403
template <typename T>
404
template <typename U>
405
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator-=
417
template <typename T>
418
template <typename U>
419
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator-=
424
this->value[0] -= m[0];
425
this->value[1] -= m[1];
426
this->value[2] -= m[2];
427
this->value[3] -= m[3];
431
template <typename T>
432
template <typename U>
433
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator*=
445
template <typename T>
446
template <typename U>
447
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator*=
452
return (*this = *this * m);
455
template <typename T>
456
template <typename U>
457
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator/=
469
template <typename T>
470
template <typename U>
471
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator/=
476
return (*this = *this / m);
479
template <typename T>
480
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator++ ()
489
template <typename T>
490
GLM_FUNC_QUALIFIER tmat4x4<T> & tmat4x4<T>::operator-- ()
499
template <typename T>
500
GLM_FUNC_QUALIFIER tmat4x4<T> tmat4x4<T>::_inverse() const
502
// Calculate all mat2 determinants
503
value_type SubFactor00 = this->value[2][2] * this->value[3][3] - this->value[3][2] * this->value[2][3];
504
value_type SubFactor01 = this->value[2][1] * this->value[3][3] - this->value[3][1] * this->value[2][3];
505
value_type SubFactor02 = this->value[2][1] * this->value[3][2] - this->value[3][1] * this->value[2][2];
506
value_type SubFactor03 = this->value[2][0] * this->value[3][3] - this->value[3][0] * this->value[2][3];
507
value_type SubFactor04 = this->value[2][0] * this->value[3][2] - this->value[3][0] * this->value[2][2];
508
value_type SubFactor05 = this->value[2][0] * this->value[3][1] - this->value[3][0] * this->value[2][1];
509
value_type SubFactor06 = this->value[1][2] * this->value[3][3] - this->value[3][2] * this->value[1][3];
510
value_type SubFactor07 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3];
511
value_type SubFactor08 = this->value[1][1] * this->value[3][2] - this->value[3][1] * this->value[1][2];
512
value_type SubFactor09 = this->value[1][0] * this->value[3][3] - this->value[3][0] * this->value[1][3];
513
value_type SubFactor10 = this->value[1][0] * this->value[3][2] - this->value[3][0] * this->value[1][2];
514
value_type SubFactor11 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3];
515
value_type SubFactor12 = this->value[1][0] * this->value[3][1] - this->value[3][0] * this->value[1][1];
516
value_type SubFactor13 = this->value[1][2] * this->value[2][3] - this->value[2][2] * this->value[1][3];
517
value_type SubFactor14 = this->value[1][1] * this->value[2][3] - this->value[2][1] * this->value[1][3];
518
value_type SubFactor15 = this->value[1][1] * this->value[2][2] - this->value[2][1] * this->value[1][2];
519
value_type SubFactor16 = this->value[1][0] * this->value[2][3] - this->value[2][0] * this->value[1][3];
520
value_type SubFactor17 = this->value[1][0] * this->value[2][2] - this->value[2][0] * this->value[1][2];
521
value_type SubFactor18 = this->value[1][0] * this->value[2][1] - this->value[2][0] * this->value[1][1];
524
+ (this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02),
525
- (this->value[1][0] * SubFactor00 - this->value[1][2] * SubFactor03 + this->value[1][3] * SubFactor04),
526
+ (this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05),
527
- (this->value[1][0] * SubFactor02 - this->value[1][1] * SubFactor04 + this->value[1][2] * SubFactor05),
529
- (this->value[0][1] * SubFactor00 - this->value[0][2] * SubFactor01 + this->value[0][3] * SubFactor02),
530
+ (this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04),
531
- (this->value[0][0] * SubFactor01 - this->value[0][1] * SubFactor03 + this->value[0][3] * SubFactor05),
532
+ (this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05),
534
+ (this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08),
535
- (this->value[0][0] * SubFactor06 - this->value[0][2] * SubFactor09 + this->value[0][3] * SubFactor10),
536
+ (this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12),
537
- (this->value[0][0] * SubFactor08 - this->value[0][1] * SubFactor10 + this->value[0][2] * SubFactor12),
539
- (this->value[0][1] * SubFactor13 - this->value[0][2] * SubFactor14 + this->value[0][3] * SubFactor15),
540
+ (this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17),
541
- (this->value[0][0] * SubFactor14 - this->value[0][1] * SubFactor16 + this->value[0][3] * SubFactor18),
542
+ (this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18));
545
+ this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02,
546
- this->value[1][0] * SubFactor00 + this->value[1][2] * SubFactor03 - this->value[1][3] * SubFactor04,
547
+ this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05,
548
- this->value[1][0] * SubFactor02 + this->value[1][1] * SubFactor04 - this->value[1][2] * SubFactor05,
550
- this->value[0][1] * SubFactor00 + this->value[0][2] * SubFactor01 - this->value[0][3] * SubFactor02,
551
+ this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04,
552
- this->value[0][0] * SubFactor01 + this->value[0][1] * SubFactor03 - this->value[0][3] * SubFactor05,
553
+ this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05,
555
+ this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08,
556
- this->value[0][0] * SubFactor06 + this->value[0][2] * SubFactor09 - this->value[0][3] * SubFactor10,
557
+ this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12,
558
- this->value[0][0] * SubFactor08 + this->value[0][1] * SubFactor10 - this->value[0][2] * SubFactor12,
560
- this->value[0][1] * SubFactor13 + this->value[0][2] * SubFactor14 - this->value[0][3] * SubFactor15,
561
+ this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17,
562
- this->value[0][0] * SubFactor14 + this->value[0][1] * SubFactor16 - this->value[0][3] * SubFactor18,
563
+ this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18);
565
value_type Determinant =
566
+ this->value[0][0] * Inverse[0][0]
567
+ this->value[0][1] * Inverse[1][0]
568
+ this->value[0][2] * Inverse[2][0]
569
+ this->value[0][3] * Inverse[3][0];
571
Inverse /= Determinant;
576
template <typename T>
577
GLM_FUNC_QUALIFIER tmat4x4<T> operator+
579
tmat4x4<T> const & m,
580
typename tmat4x4<T>::value_type const & s
590
template <typename T>
591
GLM_FUNC_QUALIFIER tmat4x4<T> operator+
593
typename tmat4x4<T>::value_type const & s,
604
template <typename T>
605
GLM_FUNC_QUALIFIER tmat4x4<T> operator+
607
tmat4x4<T> const & m1,
608
tmat4x4<T> const & m2
618
template <typename T>
619
GLM_FUNC_QUALIFIER tmat4x4<T> operator-
621
tmat4x4<T> const & m,
622
typename tmat4x4<T>::value_type const & s
632
template <typename T>
633
GLM_FUNC_QUALIFIER tmat4x4<T> operator-
635
typename tmat4x4<T>::value_type const & s,
646
template <typename T>
647
GLM_FUNC_QUALIFIER tmat4x4<T> operator-
649
tmat4x4<T> const & m1,
650
tmat4x4<T> const & m2
660
template <typename T>
661
GLM_FUNC_QUALIFIER tmat4x4<T> operator*
663
tmat4x4<T> const & m,
664
typename tmat4x4<T>::value_type const & s
674
template <typename T>
675
GLM_FUNC_QUALIFIER tmat4x4<T> operator*
677
typename tmat4x4<T>::value_type const & s,
688
template <typename T>
689
GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type operator*
691
tmat4x4<T> const & m,
692
typename tmat4x4<T>::row_type const & v
695
return typename tmat4x4<T>::col_type(
696
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w,
697
m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w,
698
m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w,
699
m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z + m[3][3] * v.w);
702
template <typename T>
703
GLM_FUNC_QUALIFIER typename tmat4x4<T>::row_type operator*
705
typename tmat4x4<T>::col_type const & v,
709
return typename tmat4x4<T>::row_type(
710
m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w,
711
m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
712
m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
713
m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * v.w);
716
template <typename T>
717
GLM_FUNC_QUALIFIER tmat2x4<T> operator*
719
tmat4x4<T> const & m1,
720
tmat2x4<T> const & m2
724
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
725
m1[0][1] * m2[0][0] + m1[1][1] * m2[0][1] + m1[2][1] * m2[0][2] + m1[3][1] * m2[0][3],
726
m1[0][2] * m2[0][0] + m1[1][2] * m2[0][1] + m1[2][2] * m2[0][2] + m1[3][2] * m2[0][3],
727
m1[0][3] * m2[0][0] + m1[1][3] * m2[0][1] + m1[2][3] * m2[0][2] + m1[3][3] * m2[0][3],
728
m1[0][0] * m2[1][0] + m1[1][0] * m2[1][1] + m1[2][0] * m2[1][2] + m1[3][0] * m2[1][3],
729
m1[0][1] * m2[1][0] + m1[1][1] * m2[1][1] + m1[2][1] * m2[1][2] + m1[3][1] * m2[1][3],
730
m1[0][2] * m2[1][0] + m1[1][2] * m2[1][1] + m1[2][2] * m2[1][2] + m1[3][2] * m2[1][3],
731
m1[0][3] * m2[1][0] + m1[1][3] * m2[1][1] + m1[2][3] * m2[1][2] + m1[3][3] * m2[1][3]);
734
template <typename T>
735
GLM_FUNC_QUALIFIER tmat3x4<T> operator*
737
tmat4x4<T> const & m1,
738
tmat3x4<T> const & m2
742
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
743
m1[0][1] * m2[0][0] + m1[1][1] * m2[0][1] + m1[2][1] * m2[0][2] + m1[3][1] * m2[0][3],
744
m1[0][2] * m2[0][0] + m1[1][2] * m2[0][1] + m1[2][2] * m2[0][2] + m1[3][2] * m2[0][3],
745
m1[0][3] * m2[0][0] + m1[1][3] * m2[0][1] + m1[2][3] * m2[0][2] + m1[3][3] * m2[0][3],
746
m1[0][0] * m2[1][0] + m1[1][0] * m2[1][1] + m1[2][0] * m2[1][2] + m1[3][0] * m2[1][3],
747
m1[0][1] * m2[1][0] + m1[1][1] * m2[1][1] + m1[2][1] * m2[1][2] + m1[3][1] * m2[1][3],
748
m1[0][2] * m2[1][0] + m1[1][2] * m2[1][1] + m1[2][2] * m2[1][2] + m1[3][2] * m2[1][3],
749
m1[0][3] * m2[1][0] + m1[1][3] * m2[1][1] + m1[2][3] * m2[1][2] + m1[3][3] * m2[1][3],
750
m1[0][0] * m2[2][0] + m1[1][0] * m2[2][1] + m1[2][0] * m2[2][2] + m1[3][0] * m2[2][3],
751
m1[0][1] * m2[2][0] + m1[1][1] * m2[2][1] + m1[2][1] * m2[2][2] + m1[3][1] * m2[2][3],
752
m1[0][2] * m2[2][0] + m1[1][2] * m2[2][1] + m1[2][2] * m2[2][2] + m1[3][2] * m2[2][3],
753
m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1] + m1[2][3] * m2[2][2] + m1[3][3] * m2[2][3]);
756
template <typename T>
757
GLM_FUNC_QUALIFIER tmat4x4<T> operator*
759
tmat4x4<T> const & m1,
760
tmat4x4<T> const & m2
763
typename tmat4x4<T>::col_type const SrcA0 = m1[0];
764
typename tmat4x4<T>::col_type const SrcA1 = m1[1];
765
typename tmat4x4<T>::col_type const SrcA2 = m1[2];
766
typename tmat4x4<T>::col_type const SrcA3 = m1[3];
768
typename tmat4x4<T>::col_type const SrcB0 = m2[0];
769
typename tmat4x4<T>::col_type const SrcB1 = m2[1];
770
typename tmat4x4<T>::col_type const SrcB2 = m2[2];
771
typename tmat4x4<T>::col_type const SrcB3 = m2[3];
773
tmat4x4<T> Result(tmat4x4<T>::null);
774
Result[0] = SrcA0 * SrcB0[0] + SrcA1 * SrcB0[1] + SrcA2 * SrcB0[2] + SrcA3 * SrcB0[3];
775
Result[1] = SrcA0 * SrcB1[0] + SrcA1 * SrcB1[1] + SrcA2 * SrcB1[2] + SrcA3 * SrcB1[3];
776
Result[2] = SrcA0 * SrcB2[0] + SrcA1 * SrcB2[1] + SrcA2 * SrcB2[2] + SrcA3 * SrcB2[3];
777
Result[3] = SrcA0 * SrcB3[0] + SrcA1 * SrcB3[1] + SrcA2 * SrcB3[2] + SrcA3 * SrcB3[3];
781
template <typename T>
782
GLM_FUNC_QUALIFIER tmat4x4<T> operator/
784
tmat4x4<T> const & m,
785
typename tmat4x4<T>::value_type const & s
795
template <typename T>
796
GLM_FUNC_QUALIFIER tmat4x4<T> operator/
798
typename tmat4x4<T>::value_type const & s,
809
template <typename T>
810
GLM_FUNC_QUALIFIER typename tmat4x4<T>::col_type operator/
812
tmat4x4<T> const & m,
813
typename tmat4x4<T>::row_type const & v
816
return m._inverse() * v;
819
template <typename T>
820
GLM_FUNC_QUALIFIER typename tmat4x4<T>::row_type operator/
822
typename tmat4x4<T>::col_type const & v,
826
return v * m._inverse();
829
template <typename T>
830
GLM_FUNC_QUALIFIER tmat4x4<T> operator/
832
tmat4x4<T> const & m1,
833
tmat4x4<T> const & m2
836
return m1 * m2._inverse();
839
// Unary constant operators
840
template <typename T>
841
GLM_FUNC_QUALIFIER tmat4x4<T> const operator-
853
template <typename T>
854
GLM_FUNC_QUALIFIER tmat4x4<T> const operator++
856
tmat4x4<T> const & m,
861
m[0] + typename tmat4x4<T>::value_type(1),
862
m[1] + typename tmat4x4<T>::value_type(1),
863
m[2] + typename tmat4x4<T>::value_type(1),
864
m[3] + typename tmat4x4<T>::value_type(1));
867
template <typename T>
868
GLM_FUNC_QUALIFIER tmat4x4<T> const operator--
870
tmat4x4<T> const & m,
875
m[0] - typename tmat4x4<T>::value_type(1),
876
m[1] - typename tmat4x4<T>::value_type(1),
877
m[2] - typename tmat4x4<T>::value_type(1),
878
m[3] - typename tmat4x4<T>::value_type(1));
881
//////////////////////////////////////
884
template <typename T>
885
GLM_FUNC_QUALIFIER bool operator==
887
tmat4x4<T> const & m1,
888
tmat4x4<T> const & m2
891
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
894
template <typename T>
895
GLM_FUNC_QUALIFIER bool operator!=
897
tmat4x4<T> const & m1,
898
tmat4x4<T> const & m2
901
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);