GLM 0.9.5

- Main Page
- Related Pages
- Modules
- Namespaces
- Files

- File List

type_mat4x4.hpp
1
29 #ifndef glm_core_type_mat4x4
30 #define glm_core_type_mat4x4
31
32 #include "../fwd.hpp"
33 #include "type_vec4.hpp"
34 #include "type_mat.hpp"
35 #if(GLM_HAS_INITIALIZER_LISTS)
36 # include <initializer_list>
37 #endif //GLM_HAS_INITIALIZER_LISTS
38 #include <limits>
39 #include <cstddef>
40
41 namespace glm{
42 namespace detail
43 {
44 template <typename T, precision P>
45 struct tmat4x4
46 {
47 enum ctor{_null};
48 typedef T value_type;
49 typedef std::size_t size_type;
50 typedef tvec4<T, P> col_type;
51 typedef tvec4<T, P> row_type;
52 typedef tmat4x4<T, P> type;
53 typedef tmat4x4<T, P> transpose_type;
54
55 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
56
57 template <typename U, precision Q>
58 friend tmat4x4<U, Q> inverse(tmat4x4<U, Q> const & m);
59 template <typename U, precision Q>
60 friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
61 template <typename U, precision Q>
62 friend tvec4<U, Q> operator/(tvec4<U, Q> const & v, tmat4x4<U, Q> const & m);
63
64 private:
66 col_type value[4];
67
68 GLM_FUNC_DECL tmat4x4<T, P> _inverse() const;
70
71 public:
72 // Constructors
73 GLM_FUNC_DECL tmat4x4();
74 GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m);
75 template <precision Q>
76 GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
77
78 GLM_FUNC_DECL explicit tmat4x4(
79 ctor Null);
80 GLM_FUNC_DECL explicit tmat4x4(
81 T const & x);
82 GLM_FUNC_DECL explicit tmat4x4(
83 T const & x0, T const & y0, T const & z0, T const & w0,
84 T const & x1, T const & y1, T const & z1, T const & w1,
85 T const & x2, T const & y2, T const & z2, T const & w2,
86 T const & x3, T const & y3, T const & z3, T const & w3);
87 GLM_FUNC_DECL explicit tmat4x4(
88 col_type const & v0,
89 col_type const & v1,
90 col_type const & v2,
91 col_type const & v3);
92
93 #if(GLM_HAS_INITIALIZER_LISTS)
94 template <typename U>
95 GLM_FUNC_DECL tmat4x4(std::initializer_list<U> m);
96
97 GLM_FUNC_DECL tmat4x4(std::initializer_list<tvec4<T, P> > m);
98 #endif//GLM_HAS_INITIALIZER_LISTS
99
101 // Conversions
102 template <typename U>
103 GLM_FUNC_DECL explicit tmat4x4(
104 U const & x);
105
106 template <
107 typename X1, typename Y1, typename Z1, typename W1,
108 typename X2, typename Y2, typename Z2, typename W2,
109 typename X3, typename Y3, typename Z3, typename W3,
110 typename X4, typename Y4, typename Z4, typename W4>
111 GLM_FUNC_DECL explicit tmat4x4(
112 X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
113 X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
114 X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
115 X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
116
117 template <typename V1, typename V2, typename V3, typename V4>
118 GLM_FUNC_DECL explicit tmat4x4(
119 tvec4<V1, P> const & v1,
120 tvec4<V2, P> const & v2,
121 tvec4<V3, P> const & v3,
122 tvec4<V4, P> const & v4);
123
124 // Matrix conversions
125 template <typename U, precision Q>
126 GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
127
128 GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
129 GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);
130 GLM_FUNC_DECL explicit tmat4x4(tmat2x3<T, P> const & x);
131 GLM_FUNC_DECL explicit tmat4x4(tmat3x2<T, P> const & x);
132 GLM_FUNC_DECL explicit tmat4x4(tmat2x4<T, P> const & x);
133 GLM_FUNC_DECL explicit tmat4x4(tmat4x2<T, P> const & x);
134 GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T, P> const & x);
135 GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
136
137 // Accesses
138 GLM_FUNC_DECL col_type & operator[](length_t i);
139 GLM_FUNC_DECL col_type const & operator[](length_t i) const;
140
141 // Unary updatable operators
142 GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m);
143 template <typename U>
144 GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<U, P> const & m);
145 template <typename U>
146 GLM_FUNC_DECL tmat4x4<T, P> & operator+= (U s);
147 template <typename U>
148 GLM_FUNC_DECL tmat4x4<T, P> & operator+= (tmat4x4<U, P> const & m);
149 template <typename U>
150 GLM_FUNC_DECL tmat4x4<T, P> & operator-= (U s);
151 template <typename U>
152 GLM_FUNC_DECL tmat4x4<T, P> & operator-= (tmat4x4<U, P> const & m);
153 template <typename U>
154 GLM_FUNC_DECL tmat4x4<T, P> & operator*= (U s);
155 template <typename U>
156 GLM_FUNC_DECL tmat4x4<T, P> & operator*= (tmat4x4<U, P> const & m);
157 template <typename U>
158 GLM_FUNC_DECL tmat4x4<T, P> & operator/= (U s);
159 template <typename U>
160 GLM_FUNC_DECL tmat4x4<T, P> & operator/= (tmat4x4<U, P> const & m);
161
163 // Increment and decrement operators
164
165 GLM_FUNC_DECL tmat4x4<T, P> & operator++ ();
166 GLM_FUNC_DECL tmat4x4<T, P> & operator-- ();
167 GLM_FUNC_DECL tmat4x4<T, P> operator++(int);
168 GLM_FUNC_DECL tmat4x4<T, P> operator--(int);
169 };
170
171 // Binary operators
172 template <typename T, precision P>
173 GLM_FUNC_DECL tmat4x4<T, P> operator+ (
174 tmat4x4<T, P> const & m,
175 T const & s);
176
177 template <typename T, precision P>
178 GLM_FUNC_DECL tmat4x4<T, P> operator+ (
179 T const & s,
180 tmat4x4<T, P> const & m);
181
182 template <typename T, precision P>
183 GLM_FUNC_DECL tmat4x4<T, P> operator+ (
184 tmat4x4<T, P> const & m1,
185 tmat4x4<T, P> const & m2);
186
187 template <typename T, precision P>
188 GLM_FUNC_DECL tmat4x4<T, P> operator- (
189 tmat4x4<T, P> const & m,
190 T const & s);
191
192 template <typename T, precision P>
193 GLM_FUNC_DECL tmat4x4<T, P> operator- (
194 T const & s,
195 tmat4x4<T, P> const & m);
196
197 template <typename T, precision P>
198 GLM_FUNC_DECL tmat4x4<T, P> operator- (
199 tmat4x4<T, P> const & m1,
200 tmat4x4<T, P> const & m2);
201
202 template <typename T, precision P>
203 GLM_FUNC_DECL tmat4x4<T, P> operator* (
204 tmat4x4<T, P> const & m,
205 T const & s);
206
207 template <typename T, precision P>
208 GLM_FUNC_DECL tmat4x4<T, P> operator* (
209 T const & s,
210 tmat4x4<T, P> const & m);
211
212 template <typename T, precision P>
213 GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator* (
214 tmat4x4<T, P> const & m,
215 typename tmat4x4<T, P>::row_type const & v);
216
217 template <typename T, precision P>
218 GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator* (
219 typename tmat4x4<T, P>::col_type const & v,
220 tmat4x4<T, P> const & m);
221
222 template <typename T, precision P>
223 GLM_FUNC_DECL tmat2x4<T, P> operator* (
224 tmat4x4<T, P> const & m1,
225 tmat2x4<T, P> const & m2);
226
227 template <typename T, precision P>
228 GLM_FUNC_DECL tmat3x4<T, P> operator* (
229 tmat4x4<T, P> const & m1,
230 tmat3x4<T, P> const & m2);
231
232 template <typename T, precision P>
233 GLM_FUNC_DECL tmat4x4<T, P> operator* (
234 tmat4x4<T, P> const & m1,
235 tmat4x4<T, P> const & m2);
236
237 template <typename T, precision P>
238 GLM_FUNC_DECL tmat4x4<T, P> operator/ (
239 tmat4x4<T, P> const & m,
240 T const & s);
241
242 template <typename T, precision P>
243 GLM_FUNC_DECL tmat4x4<T, P> operator/ (
244 T const & s,
245 tmat4x4<T, P> const & m);
246
247 template <typename T, precision P>
248 GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator/ (
249 tmat4x4<T, P> const & m,
250 typename tmat4x4<T, P>::row_type const & v);
251
252 template <typename T, precision P>
253 GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator/ (
254 typename tmat4x4<T, P>::col_type & v,
255 tmat4x4<T, P> const & m);
256
257 template <typename T, precision P>
258 GLM_FUNC_DECL tmat4x4<T, P> operator/ (
259 tmat4x4<T, P> const & m1,
260 tmat4x4<T, P> const & m2);
261
262 // Unary constant operators
263 template <typename T, precision P>
264 GLM_FUNC_DECL tmat4x4<T, P> const operator- (
265 tmat4x4<T, P> const & m);
266
267 }//namespace detail
268 }//namespace glm
269
270 #ifndef GLM_EXTERNAL_TEMPLATE
271 #include "type_mat4x4.inl"
272 #endif//GLM_EXTERNAL_TEMPLATE
273
274 #endif//glm_core_type_mat4x4
glm::length
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).
glm::inverse
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.