0.9.9 API documenation
range.hpp
Go to the documentation of this file.
1 
13 #pragma once
14 
15 // Dependencies
16 #include "../detail/setup.hpp"
17 
18 #ifndef GLM_ENABLE_EXPERIMENTAL
19 # error "GLM: GLM_GTX_range is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
20 #endif
21 
22 #if !GLM_HAS_RANGE_FOR
23 # error "GLM_GTX_range requires C++11 suppport or 'range for'"
24 #endif
25 
26 #include "../gtc/type_ptr.hpp"
27 #include "../gtc/vec1.hpp"
28 
29 namespace glm
30 {
33 
34  template<typename T, qualifier Q>
35  inline length_t components(vec<1, T, Q> const& v)
36  {
37  return v.length();
38  }
39 
40  template<typename T, qualifier Q>
41  inline length_t components(vec<2, T, Q> const& v)
42  {
43  return v.length();
44  }
45 
46  template<typename T, qualifier Q>
47  inline length_t components(vec<3, T, Q> const& v)
48  {
49  return v.length();
50  }
51 
52  template<typename T, qualifier Q>
53  inline length_t components(vec<4, T, Q> const& v)
54  {
55  return v.length();
56  }
57 
58  template<typename genType>
59  inline length_t components(genType const& m)
60  {
61  return m.length() * m[0].length();
62  }
63 
64  template<typename genType>
65  inline typename genType::value_type const * begin(genType const& v)
66  {
67  return value_ptr(v);
68  }
69 
70  template<typename genType>
71  inline typename genType::value_type const * end(genType const& v)
72  {
73  return begin(v) + components(v);
74  }
75 
76  template<typename genType>
77  inline typename genType::value_type * begin(genType& v)
78  {
79  return value_ptr(v);
80  }
81 
82  template<typename genType>
83  inline typename genType::value_type * end(genType& v)
84  {
85  return begin(v) + components(v);
86  }
87 
89 }//namespace glm
Definition: common.hpp:20
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &v)
Return the constant address to the data of the input parameter.