GLM: type_mat4x2.hpp Source File

GLM 0.9.5

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

- File List

type_mat4x2.hpp
1
29 #ifndef glm_core_type_mat4x2
30 #define glm_core_type_mat4x2
31
32 #include "../fwd.hpp"
33 #include "type_vec2.hpp"
34 #include "type_vec4.hpp"
35 #include "type_mat.hpp"
36 #include <limits>
37
38 namespace glm{
39 namespace detail
40 {
41 template <typename T, precision P>
42 struct tmat4x2
43 {
44 enum ctor{_null};
45 typedef T value_type;
46 typedef std::size_t size_type;
47 typedef tvec2<T, P> col_type;
48 typedef tvec4<T, P> row_type;
49 typedef tmat4x2<T, P> type;
50 typedef tmat2x4<T, P> transpose_type;
51
52 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
53
54 private:
55 // Data
56 col_type value[4];
57
58 public:
59 // Constructors
60 GLM_FUNC_DECL tmat4x2();
61 GLM_FUNC_DECL tmat4x2(tmat4x2<T, P> const & m);
62 template <precision Q>
63 GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
64
65 GLM_FUNC_DECL explicit tmat4x2(
66 ctor Null);
67 GLM_FUNC_DECL explicit tmat4x2(
68 T const & x);
69 GLM_FUNC_DECL explicit tmat4x2(
70 T const & x0, T const & y0,
71 T const & x1, T const & y1,
72 T const & x2, T const & y2,
73 T const & x3, T const & y3);
74 GLM_FUNC_DECL explicit tmat4x2(
75 col_type const & v0,
76 col_type const & v1,
77 col_type const & v2,
78 col_type const & v3);
79
80 #if(GLM_HAS_INITIALIZER_LISTS)
81 template <typename U>
82 GLM_FUNC_DECL tmat4x2(std::initializer_list<U> m);
83
84 GLM_FUNC_DECL tmat4x2(std::initializer_list<tvec2<T, P> > m);
85 #endif//GLM_HAS_INITIALIZER_LISTS
86
88 // Conversions
89
90 template<
91 typename X1, typename Y1,
92 typename X2, typename Y2,
93 typename X3, typename Y3,
94 typename X4, typename Y4>
95 GLM_FUNC_DECL explicit tmat4x2(
96 X1 const & x1, Y1 const & y1,
97 X2 const & x2, Y2 const & y2,
98 X3 const & x3, Y3 const & y3,
99 X4 const & x4, Y4 const & y4);
100
101 template <typename V1, typename V2, typename V3, typename V4>
102 GLM_FUNC_DECL explicit tmat4x2(
103 tvec2<V1, P> const & v1,
104 tvec2<V2, P> const & v2,
105 tvec2<V3, P> const & v3,
106 tvec2<V4, P> const & v4);
107
108 // Matrix conversions
109 template <typename U, precision Q>
110 GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
111
112 GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
113 GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);
114 GLM_FUNC_DECL explicit tmat4x2(tmat4x4<T, P> const & x);
115 GLM_FUNC_DECL explicit tmat4x2(tmat2x3<T, P> const & x);
116 GLM_FUNC_DECL explicit tmat4x2(tmat3x2<T, P> const & x);
117 GLM_FUNC_DECL explicit tmat4x2(tmat2x4<T, P> const & x);
118 GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T, P> const & x);
119 GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
120
121 // Accesses
122 GLM_FUNC_DECL col_type & operator[](length_t i);
123 GLM_FUNC_DECL col_type const & operator[](length_t i) const;
124
125 // Unary updatable operators
126 GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m);
127 template <typename U>
128 GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<U, P> const & m);
129 template <typename U>
130 GLM_FUNC_DECL tmat4x2<T, P>& operator+= (U s);
131 template <typename U>
132 GLM_FUNC_DECL tmat4x2<T, P>& operator+= (tmat4x2<U, P> const & m);
133 template <typename U>
134 GLM_FUNC_DECL tmat4x2<T, P>& operator-= (U s);
135 template <typename U>
136 GLM_FUNC_DECL tmat4x2<T, P>& operator-= (tmat4x2<U, P> const & m);
137 template <typename U>
138 GLM_FUNC_DECL tmat4x2<T, P>& operator*= (U s);
139 template <typename U>
140 GLM_FUNC_DECL tmat4x2<T, P>& operator/= (U s);
141
143 // Increment and decrement operators
144
145 GLM_FUNC_DECL tmat4x2<T, P> & operator++ ();
146 GLM_FUNC_DECL tmat4x2<T, P> & operator-- ();
147 GLM_FUNC_DECL tmat4x2<T, P> operator++(int);
148 GLM_FUNC_DECL tmat4x2<T, P> operator--(int);
149 };
150
151 // Binary operators
152 template <typename T, precision P>
153 GLM_FUNC_DECL tmat4x2<T, P> operator+ (
154 tmat4x2<T, P> const & m,
155 T const & s);
156
157 template <typename T, precision P>
158 GLM_FUNC_DECL tmat4x2<T, P> operator+ (
159 tmat4x2<T, P> const & m1,
160 tmat4x2<T, P> const & m2);
161
162 template <typename T, precision P>
163 GLM_FUNC_DECL tmat4x2<T, P> operator- (
164 tmat4x2<T, P> const & m,
165 T const & s);
166
167 template <typename T, precision P>
168 GLM_FUNC_DECL tmat4x2<T, P> operator- (
169 tmat4x2<T, P> const & m1,
170 tmat4x2<T, P> const & m2);
171
172 template <typename T, precision P>
173 GLM_FUNC_DECL tmat4x2<T, P> operator* (
174 tmat4x2<T, P> const & m,
175 T const & s);
176
177 template <typename T, precision P>
178 GLM_FUNC_DECL tmat4x2<T, P> operator* (
179 T const & s,
180 tmat4x2<T, P> const & m);
181
182 template <typename T, precision P>
183 GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator* (
184 tmat4x2<T, P> const & m,
185 typename tmat4x2<T, P>::row_type const & v);
186
187 template <typename T, precision P>
188 GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator* (
189 typename tmat4x2<T, P>::col_type const & v,
190 tmat4x2<T, P> const & m);
191
192 template <typename T, precision P>
193 GLM_FUNC_DECL tmat3x2<T, P> operator* (
194 tmat4x2<T, P> const & m1,
195 tmat3x4<T, P> const & m2);
196
197 template <typename T, precision P>
198 GLM_FUNC_DECL tmat4x2<T, P> operator* (
199 tmat4x2<T, P> const & m1,
200 tmat4x4<T, P> const & m2);
201
202 template <typename T, precision P>
203 GLM_FUNC_DECL tmat2x3<T, P> operator* (
204 tmat4x3<T, P> const & m1,
205 tmat2x4<T, P> const & m2);
206
207 template <typename T, precision P>
208 GLM_FUNC_DECL tmat4x2<T, P> operator/ (
209 tmat4x2<T, P> const & m,
210 T const & s);
211
212 template <typename T, precision P>
213 GLM_FUNC_DECL tmat4x2<T, P> operator/ (
214 T const & s,
215 tmat4x2<T, P> const & m);
216
217 // Unary constant operators
218 template <typename T, precision P>
219 GLM_FUNC_DECL tmat4x2<T, P> const operator-(
220 tmat4x2<T, P> const & m);
221
222 }//namespace detail
223 }//namespace glm
224
225 #ifndef GLM_EXTERNAL_TEMPLATE
226 #include "type_mat4x2.inl"
227 #endif
228
229 #endif //glm_core_type_mat4x2
glm::length
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).