GLM: type_mat4x4.hpp Source File

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 tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
59 template <typename U, precision Q>
60 friend tvec4<U, Q> operator/(tvec4<U, Q> const & v, tmat4x4<U, Q> const & m);
61
62 private:
64 col_type value[4];
65
66 public:
67 // Constructors
68 GLM_FUNC_DECL tmat4x4();
69 GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m);
70 template <precision Q>
71 GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
72
73 GLM_FUNC_DECL explicit tmat4x4(
74 ctor Null);
75 GLM_FUNC_DECL explicit tmat4x4(
76 T const & x);
77 GLM_FUNC_DECL explicit tmat4x4(
78 T const & x0, T const & y0, T const & z0, T const & w0,
79 T const & x1, T const & y1, T const & z1, T const & w1,
80 T const & x2, T const & y2, T const & z2, T const & w2,
81 T const & x3, T const & y3, T const & z3, T const & w3);
82 GLM_FUNC_DECL explicit tmat4x4(
83 col_type const & v0,
84 col_type const & v1,
85 col_type const & v2,
86 col_type const & v3);
87
88 #if(GLM_HAS_INITIALIZER_LISTS)
89 template <typename U>
90 GLM_FUNC_DECL tmat4x4(std::initializer_list<U> m);
91
92 GLM_FUNC_DECL tmat4x4(std::initializer_list<tvec4<T, P> > m);
93 #endif//GLM_HAS_INITIALIZER_LISTS
94
96 // Conversions
97
98 template <
99 typename X1, typename Y1, typename Z1, typename W1,
100 typename X2, typename Y2, typename Z2, typename W2,
101 typename X3, typename Y3, typename Z3, typename W3,
102 typename X4, typename Y4, typename Z4, typename W4>
103 GLM_FUNC_DECL explicit tmat4x4(
104 X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
105 X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
106 X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
107 X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
108
109 template <typename V1, typename V2, typename V3, typename V4>
110 GLM_FUNC_DECL explicit tmat4x4(
111 tvec4<V1, P> const & v1,
112 tvec4<V2, P> const & v2,
113 tvec4<V3, P> const & v3,
114 tvec4<V4, P> const & v4);
115
116 // Matrix conversions
117 template <typename U, precision Q>
118 GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
119
120 GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
121 GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);
122 GLM_FUNC_DECL explicit tmat4x4(tmat2x3<T, P> const & x);
123 GLM_FUNC_DECL explicit tmat4x4(tmat3x2<T, P> const & x);
124 GLM_FUNC_DECL explicit tmat4x4(tmat2x4<T, P> const & x);
125 GLM_FUNC_DECL explicit tmat4x4(tmat4x2<T, P> const & x);
126 GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T, P> const & x);
127 GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
128
129 // Accesses
130 GLM_FUNC_DECL col_type & operator[](length_t i);
131 GLM_FUNC_DECL col_type const & operator[](length_t i) const;
132
133 // Unary updatable operators
134 GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m);
135 template <typename U>
136 GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<U, P> const & m);
137 template <typename U>
138 GLM_FUNC_DECL tmat4x4<T, P> & operator+= (U s);
139 template <typename U>
140 GLM_FUNC_DECL tmat4x4<T, P> & operator+= (tmat4x4<U, P> const & m);
141 template <typename U>
142 GLM_FUNC_DECL tmat4x4<T, P> & operator-= (U s);
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
155 // Increment and decrement operators
156
157 GLM_FUNC_DECL tmat4x4<T, P> & operator++ ();
158 GLM_FUNC_DECL tmat4x4<T, P> & operator-- ();
159 GLM_FUNC_DECL tmat4x4<T, P> operator++(int);
160 GLM_FUNC_DECL tmat4x4<T, P> operator--(int);
161 };
162
163 template <typename T, precision P>
164 GLM_FUNC_DECL tmat4x4<T, P> compute_inverse_mat4(tmat4x4<T, P> const & m);
165
166 // Binary operators
167 template <typename T, precision P>
168 GLM_FUNC_DECL tmat4x4<T, P> operator+ (
169 tmat4x4<T, P> const & m,
170 T const & s);
171
172 template <typename T, precision P>
173 GLM_FUNC_DECL tmat4x4<T, P> operator+ (
174 T const & s,
175 tmat4x4<T, P> const & m);
176
177 template <typename T, precision P>
178 GLM_FUNC_DECL tmat4x4<T, P> operator+ (
179 tmat4x4<T, P> const & m1,
180 tmat4x4<T, P> const & m2);
181
182 template <typename T, precision P>
183 GLM_FUNC_DECL tmat4x4<T, P> operator- (
184 tmat4x4<T, P> const & m,
185 T const & s);
186
187 template <typename T, precision P>
188 GLM_FUNC_DECL tmat4x4<T, P> operator- (
189 T const & s,
190 tmat4x4<T, P> const & m);
191
192 template <typename T, precision P>
193 GLM_FUNC_DECL tmat4x4<T, P> operator- (
194 tmat4x4<T, P> const & m1,
195 tmat4x4<T, P> const & m2);
196
197 template <typename T, precision P>
198 GLM_FUNC_DECL tmat4x4<T, P> operator* (
199 tmat4x4<T, P> const & m,
200 T const & s);
201
202 template <typename T, precision P>
203 GLM_FUNC_DECL tmat4x4<T, P> operator* (
204 T const & s,
205 tmat4x4<T, P> const & m);
206
207 template <typename T, precision P>
208 GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator* (
209 tmat4x4<T, P> const & m,
210 typename tmat4x4<T, P>::row_type const & v);
211
212 template <typename T, precision P>
213 GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator* (
214 typename tmat4x4<T, P>::col_type const & v,
215 tmat4x4<T, P> const & m);
216
217 template <typename T, precision P>
218 GLM_FUNC_DECL tmat2x4<T, P> operator* (
219 tmat4x4<T, P> const & m1,
220 tmat2x4<T, P> const & m2);
221
222 template <typename T, precision P>
223 GLM_FUNC_DECL tmat3x4<T, P> operator* (
224 tmat4x4<T, P> const & m1,
225 tmat3x4<T, P> const & m2);
226
227 template <typename T, precision P>
228 GLM_FUNC_DECL tmat4x4<T, P> operator* (
229 tmat4x4<T, P> const & m1,
230 tmat4x4<T, P> const & m2);
231
232 template <typename T, precision P>
233 GLM_FUNC_DECL tmat4x4<T, P> operator/ (
234 tmat4x4<T, P> const & m,
235 T const & s);
236
237 template <typename T, precision P>
238 GLM_FUNC_DECL tmat4x4<T, P> operator/ (
239 T const & s,
240 tmat4x4<T, P> const & m);
241
242 template <typename T, precision P>
243 GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator/ (
244 tmat4x4<T, P> const & m,
245 typename tmat4x4<T, P>::row_type const & v);
246
247 template <typename T, precision P>
248 GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator/ (
249 typename tmat4x4<T, P>::col_type & v,
250 tmat4x4<T, P> const & m);
251
252 template <typename T, precision P>
253 GLM_FUNC_DECL tmat4x4<T, P> operator/ (
254 tmat4x4<T, P> const & m1,
255 tmat4x4<T, P> const & m2);
256
257 // Unary constant operators
258 template <typename T, precision P>
259 GLM_FUNC_DECL tmat4x4<T, P> const operator- (
260 tmat4x4<T, P> const & m);
261
262 }//namespace detail
263 }//namespace glm
264
265 #ifndef GLM_EXTERNAL_TEMPLATE
266 #include "type_mat4x4.inl"
267 #endif//GLM_EXTERNAL_TEMPLATE
268
269 #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).