0.9.7
type_mat4x4.hpp
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include "../fwd.hpp"
36 #include "type_vec4.hpp"
37 #include "type_mat.hpp"
38 #include <limits>
39 #include <cstddef>
40 
41 namespace glm
42 {
43  template <typename T, precision P = defaultp>
44  struct tmat4x4
45  {
46  typedef tvec4<T, P> col_type;
47  typedef tvec4<T, P> row_type;
48  typedef tmat4x4<T, P> type;
49  typedef tmat4x4<T, P> transpose_type;
50  typedef T value_type;
51 
52 # ifdef GLM_META_PROG_HELPERS
53  static GLM_RELAXED_CONSTEXPR length_t components = 4;
54  static GLM_RELAXED_CONSTEXPR length_t cols = 4;
55  static GLM_RELAXED_CONSTEXPR length_t rows = 4;
56  static GLM_RELAXED_CONSTEXPR precision prec = P;
57 # endif//GLM_META_PROG_HELPERS
58 
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:
65  col_type value[4];
66 
67  public:
68  // -- Constructors --
69 
70  GLM_FUNC_DECL tmat4x4() GLM_DEFAULT_CTOR;
71  GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m) GLM_DEFAULT;
72  template <precision Q>
73  GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
74 
75  GLM_FUNC_DECL explicit tmat4x4(ctor);
76  GLM_FUNC_DECL explicit tmat4x4(T const & x);
77  GLM_FUNC_DECL 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 tmat4x4(
83  col_type const & v0,
84  col_type const & v1,
85  col_type const & v2,
86  col_type const & v3);
87 
88  // -- Conversions --
89 
90  template <
91  typename X1, typename Y1, typename Z1, typename W1,
92  typename X2, typename Y2, typename Z2, typename W2,
93  typename X3, typename Y3, typename Z3, typename W3,
94  typename X4, typename Y4, typename Z4, typename W4>
95  GLM_FUNC_DECL tmat4x4(
96  X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
97  X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
98  X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
99  X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
100 
101  template <typename V1, typename V2, typename V3, typename V4>
102  GLM_FUNC_DECL tmat4x4(
103  tvec4<V1, P> const & v1,
104  tvec4<V2, P> const & v2,
105  tvec4<V3, P> const & v3,
106  tvec4<V4, P> const & v4);
107 
108  // -- Matrix conversions --
109 
110  template <typename U, precision Q>
111  GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x4<U, Q> const & m);
112 
113  GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
114  GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);
115  GLM_FUNC_DECL explicit tmat4x4(tmat2x3<T, P> const & x);
116  GLM_FUNC_DECL explicit tmat4x4(tmat3x2<T, P> const & x);
117  GLM_FUNC_DECL explicit tmat4x4(tmat2x4<T, P> const & x);
118  GLM_FUNC_DECL explicit tmat4x4(tmat4x2<T, P> const & x);
119  GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T, P> const & x);
120  GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
121 
122  // -- Accesses --
123 
124 # ifdef GLM_FORCE_SIZE_FUNC
125  typedef size_t size_type;
126  GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
127 
128  GLM_FUNC_DECL col_type & operator[](size_type i);
129  GLM_FUNC_DECL col_type const & operator[](size_type i) const;
130 # else
131  typedef length_t length_type;
132  GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
133 
134  GLM_FUNC_DECL col_type & operator[](length_type i);
135  GLM_FUNC_DECL col_type const & operator[](length_type i) const;
136 # endif//GLM_FORCE_SIZE_FUNC
137 
138  // -- Unary arithmetic operators --
139 
140  GLM_FUNC_DECL tmat4x4<T, P> & operator=(tmat4x4<T, P> const & m) GLM_DEFAULT;
141 
142  template <typename U>
143  GLM_FUNC_DECL tmat4x4<T, P> & operator=(tmat4x4<U, P> const & m);
144  template <typename U>
145  GLM_FUNC_DECL tmat4x4<T, P> & operator+=(U s);
146  template <typename U>
147  GLM_FUNC_DECL tmat4x4<T, P> & operator+=(tmat4x4<U, P> const & m);
148  template <typename U>
149  GLM_FUNC_DECL tmat4x4<T, P> & operator-=(U s);
150  template <typename U>
151  GLM_FUNC_DECL tmat4x4<T, P> & operator-=(tmat4x4<U, P> const & m);
152  template <typename U>
153  GLM_FUNC_DECL tmat4x4<T, P> & operator*=(U s);
154  template <typename U>
155  GLM_FUNC_DECL tmat4x4<T, P> & operator*=(tmat4x4<U, P> const & m);
156  template <typename U>
157  GLM_FUNC_DECL tmat4x4<T, P> & operator/=(U s);
158  template <typename U>
159  GLM_FUNC_DECL tmat4x4<T, P> & operator/=(tmat4x4<U, P> const & m);
160 
161  // -- Increment and decrement operators --
162 
163  GLM_FUNC_DECL tmat4x4<T, P> & operator++();
164  GLM_FUNC_DECL tmat4x4<T, P> & operator--();
165  GLM_FUNC_DECL tmat4x4<T, P> operator++(int);
166  GLM_FUNC_DECL tmat4x4<T, P> operator--(int);
167  };
168 
169  // -- Unary operators --
170 
171  template <typename T, precision P>
172  GLM_FUNC_DECL tmat4x4<T, P> const operator-(tmat4x4<T, P> const & m);
173 
174  // -- Binary operators --
175 
176  template <typename T, precision P>
177  GLM_FUNC_DECL tmat4x4<T, P> operator+(tmat4x4<T, P> const & m, T const & s);
178 
179  template <typename T, precision P>
180  GLM_FUNC_DECL tmat4x4<T, P> operator+(T const & s, tmat4x4<T, P> const & m);
181 
182  template <typename T, precision P>
183  GLM_FUNC_DECL tmat4x4<T, P> operator+(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
184 
185  template <typename T, precision P>
186  GLM_FUNC_DECL tmat4x4<T, P> operator-(tmat4x4<T, P> const & m, T const & s);
187 
188  template <typename T, precision P>
189  GLM_FUNC_DECL tmat4x4<T, P> operator-(T const & s, tmat4x4<T, P> const & m);
190 
191  template <typename T, precision P>
192  GLM_FUNC_DECL tmat4x4<T, P> operator-(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
193 
194  template <typename T, precision P>
195  GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat4x4<T, P> const & m, T const & s);
196 
197  template <typename T, precision P>
198  GLM_FUNC_DECL tmat4x4<T, P> operator*(T const & s, tmat4x4<T, P> const & m);
199 
200  template <typename T, precision P>
201  GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator*(tmat4x4<T, P> const & m, typename tmat4x4<T, P>::row_type const & v);
202 
203  template <typename T, precision P>
204  GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator*(typename tmat4x4<T, P>::col_type const & v, tmat4x4<T, P> const & m);
205 
206  template <typename T, precision P>
207  GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat2x4<T, P> const & m2);
208 
209  template <typename T, precision P>
210  GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat3x4<T, P> const & m2);
211 
212  template <typename T, precision P>
213  GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
214 
215  template <typename T, precision P>
216  GLM_FUNC_DECL tmat4x4<T, P> operator/(tmat4x4<T, P> const & m, T const & s);
217 
218  template <typename T, precision P>
219  GLM_FUNC_DECL tmat4x4<T, P> operator/(T const & s, tmat4x4<T, P> const & m);
220 
221  template <typename T, precision P>
222  GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator/(tmat4x4<T, P> const & m, typename tmat4x4<T, P>::row_type const & v);
223 
224  template <typename T, precision P>
225  GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator/(typename tmat4x4<T, P>::col_type & v, tmat4x4<T, P> const & m);
226 
227  template <typename T, precision P>
228  GLM_FUNC_DECL tmat4x4<T, P> operator/(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
229 
230  // -- Boolean operators --
231 
232  template <typename T, precision P>
233  GLM_FUNC_DECL bool operator==(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
234 
235  template <typename T, precision P>
236  GLM_FUNC_DECL bool operator!=(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
237 }//namespace glm
238 
239 #ifndef GLM_EXTERNAL_TEMPLATE
240 #include "type_mat4x4.inl"
241 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
Definition: _noise.hpp:40
OpenGL Mathematics (glm.g-truc.net)
OpenGL Mathematics (glm.g-truc.net)