| 0.9.9 API documenation

- Main Page
- Modules
- Files

- File List

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 # if GLM_COMPILER & GLM_COMPILER_VC
35 # pragma warning(push)
36 # pragma warning(disable : 4100) // unreferenced formal parameter
37 # endif
38
39 template<typename T, qualifier Q>
40 inline length_t components(vec<1, T, Q> const& v)
41 {
42 return v.length();
43 }
44
45 template<typename T, qualifier Q>
46 inline length_t components(vec<2, T, Q> const& v)
47 {
48 return v.length();
49 }
50
51 template<typename T, qualifier Q>
52 inline length_t components(vec<3, T, Q> const& v)
53 {
54 return v.length();
55 }
56
57 template<typename T, qualifier Q>
58 inline length_t components(vec<4, T, Q> const& v)
59 {
60 return v.length();
61 }
62
63 template<typename genType>
64 inline length_t components(genType const& m)
65 {
66 return m.length() * m[0].length();
67 }
68
69 template<typename genType>
70 inline typename genType::value_type const * begin(genType const& v)
71 {
72 return value_ptr(v);
73 }
74
75 template<typename genType>
76 inline typename genType::value_type const * end(genType const& v)
77 {
78 return begin(v) + components(v);
79 }
80
81 template<typename genType>
82 inline typename genType::value_type * begin(genType& v)
83 {
84 return value_ptr(v);
85 }
86
87 template<typename genType>
88 inline typename genType::value_type * end(genType& v)
89 {
90 return begin(v) + components(v);
91 }
92
93 # if GLM_COMPILER & GLM_COMPILER_VC
94 # pragma warning(pop)
95 # endif
96
98 }//namespace glm
glm::value_ptr
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &v)
Return the constant address to the data of the input parameter.
glm
Definition: common.hpp:20