Flow Visualisation
half_float.hpp
Go to the documentation of this file.
1 
37 #ifndef GLM_GTC_half_float
38 #define GLM_GTC_half_float GLM_VERSION
39 
40 // Dependency:
41 #include "../glm.hpp"
42 
43 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
44 # pragma message("GLM: GLM_GTC_half_float extension included")
45 #endif
46 
47 namespace glm{
48 namespace detail
49 {
50 #if(GLM_COMPONENT == GLM_COMPONENT_CXX98)
51  template <>
52  struct tvec2<half>
53  {
54  enum ctor{null};
55  typedef half value_type;
56  typedef std::size_t size_type;
57 
58  GLM_FUNC_DECL size_type length() const;
59  static GLM_FUNC_DECL size_type value_size();
60 
61  typedef tvec2<half> type;
62  typedef tvec2<bool> bool_type;
63 
65  // Data
66 
67  half x, y;
68 
70  // Accesses
71 
72  GLM_FUNC_DECL half & operator[](size_type i);
73  GLM_FUNC_DECL half const & operator[](size_type i) const;
74 
76  // Implicit basic constructors
77 
79  GLM_FUNC_DECL tvec2(tvec2<half> const & v);
80 
82  // Explicit basic constructors
83 
84  GLM_FUNC_DECL explicit tvec2(ctor);
85  GLM_FUNC_DECL explicit tvec2(
86  half const & s);
87  GLM_FUNC_DECL explicit tvec2(
88  half const & s1,
89  half const & s2);
90 
92  // Swizzle constructors
93 
94  GLM_FUNC_DECL tvec2(tref2<half> const & r);
95 
97  // Convertion scalar constructors
98 
100  template <typename U>
101  GLM_FUNC_DECL explicit tvec2(U const & x);
103  template <typename U, typename V>
104  GLM_FUNC_DECL explicit tvec2(U const & x, V const & y);
105 
107  // Convertion vector constructors
108 
110  template <typename U>
111  GLM_FUNC_DECL explicit tvec2(tvec2<U> const & v);
113  template <typename U>
114  GLM_FUNC_DECL explicit tvec2(tvec3<U> const & v);
116  template <typename U>
117  GLM_FUNC_DECL explicit tvec2(tvec4<U> const & v);
118 
120  // Unary arithmetic operators
121 
122  GLM_FUNC_DECL tvec2<half>& operator= (tvec2<half> const & v);
123 
124  GLM_FUNC_DECL tvec2<half>& operator+=(half const & s);
125  GLM_FUNC_DECL tvec2<half>& operator+=(tvec2<half> const & v);
126  GLM_FUNC_DECL tvec2<half>& operator-=(half const & s);
127  GLM_FUNC_DECL tvec2<half>& operator-=(tvec2<half> const & v);
128  GLM_FUNC_DECL tvec2<half>& operator*=(half const & s);
129  GLM_FUNC_DECL tvec2<half>& operator*=(tvec2<half> const & v);
130  GLM_FUNC_DECL tvec2<half>& operator/=(half const & s);
131  GLM_FUNC_DECL tvec2<half>& operator/=(tvec2<half> const & v);
132  GLM_FUNC_DECL tvec2<half>& operator++();
133  GLM_FUNC_DECL tvec2<half>& operator--();
134 
136  // Swizzle operators
137 
138  GLM_FUNC_DECL half swizzle(comp X) const;
139  GLM_FUNC_DECL tvec2<half> swizzle(comp X, comp Y) const;
140  GLM_FUNC_DECL tvec3<half> swizzle(comp X, comp Y, comp Z) const;
141  GLM_FUNC_DECL tvec4<half> swizzle(comp X, comp Y, comp Z, comp W) const;
142  GLM_FUNC_DECL tref2<half> swizzle(comp X, comp Y);
143  };
144 
145  template <>
146  struct tvec3<half>
147  {
148  enum ctor{null};
149  typedef half value_type;
150  typedef std::size_t size_type;
151  GLM_FUNC_DECL size_type length() const;
152  static GLM_FUNC_DECL size_type value_size();
153 
154  typedef tvec3<half> type;
155  typedef tvec3<bool> bool_type;
156 
158  // Data
159 
160  half x, y, z;
161 
163  // Accesses
164 
165  GLM_FUNC_DECL half & operator[](size_type i);
166  GLM_FUNC_DECL half const & operator[](size_type i) const;
167 
169  // Implicit basic constructors
170 
172  GLM_FUNC_DECL tvec3(tvec3<half> const & v);
173 
175  // Explicit basic constructors
176 
177  GLM_FUNC_DECL explicit tvec3(ctor);
178  GLM_FUNC_DECL explicit tvec3(
179  half const & s);
180  GLM_FUNC_DECL explicit tvec3(
181  half const & s1,
182  half const & s2,
183  half const & s3);
184 
186  // Swizzle constructors
187 
188  GLM_FUNC_DECL tvec3(tref3<half> const & r);
189 
191  // Convertion scalar constructors
192 
194  template <typename U>
195  GLM_FUNC_DECL explicit tvec3(U const & x);
197  template <typename U, typename V, typename W>
198  GLM_FUNC_DECL explicit tvec3(U const & x, V const & y, W const & z);
199 
201  // Convertion vector constructors
202 
204  template <typename A, typename B>
205  GLM_FUNC_DECL explicit tvec3(tvec2<A> const & v, B const & s);
207  template <typename A, typename B>
208  GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B> const & v);
210  template <typename U>
211  GLM_FUNC_DECL explicit tvec3(tvec3<U> const & v);
213  template <typename U>
214  GLM_FUNC_DECL explicit tvec3(tvec4<U> const & v);
215 
217  // Unary arithmetic operators
218 
219  GLM_FUNC_DECL tvec3<half>& operator= (tvec3<half> const & v);
220 
221  GLM_FUNC_DECL tvec3<half>& operator+=(half const & s);
222  GLM_FUNC_DECL tvec3<half>& operator+=(tvec3<half> const & v);
223  GLM_FUNC_DECL tvec3<half>& operator-=(half const & s);
224  GLM_FUNC_DECL tvec3<half>& operator-=(tvec3<half> const & v);
225  GLM_FUNC_DECL tvec3<half>& operator*=(half const & s);
226  GLM_FUNC_DECL tvec3<half>& operator*=(tvec3<half> const & v);
227  GLM_FUNC_DECL tvec3<half>& operator/=(half const & s);
228  GLM_FUNC_DECL tvec3<half>& operator/=(tvec3<half> const & v);
229  GLM_FUNC_DECL tvec3<half>& operator++();
230  GLM_FUNC_DECL tvec3<half>& operator--();
231 
233  // Swizzle operators
234 
235  GLM_FUNC_DECL half swizzle(comp X) const;
236  GLM_FUNC_DECL tvec2<half> swizzle(comp X, comp Y) const;
237  GLM_FUNC_DECL tvec3<half> swizzle(comp X, comp Y, comp Z) const;
238  GLM_FUNC_DECL tvec4<half> swizzle(comp X, comp Y, comp Z, comp W) const;
239  GLM_FUNC_DECL tref3<half> swizzle(comp X, comp Y, comp Z);
240  };
241 
242  template <>
243  struct tvec4<half>
244  {
245  enum ctor{null};
246  typedef half value_type;
247  typedef std::size_t size_type;
248  GLM_FUNC_DECL size_type length() const;
249  static GLM_FUNC_DECL size_type value_size();
250 
251  typedef tvec4<half> type;
252  typedef tvec4<bool> bool_type;
253 
255  // Data
256 
257  half x, y, z, w;
258 
260  // Accesses
261 
262  GLM_FUNC_DECL half & operator[](size_type i);
263  GLM_FUNC_DECL half const & operator[](size_type i) const;
264 
266  // Implicit basic constructors
267 
269  GLM_FUNC_DECL tvec4(tvec4<half> const & v);
270 
272  // Explicit basic constructors
273 
274  GLM_FUNC_DECL explicit tvec4(ctor);
275  GLM_FUNC_DECL explicit tvec4(
276  half const & s);
277  GLM_FUNC_DECL explicit tvec4(
278  half const & s0,
279  half const & s1,
280  half const & s2,
281  half const & s3);
282 
284  // Swizzle constructors
285 
286  GLM_FUNC_DECL tvec4(tref4<half> const & r);
287 
289  // Convertion scalar constructors
290 
292  template <typename U>
293  GLM_FUNC_DECL explicit tvec4(U const & x);
295  template <typename A, typename B, typename C, typename D>
296  GLM_FUNC_DECL explicit tvec4(A const & x, B const & y, C const & z, D const & w);
297 
299  // Convertion vector constructors
300 
302  template <typename A, typename B, typename C>
303  GLM_FUNC_DECL explicit tvec4(tvec2<A> const & v, B const & s1, C const & s2);
305  template <typename A, typename B, typename C>
306  GLM_FUNC_DECL explicit tvec4(A const & s1, tvec2<B> const & v, C const & s2);
308  template <typename A, typename B, typename C>
309  GLM_FUNC_DECL explicit tvec4(A const & s1, B const & s2, tvec2<C> const & v);
311  template <typename A, typename B>
312  GLM_FUNC_DECL explicit tvec4(tvec3<A> const & v, B const & s);
314  template <typename A, typename B>
315  GLM_FUNC_DECL explicit tvec4(A const & s, tvec3<B> const & v);
317  template <typename A, typename B>
318  GLM_FUNC_DECL explicit tvec4(tvec2<A> const & v1, tvec2<B> const & v2);
320  template <typename U>
321  GLM_FUNC_DECL explicit tvec4(tvec4<U> const & v);
322 
324  // Unary arithmetic operators
325 
326  GLM_FUNC_DECL tvec4<half>& operator= (tvec4<half> const & v);
327 
328  GLM_FUNC_DECL tvec4<half>& operator+=(half const & s);
329  GLM_FUNC_DECL tvec4<half>& operator+=(tvec4<half> const & v);
330  GLM_FUNC_DECL tvec4<half>& operator-=(half const & s);
331  GLM_FUNC_DECL tvec4<half>& operator-=(tvec4<half> const & v);
332  GLM_FUNC_DECL tvec4<half>& operator*=(half const & s);
333  GLM_FUNC_DECL tvec4<half>& operator*=(tvec4<half> const & v);
334  GLM_FUNC_DECL tvec4<half>& operator/=(half const & s);
335  GLM_FUNC_DECL tvec4<half>& operator/=(tvec4<half> const & v);
336  GLM_FUNC_DECL tvec4<half>& operator++();
337  GLM_FUNC_DECL tvec4<half>& operator--();
338 
340  // Swizzle operators
341 
342  GLM_FUNC_DECL half swizzle(comp X) const;
343  GLM_FUNC_DECL tvec2<half> swizzle(comp X, comp Y) const;
344  GLM_FUNC_DECL tvec3<half> swizzle(comp X, comp Y, comp Z) const;
345  GLM_FUNC_DECL tvec4<half> swizzle(comp X, comp Y, comp Z, comp W) const;
346  GLM_FUNC_DECL tref4<half> swizzle(comp X, comp Y, comp Z, comp W);
347  };
348 #endif//(GLM_COMPONENT == GLM_COMPONENT_CXX98)
349 }
350 //namespace detail
351 
354 
358 
362 
366 
370 
374 
378 
382 
386 
390 
394 
398 
402 
406 
410 
414 
418 
421  GLM_FUNC_DECL half abs(half const & x);
422 
425  GLM_FUNC_DECL hvec2 abs(hvec2 const & x);
426 
429  GLM_FUNC_DECL hvec3 abs(hvec3 const & x);
430 
433  GLM_FUNC_DECL hvec4 abs(hvec4 const & x);
434 
447  GLM_FUNC_DECL half mix(half const & x, half const & y, bool const & a);
448 
450 }// namespace glm
451 
452 #include "half_float.inl"
453 
454 #endif//GLM_GTC_half_float
GLM_FUNC_DECL tvec3< T > & operator=(tvec3< T > const &v)
Definition: type_vec3.inl:233
GLM_FUNC_DECL tvec3< T > & operator++()
Definition: type_vec3.inl:361
Definition: type_vec2.hpp:50
detail::tmat3x2< detail::half > hmat3x2
Definition: half_float.hpp:397
GLM_FUNC_DECL tvec3< T > & operator+=(U const &s)
GLM_FUNC_DECL tvec2< T > & operator+=(U const &s)
tvec4< T > type
Definition: type_vec4.hpp:54
detail::tmat4x3< detail::half > hmat4x3
Definition: half_float.hpp:413
GLM_FUNC_DECL tvec2< T > & operator=(tvec2< T > const &v)
Definition: type_vec2.inl:184
Definition: type_vec3.hpp:50
value_type z
Definition: type_vec3.hpp:92
std::size_t size_type
Definition: type_vec2.hpp:53
GLM_FUNC_DECL tvec2< T > & operator/=(U const &s)
detail::tmat2x4< detail::half > hmat2x4
Definition: half_float.hpp:393
value_type x
Definition: type_vec3.hpp:92
Definition: type_mat2x2.hpp:45
Definition: type_mat2x2.hpp:48
Definition: type_mat2x2.hpp:42
GLM_FUNC_DECL tvec2< T > & operator++()
Definition: type_vec2.inl:302
value_type z
Definition: type_vec4.hpp:93
GLM_FUNC_DECL value_type swizzle(comp X) const
Definition: type_vec3.inl:566
detail::tvec4< detail::half > hvec4
Definition: half_float.hpp:369
GLM_FUNC_DECL tvec4< T > & operator+=(U const &s)
tvec4< bool > bool_type
Definition: type_vec4.hpp:55
Definition: _detail.hpp:38
GLM_FUNC_DECL tvec4< T > & operator++()
Definition: type_vec4.inl:510
GLM_FUNC_DECL tvec3< T > & operator/=(U const &s)
Definition: type_mat2x2.hpp:38
detail::half half
Definition: half_float.hpp:357
detail::tmat3x4< detail::half > hmat3x4
Definition: half_float.hpp:405
GLM_FUNC_DECL tvec2()
Definition: type_vec2.inl:67
GLM_FUNC_DECL value_type swizzle(comp X) const
Definition: type_vec4.inl:706
GLM_FUNC_DECL tvec2< T > & operator*=(U const &s)
GLM_FUNC_DECL tvec2< T > & operator-=(U const &s)
GLM_FUNC_DECL tvec4()
Definition: type_vec4.inl:67
value_type y
Definition: type_vec4.hpp:93
GLM_FUNC_DECL tvec3< T > & operator*=(U const &s)
Definition: type_vec4.hpp:50
detail::tmat4x2< detail::half > hmat4x2
Definition: half_float.hpp:409
detail::tmat3x3< detail::half > hmat3
Definition: half_float.hpp:377
value_type w
Definition: type_vec4.hpp:93
tvec3< bool > bool_type
Definition: type_vec3.hpp:55
tvec3< T > type
Definition: type_vec3.hpp:54
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const
Definition: type_vec4.inl:33
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const
Definition: type_vec2.inl:33
T value_type
Definition: type_vec4.hpp:52
Definition: _swizzle.hpp:45
ctor
Definition: type_vec4.hpp:50
detail::tmat2x2< detail::half > hmat2x2
Definition: half_float.hpp:385
detail::tmat4x4< detail::half > hmat4
Definition: half_float.hpp:381
GLM_FUNC_DECL tvec3()
Definition: type_vec3.inl:67
T value_type
Definition: type_vec2.hpp:52
T value_type
Definition: type_vec3.hpp:52
std::size_t size_type
Definition: type_vec3.hpp:53
GLM_FUNC_DECL genType abs(genType const &x)
Definition: type_mat2x2.hpp:39
Definition: _swizzle.hpp:44
ctor
Definition: type_vec3.hpp:50
tvec2< T > type
Definition: type_vec2.hpp:54
GLM_FUNC_DECL value_type & operator[](size_type i)
Definition: type_vec4.inl:44
Definition: type_mat2x2.hpp:44
Definition: type_mat2x2.hpp:47
Definition: type_mat2x2.hpp:41
GLM_FUNC_DECL tvec4< T > & operator/=(U const &s)
GLM_FUNC_DECL tvec3< T > & operator-=(U const &s)
value_type x
Definition: type_vec2.hpp:91
Definition: type_half.hpp:42
Definition: _swizzle.hpp:48
GLM_FUNC_DECL tvec4< T > & operator=(tvec4< T > const &v)
Definition: type_vec4.inl:372
GLM_FUNC_DECL value_type & operator[](size_type i)
Definition: type_vec3.inl:44
GLM_FUNC_DECL tvec4< T > & operator*=(U const &s)
detail::tmat4x4< detail::half > hmat4x4
Definition: half_float.hpp:417
ctor
Definition: type_vec2.hpp:50
GLM_FUNC_DECL value_type & operator[](size_type i)
Definition: type_vec2.inl:44
Definition: type_mat2x2.hpp:40
value_type y
Definition: type_vec2.hpp:91
detail::tmat2x2< detail::half > hmat2
Definition: half_float.hpp:373
detail::tvec3< detail::half > hvec3
Definition: half_float.hpp:365
detail::tmat2x3< detail::half > hmat2x3
Definition: half_float.hpp:389
value_type x
Definition: type_vec4.hpp:93
GLM_FUNC_DECL tvec3< T > & operator--()
Definition: type_vec3.inl:370
GLM_FUNC_DECL genTypeT mix(genTypeT const &x, genTypeT const &y, genTypeU const &a)
GLM_FUNC_DECL value_type swizzle(comp X) const
Definition: type_vec2.inl:492
tvec2< bool > bool_type
Definition: type_vec2.hpp:55
value_type y
Definition: type_vec3.hpp:92
Definition: _swizzle.hpp:47
detail::tvec2< detail::half > hvec2
Definition: half_float.hpp:361
detail::tmat3x3< detail::half > hmat3x3
Definition: half_float.hpp:401
GLM_FUNC_DECL tvec4< T > & operator--()
Definition: type_vec4.inl:520
Definition: type_mat2x2.hpp:46
Definition: type_mat2x2.hpp:49
Definition: type_mat2x2.hpp:43
comp
Definition: _swizzle.hpp:36
GLM_FUNC_DECL tvec2< T > & operator--()
Definition: type_vec2.inl:310
#define GLM_FUNC_DECL
Definition: setup.hpp:678
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const
Definition: type_vec3.inl:33
Definition: _swizzle.hpp:38
GLM_FUNC_DECL tvec4< T > & operator-=(U const &s)
Definition: _swizzle.hpp:41
std::size_t size_type
Definition: type_vec4.hpp:53